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
Check session expiration date
def fresh?( ses_obj ) return true if ses_obj['expire'] == 0 now = Time.now ses_obj['expire'] >= now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_expired?\n ! (Time.now < session[:expire_at])\n end", "def session_valid?\n @session_expiry_time > Time.now if @session_expiry_time\n end", "def session_valid?\n @session_expiry_time > Time.now if @session_expiry_time\n end", "def session_expired?\n if session[:last_authenticated_action_at]\n session_expires_at = session[:last_authenticated_action_at] + (60 * 60 * SESSION_HOURS)\n session_expires_at < Time.now\n else\n false\n end\n end", "def session_expiry\n reset_session if session[:expiry_time] and session[:expiry_time] < Time.now\n\n session[:expiry_time] = MAX_SESSION_PERIOD.seconds.from_now\n return true\n end", "def expired_session?\n if session_info.nil?\n false\n else\n creds = session_info['credentials']\n creds['expires'] && creds['expires_at'] <= Time.now.to_i\n end\n end", "def check_session_expiry\n manage_session_expiry(ReferenceData::SystemParameter.lookup('PWS', 'SYS', 'RSTU', safe_lookup: true))\n end", "def session_expiry\n unless session[:expires_at].nil?\n @time_left = (session[:expires_at] - Time.now).to_i\n unless @time_left > 0 \n logout_killing_session!\n gflash :notice => 'Your session expired. Please, login again.'\n redirect_to login_url\n end \n end \n end", "def session_expiry\n @session_expiry ||= 30 * 24 * 60 * 60\n end", "def expiry_time\n session[:expires_at] || 3.days.from_now\n end", "def session_expiry\n unless session[:expires_at].nil?\n @time_left = (session[:expires_at] - Time.now).to_i\n unless @time_left > 0\n logout_killing_session!\n flash[:error] = 'Your session expired. Please, login again.'\n redirect_to login_url\n end\n end\n end", "def session_expired?\n return remote_user_name.nil? if remote_auth?\n return true if session[:timeout].nil?\n\n Time.zone.parse(session[:timeout]) < Time.current\n end", "def session_expires_at\n @expires_at ||= begin\n node = REXML::XPath.first(document, \"/p:Response/a:Assertion/a:AuthnStatement\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n parse_time(node, \"SessionNotOnOrAfter\")\n end\n end", "def session_expires_at\n @expires_at ||= begin\n node = REXML::XPath.first(document, \"/p:Response/a:Assertion/a:AuthnStatement\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n Time.parse(node.attributes[\"SessionNotOnOrAfter\"]) if node && node.attributes[\"SessionNotOnOrAfter\"]\n end\n end", "def expired?\n Date.today > self.expires_on\n end", "def expired?\n expiration_date <= Time.now\n end", "def expired?(expiration_date)\n Date.today.beginning_of_day >= expiration_date.beginning_of_day\n end", "def expired?\n Time.now > expiration if expiration\n end", "def expired?\n expires_at && Time.now > expires_at\n end", "def has_infinite_expiration?\n expiredate > Time.now+60*60\n end", "def expired?\n DateTime.now.utc >= self.expires_at\n end", "def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end", "def expired?\n expires_at && expires_at <= Time.now\n end", "def expired?\n Time.zone.today > expires_at\n end", "def expired?\n self.expires_at && Time.now > self.expires_at\n end", "def expired?\n exp < Time.now.to_i\n end", "def is_valid?\n \tDateTime.now < self.expires_at\n end", "def session_expires_at\n @expires_at ||= Time.parse(document.elements[\"/samlp:Response/saml:Assertion/saml:AuthnStatement\"].attributes[\"SessionNotOnOrAfter\"])\n end", "def session_expires_at\n @expires_at ||= Time.parse(document.elements[\"/samlp:Response/saml:Assertion/saml:AuthnStatement\"].attributes[\"SessionNotOnOrAfter\"])\n end", "def expired?\n if expires?\n Time.now >= expires_at\n else\n false\n end\n end", "def expired?\n !expiration_date || expiration_date <= Date.today\n end", "def expiring?\n return true if expires - Time.now < 60\n return false\n end", "def expired?\n Time.current >= expires_at\n end", "def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def session_expiry\n get_session_time_left\n unless @session_time_left > 0\n # Commented this out as this was showing when the server comes up after being idle\n # If a user's session times out, the user is shown the message in sessions_helper.rb, deny_access method\n # flash.now[:error] = \"Your session has timed out or you haven't logged in. Please log in.\"\n sign_out\n \n end\n end", "def is_valid?\n DateTime.now < self.expires_at\n end", "def session_expired?\n return true unless !session[:timeout].nil?\n if MarkusConfigurator.markus_config_remote_user_auth\n return true if @markus_auth_remote_user.nil?\n # Expire session if remote user does not match the session's uid\n current_user = User.find_by_id(session[:uid])\n if !current_user.nil?\n return true if ( current_user.user_name != @markus_auth_remote_user )\n end\n end\n return session[:timeout] < Time.now\n end", "def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end", "def manage_session_expiry(sys_params)\n # initialise the session values using failover values if needed\n max_idle_mins = default_ttl_value(sys_params['MAX_IDLE_MINS'], 60)\n update_ttl(:SESSION_TTL_INDEX, max_idle_mins, false)\n update_ttl(:MAX_SESSION_EXPIRE_TIME_INDEX, default_ttl_value(sys_params['MAX_SESS_MINS'], 600), false)\n\n # check if it's expired and show session ended page\n redirect_to logout_session_expired_path if session_has_expired\n\n session_ttl_warning(max_idle_mins, sys_params['IDLE_WARN_MINS'])\n\n # user has done something so update session TTL\n update_ttl(:SESSION_TTL_INDEX, max_idle_mins, true)\n end", "def check_session\n session.delete(\"accepted\") if session[:updated_at].present? && session[:updated_at].to_time <= 10.minutes.ago\n end", "def expired?\n Time.now.in_time_zone > expires_at\n end", "def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end", "def expired?\n return self.expires_on < Date.today if self.expires_on\n true\n end", "def expired?\n @expires_at <= Time.now\n end", "def expired?\n Time.now > @expires\n end", "def expired?\n return false unless expires_at\n expires_at < Time.now\n end", "def expired?\n age > ttl\n end", "def expired?\n age > ttl\n end", "def expired?\n Time.now > @expiration if @expiration\n end", "def expired?\n DateTime.now > @expires\n end", "def expired?\n expires? && (expires_at < Time.now.to_i)\n end", "def session_timeout\n #return if Rails.env.test?\n #check session last_seen\n if session[:last_seen] < SESSION_TIMEOUT_MINUTES.minutes.ago\n reset_session\n else\n session[:last_seen] = Time.now.utc\n end unless session[:last_seen].nil?\n #check when session created\n if Session.first.created_at < SESSION_WIPEOUT_HOURS.hours.ago\n Session.sweep\n end unless Session.first.nil?\n end", "def check_cert_expiring\n cert = certificate_get\n expire_date = cert.not_after\n\n now = Time.now\n # Calculate the difference in time (seconds) and convert to hours\n hours_until_expired = (expire_date - now) / 60 / 60\n\n if hours_until_expired < resource[:regenerate_ttl]\n true\n else\n false\n end\n end", "def cached_daw_session_valid?\n login_time_set = rdaw_session.include?(:login_time)\n session_age = Time.now - Time.parse(rdaw_session[:login_time]) if login_time_set\n is_valid = login_time_set && session_age < session_timeout\n\n logger.debug('[rdaw] session expired or invalid') unless is_valid\n cookie_changed = hashcookie != rdaw_session[:hash]\n logger.debug(\"[rdaw] session invalidated because #{daw_cookie_name} cookie changed\") if cookie_changed\n\n is_valid && !cookie_changed\n end", "def expired?\n @expires_in && @created_at + @expires_in <= Time.now.to_f\n end", "def expired?\n !expires_at.nil? && Time.now >= expires_at\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def verify_expiration; end", "def verify_expiration; end", "def has_default_expiration?\n expiredate < Time.now+60*60+60 # The last 60seconds are for safety\n end", "def expired?\n return true if authentication.nil?\n\n authentication.expires_at < 2.days.from_now\n end", "def session_expiry\n @time_left = (expiry_time - Time.now).to_i\n do_flash = false\n unless @time_left > 0\n unless current_user_session.nil?\n current_user_session.destroy\n do_flash = true\n end\n reset_session\n store_location\n flash[:notice] = t('app.security.session_expired',\n :default => \"Your session has been expired by inactivity.\") if do_flash\n redirect_to new_session_url\n end\n end", "def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end", "def expiration_date_valid?\n expiration_date.is_a? Date\n end", "def expired?(now)\n @expires_at <= now\n end", "def session_expired?\n return true if session[:timeout].nil?\n if Settings.remote_user_auth\n # expire session if there is not REMOTE_USER anymore.\n return true if @markus_auth_remote_user.nil?\n # If somebody switched role this state should be recorded\n # in the session. Expire only if session timed out.\n unless session[:real_uid].nil?\n # Roles have been switched, make sure that\n # real_user.user_name == @markus_auth_remote_user and\n # that the real user is in fact an admin.\n real_user = User.find_by_id(session[:real_uid])\n if real_user.user_name != @markus_auth_remote_user ||\n !real_user.admin?\n return true\n end\n # Otherwise, expire only if the session timed out.\n return Time.zone.parse(session[:timeout]) < Time.current\n end\n # Expire session if remote user does not match the session's uid.\n # We cannot have switched roles at this point.\n current_user = User.find_by_id(session[:uid])\n unless current_user.nil?\n return true if current_user.user_name != @markus_auth_remote_user\n end\n end\n # No REMOTE_USER is involed.\n Time.zone.parse(session[:timeout]) < Time.current\n end", "def expired?\n end", "def expired?\n can_expire? && @expiry < Time.now.to_i\n end", "def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end", "def expired?\n Time.now > valid_until\n end", "def expired?\n expires? && (Time.now > expires_at)\n end", "def expired?\n self.expires_on? and self.expires_on < Time.now\n end", "def prepare_session\n if !session[:expiry_time].nil? and session[:expiry_time] < Time.now\n reset_session\n end\n\n session[:expiry_time] = MAX_SESSION_TIME.minutes.from_now\n return true\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end", "def add_expiry_date!(session_data)\n if session_length\n session_data[:expiry_date] = DateTime.current + session_length\n end\n end", "def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end", "def has_expired?(date)\n # The event will expires 2 hours after is date\n Time.parse(date).to_f < Time.now.to_f - 2.hours.to_i\n rescue TypeError\n true\n end", "def token_expired?\n self.expires < Time.zone.now.to_i\n end", "def expired?\n expires && expires < Time.now\n end", "def expired?\n\n end", "def expires_within? sec\n !expires_at.nil? && Time.now >= (expires_at - sec)\n end", "def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end", "def expired?\n false\n end", "def is_expired(datetime=nil)\n unless datetime\n datetime = Time.zone.now\n end\n \n if self.expiration_date < datetime\n return true\n else\n return false\n end\n end", "def expired?\n return true if expires - Time.now <= 0\n return false\n end", "def expiration\n @expiration ||= 60 * 60 * 24 * 30 # 30 days\n end", "def check_session_time\n if !Rails.env.test? && @current_user && (@current_user.current_sign_in_at + 8.hours) < Time.now\n sign_out @current_user\n unless request[:path] == root_path\n redirect_to new_user_session_path\n end\n end\n end", "def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend", "def expiration_date\n end", "def session_valid?(session_key)\n session = reviewer_access_sessions.by_session_key(session_key)\n session.present? ? !session.expired? : false\n end", "def request_expired?\n parsed_timestamp < request_expires_at\n end", "def expires?\n !!expires_at\n end", "def expired?\n created_at < 14.days.ago && updated_at < 14.days.ago\n end", "def valid_upto\n GlobalConstant::Cookie.single_auth_expiry\n end", "def expired?\n @expiry_time < Time.now\n end", "def valid_upto\n GlobalConstant::Cookie.password_auth_expiry\n end" ]
[ "0.8122333", "0.8054441", "0.7965012", "0.7849204", "0.7798527", "0.7768935", "0.77251244", "0.7589307", "0.757776", "0.757286", "0.7566193", "0.75636715", "0.7481382", "0.7469987", "0.7342385", "0.72825533", "0.72720116", "0.72573155", "0.72456646", "0.7242692", "0.7237066", "0.72140443", "0.72057915", "0.71971595", "0.7171164", "0.7154116", "0.71450925", "0.7144565", "0.7144565", "0.7141073", "0.71217906", "0.7118359", "0.7117341", "0.71132267", "0.70994645", "0.70994645", "0.7098942", "0.709662", "0.7091205", "0.7089955", "0.708406", "0.7060763", "0.705266", "0.705247", "0.7049968", "0.70395947", "0.7025425", "0.7024572", "0.701036", "0.701036", "0.7008566", "0.69999605", "0.69944286", "0.69909376", "0.6977117", "0.6936685", "0.69324654", "0.69232035", "0.69221133", "0.69221133", "0.69209427", "0.69209427", "0.69177985", "0.69106525", "0.6903979", "0.68978035", "0.6880352", "0.68801415", "0.6875282", "0.6868658", "0.6863066", "0.6854558", "0.6854367", "0.6840292", "0.6832223", "0.682584", "0.6822603", "0.6822603", "0.6815977", "0.6811703", "0.68110424", "0.6806241", "0.6791722", "0.6782743", "0.6778369", "0.6772685", "0.67683053", "0.67631006", "0.6761473", "0.6756268", "0.67519224", "0.67484087", "0.67444116", "0.6739999", "0.673013", "0.67215484", "0.67214674", "0.6718613", "0.6714248", "0.67071337" ]
0.6762989
88
Clean out all expired sessions
def clean_expired! sessions.remove( { :expire => { '$lt' => Time.now } } ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end", "def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting })\n begin\n count = CacheStore.cleanup(ttl: SESSION_TTL)\n logger.info(\"Deleted #{count} expired sessions.\", :cleanup, { state: :success, count: count })\n rescue StandardError => e\n logger.info(\"Failed to clean up expired sessions.\", :cleanup, { state: :error, message: e.message })\n\n # Reraise (calling `raise` without arguments will reraise last error)\n raise\n end\n end", "def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end", "def cleanup\n Authie.notify(:cleanup) do\n # Invalidate transient sessions that haven't been used\n active.where('expires_at IS NULL AND last_activity_at < ?',\n Authie.config.session_inactivity_timeout.ago).each(&:invalidate!)\n # Invalidate persistent sessions that have expired\n active.where('expires_at IS NOT NULL AND expires_at < ?', Time.now).each(&:invalidate!)\n end\n true\n end", "def cleanup_sessions\n @mutex.synchronize { @sessions.garbage_collect }\n end", "def clear_session\n Mack::SessionStore.expire_all\n end", "def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end", "def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end", "def cleanup\n\t\tcurrent_time = current_date_time\n\n\t\tputs current_time\n\n\t\t# delete all sessions that are older than 30 minutes\n\t\tActiveRecord::Base.connection.execute(\"DELETE FROM sessions WHERE updated_at < '#{current_time}'\")\n\tend", "def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end", "def clean_sessions\n self.log_puts(\"Cleaning sessions on appserver.\") if @debug\n \n #Clean up various inactive sessions.\n session_not_ids = []\n time_check = Time.now.to_i - 300\n @sessions.delete_if do |session_hash, session_data|\n session_data[:dbobj].flush\n \n if session_data[:dbobj].date_lastused.to_i > time_check\n session_not_ids << session_data[:dbobj].id\n false\n else\n true\n end\n end\n \n self.log_puts(\"Delete sessions...\") if @debug\n @ob.list(:Session, {\"id_not\" => session_not_ids, \"date_lastused_below\" => (Time.now - 5356800)}) do |session|\n idhash = session[:idhash]\n self.log_puts(\"Deleting session: '#{session.id}'.\") if @debug\n @ob.delete(session)\n @sessions.delete(idhash)\n end\n \n #Clean database weak references from the tables-module.\n @db.clean\n \n #Clean the object-handler.\n @ob.clean_all\n \n #Call various user-connected methods.\n @events.call(:on_clean) if @events\n end", "def reset_sessions\n reset_session_expired_at\n @application_session.update_attributes(\n :expired_at=>session_expired_at\n )\n end", "def clear_expired(request)\n entries_for(request)\n .where {|t| t.created_at < Time.now - ttl }\n .delete\n end", "def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end", "def clear_sessions\n session.keys.each do |key|\n session.delete(key) if key =~ /ranmemory_/\n end\n end", "def remove_old_sessions\n candidates = find_old_sessions\n candidates.destroy_all\nend", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def sessions_reset\n self.sessions_flush\n @sessions = {}\n end", "def cleanup\n @session_id = nil\n end", "def delete_all_expired_for(time)\n expired_for(time).delete_all\n end", "def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end", "def invalidate_session\n @sequence = 0\n @session_id = nil\n end", "def sign_out_expired_session\n return unless current_user.present?\n return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago\n\n current_user.update last_sign_in_check: Time.now\n\n if UniversumSsoClient.signed_out?(current_user.uid)\n session[:user_id] = nil\n @current_user = nil\n clear_iris_session\n end\n end", "def clear_session\n session[:timeout] = nil\n session[:user_name] = nil\n session[:real_user_name] = nil\n session[:job_id] = nil\n session[:auth_type] = nil\n cookies.delete :auth_token\n reset_session\n end", "def clear_upstream_sessions\n upstream_sessions.delete_all\n end", "def cleanup_expired_events\n cleanup_script(keys: @event_list.key, argv: expires_at)\n end", "def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend", "def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end", "def clear_session\n session.clear\n end", "def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end", "def destroy\n @session.clear\n end", "def clear_session\n\t\tsession.clear\n\tend", "def clear_all_reviewer_sessions!\n reviewer_access_sessions.delete_all\n end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def cleanup(session = false)\n # if session\n # select { |cookie| cookie.session? || cookie.expired? }\n # else\n # select(&:expired?)\n # end.each { |cookie|\n # delete(cookie)\n # }\n # # subclasses can optionally remove over-the-limit cookies.\n # self\n end", "def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end", "def clear_any_logged_in_session\n if logged_in?\n session[:user] = nil\n session[:user_id] = nil\n current_agent = nil\n end\n end", "def expire_all\n adapter.expire_all\n logger.info('', '', :expired, cache_name)\n end", "def reset\n @redis_sessions = nil\n end", "def clear_session\n Rails.logger.debug('SSO: ApplicationController#clear_session', sso_logging_info)\n\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n end", "def clear_session_keys\n ActiveRecord::Base.clear_session_keys\n end", "def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end", "def purge_expired_schedules\n _schedules = Schedule.where('student_id = ? AND end_date < ?', @student.id, Date.today)\n _schedules.each {|s| s.destroy}\n\n redirect_to @student, notice: 'Expired schedules have been deleted'\n end", "def clear\n with_config do\n self.storage.delete_expired_tempfiles\n end\n end", "def log_out\n # current_user.created_lists.where(\"name is null\").delete_all\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n @current_list = nil\n # @current_team = nil\n cookies.signed[:id] = nil\n session[:current_date]=nil\n session[:list_id]=nil\n\n end", "def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end", "def flush_expired!\n Dir[ File.join( store, \"*.cache\" ) ].each do |f|\n if (File.mtime(f)+timeout) <= Time.now\n File.delete(f)\n end\n end\n @gc_last = Time.now\n end", "def reset_session_expiry\n ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 1.hour.from_now)\n end", "def clear_session\n @session = @login_info = nil\n end", "def logout_killing_session!\n logout_keeping_session!\n reset_session\n end", "def clear_cookie\n create_accesses_cookie\n end", "def purge_expired_workers\n @services.purge_expired_workers\n end", "def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end", "def cleanup\n return if @max_age == 0\n timeout = Time.now - @max_age\n conditions = ['last_send_attempt > 0 and created_on < ?', timeout]\n mail = ActionMailer::Base.email_class.destroy_all conditions\n\n log \"expired #{mail.length} emails from the queue\"\n end", "def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end", "def expire_all\n true\n end", "def logout_killing_session!\n logout_keeping_session!\n reset_session\n end", "def clear_session\n session[:user_id] = nil\n cookies[:user_id] = nil\n cookies[:password_hash] = nil\n end", "def clear_session\n session[:int_key] = nil\n session[:email] = nil\n session[:password] = nil\n session[:account_id] = nil\n redirect_to root_url\n end", "def expire_tokens!\n update_tokens(nil)\n end", "def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end", "def destroy\n warden.logout\n @session.destroy\n head :no_content\n end", "def session_expired\n @current_action = self.action_name\n @current_controller = self.controller_name\n return if @current_controller == 'sessions' && @current_action == 'create'\n if !session[:id].blank?\n @application_session = Session.find_by_id(session[:id])\n end\n current_user = self.current_user\n if session_expired_at.blank?\n @time_left=0\n else\n# logger.info \"ApplicationController#session_expired_at#timeleft #{session_expired_at}\"\n# logger.info \"ApplicationController#time.zone.now #{Time.zone.now}\"\n @time_left = (session_expired_at - Time.zone.now).to_i\n end\n# logger.info \"ApplicationController#session_expired #{@time_left}\"\n if @time_left<=0\n #reset_session\n #flash[:error] = 'Session Expired.'\n# logger.info \"ApplicationController#session_expired #redirect_to #{@time_left}\"\n if !session[:id].blank?\n Session.destroy(@application_session)\n session[:id] = nil\n end\n #Session.destroy(params[:id])\n logout_killing_session!\n respond_to do |format|\n format.html do\n flash[:notice] = \"Your session has been expired!\"\n redirect_back_or_default('/')\n end\n #format.fxml { render :text => \"loggedout\" }\n format.xml { render :text => \"sessionexpired\"}\n end\n #Session.destroy(@application_session);\n #render_component :controller => 'sessions', :action => 'destroy', :expired => true\n \n #return redirect_to :controller => 'sessions', :action => 'destroy'\n else\n reset_sessions\n end\n end", "def clear_session\n rails_controller_instance.reset_session\n end", "def expire_all\n FileUtils.rm_rf(Dir.glob(\"#{@config[:cache_directory]}/*\"))\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def invalidate_all!\n FileUtils.rm_r(@cache_path, force: true, secure: true)\n end", "def clear_session_keys() #:nodoc:\n @@session_keys.clear\n end", "def reset_session\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n cookies.delete(Settings.sso.cookie_name, domain: Settings.sso.cookie_domain)\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n super\n end", "def clear_session\n session[:player_id] = nil\n cookies[:player_id] = nil\n cookies[:password_hash] = nil\n end", "def delete_all_cookies; end", "def logout!\n session.clear\n end", "def clear_session\n session.delete(:token)\n redirect to('/')\n end", "def delete_session\n @env['java.servlet_request'].session.invalidate\n end", "def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end", "def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end", "def kill_session\n @authenticator.kill_session\n @session = ''\n end", "def expire_all\n @memcache.flush_all\n stop_tracking_keys\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def collect_garbage(options = {})\n config = load_config(options)\n last_key = eliminate_unwanted_sessions(config)\n while !last_key.empty?\n last_key = eliminate_unwanted_sessions(config, last_key)\n end\n end", "def remove_expired_rooms!\n @rooms.reject! do |name, room|\n @logger.info \"Removing expired room #{name}.\" if room.expired?\n room.expired?\n end\n end", "def destroy\n session.clear\n\n redirect_to root_url\n end", "def expire_caches\n expired_cache = \"expired_cache.#{Time.now.to_f}\"\n Dir.chdir(\"#{Rails.root}/tmp\") do\n FileUtils.mv('cache', expired_cache, :force => true)\n FileUtils.rm_rf(expired_cache)\n end\n end", "def destroy\r\n session.clear\r\n redirect_to root_path\r\n end", "def invalidate!\n self.active = false\n self.save!\n if controller\n cookies.delete(:user_session)\n end\n end", "def delete_expired_tempfiles\n return if !self.config.clean_up? || !self.config.enabled?\n log \"CloudTempfile.delete_expired_tempfiles is running...\"\n # Delete expired temp files\n fog_files = (self.config.local?)? local_root.files : get_remote_files\n fog_files.each do |file|\n if file.last_modified <= Time.now.utc.ago(self.config.clean_up_older_than)\n delete_file(file)\n end\n end\n log \"CloudTempfile.delete_expired_tempfiles is complete!\"\n end", "def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\tend", "def logout!\n session.clear\n end", "def logout!\n session.clear\n end", "def remove_old_sessions_in_group\n candidates = find_old_sessions\n candidates.where(group: @group).destroy_all\nend", "def delete_all_cookies\n @browser.clear_cookies\n end", "def signout\n session.clear\n end", "def purge_expired_keys\n Thread.new do\n loop do\n sleep PURGE_EXPIRED_KEYS_FREQUENCY_SECS\n puts 'Purging expired keys...'\n @cache_handler.purge_expired_keys\n end\n end\n end", "def logout\n current_user.reset_session_token\n session[:session_token] = nil\n end", "def destroy\n\t\t# reset_session will kill the existing session\n\t\treset_session\n\t\tredirect_to '/login'\n\tend", "def logout_killing_session!(class_name)\n logout_keeping_session!(class_name)\n reset_session\n end", "def session_reset_timeout! \n session[:expire_at] = Time.now + MAX_SESSION_TIME.seconds\n end" ]
[ "0.8176167", "0.8085375", "0.7972365", "0.77706915", "0.77485996", "0.77153325", "0.7592844", "0.7592844", "0.75311095", "0.74809927", "0.74503034", "0.74231356", "0.7334813", "0.73153824", "0.72658134", "0.723724", "0.7180697", "0.7180697", "0.7098137", "0.70691824", "0.706229", "0.7037688", "0.6994047", "0.6985358", "0.69748056", "0.6930278", "0.6897027", "0.68667567", "0.6800163", "0.6757771", "0.67569476", "0.6746873", "0.6740606", "0.6714731", "0.66547555", "0.6632278", "0.6603901", "0.65891623", "0.6589147", "0.65862054", "0.65861756", "0.6585036", "0.6572626", "0.6556981", "0.6549399", "0.65462893", "0.6521648", "0.65074813", "0.6505117", "0.6498782", "0.6492766", "0.6487854", "0.64790744", "0.6476812", "0.64539295", "0.6453387", "0.6452093", "0.6435708", "0.64295167", "0.64258736", "0.64056236", "0.64035296", "0.6400185", "0.63635", "0.636167", "0.63461095", "0.63389164", "0.6333683", "0.6333166", "0.63326573", "0.6331057", "0.63172156", "0.6313542", "0.6304153", "0.6301378", "0.6301378", "0.629821", "0.6286764", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62575406", "0.62559634", "0.62557584", "0.6247631", "0.623781", "0.6233306", "0.6232037", "0.6230438", "0.62225336", "0.62225336", "0.6221613", "0.6217149", "0.62087244", "0.6208248", "0.6203097", "0.61844414", "0.6176589", "0.61720514" ]
0.8575099
0
parse server description string into host, port, db, cltn
def parse_server_desc( desc ) tokens = desc.split( "/" ) raise "Invalid server description" unless tokens.size == 3 server_desc = tokens[0].split( ":" ) raise "Invalid host:port description" unless server_desc.size == 2 return server_desc.first, server_desc.last.to_i, tokens[1], tokens[2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n hsh = {}\n tuples.map do |(vrf, host, prefer, minpoll, maxpoll, sourcei, key)|\n hsh[host] = {\n vrf: vrf,\n prefer: !prefer.nil?,\n minpoll: minpoll.nil? ? nil : minpoll.to_i,\n maxpoll: maxpoll.nil? ? nil : maxpoll.to_i,\n source_interface: sourcei,\n key: key.nil? ? nil : key.to_i\n }\n hsh[host]\n end\n\n { servers: hsh }\n end", "def servers\n tuples = config.scan(SERVER_REGEXP)\n tuples.map do |(host, mplex, vrf, port, tout, keyfm, key)|\n hsh = {}\n hsh[:hostname] = host\n hsh[:vrf] = vrf\n hsh[:port] = port.to_i\n hsh[:timeout] = tout.to_i\n hsh[:key_format] = keyfm.to_i\n hsh[:key] = key\n hsh[:multiplex] = mplex ? true : false\n hsh\n end\n end", "def parse_name_servers\n servers = config.scan(/(?:ip name-server vrf )(?:\\w+)\\s(.+)/)\n values = servers.each_with_object([]) { |srv, arry| arry << srv.first }\n { name_servers: values }\n end", "def parse_connect( data )\n hostname, val = data.split(\"\\0\", 2)\n family = val[0].unpack('C')\n port = val[1...3].unpack('n')\n address = val[3..-1]\n return [hostname, family, port, address]\n end", "def parse_server(server)\n name = nil\n options = {}\n\n case server\n when Symbol, String\n name = server.to_sym\n when Hash\n unless server.has_key?(:name)\n raise(MissingOption,\"the 'server' option must contain a 'name' option for which server to use\",caller)\n end\n\n if server.has_key?(:name)\n name = server[:name].to_sym\n end\n\n if server.has_key?(:options)\n options.merge!(server[:options])\n end\n end\n\n return [name, options]\n end", "def mssql_ping_parse(data)\n\t\tres = {}\n\t\tvar = nil\n\t\tidx = data.index('ServerName')\n\t\treturn res if not idx\n\n\t\tdata[idx, data.length-idx].split(';').each do |d|\n\t\t\tif (not var)\n\t\t\t\tvar = d\n\t\t\telse\n\t\t\t\tif (var.length > 0)\n\t\t\t\t\tres[var] = d\n\t\t\t\t\tvar = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn res\n\tend", "def mssql_ping_parse(data)\n\t\tres = {}\n\t\tvar = nil\n\t\tidx = data.index('ServerName')\n\t\treturn res if not idx\n\n\t\tdata[idx, data.length-idx].split(';').each do |d|\n\t\t\tif (not var)\n\t\t\t\tvar = d\n\t\t\telse\n\t\t\t\tif (var.length > 0)\n\t\t\t\t\tres[var] = d\n\t\t\t\t\tvar = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn res\n\tend", "def parse_servers(config, type)\n case type\n when 'radius' then parse_radius_server(config)\n when 'tacacs+' then parse_tacacs_server(config)\n end\n end", "def mssql_parse_info(data, info)\n\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\tbuff = data.slice!(0,len)\n\n\t\terrno,state,sev,elen = buff.slice!(0,8).unpack('VCCv')\n\t\temsg = buff.slice!(0,elen * 2)\n\t\temsg.gsub!(\"\\x00\", '')\n\n\t\tinfo[:infos]||= []\n\t\tinfo[:infos] << \"SQL Server Info ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n\t\tinfo\n\tend", "def parse_hostname(config)\n mdata = /(?<=^hostname\\s)(.+)$/.match(config)\n { hostname: mdata.nil? ? '' : mdata[1] }\n end", "def _parse(string)\n context = Hash[string.scan(/^(.*): (.*)$/)]\n @conn_context = {}\n context.each do |key, value|\n @conn_context[key.downcase.to_sym] = value\n end\n end", "def test_config_string\n client.config(\"int et1/1\\ndescr panda\\n\")\n run = client.show('show run int et1/1')\n desc = run.match(/description (.*)/)[1]\n assert_equal(desc, 'panda')\n end", "def test_config_string\n client.config(\"int et1/1\\ndescr panda\\n\")\n run = client.show('show run int et1/1')\n desc = run.match(/description (.*)/)[1]\n assert_equal(desc, 'panda')\n end", "def inspect_server(server)\n strings = [server.hostname]\n if !is_unix_socket?(server)\n strings << \":#{server.port}\"\n strings << \":#{server.weight}\" if options[:ketama_weighted]\n end\n strings.join\n end", "def serverDetails( port )\n @port = port\n end", "def serverDetails( port )\n @port = port\n end", "def parse_connect_string(string)\n #This is a stub, used for indexing\n end", "def servers\n @config['servers'].map { |server| server.split(/:/) }\n end", "def parse_tacacs_server(config)\n values = config.scan(TACACS_GROUP_SERVER).map do |(name, vrf, port)|\n {\n name: name,\n vrf: vrf,\n port: port\n }\n end\n { servers: values }\n end", "def raw_host_with_port; end", "def parsed_host\n sockets = new_resource.host.split if new_resource.host.is_a?(String)\n sockets = new_resource.host if new_resource.host.is_a?(Array)\n r = []\n sockets.each do |s|\n if s.match(/^unix:/) || s.match(/^tcp:/) || s.match(/^fd:/)\n r << s\n else\n Chef::Log.info(\"WARNING: docker_service host property #{s} not valid\")\n end\n end\n r\n end", "def nameserver_config\n return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC']\n\n address, port = ENV['MM_DNSRC'].split(/:/)\n\n {\n nameserver_port: [[address, port.to_i]]\n }\n rescue StandardError\n {}\n end", "def getHostPortFromServerName(serverName)\n return serverName.split(',')[0..1]\nend", "def components(host_string)\n host_string = host_string.strip\n\n # IPv6\n if host_string.start_with?('[')\n end_idx = host_string.index(']')\n raise ::Aerospike::Exceptions::Parse, 'Invalid IPv6 host' if end_idx.nil?\n\n # Slice away brackets and what's inside them, then split on : and\n # replace first entry with string inside brackets\n host_string.slice(end_idx+1..-1).split(':').tap do |result|\n result[0] = host_string[1...end_idx]\n end\n else\n host_string.split(?:)\n end\n end", "def parse_radius_server(config)\n values = config.scan(RADIUS_GROUP_SERVER).map do |(name, auth, acct)|\n {\n name: name,\n auth_port: auth || DEFAULT_RADIUS_AUTH_PORT,\n acct_port: acct || DEFAULT_RADIUS_ACCT_PORT\n }\n end\n { servers: values }\n end", "def hostinfo\n return self.host.to_s + (self.port ? ':' + self.port.to_s : '')\n end", "def parse_url(url)\n expect! url => /^postgres(ql)?s?:\\/\\//\n\n require \"uri\"\n uri = URI.parse(url)\n raise ArgumentError, \"Invalid URL #{url}\" unless uri.hostname && uri.path\n\n config = {\n dbname: uri.path.sub(%r{^/}, \"\"),\n host: uri.hostname\n }\n config[:port] = uri.port if uri.port\n config[:user] = uri.user if uri.user\n config[:password] = uri.password if uri.password\n config[:sslmode] = uri.scheme == \"postgress\" || uri.scheme == \"postgresqls\" ? \"require\" : \"prefer\"\n config\n end", "def parse_url(url)\n expect! url => /^postgres(ql)?s?:\\/\\//\n\n require \"uri\"\n uri = URI.parse(url)\n raise ArgumentError, \"Invalid URL #{url}\" unless uri.hostname && uri.path\n\n config = {\n dbname: uri.path.sub(%r{^/}, \"\"),\n host: uri.hostname\n }\n config[:port] = uri.port if uri.port\n config[:user] = uri.user if uri.user\n config[:password] = uri.password if uri.password\n config[:sslmode] = uri.scheme == \"postgress\" || uri.scheme == \"postgresqls\" ? \"require\" : \"prefer\"\n config\n end", "def parse_db_uri(db_uri)\n uri = URI.parse(db_uri)\n \n db_config = {\n :adapter => uri.scheme,\n :database => uri.path[1..-1],\n :host => uri.host\n }\n \n if uri.user\n db_config[:username] = uri.user\n db_config[:password] = uri.password if uri.password\n end\n db_config[:port] = uri.port if uri.port\n \n db_config\n end", "def parse_description(config)\n mdata = /^\\s{3}description\\s(.+)$/.match(config)\n { description: mdata.nil? ? DEFAULT_INTF_DESCRIPTION : mdata[1] }\n end", "def parse_list_server_lines(lines)\n result = Array.new\n lines.each do |l|\n result << l.split(\"-\")[0].strip\n end\n return result\n end", "def ipsplit(str)\n interface, address, defrouter = str.split(':')\n return interface, address, defrouter\n end", "def nameserver_info\n facts.fetch(\"Nameserver\", {})\n end", "def parser(servers)\n @servers =\n servers.map do |server|\n Server.new(\n server[:id], server[:name], server[:status],\n # @!method parse server's addresses\n parse_addresses(server[:addresses]),\n # @!method parse server's security_groups\n parse_security_groups(server[:security_groups]),\n server[:tenant_id]\n )\n end\n self\n end", "def get_devserver\n devserver = all_info[:devserver]\n if devserver!=nil\n return devserver.split(':').last\n end\n end", "def parse_connect_attrs(conn_attrs); end", "def parse\n out = {}\n begin \n o = @line.match(/(.*?\\d\\d:\\d\\d:\\d\\d) (.*?) (.*?) (.*$)/ )\n out[\"date\"] = o.captures[0].to_ElasticDate\n out[\"machine\"] = o.captures[1]\n out[\"service\"] = o.captures[2]\n m = out[\"service\"].match(/\\[(\\d+)\\]\\:{0,1}/)\n if m then \n out[\"servicePid\"] = m.captures[0]\n out[\"serviceName\"] = out[\"service\"].sub(/\\[\\d+\\]\\:{0,1}/,\"\")\n elsif \n out[\"servicePid\"] = -1\n out[\"serviceName\"] = out[\"service\"].sub(/\\:$/,\"\")\n end\n out[\"message\"] = o.captures[3]\n out[\"parseFails\"] = false\n rescue => ex\n STDERR.puts \"--- Exception in parsing ----\"\n STDERR.puts \"#{@line}\"\n out[\"date\"] = DateTime.now().to_ElasticDate\n out[\"machine\"] = \"\"\n out[\"service\"] = \"\"\n out[\"serviceName\"] = \"\"\n out[\"servicePid\"] = \"\"\n out[\"message\"] = @line\n out[\"parseFails\"] = true\n end\n return out\n end", "def server_info()\n #This is a stub, used for indexing\n end", "def getServerName(servers, hostname, port)\n servername = nil\n upperCaseHostname = hostname.upcase;\n for server in servers\n hostFromServerName, portFromServerName = getHostPortFromServerName(server)\n hostFromServerName = hostFromServerName.upcase\n if hostFromServerName == upperCaseHostname and portFromServerName == port\n servername = server\n break\n end\n end\n raise ArgumentError, \"Server %s:%d not online\" % [hostname, port] unless servername\n return servername\nend", "def parse_service_description\n description = Nokogiri::XML open(@scpd_url)\n\n validate_scpd description\n\n parse_actions description.at('scpd > actionList')\n\n service_state_table = description.at 'scpd > serviceStateTable'\n parse_service_state_table service_state_table\n rescue OpenURI::HTTPError\n raise Error, \"Unable to open SCPD at #{@scpd_url.inspect} from device #{@url.inspect}\"\n end", "def server_info\n {:node => \"riak@#{node.host}\", :server_version => '2.0'}\n end", "def add_server(string)\n\n end", "def parse_vcap_services(element, instance)\n properties = Utils.parse_compliant_vcap_service(element, instance)\n @service_name = properties['service_name']\n # extract the db_name, host, port, user and password from the properties. Since we are using cloud variables for substitution into server.xml,\n # this means we're actually using the keys in the props, not the values. We could use the values for direct substitution.\n conn_prefix = \"cloud.services.#{@service_name}.connection.\"\n\n # uri is the only property portable between Pivotal, BlueMix, and Heroku\n conn_uri = properties[\"#{conn_prefix}uri\"]\n if conn_uri.nil?\n raise \"Resource #{@service_name} does not contain a #{conn_prefix}uri property\"\n end\n uri = URI.parse(conn_uri)\n\n @db_name = get_cloud_property(properties, element, \"#{conn_prefix}name\", uri.path[1..-1])\n @host = get_cloud_property(properties, element, \"#{conn_prefix}host\", uri.host)\n @port = get_cloud_property(properties, element, \"#{conn_prefix}port\", uri.port)\n @user = get_cloud_property(properties, element, \"#{conn_prefix}user\", uri.user)\n @password = get_cloud_property(properties, element, \"#{conn_prefix}password\", uri.password)\n\n # ensure all the cloud properties are always set\n get_cloud_property(properties, element, \"#{conn_prefix}hostname\", uri.host)\n get_cloud_property(properties, element, \"#{conn_prefix}username\", uri.user)\n\n # default JNDI name for DB is jdbc/service_name\n @jndi_name = \"jdbc/#{@service_name}\"\n # create standard configuration ids.\n @datasource_id = \"#{@config_type}-#{@service_name}\"\n @connection_manager_id = \"#{@config_type}-#{@service_name}-conMgr\"\n @properties_id = \"#{@config_type}-#{@service_name}-props\"\n @jdbc_driver_id = \"#{@config_type}-driver\"\n @lib_id = \"#{@config_type}-library\"\n @fileset_id = \"#{@config_type}-fileset\"\n end", "def parse(line)\n res='unknown'\n raw=line.split(':')\n res=raw[1] if raw[1]!=nil\n res.strip\n end", "def get_connection_string(url)\n conn = Utils.parse_connection_url(url)\n str = \"host=#{conn[:host]} dbname=#{conn[:db]}\"\n str << \" port=#{conn[:port]}\" if conn[:port].present?\n str << \" user=#{conn[:user]}\" if conn[:user].present?\n str << \" password=#{conn[:pass]}\" if conn[:pass].present?\n str\n end", "def parseWebServerLine(raw_line)\n\ttokens = /^(\\S+) (\\S+) (\\S+) \\[(\\S+ \\+\\d{4})\\] \"(\\S+ \\S+ [^\"]+)\" (\\d{3}) (\\d+|-) \"(.*?)\" \"([^\"]+)\"$/.match(raw_line).to_a\n\treturn tokens\nend", "def get_server_hostname\n (`hostname`).strip\n end", "def parse_physical_server(node)\n result = parse(node, dictionary::PHYSICAL_SERVER)\n\n result[:vendor] = \"lenovo\"\n result[:type] = dictionary::MIQ_TYPES[\"physical_server\"]\n result[:power_state] = dictionary::POWER_STATE_MAP[node.powerStatus]\n result[:health_state] = dictionary::HEALTH_STATE_MAP[node.cmmHealthState.nil? ? node.cmmHealthState : node.cmmHealthState.downcase]\n result[:host] = get_host_relationship(node.serialNumber)\n result[:location_led_state] = find_loc_led_state(node.leds)\n result[:computer_system][:hardware] = get_hardwares(node)\n\n return node.uuid, result\n end", "def mssql_parse_env(data, info)\n\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\tbuff = data.slice!(0,len)\n\t\ttype = buff.slice!(0,1).unpack('C')[0]\n\n\t\tnval = ''\n\t\tnlen = buff.slice!(0,1).unpack('C')[0] || 0\n\t\tnval = buff.slice!(0,nlen*2).gsub(\"\\x00\", '') if nlen > 0\n\n\t\toval = ''\n\t\tolen = buff.slice!(0,1).unpack('C')[0] || 0\n\t\toval = buff.slice!(0,olen*2).gsub(\"\\x00\", '') if olen > 0\n\n\t\tinfo[:envs] ||= []\n\t\tinfo[:envs] << { :type => type, :old => oval, :new => nval }\n\t\tinfo\n\tend", "def update_server(server, ec2_info)\n server[0] = ec2_info[1] # ec2_id\n server[3] = ec2_info[3] # public host\n server[4] = ec2_info[16] # public ip\n server[5] = ec2_info[4] # private host\n server[6] = ec2_info[17] # private ip\nend", "def port_string; end", "def parse_tcpdump(line)\n data = line.split(\" \")\n\n # Check input data validation, null -> skip\n if (line == nil) then\n return (nil)\n end\n if (data == []) then\n return (nil)\n end\n\n src = data[2]\n dst = data[4]\n size = data[-1] \n\n tmp1 = src.split(\".\")\n tmp2 = dst.split(\".\")\n if (tmp1.length == 5) then\n # IPv4\n src_ip = tmp1[0,4].join(\".\")\n src_port = tmp1[4]\n dst_ip = tmp2[0,4].join(\".\")\n dst_port = tmp2[4]\n else\n # IPv6\n src_ip = tmp1[0]\n src_port = tmp1[1]\n dst_ip = tmp2[0]\n dst_port = tmp2[1]\n end\n\n return ([src_ip, src_port, dst_ip, dst_port, size])\nend", "def parse_description\n skip_tkspace\n\n tk = get_tk\n\n @desc = tk.text[1..-2]\n end", "def decode_hostname(hostname); end", "def parse_description(config, name)\n value = config.scan(/neighbor #{name} description (.*)$/)\n description = value[0] ? value[0][0] : nil\n { description: description }\n end", "def config_parse(line)\n line.strip!\n return nil if line.nil? || line.empty? || line[0] == '#'\n action, line = line.split(' ', 2)\n return :domain, [line] if action == 'domain'\n return :substitution, line.split(' ', 2) if action.start_with?('sub')\n nil\n end", "def server_info\n check_connection\n @protocol.server_info\n end", "def parse_snmp_hosts(text)\n re = /host: ([^\\s]+)\\s+.*?port: (\\d+)\\s+type: (\\w+)\\s*user: (.*?)\\s+security model: (.*?)\\n/m # rubocop:disable Metrics/LineLength\n text.scan(re).map do |(host, port, type, username, auth)|\n resource_hash = { name: host, ensure: :present, port: port.to_i }\n sec_match = /^v3 (\\w+)/.match(auth)\n resource_hash[:security] = sec_match[1] if sec_match\n ver_match = /^(v\\d)/.match(auth) # first 2 characters\n resource_hash[:version] = ver_match[1] if ver_match\n resource_hash[:type] = type =~ /trap/ ? :traps : :informs\n resource_hash[:username] = username\n resource_hash\n end\n end", "def servers\n list = []\n Penctl.execute(@pen, \"servers\", 5).each do |l| \n server = Penctl.parse_server_line(l)\n list[server[:slot]] = server\n end\n list.compact\n end", "def parse_host_and_port_for_locale\n @parsed_host_and_port ||= begin\n parts = request.host_with_port.split('.')\n\n parts.shift if parts.first == 'www'\n\n lang = parts.shift if valid_locale?(parts.first)\n\n host, port = parts.join('.').split(':')\n [lang, host, port]\n end\n end", "def parse_snippet_details line, prefix\n details = line[prefix.length, line.length - prefix.length]\n details_split = details.split('::').map(&:strip)\n return nil unless (1..2).cover? details_split.size\n \n {\n prefix: details_split[0],\n description: details_split[1]\n }\n end", "def parse_description(section)\n if md = /^([A-Z]\\w+\\:)/.match(section)\n @status = md[1].chomp(':')\n @description = md.post_match.strip\n else\n @description = section.strip\n end \n end", "def split_port(host_string)\n #TODO figure out why the call to Simplib.split_port doesn't work, so\n # we don't have to replicate that code\n# require 'puppetx/simp/simplib'\n# host,port = PuppetX::Simp::Simplib.split_port(host_string)\n# # remove [] for IPv6\n# host.gsub!('[', '')\n# host.gsub!(']', '')\n\n return [nil,nil] if host_string.nil? or host_string.empty?\n\n # CIDR addresses do not have ports\n return [host_string, nil] if host_string.include?('/')\n\n # IPv6 Easy\n if host_string.include?(']')\n host_pair = host_string.split(/\\]:?/)\n host_pair[1] = nil if host_pair.size == 1\n\n # remove '[' and ']' from IPv6 address\n host_pair[0].gsub!('[', '')\n host_pair[0].gsub!(']', '')\n # IPv6 Fallback\n elsif host_string.count(':') > 1\n host_pair = [host_string, nil]\n # Everything Else\n elsif host_string.include?(':')\n host_pair = host_string.split(':')\n else \n host_pair = [host_string, nil]\n end\n\n host_pair\n end", "def query_server_details(server, port = 3979)\n packet = @udp.query(:udp_client_find_server, server, port)\n packet.payload\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def test_cli_set_string\n client.set(context: 'interface loopback41', values: 'descr panda')\n run = client.get(command: 'show run int loopback41')\n desc = run.match(/description (.*)/)[1]\n assert_equal(desc, 'panda')\n end", "def parse_type(config)\n value = config.scan(/aaa group server ([^\\s]+)/).first\n { type: value.first }\n end", "def parse_base\n hostname = data['host'].gsub('DOT','.').gsub('DASH', '-')\n parts = hostname.split('.')\n id = parts.last\n slot = parts[-2]\n cloud = parts.first(parts.size-2).join('.')\n measure_period = (data['interval'] || 10).to_i\n {id: id, slot: slot, cloud: cloud, measure_period: measure_period, measure_time: data['time']}\n end", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }.map {|x| x.split(\", \")}\n\n # Building the Hash\n dns_hash = {}\n dns_filter.each do |x| \n dns_hash[x[1]] = {\n :type => x[0],\n :target => x[2]\n }\n end\n \n dns_hash\nend", "def tns(planet)\n log_if_missing(planet, 'host', 'port', 'sid')\n \"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=#{planet['host']})(PORT=#{planet['port']})))(CONNECT_DATA=(SID=#{planet['sid']})))\" # rubocop:disable LineLength\n end", "def normalized_host; end", "def get_server\n get_general['server']\n end", "def server_port; end", "def host_with_port; end", "def hostname\n v = self.host\n v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v\n end", "def parse_server_algorithm_packet(packet); end", "def parse_old\n\thost_tracker=Wmap::HostTracker.instance\n\t@services=Hash.new\n\tf_site=File.open(ARGV[0],'r')\n\tf_site.each do |line|\n\t\tsite=line.chomp.strip\n\t\tsite=host_tracker.url_2_site(site)\n\t\tabort \"Error on processing site: #{site}\" if site.nil?\n\t\thost=host_tracker.url_2_host(site)\n\t\tabort \"Error on processing host: #{host}\" if host.nil?\n\t\tip=host_tracker.local_host_2_ip(host)\n\t\tip=host_tracker.host_2_ip(host) if ip.nil?\n\t\tnext if ip.nil?\n\t\tnext unless host_tracker.is_ip?(ip)\n\t\tport=host_tracker.url_2_port(site)\n\t\tkey=ip+\":\"\n\t\tkey+=port.to_s\n\t\t@services[key]=true unless @services.key?(key)\n\tend\n\tf_site.close\n\thost_tracker=nil\nend", "def parseShow(output, server, user, pass)\n status = \"\"\n lines = []\n output.split(\"\\n\").each do |line|\n if (line =~/^Queued/)\n status =\"queued\"\n elsif (line =~ /^Running/)\n status = \"running\"\n elsif (line =~/^Completed/)\n status = \"completed\"\n elsif(line =~/^CLI|^CGI/)\n job, u, group, p, desc = line.chomp.split(\" \")\n if (status == \"running\" && u == user)\n done = `dc_show -job #{job} -user #{user} -password #{pass} -server #{server}`\n if (done =~/([0-9|\\.]+\\%)/)\n status = status + \" \" + $1\n end\n end\n if (status != \"completed\")\n lines.push([job, user, server, status].join(\"\\t\"))\n end\n end\n end\n return lines\nend", "def calculate_dbhost\n owncloud_cookbook_config['dbhost'] =\n [\n owncloud_cookbook_config['dbhost'], owncloud_cookbook_config['dbport']\n ].join(':')\n end", "def host_id\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "def parse(text)\n header_row, body_row = text.split(/$/)\n headers = header_row.split(\"\\t\")\n rs_index = headers.index('SNP rs')\n return false unless rs_index\n values = body_row.split(\"\\t\")\n values[rs_index]\n end", "def parser(line)\n return Hash[line.split(\"\\t\").map{|f| f.split(\":\", 2)}]\n end", "def parse_hosts\n hosts = config.scan(/(?<=^logging\\shost\\s)[^\\s]+/)\n { hosts: hosts }\n end", "def host; config[:host]; end", "def parse_addr(string)\n # Split host and port number from string.\n case string\n when /\\A\\[(?<address> .* )\\]:(?<port> \\d+ )\\z/x # string like \"[::1]:80\"\n address, port = $~[:address], $~[:port]\n when /\\A(?<address> [^:]+ ):(?<port> \\d+ )\\z/x # string like \"127.0.0.1:80\"\n address, port = $~[:address], $~[:port]\n else # string with no port number\n address, port = string, nil\n end\n\n # Pass address, port to Addrinfo.getaddrinfo. It will raise SocketError if address or port is not valid.\n # IPAddr currently cannot handle ::1 notation, use Addrinfo instead\n ary = Addrinfo.getaddrinfo(address, port)\n\n # An IP address is exactly one address.\n ary.size == 1 or raise SocketError, \"expected 1 address, found #{ary.size}\"\n ary.first\nend", "def default_master_server_arguments(port, date)\n {\n :sid => '1',\n :thnum => '16',\n :format => 'tch',\n :bnum => '503316469',\n :apow => '11',\n :fpow => '18',\n :ncnum => '6000000',\n :xmsiz => '1073741824',\n :opts => 'lb',\n :slave => false,\n :date => date.strftime('%Y%m'),\n :port => port\n }\n end", "def url2servername(mURL)\n\t\tlurl =\n\t\t\tvalidateAndStripURL(mURL,'ServerProbeRecord.url2servername(mURL)')\n\t\tservername = lurl.chomp.sub(/http[s]*:[\\/]{2}/,'').sub(/\\/.*/,'')\n\t\treturn servername\n\tend", "def zookeeper_helper(url)\n # z = Zookeeper.new(\"149.165.170.7:2181\")\n # host_details= z.get(:path => url)\n # host_details=host_details[:data]\n # host_details=host_details.split(\":\")\n host_details=[ENV[\"RECOENGINE_SERVICE_PORT_8001_TCP_ADDR\"], ENV[\"RECOENGINE_SERVICE_PORT_8001_TCP_PORT\"]]\n host_details\n end", "def getHostInfo(srv=nil)\n return [nil,nil] if srv.nil?\n resolver=Resolv::DNS.new\n all=resolver.getresources(srv,Resolv::DNS::Resource::IN::SRV)\n return [nil,nil] if all.length==0\n rec=all[(rand(all.length)+1).to_i-1]\n return [ rec.target.to_s, rec.port.to_i ]\n end", "def parse url\n begin\n @h_data = {}\n\n scheme, remaining_url = url.split( '://' )\n raise \"invalid scheme\" unless scheme == 'cassandra'\n raise \"invalid url\" if remaining_url.strip.nil? || remaining_url.strip == ''\n\n host_port, keyspace = remaining_url.split( '/' )\n raise \"no keyspace\" if keyspace.nil? || keyspace.strip == ''\n\n host, port = host_port.split( ':' )\n\n port = 9160 if port.nil? || post.strip == ''\n @h_data[:host] = host\n @h_data[:port] = port\n @h_data[:keyspace] = keyspace\n\n true\n rescue\n msg = \"ERROR PARSING CASSANDRA URL #{url}: #{$!}\"\n if defined?( Rails )\n Rails.logger.error msg\n else\n puts msg\n end\n false\n end\n end", "def parse\n Layout.parallel_links = @description['parallel-links'] || 1\n Layout.stub_networks = @description['stub-networks'] || 0\n end", "def formatted_servers\n static_ips = connect.describe_addresses.addresses.map(&:public_ip)\n\n servers.select { |server| include_server? server }.map do |server|\n o = {\n date: server.launch_time.to_s,\n az: server.placement.availability_zone,\n id: server.instance_id,\n subnet: [server.subnet_id, \"(#{subnet_name[server.subnet_id]})\"].join(' '),\n priv_ip: server.private_ip_address,\n type: server.instance_type,\n vpc: server.vpc_id,\n state: opts[:csv] ? server.state.name : colorize_state(server.state.name).bold\n }\n\n if opts[:groups]\n groups_string =\n server.security_groupserver.map { |g| \"#{g.group_id} (#{g.group_name})\" }.join(', ')\n\n # Shorten the groups string to a manageable length\n unless (opts[:csv] || opts[:all_groups]) && groups_string.length > GROUPS_MAX_LENGTH\n groups_string = groups_string[0..GROUPS_MAX_LENGTH] + '...'\n end\n\n o[:groups] = groups_string\n end\n\n if server.vpc_id && opts[:vpc]\n o[:vpc] = [server.vpc_id, \"(#{vpc_name[server.vpc_id]})\"].join(' ')\n end\n\n if server.public_ip_address\n static_ip = static_ips.include?(server.public_ip_address) ? '(S)' : '(D)'\n o[:pub_ip] = [server.public_ip_address, static_ip].join(' ')\n end\n\n # Always include the name tag regardless of cli args (for searching)\n (opts[:tags] | %w[tag_Name]).each do |tag|\n next unless (k = server.tags.find { |t| t.key == tag })\n\n o[\"tag_#{tag}\".to_sym] = k.value\n end\n\n o\n end\n end", "def parse_logline(line) \n line.strip!\n split_line = line.split(/\\|/)\n addr = split_line[0].split(',').last.strip\n\n unless (addr =~ /[\\s|\\-]+/) \n @dns_map.synchronize do\n addr = @dns_map[addr] if @dns_map.include? addr\n end\n details = {}\n details[:upstream_response_time] = split_line[1].split(',').last.strip.to_f\n details[:time_local] = DateTime.strptime(split_line[2], '%d/%b/%Y:%H:%M:%S %Z')\n details[:status] = split_line[3].to_i\n details[:request_length] = split_line[4].to_i\n details[:body_bytes_sent] = split_line[5].to_i\n\n\n @log_entries.synchronize do\n @log_entries[addr] << details\n end\n end \n end", "def read_tnsnames\n\n tnsnames = {}\n\n if ENV['TNS_ADMIN']\n tnsadmin = ENV['TNS_ADMIN']\n else\n if ENV['ORACLE_HOME']\n tnsadmin = \"#{ENV['ORACLE_HOME']}/network/admin\"\n else\n logger.warn 'read_tnsnames: TNS_ADMIN or ORACLE_HOME not set in environment, no TNS names provided'\n return tnsnames # Leerer Hash\n end\n end\n\n fullstring = IO.read( \"#{tnsadmin}/tnsnames.ora\" )\n \n while true \n # Ermitteln TNSName\n start_pos_description = fullstring.index('DESCRIPTION')\n break unless start_pos_description # Abbruch, wenn kein weitere DESCRIPTION im String\n tns_name = fullstring[0..start_pos_description-1]\n while tns_name[tns_name.length-1,1].match '[=,\\(, ,\\n,\\r]' # Zeichen nach dem TNSName entfernen\n tns_name = tns_name[0, tns_name.length-1] # Letztes Zeichen des Strings entfernen\n end\n while tns_name.index(\"\\n\") # Alle Zeilen vor der mit DESCRIPTION entfernen\n tns_name = tns_name[tns_name.index(\"\\n\")+1, 10000] # Wert akzeptieren nach Linefeed wenn enthalten\n end\n fullstring = fullstring[start_pos_description + 10, 1000000] # Rest des Strings fuer weitere Verarbeitung\n\n next if tns_name[0,1] == \"#\" # Auskommentierte Zeile\n\n # ermitteln Hostname\n start_pos_host = fullstring.index('HOST')\n # Naechster Block mit Description beginnen wenn kein Host enthalten oder in naechster Description gefunden\n next if start_pos_host==nil || (fullstring.index('DESCRIPTION') && fullstring.index('DESCRIPTION')<start_pos_host) # Alle weiteren Treffer muessen vor der naechsten Description liegen\n fullstring = fullstring[start_pos_host + 5, 1000000]\n hostName = fullstring[0..fullstring.index(')')-1]\n hostName = hostName.delete(' ').delete('=') # Entfernen Blank u.s.w\n \n # ermitteln Port\n start_pos_port = fullstring.index('PORT')\n # Naechster Block mit Description beginnen wenn kein Port enthalten oder in naechster Description gefunden\n next if start_pos_port==nil || (fullstring.index('DESCRIPTION') && fullstring.index('DESCRIPTION')<start_pos_port) # Alle weiteren Treffer muessen vor der naechsten Description liegen\n fullstring = fullstring[start_pos_port + 5, 1000000]\n port = fullstring[0..fullstring.index(')')-1]\n port = port.delete(' ').delete('=') # Entfernen Blank u.s.w.\n\n # ermitteln SID oder alternativ Instance_Name oder Service_Name\n sid_tag_length = 4\n sid_usage = :SID\n start_pos_sid = fullstring.index('SID=') # i.d.R. folgt unmittelbar ein \"=\"\n start_pos_sid = fullstring.index('SID ') if start_pos_sid.nil? # evtl. \" \" zwischen SID und \"=\"\n if start_pos_sid.nil? || (fullstring.index('DESCRIPTION') && fullstring.index('DESCRIPTION')<start_pos_sid) # Alle weiteren Treffer muessen vor der naechsten Description liegen\n sid_tag_length = 12\n sid_usage = :SERVICE_NAME\n start_pos_sid = fullstring.index('SERVICE_NAME')\n end\n # Naechster Block mit Description beginnen wenn kein SID enthalten oder in naechster Description gefunden\n next if start_pos_sid==nil || (fullstring.index('DESCRIPTION') && fullstring.index('DESCRIPTION')<start_pos_sid) # Alle weiteren Treffer muessen vor der naechsten Description liegen\n fullstring = fullstring[start_pos_sid + sid_tag_length, 1000000] # Rest des Strings fuer weitere Verarbeitung\n \n sidName = fullstring[0..fullstring.index(')')-1]\n sidName = sidName.delete(' ').delete('=') # Entfernen Blank u.s.w.\n \n # Kompletter Record gefunden\n tnsnames[tns_name] = {:hostName => hostName, :port => port, :sidName => sidName, :sidUsage =>sid_usage }\n end\n tnsnames\n end", "def parse_host\n args = ENV['host'].split(',')\n hosts = []\n args.each do |arg|\n if XP5K::Role.listnames.include? arg\n hosts << roles(arg)\n else\n hosts << arg\n end\n end\n hosts.flatten\nend", "def service_description_for_host(host)\n response = self.class.get(@base_uri + \"config/host/#{host}?format=json\",\n basic_auth: @auth, verify: false)\n raise ApiError unless response.code == 200\n host_config = JSON.parse!(response.body)\n if host_config['services'].nil?\n services = []\n else\n services = host_config['services'].map { |s| s['service_description'] }\n end\n host_config['hostgroups'].each do |hg|\n services += hostgroup_services(hg)\n end\n services.nil? ? [] : services\n end", "def hostname; end", "def hostname; end", "def parse_dns(dns_raw)\r\n\r\n dns_raw1 = []\r\n len = dns_raw.length-1\r\n i = 0\r\n for r in 0..len do\r\n str1 = dns_raw[r]\r\n if dns_raw[r][0] != '#'\r\n dns_raw1[i] = dns_raw[r]\r\n i = i + 1\r\n end\r\n end\r\n dns_raw = dns_raw1\r\n\r\n b=[]\r\n dns_raw.each do |item|\r\n str = item == \"\\n\"\r\n if !str\r\n b.push(item.split(','))\r\n end\r\n end\r\n\r\n len = b.length-1\r\n dns_records ={}\r\n\r\n for r in 0 .. len do\r\n dkey = {}\r\n dkey[:type] = b[r][0].strip\r\n dkey[:target] = b[r][2].strip.chomp\r\n dns_records[b[r][1].strip] = dkey\r\n end\r\n\r\n return dns_records\r\n end" ]
[ "0.62111753", "0.5973172", "0.5915546", "0.5800562", "0.5744312", "0.57415754", "0.57415754", "0.57277054", "0.568331", "0.5681982", "0.5641119", "0.5606183", "0.5606183", "0.55802464", "0.55693823", "0.55693823", "0.5562231", "0.5502871", "0.5486854", "0.5383189", "0.5377956", "0.5376485", "0.5369492", "0.536709", "0.5326374", "0.5326147", "0.53171426", "0.53171426", "0.5312092", "0.52505565", "0.5243359", "0.5230079", "0.5210571", "0.5205389", "0.5194141", "0.51912993", "0.5184768", "0.5173787", "0.5171607", "0.5163564", "0.5156411", "0.51551884", "0.5154586", "0.51469254", "0.51285857", "0.51263577", "0.5104911", "0.5094729", "0.509255", "0.5091786", "0.50905585", "0.50715524", "0.5065714", "0.5057582", "0.503495", "0.5028165", "0.50265664", "0.5025071", "0.5024639", "0.50216115", "0.5019004", "0.50114155", "0.5007973", "0.49973622", "0.49971357", "0.4982274", "0.49753493", "0.4949011", "0.49373823", "0.49338296", "0.49336427", "0.4919415", "0.49122983", "0.49090436", "0.4905057", "0.49021697", "0.48959982", "0.4885565", "0.4885545", "0.48780674", "0.48716933", "0.48716623", "0.48637006", "0.485014", "0.48492587", "0.48440596", "0.48405445", "0.48347273", "0.48323455", "0.48258862", "0.48233968", "0.48226568", "0.48196062", "0.48180327", "0.48151085", "0.48122236", "0.48085093", "0.48007834", "0.48007834", "0.47978428" ]
0.76244825
0
Marshal session object BOZO !! Marshal will not dump valid strings for mongo using yaml instead
def serialize( ses ) YAML.dump( ses ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal(session)\n data = [ Marshal.dump(session) ].pack('m').chop\n \"#{data}--#{generate_digest(data)}\"\n end", "def inspect\n \"#<Mongo::Session:0x#{object_id} session_id=#{session_id} options=#{@options}>\"\n end", "def marshal(session)\n data = Base64.encode64(Marshal.dump(session)).chop\n Merb::Request.escape \"#{data}--#{generate_digest(data)}\"\n end", "def session_serializer\n @session_serializer ||= Watchman::SessionSerializer.new(@env)\n end", "def serialize_for_session\n @serialized_data ||= serialize_object_for_session\n end", "def dump(object)\n JsonDocument.new(@config, object).encrypt\n end", "def serialize_into_session(record)\n [record.serializable_hash.stringify_keys, nil]\n end", "def serialize_into_session(record)\n [record.serializable_hash.transform_keys(&:to_s), nil]\n end", "def mongo_fix_session_keys(session = {})\n new_session = Hash.new\n session.to_hash.each do |i, j|\n new_session[i.gsub(/\\./i, \"|\")] = j.inspect\n end unless session.empty?\n new_session\n end", "def marshal(session)\n @verifier.generate(persistent_session_id!(session))\n end", "def serialize_from_session(*args, &block)\n Warden::Manager.serialize_from_session(*args, &block)\n end", "def serialize \n Base64.encode64(@data.to_yaml) \n end", "def serialize(object)\n YAML.dump(object)\n end", "def serialize(object) end", "def to_yaml() end", "def serialize_into_session(*args, &block)\n Warden::Manager.serialize_into_session(*args, &block)\n end", "def inspect\n \"#<Mongo::Session::ServerSession:0x#{object_id} session_id=#{session_id} last_use=#{@last_use}>\"\n end", "def marshal_dump; end", "def marshal_dump\n dump\n end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def to_bson\n to_h.to_bson\n end", "def encode(data); ::BSON.serialize(data).to_s; end", "def marshal_object(object_to_store)\n Marshal.dump(object_to_store)\n end", "def save_session(session)\n \n end", "def to_bson\n end", "def serialize\n YAML::dump(self)\n end", "def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end", "def session_to_s\n return '' if @session.nil?\n\n s = '{'\n [ 'auth', 'seed', 'ip', 'user', 'session_expires' ].each do |k|\n s += \"'#{k}':'#{@session[k]}', \"\n end\n s += '}'\n return s\n end", "def __bson_dump__(io, key)\n io << Types::OBJECT_ID\n io << key.to_bson_cstring\n io << data\n end", "def to_yaml\n to_h.to_yaml\n end", "def to_yaml\n # write yaml\n end", "def serialize()\n data = {\n 'channels' => @channels.values.collect {|c| c.serialize },\n 'users' => @users.values.collect {|u| u.serialize },\n }\n data.to_yaml\n end", "def encode(value)\n value.to_yaml\n end", "def encode(value)\n value.to_yaml\n end", "def marshall_dump\n end", "def marshall_dump\n end", "def _dump() end", "def to_yaml\n to_h.to_yaml\n end", "def save_to(session)\n attributes.each do |key, value|\n session[key] = value\n end\n self\n end", "def to_bson\n encode_bson_with_placeholder do |encoded|\n encoded << javascript.to_bson << scope.to_bson\n end\n end", "def y(obj)\n puts obj.to_yaml\nend", "def y(obj)\n puts obj.to_yaml\nend", "def to_yaml(opts = {})\n return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end", "def serialize(object)\n object = MAPPINGS[object]\n object.nil? ? nil : object\n end", "def mongoize\n encrypted\n end", "def to_yaml\n to_hash.to_yaml\n end", "def encode(obj); end", "def to_yaml\n to_hash.to_yaml\n end", "def to_s\n Psych.dump to_hash\n end", "def initialize(session, option=nil)\n if @session = @@session_class.find_session(session.session_id)\n @data = unmarshalize(@session.data)\n else\n @session = @@session_class.create_session(session.session_id, marshalize({}))\n @data = {}\n end\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml(opts = {})\n return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end", "def to_session_value; end", "def mongoize\n ::Hash.mongoize(self)\n end", "def serialize; end", "def serialize; end", "def to_yaml\n as_yaml.to_yaml\n end", "def marshal_dump\n data\n end", "def serialize\n obj = {}\n obj[:players] = [@player.serialize]\n obj[:word_array] = @word_array\n obj[:word_array_player] = @word_array_player\n obj[:letters_guessed] = @letters_guessed\n obj[:errors_left] = @errors_left\n obj[:round_over] = @round_over\n obj[:round_won] = @round_won\n obj[:continuing_saved_game] = @continuing_saved_game\n @@serializer.dump(obj)\n end", "def serialize(object, data); end", "def encode(object)\n engine.encode(object)\n end", "def dump\n if !File.exist?(self.class.namespace(model.class, model.service))\n self.class.create_namespace(model.class, model.service)\n end\n\n data = {\n identity: model.identity,\n model_klass: model.class.to_s,\n collection_klass: model.collection && model.collection.class.to_s,\n collection_attrs: model.collection && model.collection.attributes,\n model_attrs: model.attributes\n }\n\n File.open(dump_to, \"w\") { |f| f.write(YAML.dump(data)) }\n end", "def inspect\n\t\t\"#<Session:#{self.type} #{self.tunnel_peer} #{self.info ? \"\\\"#{self.info.to_s}\\\"\" : nil}>\"\n\tend", "def awesome_mongo_mapper_instance(object)\n return object.inspect if !defined?(::ActiveSupport::OrderedHash)\n\n data = object.attributes.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|\n hash[c[0].to_sym] = c[1]\n hash\n end\n if !object.errors.empty?\n data = {:errors => object.errors, :attributes => data}\n end\n \"#{object} #{awesome_hash(data,true)}\"\n end", "def write_objsession_class(target_file, class_name)\n FileUtils.mkdir_p(File.dirname(target_file))\n\n class_components = [ ]\n while class_name =~ /^(.*?)::(.*)$/i\n class_components << $1\n class_name = $2\n end\n class_components << class_name\n\n File.open(target_file, \"w\") do |f|\n f.puts <<-EOF\n# This is your ObjectifiedSession class. An instance of this class will automatically be available by calling\n# #objsession from your controller, just like calling #session gets you (and will still get you) the normal session.\n#\n# See https://github.com/ageweke/objectified_sessions for more information.\nEOF\n\n class_components[0..-2].each_with_index do |module_name, index|\n write_indented_lines(f, \"module #{module_name}\", index * 2)\n end\n\n write_indented_lines(f, \"class #{class_name} < ::ObjectifiedSessions::Base\", (class_components.length - 1) * 2)\n\n write_indented_lines(f, <<-EOF, class_components.length * 2)\n# FIELD DEFINITION\n# ==============================================================================================================\n\n# This defines a field named :foo; you can access it via self[:foo], self[:foo]=, and #foo and #foo=.\n# You can override these methods and call #super in them, and they'll work properly.\n# field :foo\n\n# This does the same, but the #foo reader and #foo= writer will be private.\n# field :foo, :visibility => :private\n\n# This creates a field named :foo, that's still accessed via self[:foo], self.foo, and so on, but which is actually\n# stored in the session object under just 'f'. You can use this to keep long names in your code but short names in\n# your precious session storage.\n# field :foo, :storage => :f\n\n# This creates an inactive field named :foo. Inactive fields can't be read or written in any way, but any data in\n# them will not be deleted, even if you set unknown_fields :delete.\n# inactive :foo\n\n# This creates a retired field named :foo. Retired fields don't really exist and any data in them will be deleted if\n# you set unknown_fields :delete, but you'll get an error if you try to also define a normal field with the same\n# name or storage setting. You can use retired fields to ensure you don't accidentally re-use old session fields.\n# retired :foo\n\n# CONFIGURATION\n# ==============================================================================================================\n\n# Sets the sub-key under which all data in your objectified session lives. This is useful if you already have a large\n# system with lots of session usage, and want to start using ObjectifiedSessions to manage new session use, but\n# partition it off completely from old, traditional session use.\n# prefix nil\n\n# Sets the default visibility of fields. The default is :public; if you set it to :private, you can still override it\n# on a field-by-field basis by saying :visibility => :public on those fields.\n# default_visibility :public\n\n# By default, ObjectifiedSessions will never delete session data unless you ask it to. However, if you set\n# unknown_fields :delete, then any unknown fields -- those you haven't mentioned in this class at all -- and any\n# retired fields will be automatically deleted from the session as soon as you touch it (_i.e._, the moment you\n# call #objsession in your controller). No matter what, however, nothing outside the prefix will ever be touched, if\n# a prefix is set.\n# unknown_fields :preserve\nEOF\n\n class_components.each_with_index do |module_name, index|\n write_indented_lines(f, \"end\", (class_components.length - (index + 1)) * 2)\n end\n end\n end", "def to_ptr\n @session\n end", "def serialize(object)\n return Rubyprot::Serializer.serialize(object)\n end", "def serialize_default(object)\n mongoize(object)\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def to_yaml\n self.to_h.to_yaml\n end", "def to_yaml\n self.to_h.to_yaml\n end", "def _dump\n end", "def marshal_dump\n ivars = instance_variables.reject {|var| /\\A@delegate_/ =~ var}\n [\n :__v2__,\n ivars, ivars.map {|var| instance_variable_get(var)},\n __getobj__\n ]\n end", "def serialize\n \n end", "def save_session\n\t\tsession[:todos] = @todos.all_todos.to_json\n\tend", "def serialize(_object, data); end", "def serialize(_object, data); end", "def to_yaml\n self.to_h.deep_stringify_keys.compact.to_yaml\n end", "def awesome_mongoid_document(object)\n return object.inspect if !defined?(::ActiveSupport::OrderedHash)\n\n data = object.attributes.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|\n hash[c[0].to_sym] = c[1]\n hash\n end\n if !object.errors.empty?\n data = {:errors => object.errors, :attributes => data}\n end\n \"#{object} #{awesome_hash(data)}\"\n end", "def load_session(session_data)\n Marshal.load(Base64.decode64(session_data.split('--').first))\n end", "def to_json\n @object.marshal_dump.to_json\n end", "def to_session_hash\n {:id => self.id, :name => self.name, :email => self.email, :language => self.language}\n end", "def marshal_dump\n [version]\n end", "def to_yaml_object\n nil\n end", "def to_yaml_object\n nil\n end", "def to_s\n data.unpack(\"H*\")[0].force_encoding(Moped::BSON::UTF8_ENCODING)\n end", "def __convert_to_json(o=nil, options={})\n o = o.is_a?(String) ? o : serializer.dump(o, options)\n end", "def marshal_dump\n [version]\n end", "def serialize(object)\n if object.is_a?(::String)\n BSON::ObjectId.from_string(object) unless object.blank?\n else\n object\n end\n end", "def to_yaml\n\t\tYAML::dump self.to_hash\n\tend", "def inspect\n \"<BSON::Binary:0x#{object_id} type=#{type} data=0x#{data[0, 8].unpack1('H*')}...>\"\n end", "def to_mongo(doc)\n\n # vertical tilde and ogonek to the rescue\n\n rekey(doc) { |k| k.to_s.gsub(/^\\$/, 'ⸯ$').gsub(/\\./, '˛') }\n end", "def persist_to_database object, database\n object.with(session: database).save!\n $logger.debug \"..persisted to MongoDB: database: #{database.inspect}\\n....#{object.inspect}\\n\"\n end", "def meta_encode(meta)\n Base64.encode64(Marshal.dump(meta))\n end", "def dump(object)\n adapter_dump(object)\n end", "def to_yaml\n to_parsed.to_yaml\n end" ]
[ "0.6728865", "0.6316792", "0.6307911", "0.6299874", "0.62972796", "0.62523395", "0.61927164", "0.6173001", "0.61103636", "0.6015591", "0.6005223", "0.58515424", "0.584148", "0.5840802", "0.5785582", "0.57650965", "0.57336384", "0.57237434", "0.57171303", "0.5692215", "0.567819", "0.5653386", "0.55971694", "0.5576023", "0.550481", "0.54767174", "0.5474542", "0.5473654", "0.546615", "0.54603267", "0.543674", "0.5428399", "0.5393286", "0.5393286", "0.5390794", "0.538938", "0.5388869", "0.53823686", "0.5370228", "0.53699595", "0.5365319", "0.5365319", "0.5360692", "0.5358228", "0.5357719", "0.53429484", "0.53293204", "0.5328679", "0.5326309", "0.53247976", "0.5324263", "0.53013057", "0.53013057", "0.5288948", "0.5280129", "0.5273353", "0.5271436", "0.5271436", "0.5248459", "0.5247931", "0.5244135", "0.52438223", "0.5241462", "0.52382034", "0.5234112", "0.52223396", "0.5211141", "0.5209655", "0.5203245", "0.5202725", "0.5201435", "0.5201435", "0.5201435", "0.5199259", "0.5199259", "0.51889646", "0.5174695", "0.51594067", "0.5148216", "0.5147442", "0.5147442", "0.51352155", "0.5133147", "0.513255", "0.51310116", "0.51305693", "0.512568", "0.5120698", "0.5120698", "0.51159275", "0.5112197", "0.51012856", "0.50971603", "0.50967264", "0.50899345", "0.50878453", "0.5078051", "0.50737035", "0.50717175", "0.50714904" ]
0.6432779
1
fetch session with optional session id
def _get_session(env, sid) logger.debug "Getting session info for #{sid.inspect}" if sid ses_obj = sessions.find_one( { :_id => sid } ) if ses_obj logger.debug "Found session object on #{sid.inspect}" else logger.debug "Unable to find session object #{sid.inspect}" end session = MongoRack::SessionHash.new( deserialize(ses_obj['data']) ) if ses_obj and fresh?( ses_obj ) end unless sid and session logger.warn "Session ID not found - #{sid.inspect} - Creating new session" session = MongoRack::SessionHash.new sid = generate_sid ret = sessions.save( { :_id => sid, :data => serialize(session) } ) raise "Session collision on '#{sid.inspect}'" unless ret end merged = MongoRack::SessionHash.new.merge(session) logger.debug "Setting old session #{merged.inspect}" session.instance_variable_set( '@old', merged ) return [sid, session] rescue => boom logger.error "#{self} Hoy! something bad happened loading session data" logger.error $!.inspect boom.backtrace.each{ |l| logger.error l } return [ nil, MongoRack::SessionHash.new ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_session(env, sid); end", "def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end", "def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end", "def get_session(session_id)\n session = Session.find(:first, :conditions => ['session_id=?', session_id])\n return session\n end", "def find_session(env, sid)\n unless sid && (session = get_session_with_fallback(sid))\n sid, session = generate_sid, {}\n end\n [sid, session]\n end", "def session!(id)\n search_sessions(xml_doc!, id).first\n end", "def session(id)\n search_sessions(xml_doc, id).first\n end", "def select_session\n @session = Session.find_by_session_id(@session_id)\n @session = @session.last rescue @session\n set_req_no\n end", "def get_session(env, sid)\n raise '#get_session not implemented.'\n end", "def retrieve_session(session_id)\n @mutex.synchronize {\n @timestamps[session_id] = Time.now\n @sessions[session_id]\n }\n end", "def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end", "def find_by_session_id(session_id)\n SEMAPHORE.synchronize { setup_sessid_compatibility! }\n find_by_session_id(session_id)\n end", "def find_by_session_id(session_id)\n SEMAPHORE.synchronize { setup_sessid_compatibility! }\n find_by_session_id(session_id)\n end", "def get_session(env, sid)\n\n # Start each HTTP request with a fresh view of the repository.\n Maglev.abort_transaction\n\n session = @sessions[sid] if sid\n unless sid and session\n session = Hash.new\n sid = generate_sid\n @sessions[sid] = session # Rely on the commit_transaction in set_session\n end\n return [sid, session]\n rescue Exception => e\n puts \"== Get Session: EXCEPTION: #{e}\"\n return [nil, {}]\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def retrieve(session_id)\n unless session_id.blank?\n begin\n session_data = store.retrieve_session(session_id)\n rescue => err\n Merb.logger.warn!(\"Could not retrieve session from #{self.name}: #{err.message}\")\n end\n # Not in container, but assume that cookie exists\n session_data = new(session_id) if session_data.nil?\n else\n # No cookie...make a new session_id\n session_data = generate\n end\n if session_data.is_a?(self)\n session_data\n else\n # Recreate using the existing session as the data, when switching \n # from another session type for example, eg. cookie to memcached\n # or when the data is just a hash\n new(session_id).update(session_data)\n end\n end", "def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end", "def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end", "def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end", "def session_id\n @options[:session_id]\n end", "def session_id; end", "def session_id; end", "def session_id; end", "def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def find_session(request, sid)\n record = get_session_record(request, sid)\n record.session_id = generate_sid if record.new_record?\n [record.session_id, record.data]\n end", "def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end", "def find_session(session_id, lock = false)\n find(\"`session_id`=#{quote_escape session_id} LIMIT 1\" + (lock ? ' FOR UPDATE' : ''))\n end", "def to_param\n session_id\n end", "def session_id\n request.session_options[:id]\n end", "def id\n response_hash[:session_id]\n end", "def get\n params.required(:id)\n\n # Grab the device that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = service.sessions.find(params[:id])\n end", "def session_id\n @session.nil? ? '' : @session.session_id\n end", "def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\nend", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def get_session_id(name)\n sessions = parse_body get(\"#{admin_url}/sessions/summary\")\n current = sessions.find do |session|\n session[:name] == name\n end\n current&.dig(:id)\n end", "def get_app_session(session_id = nil)\n if session_id.nil?\n session_id = params[:id]\n end\n\n app_session = nil\n if current_user.administrator?\n app_session ||= model_class.administered_by(current_user).find_by_id(session_id)\n end\n app_session ||= model_class.viewable_by(current_user).find_by_id(session_id)\n end", "def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_privileged = true\n end\n begin\n if not @@session_id.nil?\n return @@session_id\n else\n @@session_id = get_new_session2\n end\n rescue\n @@session_id = get_new_session2\n end\n return @@session_id\n end", "def sessionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end", "def session(session_id)\n @session_id = session_id\n end", "def extract_session_id(env)\n request = Rack::Request.new(env)\n sid = request.cookies[@key]\n sid ||= request.params[@key] unless @cookie_only\n sid\n end", "def get_session_id\n p \"==>cookie: #{cookies.inspect}\"\n p \"===>session id=#{session[:sid]} session uid = #{session[:uid]}\"\n p \"cookies[:_wh_session] = #{cookies[:_wh_session] }\"\n\n if cookies[:_wh_session] \n session[:uid] = nil if session[:sid] != session[:sid]\n session[:sid] = cookies[:_wh_session] \n end\n # \n # after uesr first register, the _wh_session will be set in user's cookie\n # which will send by all afteraward quest\n #\n if (params[:sid])\n # reset_session\n\n # p request.host\n # p \"====>>>>dda29\"\n # set cookie first, because this is used to generate sid when write memcached\n if cookies[:_wh_session] == nil or cookies[:_wh_session] != params[:sid] # first time, or manually change session to other session\n\n cookies[:_wh_session] = {\n :value => params[:sid],\n :expires => 1.year.from_now,\n :domain => request.host\n }\n session[:uid] = nil\n end\n # p \"====>>>>dda69\"+params[:sid]\n # p \"====>>>>dda79\"+session[:sid]\n if (session[:sid] == nil || params[:sid] != session[:sid] )\n session[:sid] = params[:sid]\n session[:uid] = nil\n end\n\n # @sid = params[:sid]\n\n # cookies[:_wh_session] = params[:sid]\n # p \"====>>>>dda39\"\n else\n # p \"====>>>>dda19\"\n if !session[:sid]\n sid = cookies[:_wh_session]\n if sid ==nil\n sid = params[:sid] # for dev\n if !sid\n # error(\"session not exist, please restart app\")\n return nil\n end\n end \n session[:sid] = sid\n session[:uid] = nil\n end\n end\n # p \"====>>>>dda9\"\n return session[:sid]\n end", "def find_user_by_session(sess_id)\n return unless sess_id\n session_options = ActionController::Base.session_options\n sess = CGI::Session.new(request.cgi,{\n 'session_id' => sess_id,\n 'new_session' => false,\n 'secret' => session_options[:secret],\n 'database_manager' => session_options[:database_manager],\n 'session_key' => session_options[:session_key],\n 'prefix' => session_options[:prefix],\n 'tmpdir' => session_options[:tmpdir],\n 'cache' => session_options[:cache],\n 'no_cookies' => true #undocumented ruby feature, critical for us.\n })\n if(sess[:user_id])\n User.find(sess[:user_id])\n else\n nil\n end\n end", "def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end", "def get_with_session_login!(path, session)\n get_with_session_login(path, session)\n session.merge!(last_request.session)\n end", "def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end", "def session_id\n @driver.session_id\n end", "def session_id_key\n @session_id_key\n end", "def show\n @session = Session.where(unique_id: params[:id])\n # New round logic here\n\n end", "def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end", "def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end", "def login!(session) \n session[:user_id] = id \n end", "def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end", "def set_session\n @session = Session.find(params[:session_id])\n end", "def getSessionInfo(sessionID)\n call :getSessionInfo, :sessionID => sessionID\n end", "def get_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_session ...\"\n end\n # resource path\n local_var_path = \"/session\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def login!(session)\n session[:user_id] = id\n end", "def login!(session)\n session[:user_id] = id\n end", "def load_session(env)\n sid = current_session_id(env)\n sid, session = get_session(env, sid)\n [sid, session || {}]\n end", "def set_session\n @session = BatchConnect::Session.find(params[:id])\n end", "def login_by_session(sessid)\n return if @logged_in\n @logged_in = true\n @session = sessid\n end", "def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end", "def login!(session)\n session[:user_id]=id\n end", "def session_fromid(ip, idhash, meta)\n ip = \"bot\" if idhash == \"bot\"\n \n if !@sessions.key?(idhash)\n session = @ob.get_by(:Session, \"idhash\" => idhash)\n if !session\n session = @ob.add(:Session, {\n :idhash => idhash,\n :user_agent => meta[\"HTTP_USER_AGENT\"],\n :ip => ip,\n :date_lastused => Time.now\n })\n else\n session[:date_lastused] = Time.now\n end\n \n hash = {}\n @sessions[idhash] = {\n :dbobj => session,\n :hash => hash\n }\n else\n session = @sessions[idhash][:dbobj]\n hash = @sessions[idhash][:hash]\n end\n \n raise ArgumentError, \"Invalid IP.\" if ip != \"bot\" and !session.remember? and ip.to_s != session[:ip].to_s\n return [session, hash]\n end", "def session_id\n super\n end", "def session_id\n super\n end", "def set_session\r\n @session = Session.find(params[:id])\r\n end", "def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end", "def session() request.session end", "def extract_session_id!(url)\n url.gsub!(/#{::Rails.application.config.session_options[:key]}=([^&]+)&?/, '')\n url.chomp!('?')\n $1\n end", "def update_session(parsed, session)\n session ||= Session.new\n session.id = parsed[parsed.keys.first][\"customerSessionId\"] if parsed[parsed.keys.first]\n end", "def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend", "def get_session_with_http_info(account_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.get_session ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling SessionsApi.get_session\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.get_session\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Session'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.get_session\",\n :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: SessionsApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end", "def show\n begin\n if m = params[:id].match(/([^\\.]+)/)\n uid = m.captures.first\n else\n uid = params[:id]\n end\n sso_session = params[:session]\n\n # Check if session is valid\n @valid_session = (!uid.blank? && !sso_session.blank? && User.where(uid:uid,sso_session:sso_session).count > 0)\n\n # Build response\n response_hash = {\n valid: @valid_session,\n recheck: 3.minutes.from_now.utc\n }\n\n logger.info(\"INSPECT: session_hash => #{response_hash}\")\n\n render json: response_hash\n rescue Exception => e\n logger.error(e)\n raise e\n end\n end", "def get_sid(res)\r\n if res.nil?\r\n return '' if res.blank?\r\n end\r\n res.get_cookies.scan(/(JSESSIONID=\\w+);*/).flatten[0] || ''\r\n end", "def checkSession(session)\n if session\n obj = UserSessions.where(:session => session['session_id']).first()\n if !obj.blank? and !obj.nil? and obj[:sess] != false\n return {:conn => obj.connection, :user => obj.user_name, :sess => true}\n else\n return nil\n end\n end\nend", "def session_params\n session[:user_id]\n end" ]
[ "0.76285726", "0.74759054", "0.73982865", "0.73835075", "0.73036724", "0.72952044", "0.7293632", "0.72405446", "0.71259445", "0.7094336", "0.7042687", "0.7030073", "0.7030073", "0.7008642", "0.6999981", "0.6956762", "0.6907797", "0.6907797", "0.688152", "0.6879003", "0.6862748", "0.6862748", "0.6862748", "0.6836251", "0.6833723", "0.6820588", "0.68025744", "0.6787025", "0.67540556", "0.6750762", "0.6741077", "0.6728054", "0.6699069", "0.6696127", "0.6696127", "0.6696127", "0.6676269", "0.6669737", "0.66655684", "0.6663394", "0.665396", "0.6643921", "0.663234", "0.66310257", "0.6625474", "0.6582537", "0.65696734", "0.65649843", "0.65608543", "0.6557451", "0.6557344", "0.6542532", "0.6536035", "0.6512009", "0.6493678", "0.64873683", "0.64845186", "0.6450802", "0.6450802", "0.6450802", "0.6450802", "0.643386", "0.643386", "0.6416112", "0.64159507", "0.6383131", "0.63804656", "0.63680625", "0.63630396", "0.63575584", "0.63575584", "0.6353923", "0.6353129", "0.6307709", "0.6281789", "0.62782365", "0.6277764", "0.6277372", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.62656504", "0.6264159", "0.62447643", "0.6223091", "0.6206404", "0.620613" ]
0.6767204
28
update session information with new settings
def _set_session(env, sid, new_session, options) logger.debug "Setting session #{new_session.inspect}" ses_obj = sessions.find_one( { :_id => sid } ) if ses_obj logger.debug "Found existing session for -- #{sid.inspect}" session = MongoRack::SessionHash.new( deserialize( ses_obj['data'] ) ) else logger.debug "Unable to find session for -- #{sid.inspect}" session = MongoRack::SessionHash.new end if options[:renew] or options[:drop] sessions.remove( { :_id => sid } ) return false if options[:drop] sid = generate_sid sessions.insert( {:_id => sid, :data => {} } ) end old_session = new_session.instance_variable_get('@old') || MongoRack::SessionHash.new logger.debug "Setting old session -- #{old_session.inspect}" merged = merge_sessions( sid, old_session, new_session, session ) expiry = options[:expire_after] expiry = expiry ? Time.now + options[:expire_after] : 0 # BOZO ! Use upserts here if minor changes ? logger.debug "Updating session -- #{merged.inspect}" sessions.save( { :_id => sid, :data => serialize( merged ), :expire => expiry } ) return sid rescue => boom logger.error "#{self} Hoy! Something went wrong. Unable to persist session." logger.error $!.inspect boom.backtrace.each{ |l| logger.error l } return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end", "def update\n return if Settings.readonly \n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to sessions_url, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def update_session(data)\n update_attribute('data', data) \n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def update!(**args)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n @transcription_session_id = args[:transcription_session_id] if args.key?(:transcription_session_id)\n end", "def set_session_info\n @session_info = SessionInfo.find(params[:id])\n end", "def update!(**args)\n @phone_session_info = args[:phone_session_info] if args.key?(:phone_session_info)\n @totp_session_info = args[:totp_session_info] if args.key?(:totp_session_info)\n end", "def set_session\n \n end", "def update_session_key\n @parameters['sessionKey'] = get_session_key\n end", "def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n @verification_code = args[:verification_code] if args.key?(:verification_code)\n end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def update\n java_session = @java_request.getSession(true)\n hash = @session_data.dup\n hash.delete_if do |k,v|\n if String === k\n case v\n when String, Numeric, true, false, nil\n java_session.setAttribute k, v\n true\n else\n if v.respond_to?(:java_object)\n java_session.setAttribute k, v\n true\n else\n false\n end\n end\n end\n end\n unless hash.empty?\n marshalled_string = Marshal.dump(hash)\n marshalled_bytes = marshalled_string.to_java_bytes\n java_session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)\n end\n end", "def update_settings\n end", "def set_local_settings(app_settings)\n @log.debug \"Update net_control setting\"\n @host_server = app_settings[\"session\"][:host_server]\n @port_server = app_settings[\"session\"][:port_server]\n @login_name = app_settings[\"session\"][:login_name]\n @password_login_md5 = app_settings[\"session\"][:password_login]\n @password_saved = app_settings[\"session\"][:password_saved]\n @serv_conn_type = app_settings[\"session\"][:connect_type]\n @server_type_http = app_settings[\"web_http\"]\n @remote_web_url = app_settings[\"session\"][:remote_web_srv_url]\n @server_msg_aredebugged = app_settings[\"session\"][:debug_server_messages]\n end", "def update\n\t\tself.log.debug \"Updating session data for key %s\" % @id\n\t\tyield( self.serialized_data )\n\t\t@modified = false\n\tend", "def populate_session(aPlayer)\n\t\tsession[:email] = @player.email\n\t\tsession[:player_id] = @player.id \n\t\tsession[:admin] = @player.admin\n\t\tsession[:login_time] = Time.now.to_i \n\tend", "def update_mfa_session_settings\n service_response = ClientManagement::UpdateMfaSessionSettings.new(params).perform\n render_api_response(service_response)\n end", "def update!(**args)\n @owner_email = args[:owner_email] if args.key?(:owner_email)\n @recording_session_id = args[:recording_session_id] if args.key?(:recording_session_id)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n end", "def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend", "def refresh_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end", "def refresh_session\n update_session(30.days.from_now)\n update_last_session\n end", "def update_session(data)\n connection = self.class.session_connection\n if @id\n # if @id is not nil, this is a session already stored in the database\n # update the relevant field using @id as key\n if SmartSession::SqlSession.locking_enabled?\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)}, lock_version=lock_version+1 WHERE id=#{@id}\")\n @lock_version += 1 #if we are here then we hold a lock on the table - we know our version is up to date\n else\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)} WHERE id=#{@id}\")\n end\n else\n # if @id is nil, we need to create a new session in the database\n # and set @id to the primary key of the inserted record\n self.class.query(\"INSERT INTO #{SmartSession::SqlSession.table_name} (`created_at`, `updated_at`, `session_id`, `data`) VALUES (NOW(), NOW(), '#{@session_id}', #{self.class.quote(data)})\")\n @id = connection.last_id\n @lock_version = 0\n end\n end", "def get_local_settings(app_settings)\n app_settings[\"session\"][:host_server] = @host_server\n app_settings[\"session\"][:port_server] = @port_server\n #if @login_name == @curr_user_name \n app_settings[\"session\"][:login_name] = @login_name# @curr_user_name\n #end \n app_settings[\"session\"][:password_login] = @password_login_md5 if @password_saved\n app_settings[\"session\"][:connect_type] = @serv_conn_type\n app_settings[\"web_http\"] = @server_type_http \n app_settings[\"session\"][:remote_web_srv_url] = @remote_web_url\n app_settings[\"session\"][:password_saved] = @password_saved \n end", "def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end", "def save_session(session)\n \n end", "def set_connected_user_info(info)\n session[:sos_note_usr_info] = info\n end", "def update\n respond_to do |format|\n if @admin_session.update(session_params)\n format.html { redirect_to @admin_session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_session }\n else\n format.html { render :edit }\n format.json { render json: @admin_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sessions = args[:sessions] if args.key?(:sessions)\n end", "def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end", "def update_activity_time\n session[:expires_at] = (configatron.session_time_out.to_i || 10).minutes.from_now\n end", "def update_session_statistics\n @session_travel_distance += @mission.travel_distance\n @missions_aborted += 1 if @mission.aborted?\n @explosions += 1 if @mission.exploded?\n @session_fuel_burned += @mission.fuel_burned\n @session_flight_time += @mission.flight_time\n end", "def session_set(name,value)\n session[name] = value\n end", "def update\n save_setting('program_name', Setting::NAME_CURR_PROGRAM_NAME)\n save_setting('timelapse_mode', Setting::NAME_TIMELAPSE_MODE)\n save_setting('interval', Setting::NAME_INTERVAL)\n save_setting_with('sensor_proximity', Setting::NAME_SENSOR_PROXIMITY, params['sensor_proximity'].include?('active') ? \"1\" : \"0\") if params['sensor_proximity']\n save_setting_with('sensor_vibration', Setting::NAME_SENSOR_VIBRATION, params['sensor_vibration'].include?('active') ? \"1\" : \"0\") if params['sensor_vibration']\n save_setting('sensor_time_between_photos', Setting::NAME_SENSOR_TIME_BETWEEN_PHOTOS)\n\n head :ok\n end", "def update\n @session_info = SessionInfo.first\n\n respond_to do |format|\n if @session_info.update_attributes(params[:session_info])\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activity_time\n session[:expires_at] = 15.minutes.from_now\n end", "def copy_session_variables!; end", "def session_options; end", "def session_options; end", "def set_session\n @session = FitnessSession.find(params[:id])\n end", "def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_session(parsed, session)\n session ||= Session.new\n session.id = parsed[parsed.keys.first][\"customerSessionId\"] if parsed[parsed.keys.first]\n end", "def update\n respond_to do |format|\n if @sevone_session.update(sevone_session_params)\n format.html { redirect_to @sevone_session, notice: 'Sevone session was successfully updated.' }\n format.json { render :show, status: :ok, location: @sevone_session }\n else\n format.html { render :edit }\n format.json { render json: @sevone_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ergo_session.update(ergo_session_params)\n format.html { redirect_to @ergo_session, notice: 'Ergo session was successfully updated.' }\n format.json { render :show, status: :ok, location: @ergo_session }\n else\n format.html { render :edit }\n format.json { render json: @ergo_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_session\n @session = current_session\n end", "def reload\n @session_id = nil\n login\n end", "def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end", "def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end", "def hubssolib_current_session=(new_session)\n @hubssolib_current_session = new_session\n end", "def set_session_details\n session = Authentication::Session.active_token_session(auth_token)\n session && set_account_cache(session.account, auth_token)\n end", "def setup\n session[:user_id]=1\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup\n @current_session = new_session\n end", "def start_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end", "def set_session\n ses = Session.find_or_create_by(\n account: self,\n )\n ses.update(expires_at: 10.minutes.from_now)\n end", "def user_session_update sid = \"\", uid = 0\n\t\tds = Sdb[:user_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend", "def create_session\n session[:who_is_this] = \"admin\"\n end", "def change_session_value\n if (params[:portfolio_id].present? && params[:property_id].present?)\n session[:portfolio__id] = \"\"\n session[:property__id] = params[:property_id]\n elsif( (session[:portfolio__id].present? && session[:property__id].blank?) )\n session[:portfolio__id] = session[:portfolio__id]\n session[:property__id] = \"\"\n else\n session[:portfolio__id] = \"\"\n session[:property__id] = session[:property__id]\n end\n end", "def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_session user\n session[:user_id] = user.id\n session[:user_fullname] = user.fullname\n session[:user_email] = user.email\n session[:user_access] = user.access\n session[:company_id] = user.company_id\n end", "def set_session\n @session = session[:user_id]\n end", "def update\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def store_session(using_token)\n if self.token != using_token\n self.update_attribute(self.send(:\"#{self.class.meetup_token_field}\"), using_token)\n end\n end", "def update_activity_time\n session[:expires_at] = DateTime.now + 30.minutes\n end", "def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end", "def save_to(session)\n attributes.each do |key, value|\n session[key] = value\n end\n self\n end", "def update\n respond_to do |format|\n if @user_site_session.update(user_site_session_params)\n format.html { redirect_to @user_site_session, notice: 'User site session was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_site_session }\n else\n format.html { render :edit }\n format.json { render json: @user_site_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_session\n @session = Session.find(params[:session_id])\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n flash[:notice] = 'Session was successfully updated.'\n format.html { \n if @session.course\n redirect_to(admin_course_session_path(@session.course, @session))\n else\n redirect_to(admin_session_path(@session))\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user_info\n @user_info = UserInfo.find_by_user_id(session[:user_id])\n if (@user_info == nil)\n @user_info = UserInfo.new(:user_id =>session[:user_id]).save\n end\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def update\n @bohconf_session = BohconfSession.find(params[:id])\n params[:bohconf_session][:starts_at] = params[:bohconf_session][:starts_at].to_time\n params[:bohconf_session][:ends_at] = params[:bohconf_session][:ends_at].to_time\n if @bohconf_session.update_attributes(session_params)\n redirect_to bohconf_path, notice: 'Session was successfully updated.'\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def session=( new_session )\n\t\tself.log.debug \"Setting session to %p in namespace %p\" % [ new_session, self.session_namespace ]\n\t\tnew_session.namespace = self.session_namespace\n\t\t@session = new_session\n\t\tself.log.debug \" session is: %p\" % [ @session ]\n\t\t# request.session = new_session # should it set the session in the request too?\n\tend", "def update!(**args)\n @dev_mode = args[:dev_mode] if args.key?(:dev_mode)\n @function = args[:function] if args.key?(:function)\n @parameters = args[:parameters] if args.key?(:parameters)\n @session_state = args[:session_state] if args.key?(:session_state)\n end", "def set_session(env, sid, session, options)\n raise '#set_session not implemented.'\n end", "def write_session(env, sid, session, options); end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @session\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def touch_session\n session[:touched] = 1\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_session\n session[:access_token] = user_credentials.access_token\n session[:refresh_token] = user_credentials.refresh_token\n session[:expires_in] = user_credentials.expires_in\n session[:issued_at] = user_credentials.issued_at\nend", "def set_session(env, sid)\n raise '#set_session needs to be implemented.'\n end", "def update\n @session = MovieSession.find(params[:id])\n event = Event.find(@session.event_id)\n @session.attributes = params[:movie_session]\n runningtime = @session.selection.running_time ? @session.selection.running_time : 120\n @session.end_at = @session.start + runningtime.minutes\n\n if @session.save\n redirect_to(@session, :notice => 'Session was successfully updated.')\n else\n render :action => \"edit\"\n end\n\n end", "def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @contextual_session_id = args[:contextual_session_id] if args.key?(:contextual_session_id)\n end", "def update_settings(opts = {})\n update(Settings, opts)\n end", "def set_session\n session['token'] = @result['data']['token']\n current_user\n end", "def tweak_session_attrs\n tweak_session_attrs_saml\n end" ]
[ "0.7494976", "0.6977965", "0.69675374", "0.69411284", "0.68269837", "0.6774522", "0.6759715", "0.67245764", "0.671641", "0.67149985", "0.67124414", "0.66844946", "0.6641827", "0.65772057", "0.65444505", "0.65294164", "0.65285784", "0.6491644", "0.647826", "0.6371836", "0.6358403", "0.63518274", "0.6349584", "0.6314112", "0.6306636", "0.6300631", "0.6252018", "0.62434554", "0.62214404", "0.6220855", "0.62109834", "0.62045", "0.6196449", "0.61720526", "0.61512077", "0.6141646", "0.61393875", "0.61384153", "0.61384153", "0.6133137", "0.6128399", "0.61242133", "0.6120377", "0.6108906", "0.61088765", "0.6107997", "0.6107637", "0.61062", "0.61062", "0.6103969", "0.6081769", "0.6079094", "0.607516", "0.607516", "0.607516", "0.607516", "0.6072978", "0.6067281", "0.6059713", "0.6050646", "0.60481364", "0.60400736", "0.6035282", "0.6030042", "0.6027711", "0.6027392", "0.6016465", "0.6009287", "0.6007915", "0.600485", "0.60035604", "0.5972142", "0.597198", "0.59711623", "0.5956013", "0.59500384", "0.5944457", "0.5944457", "0.5944457", "0.5944457", "0.5943714", "0.5941378", "0.5940998", "0.5928294", "0.5923324", "0.5923131", "0.59218496", "0.5915674", "0.59148717", "0.5912331", "0.5912331", "0.5912319", "0.59117454", "0.59034806", "0.58886415", "0.588423", "0.5878019", "0.58766246", "0.58735996", "0.5858449" ]
0.6176481
33
merge old, new to current session state
def merge_sessions( sid, old_s, new_s, cur={} ) unless Hash === old_s and Hash === new_s logger.error 'Bad old or new sessions provided.' return cur end delete = old_s.keys - new_s.keys logger.info "//@#{sid}: delete #{delete*','}" if not delete.empty? delete.each{ |k| cur.delete(k) } update = new_s.keys.select do |k| logger.debug "Update #{k}-#{new_s[k] != old_s[k]}? #{new_s[k].inspect} - #{old_s[k].inspect}"; new_s[k] != old_s[k] end logger.info "//@#{sid}: update #{update*','}" if not update.empty? update.each{ |k| cur[k] = new_s[k] } cur end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_session_variables!; end", "def restore\n GLOBAL_HASH_TABLE[@session_id]\n end", "def store_merge_state; end", "def store_merge_state; end", "def restore\n return unless @session\n @data = @session.data\n end", "def update_copy_session\n @user = current_user\n session[:copy_flag] = true\n end", "def restore_merge_state; end", "def restore_merge_state; end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def save_to_session\n\t\t\t\t\tresult = {}\n\t\t\t\t\t\n\t\t\t\t\tif !self.user_id.blank? && !self.role_ref.blank?\n\t\t\t\t\t\tresult[\"user_id\"] = self.user_id\n\t\t\t\t\t\tresult[\"role_ref\"] = self.role_ref\n\t\t\t\t\t\tresult[\"changed\"] = true\n\t\t\t\t\t\n\t\t\t\t\telsif !self.user_id.blank?\n\t\t\t\t\t\tresult[\"user_id\"] = self.user_id\n\t\t\t\t\t\tself.role_ref = self.user.role\n\t\t\t\t\t\tresult[\"role_ref\"] = self.role_ref\n\t\t\t\t\t\tresult[\"changed\"] = true\n\n\t\t\t\t\tend\n\n\t\t\t\t\treturn result\n\t\t\t\tend", "def update!(**args)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n @transcription_session_id = args[:transcription_session_id] if args.key?(:transcription_session_id)\n end", "def modify_state(new_state)\n conversation_state.merge(new_state)\n end", "def modify_state!(new_state)\n conversation_state.merge!(new_state)\n end", "def restore\n @session_data = {}\n java_session = @java_request.getSession(false)\n if java_session\n java_session.getAttributeNames.each do |k|\n if k == RAILS_SESSION_KEY\n marshalled_bytes = java_session.getAttribute(RAILS_SESSION_KEY)\n if marshalled_bytes\n data = Marshal.load(String.from_java_bytes(marshalled_bytes))\n @session_data.update data if Hash === data\n end\n else\n @session_data[k] = java_session.getAttribute(k)\n end\n end\n end\n @session_data\n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def touch_session\n session[:touched] = 1\n end", "def restore\n if @session\n @data = unmarshalize(@session.data)\n end\n end", "def set_state_top\n session[:state] = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end", "def dup_state\r\n @state.dup\r\n end", "def merge!( otherstate )\n\t\t@scopes.push( @scopes.pop + otherstate.scope )\n\t\t# self.attributes.merge!( otherstate.attributes )\n\t\tself.options.merge!( otherstate.options )\n\t\treturn self\n\tend", "def merge(opts)\n @state.merge! opts\n flush\n end", "def _set_session(env, sid, new_session, options)\n logger.debug \"Setting session #{new_session.inspect}\" \n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj\n logger.debug \"Found existing session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new( deserialize( ses_obj['data'] ) )\n else\n logger.debug \"Unable to find session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new\n end\n \n if options[:renew] or options[:drop]\n sessions.remove( { :_id => sid } )\n return false if options[:drop]\n sid = generate_sid\n sessions.insert( {:_id => sid, :data => {} } )\n end\n old_session = new_session.instance_variable_get('@old') || MongoRack::SessionHash.new\n logger.debug \"Setting old session -- #{old_session.inspect}\" \n merged = merge_sessions( sid, old_session, new_session, session )\n\n expiry = options[:expire_after]\n expiry = expiry ? Time.now + options[:expire_after] : 0\n\n # BOZO ! Use upserts here if minor changes ?\n logger.debug \"Updating session -- #{merged.inspect}\" \n sessions.save( { :_id => sid, :data => serialize( merged ), :expire => expiry } )\n return sid\n rescue => boom \n logger.error \"#{self} Hoy! Something went wrong. Unable to persist session.\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l }\n return false\n end", "def maintain_session_and_user\n if session[:id]\n if @application_session = Session.find_by_id(session[:id])\n @application_session.update_attributes(:ip_address => request.remote_addr, :path => request.path_info)\n @user = @application_session.person\n else\n flash[:notice] = \"Excuse me, but your session data appears to be outdated. Do you mind logging in again?\"\n session[:id] = nil\n redirect_to(root_url) #If he has an incorrect session id, send to root\n end\n end\n end", "def update\n java_session = @java_request.getSession(true)\n hash = @session_data.dup\n hash.delete_if do |k,v|\n if String === k\n case v\n when String, Numeric, true, false, nil\n java_session.setAttribute k, v\n true\n else\n if v.respond_to?(:java_object)\n java_session.setAttribute k, v\n true\n else\n false\n end\n end\n end\n end\n unless hash.empty?\n marshalled_string = Marshal.dump(hash)\n marshalled_bytes = marshalled_string.to_java_bytes\n java_session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)\n end\n end", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def set_state_right\n session[:state] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end", "def set_current_tags_state\n return unless params.dig 'site_page', 'tags_attributes'\n tags = params.dig('site_page', 'tags_attributes').split(' ')\n new_tags = []\n\n # Remove old ones\n @page.tags.find_each { |t| new_tags << { id: t.id, _destroy: 1 } unless tags.include?(t.value) }\n\n # Add new ones\n tags.delete_if { |t| @page.tags.pluck(:value).include?(t) }\n\n new_tags << tags.map { |t| { value: t } } if tags.any?\n new_tags.flatten!\n\n @page.tags_attributes = new_tags\n\n session[:tags_attributes][\"#{@page_id}\"] = new_tags\n end", "def update\n\t\tself.log.debug \"Updating session data for key %s\" % @id\n\t\tyield( self.serialized_data )\n\t\t@modified = false\n\tend", "def merge( otherstate )\n\t\tmerged = self.dup\n\t\tmerged.merge!( otherstate )\n\t\treturn merged\n\tend", "def reload\n @session_id = nil\n login\n end", "def new\n super\n reset_session\n end", "def restore #:nodoc:#\n @session_data = Cachetastic::Caches::RailsSessionCache.get(@session_key) do\n {}\n end\n end", "def set_state_left\n session[:state] = [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end", "def session=(new_session)\n if self.session?(new_session.class.session_store_type)\n original_session_id = self.session(new_session.class.session_store_type).session_id\n if new_session.session_id != original_session_id\n set_session_id_cookie(new_session.session_id)\n end\n end\n session_stores[new_session.class.session_store_type] = new_session\n end", "def refresh_session\n update_session(30.days.from_now)\n update_last_session\n end", "def remember(base)\n base.session[:last_visited_blog_id] = self.id\n base.session[:last_visited_blog_seo] = self.seo_id\n end", "def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def hubssolib_current_session=(new_session)\n @hubssolib_current_session = new_session\n end", "def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end", "def touch_auth_session\n if logged_in?\n auth_session.touch!\n end\n end", "def reset_current_session\n\n pop_session_frame\n push_session_frame\n\n end", "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def merge!( other, &block ) # :yields: key, sessionValue, otherValue\n\t\t@data.merge!( other, &block )\n\tensure\n\t\t@modified = true\n\tend", "def merge_cookie old_cookie\n return config['cookie'] if old_cookie.nil?\n DhEasy::Core::Helper::Cookie.update old_cookie, config['cookie']\n end", "def update(new_state)\n self.synchronize do\n if new_state.is_a? Simulation::System\n self.merge(new_state.state)\n else\n self.merge(new_state)\n end\n end\n end", "def set_current_tags\n if current_user.save_tags\n unless session.has_key?(:current_tags)\n session[:current_tags] = Array.new\n end\n session[:current_tags] = params[:tags]\n end\n end", "def reset_session\n if current_subdomain\n copier = lambda { |sess, (key, val)| sess[key] = val unless key == current_subdomain_symbol; sess }\n new_session = request.session.inject({}, &copier)\n super\n new_session.inject(request.session, &copier)\n else\n super\n end\n end", "def migrate_user_data\n if logged_in? && session.key?(:user_name)\n # Mocks the response from URS providing only the necessary keys to store the user data\n store_user_data('endpoint' => \"/api/users/#{session[:user_name]}\")\n\n # Remove this old value from the session\n session.delete(:user_name)\n end\n end", "def set_current_page_state\n session[:page][@page_id] = @page.attributes.except(:tags)\n end", "def reset!\n @sess_hash = {}\n end", "def restore_previous_session\n # Assume previous session belongs to user\n restore_previous_non_admin_session\n current_user.setRole('admin') if user_project_admin?\n end", "def save_session\n\t\tsession[:todos] = @todos.all_todos.to_json\n\tend", "def set_session(env, sid, new_session, options)\n# if options[:drop]\n# @sessions[sid] = nil\n# return false\n# end\n @sessions[sid] = new_session\n\n # Commit the repository, including session data.\n Maglev.commit_transaction\n return sid\n end", "def refresh\n @session = ::Session.new(user: current_user)\n\n if @session.save\n current_session.destroy\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def save_session(session)\n \n end", "def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end", "def reset_session_variables\n session[:login] = ''\n session[:register_id] = ''\n session[:register_name] = ''\n session[:folio_id] = ''\n session[:folio_image] = ''\n session[:first_folio_id] = ''\n session[:last_folio_id] = ''\n session[:browse_id] = ''\n session[:browse_image] = ''\n end", "def merge(otherMachine)\n\t\t@states.merge!(otherMachine.states)\n\tend", "def merge(otherMachine)\n\t\t@states.merge!(otherMachine.states)\n\tend", "def session=(val)\n @@session ||= []\n @@session[self.id] = val\n end", "def merge_old_identity!(old_identity)\n # Merge social profiles\n self.merge_social_profiles(old_identity) unless old_identity.social_profiles.empty?\n old_identity.archive!\n\n # Merge user/backend_user information.\n # Set the total sign in count on the user.\n # Carry over the backend_user from the old account.\n total_sign_in_count = self.sign_in_count + old_identity.sign_in_count\n self.update_columns(user_id: old_identity.user_id,\n backend_user_id: old_identity.backend_user_id,\n backend_user_type: old_identity.backend_user_type,\n sign_in_count: total_sign_in_count)\n\n # TODO: What else do we want to merge?\n end", "def session() request.session end", "def set_state_random_all\n session[:state] = [rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2),rand(2)]\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end", "def save_current_search_params\n # If it's got anything other than controller, action, total, we\n # consider it an actual search to be saved. Can't predict exactly\n # what the keys for a search will be, due to possible extra plugins.\n return if (search_session.keys - [:controller, :action, :total, :counter, :commit ]) == []\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n\n #new_search = Search.create(:query_params => params_copy)\n\n new_search = Search.new\n new_search.assign_attributes({:query_params => params_copy}, :without_protection => true)\n new_search.save\n\n session[:history].unshift(new_search.id)\n # Only keep most recent X searches in history, for performance.\n # both database (fetching em all), and cookies (session is in cookie)\n session[:history] = session[:history].slice(0, Blacklight::Catalog::SearchHistoryWindow )\n end\n end", "def set_current(session)\n @@current_session = session\n end", "def store_session(session_key)\n if self.session_key != session_key\n update_attribute(:session_key, session_key)\n end\n end", "def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend", "def refresh_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end", "def get_session_variables_from_authenticated_system\n @return_to_query = session[:return_to_query] || params[:return_to_query]\n @return_to = session[:return_to] || params[:return_to]\n @previous_protocol = session[:previous_protocol] || params[:previous_protocol]\n session[:return_to_query] = session[:return_to] = session[:previous_protocol] = nil\n end", "def save_to(session)\n attributes.each do |key, value|\n session[key] = value\n end\n self\n end", "def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end", "def transfer_order_items_from_previous_session\n if session[:cart_id].present? && Cart.find_by(id: session[:cart_id]).order_items.present?\n \n @cart = Cart.first_or_create(user_id: current_user.id)\n \n #we iterate through order_items of the cart which was in previous session, \n #and we add order items to our current_user cart (if order_item is present \n #in current_user cart then we update quantity of that order_item)\n #debugger\n Cart.find_by(id: session[:cart_id]).order_items.each do |order_item|\n if @cart.order_items.find_by(product_id: order_item.product_id).present?\n\n @cart.order_items.find_by(product_id: order_item.product_id).update_attributes(quantity: @cart.order_items.find_by(product_id: order_item.product_id).quantity + order_item.quantity)\n \n else\n \n order_item.update_attributes(cart_id: @cart.id)\n end \n end\n session[:cart_id] = @cart.id\n end\n end", "def populate_session(aPlayer)\n\t\tsession[:email] = @player.email\n\t\tsession[:player_id] = @player.id \n\t\tsession[:admin] = @player.admin\n\t\tsession[:login_time] = Time.now.to_i \n\tend", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def clear_new_flight_variables\n session[:new_flight] = Hash.new\n end", "def build_current_page_state\n # Update the page with the attributes saved on the session\n @page.assign_attributes session[:page][@page_id] if session[:page][@page_id]\n if params[:site_page] && page_params.to_h.except(:dataset_setting, :dashboard_setting, :tags)\n @page.assign_attributes page_params.to_h.except(:dataset_setting, :dashboard_setting, :tags)\n end\n\n @page.tags_attributes = session[:tags_attributes][\"#{@page_id}\"] if session[:tags_attributes][\"#{@page_id}\"]\n end", "def setInputsInSession()\n session[:dayComboId] = params[\"conflict_checker\"][\"day_combinations_id\"]\n session[:timeRanges] = params[\"conflict_checker\"][\"time_ranges\"]\n session[:buildingId] = params[\"conflict_checker\"][\"buildings_id\"]\n end", "def update_session(data)\n update_attribute('data', data) \n end", "def state\n \n session[ flow_session_name ].fetch( state_session_name )\n \n end", "def push_session\n session[:players].each do |player|\n params[player] = Hash.new()\n [:left_hand, :right_hand].each do |hand|\n params[player][hand] = session[player][hand]\n end\n end\n end", "def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end", "def session=( new_session )\n\t\tself.log.debug \"Setting session to %p in namespace %p\" % [ new_session, self.session_namespace ]\n\t\tnew_session.namespace = self.session_namespace\n\t\t@session = new_session\n\t\tself.log.debug \" session is: %p\" % [ @session ]\n\t\t# request.session = new_session # should it set the session in the request too?\n\tend", "def update_config(current, new)\n current.merge! new\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def save_session()\n @store\n end", "def old()\n\t\treturn @oldConfig\n\tend", "def reset_sessions\n reset_session_expired_at\n @application_session.update_attributes(\n :expired_at=>session_expired_at\n )\n end", "def open_session\n old_session = @current_session\n @current_session = new_session\n result = yield @current_session\n @current_session = old_session\n return result\n end", "def copy_object_to_session(hash)\n flash['session'] ||= {}\n hash.is_a?(Hash) && hash.each { |k,v| flash['session'][k] = v }\n persist_session!\n nil\n end", "def save_session\n active_session = self.active_session\n if(active_session)\n active_session.save\n end\n active_session\n end", "def session\r\n @session ||= {}\r\n end", "def save_session(params, session)\n\t\tsession[:zip] = params[:zip] if params[:zip]\n\t\tsession[:min_price] = params[:min_price].to_i if params[:min_price]\n\t\tsession[:max_price] = params[:max_price].to_i if params[:max_price]\n\t\tsession[:query] = params[:query].split(' ').join('+') if params[:query]\n\tend", "def save_current_search_params\n return if search_session[:q].blank? && search_session[:f].blank?\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n new_search = Search.create(:query_params => params_copy)\n session[:history].unshift(new_search.id)\n end\n end", "def logging_in\n guest_order = guest_user.current_order_in_progress\n current_order = current_user.current_order_in_progress\n current_order.merge guest_order\n end" ]
[ "0.6205462", "0.60833365", "0.60774887", "0.60774887", "0.6018721", "0.60031736", "0.59900403", "0.59900403", "0.59826654", "0.5953009", "0.5855512", "0.5820702", "0.58132696", "0.58038795", "0.57369757", "0.57249975", "0.57124716", "0.57119817", "0.57030267", "0.5684279", "0.5681924", "0.5676944", "0.5631372", "0.5630693", "0.5629914", "0.5629914", "0.56212723", "0.5599668", "0.5573569", "0.55574834", "0.5547027", "0.55410653", "0.5538535", "0.5536074", "0.5531854", "0.5513716", "0.5499651", "0.54991996", "0.54801613", "0.5471992", "0.54670864", "0.5466646", "0.54543906", "0.5430253", "0.5426742", "0.5426097", "0.5409682", "0.53945535", "0.5394144", "0.53900117", "0.5389136", "0.5374132", "0.536565", "0.5346899", "0.5335936", "0.53272706", "0.53040236", "0.5297799", "0.5296086", "0.5296086", "0.5283599", "0.52792156", "0.5279047", "0.52764523", "0.52721995", "0.5264397", "0.5263863", "0.5241726", "0.5232567", "0.5232448", "0.52192986", "0.5217668", "0.5214728", "0.521092", "0.52067447", "0.52067447", "0.52067447", "0.51919687", "0.5177646", "0.51685375", "0.51656157", "0.51651746", "0.5155432", "0.51489395", "0.51477206", "0.51452005", "0.5132206", "0.5132206", "0.5132206", "0.5132206", "0.5122333", "0.51219094", "0.5112559", "0.5112168", "0.5109182", "0.51050746", "0.5103422", "0.5102998", "0.5098961", "0.5092061" ]
0.69177705
0
Set the log level
def set_log_level( level ) case level when :fatal ::Logger::FATAL when :error ::Logger::ERROR when :warn ::Logger::WARN when :info ::Logger::INFO when :debug ::Logger::DEBUG else ::Logger::INFO end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_level=(level); end", "def log_level=(value)\n logger.level = value\n end", "def log_level=(value)\n logger.level = value\n end", "def log_level=(value)\n logger.level = value\n end", "def level=(level)\n @level = level\n @log.level = @level\n end", "def log_level=(val)\n @@log_level = val\n end", "def loglevel=(level)\n @log.level=level\n end", "def loglevel=(level)\n @loglevel = logger.level = level\n end", "def log_level=(level)\n logger.level = level\n end", "def log_level=(level)\n @logger.level = level\n end", "def setlog(level)\n $LOGLEVEL = level\n end", "def level=(level)\n logger.level = level\n end", "def level=(log_level)\n @@log_level = DEBUG_LEVEL[log_level]\n end", "def log_level=(level)\n writer.level = level if level.is_a?(Integer) && level.between?(0, 3)\n writer.level = LOG_LEVELS[level] ||\n raise(ArgumentError, \"unknown log level\")\n @level = level\n end", "def log_level=(level)\n\t if level == 'debug'\n\t\t\t@log.level = Logger::DEBUG\n\t\telsif level == 'info'\n\t\t\t@log.level = Logger::INFO\n\t\telsif level == 'warn'\n\t\t\t@log.level = Logger::WARN\n\t\telsif level == 'error'\n\t\t\t@log.level = Logger::ERROR\n\t\telsif level == 'fatal'\n\t\t\t@log.level = Logger::FATAL\n\t\tend\n\tend", "def log_level=(level)\n\t if level == 'debug'\n\t\t\t@log.level = Logger::DEBUG\n\t\telsif level == 'info'\n\t\t\t@log.level = Logger::INFO\n\t\telsif level == 'warn'\n\t\t\t@log.level = Logger::WARN\n\t\telsif level == 'error'\n\t\t\t@log.level = Logger::ERROR\n\t\telsif level == 'fatal'\n\t\t\t@log.level = Logger::FATAL\n\t\tend\n\tend", "def set_log_level(log_level)\n case log_level.downcase\n when 'debug'\n @logger.level = Logger::DEBUG\n when 'info'\n @logger.level = Logger::INFO\n when 'warn'\n @logger.level = Logger::WARN\n when 'error'\n @logger.level = Logger::ERROR\n when 'fatal'\n @logger.level = Logger::FATAL\n end\n end", "def set_level(level)\n if SEVERITY.has_key? level\n @log_level=level\n else\n raise ArgumentError, \"Invalid log level given\"\n end\n end", "def log_level=(log_level)\n @log_level = log_level if [DEBUG, INFO, WARN, ERROR].include?(log_level)\n end", "def level=(new_level)\n @logger.level=Logger::Severity.const_get(new_level.to_sym.upcase)\n end", "def set_level(level)\n Merb::Config[:log_level] = level\n Merb.reset_logger!\n end", "def set_logging_level(level)\n level = level.to_s.downcase\n if %w[debug info warn error fatal unknown].include?(level)\n @logger.level = level.to_sym\n else\n @logger.warn('Invalid logger level')\n end\n end", "def level=(val)\n # Convert strings to the constant value\n val = convert_level(val)\n\n # Update the default log level\n @default_level = val\n\n # Set all loggers' log levels\n @loggers.each do |key, logger|\n logger.level = val\n end\n end", "def log_level(value)\n Logger.log_level = value\n return nil\n end", "def log_level level\n level = Deployable::Logger.const_get level.upcase unless \n level.kind_of? ::Fixnum\n\n @log.level = level\n end", "def log_set (level)\n execute(:log_set, level)\n end", "def level=(value)\n @loggers.each do |logger|\n logger.level = value if logger.respond_to?(:level=)\n end\n end", "def logging_level=(level)\n level = Integer(level)\n raise ArgumentError, \"invalid logging level value #{level}\" if level < 1\n @logging_level = level\n end", "def level=(value)\n logger_instance.level = self.class.level_from_any(value)\n end", "def loglevel= level\n self.class.createlogger unless self.class._logobject\n level = level.to_s.downcase.to_sym\n unless JLogger::Simple::LEVELS.has_key? level\n raise ArgumentError, \"'#{level}' is an invalid loglevel\"\n end\n \n self.class._logobject.level = JLogger::Simple::LEVELS[level]\n end", "def level=(level)\n @level = level.to_s.downcase.to_sym\n\n loggers.each do |_, logger|\n logger.level = @level\n end\n\n @level\n end", "def set_log_level(level=nil)\n defined?(Rails) and (default = (Rails.env.production? ? \"INFO\" : \"DEBUG\")) or (default = \"INFO\")\n log_level = (ENV['LOG_LEVEL'] || level || default)\n self.level = ZTK::Logger.const_get(log_level.to_s.upcase)\n end", "def level=(new_level)\n logger.level = severity_lookup(new_level, :info)\n end", "def log_level=(_arg0); end", "def log_level=(_arg0); end", "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "def level=(level)\n init unless @initialized\n unless @level_frozen\n new_level = case level\n when Symbol then level_from_sym(level)\n when String then level_from_sym(level.to_sym)\n else level\n end\n if new_level != @level\n @logger.info(\"[setup] setting log level to #{level_to_sym(new_level).to_s.upcase}\")\n @logger.level = @level = new_level\n end\n end\n level = level_to_sym(@level)\n end", "def set_level(src, level)\n\t\tlog_levels[src] = level.to_i\n\tend", "def level=(val)\n unless LEVELS.include?(val)\n fail \"Unknown log level, valid values are: #{LEVELS}\"\n end\n\n # Map the log4r levels to our simplified 3 level system\n # log4r level order is DEBUG < INFO < WARN < ERROR < FATAL\n case val\n when :normal\n # Output everything except debug statements\n console.level = Logger::INFO\n # Output everything\n log_files(:level=, Logger::DEBUG) unless console_only?\n when :verbose\n console.level = Logger::DEBUG\n log_files(:level=, Logger::DEBUG) unless console_only?\n when :silent\n # We don't use any fatal messages, so this is effectively OFF\n console.level = Logger::FATAL\n log_files(:level=, Logger::DEBUG) unless console_only?\n end\n\n @level = val\n end", "def level=(value)\n @level = ::Logger::Severity.const_get(value.to_s.upcase)\n end", "def severity= severity\n @logger.level = severity\n end", "def set_level(name, level=nil)\n # Default\n unless level then\n level = name\n name = nil\n end\n\n # Look up the level if the user provided a :symbol or \"string\"\n level = MultiLog.string_to_level(level.to_s) unless level.is_a? Fixnum\n\n if name\n # Set a specific one\n raise \"No log by the name '#{name}'\" unless @logdevs[name]\n @logdevs[name][:level] = level\n else\n # Set them all by default \n @logdevs.each{|_, logdev| logdev[:level] = level }\n end\n end", "def set_log_level\n logger.level = options[:quiet] ? Logger::FATAL : Logger::WARN\n logger.level = Logger::INFO if options[:verbose]\n logger.info(\"Logger.level set to #{logger.level}\")\n raise OptionsError.new(\"Option mismatch - you can't provide -v and -q at the same time\") if options[:quiet] && options[:verbose]\n end", "def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend", "def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend", "def log_level; end", "def log_level; end", "def level=(severity)\n raise TypeError, \"invalid log level: #{severity}\" if !severity.is_a? Integer\n @level = severity\n end", "def log_level(level)\n\t\t\t@sys_lock.synchronize {\n\t\t\t\t@log_level = Control::get_log_level(level)\n\t\t\t\tif @controller.active\n\t\t\t\t\t@logger.level = @log_level\n\t\t\t\tend\n\t\t\t}\n\t\tend", "def set_logger(logger, level)\n @debug_level = level.to_i\n @logger=logger\n end", "def level=(level) # needed to meet the Sentry spec\n @level = level.to_s == \"warn\" ? :warning : level\n end", "def level= severity\n new_level = derive_severity severity\n fail ArgumentError, \"invalid log level: #{severity}\" if new_level.nil?\n @level = new_level\n end", "def log_level\n @log_level ||= :debug\n end", "def log_level\n @log_level ||= :debug\n end", "def level(l)\n @config[:level] = l\n end", "def set_log_level(flags)\n options = %w{none basic triggers trigger_summary entries exits closures}.map(&:to_sym)\n flags = Array.wrap(flags)\n unless flags.all? { |flag| options.member? flag }\n flags.each do |flag|\n unless options.member? flag\n raise ArgumentError, \"log level :#{flag} is not one of the support options: #{options.join(', ')}\"\n end\n end\n end\n @log_flags = flags\n end", "def level; @logger.level; end", "def handle_loglevel(val)\n\t\tset_log_level(Rex::LogSource, val)\n\t\tset_log_level(Msf::LogSource, val)\n\tend", "def loglevel(level)\n if level < 0 or level > 2\n return nil\n end\n @loglevel = level\n return @loglevel\n end", "def irc_log_level=(level)\n set(:irc_log_level, MonoLogger.const_get(level))\n if self.log\n self.log.level = self.irc_log_level\n end\n end", "def level\n @log.level\n end", "def level=(level)\n if (level < 2)\n Logger.log_internal(4) do \"PubOutputter: Can't allow log level to be set to DEBUG\" end\n level = 2\n end\n super\n end", "def log_level(value, options = {})\n DuckMap::Logger.log_level = value\n if options.has_key?(:full)\n DuckMap.logger.full_exception = options[:full]\n end\n end", "def logger_level=(level)\n ::Mongo::Logger.logger.level = case level\n when :debug\n ::Logger::DEBUG\n when :fatal\n ::Logger::FATAL\n else\n nil\n end\n end", "def set_log_level(logger, config)\n log_level = get_log_level(config)\n logger.level = log_level\n return logger\n end", "def logger_level; end", "def severity=(level)\n if level.is_a?(String)\n severity = {\n 'FATAL' => Logger::Severity::FATAL,\n 'ERROR' => Logger::Severity::ERROR,\n 'WARN' => Logger::Severity::WARN,\n 'INFO' => Logger::Severity::INFO,\n 'DEBUG' => Logger::Severity::DEBUG,\n '4' => Logger::Severity::FATAL,\n '3' => Logger::Severity::ERROR,\n '2' => Logger::Severity::WARN,\n '1' => Logger::Severity::INFO,\n '0' => Logger::Severity::DEBUG\n }[level.upcase()]\n raise \"#{level} is not a severity\" if severity.nil?\n level = severity\n elsif level < Logger::Severity::DEBUG || Logger::Severity::FATAL < level\n raise \"#{level} is not a severity\"\n end\n @logger.level = level\n end", "def show_log(log_level = \"debug\")\n get_eval \"LOG.setLogLevelThreshold('#{log_level}')\"\n end", "def show_log(log_level = \"debug\")\n get_eval \"LOG.setLogLevelThreshold('#{log_level}')\"\n end", "def log_level\n @log_level ||= \"Log4r::#{@options[:log_level].upcase}\".constantize\n end", "def level=(severity)\n if severity.is_a?(Integer)\n @level = severity\n else\n _severity = severity.to_s.downcase\n case _severity\n when 'debug'\n @level = DEBUG\n when 'info'\n @level = INFO\n when 'warn'\n @level = WARN\n when 'error'\n @level = ERROR\n when 'fatal'\n @level = FATAL\n when 'unknown'\n @level = UNKNOWN\n when 'null'\n @level = NULL\n else\n raise ArgumentError, \"invalid log level: #{severity}\"\n end\n end\n end", "def level=(value)\n @level = value\n end", "def level=(value)\n @level = value\n end", "def log_level\n @log_level ||= WARN\n end", "def level=( level )\n super(level || 0)\n end", "def log_level\n case @log_level\n when Symbol, String\n Log.level_from_sym(@log_level.to_sym)\n else\n @log_level\n end\n end", "def loglevel\n @loglevel ||= ::Logger::WARN\n end", "def logging_level\n @logging_level\n end", "def setLogger(log_file, level = :info)\n $logger = Lumberjack::Logger.new(log_file.to_s, buffer_size: 0) # Open a new log file with INFO level\n $logger.level = level\n puts \"#{level} logging to #{log_file}\"\nend", "def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end", "def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end", "def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end", "def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.agent.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end", "def log_level\n @log_level ||= (\n user_configuration_from_key('solr', 'log_level') ||\n LOG_LEVELS[::Rails.logger.level]\n )\n end", "def log level, message; write level, message, caller[0] unless level > @level end", "def configure_logging(loglevel)\n return if loglevel == :none\n if self.options[:log_file].nil?\n\tKitchenplan::Log.init(Kitchenplan::Log::MultiIO.new(STDOUT))\n else\n\tfile = File.open(options[:log_file],\"a\")\n\tKitchenplan::Log.init(Kitchenplan::Log::MultiIO.new(STDOUT,file))\n end\n Kitchenplan::Log.level = loglevel\n end", "def level=(level)\n @level_index = self.class.map_level_to_index(level)\n @level = level\n end", "def level\n logger.level\n end", "def add_log_level(str)\n # Need a check since debug has a different identifier than the rest\n str = @level == 'debug' ? 'DBUG' : @level[0..3].upcase\n str = add_color_key(str) if with_color\n str += + \" | \"\n end", "def level=(lvl)\n @level = if lvl.is_a?(Integer)\n lvl\n else\n Level::NAME_TO_LEVEL.fetch(lvl.to_s.upcase)\n end\n end", "def log_level\n LOG_LEVELS[::Rails.logger.level]\n end", "def log(message)\n logger.send log_level, message if log?\n end", "def set_debug_level(val)\n super\n end", "def set_debug_level(val)\n super\n end", "def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.console.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end", "def levels (args)\n if !instance_variable_defined?(:@log_level)\n Logging.class_eval(Conf.define_accessor(\"log_level\"))\n @log_level = {}\n end\n args.each do |k,v|\n @log_level[k] = v\n end\n end", "def level=(level)\n @level = level\n @implementation.level = @level if @implementation\n level\n end", "def option_logging\n block = proc { |level| Logging::Logger.root.level = level; propagate_option('--logging', level) }\n @cl_parser.on('--logging LEVEL', 'Specify the minimum log level that should be logged.', &block)\n end", "def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend" ]
[ "0.86843663", "0.8623332", "0.8623332", "0.8622839", "0.8587217", "0.85355294", "0.8532065", "0.8525419", "0.84927607", "0.8450167", "0.82992613", "0.8293287", "0.8149891", "0.81405145", "0.8133903", "0.8133903", "0.8060652", "0.80339855", "0.800927", "0.7959342", "0.79509115", "0.79412854", "0.79135835", "0.7848174", "0.78247094", "0.7800492", "0.77948964", "0.7778274", "0.77747864", "0.77373135", "0.77191836", "0.7655594", "0.76505995", "0.7616357", "0.7616357", "0.75925314", "0.75925314", "0.75470656", "0.75056005", "0.74865705", "0.7431574", "0.74208784", "0.73161346", "0.72481835", "0.7246116", "0.7246116", "0.72261196", "0.72261196", "0.7209179", "0.71853024", "0.71701324", "0.7139931", "0.7139845", "0.7091262", "0.7091262", "0.7078023", "0.7077375", "0.7010902", "0.6995024", "0.69918483", "0.6943964", "0.69286925", "0.6873351", "0.6857525", "0.6845674", "0.6843003", "0.6832216", "0.68201655", "0.68059397", "0.68059397", "0.6799102", "0.6788212", "0.6783557", "0.6783557", "0.67501354", "0.67499924", "0.6720117", "0.671583", "0.67016387", "0.66790617", "0.6665072", "0.6665072", "0.6665072", "0.6663477", "0.6660725", "0.66542137", "0.66000843", "0.65837526", "0.65456796", "0.65215445", "0.65204126", "0.65123856", "0.6511908", "0.6505863", "0.6505863", "0.6483108", "0.6476232", "0.6474703", "0.64671326", "0.64640087" ]
0.79409564
22
Use callbacks to share common setup or constraints between actions.
def fights_params params.require(:fight).permit('opponent_1_name', 'opponent_1_strength', 'opponent_1_life', 'opponent_1_adv', 'opponent_2_name', 'opponent_2_strength', 'opponent_2_life', 'opponent_2_adv', 'opponent_3_name', 'opponent_3_strength', 'opponent_3_life', 'opponent_3_adv', 'opponent_4_name', 'opponent_4_strength', 'opponent_4_life', 'opponent_4_adv', 'opponent_5_name', 'opponent_5_strength', 'opponent_5_life', 'opponent_5_adv') 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 set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def 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 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 before_action \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 after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def duas1(action)\n action.call\n action.call\nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def call\n setup_context\n super\n end" ]
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", "0.5312988", "0.529798", "0.52968603", "0.52962637", "0.52577317", "0.5244704", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5233461", "0.52322435", "0.5227552", "0.52224743", "0.5217851", "0.521241", "0.52069896", "0.5206555", "0.5176617", "0.51738507", "0.51725876", "0.51660734", "0.51605034", "0.51571786", "0.5152762", "0.5152164", "0.5151477", "0.5145819", "0.51408994", "0.5134412", "0.5114031", "0.5113695", "0.5113695", "0.5108603", "0.5107358", "0.5090405", "0.50889385", "0.50817686", "0.5081617", "0.50658226", "0.50551206", "0.5051746", "0.5049091", "0.5049091", "0.5034681", "0.5024972", "0.5021291", "0.5016024", "0.50134826", "0.50008893", "0.50000244", "0.4999155", "0.49907947", "0.49907947", "0.49853387", "0.49796683", "0.4979596", "0.49778128", "0.49673793", "0.49662578", "0.49587822", "0.4956063", "0.49550167", "0.49523485", "0.4951614", "0.49452996", "0.49442068", "0.49336892", "0.49306205", "0.49264124", "0.49259305", "0.4925823", "0.49229056", "0.4918999", "0.49171805", "0.49167436", "0.4916559", "0.49153692", "0.49148256" ]
0.0
-1
GET /auctions GET /auctions.json
def index @auctions = Auction.joins(:profile).filter(params.slice(:by_country, :by_city, :by_gender, :by_age_from, :by_age_to)).active.charitable_first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def index\n user_id = @user.id\n @auctions = Auction.where(\"seller_id = ?\", user_id)\n\n # get all belong auctions\n render json: @auctions\n end", "def show\n render json: @auction\n end", "def index\n if current_user.admin? || current_user.creator?\n @auctions = Auction.all\n else\n @auctions = current_user.auctions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def show\n\t\trender json: @auction_item.as_json\n\tend", "def index\n #@auctions = Auction.all\n\t@search = Auction.search(params[:search])\n @auctions = @search.all\n\t@auctions = @search.paginate(:page => params[:page], :per_page => 8)\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def index\n @auction_items = AuctionItem.all\n end", "def index\n @auctions = Auction.find_consignments\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n @bids = @item.auction.bids\n end", "def all \n @auctions\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def index\n\n @auctionables = Auctionable.all\n end", "def bid_lists\n\t\tauction_item_bids = @auction.auction_item_bids.where(user_id: current_user.id)\n\t\trender json: @auction_item_bids.as_json\n\tend", "def show\n #@item = Bid.find(params[:auction_uniq_id])\n\n @bid = Bid.all\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end", "def show\n \n @auction = Auction.find(params[:id])\n\tadd_crumb @auction.title, ''\n\t\n\t# check the owner of auction\n\t@user = User.find(@auction.user_id)\n\t@owner = current_user == @user\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @arrangements = Arrangement.query_list(params[:auction_id], params[:accept_status])\n render json: @arrangements, status: 200\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\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 index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def index\n @auction1s = Auction1.all\n \n end", "def show\n @auction = Auction.find(params[:id])\n @auction_users = AuctionUser.find_all_by_auction_id(params[:id])\n if (@auction.phase == Auction::PHASES[:first]) || (@auction.phase == Auction::PHASES[:start]) && !(current_user.auction_admin?)\n @auction_user = AuctionUser.find_by_user_id(current_user.id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @merchant = Merchant.find(session[:user_id])\n \n @auctions = Auction.find(:all, :conditions => [\"`merchant_id` = ? and auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\",@merchant.merchant_id, Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @merchants }\n end\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def new\n @auction = Auction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def show\n render json: @bid\n end", "def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end", "def item(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V2/auctionItem\", Yahoo::Api.merge(opts))\r\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @biddings = Bidding.all\n end", "def index\n \n @admins = Admin.find(:all)\n \n @merchants = Merchant.find(:all, :order => \"merchant_name\")\n \n @auctions = Auction.find(:all, :conditions => [\"auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\", Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n if a.auction_end < Time.now.iso8601 \n a.auction_expired = 1\n end\n \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admins }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @auction_values = Auction::Value.all\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def birds_list\n birds = ::Bird.all\n render status: HttpCodes::OK,json: birds.extend(BirdRepresenter).to_a.as_json unless birds.empty?\n render status: HttpCodes::OK,json: {} if birds.empty?\n end", "def new\n authenticate_user!\n @auction = Auction.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end", "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def show\n @user = User.find_by_id(session[:user_id])\n @auction = Auction.find(params[:id])\n @seller = User.find_by_username(@auction.user_name)\n @bid = Bid.new\n @bid.auction_id = @auction.id\n @bid_count = Bid.find_by_sql(\"SELECT COUNT(auction_id) AS bid_count FROM bids WHERE auction_id = #{@auction.id}\")\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction }\n end\n end", "def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end", "def index\n @holdings = Holding.select(\"*, ((bid - price) * qty) as gain\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holdings }\n end\n end", "def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end", "def index\n @bid_requests = BidRequest.all\n end", "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 index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end", "def index\n @current_auctions = Auction.approved.current.custom_order\n @pending_auctions = Auction.approved.pending.custom_order\n @past_auctions = Auction.approved.past.custom_order\n end", "def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end", "def birds\n @birds = Api::V1::Bird.all\n @serializer = ActiveModel::ArraySerializer\n\n #if regularity is not defined get all birds\n if params[:regularity].blank?\n render json: {\n status: 200,\n message: \"OK\",\n totalCount: @birds.count,\n birds: @serializer.new(@birds, each_serializer: Api::V1::BirdSerializer) \n }\n \n \n #if regularity is defined get birds based on regularity\n else\n @regularity = params[:regularity].split(\",\")\n @birds = @birds.where(regularity: @regularity)\n render json: \n { \n status: 200,\n message: \"OK\",\n totalCount: @birds.count,\n birds: @serializer.new(@birds, each_serializer: Api::V1::BirdSerializer) \n }\n end\n end", "def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\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 index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end", "def auctions(user)\n Auction.joins(:bids).merge(Bid.where(source: user))\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n birds = Bird.all\n render json: birds.to_json(except: [:created_at, :updated_at])\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def show\n \trespond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "def bid_history\n bid_histories = BidHistory.for_vehicle_id_and_auction_date(params[:id], params[:auction_date])\n member_ids = bid_histories.map(&:member_id).compact\n\n bid_histories_json = if member_ids.blank?\n bid_histories.as_json\n else \n members = Hash[MemberResource.find_by_ids(member_ids).map {|member| [member.id, parse_member_country_state(member) ] } ]\n members.blank? ? bid_histories.as_json : bid_histories.map{ |bid_history| bid_history.as_json().merge!(member: fill_members_data(members[bid_history.member_id]))}\n end\n\n respond_to do |format| \n format.json { render json: { bidHistories: bid_histories_json }}\n end\n end", "def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end", "def set_bid\n @bid = Bid.find_by({\n :id => params[:id],\n :auction_id => params[:auction_id]})\n\n render json: nil, status: :not_found if @bid.nil? || @bid.auction.seller.id != @user.id\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end", "def index\n categories = {\n \"categoryId\": params[:ids]\n }\n auction_categories = Auction::Category.list categories\n if auction_categories[:comm][:code] == \"200\"\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {auction_categories: auction_categories[:data]}}\n else\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {}}\n end\n end", "def index\n @advert = Advert.find(params[:advert_id])\n @bids = @advert.bids\n end", "def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend", "def index\n @holders = Holder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holders }\n end\n end", "def getAuctionJSON\n\n\t\tbegin\n\t\t\tjson = open(@dataURL).read\n\n\t\t\tif !json.include? \"ownerRealm\"\n\t\t\t\n\t\t\t\traise \"Recieved something unexpected: \\n #{json} \\n of class: #{json.class}\"\n\n\t\t\tend\n\n\t\t\treturn json\n\n\t\trescue => e\n\t\t\t\n\t\t\tputs \"Failed to download the Auction JSON data.\\n #{e}\"\n\t\t\t@log.error \"Failed to download the Auction JSON data.\\n #{e}\"\n\n\t\t\treturn false\n\n\t\tend\n\n\tend", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @books = Book.all\n render json: @books\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 show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_bid }\n end\n end" ]
[ "0.79955554", "0.78944343", "0.7664202", "0.7439421", "0.72564614", "0.7212158", "0.7060244", "0.7010294", "0.6995", "0.69549745", "0.68647814", "0.6830017", "0.6798124", "0.6765328", "0.6748584", "0.6702673", "0.66579986", "0.6636632", "0.6569685", "0.65559703", "0.65355676", "0.652833", "0.6500525", "0.6419719", "0.63626766", "0.6340896", "0.63180953", "0.6288232", "0.62515473", "0.62359744", "0.6183015", "0.61553794", "0.6124892", "0.6112571", "0.61113936", "0.6111127", "0.60963035", "0.6093152", "0.6087543", "0.60698605", "0.60476804", "0.60357213", "0.6018141", "0.60021454", "0.5995123", "0.5994485", "0.5965025", "0.5957547", "0.59546787", "0.595284", "0.5943532", "0.59421617", "0.59332716", "0.5930157", "0.59298295", "0.5922899", "0.5920976", "0.59198403", "0.5918975", "0.5893697", "0.58828044", "0.587908", "0.58776164", "0.5873848", "0.5864234", "0.5858086", "0.5858086", "0.5858086", "0.5837684", "0.58334804", "0.58288956", "0.5827813", "0.5821833", "0.58169425", "0.58122766", "0.5809831", "0.58085096", "0.5798509", "0.5794499", "0.5782003", "0.5776823", "0.5770785", "0.57673055", "0.5758721", "0.57569134", "0.5746557", "0.574576", "0.57452816", "0.57446724", "0.57442695", "0.5740963", "0.57272166", "0.5726853", "0.5726853", "0.5726853", "0.5726853", "0.5726853", "0.57257676", "0.57203245", "0.5718968", "0.5717648" ]
0.0
-1
GET /auctions/1 GET /auctions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def show\n render json: @auction\n end", "def show\n\t\trender json: @auction_item.as_json\n\tend", "def index\n user_id = @user.id\n @auctions = Auction.where(\"seller_id = ?\", user_id)\n\n # get all belong auctions\n render json: @auctions\n end", "def show\n #@item = Bid.find(params[:auction_uniq_id])\n\n @bid = Bid.all\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end", "def show\n \n @auction = Auction.find(params[:id])\n\tadd_crumb @auction.title, ''\n\t\n\t# check the owner of auction\n\t@user = User.find(@auction.user_id)\n\t@owner = current_user == @user\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n if current_user.admin? || current_user.creator?\n @auctions = Auction.all\n else\n @auctions = current_user.auctions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def new\n @auction = Auction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @auction_items = AuctionItem.all\n end", "def show\n @auction = Auction.find(params[:id])\n @auction_users = AuctionUser.find_all_by_auction_id(params[:id])\n if (@auction.phase == Auction::PHASES[:first]) || (@auction.phase == Auction::PHASES[:start]) && !(current_user.auction_admin?)\n @auction_user = AuctionUser.find_by_user_id(current_user.id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @auction1s = Auction1.all\n \n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def index\n @auctions = Auction.find_consignments\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def index\n @bids = @item.auction.bids\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def index\n #@auctions = Auction.all\n\t@search = Auction.search(params[:search])\n @auctions = @search.all\n\t@auctions = @search.paginate(:page => params[:page], :per_page => 8)\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def item(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V2/auctionItem\", Yahoo::Api.merge(opts))\r\n end", "def new\n authenticate_user!\n @auction = Auction.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def show\n render json: @bid\n end", "def all \n @auctions\n end", "def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "def index\n\n @auctionables = Auctionable.all\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def show\n @bid = current_user.bids.where(auction_id: params[:auction_id]).order(amount: :desc).offset(1).first\n end", "def show\n @user = User.find_by_id(session[:user_id])\n @auction = Auction.find(params[:id])\n @seller = User.find_by_username(@auction.user_name)\n @bid = Bid.new\n @bid.auction_id = @auction.id\n @bid_count = Bid.find_by_sql(\"SELECT COUNT(auction_id) AS bid_count FROM bids WHERE auction_id = #{@auction.id}\")\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction }\n end\n end", "def index\n @merchant = Merchant.find(session[:user_id])\n \n @auctions = Auction.find(:all, :conditions => [\"`merchant_id` = ? and auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\",@merchant.merchant_id, Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @merchants }\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 index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def index\n @arrangements = Arrangement.query_list(params[:auction_id], params[:accept_status])\n render json: @arrangements, status: 200\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def bid_lists\n\t\tauction_item_bids = @auction.auction_item_bids.where(user_id: current_user.id)\n\t\trender json: @auction_item_bids.as_json\n\tend", "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 @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def set_auction1\n @auction1 = Auction1.find(params[:id])\n end", "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_bid }\n end\n end", "def set_bid\n @bid = Bid.find_by({\n :id => params[:id],\n :auction_id => params[:auction_id]})\n\n render json: nil, status: :not_found if @bid.nil? || @bid.auction.seller.id != @user.id\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def show\n render \"api/v1/bounties/show\"\n end", "def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end", "def show\n\n\n @buisness = Buisness.find(params[:id])\n\n if @buisness==nil\n render text: \"Cannot find the specified buisness in the database\"\n end\n render json: @buisness\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 set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end", "def new\n @bid = Bid.new\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def show\n \trespond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end", "def get_bike(bikeID, userID)\n user = User.find_by(id: userID)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/gear/'+bikeID, {Authorization: 'Bearer ' + user.access_token})\n bike = JSON.parse(response)\n end", "def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\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 @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end", "def create\n @auction = Auction.new(auction_params)\n\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: 'Запись успешно создана.' }\n format.json { render :show, status: :created, location: @auction }\n else\n format.html { render :new }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auction = Auction.new(params[:auction])\n\t\n\t#authorize! :read, @auction\n\t\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: 'Auction was successfully created.' }\n format.json { render json: @auction, status: :created, location: @auction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render(:json => Burn.find(params[:id]).as_json)\n rescue ActiveRecord::RecordNotFound\n render(:json => {error: \"no burn with that id found}\"}, :status => 404)\n end", "def index\n \n @admins = Admin.find(:all)\n \n @merchants = Merchant.find(:all, :order => \"merchant_name\")\n \n @auctions = Auction.find(:all, :conditions => [\"auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\", Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n if a.auction_end < Time.now.iso8601 \n a.auction_expired = 1\n end\n \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admins }\n end\n end", "def index\n @auction_values = Auction::Value.all\n end", "def show\n coin = Coin.find(params[:id]) \n require 'net/http'\n url = url = \"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=#{coin.coin_api_id}&order=market_cap_desc&per_page=100&page=1&sparkline=false&price_change_percentage=1h\"\n request = URI.parse(url)\n response = Net::HTTP.get_response(request)\n crypto_hash = JSON.parse(response.body)\n coin.image = crypto_hash[0]['image']\n coin.current_price = crypto_hash[0]['current_price']\n coin.price_change_percentage_1h_in_currency = crypto_hash[0]['price_change_percentage_1h_in_currency']\n coin.high_24h = crypto_hash[0]['high_24h']\n coin.low_24h = crypto_hash[0]['low_24h']\n coin.total_volume = crypto_hash[0]['total_volume']\n coin.market_cap = crypto_hash[0]['market_cap']\n coin.market_cap_rank = crypto_hash[0]['market_cap_rank']\n coin.circulating_supply = crypto_hash[0]['circulating_supply']\n\n # Serializer\n # render json: CoinSerializer.new(coin)\n render json: coin\n end", "def show\n @our_coin = OurCoin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @our_coin }\n end\n end", "def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end", "def create\n @auction = Auction.new(params[:auction])\n @auction.phase = Auction::PHASES[:init]\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: t('auctions.flash.notice.created') }\n format.json { render json: @auction, status: :created, location: @auction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def items_for_bidder\n @auction_item = AuctionItem.where([\"bidderNumber = ?\", params[:id]])\n\n respond_to do |format|\n format.html # items_for_bidder.html.erb\n end \n end", "def show\n @holding = Holding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holding }\n end\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def create\n @auction = Auction.new(auction_params)\n @auction.seller = @user\n\n if @auction.save\n render json: @auction, status: :created, location: seller_auction_url(@auction)\n else\n render json: @auction.errors, status: :unprocessable_entity\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def bird_specification\n @bird = Bird.find(params[:id])\n if @bird\n @bird = JSON.parse(@bird.to_json)\n @bird[\"id\"]=params[:id]\n render json: @bird.except(\"_id\"), status: :ok\n else\n render :nothing => true, status: :not_found\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def new\n @bidding = Bidding.new\n @item = Item.find(cookies[:remember_item_token])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bidding }\n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @holdings = Holding.select(\"*, ((bid - price) * qty) as gain\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holdings }\n end\n end", "def index\n @biddings = Bidding.all\n end", "def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end", "def show\n @brain = Brain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brain }\n end\n end", "def show\n @bidding = params[:bidding]\n @bid_event = BidEvent.new\n @bid_amount = @auctionable.bid_events.blank? ? @auctionable.base_price : @auctionable.bid_events.last.amount\n @participants = Participant.all\n render layout: 'application'\n end", "def create\n \tbid_p = (params[:bid] || {}).merge({user:current_user})\n \tbegin\n\t\t @bid = @auction.bid(bid_p)\n\t\t respond_to do |format|\n\t\t if @bid.save\n\t\t format.html { redirect_to @auction, notice: t(:bid_created) }\n\t\t format.json { render json: @auction, status: :created, location: @bid }\n\t\t else\n\t\t format.html { render action: \"new\" }\n\t\t format.json { render json: @bid.errors, status: :unprocessable_entity }\n\t\t end\n\t\t end\n\t rescue Exception => e\n\t \tredirect_to @auction, notice: t(:auction_closed) if e.message == 'Auction Closed'\n\t end\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def show\n @borrow_request = BorrowRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrow_request }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end", "def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end", "def show\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bid }\n end\n end", "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def show\n @photo_booth = PhotoBooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo_booth }\n end\n end", "def show\n bike = Bike.find(params[:id]);\n render json: {status: 'SUCCESS', message:'Loaded bike', data:bike}, status: :ok\n end", "def show\n @bet = Bet.find_all_by_id(params[:id])\n # session[\"last_bet_id\"] = @bet.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end" ]
[ "0.77117133", "0.7681789", "0.75758666", "0.7447109", "0.7319728", "0.71859163", "0.7030111", "0.7006114", "0.6900339", "0.6871605", "0.6832682", "0.6764159", "0.6754685", "0.67412204", "0.6713402", "0.67072374", "0.67071885", "0.66385025", "0.65081954", "0.64939857", "0.6490676", "0.6420514", "0.6415611", "0.6410362", "0.6409855", "0.6409855", "0.6409855", "0.6409855", "0.6409855", "0.6325019", "0.6323026", "0.6299152", "0.62975496", "0.6270434", "0.62403667", "0.6223402", "0.6220862", "0.6217859", "0.6209165", "0.6195471", "0.6177709", "0.6160314", "0.61485684", "0.6147288", "0.61377746", "0.6090081", "0.6076621", "0.6075356", "0.6058984", "0.60571575", "0.60525316", "0.60525316", "0.6048398", "0.6039756", "0.6025267", "0.6024872", "0.6014473", "0.60089546", "0.6005821", "0.5962852", "0.594923", "0.594636", "0.59414667", "0.59281564", "0.5926675", "0.59252614", "0.59114796", "0.588315", "0.5881555", "0.58786595", "0.5877665", "0.58570397", "0.58552426", "0.58497745", "0.58389753", "0.58389753", "0.5837997", "0.5834426", "0.58333135", "0.5831111", "0.5829337", "0.5825951", "0.5821725", "0.5821339", "0.5798223", "0.5793851", "0.5786941", "0.5780737", "0.57784504", "0.5777769", "0.57774156", "0.57742393", "0.5772983", "0.57682437", "0.57673484", "0.57614154", "0.5761193", "0.5746901", "0.5745803", "0.5741575", "0.5740956" ]
0.0
-1
POST /auctions POST /auctions.json
def create if current_user.profile.auctions.active.present? redirect_to auctions_my_bids_path, notice: 'You already have active auction' end @auction = current_user.profile.auctions.build(auction_params) @timezone = current_user.profile.timezone @auction.timezone = @timezone respond_to do |format| if @auction.save format.html { redirect_to @auction.profile, notice: 'Auction was successfully created.' } format.json { render :show, status: :created, location: @auction } else format.html { render :new } format.json { render json: @auction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @auction = Auction.new(auction_params)\n @auction.seller = @user\n\n if @auction.save\n render json: @auction, status: :created, location: seller_auction_url(@auction)\n else\n render json: @auction.errors, status: :unprocessable_entity\n end\n end", "def create\n @auction = Auction.new(auction_params)\n\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: 'Запись успешно создана.' }\n format.json { render :show, status: :created, location: @auction }\n else\n format.html { render :new }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auction = Auction.new(params[:auction])\n @auction.phase = Auction::PHASES[:init]\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: t('auctions.flash.notice.created') }\n format.json { render json: @auction, status: :created, location: @auction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auction = Auction.find(params[:auction_id])\n params[:bid].reverse_merge!({owner_id: current_user.id})\n @bid = @auction.bids.build(params[:bid])\n \n respond_to do |format|\n if @bid.save\n format.html { redirect_to @auction, notice: 'You submitted a bid!'}\n format.json { render json: @bid, status: :created, location: @bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def create\n @auction_item = AuctionItem.new(auction_item_params)\n\n respond_to do |format|\n if @auction_item.save\n format.html { redirect_to @auction_item, notice: 'Auction item was successfully created.' }\n format.json { render :show, status: :created, location: @auction_item }\n else\n format.html { render :new }\n format.json { render json: @auction_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tbid_p = (params[:bid] || {}).merge({user:current_user})\n \tbegin\n\t\t @bid = @auction.bid(bid_p)\n\t\t respond_to do |format|\n\t\t if @bid.save\n\t\t format.html { redirect_to @auction, notice: t(:bid_created) }\n\t\t format.json { render json: @auction, status: :created, location: @bid }\n\t\t else\n\t\t format.html { render action: \"new\" }\n\t\t format.json { render json: @bid.errors, status: :unprocessable_entity }\n\t\t end\n\t\t end\n\t rescue Exception => e\n\t \tredirect_to @auction, notice: t(:auction_closed) if e.message == 'Auction Closed'\n\t end\n end", "def create\n @auction = Auction.new(params[:auction])\n\t\n\t#authorize! :read, @auction\n\t\n respond_to do |format|\n if @auction.save\n format.html { redirect_to @auction, notice: 'Auction was successfully created.' }\n format.json { render json: @auction, status: :created, location: @auction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auctionable = Auctionable.new(auctionable_params)\n\n respond_to do |format|\n if @auctionable.save\n format.html { redirect_to @auctionable, notice: 'Auctionable was successfully created.' }\n format.json { render :show, status: :created, location: @auctionable }\n else\n format.html { render :new }\n format.json { render json: @auctionable.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend", "def create_auction(item_name, reserved_price)\n Auction.create(\n item_attributes: {\n name: item_name,\n reserved_price: reserved_price\n }\n )\n end", "def new\n @auction = Auction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @merchant = Merchant.find(session[:user_id])\n \n @auctions = Auction.find(:all, :conditions => [\"`merchant_id` = ? and auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\",@merchant.merchant_id, Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @merchants }\n end\n end", "def show\n render json: @auction\n end", "def create\n @item = Item.find_by(id: params[:auction_uniq_id])\n @bid = Bid.new(params.require(:bid).permit(:auction_uniq_id, :bid_amount))\n # @item.notify_price = @bid.bid_amount\n #@bid.save\n respond_to do |format|\n if @bid.save\n format.html { redirect_to @bid, notice: 'Bid was successfully created.' }\n format.json { render json: @bid, status: :created, location: @bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def auction_params\n params.require(:auction).permit(:title, :details, :ends_on, :reserve_price, :user_id)\n end", "def create\n @auction_item = AuctionItem.new(params[:auction_item])\n\n respond_to do |format|\n if @auction_item.save\n format.html { redirect_to(@auction_item, :notice => 'Auction item was successfully created.') }\n format.xml { render :xml => @auction_item, :status => :created, :location => @auction_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auction_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n user_id = @user.id\n @auctions = Auction.where(\"seller_id = ?\", user_id)\n\n # get all belong auctions\n render json: @auctions\n end", "def new\n authenticate_user!\n @auction = Auction.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auction }\n end\n end", "def index\n @auction_items = AuctionItem.all\n end", "def auction_params\n params.require(:auction).permit(:id, :title, :description, :start_date, :end_date, :display, :winner_message, :logo, :finalized, :payment, items_attributes:[:id, :title, :description, :start_bid, :bid_increment, :auction_id, :is_donation, :buyitnow, :picture, :picture_file_name, :picture_contnet_type, :picture_file_size, :picture_updated_at, :qty, :seq, :value], bids_attributes:[:id, :user_id, :item_id, :amount, :created_at, :updated_at, :qty] )\n end", "def index\n @bids = @item.auction.bids\n end", "def auction_item_params\n params.require(:auction_item).permit(:item_id, :auction_id)\n end", "def create\n @auction = Auction.new(auction_params)\n @auctioneer = @auction.auctioneers.build \n @auctioneer.user_id = current_user.id\n respond_to do |format|\n if @auction.save && @auctioneer.save\n Notifier.welcome(current_user.email).deliver\n format.html { redirect_to @auction, notice: 'Auction was successfully created.' }\n format.json { render :show, status: :created, location: @auction }\n else\n format.html { render :new }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bidding = Bidding.new(bidding_params)\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to [:admin, @bidding], notice: 'Bidding was successfully created.' }\n format.json { render :show, status: :created, location: @bidding }\n else\n format.html { render :new }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bid = Bid.new(params[:bid])\n\n respond_to do |format|\n if @bid.save\n format.html { redirect_to @admin_bid, notice: 'Bid was successfully created.' }\n format.json { render json: @admin_bid, status: :created, location: @admin_bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bid = @auction.bids.new(params[:bid])\n @bid.bidder = current_character\n\n respond_to do |format|\n if @bid.save\n flash[:notice] = 'Bid was successfully created.'\n format.html { redirect_to(auction_bids_path(@auction)) }\n format.xml { render :xml => @bid, :status => :created, :location => @bid }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def index\n \n @admins = Admin.find(:all)\n \n @merchants = Merchant.find(:all, :order => \"merchant_name\")\n \n @auctions = Auction.find(:all, :conditions => [\"auction_start <= ? and auction_end >= ? and auction_ended != ? and auction_deleted != ?\", Time.now.iso8601, Time.now.iso8601, \"1\", \"1\"], :order => \"auction_start desc\")\n \n @auctions.each do |a|\n url = URI.parse('http://beta.ayopasoft.com/AyopaServer/current-auction-info')\n post_args1 = {'auctionID' => a.auction_id}\n resp, data = Net::HTTP.post_form(url, post_args1)\n result = JSON.parse(data)\n \n a.current_price = result['current_price'] \n a.current_level = result['current_level']\n a.next_price = result['next_price']\n a.next_level = result['next_level']\n a.lowest_price = result['lowest_price']\n a.lowest_level = result['lowest_level']\n a.rebate_total = result['rebate_total']\n a.commission_total = result['commission_total']\n a.auction_total = result['auction_total']\n if a.auction_end < Time.now.iso8601 \n a.auction_expired = 1\n end\n \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admins }\n end\n end", "def auction_params\n params.require(:auction).permit(:aim, :rater_age_min, :rater_age_max, :rater_gender, :date_duration, :auction_end, :video_date_start, :bid_step, :start_bid, :video_preview, :charitable)\n end", "def set_bid\n @bid = Bid.find_by({\n :id => params[:id],\n :auction_id => params[:auction_id]})\n\n render json: nil, status: :not_found if @bid.nil? || @bid.auction.seller.id != @user.id\n end", "def create\n if is_login\n @auction = Auction.new(params[:auction])\n @user = User.find_by_id(session[:user_id])\n @auction.user_name = @user.username\n @auction.visible = true\n @auction.status = true\n\n respond_to do |format|\n if @auction.save\n Delayed::Job.enqueue AuctionCloseJob.new(@auction.id), 0, @auction.expire\n format.html { redirect_to(@auction, :notice => 'Auction was successfully created.') }\n format.xml { render :xml => @auction, :status => :created, :location => @auction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auction.errors, :status => :unprocessable_entity }\n end\n end\n else\n session[:user_id] = nil\n login\n end\n end", "def show\n\t\trender json: @auction_item.as_json\n\tend", "def create\n @comment = Comment.new(comment_params)\n @comment.auction_id = params[:auction_id]\n @comment.user = @user\n\n if @comment.save\n render json: @comment, status: :created,\n location: util_auction_comment_url({:id => @comment.id})\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def bid_params\n params.require(:bid).permit(:amount, :user_id, :auction_id)\n end", "def index\n #@auctions = Auction.all\n\t@search = Auction.search(params[:search])\n @auctions = @search.all\n\t@auctions = @search.paginate(:page => params[:page], :per_page => 8)\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def auction_params\n params.require(:auction).permit(:name_of_event, :organization, :image, :date, :start_time, :duration, :description)\n end", "def auctionable_params\n params.require(:auctionable).permit(:name, :description, :image_url, :base_price)\n end", "def create_voted_beer\n render json: BreweryDb::CreateVotedbeer.new(params[:beerId]).create\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def bid_lists\n\t\tauction_item_bids = @auction.auction_item_bids.where(user_id: current_user.id)\n\t\trender json: @auction_item_bids.as_json\n\tend", "def index\n\n @auctionables = Auctionable.all\n end", "def index\n @auction1s = Auction1.all\n \n end", "def auction_params\n params.require(:auction).permit(:customer, :subject, :ffeature, :sfeature, :category)\n end", "def index\n @comments = Comment.where(\n \"auction_id = ? \",\n params[:auction_id])\n\n render json: @comments\n end", "def create\n @bid = Bid.new(bid_params)\n @inspection = @bid.try(:inspection)\n @bids = @inspection.try(:bids)\n respond_to do |format|\n if @bid.save\n format.html { redirect_to @bid, notice: 'Bid was successfully created.' }\n format.js\n else\n format.html { render :new }\n format.js\n end\n end\n end", "def create\n @auction_value = Auction::Value.new(auction_value_params)\n\n respond_to do |format|\n if @auction_value.save\n format.html { redirect_to @auction_value, notice: 'Value was successfully created.' }\n format.json { render :show, status: :created, location: @auction_value }\n else\n format.html { render :new }\n format.json { render json: @auction_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end", "def index\n if current_user.admin? || current_user.creator?\n @auctions = Auction.all\n else\n @auctions = current_user.auctions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auctions }\n end\n end", "def create\n\t\t# Set up the new bid\n\t\t@bid = Bid.new\n\t\t@bid.amount = (bid_params[:amount].to_f * 100).to_i # Convert to integer and handle input with or without cents\n\t\t@time = Time.now\n\t\t@bid.bid_time = @time\n\t\t@bid.user_id = @current_user.id\n\t\t@bid.auction_id = session[:auction_id]\n\n\t\t# Fetch the auction and its associated bids\n\t\t@auction = Auction.find(session[:auction_id])\n\t\t@existing_bids = Bid.where(:auction_id => session[:auction_id])\n\n\t\t# Add the auction to the bidder's watch list\n\t\t@watcher = Watcher.new\n\t\t@watcher.auction_id = session[:auction_id]\n\t\t@watcher.user_id = @current_user.id\n\t\t\n\t\t# Create a new bid history entry\n\t\t@bid_history = BidHistory.new\n\n\t\tif @auction.status == 'live'\n\t\t\tif @auction.user_id == @current_user.id\n\t\t\t\tflash.notice = 'You cannot bid on your own auction'\n\t\t\t\tredirect_to auction_path(session[:auction_id]) and return\n\t\t\telse\n\t\t\t\tif @bid.amount\n\t\t\t\t\tif @existing_bids.length == 0\n\t\t\t\t\t\tif @bid.amount >= @auction.start_price\n\t\t\t\t\t\t\t@auction.current_bid = @auction.start_price\n\t\t\t\t\t\t\t@bid_history.amount = @auction.current_bid\n\t\t\t\t\t\t\t@bid_history.bid_time = @time\n\t\t\t\t\t\t\t@bid_history.username = @current_user.username\n\t\t\t\t\t\t\t@bid_history.auction_id = session[:auction_id]\n\t\t\t\t\t\t\t@bid_history.save\n\t\t\t\t\t\t\t@auction.save\n\t\t\t\t\t\t\tflash.notice = 'You are the first bidder'\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflash.notice = 'Bid must be at least equal to the starting price'\n\t\t\t\t\t\t\trender :new and return\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@highest_bid = Utilities.get_highest_bid(@existing_bids)\n\t\t\t\t\t\tif @highest_bid.user_id == @current_user.id\n\t\t\t\t\t\t\tif @bid.amount > @highest_bid.amount\n\t\t\t\t\t\t\t\tflash.notice = \"You have increased your maximum bid to #{Utilities.convert_to_price(@bid.amount)}\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tflash.notice = \"The amount entered needs to be higher than your last maximum bid, please enter an amount greater than #{Utilities.convert_to_price(@highest_bid.amount)}\"\n\t\t\t\t\t\t\t\trender :new and return\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif @bid.amount > @highest_bid.amount # There is a new high bidder\n\t\t\t\t\t\t\t\t@auction.current_bid = @highest_bid.amount + INCREMENT\n\t\t\t\t\t\t\t\t@bid_history.amount = @auction.current_bid\n\t\t\t\t\t\t\t\t@bid_history.bid_time = @time\n\t\t\t\t\t\t\t\t@bid_history.username = @current_user.username\n\t\t\t\t\t\t\t\t@bid_history.auction_id = session[:auction_id]\n\t\t\t\t\t\t\t\t@bid_history.save\n\t\t\t\t\t\t\t\t@auction.save\n\t\t\t\t\t\t\t\tflash.notice = \"You are now the high bidder, your maximum bid is #{Utilities.convert_to_price(@bid.amount)}\"\n\t\t\t\t\t\t\telsif @bid.amount <= @highest_bid.amount && @bid.amount > @auction.current_bid\n\t\t\t\t\t\t\t\t# The bid should increase by the challenging bidder plus the increment\n\t\t\t\t\t\t\t\tif @highest_bid.amount - @bid.amount < INCREMENT # Do not want to push the high bid over by less than the INCREMENT as this would increase the maximum bid without asking the high bidder to approve\n\t\t\t\t\t\t\t\t\t@auction.current_bid = @highest_bid.amount\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@auction.current_bid = @bid.amount + INCREMENT\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t@bid_history.amount = @auction.current_bid\n\t\t\t\t\t\t\t\t@bid_history.bid_time = @time\n\t\t\t\t\t\t\t\t@bid_history.username = @current_user.username\n\t\t\t\t\t\t\t\t@bid_history.auction_id = session[:auction_id]\n\t\t\t\t\t\t\t\t@bid_history.save\n\t\t\t\t\t\t\t\t@auction.save\n\t\t\t\t\t\t\t\tflash.notice = 'You were outbid, please enter a higher amount'\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tflash.notice = 'Bid too low, please enter a higher amount'\n\t\t\t\t\t\t\t\trender :new and return\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tflash.notice = 'No amount entered, please try again'\n\t\t\t\t\trender :new and return\n\t\t\t\tend\n\n\t\t\t\tif @bid.save\n\t\t\t\t\t@watcher.save\n\t\t\t\t\tredirect_to auction_path(session[:auction_id])\n\t\t\t\telse\n\t\t\t\t\tflash.notice = 'Bid not entered, please try again'\n\t\t\t\t\trender :new and return\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tflash.notice = 'Sorry, bidding for this auction has ended'\n\t\t\tredirect_to auction_path(session[:auction_id])\n\t\tend\n\n\tend", "def create\n @auction_news = AuctionNew.new(auction_news_params)\n\n respond_to do |format|\n if @auction_news.save\n format.html { redirect_to @auction_news, notice: 'Auction new was successfully created.' }\n format.json { render :show, status: :created, location: @auction_news }\n else\n format.html { render :new }\n format.json { render json: @auction_news.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_bid\n @instrument.bids.create!(user: current_user, price: @instrument.price)\n end", "def update\n if @auction.update(auction_params)\n head :no_content\n else\n render json: @auction.errors, status: :unprocessable_entity\n end\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def index\n @auctions = Auction.find_consignments\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def create\n @bid = @swarm_request.bids.new(params[:bid])\n @bid.user = current_user\n\n respond_to do |format|\n if @bid.save\n UserMailer.bid_notification(@bid).deliver\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully created.') }\n format.xml { render :xml => @bid, :status => :created, :location => @bid }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bid\n @auction = Auction.find(params[:auction_id])\n @reward = Reward.find(params[:reward_id])\n @hours_already_bid = @reward.hours_already_bid_by(current_user)\n @hours_entry = HoursEntry.new\n @bid = Bid.new\n end", "def create\n @bin_item = BinItem.new(bin_item_params)\n\n respond_to do |format|\n if @bin_item.save\n format.html { redirect_to @bin_item, notice: 'bin item was successfully created.' }\n format.json { render :show, status: :created, location: @bin_item }\n else\n format.html { render :new }\n format.json { render json: @bin_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(bin_params)\n @rest.post('save', bin_params)\n end", "def create\n @buisness = Buisness.new(buisness_params)\n\n respond_to do |format|\n if @buisness.save\n format.html { redirect_to @buisness, notice: 'Buisness was successfully created.' }\n format.json { render :show, status: :created, location: @buisness }\n else\n format.html { render :new }\n format.json { render json: @buisness.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @arrangements = Arrangement.query_list(params[:auction_id], params[:accept_status])\n render json: @arrangements, status: 200\n end", "def all \n @auctions\n end", "def show\n #@item = Bid.find(params[:auction_uniq_id])\n\n @bid = Bid.all\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def create\n #bird name must be present\n if params[:name].blank?\n render json: {\n status: 400,\n message: \"Fågelns namn måste anges.\" \n }\n end\n \n #latin name must be present\n if params[:latin].blank?\n render json: {\n status: 400,\n message: \"Fågelns latinska namn måste anges.\" \n }\n end\n \n #regularity must be present\n if params[:regularity].blank?\n render json: {\n status: 400,\n message: \"Fågelns regularitet måste anges.\" \n }\n end\n \n #check if bird already exists\n if Api::V1::Bird.exists?(:bird_name => params[:name])\n render json: {\n status: 400,\n message: \"Fågeln finns redan\" \n }\n else\n @bird = Api::V1::Bird.create(:bird_name => params[:name], :latin_name => params[:latin], :regularity => params[:regularity])\n render json: {\n status: 201,\n message: \"Fågeln är registrerad och finns nu i listan.\", \n bird: Api::V1::BirdSerializer.new(@bird) \n }\n end\n end", "def new\n @bid = Bid.new\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "def create\n @bought_item = BoughtItem.new(bought_item_params)\n\n respond_to do |format|\n if @bought_item.save\n format.html { redirect_to @bought_item.apartment, notice: 'Bought item was successfully created.' }\n format.json { render :show, status: :created, location: @bought_item }\n else\n format.html { render :new }\n format.json { render json: @bought_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bidding = Bidding.new\n @item = Item.find(cookies[:remember_item_token])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bidding }\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bid_item = BidItem.new(bid_item_params)\n @bid_item.seller_id = current_user.id\n @bid_item.current_price = @bid_item.starting_price\n respond_to do |format|\n if @bid_item.save\n format.html { redirect_to @bid_item, notice: 'Bid item was successfully created.' }\n format.json { render :show, status: :created, location: @bid_item }\n else\n format.html { render :new }\n format.json { render json: @bid_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bid_winner = BidWinner.new(bid_winner_params)\n\n respond_to do |format|\n if @bid_winner.save\n format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully created.' }\n format.json { render :show, status: :created, location: @bid_winner }\n else\n format.html { render :new }\n format.json { render json: @bid_winner.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bid = @swarm_request.bids.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "def create_songs\n 5.times do |i|\n url = \"https://stg-resque.hakuapp.com/songs.json?album_id=#{i+1}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n songs = JSON.parse(response)\n\n songs.each do |song|\n Song.create!(song.except('id'))\n end\n end\nend", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def create\n @bet = Bet.new(params[:bet])\n\n respond_to do |format|\n if @bet.save\n format.html { redirect_to @bet, notice: 'Bet was successfully created.' }\n format.json { render json: @bet, status: :created, location: @bet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def bids_params\n params.require(:bid).permit(:name)\n end", "def create\n @ballot = Ballot.new(ballot_params)\n\n respond_to do |format|\n if @ballot.save\n format.html { redirect_to ballots_url, notice: 'Thank you for voting.' }\n format.json { render :show, status: :created, location: @ballot }\n else\n format.html { render :new }\n format.json { render json: @ballot.errors, status: :unprocessable_entity }\n end\n end\n end", "def auction1_params\n params.require(:auction1).permit(:nombre, :puja, :fechanew, :property_id, :monto, :fechainicio, :montominimo, :ganador)\n end", "def create\n @holding = Holding.new(params[:holding].merge(@yahoo_data))\n\n respond_to do |format|\n if @holding.save\n format.html { redirect_to @holding, notice: 'Holding was successfully created.' }\n format.json { render json: @holding, status: :created, location: @holding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @holding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n begin\n respond_to do |format|\n if @bird.save(bird_params)\n format.json { render json: {items: @birds, properties: @bird.properties, families: @bird.families, description: \"Add a new bird to the library\",:status => CREATED} }\n else\n format.json { render json: @bird.errors, :status => NOT_FOUND }\n end\n end\n else\n render json:({:status => INTERNAL_SERVER_ERROR})\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 @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bike = Bike.new(bike_params)\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.save\n audit(@bike, current_user)\n render json: @bike, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end", "def bid_event_params\n params.require(:bid_event).permit(:auctionable_id, :participant_id, :final, :amount)\n end", "def run_bidding_algorithm(bidding_data)\n # begin\n url = 'http://app-csc517.herokuapp.com/match_topics' # hard coding for the time being\n response = RestClient.post url, bidding_data.to_json, content_type: 'application/json', accept: :json\n JSON.parse(response.body)\n rescue StandardError\n false\n # end\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end" ]
[ "0.705162", "0.6969033", "0.69430554", "0.68395746", "0.6675049", "0.6672291", "0.66667366", "0.66174555", "0.6613381", "0.6499353", "0.6220726", "0.6215063", "0.6150765", "0.6138528", "0.61302626", "0.6108555", "0.6104963", "0.608045", "0.6069963", "0.60552746", "0.6037936", "0.5994132", "0.58653873", "0.5853426", "0.5846321", "0.58342355", "0.5812959", "0.58067816", "0.5790856", "0.5790856", "0.5790856", "0.5790856", "0.5790856", "0.57859534", "0.5776208", "0.57263756", "0.57088184", "0.5706218", "0.570184", "0.57005304", "0.5661775", "0.5645972", "0.56360185", "0.56297994", "0.56278557", "0.55944324", "0.5588646", "0.5570708", "0.55660784", "0.5563448", "0.5558499", "0.5551976", "0.5547407", "0.5538382", "0.55367947", "0.5531424", "0.5530999", "0.5524216", "0.5498703", "0.5498703", "0.54808563", "0.5477561", "0.5471778", "0.54694676", "0.54622036", "0.5448945", "0.54137164", "0.541216", "0.54076415", "0.539882", "0.53952205", "0.5390675", "0.5386775", "0.53796536", "0.53186303", "0.5313025", "0.53041476", "0.5301561", "0.52997404", "0.5296056", "0.52910364", "0.5286714", "0.5286354", "0.52855116", "0.5280167", "0.5272737", "0.5271126", "0.5254522", "0.5241872", "0.5240762", "0.5237133", "0.52300787", "0.5229364", "0.52238256", "0.52125", "0.5210137", "0.52057165", "0.52043015", "0.52035266", "0.52006227" ]
0.662467
7
PATCH/PUT /auctions/1 PATCH/PUT /auctions/1.json
def update @timezone = current_user.profile.timezone @auction.timezone = @timezone respond_to do |format| if @auction.update(auction_params) format.html { redirect_to @auction.profile, notice: 'Auction was successfully updated.' } format.json { render :show, status: :ok, location: @auction } else format.html { render :edit } format.json { render json: @auction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @auction.update(auction_params)\n head :no_content\n else\n render json: @auction.errors, status: :unprocessable_entity\n end\n end", "def update\n @auction = Auction.find(params[:id])\n\n respond_to do |format|\n if @auction.update_attributes(params[:auction])\n format.html { redirect_to @auction, :notice => t(\"auctions.flash.notice.updated\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auction.update(auction_params)\n format.html { redirect_to @auction, notice: 'Auction was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction }\n else\n format.html { render :edit }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @auction, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auctionable.update(auctionable_params)\n format.html { redirect_to @auctionable, notice: 'Auctionable was successfully updated.' }\n format.json { render :show, status: :ok, location: @auctionable }\n else\n format.html { render :edit }\n format.json { render json: @auctionable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @auction = Auction.find(params[:id])\n\tauthorize! :read, @auction\n\t\n respond_to do |format|\n if @auction.update_attributes(params[:auction])\n format.html { redirect_to @auction, notice: 'Auction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @auction = Auction.find(params[:auction_id])\n params[:bid].reverse_merge!({owner_id: current_user.id})\n @bid = Bid.find(params[:id])\n \n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n \n redirect_to @auction and return\n end", "def update\n respond_to do |format|\n if @auction_item.update(auction_item_params)\n format.html { redirect_to @auction_item, notice: 'Auction item was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction_item }\n else\n format.html { render :edit }\n format.json { render json: @auction_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n if @bidding.update_attributes(params[:bidding])\n format.html { redirect_to @bidding, notice: 'Bidding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @admin_bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !params[:auction][:ffeature].empty?\n a=\"\"\n params[\"auction\"][\"ffeature\"].shift\n params[\"auction\"][\"ffeature\"].each do |f|\n a=a + Feature.find_by_id(f).title + \" || \"\n end\n a=a[0..a.length-5]\n params[:auction][:ffeature] = a\n end\n respond_to do |format|\n if @auction.update(auction_params)\n format.html { redirect_to auctions_url, notice: 'Запись успешно обновлена.' }\n #format.json { render :show, status: :ok, location: @auction }\n else\n format.html { render :edit }\n format.json { render json: @auction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @bid.update(bid_params)\n head :no_content\n else\n render json: @bid.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bidding.update(bidding_params)\n format.html { redirect_to [:admin, @bidding], notice: 'Bidding was successfully updated.' }\n format.json { render :show, status: :ok, location: @bidding }\n else\n format.html { render :edit }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @super_bowl_pick = SuperBowlPick.find(params[:id])\n\n respond_to do |format|\n if @super_bowl_pick.update_attributes(params[:super_bowl_pick])\n format.html { redirect_to @super_bowl_pick, notice: 'Super bowl pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_bowl_pick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid_request.update(bid_request_params)\n format.html { redirect_to @bid_request, notice: 'Bid request was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid_request }\n else\n format.html { render :edit }\n format.json { render json: @bid_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auction_value.update(auction_value_params)\n format.html { redirect_to @auction_value, notice: 'Value was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction_value }\n else\n format.html { render :edit }\n format.json { render json: @auction_value.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 @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 update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n if @bet.update_attributes(params[:bet])\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n flash[:notice] = 'Bid was successfully updated.'\n format.html { redirect_to(@bid) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user_bid = UserBid.find(params[:id])\n\n respond_to do |format|\n if @user_bid.update_attributes(params[:user_bid])\n format.html { redirect_to @user_bid, notice: 'User bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bet.update(bet_params)\n head :no_content # renders empty response\n else\n render json: @bet.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n authorize! :manage, @bid\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n @bid.maintenance_request = MaintenanceRequest.find_by_id(params[:bid][:maintenance_request_id])\n @user = User.find_by_id(@bid.maintenance_request.user_id)\n @bid.contractor = current_contractor\n if @bid.price\n @bid.payout = @bid.price * 0.90\n end\n @bid.save\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid }\n else\n @bid = Bid.new\n @maintenance_request = MaintenanceRequest.find_by_id(params[:maintenance_request_id])\n format.html { render :edit }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n flash[:notice] = 'Bid was successfully updated.'\n format.html { redirect_to bid_url(@bid) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors.to_xml }\n end\n end\n end", "def update\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n if @blocking_client.update_attributes(params[:blocking_client])\n format.html { redirect_to @blocking_client, notice: 'Blocking client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blocking_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bin.assign_attributes bin_params\n\n respond_to do |format|\n if save_bin @bin\n format.html { redirect_to @bin, notice: 'Bin was successfully updated.' }\n format.json { render json: { ok: true, bin: @bin } }\n else\n Rails.logger.error \"Failed to update bin #{params[:id]}\"\n format.html { render :edit }\n format.json { render json: {\n # Respond with the current state of the bin in the database\n ok: false, errors: @bin.errors.full_messages, bin: Bin.find_by(id: params[:id]) }\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bin_item.update(bin_item_params)\n format.html { redirect_to @bin_item, notice: 'bin item was successfully updated.' }\n format.json { render :show, status: :ok, location: @bin_item }\n else\n format.html { render :edit }\n format.json { render json: @bin_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n respond_to do |format|\n if @bride.update(bride_params)\n format.html { redirect_to @bride, notice: 'Bride was successfully updated.' }\n format.json { render :show, status: :ok, location: @bride }\n else\n format.html { render :edit }\n format.json { render json: @bride.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_bait = Bait.find(params[:id])\n\n respond_to do |format|\n if @admin_bait.update_attributes(params[:admin_bait])\n format.html { redirect_to @admin_bait, notice: 'Bait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borrow_request = BorrowRequest.find(params[:id])\n\n respond_to do |format|\n if @borrow_request.update_attributes(params[:borrow_request])\n format.html { redirect_to @borrow_request, notice: 'Borrow request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borrow_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def set_auction\n @auction = Auction.find(params[:id])\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.js\n else\n format.html { render :edit }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @bag.update(bag_params)\n format.html { redirect_to @bag, notice: \"Bag was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bag }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bond.update(bond_params)\n format.html { redirect_to bonds_path, notice: I18n.t('messages.updated_with', item: @bond.company) }\n format.json { render :show, status: :ok, location: @bond }\n else\n format.html { render :edit }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bet = Bet.find(params[:id])\n @remove_voted = params[:remove_voted] ? true : false\n \n respond_to do |format|\n if @bet.update_attributes(params[:bet])\n format.js { render :action => 'update_bet' } # update_bet.js.rjs\n format.iphone_js { render :action => 'update_bet.js.rjs' }\n else\n format.js { render :action => 'update_bet' }\n format.iphone_js { render :action => 'update_bet.js.rjs' }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid_action.update(bid_action_params)\n format.html { redirect_to @bid_action, notice: 'Bid action was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid_action }\n else\n format.html { render :edit }\n format.json { render json: @bid_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borrow = Borrow.find(params[:id])\n\n respond_to do |format|\n if @borrow.update_attributes(params[:borrow])\n format.html { redirect_to @borrow, notice: 'Borrow was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borrow.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n if @bike.update_attributes(params[:bike])\n format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bike.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n if @sugar_bag.update_attributes(params[:sugar_bag])\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:auction].nil?\n failure \"Error in closing consignment sale.\"\n end\n if params[:auction][:current_bid].blank?\n failure \"You did not enter a closing price.\"\n end\n if params[:auction][:quantity].blank?\n failure \"You did not enter a closing quantity.\"\n end\n unless @fail\n @auction = Auction.find(params[:id])\n unless params[:auction][:current_bid].nil?\n current_bid = params[:auction][:current_bid]\n current_bid.tr!('$,','')\n @auction.current_bid = current_bid\n end\n @auction.reserve_price = @auction.minimum_bid = @auction.current_bid\n @auction.buy_now_price = @auction.current_bid\n @auction.quantity = @auction.min_quantity = params[:auction][:quantity]\n unless @auction.cases_per_pallet.nil? or @auction.quantity.nil?\n @auction.pallets = (@auction.quantity.to_f / @auction.cases_per_pallet.to_f).ceil\n end\n @auction.how_many_bids = 1\n @auction.last_bid_id = @auction.buyer_id\n @auction.date_to_pickup = @auction.date_last_bid = @auction.date_to_end = Time.now\n @auction.consignment = false\n @auction.closed = true\n @auction.due_foodmoves = money_for_us(@auction)\n if @auction.save\n flash[:notice] = \"Successfully closed auction #{@auction.id}.\"\n chat_alert('team', \"#{@current_user.name} \" +\n \"has closed a consignment sale for #{@auction.description}\")\n else\n flash[:notice] = \"Unable to close auction #{@auction.id}.\"\n end\n end\n if @fail\n flash[:error] = @err_msg\n end\n redirect_to consignments_url\n end", "def update\n respond_to do |format|\n if @booth.update(booth_params)\n format.html { redirect_to event_booth_path(@booth), notice: 'Booth was successfully updated.' }\n format.json { render :show, status: :ok, location: @booth }\n else\n format.html { render :edit }\n format.json { render json: @booth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auction_foregift.update(auction_foregift_params)\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction_foregift }\n else\n format.html { render :edit }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def update\n respond_to do |format|\n if @abook.update(abook_params)\n format.html { redirect_to @abook, notice: 'Abook was successfully updated.' }\n format.json { render :show, status: :ok, location: @abook }\n else\n format.html { render :edit }\n format.json { render json: @abook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def set_bid\n @bid = Bid.find_by({\n :id => params[:id],\n :auction_id => params[:auction_id]})\n\n render json: nil, status: :not_found if @bid.nil? || @bid.auction.seller.id != @user.id\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @buisness.update(buisness_params)\n format.html { redirect_to @buisness, notice: 'Buisness was successfully updated.' }\n format.json { render :show, status: :ok, location: @buisness }\n else\n format.html { render :edit }\n format.json { render json: @buisness.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_auction_item\n @auction_item = AuctionItem.find(params[:id])\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n if @brewhouse.update_attributes(params[:brewhouse])\n format.html { redirect_to @brewhouse, notice: 'Brewhouse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brewhouse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if is_login\n @user = User.find_by_id(session[:user_id])\n @auction = Auction.find(params[:id])\n @auction.user_name = @user.username\n respond_to do |format|\n if @auction.update_attributes(params[:auction])\n format.html { redirect_to(@auction, :notice => 'Auction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auction.errors, :status => :unprocessable_entity }\n end\n end\n else\n session[:user_id] = nil\n login\n end\n end", "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end", "def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bussiness.update(bussiness_params)\n format.html { redirect_to current_user, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bourbon.update(bourbon_params)\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_auction1\n @auction1 = Auction1.find(params[:id])\n end", "def update\n respond_to do |format|\n if @bustour.update(bustour_params)\n format.html { redirect_to @bustour, notice: 'Bustour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bustour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74300045", "0.72069544", "0.7174258", "0.69386613", "0.6926642", "0.68586004", "0.68107283", "0.67690194", "0.65351576", "0.6524235", "0.64921916", "0.6472534", "0.64346886", "0.6425796", "0.6396136", "0.6392779", "0.6392779", "0.6392779", "0.6392779", "0.6331323", "0.62889856", "0.62782615", "0.62388444", "0.6238457", "0.62213933", "0.62137973", "0.620931", "0.6154384", "0.61481845", "0.6123784", "0.6123091", "0.60877365", "0.6084634", "0.6073597", "0.6070771", "0.605977", "0.60521364", "0.6051784", "0.60382944", "0.60346", "0.6028342", "0.6025105", "0.6020916", "0.59831506", "0.5979135", "0.5978997", "0.5976583", "0.5972871", "0.5972871", "0.5972871", "0.5972871", "0.5972871", "0.595934", "0.59586304", "0.5952254", "0.59397787", "0.59384346", "0.5935855", "0.59250224", "0.5916153", "0.59148204", "0.5906859", "0.5906859", "0.5906859", "0.5897821", "0.5895541", "0.5892242", "0.5892067", "0.58913296", "0.58912754", "0.5885438", "0.5878743", "0.5871881", "0.58666736", "0.5861775", "0.5859492", "0.5848593", "0.5841444", "0.5841444", "0.5835795", "0.5835103", "0.5832069", "0.58300847", "0.58273035", "0.58262527", "0.5825812", "0.5824895", "0.58200383", "0.58153677", "0.58139515", "0.5807617", "0.5806093", "0.58039284", "0.579541", "0.57946277", "0.5793256", "0.5783967", "0.5783659", "0.5781725", "0.5778656", "0.57781184" ]
0.0
-1
DELETE /auctions/1 DELETE /auctions/1.json
def destroy @auction.destroy respond_to do |format| format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Запись удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction = Auction.find(params[:auction_id])\n @bid = Bid.find(params[:id])\n @bid.destroy\n \n respond_to do |format|\n format.html { redirect_to @auction }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction = Auction.find(params[:id])\n \n\tauthorize! :read, @auction\n\t@auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to auction_bids_url(@auction) }\n format.json { head :no_content }\n end\n end", "def destroy\n @auctionable.destroy\n respond_to do |format|\n format.html { redirect_to auctionables_url, notice: 'Auctionable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_item.destroy\n respond_to do |format|\n format.html { redirect_to auction_items_url, notice: 'Auction item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n\n if @auction.destroyed?\n redirect_to auctions_path, notice: t(\"deleted\")\n else\n redirect_to auctions_path, alert: t(\"not_deleted\")\n end\n end", "def destroy\n @auction_item = AuctionItem.find(params[:id])\n @auction_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auction.destroy\n redirect_to auctions_url, notice: 'Auction was successfully destroyed.'\n end", "def destroy\n @parsed_auction = ParsedAuction.find(params[:id])\n @parsed_auction.destroy\n @parsed_auctions = ParsedAuction.find(:all, :conditions => [\"user_id = ?\", current_user[:id]])\n redirect_to parsed_auctions_url\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_voucher.destroy\n respond_to do |format|\n format.html { redirect_to auction_vouchers_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/transaction\" }\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 destroy\n @bid_item.destroy\n respond_to do |format|\n format.html { redirect_to bid_items_url, notice: 'Bid item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_bid = Bid.find(params[:id])\n @admin_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_event.destroy\n respond_to do |format|\n format.html { redirect_to auction_events_url, notice: 'Event 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 @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bidding.destroy\n respond_to do |format|\n format.html { redirect_to biddings_url, notice: 'Bidding was successfully destroyed.' }\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 @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 @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bin_item.destroy\n respond_to do |format|\n format.html { redirect_to bin_items_url, notice: 'bin item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid_request.destroy\n respond_to do |format|\n format.html { redirect_to bid_requests_url, notice: 'Bid request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(bids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auction_attribute.destroy\n respond_to do |format|\n format.html { redirect_to auction_attributes_url, notice: 'Editor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @auction_carousel.destroy\n respond_to do |format|\n format.html { redirect_to auction_carousels_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid_action.destroy\n respond_to do |format|\n format.html { redirect_to bid_actions_url, notice: 'Bid action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = @swarm_request.bids.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(swarm_request_bids_url(:swarm_request_id => @swarm_request.to_param)) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @adhub = Adhub.find(params[:id])\n @adhub.destroy\n respond_to do |format|\n format.html { redirect_to adhubs_url, notice: \"Advertisement was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @bussiness.destroy\n respond_to do |format|\n format.html { redirect_to bussinesses_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url, notice: 'Bid was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @borrow = Borrow.find(params[:id])\n @borrow.destroy\n\n respond_to do |format|\n format.html { redirect_to borrows_url }\n format.json { head :ok }\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.xml { head :ok }\n end\n end", "def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_bait = Bait.find(params[:id])\n @admin_bait.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_baits_url }\n format.json { head :ok }\n end\n end", "def destroy\n @booth.destroy\n respond_to do |format|\n format.html { redirect_to event_booths_url, notice: 'Booth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @advertise.destroy\n respond_to do |format|\n format.html { redirect_to advertises_url, notice: \"Advertise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_news.destroy\n respond_to do |format|\n format.html { redirect_to auction_news_url, notice: 'Auction new was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advertise.destroy\n respond_to do |format|\n format.html { redirect_to advertises_url, notice: 'Advertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @singleb.destroy\n respond_to do |format|\n format.html { redirect_to singlebs_url, notice: 'Singleb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blocking_client = BlockingClient.find(params[:id])\n @blocking_client.destroy\n\n respond_to do |format|\n format.html { redirect_to blocking_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'home', action: 'bounty_market' }\n format.json { head :no_content }\n end\n end", "def destroy\n @our_coin = OurCoin.find(params[:id])\n @our_coin.destroy\n\n respond_to do |format|\n format.html { redirect_to our_coins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brain = Brain.find(params[:id])\n @brain.destroy\n\n respond_to do |format|\n format.html { redirect_to brains_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auction_value.destroy\n respond_to do |format|\n format.html { redirect_to auction_values_url, notice: 'Value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @household_item.destroy\n respond_to do |format|\n format.html { redirect_to household_items_url, notice: 'Household item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n loaded = Cloudinary::Uploader.destroy(\"advertises/#{@admin_advertise.id}\", :public_id => \"advertises/#{@admin_advertise.id}\", :invalidate => true)\n @admin_advertise.destroy\n respond_to do |format|\n format.html { redirect_to admin_advertises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bird.destroy\n \n begin\n respond_to do |format|\n format.json { render json:({:status => NO_CONTENT}) }\n end\n else\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def destroy\n @user_bid = UserBid.find(params[:id])\n @user_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to user_bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bride.destroy\n respond_to do |format|\n format.html { redirect_to brides_url, notice: 'Bride was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @click_thru = ClickThru.find(params[:id])\n @click_thru.destroy\n\n respond_to do |format|\n format.html { redirect_to click_thrus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @bike = Bike.find(params[:id])\n @bike.destroy\n\n respond_to do |format|\n format.html { redirect_to bikes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @burpy.destroy\n respond_to do |format|\n format.html { redirect_to burpies_url, notice: 'Burpy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @borad = Borad.find(params[:id])\n @borad.destroy\n\n respond_to do |format|\n format.html { redirect_to borads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brochure = Brochure.find(params[:id])\n @brochure.destroy\n\n respond_to do |format|\n format.html { redirect_to brochures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bag.destroy\n respond_to do |format|\n format.html { redirect_to bags_url, notice: \"Bag was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n bin_url = @request.bin.url\n\n @request.destroy\n respond_to do |format|\n format.html do\n redirect_to \"/bins/#{bin_url}\",\n notice: 'Request was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @borrow_request = BorrowRequest.find(params[:id])\n @borrow_request.destroy\n\n respond_to do |format|\n format.html { redirect_to borrow_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\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 @Bouquets = Bouquet.find(params[:id])\n @Bouquets.destroy\n\n respond_to do |format|\n format.html { redirect_to bouquets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bagtype = Bagtype.find(params[:id])\n @bagtype.destroy\n\n respond_to do |format|\n format.html { redirect_to bagtypes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_banners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_item = AlbumItem.find(params[:id])\n @album_item.destroy\n\n respond_to do |format|\n format.html { redirect_to album_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7688671", "0.76116264", "0.7596809", "0.7451117", "0.7380871", "0.7293882", "0.727182", "0.72403324", "0.7152989", "0.7033975", "0.69657266", "0.694764", "0.68632185", "0.68632185", "0.6774795", "0.6771635", "0.6771635", "0.6771635", "0.6771635", "0.6771635", "0.67710686", "0.6756865", "0.6729187", "0.6705456", "0.6697912", "0.6695258", "0.6689905", "0.6686984", "0.6681727", "0.66523725", "0.6650022", "0.66281456", "0.6625631", "0.66139436", "0.66109943", "0.66096526", "0.66096526", "0.6598971", "0.6597876", "0.6586847", "0.65793365", "0.65709287", "0.6562031", "0.65567875", "0.65547377", "0.6552597", "0.6552148", "0.6542393", "0.65378684", "0.6536559", "0.6512732", "0.64942265", "0.64872134", "0.6480508", "0.64796966", "0.6464698", "0.6463927", "0.6453725", "0.6449401", "0.64457375", "0.64455026", "0.6443914", "0.6440399", "0.64402795", "0.6438066", "0.6435105", "0.64325213", "0.6432151", "0.64272934", "0.64194125", "0.64137703", "0.64128023", "0.6405022", "0.64042634", "0.64025426", "0.64012873", "0.6399741", "0.6398102", "0.6396891", "0.6388764", "0.63869846", "0.63865155", "0.63856876", "0.6385018", "0.63806653", "0.6374688", "0.6372725", "0.6372575", "0.6370349", "0.6366392", "0.6359748", "0.6357471", "0.6355944", "0.63522536", "0.6350103", "0.6348814", "0.6348757", "0.63457084", "0.634416" ]
0.7585603
4
Use callbacks to share common setup or constraints between actions.
def set_auction @auction = Auction.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 auction_params params.require(:auction).permit(:aim, :rater_age_min, :rater_age_max, :rater_gender, :date_duration, :auction_end, :video_date_start, :bid_step, :start_bid, :video_preview, :charitable) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1
Returns a service instance for the given service id
def service_instance(id) @@configuration_cache[id] or @@configuration_cache[id] = Psych.load_file("#{data_dir}/service/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_by_id(id)\n if params[:id]\n Service.find(params[:id])\n else\n nil #todo error handling.\n end\n end", "def service(id)\n ss = services\n ss.keep_if {|s| s.id == id}.first unless ss.nil?\n end", "def find_service(id)\n self.class.get(\"/services/#{id}.json?apikey=#{apikey}\")\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def get id\n @services[id]\n end", "def find_service\n if params[:service_id].present?\n @service = @provider.services.find_by_id(params[:service_id])\n end\n end", "def set_service\n @service = Service.where(\"id = ?\", params[:id]).first\n end", "def service(service_id)\n response = @client.get(\"/api/v1/services/#{service_id}\")\n return JSON.parse(response.body)\n end", "def service\n @service ||= fetcher.get(Service, service_id)\n end", "def locate(service_name)\n klass = @services[service_name]\n raise \"Unknown service: #{service_name}\" unless klass\n klass.new\n end", "def set_service\n if params[:id] == params[:id].to_i.to_s\n @service = Service.find(params[:id])\n else\n @service = Service.find_by_slug(params[:id])\n end\n end", "def servicio # :doc\n id = params[:service_id]\n if id.present?\n \t\tService.find(params[:service_id]) \n \tend \n end", "def set_service\n @service = Service.find_by_hashid(params[:id])\n end", "def service(name)\n name = name.to_sym\n\n service_info = SERVICES[name]\n if service_info.nil?\n raise ArgumentError, sprintf('No service found with name %s', name)\n end\n\n require_path = sprintf(SERVICE_PATH, @path_version,\n service_info.first)\n require require_path\n\n class_path = sprintf(SERVICE_CLASS_PATH, @version, service_info.last)\n return class_for_path(class_path)\n end", "def service; services.first; end", "def set_service\n @service = Service.find_by_id(params[:id])\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def service(service_name, api_client)\n klazz = service_class(service_name)\n\n # raise an error unless the class inherits from Service\n unless klazz < Core::ServiceLayer::Service\n raise ServiceParentError,\n \"service #{klazz.name} is not a subclass of \\\n Core::ServiceLayer::Service\"\n end\n\n # create an instance of the service class\n klazz.try(:new, api_client)\n end", "def load_service(redirect = true)\n if (params[:id].blank?)\n @service = nil\n return @service\n end\n\n @service = Service.where(:_id => params[:id]).first\n\n if (@service.blank? && redirect)\n # If not found, show an error and redirect\n flash[:error] = t(\"services.error.not_found\")\n redirect_to services_path()\n end\n\n return @service\n end", "def get(id)\n @service.get(id)\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.friendly.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def get( name, *args )\n point = find_definition( name )\n raise ServiceNotFound, \"#{fullname}.#{name}\" unless point\n\n point.instance( self, *args )\n end", "def set_service\n @service = @enterprise.services.find(params[:id])\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def set_service\n @service = Service.by_slug(params[:id])\n end", "def set id, service\n @services ||= {}\n @services[id] = service\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def set_service\n @service = Service.find_by_slug(params[:id])\n end", "def service_named(service_name, service_options = {})\n raise ArgumentError,\"Please provide a service name\" if service_name.nil? || service_name.empty?\n\n # Strip whitespace from service_name and ensure that it starts with \"SoftLayer_\".\n # If it does not, then add the prefix.\n full_name = service_name.to_s.strip\n if not full_name =~ /\\ASoftLayer_/\n full_name = \"SoftLayer_#{service_name}\"\n end\n\n # if we've already created this service, just return it\n # otherwise create a new service\n service_key = full_name.to_sym\n if !@services.has_key?(service_key)\n @services[service_key] = SoftLayer::Service.new(full_name, {:client => self}.merge(service_options))\n end\n\n @services[service_key]\n end", "def find(service_name)\n return @services if service_name == :all\n \n service = @services[service_name]\n return service unless service.nil? \n \n ContainerLogger.warn \"Unexisting service called: #{@name}::#{service_name}\", 1\n nil\n end", "def related_service_named(service_name)\n @client.service_named(service_name)\n end", "def instance instance_id\n ensure_service!\n grpc = service.get_instance instance_id\n Instance.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "def set_idti_service\n @idti_service = IdtiService.find(params[:id])\n end", "def service_named(service_name, service_options = {})\n raise ArgumentError,\"Please provide a service name\" if service_name.nil? || service_name.empty?\n\n # strip whitespace from service_name and\n # ensure that it start with \"SoftLayer_\".\n #\n # if it does not, then add it\n service_name.strip!\n if not service_name =~ /\\ASoftLayer_/\n service_name = \"SoftLayer_#{service_name}\"\n end\n\n # if we've already created this service, just return it\n # otherwise create a new service\n service_key = service_name.to_sym\n if !@services.has_key?(service_key)\n @services[service_key] = SoftLayer::Service.new(service_name, {:client => self}.merge(service_options))\n end\n\n @services[service_key]\n end", "def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue nil\n end", "def instantiate_service!(service, request)\n definition = service.kind_of?(Hash) ? service : service_definition_for(service.to_s)\n raise NoSuchService.new(\"Service '#{service}'' does not exist in umlaut-services.yml\") if definition.nil?\n className = definition[\"type\"] || definition[\"service_id\"]\n classConst = Kernel.const_get(className)\n service = classConst.new(definition)\n service.request = request\n return service\n end", "def show\n @service = Service.find(params[:id])\n end", "def find_service(service)\n @configs[service]\n end", "def instance_by_id(id)\n instances.detect { |x| x.id == id } # ID should always be unique\n end", "def get_service_by_name(name, space_guid)\n @client.service_instances_by_name(name).find {|srv| srv.space.guid = space_guid }\n end", "def get_service(context, host, proto, port, state=ServiceState::Up)\n\t\trec = Service.find(:first, :conditions => [ \"host_id = ? and proto = ? and port = ?\", host.id, proto, port])\n\t\tif (not rec)\n\t\t\trec = Service.create(\n\t\t\t\t:host_id => host.id,\n\t\t\t\t:proto => proto,\n\t\t\t\t:port => port,\n\t\t\t\t:state => state,\n\t\t\t\t:created => Time.now\n\t\t\t)\n\t\t\trec.save\n\t\t\tframework.events.on_db_service(context, rec)\n\t\tend\n\t\treturn rec\n\tend", "def api_service(service, **opt)\n opt[:user] = current_user unless opt.key?(:user)\n service = service.class unless service.is_a?(Class)\n service.instance(**opt)\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/tags/#{id}\", options: options)).first, client: client)\n end", "def svc_instance_by_source_ref(source_id, source_ref)\n api = api_client.api_client\n\n header_params = { 'Accept' => api.select_header_accept(['application/json']) }\n query_params = { :'source_id' => source_id, :'source_ref' => source_ref }\n\n count = 0\n timeout_count = poll_timeout / sleep_poll\n\n service_instance = nil\n loop do\n data, status_code, headers = api.call_api(:GET, \"/service_instances\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => {},\n :body => nil,\n :auth_names => ['UserSecurity'],\n :return_type => 'ServiceInstancesCollection')\n\n service_instance = data.data&.first if data.meta.count > 0\n break if service_instance.present?\n\n break if (count += 1) >= timeout_count\n sleep(sleep_poll)\n end\n\n if service_instance.nil?\n logger.error(\"Failed to find service_instance by source_id [#{source_id}] source_ref [#{source_ref}]\")\n end\n\n service_instance\n end", "def show\n @service = Service.find(params[:id])\n end", "def get_instance(id)\n begin\n instance = @ec2.instance(id)\n if instance.exists?\n return instance\n else\n raise RuntimeError.new(\"Instance #{id} does not exist\")\n end\n rescue => e\n raise e\n end\n end", "def named(name)\n service = all.find{|service| service.name == name}\n if service.nil?\n raise UnknownService, \"Service named #{name} isn't available\"\n else\n service\n end\n end", "def service_check(service_id)\n check(\"service:#{service_id}\")\n end", "def service_id\n return @service_id\n end", "def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end", "def service_name(id)\n @service_names ||= {}\n return @service_names[id] if @service_names.include?(id)\n @options.each do |key, value|\n if value.id == id\n @service_names[value.id] = key\n return key\n end\n end\n nil\n end", "def new_service(service)\n @services[service.name] = service\n\n notify_observable_base(ObservableBase::SERVICE_ADDED, {:domain => @name, :service => service.name})\n return @services[service.name]\n end", "def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end", "def service_id(service)\n if @options[service.to_sym].nil?\n nil\n else\n @options[service.to_sym].id\n end\n end", "def set_service\n @service = current_user.services.find(params[:id])\n end", "def set_service\n begin\n @service = Service.find(params[:id])\n rescue\n render json: {error: \"Service not found\"}, status: 404\n end\n end", "def client_from_id(id)\n resp = get \"#{CLIENT_API_PATH}/#{id}\"\n result = process_response(resp)\n Resources::Client.new(result)\n rescue Errors::NotFound\n nil\n end", "def get_service(id, serviceid)\n parser = post(ROOT_URI + '/a/servicedialog',\n 'serviceid' => serviceid, 'stream' => id)['html_parser']\n form = parser.at(\"//form[1]\")\n hash = { 'stream' => id }\n form.xpath(\".//input\").each { |input|\n case input['type'].downcase\n when 'text', 'hidden'\n hash[input['name']] = input['value']\n when 'radio', 'checkbox'\n if input['checked']\n value = input['value'] || 'on'\n if value && !value.empty?\n hash[input['name']] = value\n end\n end\n end\n }\n form.xpath(\".//textarea\").each { |input|\n hash[input['name']] = input.text\n }\n hash\n end", "def get_service(id, serviceid)\n parser = post(ROOT_URI + '/a/servicedialog',\n 'serviceid' => serviceid, 'stream' => id)['html_parser']\n form = parser.at(\"//form[1]\")\n hash = { 'stream' => id }\n form.xpath(\".//input\").each { |input|\n case input['type'].downcase\n when 'text', 'hidden'\n hash[input['name']] = input['value']\n when 'radio', 'checkbox'\n if input['checked']\n value = input['value'] || 'on'\n if value && !value.empty?\n hash[input['name']] = value\n end\n end\n end\n }\n form.xpath(\".//textarea\").each { |input|\n hash[input['name']] = input.text\n }\n hash\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def translate_service(service_id)\n if config[:translate]\n\n # Check if Service ID was already translated\n if @fastly_services[service_id]\n\n result = @fastly_services[service_id]\n\n else\n\n request = Net::HTTP::Get.new(\"/service/#{service_id}\")\n request['Content-Type'] = 'application/json'\n request = login_headers(request)\n\n response = @http.request(request)\n service_data = JSON.parse(response.body)\n\n if service_data['name']\n result = service_data['name'].tr('.\\ ', '_')\n @fastly_services['service_id'] = result\n else\n result = service_id\n end\n end\n\n if result == ''\n service_id\n else\n result\n end\n else\n service_id\n end\n end", "def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end", "def svc_instance_by_source_ref(source_id, source_ref)\n sleep_poll = 10\n poll_timeout = 1800\n\n header_params = {'Accept' => topology_api.select_header_accept(['application/json'])}\n query_params = {'source_id' => source_id, 'source_ref' => source_ref}\n\n count = 0\n timeout_count = poll_timeout / sleep_poll\n\n service_instance = nil\n loop do\n data, _status_code, _headers = topology_api.call_api(:GET, \"/service_instances\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => {},\n :body => nil,\n :auth_names => ['UserSecurity'],\n :return_type => 'ServiceInstancesCollection')\n\n service_instance = data.data&.first if data.meta.count > 0\n break if service_instance.present?\n\n break if (count += 1) >= timeout_count\n\n sleep(sleep_poll)\n end\n\n if service_instance.nil?\n logger.error(\"Failed to find service_instance by source_id [#{source_id}] source_ref [#{source_ref}]\")\n end\n\n service_instance\n end", "def GetServiceId(name)\n id = GetUnitId(Builtins.sformat(\"%1.service\", name))\n return nil if id == nil\n\n # return without .service\n pos = Builtins.search(id, \".service\")\n return nil if Ops.less_or_equal(pos, 0)\n Builtins.substring(id, 0, pos)\n end", "def set_service_class\n @service_class = ServiceClass.find(params[:id])\n end", "def find(service:, ref:)\n new(id: ref, service: service).tap(&:attrs)\n rescue ThreeScale::API::HttpClient::NotFoundError\n find_by_system_name(service: service, system_name: ref)\n end", "def get_instance(id)\n CloudDB::Instance.new(self,id)\n end", "def get_instance(id)\n CloudDB::Instance.new(self,id)\n end", "def get(vpc_id)\n if vpc_id\n self.class.new(:service => service).all('vpc-id' => vpc_id).first\n end\n end", "def find_region_by_service(id)\n self.class.get(\"/services/#{id}/regions.json?apikey=#{apikey}\") \n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/tasks/#{id}\", options: options)).first, client: client)\n end", "def set_counter_service\n @counter_service = CounterService.find(params[:id])\n end" ]
[ "0.8232609", "0.8001466", "0.798906", "0.74800235", "0.72416794", "0.71020395", "0.70208025", "0.6957702", "0.69028586", "0.67009765", "0.66773814", "0.663707", "0.66209364", "0.6619968", "0.65975714", "0.6573358", "0.652599", "0.652599", "0.65230924", "0.64800894", "0.6475067", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6462009", "0.6434", "0.64299476", "0.64299476", "0.64299476", "0.64299476", "0.6422756", "0.6405033", "0.6387649", "0.63842523", "0.63714653", "0.636408", "0.636408", "0.63599557", "0.6353809", "0.6346358", "0.6338438", "0.6334771", "0.63238066", "0.6294664", "0.62892", "0.6283511", "0.62094367", "0.62060523", "0.619177", "0.6170032", "0.61503595", "0.61483186", "0.61350113", "0.6129509", "0.61068255", "0.6102139", "0.60938543", "0.6044949", "0.60294545", "0.6019222", "0.6016984", "0.60155", "0.601473", "0.60057515", "0.60006005", "0.5997761", "0.59916794", "0.5986824", "0.5986824", "0.59862626", "0.59707236", "0.59638697", "0.59490794", "0.59322155", "0.5931585", "0.59254956", "0.59198385", "0.59198385", "0.5903656", "0.5857632", "0.5857288", "0.58570975" ]
0.6697947
10
Asserts that a file matches the pattern
def assert_match_in_file(pattern, file) File.file?(file) ? assert_match(pattern, File.read(file)) : assert_file_exists(file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_match_in_file(pattern, file)\n assert File.exist?(file), \"File '#{file}' does not exist!\"\n assert_match pattern, File.read(file)\n end", "def assert_match_in_file(pattern, file)\n assert File.exist?(file), \"File '#{file}' does not exist!\"\n assert_match pattern, File.read(file)\n end", "def test_file\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf/\"\n end", "def file_match(file)\n end", "def fnmatch(pattern, *args) File.fnmatch(pattern, path, *args) end", "def files_match(actual, expected)\n FileCompareAssertion.new(actual, expected)\n end", "def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end", "def match_against filename\n @regexp.match(filename)\n end", "def assert_match(pat, str)\n m = GlobMatchPattern.new(pat)\n assert_equal true, m.match(str)\n end", "def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end", "def fnmatch?(pattern, *args) File.fnmatch?(pattern, path, *args) end", "def filename_matches_pattern?(filename)\n @file_matchers.each do |pattern|\n return true if File.fnmatch(pattern, filename)\n end\n return false\n end", "def fnmatch( pattern, *args ) File.fnmatch( pattern, self, *args ) end", "def file_contains(filename, pattern)\n unless pattern.kind_of?(Regexp)\n pattern = Regexp.new(pattern)\n end\n detected = nil\n File.open(filename) { |f|\n detected = f.detect { |line|\n line =~ pattern\n }\n }\n ! detected.nil?\n end", "def test_root_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf/\"\n end", "def assert_file( file, msg = nil )\n assert_fwf_filepath( file, message(nil){ \"...is not a file.\" } )\n \n msg = message(msg){ \"File should exist at <#{file}>.\" }\n assert file.file?, msg\n end", "def fnmatch?( pattern, *args ) File.fnmatch?( pattern, self, *args ) end", "def assert_file_has_content( file, msg = nil )\n assert_fwf_filepath( file, message )\n msg = message(msg){ \"File should exist at <#{file}>, and have content.\" }\n assert file.exist?, msg.call + \"(file does not exist)\"\n assert file.file?, msg.call + \"(not a file)\"\n refute file.empty?, msg.call + \"(file is not empty)\"\n end", "def test_application_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf\"\n end", "def with_baselines(path, pattern, options={}, &block)\n count = 0\n errors = []\n Dir.glob(\"#{datadir}/#{path}/*\").each do |filename|\n next unless filename =~ pattern\n count += 1\n output = yield(*($LAST_MATCH_INFO.to_a))\n begin\n assert_testdata_equal(filename, output, options)\n rescue Test::Unit::AssertionFailedError => ex\n errors << ex\n end\n end\n assert count > 0, \"no test data files found in #{datadir} - check the test environment\"\n\n flunk errors.map(&:message).join(\"\\n\\n\") if errors.present?\n end", "def is_valid_file_name?(filename)\n return $filepattern.match(filename)\nend", "def check_file_patterns\n FILE_PATTERNS.each do |attr_name|\n if respond_to?(\"_validate_#{attr_name}\", true)\n send(\"_validate_#{attr_name}\")\n else\n validate_nonempty_patterns(attr_name, :error)\n end\n end\n\n _validate_header_mappings_dir\n if consumer.spec.root?\n _validate_license\n _validate_module_map\n end\n end", "def test_file(path)\n return File.file?(path)\nend", "def pattern_match(file, pattern)\n case\n when pattern.is_a?(Regexp)\n return file.match(pattern)\n when pattern.is_a?(String)\n return File.fnmatch(pattern, file)\n when pattern.is_a?(Proc)\n return pattern.call(file)\n when pattern.is_a?(Rake::FileTask)\n return pattern.to_s.match(file)\n else\n raise \"Cannot interpret pattern #{pattern}\"\n end\n end", "def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end", "def assert_file_content_match(refFile,resContent, explanationstring=\"\")\n if explanationstring.empty?\n explanationstring=explanationstring + \": \"\n end\n\n refContArr = File.open(refFile,\"r\").read.split(/\\n/)\n resContArr = resContent.split(/\\n/)\n assert_equal(refContArr.size,resContArr.size,explanationstring + \"Line count assertions : asnswer file: #{refFile}: \")\n for count in 0...refContArr.size\n re = refContArr[count]\n assert_match(/#{re}/,resContArr[count],explanationstring + \"At line :\" + count.to_s + \": answer file: #{refFile}\")\n end\n end", "def matches?(file); matches_exprs?(file,[@reg_expr]); end", "def gsub_file_with_match_check(relative_destination, regexp, *args, &block)\n path = destination_path(relative_destination)\n matches = File.read(path).match(regexp)\n raise \"Regexp not found in #{relative_destination}\\n called from #{caller.first}\" unless matches\n gsub_file(relative_destination, regexp, *args, &block)\nend", "def matching_file_regex\n file_regex ? file_regex : /\\.js$/\n end", "def test_validate_file\n file_list = [\n '0|0|SYSTEM>569274(100)|1553184699.650330000|288d',\n '1|288d|569274>735567(12):735567>561180(3):735567>689881(2):SYSTEM>532260(100)|1553184699.652449000|92a2',\n '2|92a2|569274>577469(9):735567>717802(1):577469>402207(2):SYSTEM>794343(100)|1553184699.658215000|4d25'\n ]\n assert validate_file file_list, [0, 0], '0'\n end", "def test_existing_file\n assert verify_parameters(['verifier_tests.rb'])\n end", "def assert_file_exists(path)\n assert File.exist?(\"#{path}\"), \"The file '#{path}' should exist\"\n end", "def test_directory_with_index\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory/\"\n end", "def test_file_must_contain_fuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"\\tnew line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"\\tnew line\\n\", lines[-1])\n\t\t}\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => true, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(false, added, \"file_must_contain added the fuzzy match when it shouldn't have\")\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => false, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(true, added, \"file_must_contain didn't add the strict match when it should have\")\n\t\t\n\t\t# test regexp escaping with fuzzymatch\n\t\tassert_nothing_raised() {\n\t\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, '0 0 * * 5 /usr/local/sbin/pkg_version -v -L =', :fuzzymatch=>true)\n\t\t}\n\t\t\n\t\t@resolvfile = Tempfile.new('test')\n\t\t@resolvefilecontents = <<FILEBLOCK\n# our servers\nnameserver 69.9.164.130\nnameserver 69.9.164.131\nFILEBLOCK\n\t\t@resolvfile.write(@multilinefilecontents)\n\t\t@resolvfile.close(false)\n\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'domain titanresearch.com', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.130', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.131', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 66.180.175.18', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.191.4', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.160.191', :fuzzymatch=>true)\n\t\t\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'domain titanresearch.com'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.130'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.131'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 66.180.175.18'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.191.4'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.160.191'))\n\tend", "def test_application_session_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", \"0000000000000000\", nil ], \"/component.vwf/0000000000000000\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", \"0000000000000000\", nil ], \"/directory/0000000000000000\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", \"0000000000000000\", nil ], \"/directory/component.vwf/0000000000000000\"\n end", "def test_read_file\n assert_match %r(This is a sample file to test extraction), zip.entry('samples/file.txt').read\n end", "def test_file_must_contain_contains()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend", "def assertMatchTest pattern, value\n assertMatch pattern, value\n end", "def check_file_content(file_path, my_class_expected)\n assert_equal File.read(file_path), my_class_expected\n end", "def matches_file?(f)\r\n @magics.any? {|m| m =~ f }\r\n end", "def matches_path?(pattern, path); end", "def matches_path?(pattern, path)\n File.fnmatch?(\n pattern, path,\n File::FNM_PATHNAME | # Wildcard doesn't match separator\n File::FNM_DOTMATCH # Wildcards match dotfiles\n )\n end", "def valid_file?(path)\n case path\n when %r|/abcdef$|, %r|^\\./tmp/db/\\w+?/database.yml$|\n return false\n end\n return true\n end", "def assert_file_named_correctly!(file, translations); end", "def validate_file(file)\n end", "def matches?(cmd)\n files_match? && file_content_match?\n end", "def relevant_file?(file)\n file.end_with?('_spec.rb')\n end", "def test_read_bad_file\n assert_raises SystemExit do\n assert_output 'File does not exist', @verify.read('sample_test.txt')\n end\n end", "def match?( path )\n path_matcher =~ path\n end", "def file_exist(file)\n FileExistAssertion.new(file)\n end", "def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end", "def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\nend", "def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end", "def search_file(pattern, file)\n node = ast_from_file(file)\n search node, pattern\n end", "def matches_filename?(filename)\r\n basename = File.basename(filename)\r\n @glob_patterns.any? {|pattern| File.fnmatch pattern, basename.downcase}\r\n end", "def contain?(filename); end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error \"File patterns must be relative and cannot start with a \" \\\n \"slash (#{attrb.name}).\"\n end\n end\n end\n end", "def test_file?(path)\n @tests_files.include?(path)\n end", "def matches_logfile?(path); end", "def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend", "def matches(_ext); end", "def matches(_ext); end", "def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend", "def content_matches_file?(content, path)\n file = read_content_from_disk(path)\n content.eql?(file)\n end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error '[File Patterns] File patterns must be relative ' \\\n \"and cannot start with a slash (#{attrb.name}).\"\n end\n end\n end\n end", "def test_match_regexp\n pattern = /Hello,*/\n value = \"Hello, World\"\n check = Maze::Checks::AssertCheck.new\n check.match pattern, value\n end", "def check_file_existence (file_path)\n \"[ -f '#{file_path}' ]\"\n end", "def filter(file, fixture)\n # return ['affix_InterveningEmpty.json'].include?(File.basename(file))\n # File.basename(file) =~ /bugreports_greek/i\n # File.basename(file) =~ /sort_stripmark/i\n # return File.basename(file) =~ /^date_rawparsesimpledate/i\n true\nend", "def matches(ext); end", "def matching_file(spec, path) # :doc:\n glob = \"#{@lib_dirs[spec.object_id]}/#{path}#{SUFFIX_PATTERN}\"\n return true unless Dir[glob].select { |f| File.file?(f) }.empty?\n end", "def file? filepath\n self.system \"test -f #{filepath}\"\n end", "def glob_matches?(rule)\n File.fnmatch?(rule, @host_name)\n end", "def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end", "def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end", "def match?(path)\n path =~ to_regexp\n end", "def file_pattern(name)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n get_config_val(@file_patterns, name)\n end", "def eventually_expect_dump_file_to_match(regex, category = 'requests')\n wait_for_dump_file_existance(category)\n eventually do\n read_dump_file(category) =~ regex\n end\n end", "def matcher(pattern)\n case pattern\n when Regexp then lambda{|p| p =~ pattern}\n when String then lambda{|p| File.fnmatch?(pattern, p)}\n when Proc then pattern\n else raise ArgumentError, \"Expected a Regexp, String, or Proc\"\n end\n end", "def assert_file!\n raise MissingSource,\n \"Couldn't find the source file `#{@path}'\" unless @path.file?\n end", "def test_should_read_error_from_file\n \n input = \"test_should_read_error_from_file\"\n outname = \"test_should_read_error_from_file\"\n \n errorFile =\"./error/#{outname}.txt\"\n file = File.open(errorFile, 'w')\n file.write(input);\n file.close();\n \n dir = \"./p/test_should_read_error_from_file.rb\"\n filename = \"test_should_read_error_from_file.rb\"\n \n result = get_compile_error( dir , filename )\n \n assert_equal(input, result)\n \n end", "def test_file_must_not_contain_not_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"new line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t\tassert_equal(false, lines.include?(\"new line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, /johnny/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend", "def test_should_be_syntax_error\n \n dir = \"./test_case/syntax_error.rb\"\n filename = dir\n \n result = check_and_compile_file( dir , filename )\n \n assert_equal(false, result)\n \n end", "def assert_no_file( file, msg = nil )\n assert_fwf_filepath( file, message )\n msg = message(msg){ \"No file/directory should exist at <#{file}>.\" }\n refute file.file?, msg\n end", "def tests_for_file(filename)\n super.select { |f| @files.has_key? f }\n end", "def file_check(filename, delete=true, &block)\n ext = File.extname(filename)\n base = filename.chomp(ext)\n checkfile = base + \".CHECK\" + ext\n File.exist?(filename).should be_true\n fstring = IO.read(filename)\n cstring = IO.read(checkfile)\n if block\n (fstring, cstring) = [fstring, cstring].map do |string|\n block.call(string)\n end\n end\n fstring.should == cstring\n File.unlink(filename) if delete\nend", "def check_file(fn)\n File.foreach(fn) do |line|\n return $1 if line =~ /^\\s*require_relative\\s*['\"](.*spec_helper)['\"]/\n end\n nil\nend", "def content_exists(file, regex, mode)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tif mode.to_i == 1\n\t\tf = File.open(file, 'r')\n\telse\n\t\tf = File.open(file, 'rb') #Open file in binary mode (utmp/wtmp/etc)\n\tend\n\tfoo = f.readlines #Read file into array we can search through as wel like\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tif mode.to_i == 1\n\t\t\tputs \"#{HC}#{FGRN}Found in Non-Binary File#{FWHT}: #{file}#{RS}\"\n\t\telse\n\t\t\tputs \"#{HC}#{FGRN}Found in Binary File#{FWHT}: #{file}#{RS}\"\n\t\tend\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend", "def in_file(filename); end", "def validate(scraper_dir, f)\n fpath = File.join(scraper_dir, f)\n src = File.read(fpath)\n [ LOCATION_RE, FETCH_RE ].each do |re|\n puts \"WARN: No match for #{re} in #{f}\" if (src !~ re)\n end\nend", "def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend", "def valid_file_name\n (@file_name.match(/((\\d)|([a-zA-Z])|(_))*.log/).to_s == @file_name)\n end", "def scan_file (file_name)\n #for each line\n File.open(file_name).each do |line|\n parsed_line = parse_line line\n raise \"Invalid spec format:\\n\" + line if parsed_line.class == InvalidLine\n update_on_new_line parsed_line\n end \n @test_suite.add_test_case current_test_case if current_test_case && @state.class == AddingTestCases\n @test_suite\n end", "def is_match?(file)\n return Match.new file, 'No Destinatin for file'\n end", "def music_file(file)\n ext_list = $config[\"music_file\"][\"media_extentions\"].gsub(/,/,\"|\")\n \n ext = \".*\\.(#{ext_list})$\" \n name = \"\"\n\n $config['music_file']['regex'].each do |pattern|\n if file =~ /.*#{pattern}#{ext}/i\n name = $1 if $1\n return false if name =~ /^sample/i\n return true\n end\n end\n return false\nend", "def validate_file(filename)\n return true\nend", "def match(pattern, flags = 0)\n\t\t\t\tpath = pattern.start_with?('/') ? full_path : relative_path\n\t\t\t\t\n\t\t\t\treturn File.fnmatch(pattern, path, flags)\n\t\t\tend", "def check\n prefix = File.basename(@file)\n if File.exist?(@file)\n @message = \"#{prefix} : Expected file exists\"\n true\n else\n @message = \"#{prefix} : Expected file not found.\"\n false\n end\n end", "def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend", "def never_expect_dump_file_to_match(regex, category = 'requests')\n should_never_happen do\n File.exist?(dump_file_path(category)) &&\n read_dump_file(category) =~ regex\n end\n end", "def assert_file_exists(path)\n assert File.exists?(\"#{APP_ROOT}/#{path}\"),\"The file '#{path}' should exist\"\n end" ]
[ "0.84720325", "0.84720325", "0.7726407", "0.71817625", "0.6976901", "0.6971162", "0.6956284", "0.6867407", "0.6860901", "0.67609847", "0.6753833", "0.67474234", "0.6743917", "0.67360705", "0.6718352", "0.6703183", "0.66835773", "0.66835034", "0.6605372", "0.6548858", "0.65231144", "0.64610726", "0.637331", "0.63617444", "0.6342715", "0.63289344", "0.62885857", "0.6267361", "0.62554574", "0.62391883", "0.62379146", "0.62224275", "0.621631", "0.6211102", "0.6176233", "0.61740834", "0.61305606", "0.61268556", "0.610917", "0.61084807", "0.6096781", "0.6089401", "0.60863376", "0.60724026", "0.6049072", "0.6042485", "0.5997353", "0.5951395", "0.59478635", "0.5918484", "0.5906541", "0.58855325", "0.58802193", "0.58786863", "0.58784735", "0.58713734", "0.5864588", "0.5860678", "0.5860013", "0.58584887", "0.58497787", "0.58497787", "0.58424324", "0.5836665", "0.5811679", "0.5784496", "0.57688", "0.57645285", "0.57632166", "0.5749334", "0.57393426", "0.57378036", "0.57247543", "0.57247543", "0.5720004", "0.57167727", "0.5716546", "0.5716399", "0.571525", "0.571488", "0.57125944", "0.57072604", "0.570272", "0.56937975", "0.5689537", "0.56888354", "0.56877863", "0.56821615", "0.5678932", "0.56726193", "0.56652606", "0.56612605", "0.56491137", "0.56481045", "0.56396127", "0.5636548", "0.56285477", "0.56282806", "0.56277215", "0.56270176" ]
0.8460051
2
Helper methods Method to display a message with a 'Hash Rocket =>'
def say(msg) puts "=> #{msg}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def farewell_message\n puts \"\"\n puts \"Cheers! \\u{1f37b}\" # beer emoji 🍻\n end", "def foorth_message\r\n \"#{self.foorth_code} #{self.message}\"\r\n end", "def display\n\t\tr_str = \"Message: \"\n\t\t(@length / 5).times { |i| r_str += \"#{@string[(i * 5)...(i * 5) + 5]} \" }\n\t\tputs r_str\n\tend", "def hockey_message(title, link, version)\n\n message = \"\\n++++++++++++++++++++++++++++++++\\n\" +\n title + \" \\n\" +\n \"Ссылка: \" + link + \" \\n\" +\n \"Версия: \" + version +\n \" \\n++++++++++++++++++++++++++++++++\"\n\nend", "def win_message(symbol)\n m = {player: \"You win!\",\n blackjack: \"Dealer can't beat that BlackJack. Nice playing.\",\n push: \"Push.\",\n dealer: \"Dealer wins.\"}[symbol]\n @printer << m\n nil\n end", "def display_user_goodbye\n display_name = User[id_active_user].full_name\n goodbye_msg = \"It Was Very Nice Getting To Know You, Good Luck With All Your Future Endeavors And If We Cross Paths Again, We Will Be Very Pleased To Hear About Your Exploits, #{display_name}!\"\n puts \"\" \n puts \" -- #{ goodbye_msg } -- \".colorize(:color => :blue, :background => :white)\n puts \"\" \nend", "def display(message)\n __display(message)\n end", "def show_message _type\n \"<div class=\\\"#{_type}\\\">#{h message[_type]}</div>\" if message[_type]\n end", "def describe_no_matches_as(message)\n return \"<span class='nomatches'>&mdash; #{message} &mdash;</span>\".html_safe\n end", "def display_repel_check\n display_message(parse_text(39, 0))\n end", "def help_message(message)\n '<a href=\"#\" class=\"info\"><img src=\"/images/help.gif\" /><span>' + message + '</span></a>'\n end", "def pretty_hash_message(msg_hash)\n message = msg_hash['message']\n if msg_hash['errors']\n msg_hash['errors'].each do |k,v|\n if msg_hash['errors'][k]\n message = \"#{message}:\\n#{k}: #{v}\"\n end\n end\n end\n message\n end", "def message\n t(\".message\")\n end", "def user_message\n return _translate if description.present? || tkey.present?\n return \"#{_translate} (#{user_digests})\" unless defined?(@coaster)\n message\n rescue => e\n \"#{message} (user_message_error - #{e.class.name} #{e.message})\"\n end", "def message\n message_hash || 'The item could not be found'.freeze\n end", "def help_message()\n return 'I\\'ll remove you from the line to get on deck. (I\\'ll automatically remove you if you leave the room.)'\n end", "def shout(message)\n output.puts Paint[message, :bold, :red ]\n end", "def success(msg)\n tell \"#{✔} {g{#{msg}}}\"\n end", "def message\n t(\".message\")\n end", "def message\n t(\".message\")\n end", "def instruction_message\n puts \"\\nMASTERMIND is a color guessing game where the computer generates a \\\nrandom string of four characters representing the base colors #{\"(r)ed\".red}, \\\n#{\"(g)reen\".green}, #{\"(b)lue\".blue}, and/or #{\"(y)ellow\".yellow}. \\\nThe intermediate difficulty level is six characters and adds \\\n#{\"(m)agenta\".magenta} and the advanced difficulty level is eight characters \\\nand adds #{\"(c)yan\".cyan}. \\\nThe string is only guaranteed to contain one color. The player must submit \\\nguesses to try to find the generated combination. Guesses are not case sensitive.\"\n\n puts \"\\nEnter #{\"(p)lay\".green}, #{\"(i)nstructions\".yellow} or #{\"(q)uit\".red}\"\n end", "def display(msg)\n puts\n puts msg\n end", "def unified_message\n notice.message.gsub(/(#<.+?):[0-9a-f]x[0-9a-f]+(>)/, '\\1\\2')\n end", "def welcome_message\n puts \"\n ┏━━━┓━━━━┏┓━━━━━━━┏┓━━━━━━━━┏┓━\n ┃┏━┓┃━━━━┃┃━━━━━━━┃┃━━━━━━━┏┛┗┓\n ┃┗━┛┃┏┓┏┓┃┗━┓┏┓━┏┓┃┃━┏┓┏━━┓┗┓┏┛\n ┃┏┓┏┛┃┃┃┃┃┏┓┃┃┃━┃┃┃┃━┣┫┃━━┫━┃┃━\n ┃┃┃┗┓┃┗┛┃┃┗┛┃┃┗━┛┃┃┗┓┃┃┣━━┃━┃┗┓\n ┗┛┗━┛┗━━┛┗━━┛┗━┓┏┛┗━┛┗┛┗━━┛━┗━┛\n ━━━━━━━━━━━━━┏━┛┃━━━━━━━━━━━━━━\n ━━━━━━━━━━━━━┗━━┛━━━━━━━━━━━━━━\n\n \".center(100).colorize(:cyan)\n sleep 2\n end", "def welcome(wins)\n <<-MSG\n\n***** #{colorize('Welcome to Rock, Paper, Scissors, Spock, Lizard!', 'white', 'bg-blue')} *****\n***** #{colorize('Current Score:', 'white')} #{colorize('YOU', 'white', 'bg-magenta', 1)} vs #{colorize('COMPUTER', 'white', 'bg-magenta', 1)} *******************\n***** #{colorize(\" #{wins[:User]} \", 'white', 'bg-cyan', 1)} #{colorize(\" #{wins[:Computer]} \", 'white', 'bg-cyan')}\n***** Game on! Make your selection now *******************\n\nMSG\nend", "def show_message(message)\n puts message\nend", "def show_message(message)\n puts message\nend", "def show_message(message)\n puts message\nend", "def thud(title, message)\r\n Tk.messageBox('icon' => 'error', 'type' => 'ok', \r\n 'title' => title, 'message' => message)\r\nend", "def info(message)\n puts \"\\e[35m#{message}\\e[0m\"\n end", "def ui_message(message)\n puts message\n end", "def welcome_message\n puts \"Welcome to Shiqing's Secret Number Game! \\nShiqing created this game.\"\nend", "def message() end", "def welcome_message\r\n system(\"clear\")\r\n a = Artii::Base.new :font => 'slant'\r\n puts a.asciify('Make 10').colorize(:white).on_green\r\n puts (\"This app can find solutions for the game Make 10.\")\r\n end", "def printOutcomeMessage(hand, outcome)\n puts \"\\tHand \" + hand.getName + \" result is: \" + $outcomeHash[outcome]\nend", "def to_s; message; end", "def print_shake\n puts \"SHAKE SHAKE SHAKE\"\n end", "def output(message, type)\n puts \"\\e[31m[ ✘ ]\\e[0m #{message}\" if type == 'error'\n puts \"\\e[32m[ ✔︎ ]\\e[0m #{message}\" if type == 'success'\n puts \"\\e[33m[ ✻ ]\\e[0m #{message}\" if type == 'info'\nend", "def flash_message(type, message)\n \"<div class=\\\"alert-message #{type}\\\"><p>#{message}</p></div>\".html_safe\n end", "def display_message(message)\n if params[:keys].given?\n output = \"\"\n\n parsed = JSON.parse(message)\n params[:keys].values.each do |key|\n output << get_value(key, parsed).to_s\n output << \" \"\n end\n\n puts output\n\n else\n puts message, ''\n end\n end", "def error_message( msg, details='' )\n\t\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\n\t\tend", "def afaire message\n if verbose?\n message_console message, '35'\n else\n message_point '35'\n end\n end", "def message_for_display\n issue_url = nil\n if issue_key\n issue_url = Settings.rcm_jira_issue_url % issue_key\n end\n\n [error_cause, issue_url].reject(&:blank?).join(\"\\n\")\n end", "def display_info_about_app\n info_msg = \"Look Dude or Dudette ! All You Need To Know Is That This Is A Great App And You Should Be Very Happy It Fell Into Your Lap. It Will Help You Navigate The World Of Pharmacies, Especially If You Are An Orc Or A Kobolt Or One Of Those UnderWorld Creatures! And If You Happen To Be A DarkElf, Know That Drizzt D'Urden Is A Good Friend Of This ... WhatEver This Is!\"\n puts \"\" \n puts \" -- #{ info_msg } -- \".colorize(:color => :light_blue, :background => :white)\n puts \"\" \nend", "def action(message)\n print(6, message)\n end", "def error_msg(message, keys1, keys2)\n sprintf(ERRORS[message], carrier, (keys1 - keys2).to_a.join(', '))\n end", "def apphelp_generic( message_name )\n t( \"uk.org.pond.canvass.generic_messages.#{ message_name }\" )\n end", "def error_message( msg, details='' )\n\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + ' ' + details\n\tend", "def display_error\n error <<~MSG\n Sorry, please check\n your input to verify it\n is correct.\n MSG\n prompt error\nend", "def display(msg)\n stdout.puts msg\n return \"#{msg}\\n\"\n end", "def message(message) end", "def to_display_without_style\n \"Admin Alert: #{self.message}\".html_safe\n end", "def message\n [ keyword, raw_args ].flatten.join(' ')\n end", "def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end", "def display_lost_round_message\n puts \"#{current_player.name} lost and their score is now #{current_player.score}\".red\n\n end", "def show(msg)\n puts msg\n false\n end", "def show(msg)\n message(\"show\", :red, msg)\n end", "def formatted_message\n \"#{@message} (#{@code})\"\n end", "def get_victory_confirmation()\n return \"#{@player.get_name()} wins with #{@player.get_weapon()}!\"\n end", "def inspect\t\t\n\t\tmsg = '{'\n\t\t@hash.each_with_index do |info, index|\n\t\t\tmsg += info.to_s\n\t\t\tmsg += \", \" if @hash.size > 1 and index + 1 < @hash.size \n\t\tend\n\t\tmsg += '}'\n\t\tmsg\n\tend", "def gradebookMessage\n \" \"\nend", "def show_hash\n hash = Push::Rhn.make_hash_for_push(@errata, current_user.login_name)\n respond_to do |format|\n format.json do\n render :layout => false,\n :json => hash.to_json\n end\n format.text do\n render :text => hash_to_string(hash)\n end\n format.html do\n @text = hash_to_string(hash)\n render :layout => false\n end\n end\n end", "def print_summary\n return if @silent\n fail '@key is empty' if \"#{@key}\".empty?\n say( \"#{@key} = '<%= color( %q{#{value}}, BOLD )%>'\\n\" )\n end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def ok(message=\"\")\n\t\t\t\tputs \"[ #{green('Ok')} ] #{message}\"\n\t\t\tend", "def welcome_message\n puts \"\\n\"\n puts \"Welcome to Rock Paper Scissors\"\n end", "def help_message()\n\t\treturn 'If you say (for example) \"help dance\", I\\'ll tell you what the dance command does.'\n\tend", "def print_message_text()\n @renderer.puts(\"Msg: #{@message_to_post.text_for_display}\")\n end", "def print_final_message(name_player, win)\n if win\n puts \" #{name_player} you won\".colorize(:cyan)\n else\n puts \" #{name_player} you lost\".colorize(:light_red)\n end\n puts\nend", "def say_notice(string)\n HighLine.new.say(\"\\n<%= color('#{string}', :notice ) %>\\n\")\n end", "def msg(message)\n \"#{@current_host_name}: #{message}\"\n end", "def welcome_message\n message = \"Welcome to Locavore Kitchen!\"\n end", "def show(msg)\n puts 'EXAMPLE<basic> ' + msg\nend", "def message_template; end", "def hermes_catchphrase; end", "def html_out(msg, color_name=\"black\")\n\t\t\trgb = Color::RGB::by_name color_name\n\t\t\tputs \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n\t\tend", "def message(string)\n puts\n puts \"[#{colorize(\"--\", \"blue\")}] #{ string }\"\nend", "def message\n \"Someone is about to start a trip. Are you at home? If not, make your place unavailable\"\n end", "def standard_message\n \"#{current_player.name}'s pending words: #{pending_result}\"\n end", "def get_other_victory_confirmation()\n return \"#{@player.get_other_name()} wins with #{@player.get_other_weapon()}!\"\n end", "def display_over(msg)\n msg = \"\\r#{msg}\"\n stdout.print msg\n return msg\n end", "def show\n render text: @system_message.content.html_safe\n end", "def msg=(_); end", "def msg=(_); end", "def info(prefix, msg)\n tell(colorize(\"☞ \", :magenta) +\n colorize(prefix, :cyan) +\n colorize(\" #{msg}\", :white))\n end", "def chat_msg_string_pretty(msg, plays)\n s = format_timestamp(msg.time/1000) + \" \"\n if msg.to_all?\n s += \"[All]\"\n elsif msg.to_allies?\n s += \"[Allies]\"\n else\n end\n \n # color = '4F4F4F'\n color = dampen_color(msg.sender_color)\n s += ' <span style=\"color: ' + color + ';\">' + msg.sender + \"</span>: \" + msg.msg\n end", "def print_message(msg)\n print \">> #{msg.to_s} \\n\"\n end", "def msg(message)\n end", "def compose_message(key, **attributes)\n short_message = translate_message(key, **attributes)\n if short_message.is_a? Hash\n @problem = problem(key, **attributes)\n @summary = summary(key, **attributes)\n @resolution = resolution(key, **attributes)\n [['Problem', @problem], ['Summary', @summary], ['Resolution', @resolution]].each_with_object(+'') do |detail_array, message|\n message << \"\\n#{detail_array[0]}:\\n #{detail_array[1]}\" unless detail_array[1].blank?\n message\n end\n else\n short_message\n end\n end", "def throw_fierce_lqqks\n 'Here I am, giving you Soviet-Satellite realness'\n end", "def show_action_error(string)\n ErrorSound.play\n text = \"Sequence key : #{phase_sequence[battle_phase].call}\\n\" + \n \"Uninitalized Constant for #{string} in :action command\"\n msgbox text\n exit\n end", "def print_welcome_message\n puts \"\\nThank you for using this amazing command line bowling scorecard, good luck!\\n\"\n end", "def print_error_message(**params)\n action = case params[:action]\n when :like then 'like media'\n when :unlike then 'unlike media'\n when :follow then 'follow user'\n when :unfollow then 'unfollow user'\n when :comment then 'comment on media'\n end\n error_string = \"There was an error trying to #{action} \".colorize(:red) + params[:data].to_s\n print_time_stamp\n puts error_string\n\n end", "def format_msg(msg)\n \"[VCard] #{msg}\"\n end", "def welcome_msg\n puts\n puts \"Welcome to BlackJack (by Luis Perez)!\"\n puts \"For instructions, press i.\"\n puts \"To quit, press q.\"\n puts\n end", "def whine msg\n logger.error(\"Synfeld laments: \" + msg)\n return msg\n end" ]
[ "0.67612046", "0.6542514", "0.63498914", "0.634817", "0.62878954", "0.62133276", "0.62074125", "0.6190394", "0.618903", "0.61204034", "0.61004496", "0.605202", "0.6015868", "0.6005052", "0.5968965", "0.59628934", "0.59625727", "0.59114516", "0.5895534", "0.5895534", "0.5887884", "0.5850601", "0.5848395", "0.5841268", "0.58320206", "0.5813325", "0.5813325", "0.5813325", "0.58118576", "0.58003753", "0.5793146", "0.57866895", "0.5782571", "0.5779773", "0.5772073", "0.5770031", "0.5761642", "0.57544214", "0.5754283", "0.575296", "0.5743929", "0.5738504", "0.57355654", "0.5734146", "0.5723543", "0.5713304", "0.57122624", "0.5707797", "0.5706298", "0.5703662", "0.569552", "0.56916803", "0.5679304", "0.5678903", "0.5672281", "0.56702507", "0.56543833", "0.5654287", "0.56541276", "0.5652888", "0.564217", "0.5631383", "0.5620769", "0.5617143", "0.5617143", "0.5617143", "0.5617143", "0.5617143", "0.5617143", "0.5610754", "0.5607921", "0.56078595", "0.5607592", "0.560398", "0.5603914", "0.55999184", "0.559921", "0.5597612", "0.55946773", "0.5594016", "0.55919343", "0.55887693", "0.5579444", "0.5576434", "0.55735284", "0.556586", "0.55619264", "0.55604094", "0.55604094", "0.55434763", "0.55399305", "0.5535589", "0.5533575", "0.5533264", "0.5522343", "0.55203664", "0.5515963", "0.5515045", "0.5514099", "0.5504913", "0.5502286" ]
0.0
-1
Checks if the user wants to exit the calculator. 'Q' to exit
def exit?(ans) ans.upcase == 'Q' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit?\n user_input == \"q\" || user_input == \"quit\"\n end", "def finished?\n input == 'q' || input =='quit'\n end", "def menu\n puts 'Welcome to the ruby calculator!'\n puts 'Press 1 to calculate or 2 to quit'\n case\n answer = gets.strip\n when '1'\n calculate\n when '2'\n exit\nend\nend", "def exit?(input)\n input == \"exit\"\n end", "def end_script?\n puts \"Please choose your action!\n\t'q' quit\n\t'm' menu\"\n answer = STDIN.gets.chomp\n\n case answer\n when \"q\" then exit\n when \"m\" then interactive_menu\n else\n puts \"Learn to type...\"\n end_script?\n end\nend", "def menu\n puts \"Would you like do to (b)asic math, (a)dvanced math or (q)uit?\"\n choice = gets.chomp\n if choice == \"b\"\n basic_calc\n elsif choice == \"a\"\n advanced_calc\n elseif choice == \"q\"\n return \"q\"\n end\nend", "def does_user_quit(user_input)\n quit if user_input == ''\n end", "def check_answer_input(range) #this method both prints and checks the answer\r\n\r\n\tequation = new_equation(range)\r\n\tanswer = false\r\n\r\n\twhile answer == false\r\n\t\tputs equation\r\n\t\tresult = eval equation\r\n\t\tputs \"{answer: #{result}}\"\r\n\t\tanswer_user = gets.chomp\r\n\r\n\t\tif answer_user.downcase == \"q\" #make a new method for if ??? - yes, I would make a new method\r\n\t\t\texit\r\n\t\telsif answer_user.to_i == result\r\n\t\t\tputs \"Correct!\"\r\n\t\t\tcheck_answer_input(range)\r\n\t\telse\r\n\t\t\tputs \"Try again\"\r\n\t\tend\r\n\tend\r\nend", "def exit_game?\n puts \"Would you like to exit game or play again?\"\n decision = gets.chomp\n if decision.downcase == \"exit\"\n exit\n elsif decision.downcase == \"play again\"\n initialize\n end\n end", "def check_quit(cmd)\r\n if cmd == \"q\" || cmd == \"quit\"\r\n puts \"Thank you for your coming.\"\r\n puts \"Hope to see you again soon!\"\r\n return true\r\n end\r\n return false\r\nend", "def quit?\n exit if options[:quit]\n end", "def menu\n puts `clear`\n print Rainbow(\"\\n\\n\\t***Calculator***\\n\\n\").red\n print Rainbow(\"(b)asic, (a)dvanced, or (q)uit\\n\\n\").green\n choice = gets.chomp.downcase\n case choice[0]\n when \"b\"\n basic_calc\n when \"a\"\n advanced_calc\n when \"q\"\n puts Rainbow(\"\\n\\tGoodbye\\n\").magenta\n gets\n response = \"q\"\n\n else \n puts Rainbow(\"You're doing it wrong!\".upcase).red\n menu\n end\n \nend", "def again_or_exit?(crate)\n puts \"\\n\\nWhat would you like to do now?\\n1. View another genre.\\n2. Exit\"\n input = gets.strip\n input_i = input.to_i\n acceptable_answers = (1..2).to_a\n while acceptable_answers.none? { |answer| answer == input_i }\n puts \"\\nI'm sorry, that's not a valid option.\"\n puts \"Please enter 1 or 2.\"\n input_i = gets.strip.to_i\n end \n\n if input_i == 1\n self.start(crate)\n else\n puts \"Have a good one!\"\n end\n end", "def prompt_quit\n ans = ''\n\tloop do\n\t print \"\\nDo you want to play another round (Y/N)? \"\n\t ans = gets.chomp.upcase\n\t break if ['Y', 'N'].include? ans\n\t puts \"Invalid answer! Try again...\"\n\tend\n\tans == 'N'\n end", "def quitting?; @quit > 0 end", "def menu\n\n puts \"~~~~~~~~Best Calculator EVER!~~~~~~~~\"\n puts \"Choose Function\"\n print \"(b)asic, (a)dvanced or (q)uit: \"\n option_1 = gets.chomp.downcase\n\n if option_1 == \"b\"\n basic_calc\n elsif option_1 == \"a\"\n advanced_calc\n else \n \"q\"\n \n end\nend", "def menu\n puts \"(a) - addition\"\n puts \"(s) - subtraction\"\n puts \"(m) - multiplication\"\n puts \"(d) - division\"\n puts \"(r) - remainder\"\n puts \"(e) - exponential\"\n puts \"(o) - root\"\n puts \"(q) - quit\"\n print Rainbow(\"Enter your choice of calculation: \").bold.white\n\n gets().chomp() #Implict return\nend", "def prompt_quit\n\t ans = ''\n\t loop do\n\t print \"\\nDo you want to play another round (Y/N)? \"\n\t ans = gets.chomp.upcase\n\t\tbreak if ['Y', 'N'].include? ans\n\t\tputs \"Invalid answer! Try again...\"\n\t end\n\t ans == 'N'\n\tend", "def input_esc\r\n return :exit\r\n end", "def main_menu_check\n input = user_input\n until input == 'p'\n if input == 'q'\n exit!\n end\n puts \"Wrong input, enter p to play or q to quit\"\n input = user_input\n end\n end", "def get_user_choice\n#show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.chomp #implicit return\nend", "def input_esc\n return :exit\n end", "def valid?\n @input != \"exit\" && @input != \"quit\"\n end", "def menu\n system (\"clear\")\n print \"\\n\\t\" + Rainbow(\"***Calc***\\n\").red, \"\\n\"\n print Rainbow(\"(b)\").white+Rainbow(\"asic ,\").green+Rainbow(\"(a)\").white+Rainbow(\"dvanced, \").green+Rainbow(\"(c)\").white+Rainbow(\"onvert or \").green+Rainbow(\"(q)\").white+Rainbow(\"uit \").green\n choice = gets.chomp.to_s\n case choice \n when \"b\"\n basic_calc\n when \"a\"\n advanced_calc\n when \"c\"\n convert_calc\n when \"q\"\n response = \"q\"\n else \n print Rainbow(\"\\n Not a valid choice, press enter to try again\").red\n gets\n menu\n end\nend", "def get_user_input\n user_input = gets.chomp\n user_input == \"exit\" ? exit : user_input\nend", "def quit_command?(str)\n return (str == 'q' or str == 'quit' or str == 'exit')\nend", "def menu\nuser_input= nil\n\tuntil user_input == \"q\"\n\tputs \"Your calculator menu\"\n\tprint \"(b)asic , (a)dvanced, (m)ortgage, (bm)i, (t)rip, (q)uit, :\" #add other calulators\n\tuser_input = gets.chomp\n\tif user_input == \"b\"\n\t\tbasic_calc\n\n\telsif user_input == \"a\"\n\t\tadvanced_calc\n\n\telsif user_input == \"m\"\n\t\tmortgage_calc\n\n\telsif user_input == \"bm\"\n\t\tbmi_calc\n\n\telsif user_input == \"t\"\n\t\ttrip_calc\n\n\telsif user_input == \"q\"\n\t\tend\n\tend\nend", "def exit_or_rerun\n puts \"\\nDo you want to select another category? (yes/no/exit)\\n\\n\"\n response = user_input_capture\n if AFFIRMATIVE_INPUT.include?(response.downcase)\n select_category\n elsif NEGATIVE_INPUT.include?(response.downcase) || QUIT_INPUT.include?(response.downcase)\n exit_app\n else\n puts \"Invalid response! Please enter 'yes', 'no', or 'exit' to quit\"\n exit_or_rerun\n end\n \n end", "def getinput(question, default = '')\n askuser = question + \" ('q' to quit)\"\n askuser << (!default.empty? ? \" [#{default}]: \" : \": \")\n puts askuser\n myui = gets.chomp\n if myui.casecmp('q').zero? then\n puts \"Okay, g'bye!\"\n exit\n end\n return myui\nend", "def main_menu(withheader)\n if withheader == SHOW_HEADER\n show_header()\n end\n menu_options();\n \n #Start looping\n begin\n operator = gets.chomp\n if operator != 'q'\n case operator\n when \"1\"\n add_operation()\n when \"2\"\n sub_operation()\n when \"3\"\n mult_operation()\n when \"4\"\n div_operation()\n else\n print_message(\"Invalid operation. Try again\")\n end ##END OF CASE\n menu_options();\n end ##END OF IF OPERATOR != Q\n end while operator != 'q' ##END OF BEGIN WHILE\n print_message \"Ended calculator...\"\n end", "def menu\n puts \"(a) - addition \"\n puts \"(q) - quitting \"\n puts \"(m) - multiplication \"\n puts \"(d) - division \"\n puts \"(s) - Square Root \"\n puts \"(e) - exponents \"\n print \"Enter your choice: \"\n gets.chomp()\nend", "def quit? \n\t\tif @move == \"quit\" || @move == \"q\"\n\t\t\ttrue\n\t\tend\n\tend", "def action_0\nputs \"Are you ready to start a new game?\\n [ Y ] [ N ]\"\n user_input = gets.chomp.downcase\n if user_input == \"y\"\n action_1\n elsif user_input == \"n\"\n puts \"\\nSmart decision! Come back later :)\\n\\n\"\n exit\n else\n nil\n end\nend", "def return_or_quit\n puts \"Please select r to return to the home screen or q to exit the program.\"\n choice = gets.chomp.downcase\n case choice\n when \"r\"\n command_list\n when \"q\"\n quit_program\n else\n return_or_quit\n end\n end", "def exit_anything(input)\n if input.downcase == \"exit\"\n exit_statement\n end\nend", "def trigger_quit(entered_name)\n entered_name.downcase == \"quit\" || entered_name.downcase == \"q\"\nend", "def exit_tent_house\n puts \"Are you sure you want to Exit [y/n]\"\n key_in = gets.chomp()\n\n if key_in.eql? \"y\"\n @db.close if @db\n\n puts \"Thanks for using 'Tent House Rental'\"\n puts \"Exiting...\"\n\n return\n else\n main\n end\n end", "def play_again?\n puts \"do you want to play again? (y/n)\"\n ans = gets.chomp.downcase\n if ans != 'y'\n exit\n end\nend", "def forced_exit?; @quit > 1 end", "def ask_continue_exit\n puts \"Do you want to continue shopping? (Y/N)\"\n answer = gets.chomp\n answer.upcase == \"Y\"\nend", "def get_answer\n\tprint \"please enter the keyword to 'exit': \"\n\tprint \"hint: it is one of the letters in the word 'exit' \"\n\tanswer = gets.chomp.downcase\n\treturn answer\nend", "def get_user_choice\n # Show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Dividation\"\n puts \"(**) - Exponent\"\n puts \"(r) - squareRoots\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp # Implicit return\n end", "def get_user_choice\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Division\"\n # puts \"(**) - Exponent\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp #implicit return\nend", "def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end", "def exit?\n type == :exit\n end", "def quit_check(input)\n return true if input.empty?\n return false if input[0].casecmp('QUIT').zero?\n true\n end", "def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end", "def menu\n puts '|____________________________________________________________|'\n puts '| |'\n puts '| -- M E N U : |'\n puts '| |'\n puts \"| * Show : 's' |\"\n puts \"| * Quit : 'q' |\"\n puts '|____________________________________________________________|'\n\n input = ''\n loop do\n puts ''\n input = ask ' >> '\n puts ''\n if ['q', 's'].include? input\n break\n else\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Invalid input, please try again... |'\n puts '|____________________________________________________________|'\n end\n end\n input\nend", "def ask_user_start\r\n quit_status = false\r\n until quit_status != false\r\n answer = @@prompt.select(\"What would you like to do?\", %w(calculator instructions quit))\r\n if answer == \"calculator\"\r\n system(\"clear\")\r\n ask_for_digits\r\n elsif answer == \"instructions\"\r\n system(\"clear\")\r\n instructions\r\n else answer == \"quit\"\r\n puts \"Stay well. Come back next time you are stuck on a number!\"\r\n quit_status = true\r\n exit\r\n end\r\n end\r\n end", "def menu\n\tputs \"Please select your calculator.\"\n\tputs \"1. Basic calculator\"\n\tputs \"2. Advanced calculator\"\n puts \"3. BMI calculator\"\n puts \"4. Mortgage calculator\"\n puts \"Q. Quit\"\n\t\n\tchoice = gets.chomp.to_i\n\t\n\tcase choice\n when 0\n quit\n when 1\n\t\tbasic_calculator\n\twhen 2\n\t\tadvanced_calculator\n when 3\n bmi_calc\n when 4\n mortgage_calc\n when 5\n puts \"Please make a valid selection\"\n choice = gets.chomp.to_i\n\n end\nend", "def main\n # determine whether to use verbose outpuut\n verbose = false\n if ARGV[0] != nil and ARGV[0].downcase == \"-v\"\n verbose = true\n end\n\n # get input\n puts \"Instructions: enter a mathematical expression using +, -, *, /, **, or (q)uit\"\n puts \"Calculator follows order of operations\"\n puts \"All elements must be separated by spaces\"\n puts \"e.g. ( 4 + 5 ) * 6\"\n print \"Enter an expression: \"\n expr = STDIN.gets.strip\n\n # continue calculating expressions until user quits\n until expr.downcase.start_with?(\"q\")\n # send to calc() and print result\n result = calc(expr, verbose)\n\n if result == nil\n puts \"Please enter a valid expression\"\n puts \"Common error: all elements should be separated by spaces\"\n elsif result % 1 == 0 # print int if result is integer\n puts result.to_i\n else\n puts result\n end\n\n print \"enter another expression, or (q)uit: \"\n expr = STDIN.gets.strip\n end\nend", "def exit_check\n if @students.count > @saved\n puts \"Students added since last save, are you sure you want to quit? (y/n)\"\n input = STDIN.gets.chomp\n while true\n if input == \"Y\" || input == \"y\" \n exit\n elsif input == \"N\" || input == \"n\"\n return\n else\n end\n end\n else\n exit\n end\nend", "def exit_checker(arg)\n if arg == \"exit\"\n puts \"Goodbye!\"\n return exit\n end\n end", "def play_again_Q\n\tputs \"\\nDo you want to play again? (Y/N)\"\n\tchoice = gets.strip\n\tconfirm_YN(choice)\nend", "def validate_user_choice\n input = gets.chomp\n if input ==\"exit\"\n exit_screen\n elsif input == \"buy\"\n ticketing_screen\n elsif input.to_i == 1\n concert_screen\n elsif input.to_i == 2\n # if user doesn't want to buy a ticket yet, they can look for other upcoming bands and/or concerts by typing bands.\n bands_screen\n else\n unrecognized_input\n end\n end", "def exit_prg \n puts \"Your brain must hurt from learning all of that information!\"\n exit \n end", "def quit?\n @quit\n end", "def menu\n puts \"Which operation would you like to do?\"\n puts \"a - addition\"\n puts \"b - subtraction\"\n puts \"c - multiplication\"\n puts \"d - division\"\n puts \"e - exponents\"\n puts \"f - square roots\"\n puts \"g - mortgage calculator\"\n puts \"h - bmi calculator\"\n puts \"i - trip calculator\"\n puts \"q - quit\"\n\n print \"Enter your choice: \"\n gets.chomp\nend", "def prompt_and_handle_exit(message)\n puts message\n user_input = gets.strip\n \n if user_input.downcase == \"exit\" \n puts \"\\nThanks for stopping by!\\n\".colorize(:color => :green) \n exit\n end \n user_input\n end", "def get_user_choice\n # show the user the available options\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Division\"\n puts \"(x) - Exponent\"\n puts \"(r) - Root\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp #implicit return\nend", "def another_calculation?\n answer = ' '\n loop do\n prompt(MESSAGES['another_loan'])\n answer = Kernel.gets().chomp().downcase()\n if YES_ANSWERS.include?(answer)\n answer = 1\n break\n elsif NO_ANSWERS.include?(answer)\n answer = 2\n break\n else\n prompt(MESSAGES['exit_error'])\n end\n end\n answer\nend", "def recipe_ask_for_options\n puts \"\"\n puts \"What would you like to do?\".colorize(:yellow)\n puts \"\\n- [1] Save recipe\\n- [2] See Conversion tool\\n- [3] Back to main menu\".colorize(:yellow)\n user_input = gets.chomp\n if @answers[1][1].include?(user_input)\n @recipe.save_recipe\n self.save_menu_options\n elsif @answers[1][2].include?(user_input)\n self.start_convert\n elsif @answers[1][3].include?(user_input)\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts \"Thats wasn't a valid input, type 1 to start program, type 2 to navigate to the conversion feature and type 3 to see help.\".colorize(:red)\n end\n end", "def menu\n puts \"(a) - addition\" #makes a new line\n puts \"(s) - subtraction\" #makes a new line\n puts \"(q) - quitting\" #makes a new line\n puts \"(m) - multiplication\"\n puts \"(d) - division\"\n puts \"(e) - exponent\"\n puts \"(r) - square_roots\"\n puts \"(mc) - Mortgage_Calculator\"\n puts \"(b) - BMI_Calculator\"\n puts \"(t) - trip_calculator\"\n\n print \"Enter your choice: \" #will allow the user to type next to it\n gets.chomp() #ask the user for an input, and we implictly return that\nend", "def menu_exit\n puts \"\\nPlease type 'Menu' to navigate to the menu, or 'Exit' to exit\"\n puts\"\\n-------------------------------------------------------------------------------------------\"\n input = gets.strip.downcase\n if input == \"menu\"\n menu_items\n elsif input == \"exit\"\n exit_statement\n else\n puts \"\\nDid you mean to type 'menu' or 'exit'?\" # Or do they want to re enter info(next iteration)\n menu_exit\n end\nend", "def run_calculator\n\n while calculate != \"exit\"\n calculate\n\n end\n\nend", "def get_user_choice\n #show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Substraction\"\n puts \"(/) - Division\"\n puts \"(*) - Multiple\"\n puts \"(**) - Exponents\"\n puts \"(sr) - Square Root\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp\nend", "def quit\n system('clear')\n exit\n end", "def continue?\n puts \"Do you want to calculate again? [Y/N]\"\n print '> '\n response = gets.chomp.upcase\n response == 'Y'\nend", "def do_you_want_to_continue\r\n # Checking if the user wants to continue with Part 2 & 3 of the script, and collecting an input from them\r\n puts \"Do you want to see Parts 2 & 3? (y/n)\"\r\n answer = gets.chomp\r\n # Providing a case that only excepts either \"yes\" or \"y\" to continue, or \"no\" or \"n\" to exit.\r\n case answer\r\n # Instantiating the case that if the user inputs \"yes\" or \"y\" the loop ends and the script continues to Parts 2 & 3.\r\n when \"yes\", \"y\"\r\n # Instantiating the case that if the user inputs \"no\" or \"n\" the terminal session is ended\r\n when \"no\", \"n\"\r\n exit\r\n # Here I placed an else component to the case the user passed an invalid input. I clear the terminal and call the method again, making it look as though\r\n # they have no choice but to put a valid input to continue\r\n else\r\n puts `clear`\r\n do_you_want_to_continue\r\n end\r\nend", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n option_3 = gets.chomp.downcase\n\n if option_3 == \"p\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter an exponent: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ** #{number_2} = #{number_1 ** number_2}\"\n elsif option_3 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n puts \"The square root of #{number_1} is #{Math.sqrt(number_1)}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend", "def continue\n puts \"Do you wish to add more? Y/N\".center(70)\n result = STDIN.gets.chomp.downcase\n if result == \"n\"\n return false\n end\nend", "def are_you_sure? # Define a method. Note question mark!\n while true # Loop until we explicitly return\n print \"Are you sure? [y/n]: \" # Ask the user a question\n response = gets # Get her answer\n case response # Begin case conditional\n when /^[yY]/ # If response begins with y or Y\n return true # Return true from the method\n when /^[nN]/, /^$/ # If response begins with n,N or is empty\n return false # Return false\n end\n end\nend", "def main_menu\n\tputs \"welcome to the magic 8 ball.\"\n\tputs \"To begin type PLAY; if you would like to exit type QUIT.\"\n\t\n\t\n\tanswer = gets.strip.downcase\n\n\tif answer == \"play\"\n\t\teight_ball\n\telse\n\t\texit\n\tend\nend", "def quit(player, input)\n \t\tunless input =~ /quit/i\n \t\t\tprint_line \"You must type the entire word 'quit' to quit.\\n\"\n \t \telse\n \t\t\tprint_line \"Until next time...\"\n \t\t\t$win.refresh\n \t\t\tsleep 3\n \t\t\t$win.close\n \t\t\texit\n \t\tend\n\tend", "def menu\n puts \"(a) - addition\"\n puts \"(s) - subtraction\"\n puts \"(m) - multiplication\"\n puts \"(d) - division\"\n puts \"(e) - exponents\" # makes a new line\n puts \"(sq) - squareroot\"\n puts \"(q) - quitting\" # makes a new line\n print \"Enter your choice: \" # allows user to type next to it\n gets.chomp() # ask user for input and we implicitly return that.\nend", "def check_ending(mark)\n return unless @game.result\n print_result\n key = @window.getch\n case key\n when ?Y,?y\n start_new_game(mark)\n when ?N,?n\n Kernel::exit\n else\n check_ending(mark)\n end\n @display.clear_status \n end", "def exit\n\t\tquit\n\tend", "def command_quit\n command_save\n exit(0)\n end", "def menu\n puts \"(a) - addition \"\n puts \"(s) - subtraction \"\n puts \"(m) - multiplication \"\n puts \"(d) - division \"\n puts \"(sq) - square root \"\n puts \"(pow) - power of \"\n puts \"(q) - quitting \" #puts is next line input\n print \"Enter your choice: \" #print is same line input\n gets.chomp()\nend", "def menu\n puts \"I am a Calculator, there are many like me but these calculations are mine\"\n puts \"What do you want to do? \"\n puts \"- Add\"\n puts \"- Subtract\"\n puts \"- Multiply\"\n puts \"- Divide\"\n puts \"- More advanced\"\n puts \"- Crazy Stuff\"\n puts \"- Quit\"\n print \"> \"\n $selection = gets.chomp.downcase\n\ncase $selection\nwhen \"more advanced\"\n advanced_calc\nwhen \"crazy stuff\"\n crazy_stuff\nwhen \"quit\"\n \"q\"\nelse\n basic_calc\nend\n\nend", "def exit?\n @exit\n end", "def menu\n\n puts \"(a) - addition\"\n puts \"(s) - subtraction\"\n puts \"(m) - multiplication\"\n puts \"(d) - division\"\n puts \"(e) - exponent\"\n puts \"(r) - square root\"\n puts \"(q) - quitting\"\n puts \"(mo) - Mortage\"\n puts \"(b) - BMI\"\n puts \"(t) - Trip\"\n\n print \"Enter your choice. \"\n gets().chomp()\n\nend", "def checkpoint\n ask_user_for_input\n user_input = gets.chomp.downcase\n center_focus_simulation if user_input == 'c'\n user_choice_simulation if user_input == 't'\n instructions if user_input == 'i'\n return if user_input == 'q'\n end", "def get_menu_or_exit\n puts \"\\n\n There you go! Interesting, amirite?\\n\n Enter 'main' to return to the main menu,\\n\n or if you're done here enter 'exit':\"\n valid_response = false\n until valid_response == true\n user_input = gets.chomp\n if user_input == 'exit'\n valid_response = true\n elsif user_input == 'menu'\n valid_response = true\n else\n puts \"\\n\n Invalid input. Please enter 'main' or 'quit' below:\"\n end\n end\n user_input\n end", "def menu\n\tputs \"Please enter the first letter of the operation you would like to carry out: \\n (A)ddition \\n (S)ubtraction \\n (M)ultiplication \\n (D)ivision \\n (P)ower \\n (S)quare root \\n (Q)uit\"\nend", "def determine_operators\n #prompt the user for a selection\n print \"Please select (B)asic or (A)dvanced calculator operations:\"\n #store the selection\n calc_operations = gets.chomp.downcase\n #determine which operators to display and call their associated methods\n if calc_operations == 'b'\n display_basic_operators\n elsif calc_operations == 'a'\n display_advanced_operators\n else\n puts \"Please only select (B)asic or (A)dvanced calculator operations:\"\n end\nend", "def menu\nputs \"Select calculation option:\\n\"\nputs \"Option 1 - add, Option 2 - subtract, Option 3 - multiply, Option 4 - divide, Option 5 - exponent, Option 6 - square root\"\n\n option = gets.to_i\n\n if option == 1\n return \"add\"\n elsif option == 2\n return \"subtract\"\n elsif option == 3\n return \"multiply\"\n elsif option == 4\n return \"divide\"\n elsif option == 5\n return \"exponent\"\n\n elsif option == 6\n puts \"For square root calculation, enter one number\"\n return \"square\"\n \n end\nend", "def calculator\n\tputs \"Hello and welcome to the calculator. If you do not want to use this application, type exit and click the return key\"\n\tputs \"Would you like to add, subtract, multiply, divide, or use exponents?\"\n\tanswer = gets.chomp\n\tif answer == \"multiply\"\n\t\tmultiplication\n\telsif answer == \"add\"\n\t\taddition\n\telsif answer == \"divide\"\n\t\tdivision\n\telsif answer == \"subtract\"\n\t\tsubtraction\n\telsif answer == \"exponents\"\n\t\texponents\n\telse\n\t\tputs \"I am sorry, that is not a computation. Try re-wording what you said and try again.\"\n\tend\nend", "def display_calculator\n puts \"----Calculator----\"\n puts \"Please select from the following Calculators. type 'B' for basic, 'A' for advanced and 'M for BMI' alternatively type 'quit' to exit? \"\n type_of_calc = gets.chomp()\n if (type_of_calc == \"B\")\n basic_calc\n elsif (type_of_calc == \"A\")\n advanced_calc\n elsif (type_of_calc == \"M\")\n bmi_calc\n end\nend", "def menu\n puts \"(a) - addition\" #makes new line\n puts \"(s) - subtract\"\n puts \"(m) - multiple\"\n puts \"(d) - divide\"\n puts \"(q) - quitting\"\n puts \"(sqrt) - square\"\n puts \"(ex) - exponents\"\n print \"enter your choice\" # will allow the user to type next to it\n gets.chomp() # ask the user for an input, and implicity return that\n\nend", "def prompt_function\n puts \"Add, subtract, multiply, divide?\"\n return gets.chomp.downcase #returns answer to above Q for: def prompt\nend", "def menu\n puts \"Welcome to the calculator, please choose from the following options:\n B : Basic Calculator\n A : Advanced Calculator\n Q : Quit\"\n\n menu_response = gets.chomp.downcase\n\nend", "def enter_q\n medium_rainbow_typer 'Press Enter to continue or q to quit'\n br\n running = true\n while running\n input = STDIN.getch\n case input\n when \"\\r\"\n running = false\n return true\n when 'q'\n running = false\n return false\n else\n next\n end\n end\n end", "def do_math(num1, num2)\n prompt_string = PROMPT + \" 1)add 2)subtract 3)multiply 4)divide\"\n puts prompt_string\n action = gets.chomp\n \n # boolean flag to determine if we need to continue\n # in the loop or drop out. false continues\n done = false\n \n # loop until the user performs a valid action or enters 'q' to quit\n # provides Infinity or -Infinity as appropriate for division by zero\n begin\n case action\n when '1'\n puts PROMPT + \"#{num1} added to #{num2} = \" + (num1 + num2).to_s\n done = true\n when '2'\n puts PROMPT + \"#{num1} minus #{num2} = \" + (num1 - num2).to_s\n done = true\n when '3'\n puts PROMPT + \"#{num1} times #{num2} = \" + (num1 * num2).to_s\n done = true \n when '4' #watch out for divide by zero\n if( (num2 == 0 || num2 == 0.0) && num1 >= 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = Infinity\"\n elsif( (num2 == 0 || num2 == 0.0) && num1 < 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = -Infinity\"\n elsif( (num1%num2) != 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2.to_f).to_s\n else\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2).to_s\n end\n done = true\n when 'q'\n puts PROMPT + \" Bye.\"\n exit\n else\n puts PROMPT + \"Invalid operation selected. Please try again or [q] to quit\"\n puts prompt_string\n action = gets.chomp\n end\n end while done == false\nend", "def initial_prompt\n puts \"How would you like to explore?\"\n puts \"---------------------------------\"\n puts \"\"\n puts \"1) Search by Year\"\n puts \"2) Search by production title\"\n puts \"\\n\\t ** or type Exit **\"\n input = gets.strip.downcase\n case input\n when \"exit\"\n goodbye\n when \"1\"\n year_search\n when \"2\"\n production_search\n else \n unclear\n end\n end", "def input_operator()\n\twhile true\n\t\tputs \"What do you want to do?\"\n\t\tputs \"+ -> add\"\n\t\tputs \"- -> subtract\"\n\t\tputs \"* -> multiply\"\n\t\tputs \"/ -> divide\"\n\t\t\n\t\top = gets.strip\n\t\tcase op\n\t\twhen \"+\"\n\t\t\treturn \"+\"\n\t\twhen \"-\"\n\t\t\treturn \"-\"\n\t\twhen \"/\"\n\t\t\treturn \"/\"\n\t\twhen \"*\"\n\t\t\treturn \"*\"\n\t\telse\n\t\t\tputs \"Please enter only + - * or /\"\n\t\tend\n\tend\nend", "def quit\n exit(1)\n end", "def raw_input(msg)\n puts msg\n print \">> \"\n input = gets.chomp\n if input.downcase == \"q\"\n return input, true\n else\n return input, false\n end\nend", "def exit\n sleep(2)\n puts \"Enter 'back' to see the full list of anime again, or enter 'exit' to quit :) \"\n puts \"\"\n input = gets.strip\n case input\n when \"back\"\n self.list_all_titles\n when \"exit\"\n puts \"\"\n puts \" Thank you for checking out this year's newest anime!!\"\n puts \"\"\n puts \" Source: Myanimelist.com\"\n puts \"\"\n else\n puts \"Invalid entry, please try again :) \"\n self.exit\n end\n end", "def menu #here the method is defined. it doesnt require any parameters because it asks the user for information\n puts \"\" #This is just an empty line\n puts \"(a) is addition\"\n puts \"(b) is subtraction\"\n puts \"(c) is multiplication\"\n puts \"(d) is division\"\n puts \"(e) is for exponents\"\n puts \"(q) is for quit\"\n print \"Enter your choice: \"\n gets.chomp() #Whateever we type is saved as this gets.chomp() statements. Note: this is the same as saying return.gets.chomp but we don't need it because the final line in a method is automatically returned\nend" ]
[ "0.764285", "0.72208023", "0.709679", "0.70717436", "0.68572444", "0.6807866", "0.6711127", "0.6701642", "0.6690668", "0.66805744", "0.6675273", "0.6673463", "0.6670867", "0.6656492", "0.66519773", "0.66414565", "0.6613275", "0.6612734", "0.66043913", "0.65856063", "0.6581397", "0.6547192", "0.6537872", "0.6537427", "0.6482253", "0.6480256", "0.6455931", "0.64439034", "0.6417424", "0.6415641", "0.64111614", "0.64069784", "0.6395825", "0.6387194", "0.63661313", "0.63444376", "0.63299143", "0.63264173", "0.6320362", "0.63059056", "0.62951964", "0.62921846", "0.62810135", "0.6277596", "0.6275089", "0.6274122", "0.6245513", "0.62417775", "0.623671", "0.6221213", "0.62203044", "0.6218107", "0.62138474", "0.6213369", "0.6212532", "0.6208864", "0.6206718", "0.6202253", "0.6190302", "0.61878204", "0.61807007", "0.61780196", "0.6167506", "0.6163625", "0.6145806", "0.61456364", "0.61436516", "0.61419225", "0.61417234", "0.6137924", "0.61325896", "0.61274004", "0.6126935", "0.6121302", "0.6119913", "0.61107993", "0.61105156", "0.61079335", "0.6102999", "0.60990125", "0.60932386", "0.60860914", "0.6082001", "0.6080603", "0.6079791", "0.6077119", "0.6064911", "0.6058221", "0.60577023", "0.60478014", "0.60450554", "0.60369223", "0.60219914", "0.602148", "0.60164124", "0.6014977", "0.60134107", "0.6008974", "0.60052514", "0.6001566" ]
0.74919397
1
Check if the given string 'num' is a number. Adapted from
def numeric?(num) !!Float(num) rescue false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_num(str)\n\treturn true if str =~ /^\\d+$/\n true if Int(str) rescue false\nend", "def is_number?(str)\n true if Float(str) rescue false\n end", "def is_a_number?(str)\n str.match(/\\d/)\nend", "def is_number?(string)\n true if Integer(string) && Integer(string) >= 0 rescue false\n end", "def is_number(str)\n str.to_f.to_s == str.to_s || str.to_i.to_s == str.to_s\n end", "def isNum?(num)\n /[0-9]/.match(num.to_s) != nil\nend", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number?(str)\n return str == str.to_f.to_s || str == str.to_i.to_s\nend", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_num?(num)\n !!Integer(num)\n rescue ArgumentError, TypeError\n false\n end", "def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend", "def is_a_number?(s)\n \ts.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n\tend", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_numeric(str)\n true if Integer(str) rescue false\nend", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def is_numeric(num)\n\n if num.to_f.to_s == num || num.to_i.to_s == num\n return true\n else\n return false\n end\n\nend", "def is_number? (num)\n \tnum.to_f.to_s == num.to_s || num.to_i.to_s == num.to_s\nend", "def is_a_number?(word)\n Integer(word) rescue false\nend", "def number?(str)\n !!Integer(str)\nrescue ArgumentError, TypeError\n false\nend", "def valid_number?(num)\n num.to_s unless num.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match num\nend", "def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend", "def number?(string)\n string.to_i.to_s == string\n end", "def is_number(input)\n input.to_s == input.to_i.to_s\nend", "def is_number? expr\n return false if expr.nil?\n expr = \"#{expr}\" # we need this condition in case the expr is a number\n expr.match /^(\\d+|\\d+\\.\\d+)$/ # since match() is defined only for strings\nend", "def ValidNumber? (string)\t\t\t\t\t\t\t\t\n\t### Check if a non-numeric character ever appears in the string using /\\D/\n\t### If so, we know it's not a 'NUMBER' as defined\n\t### Also check if string is empty\n\treturn ( not(/\\D/ =~ string) && not(string.length.zero?) ), string.to_i\nend", "def isNum(c)\r\n\tInteger(c) rescue return false\r\n\treturn true\r\nend", "def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend", "def contains_number (str)\n\n\treturn str =~ /\\d/\n\nend", "def is_number?(input)\n true if Float(input) rescue false\n end", "def is_num?(input_value)\n (input_value =~ /^-?[0-9]+$/) == 0 ? true : false\nend", "def is_number? string\n true if Float(string) rescue false\nend", "def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend", "def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end", "def is_numeric?\n self.match(/^[0-9]+$/)\n end", "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(num)\n /^\\d+$/.match(num) \n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def is_number? token\n Float(token) && true rescue false\n end", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def can_be_number(string)\n forced_as_f = string.to_f # force string to be a float\n forced_as_i = string.to_i # force string to be an integer\n return string == forced_as_f.to_s || string == forced_as_i.to_s # see if either of the forced strings equal the original\nend", "def not_a_number?(n)\n \tn.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? true : false\n end", "def numeric?(character)\n (character =~ /[0-9]/) == 0\n end", "def valid_number?(num)\n if num.to_i.to_s == num\n num.to_i\n elsif num.to_f.to_s == num\n num.to_f\n else\n false\n end\nend", "def number?\n !!strip.match(/^-?\\d\\.?\\d*$/)\n end", "def is_numeric(s)\n begin\n Integer(s)\n rescue\n puts \"please enter a number\" \n end\nend", "def is_number?(tok)\n #check number format: correct types of digits\n if tok[0] == 36 # $\n return nil if( (tok.sub(\"$\",\"\") =~ /[^A-Fa-f0-9]/) != nil)\n elsif tok[0] == 67 # C\n return nil if ( (tok.sub(\"C\",\"\") =~ /[^0-7]/) != nil)\n elsif tok[0] == 66 # B\n return nil if ( (tok.sub(\"B\",\"\") =~ /[^01]/) != nil) \n elsif tok[0] >= 48 and tok[0] <= 57\n return nil if ( (tok =~ /[^0-9]/) != nil) \n else\n #can raise exceptions here:\n return nil\n end\n \n return get_number_system(tok)\n end", "def is_numeric(str)\n Float(str) != nil rescue false\n end", "def check_number(num)\n if num.include?('.')\n num.to_f.to_s == num\n else\n num.to_i.to_s == num\n end\nend", "def is_number?(obj)\n obj.to_s == obj.to_i.to_s\n end", "def is_number(num)\n true if Float(num) rescue false\nend", "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend", "def is_numeric?(i)\n # check if i is a number\n i.to_i.to_s == i || i.to_f.to_s == i\n end", "def is_number(input)\n \t\tinput.to_f == input\n\tend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def valid_num?(number)\n number == number.to_i.to_s\nend", "def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend", "def valid_number?(num)\n num.to_i.to_s == num\nend", "def numfix(num)\n if num =~ /^\\d+$/\n return num.to_i\n elsif num.is_a?(Integer)\n return num\n else\n return false\n end\n end", "def numfix(num)\n if num =~ /^\\d+$/\n return num.to_i\n elsif num.is_a?(Integer)\n return num\n else\n return false\n end\n end", "def isNumeric(s)\n\t\tbegin\n\t\t\tFloat(s)\n\t\trescue\n\t\t\tfalse # not numeric\n\t\telse\n\t\t\ttrue # numeric\n\t\tend\n\tend", "def checkifnumber?(obj)\n obj = obj.to_s unless obj.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match obj\nend", "def is_numeric?(obj)\n if /[^0-9]/.match(obj) != nil\n return true\n end\n false\nend", "def value_is_integer?(string)\n return string.strip.numeric?\n end", "def validnum?(num)\n num == num.to_i.to_s\nend", "def is_numeric?\n for c in self.gsub('.', '').gsub('-', '').scan(/./)\n return false unless (0..9).to_a.map { |n| n.to_s }.include?(c)\n end\n return true\n end", "def check_num(x)\n (sum(x.to_s.split(//).map {|e| e.to_i }) == @num) ? true : false\n end", "def numeric?(numberInput)\n numberInput = numberInput.to_s\n if numberInput =~ /^[-+]?[0-9]*\\.?[0-9]+$/\n \n return true\n else\n return false\n end\nend" ]
[ "0.87244636", "0.81180733", "0.81120074", "0.80896354", "0.8079099", "0.8070914", "0.8004416", "0.8004416", "0.798755", "0.798755", "0.7983043", "0.7974296", "0.79679656", "0.7945104", "0.79128224", "0.7909083", "0.78987736", "0.78987736", "0.78788704", "0.7857445", "0.78499484", "0.7848653", "0.7828206", "0.7796072", "0.7776028", "0.7764602", "0.77505463", "0.7721478", "0.7717441", "0.77171785", "0.77143306", "0.7704", "0.76905274", "0.7664428", "0.76550543", "0.76395017", "0.76348126", "0.76341623", "0.76307815", "0.76196134", "0.7612749", "0.75850844", "0.7569458", "0.75529677", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7549182", "0.7545796", "0.75424075", "0.7542405", "0.75266063", "0.7519627", "0.75189453", "0.75003076", "0.75003076", "0.74970794", "0.74896884", "0.7475229", "0.7456127", "0.7446501", "0.74448436", "0.7424314", "0.7413467", "0.7411053", "0.7397066", "0.7395971", "0.7393951", "0.73807424", "0.73711336", "0.7368319", "0.7364046", "0.73555076", "0.7351137", "0.7337963", "0.73327047", "0.73327047", "0.73263764", "0.7326012", "0.73093164", "0.7294224", "0.72888136", "0.7285058", "0.72833824", "0.7264518" ]
0.0
-1
Used to check the user input. Valid input is either "Q" or a number
def get_valid_input(input_type, options = {}) input = nil loop do input = gets.chomp # binding.pry if options.has_key?(:result) && input == "" input = options[:result] break else if input_type == "num" numeric?(input) || input.upcase == 'Q' ? break : say("Numbers only") else %w(1 2 3 4 Q).include?(input.upcase) ? break : say("1, 2, 3, or 4 only") end end end input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_input(msg)\n puts msg\n print \">> \"\n input = gets.chomp\n if input.downcase == \"q\"\n return input, true\n else\n return input, false\n end\nend", "def is_valid_input(input)\n if input == \"rock\" || input == \"paper\" || input == \"scissors\" || input == \"lizard\" || input == \"spock\"\n return true\n else \n return false \n end\n end", "def check_answer_input(range) #this method both prints and checks the answer\r\n\r\n\tequation = new_equation(range)\r\n\tanswer = false\r\n\r\n\twhile answer == false\r\n\t\tputs equation\r\n\t\tresult = eval equation\r\n\t\tputs \"{answer: #{result}}\"\r\n\t\tanswer_user = gets.chomp\r\n\r\n\t\tif answer_user.downcase == \"q\" #make a new method for if ??? - yes, I would make a new method\r\n\t\t\texit\r\n\t\telsif answer_user.to_i == result\r\n\t\t\tputs \"Correct!\"\r\n\t\t\tcheck_answer_input(range)\r\n\t\telse\r\n\t\t\tputs \"Try again\"\r\n\t\tend\r\n\tend\r\nend", "def general_q(question)\n p question\n gets.chomp\nend", "def validate_band_number_input\n input = gets.chomp\n if input.to_i > Band.count\n unrecognized_input\n elsif input.to_i < 0\n unrecognized_input\n elsif input.to_i > 0\n individual_bands_screen(input)\n elsif input == \"exit\"\n exit_screen\n else\n unrecognized_input\n end\n end", "def get_user_input(question, range = nil)\n print \"\\n#{question} : \"\n user_response = gets.chomp\n\n if range === nil then\n # check whether the user input is empty\n while user_response.empty? do\n print \"\\nError! You entered a wrong input!\" +\n \"\\n#{question} : \"\n user_response = gets.chomp\n end\n else\n # check whether the user input is an integer and also it is within the given range\n unless user_response.to_i.is_a?(Integer) && user_response.to_i.between?(0, range - 1)\n print \"\\nError! You entered a wrong input!\" +\n \"\\n#{question} : \"\n user_response = gets.chomp\n end\n end\n\n user_response\n end", "def validate_user_choice\n input = gets.chomp\n if input ==\"exit\"\n exit_screen\n elsif input == \"buy\"\n ticketing_screen\n elsif input.to_i == 1\n concert_screen\n elsif input.to_i == 2\n # if user doesn't want to buy a ticket yet, they can look for other upcoming bands and/or concerts by typing bands.\n bands_screen\n else\n unrecognized_input\n end\n end", "def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end", "def get_valid_number(cont)\n loop do\n puts \"Enter number or q:\"\n val = gets.chomp()\n if (val == \"q\") \n cont << val\n break\n end\n if is_num?(val)\n return val.to_f\n else\n puts \"Input was not numerical.\"\n end\n end\nend", "def query_quantity\n puts \"Quantity? Enter to keep unchanged at #{@amount}\"\n r = gets.strip\n if r != \"\" && r.to_i != 0\n @amount = r.to_i\n end\n end", "def q(question,answer)\n puts \"\"\n puts question\n print \"Type: \"\n gets.chomp()\n puts \"Answer: #{answer}\"\nend", "def ask_question(question, kind=\"String\")\n print question + \" \"\n answer = gets.chomp\n answer.to_i if kind == \"number\"\n return answer\nend", "def disp_q(question, q_A, q_B, q_C, q_D, answer)\r\n \r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Format the display of the quiz question\r\n puts question + \"\\n\\n\"\r\n puts q_A\r\n puts q_B\r\n puts q_C\r\n puts q_D\r\n print \"\\nType the letter representing your answer: \"\r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line marker\r\n \r\n #Analyze the player's input to determine if it is correct\r\n if answer == reply then\r\n \r\n #Keep track of the number of correctly answered questions\r\n $noRight += 1 \r\n \r\n end\r\n \r\n #Analyze the answer to determine if it was valid\r\n if reply == \"a\" or reply == \"b\" or reply == \"c\" or reply == \"d\" then\r\n \r\n break #Terminate the execution of the loop\r\n \r\n end\r\n \r\n end\r\n \r\n end", "def disp_q(question, q_A, q_B, q_C, q_D, answer)\r\n\r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Format the display of the quiz question\r\n puts question + \"\\n\\n\"\r\n puts q_A\r\n puts q_B\r\n puts q_C\r\n puts q_D\r\n print \"\\nType the letter representing your answer: \"\r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line marker\r\n \r\n #Analyze the player's input to determine if it is correct\r\n if answer == reply then\r\n \r\n #Keep track of the number of correctly answered questions\r\n $noRight += 1 \r\n \r\n end\r\n \r\n #Analyze the answer to determine if it was valid\r\n if reply == \"a\" or reply == \"b\" or reply == \"c\" or reply == \"d\" then\r\n \r\n break #Terminate the execution of the loop\r\n \r\n end\r\n \r\n end\r\n\r\n end", "def q1_get_num\n puts \"Enter a number please: \"\n gets.to_i\nend", "def ask_user\n puts 'enter a number:'\n input = gets.chomp.to_i\n check_num(input)\n end", "def validate_selection(input)\n print \"#{input} is not a valid choice, re-enter the number or ID > \"\n return gets.strip\nend", "def getinput(question, default = '')\n askuser = question + \" ('q' to quit)\"\n askuser << (!default.empty? ? \" [#{default}]: \" : \": \")\n puts askuser\n myui = gets.chomp\n if myui.casecmp('q').zero? then\n puts \"Okay, g'bye!\"\n exit\n end\n return myui\nend", "def print_question(num)\n puts \"=> Please enter the #{num} number:\"\nend", "def valid?(input, type)\n if type == :play\n !(input !~ /[RPSrps]/) && input.length == 1\n elsif type == :again\n !(input !~ /[YNyn]/)\n end\nend", "def exit?(ans)\n ans.upcase == 'Q'\nend", "def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend", "def validate_input\n\t\tif @options[:num].is_a?(Integer) and @options[:num] >= 0 \n\t\t\t@num = @options[:num].to_i.abs \n\n\t\telse\n\t\t\t@num = \"NAN\"\n\n\t\tend\n\tend", "def validate_input\n puts \"Enter move >\"\n player_input = gets.chomp\n if player_input == \"q\"\n exit_game\n return\n end\n \n #Check for valid input\n player_input = player_input.gsub(/[^1-3]/, '') #Strip all but digits 1-3\n # puts player_input # testing\n\n player_input = player_input.split(\"\") # Converts input to array.\n\n if player_input.length != 2 # Looking for only two digit answers\n puts \"Please enter in the format '[1,3]'\"\n return false #Signals invalid input\n elsif player_input[0] == player_input[1]\n puts \"You can't move a piece to the same spot.\"\n else\n return player_input\n end\n end", "def asks_question(question)\n puts question\n gets.chomp\nend", "def main_menu_check\n input = user_input\n until input == 'p'\n if input == 'q'\n exit!\n end\n puts \"Wrong input, enter p to play or q to quit\"\n input = user_input\n end\n end", "def r_p_s\n puts \"Choose 'R'ock, 'P'aper, or 'S'cissors\\n\\n\"\n plyr = gets.strip.upcase.to_s\n puts plyr\n\n\n if (plyr == \"R\" || plyr == \"P\" || plyr == \"S\")\n\n\n puts \"Thanks\\n\"\n else\n puts \"Invalid! Try again.\\n\"\n\n end\nend", "def valid_input? (input)\n #if statement verifies valid input to continue\n if input == \"amex\"\n @selected_program = AMEX\n return true\n\n elsif input == \"chase\"\n @selected_program = CHASE\n return true\n\n elsif input == \"citi\"\n @selected_program = CITI\n return true\n end #ends if/else statement\n\n end", "def valid_input_type?\n case @search_type\n when \"Pokemon Name\", \"Type\"\n !@search_menu_input.match?(/\\d/) \n when \"Pokedex Number\"\n !@search_menu_input.match?(/\\D/)\n end\n end", "def get_user_input\n user_input_valid gets.chomp\n end", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def menu\n puts '|____________________________________________________________|'\n puts '| |'\n puts '| -- M E N U : |'\n puts '| |'\n puts \"| * Show : 's' |\"\n puts \"| * Quit : 'q' |\"\n puts '|____________________________________________________________|'\n\n input = ''\n loop do\n puts ''\n input = ask ' >> '\n puts ''\n if ['q', 's'].include? input\n break\n else\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Invalid input, please try again... |'\n puts '|____________________________________________________________|'\n end\n end\n input\nend", "def isValidInput?(input_num, type)\n return true if isValid?(input_num, type)\n\n msg = \"Valid input is a letter A-#{@board.labelOptionsFor(type)}.\"\n printInvalidSelectionMessage(msg)\n\n false\n end", "def play(songs)\nputs \"Please enter a song name or number:\"\ngets.chomp\nanswer = gets.chomp\nif answer.class == String && songs.include?(answer)\nputs \"Playing #{answer}\"\nelsif (1..9).to_a.include?(answer.to_i)\n puts \"Playing #{songs[answer.to_i - 1]}\"\nelse\nputs \"Invalid input, please try again\"\nend\nend", "def valid_input(input)\n valid = false\n parsed_input = downcase_camelcase_input(input)\n while valid == false\n #accepts uppercase or lowercase Y/N\n if parsed_input == \"Y\" || parsed_input ==\"N\"\n valid = true\n else\n puts \"\\nPlease enter Y or N:\\n\"\n print \"⚡️ \"\n input = gets.chomp.strip\n parsed_input = downcase_camelcase_input(input)\n end\n end\n parsed_input\n end", "def good_set_syntax? user_input\n\t\treturn false if user_input.length != 3\n\t\t# user input must only contain integers (between 0 and hand.length-1)\n\t\treturn (user_input.all? {|i| (i.to_i.to_s == i && i.to_i <= @hand.length-1 && i.to_i >= 0 && user_input.count(i) < 2)})\n\tend", "def ask(question, a, b)\n print \"#{question} (#{a}/#{b})> \"\n r = $stdin.gets.strip\n\n 4.times do\n unless r == a or r == b\n print \"\\nPlease type '#{a}' or '#{b}': \"\n r = $stdin.gets.strip\n end\n end\n\n unless r == a or r == b\n abort EXIT_MSG\n end\n\n r\nend", "def validate_concert_number_input\n input = gets.chomp\n # if user makes an accetable concert choice, they are walked through ticket purchase options.\n if input.to_i > 0 && input.to_i < Concert.count\n input.to_i\n elsif input == \"exit\"\n exit_screen\n else\n unrecognized_input\n end\n end", "def valid_input?(input)\n input.between?(1,Anime.all.size)\n #input <= 1 && >= 10\n end", "def question\n puts \"What kind of maths would you like to do?\"\n @input = gets.chomp.downcase\nend", "def check_input_number(input_str)\n while input_str.to_i <= 0 do\n input_str = ask(\"Введи положительное число!\")\n end\n input_str.to_i\n end", "def q_a (q)\n puts \"#{q}\"\n a = gets.chomp\n end", "def pt;z.gets 'Your choice:'; end", "def validate_input(input)\n if(input < 1)\n return false\n end\n return true\n end", "def input(numeroPregunta, resp=0)\n puts \"\"\n print \"Respuesta: \"\n STDOUT.flush\n if resp == 0 then\n respuesta = gets.chomp\n else\n respuesta = resp\n puts respuesta\n end\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n comparar(numeroPregunta, respuesta)\n return true\n end", "def get_user_input_for_test\n\t\tno_of_primes = 0\n\t\tprint \"\\n \\t Enter value for the number of primes you want: \"\n\t\tno_of_primes = gets.chomp.to_i\n\t\tif no_of_primes <= 0\n\t\t\tprint \"Please enter a number( > 0 ): \"\n\t\t\tself.no_of_primes = 0\n\t\t\treturn\n\t\tend\n\t\tself.no_of_primes = no_of_primes\n\tend", "def prompt_user_song\n puts \"Please enter a song name or number:\"\nend", "def user_choice(input = nil)\n loop do\n input ||= gets.chomp.downcase\n break if %w[p i l].include?(input)\n puts \"invalid. (p)lay, (l)oad, or (i)nstructions\"\n input = nil\n end\n input\n end", "def valid_user_input?(input)\n input.length > 0\n end", "def valid_input?(input)\n if 1 <= input.to_i && input.to_i <= 9\n coordinates = get_coordinates(input)\n valid_cell?(coordinates)\n elsif input.downcase == \"quit\" || input.downcase == \"restart\"\n true\n else\n false\n end\n end", "def initialize answer; @answer = answer\n@solved = false\n# Validate input\n raise \"Answer must be between 1 and 100\" unless VALID_Numbers.include? @answer\n end", "def number_check(user_input)\n if user_input.numeric?\n return user_input\n else\n return false\n end\nend", "def new_question\n new_question = Question.new\n new_question.ask_question(name)\n #awaits user answer\n print 'Answer: '\n @choice = STDIN.gets.chomp\n #performs validation on answer\n if new_question.check_answer(@choice.to_i)\n puts \"Yes! You got it!\"\n else\n puts \"Back to the drawing board with you...\"\n wrong_answer\n end\n end", "def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end", "def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end", "def valid_input(str, type = \"string\")\r\n type.downcase!\r\n\r\n case type\r\n when \"string\"\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n while input.empty?\r\n puts(\"Nothing entered. Please try again.\")\r\n input = gets.chomp\r\n end\r\n return input\r\n when \"string-one-word\"\r\n puts(\"Invalid entry. Please try again\")\r\n input = gets.chomp\r\n while input.empty? || input.include?(\" \") || ((Integer(input) rescue \"invalid\") == input.to_i)\r\n if input.empty?\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n else\r\n puts(\"Entered more than one entry. Try again\")\r\n input = gets.chomp\r\n end\r\n end\r\n return input\r\n when \"integer-no-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer-greater-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i <= 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0 && input != \"0\"\r\n puts(\"Please enter an integer.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n else\r\n false\r\n end\r\n\r\nend", "def user_input\n input = params[:Body] || params[:Digits]\n if input.present?\n return input\n else\n return false\n end\n end", "def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend", "def user_input\n\tgets\nend", "def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend", "def validate_answer(answer)\n (answer.match(/a|b/) && answer.length == 1) || answer.match(/--quit|-q/)\n end", "def user_input(p)\n loop do\n prompt p\n var = gets.chomp\n if number?(var)\n return var\n else\n prompt 'Invalid choice. Please try again.'\n end\n end\nend", "def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end", "def verify_user_answer(user_answer)\n until user_answer == \"1\" || user_answer == \"2\" || user_answer == \"3\"\n puts \"That's not a valid answer. Please enter 1, 2, or 3\"\n user_answer = gets.chomp.to_s\n end\n return user_answer\n end", "def ask\n gets.strip\n end", "def user_number\n puts 'enter your number'\n numb1 = gets.chomp!.to_i\n if numb1 <= 50\n puts 'your number is equal to or less than 50'\n elsif numb1 == 51\n puts 'you number must be 51'\n elsif numb1 <= 100\n puts 'you number is equal to or less than 100'\n else\n 'puts you got a high number'\n end\n end", "def valid?(input)\n OPERATORS.include?(input) || numeric?(input)\n end", "def get_input(message_str)\n # print prompt with text and get initial value\n prompt_string = PROMPT + \" \" + message_str + \" or [q] to quit\"\n puts prompt_string\n input_string = gets.chomp\n input_type = nil\n input_val = nil\n\n # boolean flag to determine if we need to continue\n # in the loop or drop out. false continues\n done = false\n \n # loop until we get either a 'q' or a valid numerical value\n # in the input string. 'q' exits the entire program\n begin\n input_type, input_val = get_input_type(input_string)\n if input_type == 's' && input_val == 'q'\n puts PROMPT + \" Bye.\"\n exit\n elsif input_type == 'i' || input_type == 'f'\n return input_val\n else\n puts \"Invalid entry. Please try again or [q] to quit\"\n puts prompt_string\n input_string = gets.chomp\n end\n end while done == false\nend", "def ask_q\n @current_ans = generate_q\n end", "def get_user_input\n\t\tinput_right = false\n\t\tno_of_primes = 0\n\t\tloop do\n\t\t\tprint \"Enter the number of primes you want: \"\n\t\t\tno_of_primes = gets.chomp.to_i\n\t\t\tinput_right = (no_of_primes.to_i > 0) ? true : false\n\t\t\tif no_of_primes <= 0\n\t\t\t\tprint \"\\n Please enter a number( > 0 ) \\n\"\n\t\t\t\tself.no_of_primes = 0\n\t\t\tend\n\t\t\tbreak if input_right\n\t\tend\n self.no_of_primes = no_of_primes\n\tend", "def get_input(question)\n\t# ask question \n \t# check to make sure something has been entered:\n \tanswer = \"\"\n\twhile answer.empty?\n\t\tputs question\n\t\t#get input and remove NewLine character\n\t\tanswer = gets.delete(\"\\n\")\n\tend\n\tanswer\nend", "def get_input\n square = gets.chomp\n\n input_valid?(square) ? square : false\n end", "def prompt_function\n puts \"Add, subtract, multiply, divide?\"\n return gets.chomp.downcase #returns answer to above Q for: def prompt\nend", "def check_input(input)\n if /\\D/.match(input)\n false\n else\n true \n end\nend", "def get_input(question)\n\t# ask question \n \t# check to make sure something has been entered:\n\n \tanswer = \"\"\n \tputs answer.empty?\n\twhile answer.empty?\n\t\tputs question\n\t\t#get input and remove NewLien character\n\t\tanswer = gets.delete(\"\\n\")\n\tend\n\treturn answer\nend", "def answer_validation(name)\n puts \"\\nHello, #{name}! What would you like to do today?\\n\n [1] Check allergy score.\n [2] Check allergies based on score.\n [3] Check if allergic to.\n [4] See allergy score table\n [5] Exit\"\n answer_keys = [*1..5]\n ans = gets.chomp.to_i\n while !answer_keys.include?(ans)\n puts \"Please navigate through the options using the numbers given.\"\n ans = gets.chomp.to_i\n end\n ans\nend", "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n option_3 = gets.chomp.downcase\n\n if option_3 == \"p\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter an exponent: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ** #{number_2} = #{number_1 ** number_2}\"\n elsif option_3 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n puts \"The square root of #{number_1} is #{Math.sqrt(number_1)}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend", "def finished?\n input == 'q' || input =='quit'\n end", "def validate_question(question)\n return question.nil? || question.strip == \"\" || (!ENV[\"QUESTION_SUBSTRING_BLACKLIST\"].nil? && ENV[\"QUESTION_SUBSTRING_BLACKLIST\"].split(',').any? { |phrase| question.include?(phrase) })\nend", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end", "def user_prompt\n verify = false\n until verify == true\n\n puts \"\\n\\nWhat's your guess?\"\n guess = String(gets.chomp).downcase.delete(' ')\n verify = guess.delete('rgby').empty? && guess.length == 4\n is_it_q(guess)\n cheat(guess)\n if guess.length != 4\n puts \"Four characters are required. Please try again:\"\n elsif !guess.delete('rgby').empty?\n puts \"Sorry, only r, g, b and y are acceptable as guesses. Please try again:\"\n\n else\n @user_input = guess\n verify = true\n break\n end\n\n end\nend", "def advanced_calculator_type\n print \"What would you like to do? Type 1 to find exponents or 2 to find the square root of a number: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"exponents\"\n elsif selection == 2\n \"square root\"\n else\n \"error\"\n end\nend", "def invalid_user_input_or_req_no(user_input, req_no)\n ((user_input.blank? || not_a_number(user_input)) && (not_a_number(req_no) || req_no.to_i != 1)) ? true : false\n end", "def get_question\r\n\t\t\r\n\t\treply = \"\"\r\n\t\t\r\n\t\t#loop until player enters something\r\n\t\tuntil reply != \"\"\r\n\t\t\tConsole_Screen.cls #clear the display area\r\n\t\t\tquestion = \"Type your question and press the Enter key. \\n\\n: \"\r\n\t\t\tprint question\r\n\t\t\treply = STDIN.gets #collect player input\r\n\t\t\treply.chop! #remove extra chars\r\n\t\tend \r\n\tend", "def prompt\n print 'Type an integer number (or q to exit) and press Enter: '\n number = gets\n say_bye_and_exit if number =~ /^q/i\n number = prompt unless number =~ /^\\d+$/\n if number.to_i > 2 ** 64\n puts 'The number you entered is too big. Calculation can run a lot of time! Continue? (y/n)n'\n confirm = gets\n number = prompt unless confirm =~ /^y/i\n end\n number.to_i # to ensure Numeric value returs\nend", "def play_again_Q\n\tputs \"\\nDo you want to play again? (Y/N)\"\n\tchoice = gets.strip\n\tconfirm_YN(choice)\nend", "def input_check(check)\n input = gets.chomp.upcase\n if input == check\n system \"clear\"\n true\n else\n false\n end\n end", "def ask(question)\n\tputs question\n\tgets.chomp.to_i\nend", "def ask(question)\n print question + \" \"\n gets.to_i\nend", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n gets.chomp.downcase\nend", "def validate(answers, input)\n until answers.include?(input)\n puts \"#Invalid input: #{input}\"\n input_answer\n end\n end", "def get_player_input\n\tputs \"\\n-------------------------------------------------------\"\n\tinput = gets.chomp.downcase\n\t\twhile input != \"rock\" && input != \"paper\" && input != \"scissors\" && input != \"spock\" && input != \"lizard\"\n\t\t\tputs \"Please try typing that again.\"\n\t\t\tinput = gets.chomp.downcase\n\t\tend\n\t\treturn input\nend", "def question_valid question\n # If the question is a string (and not a number, or array, or\n # whatever) AND the last character is a question mark, we\n # assume it is a question.\n # Using a negative as an array index counts backward from the\n # last element. So question[-1] is the last element\n question.is_a?(String) && question[-1] == \"?\"\n end", "def ask_for_initial_number(phrase)\n print \"Please enter the #{phrase}: \"\n input = gets.chomp\n if numerical_input?(input)\n return input.to_f\n else\n print \"#{tell_invalid(\"entry.\")} \"\n ask_for_initial_number(phrase)\n end\nend", "def ask_info(info)\n value = ''\n loop do\n value = gets.chomp\n break if (valid_number? value) && (value.to_f > 0)\n prompt \"The #{info} is not valid. Enter a valid #{info}:\"\n end\n value\nend", "def check_answer?(input)\n if @answer == input\n return true\n else\n return false\n end\n end", "def valid?\n @input != \"exit\" && @input != \"quit\"\n end" ]
[ "0.67483205", "0.66702497", "0.6666446", "0.6628097", "0.65997636", "0.6598698", "0.65643185", "0.65577036", "0.6516444", "0.6484169", "0.6446423", "0.6444627", "0.638054", "0.63550824", "0.6346796", "0.6342883", "0.6334482", "0.6298292", "0.6283001", "0.62807816", "0.6279113", "0.6269489", "0.6237466", "0.62209946", "0.61855817", "0.61846733", "0.6183776", "0.6171993", "0.61716837", "0.61579984", "0.61511075", "0.6127162", "0.612643", "0.61146903", "0.61075497", "0.6093912", "0.6088669", "0.60840005", "0.60831225", "0.60698915", "0.6056795", "0.60531425", "0.6045559", "0.6044437", "0.604207", "0.6040628", "0.6030077", "0.60276216", "0.6027373", "0.6021361", "0.60196644", "0.6016791", "0.6010382", "0.6008261", "0.60076743", "0.60050195", "0.6002307", "0.59962666", "0.59938794", "0.59883153", "0.5983029", "0.59662485", "0.59605366", "0.59584475", "0.594998", "0.59462863", "0.5939192", "0.59340686", "0.59287345", "0.5924032", "0.59198785", "0.5919449", "0.5917597", "0.5914193", "0.59122247", "0.5894232", "0.58919173", "0.58914065", "0.58873725", "0.5882718", "0.5879011", "0.5879011", "0.5874355", "0.5870225", "0.58695716", "0.58645284", "0.5861375", "0.58584154", "0.5856656", "0.585603", "0.5852107", "0.58483684", "0.58465534", "0.5841153", "0.5839302", "0.5837179", "0.5835678", "0.5835458", "0.5835453", "0.58302176" ]
0.73210204
0
Displays the result of the operation performed on the two numbers
def display_result(num1, num2, operator) # say "num1: #{num1}, num2: #{num2}, operator #{operator}" case operator when '1' result = num1.to_i + num2.to_i say "#{num1} + #{num2} = #{result}" when '2' result = num1.to_i - num2.to_i say "#{num1} - #{num2} = #{result}" when '3' begin result = num1.to_f / num2.to_f say "#{num1} / #{num2} = #{result}" rescue say("Div by 0") end else result = num1.to_i * num2.to_i say "#{num1} * #{num2} = #{result}" end result.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_results(num_1, num_2)\n puts \"addition #{num_1 + num_2}\"\n puts \"subtraction #{num_1 - num_2}\"\n puts \"product #{num_1 * num_2}\"\n puts \"remainder #{num_1 % num_2}\"\n puts \"quotient #{num_1 / num_2}\"\n puts \"power #{num_1 ** num_2}\"\n\nend", "def calculator(a,b)\n puts \"The sub of #{a} and #{b} is #{a + b}\"\n puts \"The difference of #{a} and #{b} is #{a - b}\"\n puts \"The multiplication of #{a} and #{b} is #{a * b}\"\n end", "def Subtraction(a,b)\n f = a.to_i - b.to_i\n puts \"Subtraction of both number is #{f}\"\n end", "def Multiplication(a,b)\n f = a.to_i * b.to_i\n puts \"Multiplication of both number is: #{f}\"\n end", "def sum_two(num1, num2)\n p \"#{num1} + #{num2} = #{num1 + num2}\"\nend", "def show\n # TODO put computation here for displaying alternate values?\n end", "def subtract(num_one, num_two)\n puts \"#{num_one} - #{num_two} = #{num_one + num_two}\\n\"\nend", "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend", "def maths2(firstNum, secondNum)\n total = firstNum + secondNum\n puts \"firstNum is #{firstNum}\"\n puts \"the secondnum is #{secondNum}\"\n puts \"and the total is #{total} \"\n puts firstNum\n puts secondNum\n puts total\n puts \"firstNum is firstNum\"\n puts \"the secondnum is secondNum\"\n puts \"and the total is total\"\nend", "def numbers(num1, num2)\n puts \"#{num1} + #{num2}\"\n return num1 + num2\nend", "def numbers(a, b)\n p \"#{a} + #{b}\"\n return a + b\nend", "def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend", "def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 / num2}\" \n puts \"#{num1} % #{num2} = #{num1 % num2}\" \n puts \"#{num1} ** #{num2} = #{num1 ** num2}\"\n \nend", "def add(num_one,num_two)\n puts \"#{num_one} + #{num_two} = #{num_one + num_two}\"\nend", "def calculate\n @output << @first << (@op.to_s + @second.to_s)\n \n case @op\n when \"+\" then @result = @first + @second\n when \"-\" then @result = @first - @second\n when \"*\" then \n @result = @first * @second\n # Nasobeni pod sebou ma smysl resit jenom pokud ma druhy citatel vic nez jednu cislici\n if @second.to_s.length > 1\n @output << '-'\n # Iterace pozadu pres druhy citatel pro nasobeni pod sebou\n # Idealne by to zde slo zjednodusit na @second.to_s.reverse.each_char.with_index,\n # ale to jak jsem zjistil neni podporovano v 1.8.x\n @second.to_s.reverse.split(\"\").each_with_index do |char, i|\n @output << (@first * char.to_i).to_s + (' ' * i)\n end \n end\n end\n @output << '-'\n @output << @result\n self # pro zjednoduseni chain callu \n end", "def multiply_2_and_print(x, y)\n result = x * y\n puts \"The result is #{result}.\"\nend", "def subtraction(value1, value2)\n result = value1 - value2\n puts \"The sum of #{ value1 } - #{ value2 } = #{ result }\"\nend", "def calc_subtract(num1, num2)\n puts \"#{num1} - #{num2} = #{num1 - num2}\"\nend", "def add_twos(num1, num2)\n number = (num1 + num2)\n puts number\nend", "def multiplication(value1, value2)\n result = value1 * value2\n puts \"The sum of #{ value1 } x #{ value2 } = #{ result }\"\nend", "def division(value1, value2)\n result = value1 / value2\n puts \"The sum of #{ value1 } / #{ value2 } = #{ result }\"\nend", "def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend", "def sum_two_num(a, b)\n puts a + b\nend", "def do_addition(number_1, number_2)\n\tfinal_number = number_1 + number_2\n\tputs \"Your first number, #{$first_number}, plus your second number, #{$second_number}, equals #{final_number}.\"\nend", "def sub_two_numbers(num1, num2)\n puts \"OK, let's solve your math problem!\"\n num1 - num2\nend", "def numbers(num1, num2)\n p num1 + num2\nend", "def mathy\n print \"what is the first number?\"\n first = gets.chomp.to_i\n\n print \"what is the second number\"\n second = gets.chomp.to_i\n\n puts \"\\n #{first} + #{second} = #{first + second}\\n\n #{first} - #{second} = #{first - second} \\n\n #{first} * #{second} = #{first * second} \\n\n #{first} / #{second} = #{first / second}\"\nend", "def add_two(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def multiply(num_one, num_two)\n puts \"#{num_one} * #{num_two} = #{num_one * num_two}\\n\"\nend", "def display_exponify a, b\n display = \"#{a} * \" * (b - 1) + \"#{a} = \" if b > 1\nend", "def add_two_numbers( x, y )\n puts x + y\nend", "def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend", "def multiplication (a,b)\n f = a.to_i * b.to_i\n puts \"Multiplication is: #{f}\"\n end", "def two_numbers(one, two)\n p \"This is the sum of #{one} and #{two}\"\nend", "def add_two_numbers(x,y)\n puts x + y\nend", "def addition(value1, value2)\n result = value1 + value2\n puts \"The sum of #{ value1 } + #{ value2 } = #{ result }\"\nend", "def my_math_method(num1, num2)\n\tanswer = num1 + num2\n\tputs \"The sum of #{num1} and #{num2} is #{answer}.\"\nend", "def add_two_numbers (x,y)\n puts x + y\nend", "def sisoku(a, b)\r\n puts a+b\r\n puts a-b\r\n puts a*b\r\n puts a/b\r\n end", "def sottrazione(a, b)\n puts \"SOTTRAENDO #{a} - #{b}\"\n a - b\nend", "def shownumbers_mand\n\t\tmult = @num1 * @num2 * @num3\n\t\tputs \"With Mandtory #{@num1} * #{@num2} * #{@num3} = #{mult}\"\n\tend", "def subtraction (a,b)\n f = a.to_i - b.to_i\n puts \"Subtraction is #{f}\"\n end", "def Residuo\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nResiduo: #{numero1 % numero2}\"\n end", "def math_problem(num1, num2)\n p \"I am solving this hard math problem\"\n return num1 + num2\n p num1 - num2 #this won't get executed\nend", "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend", "def multiply(num1, num2)\n result = num1 * num2\n puts \"#{num1} times #{num2} equals #{result}\"\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division of both number is: #{f}\"\n end", "def division(input_number1, input_number2)\n\tquotient = input_number1 / input_number2\n\tputs \"The quotient of #{input_number1} and #{input_number2}th is #{quotient}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def add(num1,num2)\n\tputs \"num1 has the value : #{ num1 }\"\n\tputs \"num2 has the value : #{ num2 }\"\n\tresults = num1 + num2\n\tputs \"results is then: #{ results}\"\nend", "def add(num1, num2)\n total = num1 + num2\n puts \"The sum of #{num1} + #{num2} = \" + total.to_s\nend", "def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend", "def soma(a,b)\np \"seu resultado é: \"\na+b\nend", "def show_numbersdef\n\t\tmult = @number1 * @number2 * @number3\n\t\tputs \"With default #{@number1} * #{@number2} * #{@number3} = #{mult}\"\n\tend", "def jumlah(num1, num2)\n\tnum = num1 + num2\n\tputs \"Sedang menjumlakan...\"\n\treturn num1\nend", "def display_result(result)\r\n puts result\r\n end", "def arithmetic2(a,b)\r\r\n if a < b \r\r\n a / 2\r\r\n else\r\r\n \tb / 2\r\r\n end \r\r\nend", "def numbers(a, b)\n puts \"First number is #{a}\"\n puts \"Second number is #{b}\"\n return a + b\nend", "def sum_numbers(num_1,num_2)\n puts \"The sum of #{num_1} and #{num_2} is #{num_1 + num_2}\"\nend", "def smart(x, y)\nsum = x.to_i + y.to_i\n \"What's #{x} + #{y}? The answer is #{sum}!\"\nend", "def my_math_method(num1, num2)\n sum = num1 + num2\n\tputs \"The sum of 2 + 2 is #{sum}\"\nend", "def subtraction(input_number1, input_number2)\n\tdifference = input_number1 - input_number2\n\tputs \"The difference between #{input_number1} and #{input_number2} is #{difference}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def computer (num1,num2,x)\n case x\n when \"A\" then puts \"計算式:#{num1}+#{num2}=#{num1+num2}\"\n when \"B\" then puts \"計算式:#{num1}-#{num2}=#{num1-num2}\"\n when \"C\" then puts \"計算式:#{num1}*#{num2}=#{num1*num2}\"\n when \"D\" then puts \"計算式:#{num1}/#{num2}=#{num1/num2}\"\n else\n puts \"運算元錯誤!\"\n end\nend", "def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend", "def moltiplicazione(a, b)\n puts \"MOLTIPLICANDO #{a} * #{b}\"\n a * b\nend", "def show\n @random_number = 1 + rand(10)\n @result = Number.compare_numbers(@number.input, @random_number)\n end", "def calculator(op, num1, num2)\n if op == \"add\" || op == \"+\" || op == \"addition\"\n return num1 + \" + \" + num2 + \" = #{add(num1.to_i, num2.to_i)}\"\n elsif op == \"subtract\" || op == \"-\" || op == \"subtraction\"\n return num1 + \" - \" + num2 + \" = #{sub(num1.to_i, num2.to_i)}\"\n elsif op == \"multiply\" || op == \"*\" || op == \"multiplication\"\n return num1 + \" * \" + num2 + \" = #{mult(num1.to_i, num2.to_i)}\"\n elsif op == \"divide\" || op == \"/\" || op == \"division\"\n return num1 + \" / \" + num2 + \" = #{div(num1.to_i, num2.to_i)}\"\n elsif op == \"modulo\" || op == \"remainder\" || op == \"%\"\n return num1 + \" % \" + num2 + \" = #{mod(num1.to_i, num2.to_i)}\"\n else op == \"exponent\" || op == \"^\"\n return num1 + \"^\" + num2 + \" = #{exponent(num1.to_i, num2.to_i)}\"\n end\nend", "def add_two num\n p num + 2\nend", "def sum_num(a, b)\n ab = a + b\n puts \"#{ab}\"\nend", "def show()\n puts \"\\n for Addition press :1 \"\n puts \"\\n for Subtraction press :2 \"\n puts \"\\n for Multiplication press :3 \"\n puts \"\\n for Division press :4 \"\n end", "def addition(input_number1, input_number2)\n\tsum = input_number1 + input_number2\n\tputs \"The sum of #{input_number1} and #{input_number2} is #{sum}\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def exponify a, b\n return \"a ^ b = #{display_exponify a, b}#{a**b}\"\nend", "def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend", "def multiply(number_1, number_2)\n product = number_1 * number_2\n puts \"#{number_1} * #{number_2} = #{product}\"\n puts \"Hooray for math!\"\nend", "def sum(num1, num2)\n puts \"Really? #{num1 + num2} foxes?!\"\nend", "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "def multiply(num1, num2)\nnumber_out = num1 * num2\np(number_out)\nend", "def calculate operator, num1, num2\n puts \"#{num1} #{operator} #{num2} = #{num1.send(operator, num2)}\"\nend", "def operation(num)\n\treturn num*num, num**3\nend", "def add(num_1, num_2)\nsolution=num_1.to_f + num_2\nputs solution\nend", "def print_sum(num1, num2)\n p num1 + num2\nend", "def sum_these_numbers(num1,num2)\n p num1 + num2\nend", "def add_nums(num1, num2)\n p \"Addition of #{num1} + #{num2} = #{num1 + num2}\"\nend", "def show(value)\n print (\"Result = #{value.result}\\n\")\nend", "def add(x, y)\n\tputs \"#{ x } + #{ y } = #{ x + y }\"\nend", "def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n end\nend", "def subtract(num1,num2)\n\tp num1 - num2\nend", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n\nend", "def calculate\n \t@num1 = params[:num1].to_i\n \t@num2 = params[:num2].to_i\n\n \tif params[:addition] then\n @result = @num1 + @num2\n elsif params[:subtraction] then\n @result = @num1 - @num2\n elsif params[:multiplication] then\n @result = @num1 * @num2\n elsif params[:division] then\n @result = @num1/@num2\n else\n \trender \"errorhandling\"\n \tflash[:error] = \"Couldn't calculate!\"\n end\n \t\n end", "def total(num1, num2)\n puts num1 + num2\nend", "def resta(a,b)\r\n $resultado = a - b\r\n puts $resultado\r\nend", "def output_scores (p1, p2) \n puts \"P1: #{p1.remaining_lives} / 3 VS P2: #{p2.remaining_lives} / 3\"\n end", "def addition(a,b)\n puts c = a + b\n end", "def sum(number_A, number_B)\n p number_A + number_B\nend", "def operations\n puts \"(a) - addition (+)\"\n puts \"(s) - subtraction (-)\"\n puts \"(m) - multiplication (*)\"\n puts \"(d) - division (/)\"\nend", "def to_s \n\tputs \"#{@num}/#{@denom}\"\n end", "def add\n\t number_1 + number_2\n end" ]
[ "0.72165275", "0.69052255", "0.6869239", "0.6859879", "0.6838141", "0.6747097", "0.6725214", "0.6724019", "0.66996586", "0.66837806", "0.6667593", "0.66484004", "0.66381717", "0.6631098", "0.6621911", "0.6606983", "0.6598752", "0.6594458", "0.65312785", "0.65121955", "0.6502232", "0.64875484", "0.64752156", "0.6474685", "0.6461741", "0.6455825", "0.64553815", "0.6438347", "0.6414485", "0.6405471", "0.63931656", "0.63927954", "0.6383802", "0.6381726", "0.6379864", "0.63772494", "0.6361113", "0.6353899", "0.6345838", "0.63357", "0.6321662", "0.63184255", "0.6317198", "0.6310416", "0.63058305", "0.6301091", "0.6297972", "0.62907946", "0.62850136", "0.62850136", "0.6250184", "0.6250184", "0.624751", "0.62409776", "0.624005", "0.62324834", "0.62270033", "0.62238336", "0.6211529", "0.6207971", "0.6206833", "0.6203524", "0.6202901", "0.61999905", "0.6192929", "0.6191007", "0.6190621", "0.61788696", "0.6162226", "0.61474043", "0.6135912", "0.6133828", "0.61293", "0.6126549", "0.6125752", "0.6107182", "0.6099405", "0.6093084", "0.60900587", "0.60863334", "0.6054631", "0.60484433", "0.6047139", "0.6039876", "0.603929", "0.60323966", "0.602346", "0.6020604", "0.60163504", "0.6016172", "0.60147756", "0.60140115", "0.60052454", "0.5995277", "0.5980293", "0.59693295", "0.5968756", "0.5968144", "0.595299", "0.59509856" ]
0.73220927
0
creates security_group and authorizes default port ranges
def create_security_group(name, vpc_id) sg = ec2.create_security_group({ group_name: name, description: "Kontena Grid", vpc_id: vpc_id }) sg.authorize_ingress({ # SSH ip_protocol: 'tcp', from_port: 22, to_port: 22, cidr_ip: '0.0.0.0/0' }) sg.authorize_ingress({ # HTTP ip_protocol: 'tcp', from_port: 80, to_port: 80, cidr_ip: '0.0.0.0/0' }) sg.authorize_ingress({ # HTTPS ip_protocol: 'tcp', from_port: 443, to_port: 443, cidr_ip: '0.0.0.0/0' }) sg.authorize_ingress({ # OpenVPN ip_protocol: 'udp', from_port: 1194, to_port: 1194, cidr_ip: '0.0.0.0/0' }) sg.authorize_ingress({ # Overlay / Weave network ip_permissions: [ { from_port: 6783, to_port: 6783, ip_protocol: 'tcp', user_id_group_pairs: [ { group_id: sg.group_id, vpc_id: vpc_id } ] }, { from_port: 6783, to_port: 6784, ip_protocol: 'udp', user_id_group_pairs: [ { group_id: sg.group_id, vpc_id: vpc_id } ] } ] }) sg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_security_group_prepared\n provider.create_security_group(system_config.security_group, required_public_ports)\n end", "def adjust_security_groups\n\n all_regions.each do |region|\n c = connection(region)\n g = c.security_groups.get(primary_group)\n \n g.authorize_port_range(1024..65535, :cidr_ip => \"#{master.public_ip_address}/32\")\n nodes.each do |node|\n g.authorize_port_range(1024..65535, :cidr_ip => \"#{node.public_ip_address}/32\")\n end\n end\n end", "def create_port_group\n Puppet.debug \"Entering Create Port Group method.\"\n @networksystem=host.configManager.networkSystem\n if (find_vswitch == false)\n raise Puppet::Error, \"Unable to find the vSwitch \" + resource[:vswitch]\n end\n hostnetworkpolicy = RbVmomi::VIM.HostNetworkPolicy()\n hostportgroupspec = RbVmomi::VIM.HostPortGroupSpec(:name => resource[:portgrp], :policy => hostnetworkpolicy, :vlanId => resource[:vlanid], :vswitchName => resource[:vswitch])\n @networksystem.AddPortGroup(:portgrp => hostportgroupspec)\n\n if (resource[:traffic_shaping_policy] !=nil )\n traffic_shaping\n end\n if (resource[:failback] !=nil )\n set_failback\n end\n if (resource[:overridefailoverorder] !=nil )\n setoverridepolicy\n end\n if (resource[:checkbeacon]!= nil)\n set_checkbeacon\n end\n if (resource[:portgrouptype] == :VMkernel)\n Puppet.debug \"Entering type VMkernel\"\n add_virtual_nic\n\n if (resource[:vmotion] !=nil )\n setupvmotion\n end\n\n if (resource[:mtu] !=nil )\n setupmtu\n end\n end\n Puppet.notice \"Successfully created a portgroup {\" + resource[:portgrp] + \"}\"\n end", "def authorize_port_range(sg, port_range, protocol, ip_range)\n rules = ip_permissions(sg)\n rules.create(parent_group_id: sg.id, from_port: port_range.min, to_port: port_range.max, ip_range: {\"cidr\" => ip_range}, ip_protocol: protocol)\n end", "def create_security_group(security_group_name)\n ports = {\n ssh_access: 22,\n nats_server: 4222,\n message_bus: 6868,\n blobstore: 25250,\n bosh_director: 25555,\n bosh_registry: 25777\n }\n # TODO: New stemcells to be released will use 25777, so this can be deleted\n ports[:openstack_registry] = 25889 if openstack?\n\n provider.create_security_group(security_group_name, \"microbosh\", ports)\n\n settings[\"bosh_cloud_properties\"][provider_name][\"default_security_groups\"] = [security_group_name]\n settings[\"bosh_security_group\"] = {}\n settings[\"bosh_security_group\"][\"name\"] = security_group_name\n settings[\"bosh_security_group\"][\"ports\"] = {}\n ports.each { |name, port| settings[\"bosh_security_group\"][\"ports\"][name.to_s] = port }\n save_settings!\n end", "def create(name, desc=nil, addresses=[], ports=[], protocols=[], &each_group)\n desc ||= \"Security Group #{name}\"\n ret = @@ec2.create_security_group(:group_name => name, :group_description => desc)\n return false unless (ret && ret['return'] == 'true')\n authorize(name, addresses, ports, protocols)\n get(name, &each_group)\n end", "def security_group=(new_cidr_block)\n new_cidr_block = new_cidr_block + '/32' unless new_cidr_block.include? \"/\"\n @environment.vpc.security_groups.each do |sg|\n @security_group = sg if sg.group_name == 'SshSecurityGroup' + new_cidr_block\n end\n\n # only create security group if it does not exist\n if @security_group.nil?\n ec2 = Aws::EC2::Resource.new(region: 'us-west-2')\n\n @security_group = ec2.create_security_group(\n group_name: 'SshSecurityGroup' + new_cidr_block,\n description: 'Enable SSH access via port 22',\n vpc_id: @environment.vpc.id\n )\n\n @security_group.authorize_egress(\n ip_permissions: [\n ip_protocol: 'tcp',\n from_port: 22,\n to_port: 22,\n ip_ranges: [\n cidr_ip: new_cidr_block\n ]\n ]\n )\n end\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 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 create_and_setup_SGs(client, vpc_id)\n # Create security group for private subnet ingress TCP port 80 (for httpd (nginx)).\n puts 'Creating security group for ingress TCP port 80 on private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_priv',\n description: 'Ingress TCP HTTP:80 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_80_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_priv}]\"\n\n # Create security group for public LBs ingress TCP port 80.\n puts 'Creating security group for ingress TCP port 80 for LBs...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_lb',\n description: 'Ingress TCP HTTP:80 LBs',\n vpc_id: vpc_id)\n sg_tcp_80_lb = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_lb}]\"\n\n\n # Create security group for private subnet ingress TCP port 22 (for sshd).\n puts 'Creating security group for ingress TCP port 22 for private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_priv',\n description: 'Ingress TCP SSH:22 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_22_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_priv}]\"\n\n # Create security group for ingress TCP port 22 (for sshd) for public nat instances.\n puts 'Creating security group for ingress TCP port 22 for public nat instances...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_pub',\n description: 'Ingress TCP SSH:22 NAT instances',\n vpc_id: vpc_id)\n sg_tcp_22_pub = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_pub}]\"\n\n # Create security group for ingress TCP port 80 (for nginx instance updates) through nat instances.\n puts 'Creating security group for ingress TCP port 80 for NAT instance...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_nat',\n description: 'Ingress TCP HTTP:80 to/through NAT instances',\n vpc_id: vpc_id)\n sg_tcp_80_nat = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_nat}]\"\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 private subnet security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_priv,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0') # TODO: limit to aws LB address space\n puts 'Rule added.'\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 LB security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 LB security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_lb,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0')\n puts 'Rule added.'\n\n # Add an ingress rule of (10.0.0.0/16) to the TCP port 80 for the nat instances.\n puts 'Adding ingress rule of (10.0.0.0/16) to the TCP port 80 for the private nat instance side...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_nat,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '10.0.0.0/16')\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.100.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.200.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of your choice here to the TCP port 22 public subnet security group.\n # puts 'Adding ingress rule of x.x.x.x/32 to the TCP port 22 public subnet security group...'\n # client.authorize_security_group_ingress(group_id: sg_tcp_22_pub,\n # ip_protocol: 'tcp',\n # from_port: 22, # This is the start of the port range\n # to_port: 22, # This is the end of the port range\n # cidr_ip: 'x.x.x.x/32') # Replace this with your src IP.\n # puts 'Rule added.'\n return sg_tcp_80_priv, sg_tcp_22_priv, sg_tcp_22_pub, sg_tcp_80_nat, sg_tcp_80_lb\nend", "def allowed_to_create_security_groups=(value)\n @allowed_to_create_security_groups = value\n end", "def create\n ec2 = self.class.new_ec2(@resource.value(:user), @resource.value(:password))\n group = @resource.value(:name)\n begin\n ec2.describe_security_groups({:group_name => group})\n rescue Exception => e\n ec2.create_security_group({ \n :group_name => group,\n :group_description => @resource.value(:desc)\n })\n end\n # if instance in that security group exists, start it\n # otherwise just create a new instance \n ec2.run_instances(\n { :image_id => @resource.value(:image),\n # security groups\n :security_group => group,\n :instance_type => @resource.value(:type)\n })\n end", "def create_security_group_for_inception_vm\n \n return if settings[\"inception\"][\"security_group\"] \n\n ports = {\n ssh_access: 22,\n ping: { protocol: \"icmp\", ports: (-1..-1) } \n }\n security_group_name = \"#{settings.bosh_name}-inception-vm\"\n\n provider.create_security_group(security_group_name, \"inception-vm\", ports)\n\n settings[\"inception\"] ||= {}\n settings[\"inception\"][\"security_group\"] = security_group_name\n save_settings!\n end", "def is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n authorize :network => '70.91.172.41/29', :from_port => \"9160\", :to_port => \"9160\"\n authorize :network => '72.32.68.18/32', :from_port => \"9160\", :to_port => \"9160\"\n authorize :network => '72.32.70.9/32', :from_port => \"9160\", :to_port => \"9160\"\n end\nend", "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 aws_create_security_group( name, opts = {} )\n opts = deep_merge_hashes( @aws_default_sg_options, opts )\n region = opts.delete( :region )\n ec2 = AWS::EC2.new.regions[ region ]\n unless ec2.security_groups.find { |sg| sg.name == name }\n ec2.security_groups.create( name, opts )\n end\n end", "def security_group_created_with_egress?(\n ec2_resource,\n group_name,\n description,\n vpc_id,\n ip_protocol,\n from_port,\n to_port,\n cidr_ip_range\n)\n security_group = ec2_resource.create_security_group(\n group_name: group_name,\n description: description,\n vpc_id: vpc_id\n )\n puts \"Created security group '#{group_name}' with ID \" \\\n \"'#{security_group.id}' in VPC with ID '#{vpc_id}'.\"\n security_group.authorize_egress(\n ip_permissions: [\n {\n ip_protocol: ip_protocol,\n from_port: from_port,\n to_port: to_port,\n ip_ranges: [\n {\n cidr_ip: cidr_ip_range\n }\n ]\n }\n ]\n )\n puts \"Granted egress to security group '#{group_name}' for protocol \" \\\n \"'#{ip_protocol}' from port '#{from_port}' to port '#{to_port}' \" \\\n \"with CIDR IP range '#{cidr_ip_range}'.\"\n return true\nrescue StandardError => e\n puts \"Error creating security group or granting egress: #{e.message}\"\n return false\nend", "def security_group\n node = 'AWS_SECURITY_GROUP'\n q = []\n\n # security_group node\n q.push(_upsert({ node: node, id: @name }))\n\n # vpc node and relationship\n if @data.vpc_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_VPC',\n child_name: @data.vpc_id,\n relationship: 'MEMBER_OF_VPC'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # ingress rules\n @data.ip_permissions.each do |ingress|\n ingress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_INGRESS_RULE',\n child_name: \"#{@name}-#{ingress.ip_protocol}-#{ingress.to_port}-#{i}\",\n relationship: 'HAS_INGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: ingress.ip_protocol,\n to_port: ingress.to_port,\n from_port: ingress.from_port,\n direction: 'ingress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n # egress rules\n @data.ip_permissions_egress.each do |egress|\n egress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_EGRESS_RULE',\n child_name: \"#{@name}-#{egress.ip_protocol}-#{egress.to_port}-#{i}\",\n relationship: 'HAS_EGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: egress.ip_protocol,\n to_port: egress.to_port,\n from_port: egress.from_port,\n direction: 'egress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n q\n end", "def check_open_port(security_group, port, range = \"0.0.0.0/0\")\n res = @ec2_api.describe_security_groups(:group_name => security_group)\n #puts \"res = #{res.inspect}\"\n groups = res['securityGroupInfo']['item']\n if groups.size == 0\n raise Exception.new(\"security group '#{security_group}' not found\")\n end\n permissions = groups[0]['ipPermissions']['item']\n if permissions.size == 0\n # no permissions at all\n return false\n end\n permissions.each() {|permission|\n #puts \"permission: #{permission.inspect}\"\n if permission['ipRanges'] == nil\n #no IP-Ranges defined (group based mode): ignore\n next\n end\n from_port = permission['fromPort'].to_i\n to_port = permission['toPort'].to_i\n prot = permission['ipProtocol']\n if port >= from_port && port <= to_port && prot == \"tcp\"\n permission['ipRanges']['item'].each() {|ipRange|\n if ipRange['cidrIp'] != \"0.0.0.0/0\" && ipRange['cidrIp'] != range\n next\n else\n return true\n end\n }\n end\n }\n false\n end", "def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({ group_name: group_params[0], description: group_params[1], vpc_id: group_params[3] })\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{ key: 'Name', value: group_params[2] }])\n\n render plain: I18n.t('security_groups.msg.change_success')\n end", "def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({group_name: group_params[0], description: group_params[1], vpc_id: group_params[3]})\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{key: 'Name', value: group_params[2]}])\n\n render text: I18n.t('security_groups.msg.change_success')\n end", "def create_db_security_group(name, description = name)\n request({\n 'Action' => 'CreateDBSecurityGroup',\n 'DBSecurityGroupName' => name,\n 'DBSecurityGroupDescription' => description,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSecurityGroup.new\n })\n end", "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "def default_security_group\n filters = {\n filters:\n [\n {\n name: 'vpc-id',\n values: [@vpc.id]\n },\n {\n name: 'group-name',\n values: ['default']\n }\n ]\n }\n collection = ec2.security_groups(filters)\n f = []\n collection.map { |e| f.push e }\n f[0]\n end", "def create_security_group_iso(iso)\n @logger.info(\"Creating SecurityGroup #{iso.name}\")\n sg = SugarCRM::SecurityGroup.new(:name => iso.name) unless find_sugarcrm_object('security_group','name', iso.name)\n sg.save! if sg\n end", "def security_group(sg_name, hsh={}, &block)\n sg_name = sg_name.to_s\n security_groups[sg_name] ||= Ironfan::Cloud::SecurityGroup.new(self, sg_name)\n security_groups[sg_name].configure(hsh, &block)\n security_groups[sg_name]\n end", "def create_secgroup(group)\n connect = aws_api_connect('EC2_Client')\n begin\n p group[:name]\n sec_id = connect.describe_security_groups({\n filters: [\n {\n name: \"group-name\",\n values: [group[:name]],\n },\n ],\n }).security_groups[0].group_id\n return sec_id\n rescue => e\n not_created = true\n end\n\n if not_created == true\n resp = aws_api_connect(\"EC2_Resource\")\n pants = resp.create_security_group({\n group_name: group[:name], # required\n description: group[:description], # required\n vpc_id: group[:vpc_id],\n })\n secgroup_id = pants.id\n puts \"Created secgroup id #{group[:name]} with id #{secgroup_id}.\"\n return secgroup_id\n end\n end", "def select_security_group\n compute.security_groups.each { |s| [s.name, s.id] }\n end", "def create\n @security = OpenStack::Nova::Compute::SecurityGroup.new();\n @security.name = params[:name]\n @security.description = params[:description]\n @security.save\n \n # TODO\n params[:rules].each do |k, v|\n @rule = OpenStack::Nova::Compute::Rule.new\n @rule.ip_protocol = v[:ip_protocol]\n @rule.from_port = v[:from_port]\n @rule.to_port = v[:to_port]\n @rule.cidr = v[:cidr]\n @rule.parent_group = @security\n @security.rule = @rule\n @rule.save\n @security.rule = @rule\n end\n\n respond_to do |format|\n format.json { render json: { status: 0 } }\n end\n\n # respond_to do |format|\n # if @security.save\n # format.html { redirect_to @security, notice: 'Security was successfully created.' }\n # format.json { render json: @security, status: :created, location: @security }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def allowed_to_create_security_groups\n return @allowed_to_create_security_groups\n end", "def security_groups\n @resource.security_groups.map { |sg| SecurityGroup.new(id: sg.group_id, ec2_resource: @ec2_resource) }\n end", "def security_group_to_security_group(_options = {})\n return {} if ar_ems.nil?\n\n cloud_network = field(:cloud_network)\n return {} if cloud_network.nil?\n\n ar_security_group = ar_ems.security_groups.select { |security_group| security_group.cloud_network.ems_ref == cloud_network }\n index_dropdown(ar_security_group)\n rescue => e\n logger(__method__).ui_exception(e)\n end", "def set_security_group\n @security_group = SecurityGroup.find(params[:id])\n end", "def edit_security_group(action, group_name, params)\n hash = {}\n case action\n when :authorize, :grant then action = \"AuthorizeSecurityGroupIngress\"\n when :revoke, :remove then action = \"RevokeSecurityGroupIngress\"\n else raise \"Unknown action #{action.inspect}!\"\n end\n hash['GroupName'] = group_name\n hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].blank?\n hash['SourceSecurityGroupOwnerId'] = params[:source_group_owner].to_s.gsub(/-/,'') unless params[:source_group_owner].blank?\n hash['IpProtocol'] = params[:protocol] unless params[:protocol].blank?\n unless params[:port].blank?\n hash['FromPort'] = params[:port]\n hash['ToPort'] = params[:port]\n end\n hash['FromPort'] = params[:from_port] unless params[:from_port].blank?\n hash['ToPort'] = params[:to_port] unless params[:to_port].blank?\n hash['CidrIp'] = params[:cidr_ip] unless params[:cidr_ip].blank?\n #\n link = generate_request(action, hash)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_security_group(name, description)\n # EC2 doesn't like an empty description...\n description = \" \" if description.blank?\n link = generate_request(\"CreateSecurityGroup\", \n 'GroupName' => name.to_s, \n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def edit_security_group(action, group_name, params)\n hash = {}\n case action\n when :authorize, :grant then action = \"AuthorizeSecurityGroupIngress\"\n when :revoke, :remove then action = \"RevokeSecurityGroupIngress\"\n else raise \"Unknown action #{action.inspect}!\"\n end\n hash['GroupName'] = group_name\n hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].right_blank?\n hash['SourceSecurityGroupOwnerId'] = params[:source_group_owner].to_s.gsub(/-/,'') unless params[:source_group_owner].right_blank?\n hash['IpProtocol'] = params[:protocol] unless params[:protocol].right_blank?\n unless params[:port].right_blank?\n hash['FromPort'] = params[:port]\n hash['ToPort'] = params[:port]\n end\n hash['FromPort'] = params[:from_port] unless params[:from_port].right_blank?\n hash['ToPort'] = params[:to_port] unless params[:to_port].right_blank?\n hash['CidrIp'] = params[:cidr_ip] unless params[:cidr_ip].right_blank?\n #\n link = generate_request(action, hash)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_security_group(name, description)\n # EC2 doesn't like an empty description...\n description = \" \" if description.blank?\n link = generate_request(\"CreateSecurityGroup\", \n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\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 lookup_open_ports(group_name, group_infos)\n # puts \"group_infos = #{group_infos.inspect}\"\n group_info = get_security_group_info(group_name, group_infos)\n # puts \"group_info for #{group_name} = #{group_info.inspect}\"\n open_ports = []\n group_info['ipPermissions']['item'].each() {|permission|\n if permission['ipRanges'] == nil\n #no IP-Ranges defined (group based mode): ignore\n next\n end\n prot = permission['ipProtocol']\n from_port = permission['fromPort'].to_i\n to_port = permission['toPort'].to_i\n next if from_port != to_port #ignore port ranges\n permission['ipRanges']['item'].each() {|ipRange|\n if ipRange['cidrIp'] == \"0.0.0.0/0\"\n #found one\n open_ports << {:protocol => prot, :port => from_port}\n end\n }\n }\n open_ports\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_inbound(opts)\n opts[:security_group].authorize_ingress(:tcp, 20..8080)\n end", "def add_cloud_subnet_network_ports\n add_collection(network, :cloud_subnet_network_ports) do |builder|\n builder.add_properties(:manager_ref_allowed_nil => %i(cloud_subnet))\n end\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 authorize_db_security_group( options = {} )\n raise ArgumentError, \"No :db_security_group_name provided\" if options.does_not_have?(:db_security_group_name)\n\n params = {}\n params['DBSecurityGroupName'] = options[:db_security_group_name]\n\n if options.has?(:cidrip)\n params['CIDRIP'] = options[:cidrip]\n elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id)\n params['EC2SecurityGroupName'] = options[:ec2_security_group_name]\n params['EC2SecurityGroupOwnerId'] = options[:ec2_security_group_owner_id]\n else\n raise ArgumentError, \"No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided\"\n end\n\n return response_generator(:action => \"AuthorizeDBSecurityGroupIngress\", :params => params)\n end", "def create_db_security_group( options = {} )\n raise ArgumentError, \"No :db_security_group_name provided\" if options.does_not_have?(:db_security_group_name)\n raise ArgumentError, \"No :db_security_group_description provided\" if options.does_not_have?(:db_security_group_description)\n\n params = {}\n params['DBSecurityGroupName'] = options[:db_security_group_name]\n params['DBSecurityGroupDescription'] = options[:db_security_group_description]\n\n return response_generator(:action => \"CreateDBSecurityGroup\", :params => params)\n end", "def createSubnetGroup\n subnet_ids = []\n if @config[\"vpc\"] && !@config[\"vpc\"].empty?\n raise MuError.new \"Didn't find the VPC specified for #{@mu_name}\", details: @config[\"vpc\"].to_h unless @vpc\n\n vpc_id = @vpc.cloud_id\n\n # Getting subnet IDs\n if @config[\"vpc\"][\"subnets\"].empty?\n @vpc.subnets.each { |subnet|\n subnet_ids << subnet.cloud_id\n }\n MU.log \"No subnets specified for #{@config['identifier']}, adding all subnets in #{@vpc}\", MU::DEBUG\n else\n @config[\"vpc\"][\"subnets\"].each { |subnet|\n subnet_obj = @vpc.getSubnet(cloud_id: subnet[\"subnet_id\"].to_s, name: subnet[\"subnet_name\"].to_s)\n raise MuError.new \"Couldn't find a live subnet matching #{subnet} in #{@vpc}\", details: @vpc.subnets if subnet_obj.nil?\n subnet_ids << subnet_obj.cloud_id\n }\n end\n else\n # If we didn't specify a VPC try to figure out if the account has a default VPC\n vpc_id = nil\n subnets = []\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_vpcs.vpcs.each { |vpc|\n if vpc.is_default\n vpc_id = vpc.vpc_id\n subnets = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_subnets(\n filters: [\n {\n name: \"vpc-id\", \n values: [vpc_id]\n }\n ]\n ).subnets\n break\n end\n }\n\n if !subnets.empty?\n mu_subnets = []\n subnets.each { |subnet|\n subnet_ids << subnet.subnet_id\n mu_subnets << {\"subnet_id\" => subnet.subnet_id}\n }\n\n @config['vpc'] = {\n \"vpc_id\" => vpc_id,\n \"subnets\" => mu_subnets\n }\n\n MU.log \"Using default VPC for cache cluster #{@config['identifier']}\"\n end\n end\n\n if subnet_ids.empty?\n raise MuError, \"Can't create subnet group #{@config[\"subnet_group_name\"]} because I couldn't find a VPC or subnets\"\n else\n MU.log \"Creating subnet group #{@config[\"subnet_group_name\"]} for cache cluster #{@config['identifier']}\"\n\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_subnet_group(\n cache_subnet_group_name: @config[\"subnet_group_name\"],\n cache_subnet_group_description: @config[\"subnet_group_name\"],\n subnet_ids: subnet_ids\n )\n\n allowBastionAccess\n\n if @dependencies.has_key?('firewall_rule')\n @config[\"security_group_ids\"] = []\n @dependencies['firewall_rule'].values.each { |sg|\n @config[\"security_group_ids\"] << sg.cloud_id\n }\n end\n end\n end", "def create\n @security_group = SecurityGroup.new(security_group_params)\n\n respond_to do |format|\n if @security_group.save\n format.html { redirect_to @security_group, notice: 'Security group was successfully created.' }\n format.json { render :show, status: :created, location: @security_group }\n else\n format.html { render :new }\n format.json { render json: @security_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_security_group(name, description=nil)\n # EC2 doesn't like an empty description...\n description = \"-\" if description.right_blank?\n link = generate_request(\"CreateSecurityGroup\",\n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_security_group(name, description=nil)\n # EC2 doesn't like an empty description...\n description = \"-\" if description.blank?\n link = generate_request(\"CreateSecurityGroup\",\n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def authorize_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n authorize_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\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 current_open_ports\n tcp_ports = []\n udp_ports = []\n security_group.ip_permissions.each do |hsh|\n proto, from, to = hsh['ipProtocol'], hsh['fromPort'], hsh['toPort']\n case proto\n when 'tcp'\n tcp_ports.push Range.new(from, to).to_a\n when 'udp'\n udp_ports.push Range.new(from, to).to_a\n end\n end\n {tcp: tcp_ports.flatten, udp: udp_ports.flatten}\n end", "def revoke_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :revoke, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def revoke_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :revoke, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\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 is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n end\nend", "def create(name, type)\n configure [\"aaa group server #{type} #{name}\", 'exit']\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def create\n file = Tempfile.new(\"onesecgroup-#{resource[:name]}-create.xml\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.DESCRIPTION resource[:description]\n resource[:rules].each do |rule|\n xml.RULE do\n rule.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:rules]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating secgroup using #{tempfile}\"\n onesecgroup('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def describe_security_groups\n request({\n 'Action' => 'DescribeSecurityGroups',\n :idempotent => true,\n :parser => Fog::Parsers::BT::Compute::DescribeSecurityGroups.new\n })\n end", "def create_ports(connection_points, vlinks, networks_id, security_group_id)\n\t\tports = []\n\n\t\tconnection_points.each do |connection_point|\n\t\t\tvlink = vlinks.find {|vlink| vlink['id'] == connection_point['vlink_ref']}\n\t\t\tnetwork_id = networks_id.find{ |network| network['alias'] == vlink['alias'] }['id']\n\t\t\tport_name = \"#{connection_point['id']}\"\n\t\t\tports << { port: {get_resource: port_name} }\n\t\t\t@hot.resources_list << Port.new(port_name, network_id, security_group_id)\n\n\t\t\t# Check if it's necessary to create an output for this resource\n\t\t\tif @outputs.has_key?('ip') && @outputs['ip'].include?(port_name)\n\t\t\t\t@hot.outputs_list << Output.new(\"#{port_name}#ip\", \"#{port_name} IP address\", {get_attr: [port_name, 'fixed_ips', 0, 'ip_address']})\n\t\t\tend\n\n\t\t\t# Check if the port has a Floating IP\n\t\t\tif vlink['access']\n\t\t\t\tfloating_ip_name = get_resource_name\n\t\t\t\t# TODO: Receive the floating ip pool name?\n\t\t\t\t@hot.resources_list << FloatingIp.new(floating_ip_name, 'public')\n\t\t\t\t@hot.resources_list << FloatingIpAssociation.new(get_resource_name, {get_resource: floating_ip_name}, {get_resource: port_name})\n\t\t\t\t@hot.outputs_list << Output.new(\"#{port_name}#floating_ip\", \"#{port_name} Floating IP\", {get_attr: [floating_ip_name, 'floating_ip_address']})\n\t\t\tend\n\t\tend\n\n\t\tports\n\tend", "def set_security_groups(lb_id, security_group_ids)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('SecurityGroups', security_group_ids))\n request({\n 'Action' => 'SetSecurityGroups',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::SetSecurityGroups.new\n }.merge!(params))\n end", "def create!\n Subnet.reserve(@subnet)\n super\n Address.mkdir(@id)\n PoolNode.mkdir(@id)\n create_address(gateway)\n end", "def security_groups\n data[:security_groups]\n end", "def create(group_hash)\n # Check arguments\n if !group_hash[:name]\n return OpenNebula::Error.new(\"Group name not defined\")\n end\n\n if group_hash[:group_admin]\n if group_hash[:group_admin][:name] && !group_hash[:group_admin][:password]\n error_msg = \"Admin user password not defined\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n # Allocate group\n rc = allocate(group_hash[:name])\n return rc if OpenNebula.is_error?(rc)\n\n # Set group ACLs to create resources\n rc, msg = create_default_acls(group_hash[:resources])\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error creating group ACL's: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n\n # Set group ACLs to share resources\n if group_hash[:shared_resources]\n acls = Array.new\n acls << \"@#{id} #{group_hash[:shared_resources]}/@#{id} USE\"\n\n rc, msg = create_group_acls(acls)\n\n if OpenNebula.is_error?(rc)\n self.delete\n error_msg = \"Error creating group ACL's: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n # Create associated group admin if needed\n rc = create_admin_user(group_hash)\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error creating admin user: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n\n sunstone_attrs = []\n\n # Add Sunstone views for the group\n if group_hash[:views]\n sunstone_attrs << \"VIEWS=\\\"#{group_hash[:views].join(\",\")}\\\"\"\n end\n\n if group_hash[:default_view]\n sunstone_attrs << \"DEFAULT_VIEW=\\\"#{group_hash[:default_view]}\\\"\"\n end\n\n # And the admin views\n if group_hash[:admin_views]\n sunstone_attrs << \"GROUP_ADMIN_VIEWS=\\\"#{group_hash[:admin_views].join(\",\")}\\\"\"\n else\n sunstone_attrs << \"GROUP_ADMIN_VIEWS=#{GROUP_ADMIN_SUNSTONE_VIEWS}\"\n end\n\n if group_hash[:default_admin_view]\n sunstone_attrs << \"GROUP_ADMIN_DEFAULT_VIEW=\\\"#{group_hash[:default_admin_view]}\\\"\"\n else\n sunstone_attrs << \"GROUP_ADMIN_DEFAULT_VIEW=#{GROUP_ADMIN_SUNSTONE_VIEWS}\"\n end\n\n do_update = false\n\n if sunstone_attrs.length > 0\n do_update = true\n\n update_str = \"SUNSTONE=[#{sunstone_attrs.join(\",\\n\")}]\\n\"\n end\n\n opennebula_attrs = []\n\n # Persistency attributes for new images\n if group_hash[:opennebula]\n if group_hash[:opennebula][:default_image_persistent]\n opennebula_attrs << \"DEFAULT_IMAGE_PERSISTENT=\\\"\"\\\n \"#{group_hash[:opennebula][:default_image_persistent]}\\\"\"\n end\n\n if group_hash[:opennebula][:default_image_persistent_new]\n opennebula_attrs << \"DEFAULT_IMAGE_PERSISTENT_NEW=\\\"\"\\\n \"#{group_hash[:opennebula][:default_image_persistent_new]}\\\"\"\n end\n end\n\n if opennebula_attrs.length > 0\n do_update = true\n\n update_str += \"OPENNEBULA=[#{opennebula_attrs.join(\",\\n\")}]\\n\"\n end\n\n if do_update\n rc = update(update_str, true)\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error updating group template: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n return 0\n end", "def aws_security_group_enable_outbound_port_443(opts)\n opts[:security_group].authorize_egress('0.0.0.0/0', protocol: :tcp, ports: 443)\n end", "def ensure_user_group\n if new_resource.gid.is_a?(String)\n group_name = new_resource.gid\n Etc.getgrnam(new_resource.gid).gid\n else\n group_name = new_resource.username\n Etc.getgrgid(new_resource.gid).gid\n end\nrescue ArgumentError\n Chef::Log.info(\n \"user_account[#{new_resource.username}] creating group #{group_name}\")\n group group_name do\n gid new_resource.gid if new_resource.gid.is_a?(Integer)\n end.run_action(:create)\n Etc.getgrnam(group_name).gid\nend", "def create_port(network, subnet = nil, device = nil, device_owner = nil)\n data = {\n 'port' => {\n 'network_id' => network,\n } \n }\n unless device_owner.nil?\n data['port']['device_owner'] = device_owner\n end\n unless device.nil?\n data['port']['device_id'] = device\n end\n unless subnet.nil?\n data['port']['fixed_ips'] = [{'subnet_id' => subnet}]\n end\n \n puts data\n\n return post_request(address(\"ports\"), data, @token)\n end", "def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend", "def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend", "def create\n\t\tload_schedule\n\t\t@schedule.generate_groups(params[:number].to_i)\n\t\tredirect_to schedule_overview_path(@schedule), notice: 'Groups have been randomly assigned.'\n\tend", "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 set_resource_group\n @resource_group = ResourceGroup.find(params[:id])\n # authorize(@resource_group)\n end", "def create\n @resource_group = ResourceGroup.new(resource_group_params)\n # authorize(@resource_group)\n respond_to do |format|\n if @resource_group.save\n format.html { redirect_to @resource_group, notice: 'Resource group was successfully created.' }\n format.json { render :show, status: :created, location: @resource_group }\n else\n format.html { render :new }\n format.json { render json: @resource_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_collection_svc_def_con_grp\n # preconfig servers\n servers = %w(group1 group2)\n config_tacacs_servers(servers)\n\n # preconfig console\n # we need in some specific order\n config('aaa authentication login default group group2 group1 none',\n 'aaa authentication login console group group1')\n\n aaaauthloginservice_list = AaaAuthenticationLoginService.services\n refute_empty(aaaauthloginservice_list,\n 'Error: service collection is not filled')\n assert_equal(2, aaaauthloginservice_list.size,\n 'Error: Login collection not reporting correct size')\n assert(aaaauthloginservice_list.key?('default'),\n 'Error: collection does contain default')\n assert(aaaauthloginservice_list.key?('console'),\n 'Error: collection does contain console')\n aaaauthloginservice_list.each do |name, aaaauthloginservice|\n assert_equal(name, aaaauthloginservice.name,\n \"Error: Invalid name #{name} in collection\")\n\n if name == 'default'\n assert_equal(AAA_AUTH_LOGIN_SERVICE_METHOD_NONE,\n aaaauthloginservice.method,\n 'Error: Invalid method for default in collection')\n groups = %w(group2 group1)\n assert_equal(groups, aaaauthloginservice.groups,\n 'Error: Invalid groups for default in collection')\n end\n\n if name == 'console'\n assert_equal(AAA_AUTH_LOGIN_SERVICE_METHOD_UNSELECTED,\n aaaauthloginservice.method,\n 'Error: Invalid method for console in collection')\n groups = ['group1']\n assert_equal(groups, aaaauthloginservice.groups,\n 'Error: Invalid groups for default in collection')\n end\n aaaauthloginservice_detach(aaaauthloginservice, false)\n end\n aaaauthloginservices_default\n unconfig_tacacs\n end", "def create_cluster(opts)\n opts = check_params(opts,[:cluster_ips,:netmasks])\n super(opts)\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 aws_security_group_egress_params\n params.require(:aws_security_group_egress).permit(:security_group_id, :egress_id, :ip_protocol, :from_port, :to_port)\n end", "def new\n @host_group = Hostgroup.new\n end", "def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(opts)\n opts = check_params(opts,[:admin_ips,:netmasks])\n super(opts)\n end", "def generate\n xorkey, rc4key = rc4_keys(datastore['RC4PASSWORD'])\n conf = {\n port: datastore['LPORT'],\n xorkey: xorkey,\n rc4key: rc4key,\n reliable: false\n }\n\n # Generate the more advanced stager if we have the space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp_rc4(conf)\n end", "def create_shared_ip_group(options)\n data = JSON.generate(:sharedIpGroup => options)\n response = csreq(\"POST\",svrmgmthost,\"#{svrmgmtpath}/shared_ip_groups\",svrmgmtport,svrmgmtscheme,{'content-type' => 'application/json'},data)\n CloudServers::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n ip_group = JSON.parse(response.body)['sharedIpGroup']\n CloudServers::SharedIPGroup.new(self,ip_group['id'])\n end", "def authorize_db_security_group_ingress(name, opts={})\n unless opts.key?('CIDRIP') || ((opts.key?('EC2SecurityGroupName') || opts.key?('EC2SecurityGroupId')) && opts.key?('EC2SecurityGroupOwnerId'))\n raise ArgumentError, 'Must specify CIDRIP, or one of EC2SecurityGroupName or EC2SecurityGroupId, and EC2SecurityGroupOwnerId'\n end\n\n request({\n 'Action' => 'AuthorizeDBSecurityGroupIngress',\n :parser => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,\n 'DBSecurityGroupName' => name\n }.merge(opts))\n end", "def build_security_groups(entity)\n security_groups = []\n security_group_id = entity.network_security_group&.id&.downcase\n if security_group_id\n security_groups << persister.security_groups.lazy_find(security_group_id)\n end\n\n security_groups\n end", "def create_security_group(name, description)\n action = 'CreateSecurityGroup'\n params = {\n 'Action' => action,\n 'GroupName' => name,\n 'GroupDescription' => description\n }\n\n response = send_query_request(params)\n response.is_a?(Net::HTTPSuccess)\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 generate\n xorkey, rc4key = rc4_keys(datastore['RC4PASSWORD'])\n conf = {\n port: datastore['LPORT'],\n xorkey: xorkey,\n rc4key: rc4key,\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp_rc4(conf)\n end", "def security_groups\n catch_aws_errors do\n @security_groups ||= instance.security_groups.map do |sg|\n { id: sg.group_id, name: sg.group_name }\n end\n end\n end", "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "def security_group_params\n params.require(:security_group).permit(:data)\n end", "def createGroup\n call :createGroup\n end", "def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n Puppet.debug(\"Calling create method of security_policy_parameter_protectionprovider: \")\n end", "def ec2_security_groups\n data.ec2_security_groups\n end", "def build_resource(hash = nil)\n super(hash)\n resource.role = User::GROUP_MEMBER_ROLE\n end", "def reserved_ports\n ports = []\n ports.push(443)\n ports.push(8484)\n ports.push(80)\n ports.push(22)\n ports.push(808)\n ports\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_db_security_group_ingress(name, opts={})\n unless opts.key?('CIDRIP') || (opts.key?('EC2SecurityGroupName') && opts.key?('EC2SecurityGroupOwnerId'))\n raise ArgumentError, 'Must specify CIDRIP, or both EC2SecurityGroupName and EC2SecurityGroupOwnerId'\n end\n\n request({\n 'Action' => 'AuthorizeDBSecurityGroupIngress',\n :parser => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,\n 'DBSecurityGroupName' => name\n }.merge(opts))\n\n end" ]
[ "0.6960418", "0.68461275", "0.67666686", "0.6735143", "0.672424", "0.66636515", "0.6518181", "0.6365194", "0.6365194", "0.63321275", "0.62130576", "0.61536574", "0.6109729", "0.59928954", "0.59671044", "0.5956372", "0.59492046", "0.59347475", "0.5888241", "0.58338535", "0.58306205", "0.5824985", "0.5775924", "0.5761627", "0.5748217", "0.57419616", "0.5692056", "0.5664878", "0.56398374", "0.5632552", "0.56171256", "0.5594043", "0.558564", "0.55783945", "0.5561247", "0.5552465", "0.55521685", "0.55456245", "0.5517748", "0.5499594", "0.5497302", "0.5482344", "0.54776853", "0.5474566", "0.5450913", "0.5450387", "0.5446247", "0.5442226", "0.54334617", "0.54026425", "0.54019195", "0.5394756", "0.5383406", "0.5383406", "0.5379471", "0.53504884", "0.5311486", "0.5301301", "0.5301301", "0.5293477", "0.52877325", "0.52433217", "0.52100205", "0.51836866", "0.5182706", "0.5179059", "0.51724285", "0.51628053", "0.51530695", "0.5140406", "0.5140406", "0.5139734", "0.51317143", "0.5128469", "0.5118919", "0.51180565", "0.5102818", "0.5095261", "0.5086246", "0.50853485", "0.5084853", "0.50839055", "0.50810486", "0.5051937", "0.5049936", "0.50490963", "0.50478613", "0.5040921", "0.5038077", "0.5037512", "0.50358754", "0.5035372", "0.50346625", "0.50156724", "0.5013947", "0.5008884", "0.50061584", "0.500405", "0.50019675", "0.4992625" ]
0.64533263
7
TODO: only allow destroy if not used on any closed invoices
def destroy destroy! do |format| format.html{ redirect_to @awarded_promotion.get_redirect_to_url(self) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @invoice.destroy\n end", "def destroy\n @invoice = current_organization.invoices.find(params[:id])\n @invoice.destroy\n \n redirect_to(invoices_url)\n end", "def destroy\n if @invoice.status == 'fresh'\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to invoices_url\n flash[:danger] = 'You can delete only fresh invoices.'}\n format.json {render nothing: true}\n end\n end\n end", "def delete_invoices\n self.invoices.delete_all\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n redirect_to invoices_url\n end", "def rebuild_invoice\n end", "def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end", "def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy \n\n @user = current_user\n @invoice = @user.invoices.find(params[:id])\n @invoice.destroy \n\n redirect_to invoices_path \n end", "def update_invoice\n if invoice.registrations.any?\n invoice.update_paid\n else\n invoice.destroy\n end\n end", "def delete\n authorize!(:delete,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @invoice = Invoice.find(params[:id])\n if @invoice.payments.empty?\n InvoiceDetail.delete_all(:invoice_id=>params[:id])\n @invoice.delete\n flash[:notice] = \"#{t(:text_invoices)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n else\n flash[:error] = t(:flash_invoice_cannot_deleted)\n end\n respond_to do |format|\n format.html { redirect_to :action=>'index'}\n format.xml { head :ok }\n end\n end", "def invoice\n raise \"override in purchase_order or sales_order\"\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def check_for_invoice\n unless self.invoice_id.blank?\n errors.add(:amount, \"This bill is invoiced and cannot be deleted\")\n throw :abort\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice.destroy\n\n head :no_content\n end", "def teardown\n\t\t@invoice = nil\n\tend", "def destroy\n @invoice_type.destroy\n end", "def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @invoice.destroy\n @invoice.update_attributes(is_deleted: true,status_id: 4)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n flash[:notice] = \"Successfully destroyed Invoice\"\n redirect_to @invoice\n end", "def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @invoice = Invoice.find(params[:id])\r\n @retail_plan = RetailPlan.find(@invoice.retail_plan_id)\r\n billing_site_id = @retail_plan.billing_site_id\r\n @invoice.destroy\r\n redirect_to billing_site_url(billing_site_id), notice: 'Invoice has been destroyed successfully !'\r\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: \"Invoice was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @invoice.destroy\r\n authorize @invoice\r\n respond_to do |format|\r\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def load_voices\n # TODO\n end", "def destroy\n respond_to do |format|\n if @invoice.destroy\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n else\n format.html { render \"show\", notice: \"You cannot delete this invoice because your website is using it.\" }\n format.json { head :no_content }\n end\n end\n end", "def create_invoice\n self.invoice = match.invoices.create unless invoice\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html do\n redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' unless htmx_request?\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplier_invoice = SupplierInvoice.find(params[:id])\n\n respond_to do |format|\n if @supplier_invoice.destroy\n format.html { redirect_to supplier_invoices_url,\n notice: (crud_notice('destroyed', @supplier_invoice) + \"#{undo_link(@supplier_invoice)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to supplier_invoices_url, alert: \"#{@supplier_invoice.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @supplier_invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Devis supprime.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cash_invoice.destroy\n render 'action'\n end", "def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_invoice.destroy\n respond_to do |format|\n format.html { redirect_to payment_invoices_url }\n format.json { head :no_content }\n end\n end", "def build_invoice\n raise \"override in purchase_order or sales_order\"\n end", "def check_unresolved_invoices\n return true if !invoices.unresolved.exists? || should_be_deleted?\n errors.add(:invoices, :unresolved_invoices)\n throw :abort\n end", "def destroy\n @order_invoice.destroy\n respond_to do |format|\n format.html { redirect_to order_invoices_url, notice: 'Order invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @incominginvoice.destroy\n respond_to do |format|\n format.html { redirect_to incominginvoices_url, notice: 'Incominginvoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:invoice_id])\n @client = @invoice.clients.find(params[:id])\n @client.destroy\n redirect_to invoice_path(@invoice)\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to project_invoices_path(@invoice.project)}\n format.xml { head :ok }\n end\n end", "def create_replacement\n new_invoice = self.clone\n new_invoice.document_number = Numerator.get_number\n old_invoice = self\n old_invoice.status_constant = Invoice::CANCELED\n old_invoice.order_id = nil\n old_invoice.lines.each do |line|\n new_invoice.invoice_lines << line.clone\n line.order_id = nil # Disassociate the order so that things don't appear twice on orders just because there is a replacement invoice\n line.save\n end\n new_invoice.save\n old_invoice.replacement = new_invoice\n old_invoice.save\n return new_invoice\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n\n @customer = Customer.find_by_id(params[:customer_id])\n #@invoice.customer_id = @customer.id\n\n\n\n @invoice.destroy\n\n# respond_to do |format|\n# format.html { redirect_to (customer_path(@invoice.customer_id), :notice => 'Invoice was successfully deleted.') }\n# format.xml { head :ok }\n# end\n end", "def destroy\n @pln_invoice.destroy\n respond_to do |format|\n format.html { redirect_to pln_invoices_url, notice: 'pln_invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n run_callbacks :destroy do\n #the insurance billing record status need to be revertd back so it appears in the claims outstanding box\n #dont know if it was submitted or printed, so use error as a revert\n self.insurance_billing.revert_to_previous_status if !self.insurance_billing_id.blank?\n self.update_column(:deleted, true)\n end\n end", "def build_invoice\n raise \"override in purchase_order or sales_order\"\n end", "def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end", "def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end", "def destroy\n @collection_invoice = CollectionInvoice.find(params[:id])\n @collection_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoicedetail.destroy\n respond_to do |format|\n format.html { redirect_to invoicedetails_url, notice: 'Invoicedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def void\n \n resp = StdClass.new\n t = InvoiceTransaction.where(:invoice_id => self.id, :transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"This invoice has already been captured, you will need to refund instead\"\n elsif t.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config\n ot = Caboose::InvoiceTransaction.new(\n :invoice_id => self.id,\n :date_processed => DateTime.now.utc,\n :transaction_type => InvoiceTransaction::TYPE_VOID,\n :payment_processor => sc.pp_name,\n :amount => self.total\n )\n \n case sc.pp_name\n when 'authorize.net' \n response = AuthorizeNet::SIM::Transaction.new(\n sc.authnet_api_login_id, \n sc.authnet_api_transaction_key, \n self.total,\n :transaction_type => InvoiceTransaction::TYPE_VOID,\n :transaction_id => t.transaction_id,\n :test => sc.pp_testing\n ) \n self.update_attributes(\n :financial_status => Invoice::FINANCIAL_STATUS_VOIDED,\n :status => Invoice::STATUS_CANCELED\n )\n self.save \n # TODO: Add the variant quantities invoiceed back \n resp.success = \"Invoice voided successfully\"\n \n ot.success = response.response_code && response.response_code == '1' \n ot.transaction_id = response.transaction_id\n #ot.auth_code = response.authorization_code\n ot.response_code = response.response_code \n ot.save\n \n when 'stripe'\n # TODO: Implement void invoice for strip\n \n when 'payscape'\n # TODO: Implement void invoice for payscape\n \n end\n \n end\n return resp \n end", "def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end", "def create_invoice\n invoice_data = {\n payplan_id: self.payplan.id, \n payertype: \"fiz\", \n paymenttype: \"creditcard\", \n service_handle: self.payplan.service_handle \n }\n if self.status\n if self.payplan_id == Payplan.favorite_free_id\n invoice = Invoice.create(invoice_data.merge!(status: \"Оплачен\"))\n payment = invoice.get_payment.update(paymentdate: Date.today, status: \"Оплачен\")\n else\n invoice = Invoice.create(invoice_data)\n end\n end\nend", "def destroy\n session[:return_to] ||= request.referer # record where the user came from so we can return them there after the save\n \n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to session.delete(:return_to) }\n format.json { head :no_content }\n end\n end", "def destroy\n @proforma_invoice.destroy\n respond_to do |format|\n format.html { redirect_to proforma_invoices_url, notice: 'Proforma invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Fatura başarıyla silindi.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #ヘッダIDをここで保持(内訳・明細も消すため)\n @invoice_header_id = @invoice_header.id\n\n @invoice_header.destroy\n respond_to do |format|\n format.html { redirect_to invoice_headers_url, notice: 'Invoice header was successfully destroyed.' }\n format.json { head :no_content }\n end\n\t\n #資金繰りのデータも削除 (add200127)\n args = [\"DELETE FROM account_cash_flow_detail_actual where invoice_header_id = ?\" , \n @invoice_header_id]\n sql = ActiveRecord::Base.send(:sanitize_sql_array, args)\n result_params = ActiveRecord::Base.connection.execute(sql)\n #add end \n \n #内訳も消す\n InvoiceDetailLargeClassification.where(invoice_header_id: @invoice_header_id).destroy_all\n\n #明細も消す\n InvoiceDetailMiddleClassification.where(invoice_header_id: @invoice_header_id).destroy_all\n \n #add230125\n #入金・日次入出金ファイルをここで抹消\n destroy_deposit\n delete_daily_cash_flow\n end", "def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end", "def mark_as_closed \n if @invoice.paid?\n @invoice.listings.find_each do |listing|\n inv_list = Invoice.where(status: 'unpaid').joins(:invoice_details).where(\"`invoice_details`.`pixi_id` = ?\", listing.pixi_id).readonly(false)\n inv_list.find_each do |inv|\n inv.update_attribute(:status, 'closed') if inv.pixi_count == 1 && inv.id != @invoice.id && inv.buyer_id == @invoice.buyer_id\n end\n end\n end\n end", "def generate_invoices_status\n MorLog.my_debug \" ********* \\n for period #{session_from_date} - #{session_till_date}\"\n change_date\n MorLog.my_debug \"for period #{session_from_date} - #{session_till_date}\"\n\n unless params[:invoice]\n dont_be_so_smart\n redirect_to(:root) && (return false)\n end\n owner_id = correct_owner_id\n if params[:date_issue].present?\n issue_date = Time.mktime(params[:date_issue][:year],\n params[:date_issue][:month],\n params[:date_issue][:day])\n end\n\n type = %W[postpaid prepaid user].include?(params[:invoice][:type].downcase)? params[:invoice][:type] : 'postpaid'\n\n from_time = Time.parse(session_from_datetime_no_timezone)\n till_time = Time.parse(session_till_datetime_no_timezone)\n\n if type == 'user'\n @user = User.where(['users.id = ?', params[:s_user_id]]).first if params[:s_user_id]\n unless @user\n flash[:notice] = _('User_not_found')\n redirect_to(action: :generate_invoices) && (return false)\n end\n valid_period = validate_period_user(@user, till_time)\n else\n valid_period = validate_period(type, till_time)\n end\n\n redirect_to(action: :generate_invoices) && (return false) unless valid_period\n\n if from_time > till_time\n flash[:notice] = _('Date_from_greater_thant_date_till')\n redirect_to(action: :generate_invoices) && (return false)\n end\n\n invoice_type_confline = (type == 'prepaid' && (admin? || accountant?)) ? 'Prepaid_' : ''\n invoice_number_type = Confline.get_value(\"#{invoice_type_confline}Invoice_Number_Type\", owner_id).to_i\n\n unless [1, 2].include?(invoice_number_type)\n flash[:notice] = _('Please_set_invoice_params')\n usertype = session[:usertype].to_s\n unless accountant?\n if %w(reseller partner).include?(usertype)\n redirect_to(controller: 'functions', action: \"#{usertype}_settings\") && (return false)\n else\n redirect_to(controller: 'functions', action: 'settings') && (return false)\n end\n else\n redirect_to(action: 'generate_invoices') && (return false)\n end\n end\n BackgroundTask.create(\n task_id: 5,\n owner_id: owner_id,\n created_at: Time.now,\n status: 'WAITING',\n user_id: params[:s_user_id].present? ? params[:s_user_id].to_i : -2,\n data1: session_from_datetime_no_timezone,\n data2: session_till_datetime_no_timezone,\n data3: type,\n data4: issue_date.to_s,\n data5: params[:currency]\n )\n system(\"/usr/local/mor/mor_invoices elasticsearch &\")\n flash[:status] = _('bg_task_for_generating_invoice_successfully_created')\n if admin?\n redirect_to(controller: 'functions', action: 'background_tasks') && (return false)\n else\n redirect_to(action: 'invoices') && (return false)\n end\n end", "def invoice_events\n require_event_type('invoice')\n subscription_id = params['data']['object']['subscription']\n subscription = Subscription.find_by_stripe_subscription_id(subscription_id)\n stripe_invoice_id = params['data']['object']['id']\n invoice = Invoice.where(:stripe_invoice_id => stripe_invoice_id).first\n if (invoice)\n invoice.update_attributes(:body => params['data']['object'])\n else\n Invoice.create({\n :subscription_id => subscription.id,\n :company_id => subscription.company_id,\n :stripe_invoice_id => stripe_invoice_id,\n :body => params['data']['object']\n })\n end\n invoice_hook = params['type'].split('.')[1]\n subscription.update_state_for_invoice_hook(invoice_hook, params['data']['object'])\n subscription.record_event_for_invoice_hook(invoice_hook, params['data']['object'])\n head :no_content\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoice_numbers_url, notice: 'Invoice number was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_invoice.destroy\n respond_to do |format|\n format.html { redirect_to service_invoices_url, notice: 'Service invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_header = InvoiceHeader.find(params[:invoice_header_id])\n @payment = @invoice_header.payments.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.generate_invoice_extra_entry(@current_user,{\"payment_medium\"=>\"paypal\"} )\n else\n @invoice = order.generate_invoice(@current_user, {\"payment_medium\"=>\"paypal\"}) \n end \t\n @invoice.validating(\"paypal\")\n session[:current_object].invoice = @invoice\n session[:current_object].save\n p session[:userid]\n if session[:userid].blank?\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,order.id])\n \n else\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",session[:userid],order.id])\n \n end\n \n if order.instance_of? CompetitionsUser\n note = \"no note created\"\n note = order.competition.timing.note if order.competition.timing \n \n start_date = order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n p \"the invoice is blank\"\n p invoice\n if invoice \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n else\n p \"i dont have invoice created\"\n end\n elsif order.instance_of? ExhibitionsUser\n note = \"no note created\"\n note = order.exhibition.timing.note if order.exhibition.timing \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n email= UserMailer.create_send_invoice(invoice,@current_user)\n UserMailer.deliver(email)\n rescue => e\n logger.info \"there is error while sending the email\"\n logger.info e\n end\n end", "def invoice\n @invoice ||= Invoice.find(params[:id])\n end", "def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend", "def invoice_id\n @invoice_id if @invoice_id\n end", "def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n if @order.instance_of? CompetitionsUser\n note = \"no notes created\"\n note = @order.competition.timing.note if @order.competition.timing\n start_date = @order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = @order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if invoice\n\n p \"fdfgffggfdgfgd\"\n\n \n p \"i got the invoice and creating pdf\"\n\n create_pdf(invoice.id,invoice.number,start_date,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,invoice.final_amount.to_i,0,false,end_date)\n end \n else\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n end\n elsif @order.instance_of? ExhibitionsUser\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n\n # email= UserMailer.create_send_invoice(invoice,@current_user)\n # UserMailer.deliver(email)\n\n p \"sending the emaillll\"\n email= UserMailer.create_send_invoice(invoice,@current_user)\n #UserMailer.deliver(email)\n\n rescue\n end\n session[:total_entry] = nil \n if @invoice.purchasable_type == \"Order\"\n session[:cart]=nil\n end\n end", "def cancel_now_and_invoice\n as_stripe_subscription.cancel({\n invoice_now: true,\n prorate: proration_behavior == 'create_prorations',\n })\n\n mark_as_cancelled\n\n self\n end", "def destroy\n\n InventoryOwn.transaction do\n @inventory_own.deleted = true\n @inventory_own.save\n\n user_id = @inventory_own.user_id\n\n #If the book being removed is involved in a trade, email other users involved in trade that the trade\n #has been cancelled\n @trades = @inventory_own.trades\n debugger\n @trades.each do |trade|\n\n if not trade.declined?\n trade.user_decline(user_id, \"Sorry, I removed this item from my have list.\")\n\n @trade_lines = trade.get_tradelines_except(user_id)\n @trade_lines.each do |line|\n UserMailer.trade_destroyed(line.inventory_own.user, trade).deliver\n end\n end\n end\n\n end\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def create\n @customer = Customer.find_by_id(params[:customer_id])\n #@customer = Customer.find_by_id(@invoice.customer_id)\n @invoice = Invoice.new(params[:invoice])\n #@invoice.customer_id = @customer.id\n if @invoice.category.nil? then @invoice.category = \"Redmond\" end\n if @invoice.paid.nil? then @invoice.paid = false end\n\n @invoice.timestamp = Time.now\n @invoice.date = Time.now\n @invoice.employee = current_user.email\n #@invoice.ticket_id = params[:invoice_id].to_i if params[:invoice_id]\n\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n customer_invoice_last = @customer_invoice.sales_order.cost_center_id\n if @customer_invoice.destroy\n recalculate_cost_center(customer_invoice_last)\n render :json => @customer_invoice\n else \n render :json => @customer_invoice.errors.full_messages\n end\n end", "def destroy\n @sale_invoice = SaleInvoice.find(params[:id])\n @sale_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_movement_sale_invoices_url }\n format.json { head :ok }\n end\n end", "def destroy\n @invoice_history.destroy\n respond_to do |format|\n format.html { redirect_to invoice_histories_url, notice: \"Invoice history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n flash_message(:success, \"Invoice was successfully deleted.'\")\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n format.js {render js:'window.location.reload();'}\n end\n end", "def has_invoice?\n !self.freshbooks_invoice_id.nil?\n end" ]
[ "0.69884855", "0.6904366", "0.6831483", "0.68082774", "0.6807483", "0.677839", "0.67658603", "0.66700685", "0.66537064", "0.66427433", "0.65971416", "0.65868616", "0.6534544", "0.6530909", "0.65227056", "0.65227056", "0.65227056", "0.65227056", "0.6503409", "0.6502425", "0.6502425", "0.6502425", "0.6502425", "0.6502425", "0.64831036", "0.64801145", "0.6474059", "0.64731073", "0.64540535", "0.64398444", "0.64396197", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.6419044", "0.64186525", "0.6405572", "0.64002055", "0.63952845", "0.6383269", "0.6367647", "0.63543093", "0.63511354", "0.63291013", "0.63060695", "0.62949497", "0.6292333", "0.62896955", "0.6255988", "0.6249316", "0.62242377", "0.6219307", "0.6210398", "0.6209685", "0.62081414", "0.62069935", "0.61967176", "0.61932206", "0.61904156", "0.6169793", "0.6155272", "0.6150858", "0.6149884", "0.6144023", "0.6103027", "0.6102303", "0.6073223", "0.6068111", "0.60637844", "0.6051511", "0.60285413", "0.60120994", "0.60086274", "0.6005145", "0.5998092", "0.5995077", "0.5978141", "0.59757835", "0.59757483", "0.59736216", "0.59715575", "0.59709924", "0.59594756", "0.594744", "0.5943233", "0.5941411", "0.5938594", "0.593303", "0.5924975", "0.591423", "0.59140986", "0.59112537", "0.5909852", "0.59032106" ]
0.0
-1
PUT /resource We need to use a copy of the resource because we don't want to change the current user in place.
def update params[:user][:role_ids] ||= [] self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) if resource.update_with_password(params[resource_name]) if is_navigational_format? if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation? flash_key = :update_needs_confirmation end set_flash_message :notice, flash_key || :updated end sign_in resource_name, resource, :bypass => true respond_with resource, :location => after_update_path_for(resource) else clean_up_passwords resource respond_with resource end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end", "def set_resource\n @user = current_user\n @resource = Resource.find(params[:id])\n end", "def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end", "def update_resource(resource, params)\n resource.role_id = 1\n resource.update_without_password(params)\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end", "def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end", "def put(resource, **params)\n\n execute(Net::HTTP::Put, 'PUT', resource, **params)\n\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end", "def update\n @user_resource = UserResource.find(params[:id])\n\n respond_to do |format|\n if @user_resource.update_attributes(params[:user_resource])\n format.html { redirect_to user_preferences_path(@user), notice: 'User resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resource(resource, params)\n check_id_uniformity(params)\n resource.assign_attributes(json_api_attributes(params))\n authorize resource, :update?\n resource.save!\n resource\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update\n if @resource.update(resource_params)\n flash[:notice] = notification_message('edit_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('edit_failure') }, status: :unprocessable_entity\n end\n end", "def manage_resource(resource)\n unless resource.is_a?(OMF::SFA::Model::Resource)\n raise \"Resource '#{resource}' needs to be of type 'Resource', but is '#{resource.class}'\"\n end\n\n resource.account_id = _get_nil_account.id\n resource.save\n resource\n end", "def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end", "def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update_resource(resource, params)\n resource.update_with_password(params)\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n @resource.saved_by(current_admin)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(resource, attributes = {})\n resource.client = self\n resource.update(attributes)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update_resource(resource_desc, resource_type, authorizer, new_attributes)\n resource = find_resource(resource_desc, resource_type, authorizer)\n authorizer.can_modify_resource?(resource, resource_type)\n resource.update(new_attributes)\n resource\n end", "def update_resource(object, attrs)\n object.update_with_password(*attrs)\n end", "def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end", "def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n check_action_whitelisted!(params[:action])\n authorize! params[:action].to_sym, resource\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def update\n authorize! :update, resource\n current_model_service.update resource, params\n yield if block_given? # after_update\n respond_with resource, location: helpers.show_path(resource)\n end", "def update(resource, id, format=@default_format)\n options = { resource: resource.class, id: id, format: format }\n reply = put resource_url(options), resource, fhir_headers(options)\n reply.resource = parse_reply(resource.class, format, reply)\n reply.resource_class = resource.class\n reply\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_resource(resource, params)\n if [\"facebook\", \"github\", \"google_oauth2\"].include? current_user.provider\n params.delete(\"email\")\n params.delete(\"avatar\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end", "def update!(**args)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n end", "def update\n @resource = Resource.find(params[:id])\n\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n redirect_to @resource\n else\n render :action => \"edit\"\n end\n end", "def new\n super\n @resource.user = current_user\n end", "def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end", "def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! params[:entity]\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update_profile_resource(resource, params)\n resource.update_without_password(params)\n end", "def resource=(new_resource)\n @resource = @resource.merge(new_resource)\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end", "def update\n user = self.resource = User.to_adapter.get!(send(:\"current_user\").to_key)\n\n if user.update_with_password(resource_params)\n set_flash_message :notice, :updated\n sign_in resource_name, user, :bypass => true\n respond_with user, :location => after_update_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:success] = 'Resource was successfully updated.'\n format.html { redirect_to admin_resource_path(@resource.id) }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end", "def put(request, response)\n @resource.put(request, response)\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def put(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}\"\n response = ApiClient::Dispatcher.put(url, self.to_hash, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end", "def update\n @resource = Resource.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully updated.') }\n format.xml { head :ok }\n else\n get_resource_info\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end", "def put!\n request! :put\n end", "def find_and_update_resource\n model = class_name.find(params[:id])\n model.tap do |m|\n m.update get_secure_params\n set_resource_ivar m\n end\n end", "def update_resource(object, attributes)\n object.update(*attributes)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update_card_resource(card_id, resource, *paths)\n paths, options = extract_options(camp(resource), *paths)\n put card_path(card_id, *paths), options\n end", "def put(name,&block)\n build_resource(name, :put, &block)\n end", "def update_resource(resource, params)\n if !current_user.provider.nil?\n params.delete(\"current_password\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end", "def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end", "def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def update\n # make sure user is authorized\n unless @resource\n return render json: {\n success: false,\n errors: ['Unauthorized']\n }, status: 401\n end\n\n # ensure that password params were sent\n unless password_resource_params[:password] and password_resource_params[:password_confirmation]\n return render json: {\n success: false,\n errors: ['You must fill out the fields labeled \"password\" and \"password confirmation\".']\n }, status: 422\n end\n\n if @resource.update_attributes(password_resource_params)\n return render json: {\n success: true,\n data: {\n user: @resource,\n message: \"Your password has been successfully updated.\"\n }\n }\n else\n return render json: {\n success: false,\n errors: @resource.errors\n }, status: 422\n end\n end", "def update!(**args)\n @granted = args[:granted] if args.key?(:granted)\n @permission = args[:permission] if args.key?(:permission)\n @resource = args[:resource] if args.key?(:resource)\n @resource_attributes = args[:resource_attributes] if args.key?(:resource_attributes)\n end", "def save_resource\n resource.save\n end", "def accept_resource\n resource = resource_class.accept_invitation!(update_resource_params)\n @user = User.find(resource.invited_by_id)\n resource.company_id = @user.company.id\n resource.save\n resource\n end", "def update!(**args)\n @resource_key = args[:resource_key] if args.key?(:resource_key)\n end", "def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params['password']&.present?\n\n # Allows user to update registration information without password.\n resource.update_without_password(params.except('current_password'))\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n\n if resource.update_attributes(params[resource_name])\n if is_navigational_format?\n if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?\n flash_key = :update_needs_confirmation\n end\n set_flash_message :notice, flash_key || :updated\n end\n sign_in resource_name, resource, :bypass => true\n respond_with resource, :location => after_update_path_for(resource)\n else\n clean_up_passwords resource\n respond_with resource\n end\n end", "def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params[\"password\"]&.present?\n # Allows user to update registration information without password.\n resource.update_without_password(params.except(\"current_password\"))\n end" ]
[ "0.7224541", "0.700414", "0.6980963", "0.6971368", "0.6954467", "0.69530743", "0.6754272", "0.6744999", "0.67417157", "0.67165345", "0.67165345", "0.6707067", "0.6707067", "0.6707067", "0.6707067", "0.6707067", "0.6707067", "0.6707067", "0.6707067", "0.6703914", "0.6699215", "0.6694407", "0.66859937", "0.6681915", "0.6664999", "0.6660764", "0.6644141", "0.6626805", "0.6626805", "0.6626805", "0.6626805", "0.6626805", "0.6626805", "0.6626805", "0.6577155", "0.6563974", "0.65400755", "0.6510835", "0.65106446", "0.65090066", "0.64336973", "0.6427195", "0.63890016", "0.63821745", "0.63821745", "0.6343938", "0.6326809", "0.63196135", "0.63130647", "0.6303804", "0.62851787", "0.6275551", "0.6275235", "0.6259522", "0.6259183", "0.6250705", "0.6233134", "0.6233134", "0.6232381", "0.6222466", "0.62158287", "0.62052673", "0.6185241", "0.6176471", "0.6167724", "0.6164693", "0.6158259", "0.6150052", "0.6148374", "0.6147745", "0.61450607", "0.61338395", "0.6132919", "0.61273265", "0.61272454", "0.61258703", "0.61258703", "0.6117413", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6117224", "0.6113116", "0.6109723", "0.61055833", "0.61032087", "0.60999405", "0.6093108", "0.60882163", "0.60882163", "0.60881233", "0.60851026", "0.60835797" ]
0.0
-1
serialize the hash into json and save in a cookie add to the responses cookies
def store_session(res) cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json) res.cookies << cookie end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end", "def serialize_into_cookie(record); end", "def encode_to_cookie h, cookie\n cookie[@name] = encode h\n end", "def serialize_from_cookie(*args); end", "def serialize_into_cookie\n [uid, self.remember_token]\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def save( response )\n\t\tself.log.debug \"Saving session %s\" % [ self.session_id ]\n\t\tself.class.save_session_data( self.session_id, @hash )\n\t\tself.log.debug \"Adding session cookie to the response.\"\n\n\t\tsession_cookie = Strelka::Cookie.new(\n\t\t\tself.class.cookie_name,\n\t\t\tself.session_id,\n\t\t\tself.class.cookie_options || {}\n\t\t)\n\n\t\tresponse.cookies << session_cookie\n\tend", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def to_hash\n cookies = {}\n\n @cookies.each do |cookie|\n cookies[cookie.name] = cookie.value\n end\n\n cookies\n end", "def store_session(res)\n cookie = { path: '/', value: @cookie_hash.to_json }\n res.set_cookie(\"_rails_lite_app\", cookie )\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new(\"_flash\", @flash_hash.to_json)\n end", "def set_hash_and_json\n @hash = {header: @header, payload: @payload, signature: encode(@signature)}\n @json = \"#{@header.to_json}.#{@payload.to_json}.#{encode(@signature)}\"\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_lite_flash\", @stuff.to_json)\n cookie.path = \"/\"\n res.cookies << cookie\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def load_cookie_jar_json(jar, data)\n VkMusic.log.info('cookie_reader') { 'Loading JSON cookies' }\n JSON.parse(data).each_pair do |k, v|\n jar.add(URI('https://m.vk.com'), HTTP::Cookie.new(k, v))\n end\n end", "def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def cookie_value\n @screen_data.to_json\n end", "def store_session(res)\n attributes = { path: '/', value: @cookie.to_json }\n res.set_cookie('_rails_lite_app', attributes)\n #store_session(response) that will put the session into a cookie\n# and set it using Rack::Response#set_cookie.\n# The first argument to #set_cookie is the name of the cookie which\n# should be _rails_lite_app.\n# The second argument is the cookie attributes. These are merely a hash\n# of path: ..., value: ..., where path is the path where our cookie is\n# available and value is a string. Since we want to pass a collection\n# (our session store) in the cookie, we can serialize our instance\n# variable using JSON. The path should be / (our root url) so the cookie\n# will available at every path.\n# NB: In order for this to work properly, the path and value keys in\n# your hash must be symbols, not strings.\n end", "def store_session(res)\n res.set_cookie(\"_rails_lite_app\", { path: \"/\", value: \"#{@cookie.to_json}\" })\n # p res\n # res[\"_rails_lite_app\"] = @cookie.to_json\n end", "def serialize\n JSON.dump(@hash)\n end", "def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @session.to_json)\n res.cookies << cookie\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @flash_hash.to_json)\n end", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def store_session(res)\n res.set_cookie(@cookie.to_json)\n debugger\n end", "def collect_cookies_from_response; end", "def save_session(r)\n return r if !r.is_a?(Array) || (r.is_a?(Array) && r[0] == -1)\n\n unless @hash.empty?\n data = cipher(:encrypt, Marshal.dump(@hash)) rescue nil\n c = {\n value: data,\n path: '/',\n }\n\n if !@opts[:domain].nil?\n c[:domain] = @opts[:domain]\n elsif @host&.match(%r{^[a-zA-Z]})\n c[:domain] = @host\n end\n\n c[:httponly] = @opts[:http_only] === true\n if @opts.has_key?(:expires)\n c[:expires] = Time.at(Time.now + @opts[:expires])\n end\n\n r[1]['Set-Cookie'] = nil if @opts[:clear_cookies]\n r[1]['Set-Cookie'] = Rack::Utils.add_cookie_to_header(\n r[1]['Set-Cookie'], @opts[:cookie_name], c\n ) unless data.nil?\n end\n\n @cb.call(r) if @cb\n r\n end", "def to_json(*a)\n {\n 'json_class' => self.class.name,\n 'cookies' => to_a.to_json(*a)\n }.to_json(*a)\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end", "def store_session(res)\n app_crumb = WEBrick::Cookie.new(\"_rails_lite_app\", @session_values.to_json)\n\n res.cookies.concat([app_crumb])\n end", "def decode cookie\n data = cookie[@name].to_s\n return empty_hash if data.empty?\n\n sig, str = data.split '/', 2\n return empty_hash unless str\n\n h = nil\n digest = nil\n begin\n sig = decode64 sig\n digest = @dss.digest str\n if @dsa.sysverify(digest, sig)\n str = @cipher_key ? decipher(str) : decode64(str)\n h = JSON.parse str, JSON_DECODE_OPTS\n end\n ensure\n return empty_hash unless h\n end\n\n if h.is_a?(Session)\n h.instance_variable_set :@init_digest, digest\n h.instance_variable_set :@init_data, data\n h\n else\n empty_hash\n end\n end", "def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end", "def store_flash(res)\n serialized_flash = @later.to_json\n res.cookies << WEBrick::Cookie.new(\"_rails_lite_flash\" , serialized_flash)\n end", "def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend", "def store(fortune_cookie_text)\n hash = msg(fortune_cookie_text)\n puts \"Stored cookie: #{fortune_cookie_text}\"\n puts \"Cookie ID: #{hash}\"\n return hash\n end", "def add_to_cookie_2 (id)\n cookies[:scotids] ? cookies[:scotsids] = JSON.parse(cookies[:scotsids]) << \"#{id}\" : cookies[:scotsids] = JSON.generate([\"#{id}\"])\n end", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def to_cookie\n unless self.empty?\n data = self.serialize\n value = Merb::Parse.escape \"#{data}--#{generate_digest(data)}\"\n if value.size > MAX\n msg = \"Cookies have limit of 4K. Session contents: #{data.inspect}\"\n Merb.logger.error!(msg)\n raise CookieOverflow, msg\n end\n value\n end\n end", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def cookies(cookies); end", "def cookie_to_mash(headers)\n if headers && headers.is_a?(Faraday::Utils::Headers)\n cookie = headers_to_mash(headers).set_cookie\n if cookie\n sanitized_cookie = cookie.split(/\\;/).map{|x|\n key,value = x.split(\"=\");\n {key.strip.gsub(/\\W/,\"_\").gsub(/^\\_|\\_$/,\"\").to_sym => value.to_s.downcase.strip}\n }\n return sanitized_cookie.reduce Hashie::Mash.new, :merge\n end\n end\n end", "def store_session(res)\n res.set_cookie('_req_room_session', path: '/', value: data.to_json)\n end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def hashcookie\n cookies[daw_cookie_name] && Digest::SHA1.hexdigest(cookies[daw_cookie_name])\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @persist.to_json)\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookie_jar=(cookie_jar); end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_flash_rails_lite_app', @flash.to_json)\n res.cookies << cookie\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app_flash', flash.to_json)\n cookie.path = '/'\n res.cookies << cookie\n end", "def cookie_jar=(_arg0); end", "def cookie_jar=(_arg0); end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def serialize(hash, salt)\n hash + salt\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def unmarshal(cookie)\n if cookie.blank?\n {}\n else\n data, digest = Merb::Parse.unescape(cookie).split('--')\n return {} if data.blank? || digest.blank?\n unless digest == generate_digest(data)\n clear\n unless Merb::Config[:ignore_tampered_cookies]\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n end\n unserialize(data)\n end\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def write_fund_hash(fund_hash)\n File.write(\"save.json\", JSON.generate(fund_hash))\n end", "def create\n @city = City.new(city_params)\n @city.city_hash = generate_unique_hash\n cookies[:city_hash] = @city.city_hash\n cookies[:city_hash] = { :value => @city.city_hash, :expires => 168.hour.from_now }\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def add_products_to_cookies\n if cookies[:product].blank?\n cookies[:product] = [params[:id]]\n else\n @recently = cookies[:product].split('&').last(8)\n unless @recently.include?(params[:id])\n cookies[:product] = [cookies[:product]] << params[:id]\n end\n end\n\n end", "def get_cookies\n if cookies.signed[:name].present? && cookies.signed[:email].present?\n render json: { allow: true, name: cookies.signed[:name], email: cookies.signed[:email] }\n else\n render json: { allow: false }\n end\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def cookies; @cookies ||= CookieJar.new; end", "def jsonify(hash)\n Yajl::Encoder.encode(hash)\n end", "def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def serialize_from_cookie(*args)\n id, token, generated_at = *args\n\n record = to_adapter.get(id)\n record if record && record.remember_me?(token, generated_at)\n end", "def show\n cookies[:arch_nombre] = { value: @archive.nombre, expires: 10.minutes.from_now }\n cookies[:arch_email] = { value: @archive.email, expires: 10.minutes.from_now }\n cookies[:arch_tel] = { value: @archive.telefono, expires: 10.minutes.from_now }\n end", "def set_api_response_cookie(http_response)\n all_set_cookies = http_response.get_fields('set-cookie')\n return if all_set_cookies.blank?\n\n new_api_cookies = {}\n all_set_cookies.each do |api_cookie|\n api_cookie_elements = api_cookie.split(\"; \")\n cookie_name = ''\n api_cookie_elements.each_with_index do |c_element, i|\n Rails.logger.debug(\"new_api_cookies :: #{c_element.inspect}\")\n c_sub_element = c_element.split('=', 2)\n c_sub_element_key = CGI::unescape(c_sub_element[0])\n c_sub_element_value = CGI::unescape(c_sub_element[1]) if c_sub_element[1].present?\n # Zeroth element is cookie name and value\n if i == 0\n cookie_name = c_sub_element_key\n new_api_cookies[cookie_name] = {value: c_sub_element_value, domain: GlobalConstant::CompanyApi.cookie_domain}\n elsif c_sub_element_key == \"expires\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Time.zone.parse(c_sub_element_value)\n elsif c_sub_element_key == \"domain\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n elsif c_sub_element_key == \"secure\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Rails.env.production?\n elsif c_sub_element_key == \"HttpOnly\"\n new_api_cookies[cookie_name][:http_only] = true\n elsif c_sub_element_key == \"SameSite\"\n new_api_cookies[cookie_name][:same_site] = c_sub_element_value\n else\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n end\n\n end\n end\n\n Rails.logger.debug(\"new_api_cookies :: #{new_api_cookies.inspect}\")\n @cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym] = new_api_cookies\n end", "def sso_cookie_content\n return nil if @current_user.blank?\n\n {\n 'patientIcn' => (@current_user.mhv_icn || @current_user.icn),\n 'mhvCorrelationId' => @current_user.mhv_correlation_id,\n 'signIn' => @current_user.identity.sign_in.deep_transform_keys { |key| key.to_s.camelize(:lower) },\n 'credential_used' => sso_cookie_sign_credential_used,\n 'expirationTime' => @session_object.ttl_in_time.iso8601(0)\n }\n end", "def hash\n [custom_headers, encode_as, name, payload, url].hash\n end", "def cookie_hash_length\n super\n end", "def parse_set_cookie(all_cookies_string)\n cookies = Hash.new\n \n # if all_cookies_string.present?\n # single cookies are devided with comma\n all_cookies_string.split(',').each {\n # @type [String] cookie_string\n |single_cookie_string|\n # parts of single cookie are seperated by semicolon; first part is key and value of this cookie\n # @type [String]\n cookie_part_string = single_cookie_string.strip.split(';')[0]\n # remove whitespaces at beginning and end in place and split at '='\n # @type [Array]\n cookie_part = cookie_part_string.strip.split('=')\n # @type [String]\n key = cookie_part[0]\n # @type [String]\n value = cookie_part[1]\n\n # add cookie to Hash\n cookies[key] = value\n }\n \n cookies\n end", "def store_session(res)\n res.set_cookie\n end", "def store_flash(res)\n res.set_cookie('_rails_lite_app_flash', {path: '/', value: @new_cookie.to_json})\n end", "def store_flash(res)\n cookie = @flash.to_json\n res.set_cookie('_rails_lite_app_flash', cookie)\n end", "def cookie(cookie)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n raise \"Not a hash: '#{cookie.class.name}', '#{cookie}'.\" unless cookie.is_a?(Hash)\n _httpsession.resp.cookie(cookie)\n return nil\n end", "def to_h\n {\n data: data,\n nonce: nonce,\n time: time,\n hash: hash,\n index: index,\n prev_hash: prev_hash\n }\n end", "def http_cookie\n http.cookie\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def store_flash(res)\n res.set_cookie(\"_rails_lite_app_flash\", {\n path: \"/\",\n value: @flash.to_json\n })\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def unmarshal(cookie)\n if cookie\n data, digest = cookie.split('--')\n return {} if data.blank?\n unless digest == generate_digest(data)\n delete\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n Marshal.load(Base64.decode64(data))\n end\n end" ]
[ "0.7232483", "0.7079436", "0.70458454", "0.69088364", "0.67860115", "0.6538753", "0.6516383", "0.64779174", "0.6469998", "0.643302", "0.6402495", "0.6361502", "0.636", "0.6339202", "0.63323885", "0.6327872", "0.63275915", "0.629749", "0.62952596", "0.6291643", "0.6252314", "0.62436986", "0.62171793", "0.6215092", "0.6212942", "0.62109303", "0.62076265", "0.6201022", "0.61970025", "0.6191", "0.61889803", "0.6174591", "0.61128205", "0.61075926", "0.6080043", "0.60611534", "0.6045012", "0.6008798", "0.6000785", "0.5992238", "0.5981834", "0.5978125", "0.5964963", "0.5964001", "0.5935738", "0.59356415", "0.59306914", "0.58483034", "0.58483034", "0.58483034", "0.58483034", "0.5835443", "0.5818669", "0.58077943", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5794816", "0.57787037", "0.5777957", "0.57715976", "0.5742014", "0.5742014", "0.5740027", "0.56911445", "0.5629975", "0.5626226", "0.5624343", "0.56158435", "0.5614091", "0.56086624", "0.56050736", "0.5600794", "0.55835646", "0.5580056", "0.55525774", "0.55406666", "0.55384266", "0.55243427", "0.5523828", "0.55194956", "0.55183715", "0.5515784", "0.5484435", "0.548393", "0.5455355", "0.5453349", "0.5447896", "0.54413706", "0.5437751", "0.5436442", "0.5430842", "0.5430842", "0.54289997", "0.54261774", "0.5424427" ]
0.63407034
13
d1p2.rb This is my implementation for Advent of Code: Day 1 (part 2) (See: function to find matches from arr[i] and arr[i + offset] and return the sum of their numbers
def captchaTwo(array) result = 0 offset = (array.length / 2) for i in 0...(array.length) if array[i] == array[(i + offset) % array.length] result += array[i] end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum(numbers, target)\n arr = numbers\n num = target\n index_array = []\n return_array = []\n current_index = 0\n\n loop do\n idx_counter = current_index\n current_element = arr[current_index]\n\n loop do\n break if idx_counter >= arr.length - 1\n next_index = idx_counter + 1\n next_element = arr[next_index]\n if current_element + next_element == num\n index_array << current_index << next_index\n end\n idx_counter += 1\n end\n\n if return_array == []\n current_index += 1\n end\n break if return_array.reduce(:+) == num\n end\n\n p index_array\nend", "def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend", "def two_numer_sum(array, target_sum)\n nums = {}\n array.each { |num|\n potential_match = target_sum - num\n if nums[:potential_match]\n return [potential_match, num]\n else\n nums[:num] = true\n end\n }\n return []\nend", "def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend", "def sum_of_matches(nums)\n circular_nums = [nums.last] + nums\n total = 0\n circular_nums.each_with_index do |num, ind|\n total += num.to_i if num == circular_nums[ind + 1]\n end\n total\nend", "def get_answer(matching_array)\n matching_array.map(&:to_i).inject(:+)\nend", "def two_sum(nums, target)\n result = []\n nums.each_with_index do |num, idx|\n find_num = target - num\n result = [idx, nums.index(find_num)] if nums.include?(find_num) && nums.index(find_num) != idx\n return result if result.length > 0\n end\n\n if result.length == 0\n return \"Target sum not found in array\"\n end\nend", "def two_sum(numbers, target)\n\n numbers.each_with_index do |num, index|\n \n looking_for = target - num\n answer_2 = binary_search(numbers, index + 1, numbers.length - 1, looking_for)\n if !!answer_2\n return [index + 1, answer_2 + 1] \n end\n end\nend", "def two_sum(array, target)\n found = Hash.new(false)\n goal = nil\n\n array.each do |el|\n goal = (target - el).abs\n return true if found[goal] && goal + el == target\n found[el] = true\n end\n\n false\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def two_sum(nums, target)\n results = []\n i = 1\n while i < nums.length\n diff = target - nums[i - 1]\n if nums[i..-1].include?(diff)\n idx = nums[i..-1].index(diff)\n results << i - 1 << idx + i\n end\n\n i += 1\n end\n\n results\nend", "def solution_1\n\n sums = []\n start_point = 0\n index_number_to_check = 25\n\n while true\n \n number_to_check = INPUT[index_number_to_check]\n range = INPUT.slice(start_point,25)\n\n for i in 0..range.length - 1\n k = i + 1\n for k in k..range.length - 1\n sum_result = range[i] + range[k]\n sums << sum_result\n end\n end\n start_point +=1\n index_number_to_check +=1\n if sums.include?(number_to_check) == false\n puts \"The number is #{number_to_check}\"\n exit\n end\n sums = []\n end\n number_to_check\nend", "def array_sum_by_index(arr)\n\nend", "def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n if (num1 + num2 == target) && (idx1 != idx2)\n return [idx1, idx2]\n end\n end\n end\nend", "def two_sum(nums)\n\n\t#option 1\n\n\t#Every index, add with other number\n\t\t#downfall -> n^2\n\n\t#Check first to last, like a palindrome (this won't work)\n\n\t#quick sort, add numbers up to 0\n\n\t#Every Index, add with other number\n\t\t#Iterate through array\n\t\tnums.each_with_index do |number, index|\n\t\t#iterate array with each individual number\n\t\t\tnums.each_with_index do |second_number, second_index|\n\t\t\t\t#skip if it is the same number\n\t\t\t\tnext if index == second_index\n\n\t\t\t\t#if there is a match, return starting & current index\n\t\t\t\tif (number + second_number == 0)\n\t\t\t\t\treturn [index, second_index]\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\t\t#if there is no match, return nil (iterate through)\n\n\t\tnil\n\nend", "def sum_of_halfway_matches(nums)\n rotated = nums.rotate(nums.length / 2)\n matches = nums.zip(rotated)\n matches.reduce(0) do |total, pair|\n if pair.first == pair.last\n total + pair.first.to_i\n else\n total\n end\n end\nend", "def find_pair(array,sum)\n indices = []\n for i in 0...array.length\n for j in i+1...array.length\n indices.push(\"#{i},#{j}\") if array[i] + array[j] == sum\n end\n end\n indices\nend", "def sum_of_sums(array)\r\nend", "def two_sum(nums, target)\n hash_idx_nums = {}\n index_result_array = []\n for index in (0...nums.length)\n hash_idx_nums[index] = nums[index]\n end\n\n # nums.each do |num|\n # result = target - num\n # if hash_idx_nums.value?(result)\n # index_result_array << hash_idx_nums.key(result)\n # end\n # end\n for index in (0...nums.length)\n result = target - nums[index]\n \n if hash_idx_nums.value?(result) && hash_idx_nums.key(result) != index\n index_result_array << hash_idx_nums.key(result)\n end\n end\n p index_result_array\n return index_result_array[0], index_result_array[1]\nend", "def two_sum(array, target)\n num_hash = {}\n \n array.each_with_index do |num, index|\n difference = target - num\n if num_hash[difference]\n return [num_hash[difference], index]\n else\n num_hash[num] = index\n end\n end\nend", "def two_sum(arr, target) \n hash = {}\n \n i = 0\n for val in arr do\n val1 = arr[i]\n val2 = target - val1 \n if hash[val2] \n return [hash[val2], i]\n else\n hash[val1] = i \n end\n i += 1\n end\n\n nil \nend", "def two_sum(nums, target)\n if target_match = nums.combination(2).find { |pair| pair.sum == target }\n index1 = nums.index(target_match[0])\n nums.delete_at(nums.index(target_match[0]))\n index2 = nums.index(target_match[1]) + 1\n [index1, index2]\n end\nend", "def sum_pairs(array, sum)\n h = {}\n i = 0\n array.each do |e|\n lookup = h[sum - e]\n lookup.nil? ? h[e] = i : (return [sum - e, e])\n i += 1\n end\n nil\nend", "def calculate_total(cards) # input is an array of arrays\n\tarr = cards.map { |e| e[1] } # gets second element of the array and loads that into a new array\n\n\ttotal = 0\n\tarr.each do |value|\n\t\ttotal = total + value\n\tend\n\n\tarr.select { |e| e == 11}.count.times do # corrects for aces\n\t\tif total > 21\n\t\t\ttotal = total - 10\n\t\tend\n\tend\n\nreturn total\nend", "def two_sum?(array, target_sum)\n matches = {}\n array.each do |num|\n return true if matches.has_key?(target_sum - num)\n matches[num] = 1\n end\n false\nend", "def two_sum(nums, target)\n target_indexes = []\n nums.each_with_index do |primary, index|\n nums.each_with_index do |num, i|\n if primary + num == target && index != i\n target_indexes << index\n target_indexes << i\n end\n end\n end\n return target_indexes.uniq\nend", "def two_sum(numbers, target)\n ##set hash\n hash = {}\n ##set array\n arr = []\n\n numbers.each_with_index do |val, idx|\n if hash.key?(target - val)\n arr.push(hash[target - val])\n arr.push(idx + 1)\n break\n else\n hash[val] = idx + 1\n end\n end\n\n arr\nend", "def two_sum(nums, target)\n hash = Hash.new\n nums.each_with_index do |num, index|\n findable = target - num\n if hash[findable]\n return [nums.index(findable), index]\n end\n hash[num] = findable\n end\n require 'pry'; binding.pry\nend", "def sum_upon_sums(array)\n\nend", "def sum_of_sums1(numbers)\n result = 0\n index_end = 1\n loop do\n numbers[0, index_end].each { |number| result += number }\n break if index_end >= numbers.size\n\n index_end += 1\n end\n result\nend", "def two_sum(nums, target)\n indices_array = []\n i = 0\n while i < nums.length\n j = i + 1\n while j < nums.length\n if nums[i] + nums[j] == target\n indices_array << i\n indices_array << j\n end\n j += 1\n end\n i += 1\n end\n return indices_array\nend", "def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n next if idx1 == idx2\n return [idx1, idx2] if num1 + num2 == target\n end\n end\n return \"Couldn't find target value\"\nend", "def two_sum_3(nums, target)\n len = nums.length\n hash = {}\n\n for i in (0...len)\n elt = nums[i]\n diff = target - elt\n # check to see if diff is in the hash; if so we found 2 numbers that add up to sum, that is diff and elt\n if hash[diff]\n index1 = nums.index(diff)\n puts \"index1=#{index1+1}, index2=#{i+1}\"\n return\n else\n hash[elt] = 1 # add the key elt to the hash\n end\n end\nend", "def check_exam(arr1,arr2)\n result = 0\n arr1.each_with_index do |item, index|\n if arr1[index] == arr2[index]\n result += 4\n elsif arr2[index] == \"\"\n result += 0\n elsif arr1[index] != arr2[index]\n result -= 1\n end\n end\n result = 0 if result <= 0\n p result\nend", "def two_sum_indices?(arr, target_sum)\n summands = {}\n\n arr.each_with_index do |num, i|\n summand = target_sum - num\n return [target_sum[summand], i] if summands.key?(summand)\n\n summands[num] = i\n end\n\n false\nend", "def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend", "def two_sum(array, target_sum)\n hash = {}\n array.each do |ele|\n hash[target_sum - ele] = ele\n end \n array.each do |ele|\n # debugger\n return true if !(hash[ele].nil? || hash[ele] == ele) \n end \n false \nend", "def array_index_equel_sum_of_parts(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n array.each_index do |i|\n left_part = array[0..i].reduce { |sum, e| sum + e }\n right_part = array[i..array.length - 1].reduce { |sum, e| sum + e }\n return i if left_part == right_part\n end\n -1\nend", "def pair_sum(arr, target)\n # basic approach is nested loops scanning each element checking if its == to target\n result = []\n i = 0\n j = i + 1\n while i < arr.length\n while j < arr.length\n p i, j\n if i != j && arr[i] + arr[j] == target\n result << [i, j]\n end\n j += 1\n end\n i += 1\n j = i + 1\n end\n result\nend", "def check_array(nums)\n sum = 0\n i = 0\n while i < nums.length\n \tif(nums[i] == 17)\n\t\t\ti= i + 1\n\t\telse\n\t\t \tsum = sum + nums[i]\n\t end\n\t i += 1\n end\n \treturn sum\nend", "def two_sum(nums, target)\n hsh = Hash.new\n nums.each_with_index do |n, i|\n hsh[n] = i+1\n end\n \n nums.each_with_index do |val, ind|\n second = target - val\n if hsh.include?(second) && nums.index(second) != ind\n return [ind+1, nums.index(second)+1]\n end\n end\nend", "def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend", "def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n loop do\n \n idx2 = 0\n loop do\n sum += numbers[0..idx][idx2]\n idx2 += 1\n break if idx2 == numbers[0..idx].size\n end\n \n idx += 1\n break if idx == numbers.size\n end\n \n sum\nend", "def two_sum(nums, target)\n sorted_nums = nums.sort\n\n last_index = sorted_nums.size - 1\n first_index = 0\n\n while true do\n if sorted_nums[last_index] + sorted_nums[first_index] > target\n last_index -= 1\n\n next\n end\n\n smaller_have_to_be = target - sorted_nums[last_index]\n\n while true do\n if sorted_nums[first_index] < smaller_have_to_be\n first_index += 1\n\n next\n end\n\n break\n end\n\n if sorted_nums[first_index] != smaller_have_to_be\n last_index -= 1\n next\n end\n\n break\n end\n\n # Find correct indexes ( because that indexs in sorted array )\n\n result = []\n nums.each_with_index do |number, index|\n if [sorted_nums[first_index], sorted_nums[last_index]].include?(number)\n result.push(index)\n end\n end\n\n result\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def map_then_iterate_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n hash[i] = index\n end\n indexes = []\n array.each.with_index do |ii, index|\n complement = target - ii \n if hash.has_key?(complement) && hash.fetch(complement) != index\n indexes.push(index, hash.fetch(complement))\n return indexes\n end\n end\nend", "def two_sum(nums)\n nums.each_with_index do |x, ix|\n nums.each_with_index do |y, iy|\n if ix != iy\n if x + y == 0\n return [ix, iy]\n end\n end\n end\n end\n nil\nend", "def search_array2(ary, target)\n i = 0\n match = nil\n ary.each do |x|\n case\n when x == target then match = i\n else i += 1\n end\n end\n p match\nend", "def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort\n arr.each_index do |i|\n to_find = target - arr[i]\n sub_arr = arr[0...i] + arr[i + 1..-1]\n return true if sub_arr.bsearch { |x| x == to_find }\n end\n false\nend", "def findSum()\n\tnumbers.inject(0) { |sum, number| sum + number }\nend", "def sum_of_sums(array)\n current_sum = 0\n counter = 0\n loop do\n current_sum += array[0..counter].sum\n counter +=1\n break if counter == array.size\n end\n current_sum\nend", "def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend", "def two_sum(nums, target)\n # i,j = 0, nums.length-1\n i = 0\n j = nums.length-1\n output = []\n while i < nums.length-1\n while j > i\n if nums[i] + nums[j] == target\n output << i << j\n end\n j-=1\n end\n i+=1\nend\nreturn output #returning index\nend", "def three_sum(nums)\n nums.sort!\n res = []\n # for each num, find the two constituent targets\n for i in 0..nums.length - 3 do\n next if i > 0 && nums[i] == nums[i - 1]\n\n partial_target = 0 - nums[i]\n j = i + 1\n k = nums.length - 1\n while j < k\n if nums[j] + nums[k] == partial_target\n res.push([nums[i], nums[j], nums[k]])\n j+=1 while j < k && nums[j] == nums[j+1]\n k-=1 while j < k && nums[k] == nums[k-1]\n j+=1\n k-=1\n elsif nums[j] + nums[k] > partial_target\n k-=1 while j < k && nums[k] == nums[k-1]\n k-=1\n else\n j+=1 while j < k && nums[j] == nums[j+1]\n j+=1\n end\n end\n end\n return res\nend", "def adjacent_sum(arr)\n new_arry = []\n arr.each_with_index do |num, i|\n if num == arr[-1]\n return new_arry\n else\n new_arry << num + arr[i+1]\n end\n end\n\treturn new_arry\nend", "def two_sum(nums, target)\n nums.each_with_index do |ele, i|\n check = target - ele\n return i, nums.index(check) if nums.include?(check) && i != nums.index(check)\n end\nend", "def two_sum(num_arr)\n idx1 = 0\n while idx1 < num_arr.length\n if num_arr.include?(-(num_arr[idx1]))\n return [idx1,num_arr.index(-(num_arr[idx1]))]\n end\n idx1 += 1\n end\nend", "def two_sum(nums)\n\tstore = nums.combination(2).to_a\n\tarr = Array.new\n\ti = 0\n\tsum = 0\n\twhile i <= store.length\n\t\ta = store[i][0]\n\t\tb = store[i][1]\n\t\tsum = ( a + b )\n\t\t\n if sum != 0 && i == store.length-1\n \treturn nil\n elsif sum != 0 && i < store.length\n\t\t\ti += 1\t\n elsif sum == 0\n\t\t\tarr[0] = nums.index(a)\n\t\t\tarr[1] = nums.index(b)\n\t\t\treturn arr\t\t\n\t\tend \n \n\tend\n # if sum = store[store.length-1][0] + store[store.length-1][1]) \n # if sum != 0 && i == store.length\n # \treturn arr\n # end\n\nend", "def find_even_index(arr)\n i = 0\n a = 0\n b = 1\n for i in 0...arr.length\n a = arr.slice(0, i).sum\n b = arr.slice(i + 1, arr.length - 1).sum\n if a != b && i == arr.length - 1\n return -1\n elsif a != b\n i += 1\n else\n return i\n end\n end\nend", "def sum_of_all_pairs(arr, sum)\n answer = []\n arr.each_with_index do |ele, idx|\n while idx < arr.length - 1\n if ele + arr[idx + 1] == sum\n if ele < arr[idx + 1]\n temp_arr = [ele, arr[idx + 1]]\n else\n temp_arr = [arr[idx + 1], ele]\n end\n if !answer.include?(temp_arr)\n answer.push(temp_arr)\n end \n end\n idx = idx + 1\n end\n end\n return answer\nend", "def sum_of_sums(array)\n result = 0\n array.each_index {|idx| result += array[0..idx].sum}\n result\nend", "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend", "def three_sum(arr)\n sorted = arr.sort()\n results = []\n # 3 index tracking tools, i to start and scan array 1 by one\n # start to always be one ahead and step till we hit a greater condition\n # finish to always start from the back and work its way to the front\n # these will work if the array is sorted\n\n (0..sorted.length - 3).each do |i| # step up until last 2 elements (reserved for next 2 pointers)\n start = i + 1\n finish = sorted.length - 1\n\n a = sorted[i]\n while start < finish\n b = sorted[start]\n c = sorted[finish]\n p a, b, c\n p sorted\n if (a + b + c) == 0 # found one, put this in our results\n results << [a, b, c] unless results[-1] == [a, b, c] \n if b == sorted[start + 1] # is the next element for b the same\n start += 1\n else\n finish -= 1\n end\n elsif (a + b + c) > 0 # too big so decrement our finish\n finish -= 1\n else # increment our middle pointer\n start += 1\n end\n end \n\n end\n\n results\nend", "def two_number_sum(array, target_sum)\n i = 0\n while i <= array.length - 1\n j = array.length - 1\n while j >= 0\n if array[i] + array[j] == target_sum && i != j\n return [array[i], array[j]]\n end\n j -= 1\n end\n i += 1\n end\n return []\nend", "def four_sum(arr, target)\n arr = arr.sort\n size = arr.size\n res = []\n (0...size).each do |i|\n (i + 1...size).each do |j|\n left = j + 1\n right = size - 1\n while left < right\n sum = arr[i] + arr[j] + arr[left] + arr[right]\n res << [arr[i], arr[j], arr[left], arr[right]] if sum == target\n if sum > target\n right -= 1\n else\n left += 1\n end\n end\n end\n end\n res\nend", "def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend", "def two_sum?(arr, target)\n h = Hash.new\n arr.each_with_index do |val, i|\n h[val] = i\n end\n\n arr.each_index do |i|\n to_find = target - arr[i]\n return true if h[to_find] && h[to_find] != i\n end\n false\nend", "def sum_of_sums_2(array)\n total_sum = 0\n i = 0\n len = array.size\n \n while i < len\n total_sum += array[0..i].inject { |sum, j| sum + j }\n i += 1\n end\n total_sum\nend", "def twoSum(numbers, target)\n # solution\n result = []\n numbers.each do |i|\n y = numbers.length - 1\n while y > numbers.index(i) do \n if i + numbers[y] == target\n result << numbers.index(i) << y\n return result\n end\n y -= 1\n end\n end\nend", "def true_two_sum(arr, targ)\n\n arr_hash = Hash.new\n\n arr.each { |el| arr_hash[n] = true }\n\n arr.each { |el| return arr_hash[targ - el] if arr_hash[targ - el] }\n false \nend", "def okay_two_sum(arr, target)\n sorted_arr = arr.sort\n while sorted_arr.any?\n partner = target - sorted_arr.pop\n return true if b_search(sorted_arr, partner)\n end\n\n false\nend", "def count_adjacent_sums(array, n)\n count = 0\n array.each_with_index do |i, idx |\n # if array[idx] + array[idx + 1] == n\n # count++\n # end\n count += 1 if array[idx] + array[idx + 1] == n\n end\n count\nend", "def okay_two_sum?(arr, target)\n\n arr.each do |ele1| # O(n)\n # debugger\n found = arr.bsearch do |ele2|\n # debugger\n (target - ele1) == ele2\n end\n return true unless found.nil? || arr.index(found) == arr.index(ele1)\n end\n false\nend", "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n counter = -1\n while counter + 1 > -arr.size\n total_sum += arr.slice(idx..counter).reduce(:+)\n counter -= 1\n end\n total_sum\nend", "def namerisuminarray arr \n len = arr.length\n sum = 0\n sum = sum.to_i\n broqch = 0\n \n while broqch <= len - 1\n sum = sum + arr[broqch].to_i\n broqch = broqch + 1\n end\n \n return sum \nend", "def two_sum_2(nums, target)\n sorted_nums = merge_sort(nums)\n i, j = 0, sorted_nums.length-1\n while i < j\n sum = sorted_nums[i] + sorted_nums[j]\n if sum == target\n index1 = nums.index(sorted_nums[i])\n index2 = nums.index(sorted_nums[j])\n puts \"index1=#{index1+1}, index2=#{index2+1}\"\n return\n elsif sum < target\n i += 1\n else\n j -= 1\n end\n end\nend", "def check_sum(array, target)\n\nend", "def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend", "def solve(nums, target)\n nums.each_with_index do |e, i|\n nums.each_with_index do |e_, i_|\n return [i, i_] if ((e + e_ == target) && (i != i_))\n end\n end\nend", "def strange_sums(arr)\n count = 0\n arr.each_with_index do |ele, i|\n arr.each_with_index do |ele2, i2|\n if i > i2\n if ele + ele2 == 0\n count += 1\n end\n end\n end\n end\n count\nend", "def sumTwo(array, sum)\n returnarray = []\n i = 0\n j = 1\n for i in (0..array.length-1) do\n for j in (1..array.length-1) do\n if array[i] + array[j] == sum\n returnarray << array[i]\n returnarray << array[j]\n return returnarray\n end\n end\n end\n return \"no pairs sum to this input\"\nend", "def sorting_two_sum(array, target)\n arr = array.sort\n arr.each_with_index do |int, idx|\n search_array = array[0...idx] + array[(idx + 1)..-1]\n return true if search_array.bsearch { |x| x == target - int }\n end\n false\nend", "def sum_to_n? (int_array, n)\r\n found = false\r\n secondAddendCandidates = []\r\n int_array.each do |num|\r\n # Check if we found the 2nd addend \r\n if secondAddendCandidates.include? num\r\n found = true\r\n break\r\n else\r\n # Key = candidate for the 2nd addend in the sum\r\n secondAddendCandidates << n-num\r\n end\r\n end\r\n\r\n found\r\nend", "def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend", "def bad_two_sum?(arr, target)\n found = false\n arr.each_with_index do |a, l|\n arr.each_with_index do |b, n|\n next if l == n\n found = true if arr[l] + arr[n] == target\n end\n end\n found\nend", "def two_sum?(array, target_sum)\n checked = {}\n\n array.each_with_index do |ele, i|\n return true if checked[target_sum - ele]\n checked[ele] = i\n end\n false\n\nend", "def calculate(arr1, arr2)\n result = []\n arr1.each_with_index do |num, index|\n result << num + arr2[index]\n end\n result\nend", "def arr_sum(arr, target)\n 0.upto(arr.size - 2) do |idx1|\n 1.upto(arr.size - 1) do |idx2|\n return true if arr[idx1] + arr[idx2] == target && idx2 > idx1\n end\n end\n false\nend", "def two_sum_big_gun(array, target)\n nums = Hash.new(0)\n\n array.each do |el|\n nums[el] += 1\n end\n\n array.any? do |el|\n wing = target - el\n nums[wing] > 0\n end\n\nend", "def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n while idx < numbers.size\n idx2 = 0\n \n while idx2 < numbers[0..idx].size\n sum += numbers[0..idx][idx2]\n idx2 += 1\n end\n \n idx += 1\n end\n \n sum\nend", "def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n until idx == numbers.size\n idx2 = 0\n \n until idx2 == numbers[0..idx].size\n sum += numbers[0..idx][idx2]\n idx2 += 1\n end\n \n idx += 1\n end\n \n sum\nend", "def array_sum_with_index(arr)\n acc = 0\n arr.each_with_index {|int, id| acc += (int * id)}\n acc\nend", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend", "def okay_two_sum_b?(arr, target_sum)\n arr = arr.sort\n arr.each_with_index do |el, i|\n search_result = arr.bsearch { |el2| target_sum - el - el2 }\n next unless search_result\n return [arr[i - 1], arr[i + 1]].include?(el) if search_result == el\n return true\n end\n false\nend", "def two_sum?(array, target_sum)\n array_hash = {}\n array.each do |el|\n array_hash[el] = true\n end\n\n array.each_with_index do |el|\n next if target_sum - el == el\n return true if array_hash[target_sum - el]\n end\n false\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def adjacent_sum(arr)\n result = []\n\n arr.each_with_index do |num, idx|\n counter = 0\n if idx < arr.length-1\n counter += num + arr[idx+1]\n result << counter\n end\n end\n\n return result\n\nend", "def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend", "def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend", "def okay_two_sum?(arr, target)\n sorted = quick_sort(arr)\n\n arr.each_with_index do |el, idx|\n p current = target - el\n bruh = bsearch(arr, current)\n next if bruh == idx\n return true unless bruh.nil?\n end\n\n return false\nend" ]
[ "0.69249415", "0.6826382", "0.6722587", "0.66272825", "0.65868217", "0.658194", "0.6562062", "0.64947915", "0.6480071", "0.6478007", "0.64542824", "0.6444382", "0.6416029", "0.641552", "0.6390692", "0.6314885", "0.6311496", "0.62951857", "0.6284888", "0.62824893", "0.6280062", "0.6275764", "0.62729114", "0.62724555", "0.62664896", "0.6266362", "0.6263143", "0.62570274", "0.6253003", "0.62409794", "0.6240404", "0.62267643", "0.62224144", "0.6221966", "0.62202287", "0.6203571", "0.61982024", "0.6194833", "0.619376", "0.6190415", "0.6188797", "0.61748487", "0.61682516", "0.61629784", "0.61497283", "0.6147566", "0.61427903", "0.61374843", "0.6134931", "0.6133493", "0.61290693", "0.6117692", "0.61167485", "0.6115718", "0.61151516", "0.6111244", "0.61097795", "0.6106171", "0.6106111", "0.61006993", "0.6100293", "0.60974884", "0.6091433", "0.6091183", "0.607715", "0.6076157", "0.60736656", "0.6069917", "0.6065713", "0.6065407", "0.6064438", "0.60634726", "0.6060659", "0.6059331", "0.60592514", "0.6056991", "0.6054838", "0.6054085", "0.6047437", "0.6046204", "0.6043865", "0.604291", "0.6040725", "0.6033524", "0.60315716", "0.60294336", "0.60282487", "0.60274935", "0.60232395", "0.60231423", "0.60215706", "0.60210377", "0.60197586", "0.6014812", "0.6011565", "0.60107905", "0.60093915", "0.60092694", "0.60076237", "0.60069364", "0.60059035" ]
0.0
-1
function to format and get input from argv
def getInput(array) if ARGV[0] == nil puts "Bad input" exit end # input is one string, read it in by char, convert to int, and store in # array, element-by-element ARGV[0].each_byte do |c| array << c.chr.to_i end # puts array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end", "def read_from_cmdline\n require \"shellwords\"\n\n string = unless ARGV.empty?\n ARGV.join(' ')\n else\n if STDIN.tty?\n STDERR.print(\n %|(offline mode: enter name=value pairs on standard input)\\n|\n )\n end\n array = readlines rescue nil\n if not array.nil?\n array.join(' ').gsub(/\\n/n, '')\n else\n \"\"\n end\n end.gsub(/\\\\=/n, '%3D').gsub(/\\\\&/n, '%26')\n\n words = Shellwords.shellwords(string)\n\n if words.find{|x| /=/n.match(x) }\n words.join('&')\n else\n words.join('+')\n end\n end", "def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend", "def parse!(argv)\n options = {}\n parser = configure_base!(OptionParser.new)\n parser.parse!(argv, into: options)\n unless options.key?(:input)\n puts 'Missing --input argument, which is required.'\n Advent2019.show_help(parser)\n end\n options\n end", "def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend", "def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 1,\n :cols => 3, :rows => 3,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => false,\n :moveto_color => '#0000ff', :lineto_color => '#ff0000',\n :xshift => 0, :yshift => 0, :gcode => false, :do_tform => false\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n elsif v = a.match(/^--gcode$/) then params[:gcode] = true\n elsif v = a.match(/^--apply-maths$/) then params[:do_tform] = true\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n params\nend", "def read_user_input\n if ARGV.size < 2\n puts \"Insufficient inputs provided.\"\n exit\n \n elsif ARGV.size == 2\n $network = ARGV[0]\n $dataMut = ARGV[1]\n $weights_file = \"none\"\n $alpha = nil\n $cancer = \"nCOP_out\"\n \n elsif ARGV.size > 2\n $network = ARGV[0]\n $dataMut = ARGV[1]\n $weights_file = \"none\"\n $alpha = nil\n $cancer = \"nCOP_out\"\n \n (2..(ARGV.size - 1)).each do |i|\n index = ARGV[i].index(\"=\")\n\n if index.nil?\n puts \"Illegal input format. Please use param=value without white spaces if adding any non-required parameters, i.e alpha=0.4\"\n exit\n end\n \n param = ARGV[i][0..(index - 1)]\n value = ARGV[i][(index+1)..-1]\n \n case param\n when \"alpha\"\n $alpha = value.to_f\n when \"weights\"\n $weights_file = value\n when \"output_prefix\"\n $cancer = value\n else\n puts \"Wrong parameter specified. Please use one of the alpha=, weights=, or output_prefix=.\"\n exit\n end\n end\n end\nend", "def argv; end", "def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(' ').gsub(/\\n/, '')\n end.gsub(/\\\\=/, '%3D').gsub(/\\\\&/, '%26'))\n\n if words.find{|x| x =~ /=/} then words.join('&') else words.join('+') end\n end", "def parseInput(args)\n\t# in case it is a full path, get only the filename part\n\targstr = File.basename(args.join(\" \").strip())\n\t# remove filename extensions\n\twhile argstr.sub!(/\\.[a-zA-Z2]{1,5}/,''); end\n\t# Case 1: LC control number\n\tif argstr.start_with?('lccn:') then\n\t\treturn {'lccn' => argstr.sub!('lccn:','')}\n\tend\n\t# Case 2: worldcat query string\n\ttokens = argstr.split(/\\b(author|isbn|keyword|title)=/).drop(1)\n\tif tokens.length > 1 then\n\t\treturn Hash[*tokens]\n\tend\n\t# Case 3: ISBN10 or ISBN13\n\tfor i in 0..(argstr.length - 13) do\n\t\treturn {'isbn' => argstr[i..(i+12)]} if isbn13?(argstr[i..(i+12)])\n\tend\n\tfor i in 0..(argstr.length - 10) do\n\t\treturn {'isbn' => argstr[i..(i+9)]} if isbn10?(argstr[i..(i+9)])\n\tend\n\t# Case 4: Semicolon-separated pieces (probably filename without extension)\n\ttokens = argstr.split(\";\")\n\tret = {}\n\tif tokens.length == 3 then # fulltitle;authors;year\n\t\tret['fulltitle'] = tokens[0].gsub(/[-_]/, ' ')\n\t\tret['year'] = tokens[2].gsub(/[^\\d]/,'')\n\t\tif tokens[1] =~ /^([a-zA-Z]+-)?(.*)$/ then\n\t\t\tret['author'] = $2 if $2.length > 0\n\t\tend\n\telsif tokens.length > 1 then\n\t\tret['fulltitle'] = tokens.shift.gsub(/[-_]/, ' ')\n\t\tauthor = tokens.drop_while{|x| x =~ /[^a-zA-Z\\s]/}.first\n\t\tret['author'] = author unless author.nil?\n\telse\n\t\tret['fulltitle'] = argstr.gsub(/[-_]/, ' ')\n\tend\n\tret['fulltitle'] = ret['fulltitle'].gsub(/\\(.*\\)/,'').gsub(/ +/,' ').strip\n\tret['fulltitle'].match(/\\b(\\d+)e$/) { |m|\n\t\tret['edition'] = m[1]\n\t\tret['fulltitle'].sub!(/\\b\\s*\\d+e$/,'')\n\t}\n\tret['title'] = ret['fulltitle'].sub(/\\..*$/,'').strip()\n\treturn ret\nend", "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend", "def input\n @input ||= args.dig(:input)\n end", "def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend", "def argv; argline.split(/ +/) unless argline.nil?; end", "def parse_options( argv = ARGV )\n oparser = OptionParser.new do | o |\n o.separator 'Input Options:'\n \n o.on( '-i', '--input \"text to process\"', doc( <<-END ) ) { |val| @input = val }\n | a string to use as direct input to the recognizer\n END\n \n o.on( '-I', '--interactive', doc( <<-END ) ) { @interactive = true }\n | run an interactive session with the recognizer\n END\n end\n \n setup_options( oparser )\n return oparser.parse( argv )\n end", "def parse argv\n parse_args argv do |argv, remaining_args, arg|\n remaining_args << arg\n end\n end", "def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend", "def getArguments\n\n\t# Parse the arguments\n\ttheArgs = { :clang => false,\n\t\t\t\t:rewrite => false,\n\t\t\t\t:help => false,\n\t\t\t\t:paths => [],\n\t\t\t\t:exclude => [] }\n\n\ttheParser = OptionParser.new do |opts|\n\t\topts.banner = \"Usage:\\n rn-format [--help] [--clang] [--rewrite] [--exclude=PATH] PATH [PATH...]\";\n\t\topts.separator \"\";\n\t\topts.separator \"Reformat any source files within the supplied paths,\";\n\t\topts.separator \"displaying the results to standard output.\";\n\t\topts.separator \"\";\n\t\topts.separator \"Options:\";\n\n\t\topts.on('--clang',\t\t\t\t\t\t'Show raw clang-format output') do\n\t\t\ttheArgs[:clang] = true;\n\t\tend\n\n\t\topts.on('--rewrite',\t\t\t\t\t'Rewrite files in-place') do\n\t\t\ttheArgs[:rewrite] = true;\n\t\tend\n\n\t\topts.on('--exclude=PATH',\t\t\t\t'Exclude a path') do |thePath|\n\t\t\ttheArgs[:exclude] << File.expand_path(thePath);\n\t\tend\n\n\t\topts.on('--help',\t\t\t\t\t\t'Show the help') do\n\t\t\ttheArgs[:help] = true;\n\t\tend\n\tend\n\n\ttheParser.parse!;\n\ttheArgs[:paths] = ARGV;\n\n\n\n\t# Show the help\n\tif (theArgs[:help] || theArgs[:paths].empty?)\n\t\tputs theParser.help();\n\t\texit(false);\n\tend\n\t\n\treturn theArgs;\n\nend", "def format_input(input)\n input\n end", "def get_input\n @input = gets.strip\n end", "def read_input_params options_cli={}\n #utility sub\n def find_first_yaml_file(dir_to_process)\n Dir.chdir(dir_to_process)\n yaml_file = nil\n Dir.glob(\"*.{yaml,yml}\") do |file|\n yaml_file = file\n break\n end \n return yaml_file\n end\n\n # read input args\n dir_to_process = Dir.pwd\n fail(\"#{dir_to_process} does not exist\") unless File.exist?(dir_to_process) \n fail(\"#{dir_to_process} is not a Directory\") unless File.directory?(dir_to_process)\n $log.info \"Dir to be processed: #{dir_to_process}\"\n \n yaml_name = options_cli['--event']||find_first_yaml_file(dir_to_process)\n fail(\"- no YAML File found;\") if yaml_name.nil? \n fail(\"- no YAML File found;\") unless File.file?(yaml_name)\n $log.info \"YAML Profile to be processed: #{yaml_name}\"\n return [dir_to_process, yaml_name]\nend", "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <Domain>\"\n exit\n end\n ARGV.first\nend", "def handleInput(inputs)\n\t\tinputArgs = ARGV.map(&:upcase)\n\t\tinputArgs = inputArgs.sort\n\treturn inputArgs\nend", "def get_input(*msg)\n print *msg\n return gets.strip\n end", "def get_input\n input = gets\n return input\nend", "def parsed_argv\n Hash[ARGV.map { |arg| arg.split(\":\") }]\nend", "def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end", "def read_input_args(input)\n rows = []\n whites = []\n blacks = []\n counter = 1\n \n # reads the whole file and splits it by newlines, then split each line into its integer part. The result is appended to the rows array\n File.readlines(input).map do |line|\n rows << line.split.map(&:to_i)\n end\n \n n, m, b, w = rows[0]\n \n # add every black dot into the array\n 1.upto(b) do \n x, y = rows[counter]\n blacks << [x, y]\n counter += 1\n end\n \n # add every white dot into the array\n 1.upto(w) do\n x, y = rows[counter]\n whites << [x, y]\n counter += 1\n end\n \n return n, m, blacks, whites\nend", "def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end", "def parse_arguments!(argv)\n results = {\n embed: false\n }\n\n option_parser = OptionParser.new do |opts|\n opts.on(\"-h\", \"--help\", \"Prints this help\") do\n results[:help] = opts.help\n end\n\n opts.on(\"-sS\", \"--match-string=S\", \"Match nodes containing the string\") do |s|\n results[:pattern] = s\n end\n\n opts.on(\"-mD\", \"--month=D\", \"Only return results for the month containing the given date\") do |d|\n results[:month] = month_for_date(d)\n end\n\n opts.on(\"-fF\", \"--file=F\", \"Use the given file as input. If absent, will parse STDIN\") do |f|\n results[:file] = f\n end\n\n opts.on(\"-a\", \"--include-all\", \"Include all the matching results, not just the first\") do |a|\n results[:include_all] = true\n end\n\n opts.on(\"-e\", \"--embed\", \"Place resulting block refs in an embed\") do |a|\n results[:embed] = true\n end\n\n opts.on(\"-E\", \"--no-embed\", \"Do not place resulting block refs in an embed (default)\") do |a|\n results[:embed] = false\n end\n end\n\n option_parser.parse!(argv)\n if argv.count != 0 || !config_valid?(results)\n results = { :help => option_parser.help }\n end\n\n results\nend", "def format_input\n str = ARGV[1].gsub(/[^a-zA-Z]+/, '').upcase\n divided = []\n while str.length > 0\n word = str.slice!(0, 5)\n while word.length < 5\n word += \"X\"\n end\n divided << word\n end\n divided.join ' '\nend", "def normalize_args(string, options_hash); end", "def parse_input(input_string)\n cmd = \"\"\n args = []\n \n split_input = input_string.split(\",\")\n \n if split_input.length > 1\n cmd = split_input[0].slice(15, split_input[0].length - 1)\n i = 1;\n while i < split_input.length\n arg = \"\"\n input_chars = split_input[i].chars\n input_chars.each do |char|\n if char != \" \" && char != \")\"\n arg += char\n end\n end\n args << arg\n i += 1\n end\n else\n cmd = split_input[0].slice(15, split_input[0].length - 2)\n end\n puts cmd\n puts args\nend", "def parse_option(args)\n if args.include?(\"-h\") || args.include?(\"--help\")\n puts \"usage: bq_guess input_file\"\n exit\n elsif args.include?(\"-v\") || args.include?(\"--version\")\n require \"bq_guess/version\"\n puts BqGuess::VERSION\n exit\n else\n { input_path: args.first }\n end\n end", "def parse_args(args)\n options = {\n :excount => 5,\n :testdata => nil,\n :console => false,\n :raw => false,\n :pronounciation_offset => 1,\n :definition_offset => 2,\n :url => \"m\"\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n opts.on(\"-p N\", Integer, \"Offset to pronunciation column, default 1\") do |n|\n options[:pronounciation_offset] = n\n end\n opts.on(\"-d N\", Integer, \"Offset to definition column, default 2\") do |n|\n options[:definition_offset] = n\n end\n opts.on(\"-n N\", Integer, \"Number of example sentences, default 5\") do |n|\n options[:excount] = n\n end\n opts.on(\"-u U\", String, \"Source url (#{WWWJDICExampleProvider::SOURCES.to_s}), default #{options[:url]}\") do |u|\n options[:url] = u\n end\n\n opts.separator \"\"\n opts.separator \"Testing:\"\n opts.on(\"-t\", \"--testdata [DATAFILE]\",\n \"Path to yaml data file of examples (useful for testing)\") do |d|\n options[:testdata] = d\n end\n\n opts.separator \"\"\n opts.separator \"Output:\"\n opts.on(\"-c\", \"--console\", \"Dump to console only\") do |c|\n options[:console] = c\n end\n opts.on(\"-r\", \"--raw\", \"Output raw data (all examples)\") do |c|\n options[:raw] = c\n end\n\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend", "def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend", "def shellParse(input)\n #input.gsub!(\"\\\\\", \"\\\\\\\\\\\\\") # Allows '\\' chars in windows paths to be handled properly in shellwords\n argv = shellwords(input)\n return(argv) if !(rdi = argv.index('|') || argv.index('>>') || argv.index('>'))\n \n rda = argv.slice!(rdi..-1)\n begin\n if rda[0] == '|'\n raise MiqRedirectError.new(), \"Missing pipe target command\" if rda.length < 2\n $miqOut = IO.popen(rda[1..-1].join(\" \"), \"w\")\n else\n raise MiqRedirectError.new(), \"\\\"#{rda.join(' ')}\\\"\" if rda.length != 2\n $miqOut = File.new(rda[1], rda[0] == '>' ? \"w\" : \"a\")\n end\n rescue => err\n raise MiqRedirectError.new(), err.to_s\n end\n return(argv)\n end", "def usage\n\t#check the argument\t\n if ARGV.length !=1\n \tputs \"Usage: ./ping_sweep.rb subnet(192.168.79)\"\n end\n #match subnet format like 192.168.79\n if /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/ =~ ARGV[0]\n \treturn ARGV[0]\n else\n \tputs \"wrong subnet format\"\n \texit(1)\n end\n\nend", "def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end", "def handle_argv\n opt = OptionParser.new(BANNER)\n opt.on( '--[no-]preserve_paragraph', sprintf(\"Preserved paragraph structures? (Def: %s)\", OPTS[:preserve_paragraph].inspect), TrueClass) {|v| OPTS[:preserve_paragraph] = v}\n opt.on( '--lbs-style=STYLE', sprintf(\"One of (t(runcate)|d(elete)|n(one)) (Def: truncate).\", Symbol)) { |v| OPTS[:lbs_style]=v.strip[0].to_sym }\n # opt.on( '--version', \"Display the version and exits.\", TrueClass) {|v| OPTS[:version] = v} # Consider opts.on_tail\n opt.on( '--[no-]debug', \"Debug (Def: false)\", TrueClass) {|v| OPTS[:debug] = v}\n opt.separator \"\" # Way to control a help message.\n opt.separator \"Note:\"\n opt.separator \" Spaces are truncated in default.\"\n\n opt.parse!(ARGV)\n\n OPTS[:lbs_style] = OPTS[:lbs_style].to_s[0].to_sym\n unless %i(t d n).include? OPTS[:lbs_style]\n warn \"ERROR: --lbs-style must be one of (t(runcate)|d(elete)|n(one)), but given (#{OPTS[:lbs_style].inspect})\"; exit 1\n end\n\n OPTS\nend", "def normalization_program\n puts normalize(prompt_and_get_input_from_user)\nend", "def getOptions\n @options = Array.new\n # format of options argument\n optionsPattern = Regexp.new(/\\-[\\w]+/)\n # check to see if options are formatted correctly\n if optionsPattern.match(ARGV[0])\n # get each option and push them to an array \n # start at 1 to ignore - \n for i in 1..ARGV[0].length - 1\n @options.push(ARGV[0][i])\n end # -- end for loop to get options\n else\n abort(\"First argument needs to be an option.\\nExample:\\n\\t ruby OSQuery -i Blood_rune\")\n end # -- end valid options check\nend", "def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def parse_input(input)\n match = input.match(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i)\n\n command, args = match.captures\n args.strip!\n\n [command.downcase.to_sym, args]\n end", "def prescreen_input(args)\n if ((args.nil?) || (args.empty?))\n ['-eq', Date.today.strftime('%Y-%m-%d')]\n elsif ((args.length == 1) && (args[0].is_date?))\n ['-eq', args[0]]\n else\n args\n end\nend", "def run_cmd(input); end", "def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 0.7,\n :cols => 10, :rows => 10,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => true,\n :moveto_color => 'none', :lineto_color => '#ff0000', :background_color => '#fe8736',\n :xshift => 0, :yshift => 0,\n :shiftstep => nil, :shiftstepx => 0, :shiftstepy => 0, :shiftsteps => 15,\n :outputstepfile => 'output/img_%.04d.svg'\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n\n elsif v = a.match(/^--shiftstep=([-.0-9]+)$/) then params[:shiftstep] = v[1].to_f\n elsif v = a.match(/^--shiftstepx=([-.0-9]+)$/) then params[:shiftstepx] = v[1].to_f\n elsif v = a.match(/^--shiftstepy=([-.0-9]+)$/) then params[:shiftstepy] = v[1].to_f\n elsif v = a.match(/^--shiftsteps=([0-9]+)$/) then params[:shiftsteps] = v[1].to_i\n elsif v = a.match(/^--outputstepfile=['\"]*(.+\\.svg)['\"]*$/)\n then\n if v[1].match(/%[.0-9]*d/)\n params[:outputstepfile] = v[1]\n STDERR.puts \"got outputstepfile == #{params[:outputstepfile]}\"\n end\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n unless params[:shiftstep].nil? \n params[:shiftstepx] = params[:shiftstep]\n params[:shiftstepy] = params[:shiftstep]\n end\n\n params\nend", "def command_parse(argv)\n end", "def prepare_input(prompt); end", "def parse_input(params, resource); end", "def parse_args\n doc = <<DOCOPT\nschwifty saves and downloads objects from ipfs, keeping track of their hashes in a garbage collection file in ~/.ipfs/ipfs_pinned_objects.yaml and an objects file in ./ipfs_objects.yaml\n\nUsage:\n schwifty add <files>...\n schwifty bootstrap (--clear | <nodes>... | --file=<bootstrap_list_yaml>)\n schwifty get <files_or_hashes>...\n schwifty gc\n schwifty -h | --help\n schwifty --version\n\nOptions:\n -h --help Show this screen.\n --version Show version.\nDOCOPT\n begin\n Docopt.docopt(doc)\n rescue Docopt::Exit => e\n puts e.message\n exit\n end\n end", "def fixInput()\n\t# Debug output\n\tif $DEBUG then STDERR.puts \"in fixInput()\" end\n\n\tremainingChars = 10\n\tmodifiedInput = \"\"\n\n\tARGV.each do |arg| \n\t\tif arg.length > remainingChars then\n\t\t\tmodifiedInput += arg[0...remainingChars]\n\t\t\tbreak\n\t\telse\n\t\t\tmodifiedInput += arg\n\t\t\tremainingChars -= arg.length\n\t\tend\n\tend\n\n\treturn modifiedInput.downcase\nend", "def user_input\n\tgets\nend", "def question_answer(question) #Takes question as input and return users input\n STDOUT.puts(question)\n return STDIN.gets.strip #Get user input and remove leading and trailing whitespaces\n #gets method reads from the list of files supplied as arguments, only defaulting to the keyboard (or, standard input stream, to be precise) if there are no files.\n #Because passing argument to file on startup, we need prepend gets with reference of STDIN for all place where we expecting user input from keyboard\nend", "def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end", "def input \n\t@plaintext = File.read(ARGV[0]).split(//)\n\t@key = ARGV[1].to_i\n\t@file_out = ARGV[2]\nend", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def input=(_arg0); end", "def parse_command_line()\n opts = GetoptLong.new(\n [ \"--input-file\" , \"-i\", GetoptLong::REQUIRED_ARGUMENT ],\n [ \"--verbose\" , \"-v\", GetoptLong::NO_ARGUMENT ]\n )\n #----------------------------- defaults\n\n opts.each do |opt, arg|\n if (opt == \"--input-file\" ) ; $input_file = arg\n elsif (opt == \"--verbose\" ) ; $verbose = 1\n end\n\n if ($verbose != 0) ; puts \"Option: #{opt}, arg #{arg.inspect}\" ; end\n end\nend", "def parse(input, game)\n method = input.words.first.command_pp\n\n arguments = input.words[1..-1]\n\n output = __send__(\"_#{method}\", arguments.join(\" \"), game)\n end", "def parse_args()\n opts = GetoptLong.new(\n ['--host', GetoptLong::OPTIONAL_ARGUMENT],\n ['--port', GetoptLong::OPTIONAL_ARGUMENT],\n ['--columns', GetoptLong::OPTIONAL_ARGUMENT],\n ['--index', GetoptLong::REQUIRED_ARGUMENT],\n ['--type', GetoptLong::REQUIRED_ARGUMENT]\n )\n\n opts.each do |opt, arg|\n case opt\n when '--host'\n @host = arg\n when '--port'\n @port = arg\n when '--columnns'\n @cols = arg.split(\",\")\n when '--index'\n @index = arg\n when '--type'\n @type = arg\n end\n end\n\n if @index.nil?\n STDERR.puts 'missing argument: --index'\n exit 1\n end\n\n if @type.nil?\n STDERR.puts 'missing argument: --type'\n exit 1\n end\n\n if ARGV.length != 1\n STDERR.puts 'Missing argument: file'\n exit 1\n end\n\n @file = ARGV.shift\nend", "def usage\n puts \"usage: isf2asc.rb isf_filename\"\nend", "def format_arguments; end", "def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend", "def parse_args\n case ARGV[0]\n when '-a'\n # check that no arg was passed with the -a flag.\n if ARGV[1]\n puts \"Error, '-a' flag cannot accept additional arguments.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n parse_directory(File.expand_path(Dir.pwd))\n when '-d'\n ARGV.shift\n ARGV.each do |d|\n unless File.directory?(d)\n puts \"Error, #{d} is not a directory.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n end\n dirs = ARGV.map { |d| File.expand_path(d) }\n dirs.each { |d| parse_directory(d) }\n when \"-f\"\n ARGV.shift\n ARGV.each do |f|\n unless File.extname(f) == '.pp'\n puts \"Error, #{f} is not a '.pp' file\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end \n end\n ARGV.each { |f| PuppetFile.new(File.expand_path(f)) }\n when '-g'\n if ARGV[1]\n puts \"Error, '-g' flag cannot accept additional arguments.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n parse_git_repo\n end\nend", "def input \n @input ||= JSON.parse(File.read(ARGV[0]));\nend", "def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end", "def read_parameters\n params = read_stdin\n return_error(\"Parameter 'target' contains illegal characters\") unless safe_string?(params['target'])\n params\nend", "def format_user_input strip = true\n format_ruby self.user_input, strip\n end", "def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end", "def get_folder_name\n check_if_user_gave_input\n return folder_name = ARGV.first\nend", "def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end", "def gentest argv\n argv = argv.dup\n @both = false\n process_opts(argv) if /^-/ =~ argv.first\n\n @service_controller = deduce_services_controller\n @ui = Hipe::IndentingStream.new($stdout,'')\n file = argv.shift\n mod = deduce_module_from_file file\n mod.spec.invocation_name = File.basename(file)\n get_actuals mod, argv\n @ui.indent!.indent!\n go_app(mod, file)\n go_desc(mod, file) do\n go_exp\n go_act(mod, argv)\n end\n exit(0) # rake is annoying\n end", "def read_input()\n input = []\n \n until ARGV.empty? do\n input.push Integer(ARGV.shift)\n end \n return input\nend", "def say_hello\nputs \"Whats your name?\"\n name = gets.strip #gets info from the user. Strip just takes away the line break\n puts \"Hello #{name}!\" #this is called INTERPOLATION\n end", "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all command line arguments\"\n puts \"-i or --info Display instructions on how to play\"\n puts \"-v or --version Display current application and Ruby version\"\n puts \"start Skip menu and immediately start a new game\"\n puts \"wins Print win counts\"\n puts \"\"\nend", "def extract_arguments!\n return ARGV[0], nil, nil if ARGV.length == 1\n\n raise(ArgumentError, \"Usage: mixtape-bu SOURCE [CHANGES] [DEST]\") unless ARGV.length == 3\n\n ARGV.take(3)\nend", "def input_string; end", "def parse(obj, argv)\n case argv\n when String\n require 'shellwords'\n argv = Shellwords.shellwords(argv)\n else\n argv = argv.dup\n end\n\n argv = argv.dup\n args, opts, i = [], {}, 0\n while argv.size > 0\n case opt = argv.shift\n when /=/\n parse_equal(obj, opt, argv)\n when /^--/\n parse_option(obj, opt, argv)\n when /^-/\n parse_flags(obj, opt, argv)\n else\n args << opt\n end\n end\n return args\n end", "def commander _args\n \"commander _args;\" \n end", "def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend", "def work(argv)\n # all -h equivalent to --help\n argv = argv.map { |a| a == '-h' ? '--help' : a }\n idx = argv.index { |c| !c.start_with?('-') }\n preoption = idx.nil? ? argv.shift(argv.size) : argv.shift(idx)\n\n # handle --version or --help or nothing\n return show(\"SeccompTools Version #{SeccompTools::VERSION}\") if preoption.include?('--version')\n return show(USAGE) if idx.nil?\n\n # let's handle commands\n cmd = argv.shift\n argv = %w[--help] if preoption.include?('--help')\n return show(invalid(cmd)) if COMMANDS[cmd].nil?\n\n COMMANDS[cmd].new(argv).handle\n end", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "def parse_input(input)\n\tinput.split(\" \")\nend", "def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end", "def get_input\n story = gets.chomp\nend", "def do_as_i_said\n if ARGV.length == 0\n puts $usage\n exit\n elsif ARGV[0] == \"-h\"\n\n arguments = ARGV.dup\n \n if arguments.length > 2\n arguments.slice!(2..(arguments.length - 1))\n end\n \n parse_command_line(arguments)\n \n else\n arguments = ARGV.dup\n command = split_arguments! arguments\n \n # Prevent space character from being considered as a separator.\n arguments.map! do |arg|\n if arg == \" \"\n '\" \"'\n else\n arg\n end\n end\n \n exec(\"#{$current_directory}/gimmicode-#{command} #{arguments.join(\" \")}\")\n end\nend", "def parse_argv(argv)\n # Host is always first argument\n host = argv[0]\n\n # Create array for ports\n ports = Array.new\n\n # Ignore the first argument (host), and just traverse the rest\n for i in 1..argv.length - 1\n # If argument contains a hyphen..\n if (argv[i]).include? \"-\"\n # ..split it in two..\n tokens = argv[i].split(\"-\")\n if tokens.length != 2\n # ..if we get more than two tokens, then it's not valid\n puts \"'%s' is not in the form 'number1-number2'\" % argv[i]\n exit(1)\n else\n # ..otherwise, parse both tokens..\n number1 = parse_string_to_port(tokens[0])\n if number1 == -1\n puts \"'%s' is not a valid port number\" % tokens[0]\n exit(1)\n end\n number2 = parse_string_to_port(tokens[1])\n if number2 == -1\n puts \"'%s' is not a valid port number\" % tokens[1]\n exit(1)\n end\n # ..and create the range between number1 and number2\n for j in number1..number2\n # Add the port to the array\n ports.push(j)\n end\n end\n else\n # If there's no hyphen, then just treat the parameter as\n # a single port number\n number = parse_string_to_port(argv[i])\n if number == -1\n puts \"'%s' is not a valid port number\" % argv[i]\n exit(1)\n else\n # Add the port to the array\n ports.push(number)\n end\n end\n end\n\n # Finally, return the host and the port array\n return host, ports\nend", "def get_user_input\n gets.strip\nend", "def take_input\n pp File.open('input.txt').read.split\n end", "def format_input(input)\n raise \"No content in entry\" if input.nil? || input.strip.length == 0\n input_lines = input.split(/[\\n\\r]+/)\n title = input_lines[0].strip\n note = input_lines.length > 1 ? input_lines[1..-1] : []\n note.map! { |line|\n line.strip\n }.delete_if { |line|\n line =~ /^\\s*$/\n }\n\n [title, note]\n end", "def user_prompt(*args)\n print(*args)\n to_return = gets.strip.split\n to_return.collect {|value| Integer(value)}\nend", "def parse_cmd(cmd, flags)\n if cmd.flags?\n args = Raw.arguments_to(cmd.flags.short, flags)\n if args.nil? || args.empty?\n args = Raw.arguments_to(cmd.flags.long, flags)\n end\n else\n args = Raw.arguments_to(cmd.index.to_s, flags)\n end\n unless cmd.type.to_s =~ /stdin/\n return nil if args.nil?\n end\n case cmd.type\n when :stdin\n args = STDIN.gets.strip\n when :stdin_stream\n args = STDIN\n when :stdin_string\n args = STDIN.gets.strip\n when :stdin_strings\n args = []\n while arg = STDIN.gets\n next if arg.nil?\n arg = arg.strip\n args << arg\n end\n args\n when :stdin_integer\n args = STDIN.gets.strip.to_i\n when :stdin_integers\n args = []\n while arg = STDIN.gets\n next if arg.nil?\n arg = arg.strip\n parse = arg.to_i\n if parse.to_s == arg\n args << parse\n end\n end\n args\n when :stdin_bool\n args = STDIN.gets.strip.downcase == \"true\"\n when :single, :string\n args = args.first\n when :strings, :multi\n if cmd.delimiter?\n if args.count > 1\n args = args.first.split(cmd.delimiter)\n else\n args = args.map { |arg| arg.split(cmd.delimiter) }.flatten\n end\n end\n args\n when :integer\n args = args.first.to_i\n when :integers\n if cmd.delimiter?\n if args.count > 1\n args = args.join\n args = args.select { |arg| arg if arg.include?(cmd.delimiter) }\n args = args.map { |arg| arg.split(cmd.delimiter) }.flatten\n else\n args = args.map { |arg| arg.split(cmd.delimiter) }.flatten\n end\n end\n args = args.map(&:to_i)\n when :bool, :bools\n if cmd.delimiter?\n if args.count > 1\n args = args.join\n args = args.select { |arg| arg if arg.include?(cmd.delimiter) }\n args = args.map { |arg| arg.split(cmd.delimiter) }.flatten\n else\n args = args.map { |arg| arg.split(cmd.delimiter) }.flatten\n end\n end\n args = args.map { |arg| arg == \"true\" }\n end\n rescue => e# this is dangerous\n puts e\n nil\n end", "def parseText _args\n \"parseText _args;\" \n end", "def format_input\n\t\t# removing white spaces at the beginning and the end\n\t\t@input_params = @input_params.downcase.strip()\n \tend", "def input(prompt = '', *expected)\n prompt << \" [#{expected.join '/'}]\" unless expected.empty?\n ostream << \"#{prompt}: \" unless prompt.to_s.empty?\n input = @settings[:istream].gets[0..-2]\n unless expected.empty? || expected.include?(input)\n input = input 'Please provide valid input', *expected\n end\n input\n end", "def parse(*argv, into: nil)\n argv = argv[0].dup if argv.size == 1 and Array === argv[0]\n parse!(argv, into: into)\n end", "def getInput ( question )\n puts question\n response = STDIN.gets.strip\n puts\n response\nend", "def get_input\n gets.strip #chomp was also used..\nend" ]
[ "0.69742966", "0.63995683", "0.63152295", "0.6279123", "0.62648135", "0.6214056", "0.61848414", "0.617962", "0.6157279", "0.6141151", "0.61213", "0.609808", "0.6037148", "0.60286355", "0.5957596", "0.59459776", "0.5942399", "0.5937082", "0.5936803", "0.5915276", "0.59096396", "0.59025264", "0.58886945", "0.5886889", "0.5883694", "0.58576196", "0.5853335", "0.5831026", "0.58119166", "0.5798708", "0.57889503", "0.5774629", "0.57686013", "0.5762", "0.57527447", "0.5729434", "0.5728915", "0.5724627", "0.57202697", "0.5714505", "0.57088286", "0.57064337", "0.57064176", "0.5704714", "0.5703534", "0.5702948", "0.5698154", "0.5695208", "0.56890553", "0.56739765", "0.5673407", "0.56687456", "0.5665794", "0.56601846", "0.5660166", "0.5656301", "0.56547415", "0.5652023", "0.5639605", "0.5639296", "0.5631257", "0.5620353", "0.5616643", "0.5614717", "0.5605003", "0.5601154", "0.5599704", "0.5598349", "0.55963653", "0.55916715", "0.5582542", "0.55819035", "0.55789536", "0.55758625", "0.55746347", "0.55568314", "0.55522925", "0.5533488", "0.5524738", "0.5518205", "0.55178684", "0.55142003", "0.5510652", "0.5509847", "0.5503598", "0.55010474", "0.5493614", "0.5493176", "0.5489748", "0.5488772", "0.54872394", "0.5485602", "0.5474773", "0.5468901", "0.54677737", "0.5459252", "0.5457962", "0.54562664", "0.54557705", "0.5445537" ]
0.5605749
64
DELETE /psychologies/1 DELETE /psychologies/1.xml
def destroy @psychology = Psychology.find(params[:id]) @psychology.destroy respond_to do |format| format.html { redirect_to(psychologies_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete params[:id]\r\n redirect_to :action => \"configuration_products\", :id => params[:id]\r\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 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 @apology.destroy\n respond_to do |format|\n format.html { redirect_to apologies_url, notice: 'Apology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tFile.delete(@ontology.url)\n\t\t@ontology.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to ontologies_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @shelf = Shelf.find(params[:id])\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(shelves_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ped_strategy = PedStrategy.find(params[:id])\n #<rck> Ing. César Reyes - Actualiza en Automatico la Jerarquia\n sql = ActiveRecord::Base.connection()\n sql.begin_db_transaction\n hierarchy = \"update ped_strategies\n set hierarchy = hierarchy - 1\n where hierarchy > #{@ped_strategy.hierarchy}\"\n sql.update hierarchy\n sql.commit_db_transaction \n #</rck>\n @ped_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to ped_strategies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration_set = ConfigurationSet.find(params[:id])\n @configuration_set.destroy\n\n respond_to do |format|\n format.html { redirect_to configuration_sets_url }\n format.json { head :no_content }\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 @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 @logotype = Logotype.find(params[:id])\n @logotype.destroy\n\n respond_to do |format|\n format.html { redirect_to(logotypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @logotype = Logotype.find(params[:id])\n @logotype.destroy\n\n respond_to do |format|\n format.html { redirect_to(logotypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ecosystem_typology.destroy\n respond_to do |format|\n format.html { redirect_to ecosystem_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hypothesis.destroy\n respond_to do |format|\n format.html { redirect_to hypotheses_url, notice: 'Hypothesis was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end", "def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_ontologies_and_submissions\n LinkedData::SampleData::Ontology.delete_ontologies_and_submissions\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @variate.destroy\n\n respond_to do |format|\n format.html { redirect_to variates_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 @procedure = Procedure.find(params[:id])\n @procedure.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n end\n\n end", "def destroy\n @compliance.destroy\n\n respond_to do |format|\n format.html { redirect_to(compliances_url) }\n format.xml { head :ok }\n end\n end", "def orchio_delete_graph(kind, to_collection, to_key)\n response = client.send_request(\n :delete,\n inst_args(\n kind: kind,\n to_collection: to_collection,\n to_key: to_key,\n path: \"?purge=true\"\n ))\n orchio_status response, 204\n end", "def destroy\n @decision = Decision.find(params[:id])\n @decision.destroy\n\n respond_to do |format|\n format.html { redirect_to(decisions_url) }\n format.xml { head :ok }\n end\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def destroy\n @psycho_physio_alteration = PsychoPhysioAlteration.find(params[:id])\n @psycho_physio_alteration.destroy\n\n respond_to do |format|\n format.html { redirect_to psycho_physio_alterations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n @socioeconomic_ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(socioeconomic_ocupations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @formula.destroy\n\n respond_to do |format|\n format.html { redirect_to(formulas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @title = \"Destroy Operations\"\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @catastrosdato = Catastrosdato.find(params[:id])\n @catastrosdato.destroy\n\n respond_to do |format|\n format.html { redirect_to(catastrosdatos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @topic_attribute = TopicAttribute.find(params[:id])\n \n @topic_attribute.opinions.each do |opinion|\n opinion.destroy\n end\n \n @topic_attribute.destroy\n\n respond_to do |format|\n format.html { \n redirect_to(root_path)\n #topic_attributes_url\n }\n format.xml { head :ok }\n end\n end", "def destroy\n @data_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @confrence = Confrence.find(params[:id])\n @confrence.destroy\n\n respond_to do |format|\n format.html { redirect_to confrences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @promos = Promos.find(params[:id])\n @promos.destroy\n\n respond_to do |format|\n format.html { redirect_to(promos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @action_graphic = ActionGraphic.find(params[:id])\n @action_graphic.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_graphics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_decision\n\t\t# ES: Por medio de la configuracion del modelo, todo lo relacionado con esa decision, y sus hijos se borrará también\n\t\t# EN: According to the model configuration, all information related to that decision and it sons will be deleted also\n\t\tdecision = GovernanceDecision.find(params[:idDecision].to_i)\n\t\thijasToDelete = view_context.recursiveDarHijos(decision, []) # ES: Agrega sus hijos - EN: Add it sons\n\t\thijasToDelete.push(decision.id) # ES: Se agrega a si misma - EN: Add it itself\n\n\t\tdecision.destroy\n\n\t\trespond_to do |format|\n\t\t\t# ES: Envia el texto:\n\t\t\t# EN: Send the text:\n\t\t\tformat.json {render json: hijasToDelete}\n\t end\n\tend", "def destroy\n @psicologic_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to psicologic_evaluations_url, notice: 'Psicologic evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n @server_rack = ServerRack.find(params[:id])\n @server_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to(server_racks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @slitting = Slitting.find(params[:id])\n @slitting.destroy\n\n respond_to do |format|\n format.html { redirect_to(slittings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @prd_attribute = PrdAttribute.find(params[:id])\n @prd_attribute.destroy\n\n #delete_rules()\n\n respond_to do |format|\n format.html { redirect_to(prd_attributes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @choice.destroy\n\n head :no_content\n end", "def destroy\n @pig = Pig.find(params[:id])\n @pig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pigs_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 @scoop.destroy\n respond_to do |format|\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @choice_set.destroy\n respond_to do |format|\n format.html { redirect_to choice_sets_url, notice: 'Choice set was successfully destroyed.' }\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.xml { head :ok }\n end\n end", "def destroy\n @domicile_type = DomicileType.find(params[:id])\n @domicile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hypothetical.destroy\n respond_to do |format|\n format.html { redirect_to hypotheticals_url, notice: 'Destroyed!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expression_relationship = ExpressionRelationship.find(params[:id])\n @expression_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recreation_service_typology.destroy\n respond_to do |format|\n format.html { redirect_to recreation_service_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @konfig = Konfig.find(params[:id])\n @konfig.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_konfigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @criteria = Criteria.find(params[:id])\n @criteria.destroy\n\n respond_to do |format|\n format.html { redirect_to(criterias_url) }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to(csos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @predicition = Predicition.find(params[:id])\n @predicition.destroy\n\n respond_to do |format|\n format.html { redirect_to(predicitions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @power = Power.find(params[:id])\n @power.destroy\n\n respond_to do |format|\n format.html { redirect_to(powers_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 @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to(surveys_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alternatives_set = AlternativesSet.find(params[:id])\n @alternatives_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(alternatives_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sotto_categoria = SottoCategoria.find(params[:id])\n @sotto_categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(sotto_categorie_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @protocolo = Protocolo.find(params[:id])\n @protocolo.destroy\n\n respond_to do |format|\n format.html { redirect_to(protocolos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ecology.destroy\n respond_to do |format|\n format.html { redirect_to ecologies_url, notice: 'Ecology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommand = Recommand.find(params[:id])\n @recommand.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fact = Fact.find(params[:id])\n\t\t@parent = @fact.parent\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/nuniverse-of/#{@parent.unique_name}\" }\n format.xml { head :ok }\n end\n end", "def destroy\n @microsilica = Microsilica.find(params[:id])\n @microsilica.destroy\n\n respond_to do |format|\n format.html { redirect_to(microsilicas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pluto_process_definition = collection.find(params[:id])\n @pluto_process_definition.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def destroy\n # set_chef\n @chef.destroy\n redirect_to chefs_path\n end", "def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @chore = Chore.find(params[:id])\n @chore.destroy\n\n respond_to do |format|\n format.html { redirect_to(chores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @components_grip = Components::Grip.find(params[:id])\n @components_grip.destroy\n\n respond_to do |format|\n format.html { redirect_to(components_grips_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pump_line = PumpLine.find(params[:id])\n @pump_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(pump_lines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n common_name = @taxon.common_name\n @taxon.destroy\n respond_to do |format|\n format.html { redirect_to taxons_path, notice: \"Species: '#{common_name}' was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @coin_set = CoinSet.find(params[:id])\n @coin_set.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @clique = Clique.find(params[:id])\n @clique.destroy\n\n respond_to do |format|\n format.html { redirect_to(cliques_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @prestamo = Prestamo.find(params[:id])\n @prestamo.destroy\n\n respond_to do |format|\n format.html { redirect_to(prestamos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @micropst = Micropst.find(params[:id])\n @micropst.destroy\n\n respond_to do |format|\n format.html { redirect_to(micropsts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @water_system_typology.destroy\n respond_to do |format|\n format.html { redirect_to water_system_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @choice_question = ChoiceQuestion.find(params[:id])\n question_content_id = @choice_question.question_content.id\n destroy_default_rule_and_display_field(@choice_question)\n @choice_question.destroy\n respond_to do |format|\n format.html { redirect_to survey_path(@survey_version.survey), :notice => \"Successfully deleted choice question.\"}\n format.js { render :partial => \"shared/element_destroy\" }\n end\n # Remove any rules which have actions that point to the choice question_content that just got deleted.\n Action.where(\"value LIKE ?\", question_content_id).each do |a|\n if a.rule.present?\n a.rule.destroy\n end\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @socio.destroy\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prop = Prop.find(params[:id])\n @prop.destroy\n\n respond_to do |format|\n format.html { redirect_to(props_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.61582494", "0.6086254", "0.6056867", "0.59706193", "0.5956572", "0.5942821", "0.5926905", "0.5917924", "0.5891654", "0.5885887", "0.58780557", "0.5869463", "0.5869463", "0.58542603", "0.5851631", "0.5842676", "0.5840533", "0.5837158", "0.58360296", "0.58262134", "0.58073163", "0.579225", "0.5786312", "0.5758552", "0.57555366", "0.57529795", "0.5750084", "0.5744283", "0.57411146", "0.5739459", "0.5734586", "0.5733386", "0.57321316", "0.5731322", "0.57274616", "0.57238376", "0.57113004", "0.57103705", "0.5705774", "0.56957173", "0.569531", "0.5694438", "0.5690896", "0.5690896", "0.56891304", "0.56884986", "0.5687403", "0.5686676", "0.5686186", "0.56800914", "0.56787646", "0.56761014", "0.5660488", "0.5652963", "0.5650255", "0.5649226", "0.5648179", "0.564525", "0.5643492", "0.56432503", "0.5642914", "0.5641994", "0.56404", "0.56402576", "0.5640107", "0.5634121", "0.56339645", "0.5633013", "0.56314373", "0.56305593", "0.5628616", "0.5628533", "0.5628005", "0.5627568", "0.5626093", "0.5626012", "0.5626", "0.5625206", "0.56220406", "0.562009", "0.5618595", "0.561851", "0.5617403", "0.5614371", "0.56126666", "0.56109333", "0.56092185", "0.56092185", "0.5606078", "0.560552", "0.56022245", "0.5600837", "0.55996627", "0.55993366", "0.5599047", "0.5598515", "0.5593174", "0.5592384", "0.559", "0.55898243" ]
0.7391541
0
com passagem de parametros
def meu_metodo(parametro, parametro1 = 0) #quando o parametro for opcional pode se atribuir um valor padrão como 0 puts "meu metodo foi executado. parametros #{parametro} #{parametro1}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; 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 parameters=(_arg0); end", "def parameters=(_); end", "def param; end", "def param; end", "def params=(value); end", "def params() @param_types end", "def get_parameters; end", "def get_parameters; end", "def parse_parameters; end", "def params=(_arg0); end", "def params=(_arg0); end", "def params(*); {}; end", "def params=(_); end", "def parameterize(value); end", "def parameter_string\n\t\tend", "def parametro_params\n params.require(:parametro).permit(:descripcion, :observacion)\n end", "def methodWithParams nombre,apellido\n puts \"Mi nombre es #{nombre} #{apellido}\" \nend", "def parametrage_params\n params.require(:parametrage).permit(:libelle, :typeParam)\n end", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def params\n raise NotImplementedError\n end", "def initialize(parametros)\n # En cada variable intanciada le asignamos un hash con la variable correspondiente\n @villano = parametros[:villano]\n @frase = parametros[:frase]\n end", "def objetovalparametro_params\n params.require(:objetovalparametro).permit(:objeto_id, :valparametro_id)\n end", "def parameter_types; end", "def parameters\n nil\n end", "def parameters()\n @melody = params[:melody].upcase.split(\",\") # create array of notes in melody parameter\n @shift = params[:shift] # shift parameter\nend", "def parameter_detail_params\n params.require(:parameter_detail).permit(:parameter_id, :afp_id, :aporte, :seguro, :comision_flujo,:comision_mixta,:comision_mixta_saldo)\n end", "def parameter_type; end", "def parameter_type; end", "def parsed_params\n \n end", "def query_parameters; end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def quote_params(params); end", "def to_param; end", "def params\n @parameters\n end", "def all_params; end", "def agi; param(6); end", "def arguments; end", "def arguments; end", "def arguments; end", "def query_parameters\n end", "def parameters\n @parameters || []\n end", "def pha; sparam(3); end", "def objeto_params\n params.require(:objeto).permit(:name, :valparametros => [:id, :valor, :parametro_id], :objetovalparametros_attributes => [:id, :parametro_id, :objeto_id, :valparametro_id, :_destroy], :parametrizacaos_attributes => [:objeto_id, :parametro_id, :_destroy], :parametros_attributes => [:id, :name, :value, :_destroy])\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def parameters\n @parameters\n end", "def nombr_comune_params\n params[:nombr_comune]\n end", "def enquete_params\n params.fetch(:enquete, {})\n end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def print_parameters()\n @h.each do |clave, valor|\n \n $LOG.debug \"The Parameter #{clave} have the value \" +valor.to_s\n end\n end", "def _wrap_parameters(parameters); end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def print_parameters()\n @params.each do |clave, valor|\n #$LOG.debug \"The Parameter #{clave} have the value \" +valor.to_s\n puts \"#{clave} = #{valor} \"\n end\n end", "def equipament_params\n\t\t\tdelocalize_config = { :valor => :number }\n\t\t\tparams.require(:equipament).permit( :name_equipament,:fornecedor ,:marca_mod ,:rec_manutencao ,:obs_equipament ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:valor, :depreciacao, :proposal_id, :type_equipament_id, :sub_type_id, :control_print).delocalize(delocalize_config)\n\t\tend", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def datos_de_pasaje_params\n #params.require[:datos_de_pasaje]\n params.require(:datos_de_pasaje).permit(:asiento_de_servicio_id, :pasajero_id, :servicio_id)\n end", "def usuario_params\n \n end", "def tipomaquinat_params\n # params.require(:tipomaquinat).permit(:tipomaquina, :descripcion, :tipomaquinat)\n params.require(:tipomaquinat).permit(:tipomaquina, :descripcion) # :tipomaquinat) ESTABA DE MAS?? DEFAULT O NO? CREO QUE NO. OK.\n #params.require(:tipomaquinat).permit(:tipomaquina)\n end", "def valid_params?; end", "def query_params=(_arg0); end", "def request_parameters; end", "def get_parameters\r\n @parameters\r\n end", "def lectorDeParametros (argumentos)\n if ((argumentos.length == 0) || (argumentos.length > 4))\n raise ArgumentError, \"Ha ingresado un numero incorrectos de parametros\"\n else\n argumentos.each do |valores|\n\n if (esUnNumero?(valores))\n @numero = valores\n elsif ((valores.downcase.include? \"--format=quiet\") || (valores.downcase.include? \"--format=pretty\"))\n @formato = valores.downcase\n elsif ((valores.downcase.include? \"--sort=des\") || (valores.downcase.include? \"--sort=asc\"))\n @orden = valores.downcase\n elsif (valores.downcase.include? \"--output-file=\")\n @archivoRuta = valores[14..-1]\n\telse\n\t raise ArgumentError, \"El parametro #{\"valores\"}es incorrecto\"\n end\n end\n end\n end", "def update_params\n raise 'Sovrascrivi in figli'\n end", "def compileparameterlist\n\n end", "def check_params; true; end", "def params\n '(%s)' % @format\n end" ]
[ "0.744041", "0.744041", "0.744041", "0.744041", "0.744041", "0.744041", "0.744041", "0.744041", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7339775", "0.7219137", "0.7045244", "0.70148766", "0.70148766", "0.6917026", "0.68674797", "0.6836341", "0.6836341", "0.68144625", "0.6780022", "0.6780022", "0.6773729", "0.67703927", "0.66957116", "0.66877306", "0.6667041", "0.660729", "0.6488066", "0.6438353", "0.6438353", "0.6407745", "0.63845843", "0.63591206", "0.631872", "0.62712216", "0.6263902", "0.6223999", "0.62027967", "0.62027967", "0.61993474", "0.6170573", "0.6159462", "0.6159462", "0.6159462", "0.6159462", "0.6159462", "0.61572546", "0.61554044", "0.61477554", "0.61366117", "0.61260706", "0.6125252", "0.6125252", "0.6125252", "0.60825664", "0.60820687", "0.6081534", "0.6076333", "0.6074176", "0.6074176", "0.60736847", "0.60715485", "0.60420394", "0.6037978", "0.6037978", "0.6037978", "0.6037978", "0.60272014", "0.602069", "0.60206234", "0.60204285", "0.6012164", "0.60105", "0.6008024", "0.60002065", "0.59977686", "0.59910876", "0.5974559", "0.59695065", "0.59651744", "0.5963853", "0.5963415", "0.59592384", "0.5955525", "0.5948514" ]
0.613312
65
string The String to be checked letter The String to be checked for. Examples index_of_char("Hello", "o") => "4" Returns the index or nil if not found.
def index_of_char(string, letter) i = 0 while i < string.length if string[i] == letter return i end i += 1 end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_of_char(string, character)\n i = 0\n position = nil\n while i < string.length\n if string[i] == character\n position = i\n break\n else\n i += 1\n end\n end\n return position\nend", "def index_of_char(str, char)\n i = 0\n while i < str.length\n if str[i] == char\n return i\n end\n\n i += 1\n end\n\n return nil\nend", "def index_of_char(string, character)\n i = 0\n output = []\n while i < string.length\n if character == string[i]\n output << i\n end\n i += 1\n end\n if output == []\n output = nil\n end\n return output\nend", "def first_vowel_index(string)\n letter = first_vowel(string)\n if letter == nil\n return nil\n end\n string.index letter\nend", "def indexof(string)\n return @container.index(string) \n end", "def char_index(length:, string:)\n i = 0\n char_count = 0\n while i < string.bytesize && char_count < length\n ordinal = string[i].ord\n \n if (ordinal & 0x80) == 0 # 1-byte char\n char_count += 1\n elsif (ordinal & 0xF0) == 0xF0 # 4-byte char\n char_count += 1\n i += 3\n elsif (ordinal & 0xE0) == 0xE0 # 3-byte char\n char_count += 1\n i += 2\n elsif (ordinal & 0xC0) == 0xC0 # 2-byte char\n char_count += 1\n i += 1\n else\n # likely in middle of char; scan forward up to 2 more\n # bytes\n # also, have a boundary condition here; we might have\n # a short read so if we run out of bytes to check just\n # ignore this half-formed char\n j = i + 1\n k = 0\n while k < 2 && j < string.bytesize\n break if (string[j].ord & 0xC0) != 0x80\n k += 1\n j += 1\n i += 1\n end\n end\n \n i += 1\n end\n i\n end", "def get_character(full_string, index)\n full_string[index]\nend", "def customIndex(string , substring)\n if string.include?(substring)\n length=substring.length\n string.chars.each_with_index do |ele , index|\n sequence=string[index , length]\n return index if sequence==substring\n end\n else\n return nil\n end\nend", "def custIndex(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def get_character(full_string, index) # defines a method get_character with two parameters full_string and index\n full_string[index] # looks for index within the variable full_string ????\nend", "def indexes_of(char, str)\n indexes = []\n str.chars.each_with_index do |current_char, index|\n indexes << index if current_char.eql?(char)\n end\n indexes\n end", "def custom_index(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def custom_index(string,substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def index_of(sentence, letter)\n\tcounter=0\n\tsentence_split=sentence.split(//)\n\twhile counter<sentence.length\n\t\tcounter=counter+1\n\t\tif sentence_split[counter] == letter\n\t\t\treturn counter\n\t\tend\n\tend\n\t-1\nend", "def match_input(letter)\n return $word.index(letter[0])\nend", "def index_str(str, substr)\n i = 0\n substrlength = substr.length\n while i < str.length\n if str[i, substrlength] == substr\n return i\n end\n i += 1\n end\n return nil\nend", "def costum_index(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def each_index_of_char_in_string(string, char)\n index = 0\n while index\n index = string.index(char, index)\n if index\n yield index\n index += 1\n end\n end\n end", "def last_index(str, char)\n i = 0\n str.each_char.with_index do |ch,ind|\n if ch == char\n i = ind\n end\n end\n return i\nend", "def letter_to_index(letter)\n ALPHA26.index(letter.upcase)\n end", "def first_vowel\n @input_str.index(/[aeiouAEIOU]/) #Returns an Integer\n end", "def last_index(str, char)\n\tidx = []\n \ti = 0\n\n\twhile i < str.length\n if str[i] == char\n idx << i\n end\n i += 1\n end\n \treturn idx[-1]\nend", "def find_first_vowel (word)\n word.split('').each.with_index do |char, index|\n if is_vowel?(char)\n # Return the index of that vowel\n return index\n end\n end\n # Return index 0 if no vowel is found\n return 0\n end", "def first_unique_character(string)\n idx1 = 0\n while idx1 < string.length\n idx2 = 0\n while idx2 < string.length\n break if string[idx1] == string[idx2] && idx1 != idx2\n idx2 += 1\n end\n\n return idx1 if idx2 == string.length\n\n idx1 += 1\n end\n\n # No unique character at all!\n nil\nend", "def getCharByOffset(char, offset=0)\n # Chars could be in the upper alphabet, the lower alphabet, or neither.\n indexUpper = $ALPHABET.index(char)\n indexLower = $alphabet.index(char)\n if indexUpper\n i = calculateOffset(indexUpper, offset)\n char = $ALPHABET[i] # Get the char at that index\n elsif indexLower\n i = calculateOffset(indexLower, offset)\n char = $alphabet[i]\n end\n char\n end", "def last_index(str, char)\n return str.chars.each_with_index.select { |key, value| key == char }.map { |found| found.last }.last\nend", "def get_first_char(word)\n index = 0\n ret = word[0]\n word.split(//).each { |char|\n index+=1\n if char.match(/[a-zA-Z]/)\n ret = char\n break\n end\n }\n return ret, index\nend", "def rightMostChar string, char\n\tindex = -1\n\tstring.each_char.with_index(0) do |char_str, i|\n\t\tif char_str == char\n\t\t\tindex = i\n\t\tend\n\tend\n\treturn index\nend", "def to_index(string)\n /^\\d+/.match?(string) ? string.to_i : -1\n end", "def contains_char(string, char)\n i = 0\n while i < string.length\n if string[i] == char\n return true\n end\n i += 1\n end\n return false\nend", "def input_to_index( inputString )\n index = inputString.to_i - 1\n #puts \"Index: #{index}\"\n if (index.between?(0,8) == true )\n return index\n else\n return -1\n end\n end", "def first_vowel_index(word)\n if first_vowel(word) != nil \n return word.index(first_vowel(word)) \n else \n return nil\n end \nend", "def first_vowel(str)\n regex = /[aeiouAEIOU]/\n str.index(regex)\nend", "def index_of_the_first_vowel(str)\n #v = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n #v.map { |c| [str.index(c)] }.first\n s = string.chars.count {|char| vowels.include? (char)}\nend", "def last_index(str, char)\n i = str.length - 1\n while i >= 0\n if str[i] == char\n return i\n end \n i -= 1\n end\nend", "def last_index(str, char)\n arr = str.chars\n\n setupArr = arr.map.with_index do |ele, idx|\n\n if ele == char\n idx\n else\n 0\n end\n end\n\n returnStr = setupArr.select { |ele| ele > 0 }\n\n return returnStr[-1]\n\nend", "def non_repeating_char_index(string) \n hash = {}\n\n string.length.times do |i|\n if !hash.has_key?(string[i])\n hash[string[i]] = 1\n else\n hash[string[i]] += 1\n end\n end\n\n char = hash.select { |char, occurence| occurence == 1}\n .map { |char, occurence| char }[0]\n\n return string.index(char) \nend", "def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end", "def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end", "def index(str, *args)\n bidx = str.index(*args)\n bidx ? (str.slice(0...bidx).unpack(\"U*\").size) : nil\n end", "def str_str(haystack, needle)\n return 0 if needle == \"\"\n \n haystack.each_char.with_index do |char, idx|\n if char == needle[0]\n return idx if haystack[idx, needle.length] == needle\n end\n end\n -1\nend", "def letter_to_index(letter)\n alphabet_array.index(letter.upcase)\n end", "def character_by_character(string)\nend", "def letter_index(letter)\n @places = []\n @split_word.each_with_index do |char, index|\n if char == letter\n @places << index\n end\n end\n end", "def column_index_from_string(s)\n s = s.upcase\n len = s.length\n case\n when len == 1\n (s[0].ord - 64)\n when len == 2\n ((1 + (s[0].ord - 65)) * 26) + (s[1].ord - 64)\n when len == 3\n ((1 + (s[0].ord - 65)) * 676) + ((1 + (s[1].ord - 65)) * 26) + (s[2].ord - 64)\n when len > 3\n raise Xl::ColumnStringIndexError, \"Column string index can't be longer than 3 characters\"\n else\n raise Xl::ColumnStringIndexError, \"Column string index can't be empty\"\n end\n end", "def character_score(character)\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n alphabet.index(character) + 1\nend", "def last_index(str, char)\n \tarry = []\n\tstr.split(\"\").map.with_index do|i, indx|\n\tif i == char\n arry << indx\n end\n end\n return arry[-1]\nend", "def last_index(str, char)\n\tlength = str.length - 1\n \twhile length >= 0\n \tif str[length] == char\n return length\n end\n \tlength -= 1\n end\nend", "def indexOfVowel(letter,vowels)\n vowels.index(letter)\nend", "def firstChar(str, f_index)\n if alpha(str[f_index])\n return str[f_index], f_index\n end\n firstChar(str, f_index += 1) \n end", "def contains_char(str, char)\n i = 0\n while i < str.length\n if str[i] == char\n return true\n end\n\n i += 1\n end\n\n return false\nend", "def uindex_to_index(char_index)\n return nil if char_index.nil?\n if char_index < 0 || char_index > jlength\n raise RangeError, 'index out of range'\n end\n \n chars = split('')\n byte_index = 0\n char_index.times do |i|\n byte_index += chars[i].length\n end\n byte_index\n end", "def lookup(string)\r\n return 2 ** (string.chr.downcase.ord - ('a'.ord))\r\n end", "def first_char_with_ascii_gr8ter_120(input)\n input.find do |c|\n c.ord > 120\n end\nend", "def get_char_number(char)\n a = 'a'.ord\n z = 'z'.ord\n val = char.ord\n\n if a <= val && val <= z\n return val - a\n end\n\n -1\nend", "def str_index_of(str1, str2)\n if str_include(str1, str2)\n get_index(str1, str2)\n else\n return -1\n end\nend", "def find_missing_letter(string)\n string = string.split(\"\")\n f_letter = string.first\n l_letter = string.last\n all_letters = f_letter.upto(l_letter).to_a\n missing = all_letters - string \n if missing == []\n return nil\n else\n return missing\n end \nend", "def input_to_index(string)\nstring.to_i-1\nend", "def char_data_for(char_string)\n id = char_string.ord\n @char_data.select{|cd| cd.id == id}.first\n end", "def last_index(str, char)\n return (str.length - 1) - str.reverse.index(char)\nend", "def get_letter(word, index)\n if word[index] == 'Q' && index+1 < word.length && word[index+1] == 'U'\n return 'Qu'\n end\n\n return word[index]\n end", "def find_vowel_index(word, char_idx, count_direction)\n vowel_index = char_idx\n word.length.times do\n if is_vowel?(word[char_idx])\n vowel_index = char_idx\n break\n end\n char_idx += count_direction\n end\n return vowel_index\nend", "def getChar\n if @index <= @code.size - 1\n return @code[@index] if !@code[@index].nil?\n end\n # If nil return empty string.\n return nil\n end", "def index(letter,start=0)\n if start >= left.length\n left.length + right.index(letter,start-left.length)\n else\n left.index(letter,start) || left.length + right.index(letter)\n end\n rescue\n nil\n end", "def rindex_method\n\n puts \"type string:\"\n string = gets.chomp\n puts \"trype letter to find:\"\n find_char = gets.chomp\n\n puts \"So the question is, how many character spots in does the righmost occurance of \\\"#{find_char}\\\" exist?\"\n array = string.chars\n counter = 0\n total_char = string.length - 1\n backwards_array = array.reverse\n if array.include?(find_char) == true\n while true\n if backwards_array [(0 + counter.to_i)] == find_char.to_s\n puts \"the character \\\"#{find_char}\\\" is indexed at \" + (total_char-counter).to_s + \" spots in at the rightmost place\"\n break\n else\n counter += 1\n end\n end\n else\n puts \"try again, the character \\\"#{find_char}\\\" does not exist within the string \\\"#{string}\\\"\"\n end\nend", "def str_byte_index(haystack, needle, offset = 0)\n haystack.index(needle, offset)\n end", "def input_to_index(string)\n string.to_i - 1\nend", "def index(str, pos)\n case\n when @left.size <= pos\n @right.index(str, pos - @left.size)\n when (ret = @left.index(str, pos))\n ret\n else\n self.each_char_from(pos){|c, i|\n }\n # Search is done for <= @left[]\n left_s = kkk\n left_p = pos\n end\n end", "def input_to_index(str)\n if str.to_i >= 0 && str.to_i <=8\n return str.to_i - 1\n end\nend", "def count_char(string, character)\n i = 0\n output = 0\n while i < string.length\n if character == string[i]\n output += 1\n end\n i += 1\n end\n return output\nend", "def findMatch(char,word)\n\t(0..4).each do |j|\n\t\tif char.upcase == word[j].upcase\n\t\t\treturn \"? \"\n\t\tend\n\tend\n\treturn \"X \"\nend", "def letter?(string)\n string =~ /[A-Za-z]/\n end", "def input_to_index(string)\r\n input = string.to_i\r\n user_input = input - 1\r\nend", "def input_to_index(string_input)\n\n #coverting string input to an integer and subtracting it by 1\n (string_input.to_i) - 1\n\nend", "def has_letter(c, word)\n word.each_char do |i|\n if i == c\n return true\n end\n end\n false\nend", "def arrayplace (letter)\n array= \"abcĉdefgĝhĥijĵklmnoprsŝtuŭvz \".chars\n array.find_index(letter)\nend", "def letter?(char)\n char[/[a-zA-Z]/] == char\nend", "def start_of_word(str, number)\n\treturn str[0, number]\nend", "def count_char(string, char)\n string.scan(/#{char}/i).size\nend", "def start_of_word (str, num)\n\n str[0, num]\n\nend", "def char_indices(str)\n indices = Hash.new { |char, idx| char[idx] = [] }\n str.each_char.with_index { |char, idx| indices[char].push(idx) }\n indices\nend", "def substring_of_string(string, substring)\n sub_i = 0\n\n string.each_char.with_index do |char, i|\n if substring[sub_i] == char\n return true if sub_i == substring.length - 1\n sub_i += 1\n else\n if substring[0] == char\n sub_i = 1\n else\n sub_i = 0\n end\n end\n end\n\n false\nend", "def char_indices(str)\n indices = Hash.new { |h, k| h[k] = [] }\n\n str.each_char.with_index { |char, idx| indices[char] << idx }\n\n indices\nend", "def vowel(letter)\n vowels = \"aeiou\"\n vowel_index = vowels.index(letter) + 1\n next_letter = vowels[vowel_index]\nend", "def first_non_repeated_char(string)\n store = {}\n\n string.each_char do |char|\n if store[char]\n store[char] += 1\n else\n store[char] = 1\n end\n end\n\n string.each_char do |char|\n return char if store[char] == 1\n end\n\n nil\nend", "def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end", "def index_of_the_first_vowel(str)\n vowels_array = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\n def check_if_in_array(check, array)\n array.each do |i|\n if check.upcase == i.upcase\n return true\n end\n end\n\n return false\n end\n \n index = 0\n str.chars.each do |i|\n if check_if_in_array(i, vowels_array)\n return index\n end\n\n index += 1\n end\nend", "def last_index(str, char)\n\tarr = str.split(\"\")\n \tarr2 = []\n \t# print arr\n \tarr.map.with_index do |letter, i|\n \tif letter == char\n \tarr2 << i\n end\n end\n \tputs\n \treturn arr2[-1]\nend", "def charChange(char)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n charPosition = alpha.index(char)\n newChar = alpha[charPosition - 1]\n return newChar\nend", "def first_uniq_char(s)\n checked_letters = []\n \n s.split(\"\").each_with_index do |letter, idx|\n unique = true\n if !checked_letters.include?(letter)\n checked_letters << letter\n for i in (idx+1)..(s.length-1) do\n if letter == s[i]\n unique = false\n break\n end\n end\n else\n unique = false\n end\n return idx if unique\n end\n -1\nend", "def lastChar(str, l_index)\n if alpha(str[l_index])\n return str[l_index], l_index\n end\n lastChar(str, l_index -= 1)\n end", "def findFirstNonrepeatingCharacterBruteForce(string)\n\tcharactersArray = string.split(\"\")\n\tuniqueCharsArray = charactersArray.uniq\n\tfor char in uniqueCharsArray\n\t\tcounter = 0\n\t\tfor i in 0..charactersArray.length-1\n\t\t\tif charactersArray[i] == char\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\t\tif counter == 1\n\t\t\treturn char\n\t\tend\n\tend\n\treturn nil\nend", "def ruby_test(str)\n if(str[1,4] == \"Ruby\")\n return (str[5, str.length()]);\n else\n return str;\n end\n end", "def vowel(vowel_letter)\r\n vowel = \"aeiou\"\r\n current_location = vowel.index(vowel_letter)\r\n new_vowel = current_location + 1\r\n if vowel.index(vowel_letter) == 4\r\n results = vowel[0]\r\n else\r\n results = vowel[new_vowel]\r\n end\r\n results\r\nend", "def char_counter_1(string, char)\n string.scan(/#{char}/).length\nend", "def test_index word, guess, index\r\n (word[index] == guess)? \"!\" : \"?\" #if the indexes match it means outputs a \"!\", else it means the letter exists in the word but not in that exact index and outputs a \"?\" \r\nend", "def char_indices(str)\n indices = Hash.new { |hash, key| hash[key] = [] }\n\n str.each_char.with_index { |char, index| indices[char].push(index) }\n\n indices\nend", "def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend", "def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend", "def closest_character_index(position)\n\t\t\t# Move caret into position\n\t\t\t# Try to get as close to the position of the cursor as possible\n\t\t\twidth = @font.width(@string, @height)\n\t\t\tx = @position.x\n\t\t\tmouse_x = $window.mouse.position_in_world.x\n\t\t\t\n\t\t\t# Figure out where mouse_x is along the continuum from x to x+width\n\t\t\t# Use that to guess what the closest letter is\n\t\t\t# * basically, this algorithm is assuming fixed width, but it works pretty well\n\t\t\tpercent = (mouse_x - x)/width.to_f\n\t\t\ti = (percent * (@string.length)).to_i\n\t\t\t\n\t\t\ti = 0 if i < 0\n\t\t\ti = @string.length if i > @string.length\n\t\t\t\n\t\t\treturn i\n\t\tend" ]
[ "0.7835206", "0.76471406", "0.7409047", "0.709801", "0.70619327", "0.7061357", "0.70180374", "0.6688983", "0.66763335", "0.66719484", "0.6631625", "0.6607552", "0.6589543", "0.65614766", "0.65571266", "0.6525291", "0.64588773", "0.6450701", "0.6373768", "0.6306992", "0.6242094", "0.6161711", "0.6147678", "0.61463743", "0.61143136", "0.6098348", "0.6075431", "0.60653067", "0.6048656", "0.60485375", "0.60301125", "0.60219353", "0.6007454", "0.5961413", "0.5958347", "0.5943964", "0.59357464", "0.59275836", "0.59275836", "0.59013015", "0.5900628", "0.5884615", "0.58447766", "0.5842777", "0.5838148", "0.5832923", "0.5824867", "0.5820826", "0.57932603", "0.57646745", "0.57562983", "0.5731044", "0.5724479", "0.57208216", "0.57020557", "0.56510985", "0.5636258", "0.56309694", "0.5628977", "0.56248194", "0.56054926", "0.56026", "0.5599017", "0.558436", "0.5583844", "0.5580373", "0.557619", "0.5572248", "0.5561681", "0.5561203", "0.55581146", "0.5552965", "0.5552461", "0.5550499", "0.55332005", "0.5522519", "0.5514522", "0.5500056", "0.5468265", "0.5452493", "0.54469985", "0.54388523", "0.5438117", "0.5433644", "0.5433523", "0.5429115", "0.5425897", "0.5420514", "0.54164445", "0.5407338", "0.5399179", "0.5388794", "0.53884935", "0.5386972", "0.5375191", "0.5371361", "0.53701746", "0.53644264", "0.53644264", "0.5361471" ]
0.78389734
0
Require token at instantiation
def initialize(key) @key = key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_tokens\n @tokens_required = true\n end", "def initialize(token)\n @token = token.freeze\n end", "def initialize(token)\n @token = token\n end", "def initialize(token)\n @token = token\n end", "def initialize(token)\n #accepts a token to assign\n @token = token\n end", "def initialize(token:)\n @token = token\n end", "def initialize(token)\n @token = token\n end", "def initialize(token)\n\t\t@token = token\n\tend", "def initialize(token)\n @token = token\n end", "def initialize(token)\n @token = token\n end", "def initialize(token = nil)\n @token = token\n end", "def initialize(token) \n self.token_set = token\n end", "def initialize(token = \"X\")\n\t\t@token = token\n\tend", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def initialize\n setup_token\n end", "def initialize(name, token)\n @name = name\n @token = token\n end", "def token=(_arg0); end", "def token=(_arg0); end", "def token=(_arg0); end", "def token\n end", "def initialize(token:)\n raise Fitbark::Errors::TokenNotProvidedError if token.nil?\n\n @token = token\n end", "def initialize(token)\n @token = token #when we initialize a player, the game knowns each player has a specific token\n end", "def ensure_token!(instance)\n reset_token!(instance) unless token_set?(instance)\n get_token(instance)\n end", "def initialize(token)\n super\n self.token == \"X\" ? @opp_token = \"O\" : @opp_token = \"X\"\n end", "def check_token\n end", "def require_api_token\n end", "def k_require!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n\n\n\n type = K_REQUIRE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 361:4: 'require'\n match( \"require\" )\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__, 27 )\n\n\n end", "def initialize(token_object)\n @token_object = token_object\n end", "def set_internal_token!\n self.token ||= generate_token\n end", "def require_definition(identifier); end", "def require_definition(identifier); end", "def token(content, kind); end", "def token\n @token ||= Token.new(config)\n end", "def process_token(tokenline)\n \n begin\n camelcased = tokenline.token.to_s.capitalize.gsub(/_\\w/){|w| w[1].capitalize}\n tokenklass = Token.const_get \"#{camelcased}Token\"\n instance_exec(tokenklass, tokenline.content, &(tokenklass.handler))\n rescue Exception => error\n raise NoTokenHandler.new(\"No Tokenhandler for: @#{tokenline.token}\nThis is no big deal. You can add your custom tokenhandler for @#{tokenline.token} by adding the following line to your included ruby-file:\n\n Token::Handler.register :#{tokenline.token} # optionally add a tokenhandler or target-area (See documentation for more infos)\n \nAfter this using '@#{tokenline.token}' in your documentation is no problem...\\n\\n\" + error.message)\n end\n end", "def initialize\n @token_type = 'bearer'\n end", "def consume_token(t)\n raise NotImplementedError\n end", "def token; config[:token]; end", "def next_token; end", "def initialize()\n\t\t@rules = {}\n\t\t@token_types = nil\n\tend", "def initialize(tokens, &block)\n super(@tokens = tokens, &block)\n end", "def token_valid?\n raise 'To be implemented in child classes'\n end", "def initialize(token, token_type = TokenCredentials::DEFAULT_SCHEME)\n @token = token\n @token_type = token_type\n end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def token_type; end", "def initialize(ops={})\n\t\t\t#\tfor the readers\n\t\t\t#\tnot necessary, but polite\n\t\t\tops.each do |k, v|\n\t\t\t\tinstance_variable_set \"@#{k}\".to_sym, v\n\t\t\tend\n\n\t\t\traise Error.new(\"you must provide an Access Token\") unless self.token\n\t\tend", "def initialize\n raise 'Au contraire, mon frere. No lexer instances will be running around.'\n end", "def initialize(token, secret)\n @token, @secret = token, secret\n end", "def initialize(opts = {})\n enforce_ttl = opts.has_key?(:enforce_ttl) ? opts[:enforce_ttl] : Configuration.enforce_ttl\n @token = Token.new(opts.fetch(:token),\n secret: opts.fetch(:secret),\n enforce_ttl: enforce_ttl,\n ttl: opts[:ttl],\n now: opts[:now])\n end", "def initialize(params, token = nil)\n @token = token\n @params = normalize(params)\n end", "def load_token\n ENV['ABS_TOKEN'] || token_from_file\n end", "def next_token\n raise NotImplementedError\n end", "def token!\n # at line 1:8: ( T__80 | T__81 | T__82 | EOL | LPAR | RPAR | LLAIZQ | LLADER | COMA | PUNTO | CORDER | CORIZQ | DELIM | ASIGNACION | DOUBLEDOT | COMILLA | OP_REL | OP_ARI | OP_LOG | K_ACCIONARCHIVO | K_ACCIONARREGLO | K_PACKAGE | K_CLASS | K_END | K_DEF | K_VAR | K_REQUIRE | K_IMPLEMENTS | K_EXTENDS | K_IMPRIMIR | K_CONVERSION | K_ASIGNACION | K_RETORNO | K_ACCIONSYS | K_INTERFACE | K_IF | K_TIMES | K_DO | K_EACH | K_ELSE | K_INVOKE | K_NEW | TIPO | K_REFERENCIA | K_INSPECCIONAR | K_MATEMATICA | K_NUM | K_RESIZE | K_ORDENAR | ModoOrd | K_BUSQUEDA | K_TIPOBUSQUEDA | K_WHERE | K_SPLIT | K_BEGIN | K_DIR | K_UNION | K_VISIBILIDAD | K_MODIFICADOR | K_ARRAY | K_PROPIEDAD | K_GET | K_SET | K_VALUE | K_INITIALIZE | K_FUNC | K_VOID | HexLiteral | DecimalLiteral | OctalLiteral | WS | LINE_COMMENT | Identificador )\n alt_28 = 73\n alt_28 = @dfa28.predict( @input )\n case alt_28\n when 1\n # at line 1:10: T__80\n t__80!\n\n\n when 2\n # at line 1:16: T__81\n t__81!\n\n\n when 3\n # at line 1:22: T__82\n t__82!\n\n\n when 4\n # at line 1:28: EOL\n eol!\n\n\n when 5\n # at line 1:32: LPAR\n lpar!\n\n\n when 6\n # at line 1:37: RPAR\n rpar!\n\n\n when 7\n # at line 1:42: LLAIZQ\n llaizq!\n\n\n when 8\n # at line 1:49: LLADER\n llader!\n\n\n when 9\n # at line 1:56: COMA\n coma!\n\n\n when 10\n # at line 1:61: PUNTO\n punto!\n\n\n when 11\n # at line 1:67: CORDER\n corder!\n\n\n when 12\n # at line 1:74: CORIZQ\n corizq!\n\n\n when 13\n # at line 1:81: DELIM\n delim!\n\n\n when 14\n # at line 1:87: ASIGNACION\n asignacion!\n\n\n when 15\n # at line 1:98: DOUBLEDOT\n doubledot!\n\n\n when 16\n # at line 1:108: COMILLA\n comilla!\n\n\n when 17\n # at line 1:116: OP_REL\n op_rel!\n\n\n when 18\n # at line 1:123: OP_ARI\n op_ari!\n\n\n when 19\n # at line 1:130: OP_LOG\n op_log!\n\n\n when 20\n # at line 1:137: K_ACCIONARCHIVO\n k_accionarchivo!\n\n\n when 21\n # at line 1:153: K_ACCIONARREGLO\n k_accionarreglo!\n\n\n when 22\n # at line 1:169: K_PACKAGE\n k_package!\n\n\n when 23\n # at line 1:179: K_CLASS\n k_class!\n\n\n when 24\n # at line 1:187: K_END\n k_end!\n\n\n when 25\n # at line 1:193: K_DEF\n k_def!\n\n\n when 26\n # at line 1:199: K_VAR\n k_var!\n\n\n when 27\n # at line 1:205: K_REQUIRE\n k_require!\n\n\n when 28\n # at line 1:215: K_IMPLEMENTS\n k_implements!\n\n\n when 29\n # at line 1:228: K_EXTENDS\n k_extends!\n\n\n when 30\n # at line 1:238: K_IMPRIMIR\n k_imprimir!\n\n\n when 31\n # at line 1:249: K_CONVERSION\n k_conversion!\n\n\n when 32\n # at line 1:262: K_ASIGNACION\n k_asignacion!\n\n\n when 33\n # at line 1:275: K_RETORNO\n k_retorno!\n\n\n when 34\n # at line 1:285: K_ACCIONSYS\n k_accionsys!\n\n\n when 35\n # at line 1:297: K_INTERFACE\n k_interface!\n\n\n when 36\n # at line 1:309: K_IF\n k_if!\n\n\n when 37\n # at line 1:314: K_TIMES\n k_times!\n\n\n when 38\n # at line 1:322: K_DO\n k_do!\n\n\n when 39\n # at line 1:327: K_EACH\n k_each!\n\n\n when 40\n # at line 1:334: K_ELSE\n k_else!\n\n\n when 41\n # at line 1:341: K_INVOKE\n k_invoke!\n\n\n when 42\n # at line 1:350: K_NEW\n k_new!\n\n\n when 43\n # at line 1:356: TIPO\n tipo!\n\n\n when 44\n # at line 1:361: K_REFERENCIA\n k_referencia!\n\n\n when 45\n # at line 1:374: K_INSPECCIONAR\n k_inspeccionar!\n\n\n when 46\n # at line 1:389: K_MATEMATICA\n k_matematica!\n\n\n when 47\n # at line 1:402: K_NUM\n k_num!\n\n\n when 48\n # at line 1:408: K_RESIZE\n k_resize!\n\n\n when 49\n # at line 1:417: K_ORDENAR\n k_ordenar!\n\n\n when 50\n # at line 1:427: ModoOrd\n modo_ord!\n\n\n when 51\n # at line 1:435: K_BUSQUEDA\n k_busqueda!\n\n\n when 52\n # at line 1:446: K_TIPOBUSQUEDA\n k_tipobusqueda!\n\n\n when 53\n # at line 1:461: K_WHERE\n k_where!\n\n\n when 54\n # at line 1:469: K_SPLIT\n k_split!\n\n\n when 55\n # at line 1:477: K_BEGIN\n k_begin!\n\n\n when 56\n # at line 1:485: K_DIR\n k_dir!\n\n\n when 57\n # at line 1:491: K_UNION\n k_union!\n\n\n when 58\n # at line 1:499: K_VISIBILIDAD\n k_visibilidad!\n\n\n when 59\n # at line 1:513: K_MODIFICADOR\n k_modificador!\n\n\n when 60\n # at line 1:527: K_ARRAY\n k_array!\n\n\n when 61\n # at line 1:535: K_PROPIEDAD\n k_propiedad!\n\n\n when 62\n # at line 1:547: K_GET\n k_get!\n\n\n when 63\n # at line 1:553: K_SET\n k_set!\n\n\n when 64\n # at line 1:559: K_VALUE\n k_value!\n\n\n when 65\n # at line 1:567: K_INITIALIZE\n k_initialize!\n\n\n when 66\n # at line 1:580: K_FUNC\n k_func!\n\n\n when 67\n # at line 1:587: K_VOID\n k_void!\n\n\n when 68\n # at line 1:594: HexLiteral\n hex_literal!\n\n\n when 69\n # at line 1:605: DecimalLiteral\n decimal_literal!\n\n\n when 70\n # at line 1:620: OctalLiteral\n octal_literal!\n\n\n when 71\n # at line 1:633: WS\n ws!\n\n\n when 72\n # at line 1:636: LINE_COMMENT\n line_comment!\n\n\n when 73\n # at line 1:649: Identificador\n identificador!\n\n\n end\n end", "def match_token (exp, token)\n\tputs \"Leaf token received: #{token.value}\"\n\tputs \"\\tExpecting token of type: #{exp}\"\n\n\tif exp == token.type\n\t\tputs \"\\t\\tShiny. Got #{token.type}!\"\n\t\t$cst.add_leaf(token.value, token)\n\t\t\n\t\t# To try to make this auto-managed\n\t\t$index = $index + 1\n\t\t\n\telse\n\t\traise FaultyTokenError.new(exp, token)\n\tend\nend", "def require!(_file_)\n raise 'must implement'\n end", "def validate_token_hash; end", "def initialize(token)\n @token = token\n @file_cache = {}\n end", "def create_token(type, properties = T.unsafe(nil)); end", "def initialize(token, organization)\n @token = token\n @organization = organization\n end", "def initialize(token)\n @gnews_token = token\n end", "def require(p0) end", "def token=(_token)\n raise NotImplementedError, \"#token= is not implemented\"\n end", "def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end", "def token_attribute; end", "def require!\n @required = true\n end", "def require!\n @required = true\n end", "def token_s\n fail 'sub-class to implement'\n end", "def token\n @token ||= options[:token] || TokenFetcher.fetch\n end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokenizer\n yield\n\n rescue RangeError, RuntimeError => ex\n $stderr.print 'invalid token detected around '\n fail ex.message\n end", "def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end", "def require(*template)\r\n return parse(template, REQUIRE_FAILACTION)\r\n end", "def tokens=(_arg0); end", "def tokens=(_arg0); end", "def tokens=(_arg0); end", "def token\n @@token ||= fetch_token\n end", "def token!\n # at line 1:8: ( T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | CONSTANT | ID | TEMPLATE | STRING | COMMENT | WS )\n alt_12 = 16\n alt_12 = @dfa12.predict(@input)\n case alt_12\n when 1\n # at line 1:10: T__10\n t__10!\n\n when 2\n # at line 1:16: T__11\n t__11!\n\n when 3\n # at line 1:22: T__12\n t__12!\n\n when 4\n # at line 1:28: T__13\n t__13!\n\n when 5\n # at line 1:34: T__14\n t__14!\n\n when 6\n # at line 1:40: T__15\n t__15!\n\n when 7\n # at line 1:46: T__16\n t__16!\n\n when 8\n # at line 1:52: T__17\n t__17!\n\n when 9\n # at line 1:58: T__18\n t__18!\n\n when 10\n # at line 1:64: T__19\n t__19!\n\n when 11\n # at line 1:70: CONSTANT\n constant!\n\n when 12\n # at line 1:79: ID\n id!\n\n when 13\n # at line 1:82: TEMPLATE\n template!\n\n when 14\n # at line 1:91: STRING\n string!\n\n when 15\n # at line 1:98: COMMENT\n comment!\n\n when 16\n # at line 1:106: WS\n ws!\n\n end\n end", "def initialize email,token\n super(email, token)\n end", "def token\n @token\n end", "def initialize(theTokens)\n super(theTokens)\n @options = []\n end", "def initialize(tokenizer) \n @tokenizer = tokenizer\n @symbol_table = SymbolTable.instance\n @sy = Token.new(TokenType::VOID_TOKEN, -1, \"EMPTY\")\n @stack = UpdateStack.new\n @current_level = 'global'\n end", "def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should return true if the token object is an AccessToken\n # it should return false if the token object is a RequestToken\n if !current_token.access_token?\n throw :halt, render(invalid_access_token_message, :status => 401, :layout => false)\n end\n end", "def initialize(top_level, file_name, content, options, stats)\n super\n\n preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include\n\n preprocess.handle @content do |directive, param|\n warn \"Unrecognized directive '#{directive}' in #{@file_name}\"\n end\n end", "def initialize(top_level, file_name, content, options, stats)\n super\n\n preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include\n\n preprocess.handle @content do |directive, param|\n warn \"Unrecognized directive '#{directive}' in #{@file_name}\"\n end\n end", "def token!\n # at line 1:8: ( STRING | SHELL_STRING | CMD_OUTPUT | SPACE | COMMAND_END | VARIABLE | GLOB | CHUNK | OPEN_PAR | CLOSE_PAR | PIPELINE_OPERATOR | REDIRECT | COMMENT )\n alt_25 = 13\n alt_25 = @dfa25.predict( @input )\n case alt_25\n when 1\n # at line 1:10: STRING\n string!\n\n when 2\n # at line 1:17: SHELL_STRING\n shell_string!\n\n when 3\n # at line 1:30: CMD_OUTPUT\n cmd_output!\n\n when 4\n # at line 1:41: SPACE\n space!\n\n when 5\n # at line 1:47: COMMAND_END\n command_end!\n\n when 6\n # at line 1:59: VARIABLE\n variable!\n\n when 7\n # at line 1:68: GLOB\n glob!\n\n when 8\n # at line 1:73: CHUNK\n chunk!\n\n when 9\n # at line 1:79: OPEN_PAR\n open_par!\n\n when 10\n # at line 1:88: CLOSE_PAR\n close_par!\n\n when 11\n # at line 1:98: PIPELINE_OPERATOR\n pipeline_operator!\n\n when 12\n # at line 1:116: REDIRECT\n redirect!\n\n when 13\n # at line 1:125: COMMENT\n comment!\n\n end\n end", "def token_hash=(_arg0); end", "def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end", "def initialize\n\t\t@tokenizer = Lexer.new # why the defined method is initialize and the called method is new mystifies me\n\t\t@token = nil\n\t\t@blocklevel = 0\n\t\t@node = nil\n\t\t@sav = nil\n\tend" ]
[ "0.73096997", "0.7015049", "0.6930624", "0.6930624", "0.68641126", "0.68243986", "0.6808781", "0.67778265", "0.6774474", "0.6774474", "0.6658329", "0.6621834", "0.65471387", "0.6446971", "0.6446971", "0.6446971", "0.6446971", "0.6446971", "0.6446971", "0.6394099", "0.6353075", "0.62413704", "0.62413704", "0.62413704", "0.6152387", "0.6119195", "0.610244", "0.60989916", "0.5990338", "0.5984513", "0.5969889", "0.5949335", "0.58446604", "0.58204126", "0.58074605", "0.58074605", "0.57796127", "0.57590395", "0.5742374", "0.57245576", "0.5712799", "0.5712163", "0.5703281", "0.5699467", "0.569936", "0.56926185", "0.5684682", "0.5673514", "0.5673514", "0.5673514", "0.56565845", "0.5630514", "0.5585178", "0.5580291", "0.55375254", "0.5535565", "0.55147326", "0.55125135", "0.5508114", "0.5492027", "0.5478837", "0.5467248", "0.5447884", "0.5441936", "0.5440542", "0.54329765", "0.54287916", "0.5428765", "0.5423862", "0.5411069", "0.5401362", "0.5401362", "0.5389932", "0.5384857", "0.53809917", "0.53809917", "0.53809917", "0.53809917", "0.53809917", "0.53809917", "0.53809917", "0.53809917", "0.53736037", "0.5371891", "0.53699356", "0.53693765", "0.53693765", "0.53693765", "0.53649896", "0.5347926", "0.53467375", "0.53351563", "0.5334684", "0.53181493", "0.53166944", "0.53150034", "0.53150034", "0.53126055", "0.5309313", "0.53065246", "0.5304694" ]
0.0
-1
Assemble data for request
def get_data(event, data={}) self['event'] = event self['properties'] = data self['properties']['token'] = @key self['properties']['time'] = Time.now.to_i Base64.encode64(JSON.generate(self)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_data; end", "def request_data\n data = {}\n data[:user_agent] = request.user_agent\n data[:referrer] = request.referrer\n data[:remote_ip] = request.remote_ip\n data\n end", "def assemble_request_body data\n request = { :purlPath => data.purl_path, :type => data.redirect_type, :target => data.target_url, :institutionCode => data.institution }\n return request.to_json\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"amount\"\n @amount = data[\"amount\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"request_email\"\n @request_email = data[\"request_email\"]\n end\n if data.include? \"request_shipping\"\n @request_shipping = data[\"request_shipping\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def request_data\n data = {}\n # Also for convenience store name and version\n data[:browser_name] = browser.name\n data[:browser_version] = browser.version\n data[:referrer] = session[:referrer]\n data[:remote_ip] = request.remote_ip\n data[:user_agent] = request.user_agent\n data\n end", "def request_data(request_id, start_time, duration, status, success, options)\n request_data = super\n request_data.client_ip = options[:client_ip]\n request_data\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"customer\"\n @customer = data[\"customer\"]\n end\n if data.include? \"token\"\n @token = data[\"token\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"authorized\"\n @authorized = data[\"authorized\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"custom\"\n @custom = data[\"custom\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"gateway\"\n @gateway = data[\"gateway\"]\n end\n if data.include? \"enabled\"\n @enabled = data[\"enabled\"]\n end\n if data.include? \"public_keys\"\n @public_keys = data[\"public_keys\"]\n end\n \n self\n end", "def prepare_data(params)\n build_ingest_form\n build_uploader(params[:upload], params[:upload_cache])\n build_asset(params[:id], params[:template_id])\n assign_form_attributes(params)\n find_unmapped_rdf\n end", "def request_data(code)\n request_data = {\n \"request\" => {\n \"passengers\" => {\n \"adultCount\" => \"1\"\n },\n \"slice\" => [\n {\n \"origin\" => \"OMA\",\n \"destination\" => code,\n \"date\" => (Date.today + 1).to_s\n }\n ],\n \"solutions\" => \"1\"\n }\n }\nend", "def initialize_data\n end", "def request_parameters; end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"brand\"\n @brand = data[\"brand\"]\n end\n if data.include? \"type\"\n @type = data[\"type\"]\n end\n if data.include? \"bank_name\"\n @bank_name = data[\"bank_name\"]\n end\n if data.include? \"level\"\n @level = data[\"level\"]\n end\n if data.include? \"iin\"\n @iin = data[\"iin\"]\n end\n if data.include? \"last_4_digits\"\n @last_4_digits = data[\"last_4_digits\"]\n end\n if data.include? \"exp_month\"\n @exp_month = data[\"exp_month\"]\n end\n if data.include? \"exp_year\"\n @exp_year = data[\"exp_year\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def request_params; end", "def request_data\n @data.to_json\n end", "def data\n [@name, @format, @entry, @processors]\n end", "def request_body\n MAPPING.keys.inject({}) do |mem, e|\n next mem unless value = send(e)\n mem.merge!(e.to_s => value.to_json)\n end\n end", "def initialize_data\n @data = parse_body || {}\n end", "def setData(request)\n if request.length\n key = request[1]\n data = request[2]\n time = Time.now.to_i + request[3].to_i\n\n @data[key] = {'data' => data, 'time' => time}\n end\n end", "def data\n @_data ||= {\n :as => @options.values.first,\n :type => @options.keys.first,\n :required_platforms => [@options[:requires]].flatten.compact\n }\n end", "def prepare_data\n\t\t\tsuper\n\t\t\t@data[:tuneable_data] = @tuneable_data\n\t\t\t@data[:@lowest_old] = @lowest_old\n\t\tend", "def build_common_request\n common_set_body_contents\n process_header\n add_body_to_header\n end", "def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end", "def generate_data\n # Instantiate the basic attack as our random generator feeder\n random_generator = RestBasicAttack.new\n\n # Randomise the number of keys-and-values pair\n # Then, create the randomise keys and value.\n param_count = random_generator.random_number(50)\n params = Hash.new\n param_count.times do\n params[random_generator.random_string] = attack.input\n end\n\n params\n end", "def initialize()\n @additional_data = Hash.new\n end", "def prepared_data\n hash_list = Array.new\n devices.each { |device| hash_list << device.get_hash }\n\n data = Hash.new\n data['current_date'] = Time.now.strftime(\"%d.%m.%Y\")\n data['devices'] = hash_list\n return data\n end", "def initialize()\n @additional_data = Hash.new\n end", "def data needed=nil\n unless @data\n @data = {\n obj_type_singular: object_type,\n obj_type_plural: object_type(true),\n human_name: human_name(false, false),\n human_name_capitalize: human_name(false, true),\n human_name_plural: human_name(true, false),\n human_name_plural_capitalize: human_name(true, true)\n }\n # templateData.subs.picdata ||= templateData.subs.picurl || \"/assets/NoPictureOnFile.png\" # Default\n\n if @object\n toget = needed || (@object.class.mass_assignable_attributes + [:id])\n toget.each { |key|\n key = key.to_sym\n @data[key] = @object.send(key) if @object.respond_to? key\n }\n end\n end\n @data\n end", "def prepare_request_data(session_id, pos_id)\r\n pos = pos_id || @parameters.pos_id.to_a.first\r\n\r\n ts = calculate_ts\r\n\r\n data = {\r\n :pos_id => pos,\r\n :session_id => session_id,\r\n :ts => ts,\r\n :sig => sign(pos, session_id, ts, @parameters.key1)\r\n }\r\n data\r\n end", "def init_data\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 data\n {}.merge(build_page)\n end", "def build_common_request\n common_set_body_contents\n set_receiver_id\n process_header\n add_body_to_header\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def setup_attributes\n setup_location_header\n # TODO: Should setup_content_length_header?\n setup_status_and_body\n end", "def data\n _init\n\n respond_to do |format|\n format.xml { render xml: _data }\n format.json { render json: _data }\n end\n end", "def initialize\n super()\n init_data()\n end", "def generate_request\r\n end", "def build_custom_item_info_request(attrs={})\n\t\t CustomItemInfoRequest.new(attrs.merge({:udi_auth_token=>@udi_auth_token, :http_biz_id=>@http_biz_id}))\t\t \n\t\tend", "def initialize request\n loader = Loader.new\n @files = request.proto_file.map do |fd|\n loader.load_file fd, request.file_to_generate.include?(fd.name)\n end\n @services = @files.flat_map(&:services)\n @messages = @files.flat_map(&:messages)\n @enums = @files.flat_map(&:enums)\n end", "def data\r\n {\r\n \"key\" => api_key,\r\n \"message\" => message,\r\n \"async\" => async,\r\n \"ip_pool\" => ip_pool,\r\n \"send_at\" => send_at\r\n }\r\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def data; end", "def request_data\n Thread.current[THREAD_LOCAL_NAME] ||= {}\n end", "def data\n {\n id: @id,\n options: @features,\n actions: actions,\n }\n end", "def initialize(*object)\n if object.first\n object = object.first\n @system_data = {:client => object}\n unless object.is_a? Hash\n hash = {:body => object.body,\n :user_id => object.user_id,\n :target_id => object.target_id,\n :created_at => object.created_at,\n :updated_at => object.updated_at,\n :id => object.id,\n :project_id => object.prefix_options[:project_id]}\n else\n hash = object\n end\n super hash\n end\n end", "def initialize request\n @request = request\n loader = Loader.new\n @files = request.proto_file.map do |fd|\n loader.load_file fd, request.file_to_generate.include?(fd.name)\n end\n @services = @files.flat_map(&:services)\n @messages = @files.flat_map(&:messages)\n @enums = @files.flat_map(&:enums)\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def post_data; end", "def initialize(data)\n self.data = (self.respond_to? :prepare_data)? prepare_data(data): data\n self\n end", "def build_request(*args); end", "def initialize data\n @data = data\n end", "def collect_data( data )\n data\n end", "def data\n if key?('data') && !self['data'].nil?\n self['data']\n else\n request_params\n end\n end", "def post_data=(_arg0); end", "def build_response(connection, request); end", "def build_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n urlpath = erb.extra_params(@arguments)\n render json: { success: urlpath }, status: 200\n end\n end", "def build\n add_access_request\n add_track_request\n end", "def data_for_create\n {}\n end", "def search_data\n\t\t{\n\t\t\tcaseID: caseID,\n attackID: attackID,\n\t\t\turl: url,\n\t\t\tregistrationDate: registrationDate,\n domain: domain,\n functionality: functionality,\n status: status\n\t\t}\n\tend", "def components(the_body)\n super\n @msisdn = the_body.dig(\"event\", \"resource\", \"sender_msisdn\")\n @till_number = the_body.dig(\"event\", \"resource\", \"till_number\")\n @system = the_body.dig(\"event\", \"resource\", \"system\")\n @first_name = the_body.dig(\"event\", \"resource\", \"sender_first_name\")\n @middle_name = the_body.dig(\"event\", \"resource\", \"sender_middle_name\")\n @last_name = the_body.dig(\"event\", \"resource\", \"sender_last_name\")\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end" ]
[ "0.7092065", "0.6568239", "0.649822", "0.6420911", "0.63801426", "0.62743175", "0.62548745", "0.61686534", "0.6167868", "0.61437047", "0.6139553", "0.6136649", "0.612223", "0.61041224", "0.6095108", "0.60523427", "0.6050128", "0.60491115", "0.60350645", "0.6016136", "0.6011132", "0.59977067", "0.59824413", "0.5969606", "0.5961057", "0.5958371", "0.5933963", "0.5929503", "0.59249985", "0.5923606", "0.5913109", "0.59103096", "0.5903459", "0.5899734", "0.5899734", "0.5864261", "0.5864261", "0.58635426", "0.58635426", "0.58635426", "0.58635426", "0.58635426", "0.58635426", "0.58635426", "0.58635426", "0.586138", "0.5843476", "0.58394635", "0.5838287", "0.5836691", "0.58332795", "0.5826605", "0.58221406", "0.58221406", "0.58221406", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.5812979", "0.57928103", "0.5788943", "0.5784281", "0.5781097", "0.5769071", "0.5769071", "0.5769071", "0.5769071", "0.5766963", "0.574633", "0.5742717", "0.5740485", "0.5735316", "0.5730851", "0.5724325", "0.57131135", "0.5711972", "0.57095927", "0.56983674", "0.5687698", "0.56853426", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457", "0.5682457" ]
0.0
-1
Get data and make HTTP request
def track(event, data={}) params = self.get_data(event, data) r = self.conn.get '/track', {:data => params} r.body.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def get\n if @data == nil\n url = make_url\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n\n return @data\n end", "def http( *args )\n p http_get( *args )\n end", "def get()\n return @http.request(@req)\n end", "def get_data\n uri = URI(\"#{@url_base}/#{@url_path}\")\n uri.query = @params\n use_ssl = { use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE }\n response = {}\n\n Net::HTTP.start(uri.host, uri.port, use_ssl) do |http|\n request = Net::HTTP::Get.new(uri)\n response = http.request(request)\n end\n\n raise JSON.parse(response.body)['error'] if !JSON.parse(response.body)['error'].nil?\n\n raise \"page_arg_must_be_integer\" if !@page_number.empty? && @page_number.scan(/\\d/).join('').to_i == 0\n\n raise \"no_response\" if JSON.parse(response.body).nil?\n\n raise \"no_orders_found\" if JSON.parse(response.body)['orders'].nil?\n\n { res: JSON.parse(response.body), status: get_response_status(response) }\n end", "def request(url, api_key)\n rover = get_data(\"#{url}#{api_key}\")\n\n return rover\nend", "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 get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end", "def fetch_data\n res = Net::HTTP.start(DATA_URI.host, DATA_URI.port) do |http|\n http.get(DATA_URI.path, 'USER_AGENT' => 'Nordea::Bank gem')\n end\n\n if res.code =~ /2\\d\\d/\n res.body\n else\n fail ServerError, 'The server did not respond in the manner in which we are accustomed to.'\n end\n end", "def make_request(url,headers,query)\n c = HTTPClient.new\n c.get_content(url,query,headers)\nend", "def get\n start { |connection| connection.request http :Get }\n end", "def request(klass, path, data={})\n url = url(path)\n http = http(url)\n req = build_request(klass, url, data)\n resp = http.request(req) # send request\n load_json(resp)\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def get!\n self.https.request self.http_request # Net::HTTPResponse object\n end", "def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end", "def make_request\n response = @http.request(@request)\n end", "def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def getwork(data)\n request :getwork, data\n end", "def get\n @response = Net::HTTP.get_response(URI(@url))\n end", "def request\n self.http_response = http_client.get(url, request_options)\n self\n end", "def request_repo_data\n self.class.get(\"/#{@repo}\", headers: {\n 'Authorization' => \"token #{@token}\",\n 'User-Agent' => 'stefanrush/weightof.it'\n })\n end", "def get_data(flag, url)\n\t\t\t\t\t\tdata = \"\"\n\t\t\t\t\t\t\t\tresponse = 0\n\t\t\t\t\t\t\t\t\t\tif flag == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse = RestClient.get(url)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata = JSON.load response\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\treturn data\nend", "def getData(data_of, id)\n url_data = stringGetUrlPath(data_of)\n url_request = \"#{url_data}/#{id}\"\n response_data = readData(url_request)\n return response_data\n end", "def make_get_request url, headers = []\n make_request url, headers: headers\n end", "def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend", "def fetch_data(offset_start, offset_end, &block)\n request = Net::HTTP::Get.new(@get_uri.request_uri)\n request.basic_auth(@user, @pass) unless @user.nil? || @pass.nil?\n request.set_range(offset_start..offset_end)\n connection(@get_uri).request(request, &block)\n end", "def request(kind, url, data, options)\n # options passed as optional parameter show up as an array\n options = options.first if options.kind_of? Array\n query_options = self.class.package_query_params(options)\n full_url = URI.parse(\"#{self.url}#{url}#{query_options}\")\n \n # create an object of the class required to process this method\n klass = Object.module_eval(\"::Net::HTTP::#{kind.to_s.capitalize}\", __FILE__, __LINE__)\n request = klass.new([full_url.path, full_url.query].compact.join('?'))\n request = apply_headers(request)\n # take passed data and encode it\n request.body = self.class.body_encoder(data) if data\n \n http = Net::HTTP.new(full_url.host, full_url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 500\n response = http.start do |web|\n web.request(request)\n end\n return self.class.parse_response(response.code, response.body)\n end", "def data\n construct_url\n JSON.parse(response)\n end", "def http_get(curl, data, url)\n\n # Define the url we want to hit\n curl.url=url\n\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.http_get\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\nend", "def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def do_http_get(url)\n response, data = @http.get(url, @headers)\n\n unless response.code == '200'\n case response.code\n when '400'\n data = {\n error: \"status code : #{response.code}, message : #{response.body}\"\n } \n else\n data = {\n error: \"You have Internal Error. status code : #{response.code}, message: #{response.body}\"\n }\n end\n end\n\n return data\n end", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def get_data(flag, url)\n data = \"\"\n response = 0\n if flag == true\n response = RestClient.get(url)\n data = JSON.load response\n end\n return data\nend", "def get(data = {})\n call data, method: :get\n end", "def request_data; end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def fetch()\n @result = open(@url,@headers)\n end", "def data\n @data ||= `curl #{url} --digest --user #{username}:#{password}`\n end", "def restRequest(url)\n printDebugMessage('restRequest', 'Begin', 11)\n printDebugMessage('restRequest', 'url: ' + url, 12)\n # Split URL into components\n uri = URI.parse(url)\n # Create a HTTP connection\n httpConn = Net::HTTP.new(uri.host, uri.port)\n # Get the resource\n if uri.query\n path = \"#{uri.path}?#{uri.query}\"\n else\n path = uri.path\n end\n resp, data = httpConn.get(path, {'User-agent' => getUserAgent()})\n case resp\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n $stderr.puts data\n resp.error!\n end\n printDebugMessage('restRequest', 'data: ' + data, 21)\n printDebugMessage('restRequest', 'End', 11)\n return data\n end", "def request( params={} )\n if Biomart.proxy or ENV['http_proxy']\n proxy_uri = Biomart.proxy\n proxy_uri ||= ENV['http_proxy']\n proxy = URI.parse( proxy_uri )\n @@client = Net::HTTP::Proxy( proxy.host, proxy.port )\n end\n \n params[:url] = URI.escape(params[:url])\n \n if params[:method] === 'post'\n res = @@client.post_form( URI.parse(params[:url]), { \"query\" => params[:query] } )\n else\n res = @@client.get_response( URI.parse(params[:url]) )\n end\n \n # Process the response code/body to catch errors.\n if res.code != \"200\"\n raise HTTPError.new(res.code), \"HTTP error #{res.code}, please check your biomart server and URL settings.\"\n else\n if res.body =~ /ERROR/\n if res.body =~ /Filter (.+) NOT FOUND/\n raise FilterError.new(res.body), \"Biomart error. Filter #{$1} not found.\"\n elsif res.body =~ /Attribute (.+) NOT FOUND/\n raise AttributeError.new(res.body), \"Biomart error. Attribute #{$1} not found.\"\n elsif res.body =~ /Dataset (.+) NOT FOUND/\n raise DatasetError.new(res.body), \"Biomart error. Dataset #{$1} not found.\"\n else\n raise BiomartError.new(res.body), \"Biomart error.\"\n end\n end\n end\n \n return res.body\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def get(path, data=nil)\n request(:get, path, data)\n end", "def send_request(uri)\n resp = Net::HTTP.get_response(uri) \n data = JSON.parse(resp.body) # convert the JSON string to Ruby Hash\n return data\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\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 #puts response.body\n return JSON.parse(response.body)\n end", "def restRequest(url)\n printDebugMessage('restRequest', 'Begin', 11)\n printDebugMessage('restRequest', 'url: ' + url, 12)\n # Split URL into components\n uri = URI.parse(url)\n # Get the resource\n userAgent = getUserAgent()\n data = uri.read('User-agent' => userAgent)\n printDebugMessage('restRequest', 'data: ' + data, 21)\n printDebugMessage('restRequest', 'End', 11)\n return data\n end", "def get(path, data={})\n request(:get, path, data)\n end", "def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-Vermillion-Key', key)\n req.add_field('Accept', 'application/json')\n req.add_field('Cache-Control', 'no-cache')\n req.add_field('From', @config.get(:user))\n req.add_field('User-Agent', 'Vermillion Client 1.0')\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end", "def get(http: HTTParty)\n http.get(url)\n end", "def request\n self.response = prepare_response(http_communication.content)\n end", "def perform_get_request\n # Validate preventing request error\n\n # setup params, like API Key if needed\n\n # Perform the request\n get_request\n end", "def request\n uri = URI(final_url)\n response = Net::HTTP.get(uri)\n ResponseAdapter.new(response: response)\n end", "def data; @data ||= fetch; end", "def fetch\n url = URI.parse(self.class.url)\n req = Net::HTTP::Post.new(url.path)\n req.body = query_builder\n req.content_type = 'application/x-www-form-urlencoded'\n Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }.body\n end", "def request(url)\n\n # For catch 4xx and 5xx HTTP errors\n has_errors = false\n\n # Send request to vendor API\n http = Curl.get(url) do |http|\n\n # On 4xx errors\n http.on_missing do\n has_errors = true\n end\n\n # On 5xx errors\n http.on_failure do\n has_errors = true\n end\n\n end\n\n raise \"Error from TRADO API - #{http.body_str}\" if has_errors\n\n JSON.parse(http.body_str)['data']\n\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end", "def send_data(data, url)\n content_type = :xml\n response = Requester.request(url, data, content_type)\n response.body\n end", "def http_get(end_point)\n uri= URI.parse \"#{@main_url}#{end_point}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def go_get(url)\n begin\n puts \"Connecting to URL: \" + url\n response = HTTParty.get(url, timeout: Rails.configuration.x.network_time_out)\n data = response.parsed_response\n rescue Exception => e\n puts \"Connection ERROR: \" + e.message\n return nil\n end\n return data\n end", "def get_content\n send_get_content(url)\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def get url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end", "def http; end", "def run_request(method, url, body, headers); end", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def make_get_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Get.new(@uri.request_uri)\n @response = http.request(request)\n end\n @response.body\n end", "def do_request(request, want_reply, data); end", "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 send_data\n request = Collector::Request.\n new(self.api_location,\n :user => config[:htpasswd_user],\n :pass => config[:htpasswd_pass])\n\n # convert the array of object to a hash\n server = {\n websites: @websites.map{ |w| w.to_hash(@version).merge({server: config[:client_name].underscore }) }.map{ |w| w[:website] },\n name: config[:client_name].underscore\n }\n\n request.send(server)\n\n end", "def makeRequest(url,input)\n #GET\n if input.class == String\n begin\n rawData = Net::HTTP.get_response(URI.parse(url+input))\n if rawData.code == \"404\"\n data = nil\n else\n data = rawData.body\n end\n rescue\n puts \"Error: #{$!}\"\n end\n #POST\n else\n uri = URI.parse(url+\"/\")\n begin\n data = Net::HTTP.new(uri.host).post(uri.path,input.join(\",\")).body\n rescue\n puts \"Error: #{$!}\"\n end\n end\n return data\n end", "def fetch\n open(to_url) { |io| io.read }\n end", "def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end", "def data\n retrieve_data\n end", "def http_get(endpoint)\n uri= URI.parse \"#{@main_url}#{endpoint}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def do_request(params)\n # Convert the uri to a URI if it's a string.\n if params[:uri].is_a?(String)\n params[:uri] = URI.parse(params[:uri])\n end\n host_url = \"#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? \":#{params[:uri].port}\" : ''}\"\n\n # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to\n # different hosts.\n @connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options)\n\n # Set headers to an empty hash if none are set.\n headers = params[:headers] || {}\n\n # Add our auth cookie to the headers\n if @cookie\n headers.merge!('Cookie' => @cookie)\n end\n\n # Make the request\n response = @connections[host_url].request({\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers,\n :method => params[:method] || 'GET',\n :path => params[:uri].path\n })\n\n # Parse the response body into a hash\n #puts response.body\n unless response.body.empty?\n if params[:parse]\n document = Fog::ToHashDocument.new\n parser = Nokogiri::XML::SAX::PushParser.new(document)\n parser << response.body\n parser.finish\n\n response.body = document.body\n end\n end\n\n response\n end", "def tessen_api_request(data)\n @logger.debug(\"sending data to the tessen call-home service\", {\n :data => data,\n :options => @options\n })\n connection = {}\n connection[:proxy] = @options[:proxy] if @options[:proxy]\n post_options = {:body => Sensu::JSON.dump(data)}\n http = EM::HttpRequest.new(\"https://tessen.sensu.io/v1/data\", connection).post(post_options)\n http.callback do\n @logger.debug(\"tessen call-home service response\", :status => http.response_header.status)\n yield if block_given?\n end\n http.errback do\n @logger.debug(\"tessen call-home service error\", :error => http.error)\n yield if block_given?\n end\n end", "def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end", "def get(url); end", "def make_request\n doc_content = open(\"#{@baseurl}#{@path}#{@gamer}#{@gamepath}\", \"User-Agent\" => @user_agent)\n @doc = Nokogiri::HTML( doc_content )\n res = self.reformat_games( self.get_json )\n res\n end", "def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end", "def get_request(options, path)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Get.new(path)\n\n # we make an HTTP basic auth by passing the\n # username and password\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def get(options = {}, all = true)\n uri = URI.parse(request_path(options, all))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n puts \"Request URL (GET) is #{uri.request_uri}\" \n\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n response.body\n end", "def data\n return @data if defined? @data\n\n if path?\n @data = File.read @path\n elsif uri?\n @data = Net::HTTP.get @uri\n elsif stream?\n @data = @stream.read\n end\n\n @data\n end", "def data\n return @data if defined? @data\n\n if path?\n @data = File.read @path\n elsif uri?\n @data = Net::HTTP.get @uri\n elsif stream?\n @data = @stream.read\n end\n\n @data\n end", "def fetch\n response = HTTParty.get(@url)\n if response.success?\n @data = response.parsed_response\n end\n response.code\n end", "def http_request(action, data, method_type = 'POST', binary_key = nil)\n\n uri = \"#{@api_uri}/#{action}\"\n if method_type != \"POST\" && (!method_type.is_a? String)\n uri += \"?\" + data.map{ |key, value| \"#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}\" }.join(\"&\")\n end\n\n req = nil\n\n _uri = URI.parse(uri)\n\n headers = {\n \"Content-Type\": \"text/json\",\n \"Api-Key\":\"#{@api_key}\"\n }\n\n if method_type == 'POST'\n req = set_up_post_request(\n _uri, data, headers, binary_key\n )\n\n else\n request_uri = \"#{_uri.path}?#{_uri.query}\"\n if method_type == 'DELETE'\n req = Net::HTTP::Delete.new(request_uri, headers)\n else\n req = Net::HTTP::Get.new(request_uri, headers)\n end\n end\n\n begin\n http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(_uri.host, _uri.port)\n\n if _uri.scheme == 'https'\n http.ssl_version = :TLSv1\n http.use_ssl = true\n http.set_debug_output $stderr\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @verify_ssl != true # some openSSL client doesn't work without doing this\n http.ssl_timeout = @opts[:http_ssl_timeout] || 5\n end\n http.open_timeout = @opts[:http_open_timeout] || 5\n http.read_timeout = @opts[:http_read_timeout] || 10\n http.close_on_empty_response = @opts[:http_close_on_empty_response] || true\n\n\n response = http.start do\n http.request(req)\n end\n\n rescue Timeout::Error, Errno::ETIMEDOUT => e\n raise UnavailableError, \"Timed out: #{_uri}\"\n rescue => e\n raise ClientError, \"Unable to open stream to #{_uri}: #{e.message}\"\n end\n\n response.body || raise(ClientError, \"No response received from stream: #{_uri}\")\n end", "def get(user_auth=false)\n http = new_http()\n request = Net::HTTP::Get.new(@uri.request_uri)\n initialize_header(request, @header)\n authenticate_user(request) if user_auth == true\n request.body = @payload if @payload\n log_request(request)\n response = http.request(request)\n log_response(response)\nend", "def send_and_receive\n url = to_s\n raw_response = HTTPClient.new.get(url).body\n parsed_response = BEncode::Parser.new(StringIO.new(raw_response))\n parsed_response.parse!\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end" ]
[ "0.7289908", "0.7190825", "0.71753836", "0.71177435", "0.70374656", "0.6984405", "0.68778366", "0.6828046", "0.6789741", "0.6789196", "0.6778939", "0.6769434", "0.6759759", "0.6752113", "0.6720222", "0.66766727", "0.664878", "0.6639942", "0.6602201", "0.6599905", "0.6586025", "0.6585442", "0.65689164", "0.65669894", "0.6566656", "0.6556041", "0.655541", "0.6554175", "0.65507966", "0.6546752", "0.65447146", "0.65288407", "0.6524725", "0.6521278", "0.6514588", "0.6511362", "0.64974517", "0.64972967", "0.6495606", "0.64852095", "0.64832944", "0.64733976", "0.6452138", "0.64388067", "0.6428062", "0.64179146", "0.63994265", "0.63994265", "0.6386005", "0.6368905", "0.63636994", "0.6337231", "0.6335681", "0.63343143", "0.6326164", "0.6323159", "0.63195294", "0.6316728", "0.6313926", "0.63124806", "0.6312252", "0.63068485", "0.6296536", "0.6289962", "0.62879145", "0.62816966", "0.6258218", "0.6256998", "0.62470657", "0.62438244", "0.6236667", "0.6235384", "0.6223235", "0.6220804", "0.6216376", "0.62152904", "0.6204229", "0.6201333", "0.61875004", "0.61848855", "0.6182566", "0.61740434", "0.6171805", "0.6171709", "0.61708045", "0.6168768", "0.6160397", "0.61603135", "0.61587524", "0.6156328", "0.61556584", "0.6152697", "0.6147497", "0.6147497", "0.61398435", "0.6135896", "0.6133581", "0.61318034", "0.61245507", "0.61245507", "0.61233073" ]
0.0
-1
check if any of its tasks is not completed
def not_completed? tasks.any? { |task| task.done != 100 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend", "def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend", "def ignore_complete?(task)\n !get_result(task).nil?\n end", "def empty?; tasks.empty? end", "def all_complete\n self.tasks.count == self.tasks.done.count\n end", "def tasks_have_failed?\n return true if @tasks_have_failed\n failed = select do |task|\n task.failed?\n end\n if failed.any?\n debug \"Found failed tasks: #{failed.map { |t| t.name }.join ', '}\"\n @tasks_have_failed = true\n end\n failed.any?\n end", "def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end", "def check_tasks\n if !(@free_workers.empty? || @tasks_to_assign.empty?)\n @free_workers.each { |worker| find_task_for(worker) }\n end\n end", "def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end", "def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end", "def is_ready\n if self.tasks.empty? and not self.is_done # no tasks assigned for this\n false\n elsif (self.tasks.find_by is_done: false).nil? # can't find any false => all tasks are done\n self.update_attribute(:is_done, true)\n true\n else\n false\n end\n end", "def ending_tasks\n each_task.reject do |task|\n task.dependency_forward_any?\n end\n end", "def validate_tasks\n validated = false\n if tasks_completed?\n validated = tasks_completed!\n end\n\n validated\n end", "def has_subtasks?\n\t\ttasks.size > 0\n\tend", "def no_pending_tasks?\n if not @record.experiment.supervised\n simulation_run = record.experiment.simulation_runs.where(sm_uuid: record.sm_uuid, to_sent: false, is_done: false).first\n simulation_run.nil? and not @record.experiment.has_simulations_to_run?\n else\n # we assume that in supervised experiment, there are always tasks pending\n false\n end\n end", "def tasks_are_finished?\n return true if @tasks_are_finished\n finished = all? do |task|\n task.finished?\n end\n if finished\n debug 'All tasks are finished'\n @tasks_are_finished = true\n end\n finished\n end", "def any_waiting_threads?\n waiting_threads_count >= 1\n end", "def busy?\n @tasks.each_value { |task| return true if task.busy? }\n false\n end", "def successful_tasks\n @successful_tasks ||= @tasks_results.select(&:success?)\n end", "def tasks_are_successful?\n return true if @tasks_are_successful\n return false if @tasks_have_failed\n successful = all? do |task|\n task.successful?\n end\n if successful\n debug 'All tasks are successful'\n @tasks_are_successful = true\n end\n successful\n end", "def any_waiting_threads?\n @condition_variable.any_waiting_threads?\n end", "def complete?\n !pending?\n end", "def run_successfully?(tasks)\n [*tasks].all? do |task|\n Rake::Task.task_defined?(task) && Rake::Task[task].invoke\n end\nend", "def finished?\n !@operations or @operations.empty?\n end", "def pending_tasks?\n hash = pending_tasks\n return nil unless hash.key? \"tasks\"\n hash[\"tasks\"].length > 0\n end", "def unfinished?\n !finished?\n end", "def failed_tasks\n @failed_tasks ||= @tasks_results.select(&:failure?)\n end", "def starting_tasks\n each_task.reject do |task|\n task.dependency_backward_any?\n end\n end", "def completed?\n !self.shift_jobs.empty?\n end", "def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend", "def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end", "def failed_tasks\n each_task.select do |task|\n task.status == :failed\n end\n end", "def can_remove_no_wait?\n @queue.size > @num_waiting\n end", "def can_remove_no_wait?\n @queue.size > @num_waiting\n end", "def can_remove_no_wait?\n @queue.size > @num_waiting\n end", "def task_available\n return unless task\n\n validate_task_has_no_pending\n validate_task_has_no_approved\n end", "def incomplete_tasks\n # Give me all the tasks such that the task is incomplete\n @tasks.select { |task| task.incomplete? }.sort_by { |task| task.created_at }\n end", "def has_pre_tasks?\n !@pre_tasks.empty?\n end", "def _wait_tasks\n @wait_tasks\n end", "def tasks?\n tasks.summary.items?\n end", "def compatible_state?(task)\n\t finished? || !(running? ^ task.running?)\n\tend", "def running\n tasks.detect {|task| task.running? }\n end", "def running\n tasks.detect {|task| task.running? }\n end", "def has_tasks?\n return true unless session_tasks.empty?\n false\n end", "def done?\n waiting || verified || rejected\n end", "def compatible_state?(task)\n finished? || !(running? ^ task.running?)\n end", "def undone?\n !done?\n end", "def active_tasks(tasks)\n tasks.select { |task| task.completed_at.nil? }\n end", "def failed?\n status == :failed or tasks_have_failed?\n end", "def all_jobs_hve_been_processed?(queue)\n (job_count(queue) == 0) && (working_job_count(queue) <= 1)\n end", "def no_tasks\n $stderr.puts 'No tasks found in the current working directory.'\n exit(1)\n end", "def orphan_tasks\n each_task.reject do |task|\n task.dependency_backward_any? or task.dependency_forward_any?\n end\n end", "def not_finished?\n more_results == :NOT_FINISHED\n end", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def step_completed?\n !object.waiting_on.include?(scope)\n end", "def not_completed?\n status == NOT_COMPLETED\n end", "def check_finish\n if @finished_publishing && @pending_hash.empty?\n if @exception_count == 0\n do_stop\n else\n check_retry\n end\n end\n end", "def incomplete?\n !completed\n end", "def total_complete\n tasks.select { |task| task.complete? }.count\n end", "def all_done?\n return false if $producers.any?{|_thr| _thr.alive?}\n return false if $consumers.any?{|_proc| _proc.busy?}\n return true\nend", "def notify_uncompleted_delivery\n deliveries = @arguments[:deliveries]\n\n if deliveries.any? && (emails = Settings.first.notify_scans_not_delivered_to).any?\n ScanMailer.notify_uncompleted_delivery(emails, deliveries).deliver_later\n else\n false\n end\n end", "def check_completed\n\t\tend", "def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend", "def inactive_tasks\n @tasks.select { | task | ! task.active }\n end", "def finished?\n started? and threads.none?(&:status)\n end", "def done?\n beam.empty?\n end", "def tasks_status(tasks)\n return 'passing' if tasks.all?(&:passing?)\n return 'failing' if tasks.any?(&:failing?)\n return 'errored' if tasks.any?(&:errored?)\n return 'pending' if tasks.any?(&:pending?)\n return 'incomplete' if tasks.any?(&:incomplete?)\n\n 'unstarted'\n end", "def check_if_finished\n return parent_check if parent\n\n st = status\n raise error_message(st) if st.failed?\n\n queued = st.queued?\n return [true, queued, st] if st.completed?\n\n [false, queued, nil]\n end", "def finished?\n self.completed? || self.failed?\n end", "def finished?\n FINISHED_STATUSES.include? status or tasks_are_finished?\n end", "def check_completed_ps\n executed = false\n watched_ps_ids = @observed_parameter_sets.keys\n psids = completed_ps_ids( watched_ps_ids )\n\n psids.each do |psid|\n break if @sigint_received\n ps = ParameterSet.find(psid)\n if ps.runs.count == 0\n @logger.warn \"#{ps} has no run\"\n else\n @logger.debug \"calling callback for #{psid}\"\n executed = true\n while callback = @observed_parameter_sets[psid].shift\n callback.call( ps )\n break unless completed?( ps.reload )\n end\n end\n end\n\n @observed_parameter_sets.delete_if {|psid, procs| procs.empty? }\n executed\n end", "def future?\n !current? && !complete?\n end", "def success?\n @success ||= @tasks_results.all?(&:success?)\n end", "def finished?\n lock.value != 1 && queued_jobs.size.zero? && indegree.size.zero?\n end", "def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end", "def ran?\n completed? || failed?\n end", "def incomplete?\n running? || pending? || initialized?\n end", "def tasks_finished_count\n count do |task|\n task.finished?\n end\n end", "def claimed_chore?\n tasks.where(completion_status: \"pending\").count > 0\n end", "def complete?\n pending == failures && (child_count == 0 || child_count == @completed)\n end", "def complete?\n !incomplete?\n end", "def complete?\n !incomplete?\n end", "def no_activity?(*counts)\n self.prev_counts ||= Array.new(counts.length)\n @repeats ||= 0\n status = adjust_deferred_jobs(0).zero? && (prev_counts == counts ? true : (self.prev_counts = counts and false))\n @repeats += 1 if status\n @repeats == 3\n end", "def imports_finished_with_failures?\n digital_object_imports.where(status: DigitalObjectImport::FAILED).exists? &&\n digital_object_imports.where(\n status: [DigitalObjectImport::QUEUED, DigitalObjectImport::IN_PROGRESS]\n ).blank?\n end", "def completed?\n !@time_started.nil? && !@time_completed.nil?\n end", "def any?\n !@queue.empty?\n end", "def client_tasks_open\n self.find_all {|e| e.completed.nil? or !e.completed }\n end", "def any?\n !@queue.empty?\n end", "def complete?\n return true unless skipped_at.nil? # a skipped action item is considered complete. Lazy fucks.\n performed?\n end", "def in_progress?\n progressconditions.any?(&:met?)\n end", "def dependencies_have_failed?\n return @dependencies_have_failed unless @dependencies_have_failed.nil?\n failed = select do |task|\n task.failed?\n end\n debug \"Found failed dependencies: #{failed.map { |t| t.name }.join ', '}\" if failed.any?\n @dependencies_have_failed = failed.any?\n end", "def done?\n (@spinners - [@top_spinner]).all?(&:done?)\n end", "def task_running?(response)\n return true if response.nil?\n return !(response.data['status'].eql?(\"succeeded\") || response.data['status'].eql?(\"failed\"))\n end", "def busy?\n !@work_queue.empty? || super\n end", "def complete?\r\n # Both worker and instuction should not be nil and instruction should be complete\r\n !self.worker.blank? && !self.instruction.blank? && self.instruction.try(:complete?)\r\n end", "def all_not_done\n self.select { |todo| !todo.done? }\n end", "def completed? # Is task completed? method\n completed_status # True or false\n end", "def no_activity?(*counts)\n self.prev_counts ||= Array.new(counts.length)\n @repeats ||= 0\n status = adjust_deferred_jobs(0).zero? && (prev_counts == counts ? true : (self.prev_counts = counts and false))\n @repeats += 1 if status\n @repeats == 3\n end", "def finished?\n failed? or successful? or skipped?\n end" ]
[ "0.7589577", "0.7548989", "0.75104195", "0.7493704", "0.7404067", "0.7304864", "0.70360976", "0.70122945", "0.6991329", "0.6991329", "0.68446267", "0.6811772", "0.6742053", "0.6736515", "0.6727335", "0.67162865", "0.6677665", "0.66746724", "0.6668764", "0.6649169", "0.6611977", "0.6583861", "0.64918363", "0.6485275", "0.6476234", "0.64528424", "0.6448374", "0.64212674", "0.6420233", "0.64093", "0.635944", "0.63569367", "0.63549733", "0.63539404", "0.6343752", "0.6337618", "0.633319", "0.6324903", "0.6299358", "0.62807566", "0.6263707", "0.62558144", "0.62558144", "0.6236278", "0.62153465", "0.6185708", "0.6185297", "0.6182924", "0.6181817", "0.61804813", "0.61792064", "0.6179166", "0.61734426", "0.61674505", "0.61674505", "0.6162837", "0.6156232", "0.6141252", "0.61345893", "0.61293864", "0.6128863", "0.6121059", "0.6113733", "0.6110059", "0.61093205", "0.61012495", "0.60981053", "0.60979533", "0.6093222", "0.6093017", "0.6090641", "0.60884553", "0.6082212", "0.6072159", "0.6071372", "0.60507536", "0.6040491", "0.6039181", "0.6013872", "0.6013225", "0.6010489", "0.5959292", "0.5959292", "0.5950347", "0.59491116", "0.59424293", "0.59396255", "0.5937799", "0.5937025", "0.5931524", "0.59294987", "0.5929075", "0.5928784", "0.5926405", "0.592582", "0.5923629", "0.5917318", "0.5917033", "0.5916557", "0.59153366" ]
0.794058
0
space complexity is O(1) b/c the storage does not increase based on the size of the input
def reverse_sentence(my_sentence) if my_sentence == nil || my_sentence.empty? return my_sentence end i = 0 j = 0 temp = [] until i == my_sentence.length until my_sentence[j] == " " && my_sentence[j + 1] != " " || my_sentence[j] != " " && my_sentence[j + 1] == " " || j == my_sentence.length - 1 j += 1 end temp << my_sentence[i..j] j += 1 i = j end total_index = my_sentence.length temp.each do |capture| total_index = total_index - capture.length my_sentence[total_index..(total_index + capture.length - 1)] = capture end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(input); end", "def findlargestdrop(arr)\n\n\n\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def space_edition(input_array)\n lowest_range = 1\n highest_range = input_array.length - 1\n \n while (lowest_range < highest_range)\n \n mid = (lowest_range + highest_range) /2\n \n first_half_lowest_range = lowest_range\n first_half_highest_range = mid\n \n second_half_lowest_range = mid + 1\n second_half_highest_range = highest_range\n \n number_of_elements_in_first_half = 0\n input_array.each do |number|\n if number >= first_half_lowest_range && number <= first_half_highest_range \n number_of_elements_in_first_half += 1\n end\n \n number_of_unique_possibilities_in_first_half = first_half_highest_range - first_half_lowest_range + 1\n \n if number_of_elements_in_first_half > number_of_unique_possibilities_in_first_half\n lowest_range, highest_range = first_half_lowest_range, first_half_highest_range\n else\n lowest_range, highest_range = second_half_lowest_range, second_half_highest_range\n end\n end\n \n end\n\n return lowest_range\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def input2\n [\n [3, 2,-4, 3],\n [2, 3, 3, 15],\n [5, -3, 1, 14]\n ]\nend", "def solution4(input)\n end", "def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend", "def input1\n [\n [1, 0, 0, 0, 1],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 4],\n [0, 0, 0, 1, 3]\n ]\nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def euler_golf(size)\n a = [1]\n euler_golf(size - 1).slice(1, size - 1).each { |el| a.push(a.last + el) } unless size == 1\n a.push(a.last * 2)\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def solution(a)\n a.uniq.count\nend", "def sort3(array, length)\n # O(k)\n length.times do |i|\n # clear hash\n hash = {}\n \n # O(n)\n array.each do |str|\n if hash[str[i]].nil?\n hash[str[i]] = [str]\n else\n hash[str[i]] += [str]\n end\n end\n\n array = []\n # O(n)\n hash.values.each do |val|\n array += val \n end\n end\n\n # overall time complexity O(kn)\n array\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def word_sizes(input)\n\n occurrences = Hash.new(0)\n\n input.split.each do |element|\n occurrences[element.size] += 1\n end\n \n occurrences\nend", "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def largest_contiguous_subsum(arr)\n\n\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def find_unsorted_subarray(nums)\n \nend", "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend", "def sluggish_octopus(arr)\n lngest_fish = [arr.first]\n # debugger\n arr.each do |fish|\n # debugger\n lngest_fish = [fish] if fish.length > lngest_fish.first.length\n end\n lngest_fish\nend", "def sort3(strings, length)\n i = length - 1 \n letters = (\"a\"..\"z\").to_a\n while i >= 0 \n # O(k)\n buckets = Array.new(26) {[]}\n strings.each do |string|\n buckets[letters.find_index(string[i])] << string \n # O(n)\n end \n strings = buckets.flatten\n i-=1\n end \n p strings\nend", "def run_length_encode\n self.pack_consecutive_duplicates.inject([]) do |array, current|\n array << [current.size, current[0]]\n array \n end\n end", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def redistribute(input)\n number_to_redistribute = input.max\n index_to_redistribute = input.index(number_to_redistribute)\n input[index_to_redistribute] = 0\n\n while number_to_redistribute > 0\n index_to_redistribute = (index_to_redistribute + 1) % input.length\n input[index_to_redistribute] += 1\n number_to_redistribute -= 1\n end\n input\nend", "def hard(input)\n input.map { |line| line.dump.length - line.length }.sum\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n arr =[]\r\n a.each_with_index{|el,i|\r\n \r\n if !arr.index(el) \r\n arr << el\r\n end\r\n \r\n }\r\n arr.count\r\nend", "def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend", "def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend", "def test_string_size\n ary = []\n (1..10000000).each do |i|\n i.to_s.size if i.odd?\n end\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def solution(a)\n return nil unless a || a.empty?\n num_hash = {}\n a.each do |num|\n num_hash[num] = 1\n end\n\n 1.upto(a.size + 1) do |item|\n return item if !num_hash.has_key? item \n end\n\nend", "def 500_files(input)\n # naive solution is to flatten and sort\n\n \nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def problem_80b(size = 100)\n total = 0\n (2..100).each do |n|\n r = n.sqrt_digits(size+1)\n next if r.length == 1\n r = r[0,size].reduce(&:+)\n total += r\n# puts \"#{n} #{r.inspect}\"\n end\n total\nend", "def optimize(ary, total)\n return [] if ary.empty?\n table = []\n (ary.size+1).times { |i| table[i] = [] }\n (0..total).each { |zerg| table[0][zerg] = 0 }\n (1..ary.size).each do |base|\n table[base][0] = 0\n (1..total).each do |zerg|\n if ary[base-1].zerg <= zerg && (ary[base-1].minerals + table[base-1][zerg - ary[base-1].zerg] > table[base-1][zerg])\n table[base][zerg] = ary[base-1].minerals + table[base-1][zerg - ary[base-1][1]]\n else\n table[base][zerg] = table[base-1][zerg]\n end\n end\n end\n result = []\n i, k = ary.size, total\n while i > 0 && k > 0\n if table[i][k] != table[i-1][k]\n result << ary[i-1]\n k -= ary[i-1].zerg\n end\n i -= 1\n end\n result\nend", "def persistence(n)\n array = n.to_s.split('').map(&:to_i)\n\n if array[1].nil?\n 0\n else\n solution = []\n loop do\n array = array.inject(:*).to_s.split('').map(&:to_i).to_a\n solution << array\n break if array[1].nil?\n end\n solution.length\n end \nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end", "def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def ptn(a)\n if a.size == 1 then\n return [a]\n end\n ret = Array.new\n # 重ならないパターン\n ret += a.perms\n # 重なるパターン\n h1 = Hash.new\n for i in 0..a.size - 1\n for j in i + 1..a.size - 1\n key = [a[i], 0, a[j]].to_s\n if !h1.key?(key) then\n h1.store(key, nil)\n h2 = Hash.new\n # a[i]とa[j]を範囲をずらしながら重ねる\n for k in 0..a[i].size + a[j].size\n t = [0] * a[j].size + a[i] + [0] * a[j].size\n for m in 0..a[j].size - 1\n t[k + m] += a[j][m]\n end\n # 余分な0を取り除く\n t.delete(0)\n # 4より大きい値がないかチェック\n next if t.any? {|v| v > 4}\n # 9より長くないかチェック\n next if t.size > 9\n # 重複チェック\n if !h2.key?(t.to_s) then\n h2.store(t.to_s, nil)\n # 残り\n t2 = a.dup\n t2.delete_at(i)\n t2.delete_at(j - 1)\n # 再帰呼び出し\n ret += ptn([t] + t2)\n end\n end\n end\n end\n end\n return ret\nend", "def get_squares(input)\ninput.sort\nsquared = input.map {|x| x*x }\noutput = []\ninput.length.times.with_index do |x,i|\n\tif input.include?(squared[i])\n\t\toutput << input[i]\n\tend\nend\nreturn output.sort\nend", "def operations_to_palindrome(input)\n n_operations = 0\n \n # i = index for walk from the begin to the middle\n # j = index for walk from the end to the middle\n for i in 0..(input.size / 2 - 1) do\n j = input.size - 1 - i\n n_operations += (input[i].unpack('U')[0] - input[j].unpack('U')[0]).abs\n end\n return n_operations\nend", "def find_unique_elements(arr)\n \nend", "def twist_lengths input\n lengths = input.chars.map(&:ord) + [17, 31, 73, 47, 23]\n 64.times { lengths.each {|l| twist l } }\n hash\n end", "def aVeryBigSum(ar)\n sum = ar.sum\nreturn sum\nend", "def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end", "def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend", "def joltageDiff(input)\n # add my input device with rating +3\n input.append(input.max + 3)\n arr = input\n .sort\n .reverse\n \n diffs = arr\n .map.with_index{ |n, i|\n if i < arr.size - 1\n n - arr[i+1]\n end\n }\n diffs.pop # remove last element\n # puts diffs.sort\n counts = [0, 0, 0]\n counts[0] = diffs.select{ |n| n == 1 }.size + 1 # fuck knows why this is here.. #dirtyhack\n counts[1] = diffs.select{ |n| n == 2 }.size\n counts[2] = diffs.select{ |n| n == 3 }.size\n #puts counts\n return counts\nend", "def sq_arr(a)\n # require 'debug'\n a.map! { |x| x**2 }\n j = (a.length - 1)\n return a if j == 0\n while a[0] >= a[1] && j >= 0\n p j\n if a[0] > a[j]\n a.insert(j, a.shift)\n else\n j -= 1\n end\n end\n a\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def solution1(a)\n a.map(&:abs).uniq.size\nend", "def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend", "def problem_80(size = 100)\n total = 0\n (2..100).each do |n|\n n,d = n.sqrt_frac(2*size)\n next unless n\n r = n * (10 ** (size * 1.1).to_i) / d\n r = r.to_s[0,size].split(//).map(&:to_i).reduce(&:+)\n total += r\n# puts r.inspect\n end\n total\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def check_rehash!\n return if @size.to_f/@cardinality < LOAD_FACTOR_THRESHOLD\n\n @cardinality *= 2\n old_arr = @arr.dup\n @arr = []\n old_arr.each do |r|\n next unless r\n\n self.add(r.number, r.name)\n el = r\n while (el = el.next_rec)\n self.add(el.number, el.name)\n end\n end\n end", "def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend", "def unique_in_order(iterable)\n iterable.is_a?(String) ? input_arr = iterable.chars : input_arr = iterable\n out_arr = []\n out_arr << input_arr[0]\n 1.upto(input_arr.size - 1) do |i|\n out_arr << input_arr[i] if input_arr[i-1] != input_arr[i]\n end\n out_arr = [] if (iterable == [] || iterable == '')\n return out_arr\n\n\n # # other solution 1:\n # (iterable.is_a?(String) ? iterable.chars : iterable).chunk { |x| x }.map(&:first)\n\n\n # # other solution 2:\n # it_array= []\n # iterable.length.times do |x|\n # it_array << iterable[x] if iterable[x] != iterable[x+1]\n # end\n # it_array\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def sorted_squared_array_n_nlogn(values)\n values.collect!{|val| val*val}\n merge_sort(values)\nend", "def count_distinct(input, window)\n counter = 0\n len = 0\n elems = {}\n output = []\n input.each do |elem|\n counter2 = counter + 1\n sum = 1\n elems = {}\n elems[elem] = 1\n win = window - 1\n while counter2 < input.size && win > 0\n unless elems.key?(input[counter2])\n sum += 1\n elems[input[counter2]] = 1\n end\n counter2 += 1\n win -= 1\n end\n if win == 0\n p elems\n p sum\n end\n counter += 1\n end\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def array_to_sum(input)\n arr_sum = []\n\n input.each_with_index do |x,y| \n arr_sum << x*10**(input.size - (y + 1))\n end\n\n arr_sum.sum\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def unique_in_order(iterable) \n# create an empty array\ncontent = []\n\n # check each letter/number of `iterable` \n for e in (0..iterable.length()-1) \n\n# compare current element to previous element\n# if array is empty\n if e == 0 or \n# \n# if current element is not the same with previous element, push current index to content array\n iterable[e] != iterable[e-1] \n content.push(iterable[e])\n end\n end\n# return new content array\n return content\nend", "def solution(h)\n n = h.size\n return 0 if n == 0\n stack = [h.first]\n blocks = 0\n (1...n).each { |y|\n if h[y] != stack.last\n while !stack.empty? && h[y] < stack.last\n stack.pop\n blocks += 1\n end\n stack << h[y] unless stack.last == h[y]\n end # != last\n }\n blocks += stack.count\nend", "def correct_input_size?(input_ary, ref_size)\n input_ary.length == ref_size\n end", "def sieve_of_eratosthene(size)\n arr=(0..size).to_a\n arr[0]=nil\n arr[1]=nil\n max=size\n (size/2+1).times do |n|\n if(arr[n]!=nil) then\n cnt=2*n\n while cnt <= max do\n arr[cnt]=nil\n cnt+=n\n end\n end\n end\n arr.compact!\n end", "def hard(input)\n graph = Graph.from(input)\n components = []\n vertices = Set.new(graph.vertices)\n until vertices.empty?\n start = vertices.first\n component = graph_walk(graph, start)\n components << component\n vertices = vertices.difference(component)\n end\n components.length\nend", "def large_contig_subsum1(arr)\n timestart = Time.now\n sub_arrs = []\n\n\n arr.each_with_index do |el, idx|\n\n count = 0\n while idx+count < arr.length\n sub_arrs << arr[idx..idx+count]\n count+=1\n end\n end\n\n\n sum_arr = []\n sub_arrs.each do | sub_arr |\n sum_arr << sub_arr.reduce(:+)\n end\n\n max = sum_arr.max\n p (Time.now - timestart) * 1000\n max\nend", "def solution(string) # \"ABCA\",\n # TIME O(N) + O(N) = O(2N) ~~ O(N)\n # SPACE O(N)\n\n array = string.split(\"\") # w[A B C A], O(N)\n array_exist = [] # [B C]\n array.each do |s| # O(N), N= 1000_000\n if array_exist.include?(s)\n array_exist.delete(s)\n else\n array_exist.push(s)\n end\n end\n array_exist[0]\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def input4\n [\n [1, 0, 0, 0, 1],\n [0, 0, 0, 1, 3],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 8]\n ]\nend", "def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend", "def aVeryBigSum(ar)\n ar.reduce(:+)\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n factors = factors_sieve(a)\n n = a.size\n a.map {|num| n - factors[num]}\nend" ]
[ "0.610956", "0.5955452", "0.5855595", "0.57886446", "0.5786059", "0.57112885", "0.56840974", "0.56586796", "0.56450695", "0.5632296", "0.5598963", "0.5594605", "0.55914265", "0.55795634", "0.5574874", "0.5558279", "0.5556949", "0.55156344", "0.550784", "0.5486466", "0.54747486", "0.5472197", "0.54695106", "0.54648536", "0.5459269", "0.5448698", "0.5437778", "0.5437321", "0.54365426", "0.5433777", "0.5422204", "0.54047084", "0.5398809", "0.5388303", "0.538818", "0.5381902", "0.5380546", "0.5376655", "0.5375385", "0.53735125", "0.5356203", "0.5350054", "0.53385174", "0.53383654", "0.533741", "0.5329675", "0.53174245", "0.5317184", "0.53150463", "0.5311616", "0.5306902", "0.5306033", "0.5305585", "0.53034014", "0.52965426", "0.5295953", "0.52893", "0.5281196", "0.52799857", "0.52799857", "0.5279651", "0.52763927", "0.52731395", "0.52666175", "0.52618587", "0.525808", "0.5257176", "0.52543104", "0.52452606", "0.52439696", "0.5240178", "0.5239326", "0.5234422", "0.5232104", "0.52318394", "0.5224232", "0.52192813", "0.5210824", "0.52093625", "0.5208898", "0.5204183", "0.5201792", "0.51964456", "0.51960856", "0.51954186", "0.5194441", "0.5192535", "0.5187719", "0.518424", "0.51826644", "0.51785356", "0.5178201", "0.51702774", "0.51640993", "0.5161138", "0.51576674", "0.5151786", "0.51479936", "0.5147376", "0.51451164", "0.5143333" ]
0.0
-1
Get list of records for a given model class.
def get_list_of_records(klass, options = {}, &block) items = klass.name.tableize self.current_page = options[:page] if options[:page] query = options[:query] if options[:query] category = options[:category] if options[:category] pagination = options[:pagination].nil? ? true : options[:pagination] date = options[:date] if options[:date] #date_range = options[:date_range] if options[:date_range] start_date = options[:start_date] if options[:start_date] end_date = options[:end_date] if options[:end_date] sort_fields = options[:sort] if options[:sort] sort_dir = options[:dir] || "ASC" per_page = options[:per_page] if options[:per_page] #self.current_query = options records = { :user => @current_user #, # :order => @current_user.pref[:"#{items}_sort_by"] || klass.sort_by } # Use default processing if no hooks are present. Note that comma-delimited # export includes deleted records, and the pagination is enabled only for # plain HTTP, Ajax and XML API requests. wants = request.format filter = session[options[:filter]].to_s.split(',') if options[:filter] scope = klass.scoped scope = scope.category(category) if category.present? scope = scope.state(filter) if filter.present? scope = scope.search(query) if query.present? scope = scope.at_date(date) if date.present? #scope = scope.between_dates(date_range) if date_range.present? scope = scope.between_dates(start_date, end_date) if (start_date.present? && end_date.present?) if sort_fields.present? words = sort_fields.split(".") if words.length > 1 table = words.shift.tableize # popup first item field = words.join(".") sort_fields2 = "#{table}.#{field}" else sort_fields2 = "#{items}.#{words.first}" end scope = scope.order_by(sort_fields2, sort_dir) end scope = yield scope if block_given? scope = scope.unscoped if wants.csv? scope = scope.page(current_page).per(per_page) scope end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def records(_options = {})\n if defined?(_resource_klass.records)\n _resource_klass.records(_options)\n else\n _resource_klass._model_class.all\n end\n end", "def records_base(_options = {})\n _model_class.all\n end", "def records\n arr = @klass.all(find_options)\n arr.empty? ? nil : arr\n end", "def index\n @records = record_class.all\n end", "def records\n @records ||= Records.new(klass, self)\n end", "def list(scope = list_query)\n model.all(scope)\n end", "def records(opts = {})\n opts = opts.merge(@opts)\n client.list_records(opts).full.lazy.flat_map do |rec|\n @record_class.build(mint_id(rec.header.identifier),\n record_xml(rec))\n\n end\n end", "def list_objects\n objects = @model_class.method(:list).arity == 0 ? @model_class.list : @model_class.list(true)\n objects.map { |obj| Array(obj).find { |o| o.is_a?(@model_class) } }\n end", "def get_all_from_database\n model.all\n end", "def records\n doc = @session.request(:get, @records_url)\n return doc.css(\"entry\").map(){ |e| Record.new(@session, e) }\n end", "def records\n @records ||= []\n end", "def find_all(klass)\n ds = @model_class.where(:class_type=>klass.to_s)\n ds.all.map {|r| r[:id] }\n end", "def list(options = nil)\n table = DB.from(@table)\n \n if options[:rows]\n if options[:offset]\n table = table.limit(options[:rows],options[:offset])\n elsif options[:page] \n offset = options[:page] * options[:rows]\n table = table.limit(options[:rows],offset)\n end\n end\n \n # convert the array of hashes to an array of model objects\n table.all.map{|row| @model_class.new row}\n end", "def records\n @records ||= search.records\n end", "def to_a\n return @records unless loadable?\n\n @response = cache.get_or_set_query(klass, options) do\n connection.documents({ query: options })\n end\n\n @records = []\n\n if @response.success?\n records = @response.members.attributes[\"query\"]\n\n records.each do |record|\n @records << klass.new(record.merge(persisted: true))\n end\n\n @loaded = true\n end\n\n @records\n end", "def fetch_records(ids)\n model.where(id: ids)\n end", "def list_entries\n model_class.respond_to?(:list) ? model_scope.list : model_scope\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def list(klass, params)\n DSpaceObj.get(self, self.link + klass::PATH, params)\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def records(options = {})\n records_base(options)\n end", "def fetch_model_list\n if parent_model\n return parent_model.send(\"#{model_name.pluralize.downcase}\")\n else\n return model_name.camelize.constantize.find(:all)\n end\n end", "def list_entries\n model_class.scoped\n end", "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def initialize(model_class)\n @model_class = model_class\n @records = []\n end", "def fetch_records(record_class:, record_ids:)\n output = []\n record_ids.each do |record_id|\n key = get_key_for_record_id(record_id: record_id, record_class: record_class)\n data = REDIS_APP_JOIN.hgetall(key)\n # => add the key as ID attribute if there is data hash\n output << OpenStruct.new(data.merge(id: record_id.to_s)) if data.size > 0\n end\n return output\n end", "def records\n Importu::Record::Iterator.new(@source.rows, config)\n end", "def list_endpoint(clazz, select_options = nil, base_record_set: nil)\n if base_record_set\n records = base_record_set\n else\n records = clazz.all\n end\n\n records = apply_pagination(records)\n\n if select_options\n records.as_json(select_options)\n else\n records\n end\n end", "def get_records(type)\n if @action == 'initial_run'\n @logger.info \"Getting all records from SalesForce for #{type}\"\n records = get_all_sobjects(type)\n else\n @logger.info \"Getting records for yesterday from SalesForce for #{type}\"\n records = @client.materialize(type)\n \n datetime = DateTime.now\n datetime = datetime -= 1\n records.query(\"lastmodifieddate >= #{datetime}\")\n end\n end", "def find_all\n response = fetch()\n new(response)\n end", "def load_collection\n model_class.all(find_options)\n end", "def records\n sql_records = klass.subject_type.where(klass.subject_type.primary_key => ids)\n sql_records = sql_records.includes(self.options[:includes]) if self.options[:includes]\n\n # Re-order records based on the order from Elasticsearch hits\n # by redefining `to_a`, unless the user has called `order()`\n #\n sql_records.instance_exec(response.response['hits']['hits']) do |hits|\n ar_records_method_name = :to_a\n ar_records_method_name = :records if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 5\n\n define_singleton_method(ar_records_method_name) do\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4\n self.load\n else\n self.__send__(:exec_queries)\n end\n @records.sort_by { |record| hits.index { |hit| hit['_id'].to_s == record.id.to_s } }\n end if self\n end\n\n sql_records\n end", "def models_list\n ModelsList.to_a\n end", "def get_records(params, columns)\n []\n end", "def all\n self.class.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def index\n @records = Record.all\n end", "def to_a\n records\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "def list\n self.class.list\n end", "def find_all\n execute_sql(:read, :user) { table.map {|u| inflate_model(u) } }\n end", "def index\n @record_objects = RecordObject.all\n end", "def get_records(*identifiers, **opt)\n get_relation(*identifiers, **opt).records\n end", "def get_records(*identifiers, **opt)\n get_relation(*identifiers, **opt).records\n end", "def all\n folder.data_objects.all(parameters).collect do |data_object|\n model.new(data_object)\n end\n end", "def get_models(model_type)\n model_store.get_collection class_for_type(model_type)\n end", "def all( model )\n model( model ).all\n end", "def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end", "def get_recordset\n return @recordset if instance_variable_defined?(:@recordset) && @recordset\n return (@recordset = self.class.recordset) if self.class.recordset\n\n # If there is a model, return that model's default scope (all records by default).\n if (model = self.get_model(from_get_recordset: true))\n return @recordset = model.all\n end\n\n return nil\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\n _register_class_observer\n if _class_fetch_states.has_key?(:all) && 'fi'.include?(_class_fetch_states[:all]) # if f_etched or i_n progress of fetching\n collection = HyperRecord::Collection.new\n _record_cache.each_value { |record| collection.push(record) }\n return collection\n end\n promise_all\n HyperRecord::Collection.new\n end", "def __records_for_klass(klass, ids)\n adapter = __adapter_for_klass(klass)\n\n case\n when Elasticsearch::Model::Adapter::ActiveRecord.equal?(adapter)\n klass.where(klass.primary_key => ids)\n when Elasticsearch::Model::Adapter::Mongoid.equal?(adapter)\n klass.where(:id.in => ids)\n else\n klass.find(ids)\n end\n end", "def records_for(model)\n storage_name = model.storage_name(name)\n case storage_name.to_sym\n when :domains, :domain, :data_mapper_dh_api_models_domains\n @records[storage_name] ||= DataMapper::DhApi::Adapter.domains\n when :dnses, :dns, :data_mapper_dh_api_models_dns\n @records[storage_name] ||= DataMapper::DhApi::Adapter.dnses\n when :users, :user, :data_mapper_dh_api_models_users\n @records[storage_name] ||= DataMapper::DhApi::Adapter.users\n when :users_pw, :user_pw, :data_mapper_dh_api_models_users_pw\n @records[storage_name] ||= DataMapper::DhApi::Adapter.users_pw\n else\n raise NotImplementedError, \"Storage (#{storage_name}) not implemented\"\n end\n\n @records[storage_name] ||= []\n end", "def load_records\n native_instance(true)\n native_instance.top(limit) if limit.present?\n Array(service.native_instance.execute)\n end", "def all\n table_name = self.table_name\n \n results = CONNECTION.execute(\"SELECT * FROM '#{table_name}';\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def all\r\n copy_and_return(@records)\r\n end", "def get_records(table_name, opts)\n raise \"implement in subclass\"\n end", "def records(opts = {})\n view = opts[:view] || @opts[:view]\n client.view(view, include_docs: true, stream: true).docs.lazy.map do |r|\n @record_class.build(mint_id(r['_id']), r.to_json, 'application/json')\n end\n end", "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "def all(offset = 0, limit = 0)\n @client.get(\"/#{@model}s\", {offset: offset, limit: limit})\n end", "def fetch_all\n self.to_a\n end", "def recordsets_by(params)\n GRemote::RecordSet.list_for(self.id ? self.id : self.name, params)\n end", "def find_all( opts = {} )\n # opts[:order] ||= [:posted_at.desc, :id.asc]\n model.all( opts )\n end", "def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end", "def list \n @employees = Employee.find( :all ) # return an array of all Employees\n end", "def get_all_objects(class_name, count)\n per_page = 1000\n objects = []\n times = [(count/per_page.to_f).ceil, 10].min\n 0.upto(times) do |offset|\n query = Parse::Query.new(class_name)\n query.limit = per_page\n query.skip = offset * per_page\n objects << query.get\n end\n objects.flatten(1)\n end", "def get_records\n return error_response unless is_get_records_request?\n as_json\n end", "def collect_objects\n results = []\n generate_objects! if object_ids.nil?\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n rescue ActiveRecord::RecordNotFound\n generate_objects!\n collect_objects\n end\n end", "def get_all_sobjects(type)\n case type\n when 'Account'\n records = @client.materialize(type).query(\"Agents__c != ''\")\n when 'ccrmbasic__Email__c'\n records = @client.materialize(type).query(\"ccrmbasic__Contact__c != ''\")\n else\n records = @client.materialize(type).all\n end\n sobjects = records.dup.to_a\n while records.next_page?\n sobjects += records.next_page\n records = records.next_page\n end\n sobjects\n end", "def models\n Model.all.select {|model| model.make_id == id}\n end", "def models\n @model_class = params[:model_class].constantize\n assoc = false\n query = params[:query]\n \n unless query.blank?\n query = query.gsub(/<\\/?[^>]*>/, '').downcase\n \n conditions = @model_class.searchables.map do |field|\n if @model_class.column_names.include?(field)\n \"#{@model_class.table_name}.#{field} ILIKE :q\"\n else\n assoc = @model_class.get_assoc_prefix_for(field)\n \"#{assoc[:prefix]}.#{field} ILIKE :q\"\n end\n end.join(' OR ') if @model_class.respond_to? :searchables\n \n options = { :conditions => [conditions, { :q => \"%#{query}%\" }] }\n options.store :include, assoc[:join] if assoc\n \n @results = @model_class.all options\n else\n flash[:error] = 'Type something in to search for, DUH!'\n end\n \n render :layout => false if request.xhr?\n end", "def records\n live_lookup_service.new(@ids).records\n end", "def all_from_class\n begin\n class_name.all\n rescue\n @errors << {message: \"Unable to find this class in the database.\", variable: \"class_name\"}\n []\n end \n end", "def all(model)\n store.all(table: table_name).map {|data| model.new data}\n end", "def get_record_types\n get_records_with_filter {|records, record_type, offset, ptr| records.push(ptr[0])}\n end", "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end", "def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end", "def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end", "def find(options)\n table = DB.from(@table)\n \n options.each_pair do |method_name,params|\n table = table.send(method_name, params)\n end\n \n # convert the array of hashes to an array of model objects\n table.all.map{|row| @model_class.new row}\n end", "def collect_objects\n results = []\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n # rescue ActiveRecord::RecordNotFound\n # generate_objects!\n # collect_objects\n end\n end", "def get_recordings\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_customer_recordings, \n message: { 'wsdl:sessionID' => session_id }\n\n # Returns an array of instances of the Recording class\n @recordings = TranscribeMe::Recording.new_from_soap response.body[:get_customer_recordings_response][:get_customer_recordings_result][:recording_info]\n end", "def list\n\t\tdocs = proxy_database.view(\"#{shared_data_context.name}/all\")[\"rows\"]\n\t\treturn docs\n \tend", "def models\n @models ||= []\n end", "def find(options)\n klass = options[:class]\n sql = resolve_options(klass, options)\n read_all(query(sql), klass, options)\n end", "def records\n unless Adknowledge.token\n raise ArgumentError, 'Adknowledge token required to perform queries'\n end\n results\n end", "def records(options={})\n options[\"sortField\"], options[\"sortDirection\"] = options.delete(:sort) if options[:sort]\n results = self.class.get(worksheet_url, query: options).parsed_response\n RecordSet.new(results)\n end", "def get_workers_records_list(resource_configuration, params = {})\n get_workers_records_cursor(resource_configuration, params).to_a\n end", "def get_records_format_data(class_name, fields, condition = nil)\n ret = []\n ret.push([\"\",\"\"])\n class_name.find(:all).each do |rec|\n tmp = \"\"\n fields[1..fields.size-1].each do |field|\n tmp += \" \" if tmp.length > 0\n tmp += rec[field]\n end\n ret.push([rec[fields[0]], tmp])\n end\n return ret\n end", "def all\n results = connection.exec_params('SELECT * FROM contacts LIMIT 5 OFFSET\n $1::int;', [get_offset])\n return results.map do |contact|\n self.new(contact['name'], contact['email'], contact['id'])\n end \n end", "def fetch_records_field(record_class:, record_ids:, field:)\n output = []\n record_ids.each do |record_id|\n key = get_key_for_record_id(record_id: record_id, record_class: record_class)\n data = REDIS_APP_JOIN.hget(key, field)\n output << data if data # checks if nil\n end\n return output.uniq\n end", "def get_recordings()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/recordings\"))[0]\n end", "def fetch(key, page, page_size, record_klass, records_counter)\n page, page_size = process_page_params(page, page_size, record_klass)\n return [] if exceeds_max_pages?(page, page_size, records_counter)\n\n start, stop = get_range(page, page_size)\n rs = read_records(key, start, stop, record_klass)\n return rs if rs.present?\n\n if block_given?\n ActiveRecord::Base.with_advisory_lock(\"list/cache/#{key}/#{page}/#{page_size}\", timeout_seconds: 3) do\n rs = read_records(key, start, stop, record_klass)\n return rs if rs.present?\n\n records = yield\n return [] if records.blank?\n\n load_records(key, page, page_size, records, record_klass)\n end\n end\n end", "def to_a\n return @records if loaded?\n\n load\n end", "def all\n @collection ||= Collection.new model_name\n end", "def all\n Ribs.with_handle(self.database) do |h|\n h.all(self.metadata.persistent_class.entity_name)\n end\n end", "def array\n @models ||= load\n end", "def batch_edit\n @records = record_class.all\n end" ]
[ "0.7259449", "0.72117144", "0.7181429", "0.6925908", "0.6874491", "0.6479553", "0.64787513", "0.6426368", "0.6415522", "0.64123756", "0.63960654", "0.6394551", "0.63728976", "0.6365377", "0.6337952", "0.6334368", "0.6272345", "0.61693656", "0.6123235", "0.6117369", "0.611144", "0.61096776", "0.61080563", "0.6100037", "0.6086538", "0.6079391", "0.60509664", "0.60444784", "0.60105294", "0.5997421", "0.5991392", "0.59599394", "0.59586656", "0.594452", "0.59264904", "0.59207135", "0.59207135", "0.59207135", "0.59207135", "0.59207135", "0.5916335", "0.589148", "0.58796215", "0.5848693", "0.5826806", "0.5825077", "0.5825077", "0.5824665", "0.58222294", "0.58218724", "0.5813447", "0.57894665", "0.5787556", "0.57816666", "0.5774081", "0.5754819", "0.5750888", "0.5750036", "0.57389563", "0.5737506", "0.5704752", "0.5694028", "0.56925887", "0.56825125", "0.56789166", "0.5674466", "0.56474245", "0.564594", "0.5627722", "0.56237155", "0.56150216", "0.56016254", "0.55929464", "0.5590362", "0.55846727", "0.5580882", "0.55682135", "0.5566845", "0.55611", "0.55591697", "0.55350816", "0.55251753", "0.55229825", "0.5520464", "0.5516061", "0.55116034", "0.55093956", "0.55081785", "0.55050224", "0.5493148", "0.5479", "0.547195", "0.54542893", "0.54530704", "0.543534", "0.5434085", "0.54307723", "0.5425365", "0.54223907", "0.5409593" ]
0.59760606
31
Proxy current page for any of the controllers by storing it in a session.
def current_page=(page) @current_page = session["#{controller_name}_current_page".to_sym] = page.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n session[:return_to] = request.url\n super\n end", "def index\r\n # State machine stuff\r\n current_user.came_home\r\n eval current_user.redirect, binding()\r\n return\r\n end", "def set_current_path\n case params.values_at(:controller, :action).join('/')\n when 'search/image' then return\n when %r{^devise/} then return\n when %r{^user/} then return\n end\n if request.path == root_path\n session.delete('app.current_path')\n else\n prms = url_parameters.except(:id)\n path = make_path(request.path, **prms)\n comp = compress_value(path)\n session['app.current_path'] = (path.size <= comp.size) ? path : comp\n end\n session['app.time'] = DateTime.now\n end", "def store_location\n # request object (via request.url) to get the URL of the requested page\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\nend", "def store_location\nsession[:forwarding_url] = request.url if request.get?\nend", "def current_page=(page)\n p = page.to_i\n @current_page = session[:\"#{controller_name}_current_page\"] = (p.zero? ? 1 : p)\n end", "def store_location\n session[:forwarding_url]=request.fullpath if request.get?\n end", "def store_forwarding_loc\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forward_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n \tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def index\n if cookies[:user_id]!=\"4\"\n redirect_to action: \"profile\",controller: \"main\"\n end\n @pages = Page.all\n\n end", "def store_location\n\t session[:forwarding_url] = request.original_url if request.get?\n\tend", "def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end", "def proxy\n self.class.proxy.new(session)\n end", "def store_location\n session[:return_to] = request.fullpath if request.get? and controller_name != \"user_sessions\" and controller_name != \"sessions\"\n end", "def last_visited(action_name, controller_name)\n if(action_name =='find' and controller_name == 'search')\n session[:action]='back'\n session[:controller]=controller_name\n elsif(action_name =='index' and controller_name == 'main_menu')\n session[:action]=action_name\n session[:controller]=controller_name\n end\n end", "def session\n @controller.session\n end", "def store_location\n \tsession[:forwarding_url] = request.url if request.get?\n end", "def store_location\n\t\tsession[:forwarding_url]=request.original_url if request.get?\n\tend", "def store_location\n # Store the URL only when the reqest was GET\n session[:forwarding_url] = request.original_url if request.get?\n end", "def index\n #@page = Page.find_by_slug('home') || Page.first(:conditions => {:root => true})\n #render '/pages/show'\n if cookies[:first_time_visit]\n redirect_to courses_path\n return\n else\n cookies[:first_time_visit] = {:value => Time.now.to_s, :expires => 1.year.from_now }\n redirect_to '/landing'\n end\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend", "def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get? # only for get requests. A user could technically delete their cookie then submit a form\n end" ]
[ "0.63160235", "0.623", "0.6068191", "0.606676", "0.6030942", "0.5964684", "0.59170735", "0.5851382", "0.5844857", "0.58415294", "0.58362776", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.5808995", "0.58057284", "0.57994723", "0.57994723", "0.5793808", "0.57931596", "0.57777935", "0.5776435", "0.57572246", "0.57547164", "0.57379186", "0.5736811", "0.57363605", "0.57332665", "0.57317156", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.5721711", "0.57137245", "0.57137245", "0.57137245", "0.57137245", "0.5712929", "0.5708921", "0.570831", "0.5708191" ]
0.6015731
5
Proxy current search query for any of the controllers by storing it in a session.
def current_query=(query) @current_query = session[:advanced_query] = query end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_session\n session[:search] ||= {}\n end", "def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end", "def restore_for_guest_user\n if resetting_search?\n session.delete :search\n elsif actively_searching?\n session[:search] = {\n model: search_key,\n params: {\n s: params[:s].dup,\n fs: params[:fs].dup,\n f: params[:f].dup,\n scope: params[:scope].dup\n }\n }\n elsif session[:search] && session[:search]['model'] == controller_name\n redirect_to session[:search]['params'].merge(action: params[:action])\n end\n end", "def set_immediate_search\n opt = request_parameters\n return unless opt.key?(:immediate_search)\n if true?(opt.delete(:immediate_search))\n session['app.search.immediate'] = 'true'\n else\n session.delete('app.search.immediate')\n end\n redirect_to opt\n end", "def search_redirect\n return if SEARCH_CONTROLLERS.include?(params[:controller]&.to_sym)\n query = request_parameters\n return if query.slice(:q, :title, :creator, :identifier).blank?\n redirect_to query.merge!(controller: DEFAULT_SEARCH_CONTROLLER)\n end", "def index\n if(params[:search]) then\n search_condition = \"%\" + params[:search] + \"%\"\n session[:search] = params[:search]\n elsif(session[:search])\n search_condition = \"%\" + session[:search] + \"%\"\n else\n search_condition = \"%\"\n session[:search] = nil\n end\n\n session[:tempacct_letter] = nil\n session[:tempacct_letter] ||= params[:q]\n\n @tempaccts = Tempacct.by_letter(session[:tempacct_letter]).paginate :page => params[:page], :per_page => 25\n session[:tempaccts_page] = (params[:page]) ? tempaccts_url+\"?page=\"+params[:page] : tempaccts_url\n end", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def search_params\n if params[:q] == nil\n params[:q] = session[search_key]\n end\n if params[:q]\n session[search_key] = params[:q]\n end\n params[:q]\n end", "def initialize_search\n session[:search_name] = params[:search_name]\n session[:search_species] = params[:search_species]\n session[:search_body_temperature] = params[:search_body_temperature]\n session[:search_age] = params[:search_age]\n end", "def index\n # Set session variables\n if session[:selected_communications].blank?\n session[:selected_communications] = Hash.new\n end\n \n # reset search param\n if !params[:from].blank? && params[:from].match('reset_search')\n session[:crm_communication_search_details] = nil\n end\n \n # any previous communication search in session?\n if session[:crm_communication_search_details] != nil\n @search = session[:crm_communication_search_details]\n else\n @search = CrmCommunicationSearchDetails.new\n end\n \n end", "def search_params\n if params[:q] == nil\n params[:q] = session['search_key']\n end\n if params[:q]\n session['search_key'] = params[:q]\n end\n params[:q]\n end", "def index\n session[:special_words_search] ||= {}\n if params[:search_button]\n set_conditions\n elsif params[:clear_button]\n session[:special_words_search] = {}\n end\n\n # 検索条件を処理\n cond, order_by = make_conditions\n \n @special_words = find_login_owner(:special_words)\n .where(cond)\n .order(order_by)\n .page(params[:page])\n .per(current_user.per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @special_words }\n end\n end", "def index\n if session[:user_id]\n @transactions = Transaction.where(user_id: session[:user_id])\n elsif session[:admin_id]\n @transactions = Transaction.where(nil)\n else\n redirect_to login_path\n end\n\n @transactions = @transactions.search(params[:search_name], params[:search_phone] , params[:search_amount], params[:search_status], params[:search_date ])\n end", "def index\n @shift = Shift.new #new shift model\n\n #store in session so on refresh search input is empty (it will not reset the route)\n session[:search_by_name] = params[:search]\n \n\n #get all shifts that are from same organization that current logged in user is\n #possible to do it this way but querying will be N + 1\n # @shifts = Shift.all.order(created_at: :desc).select {|shift| shift.user.organization == current_user.organization}\n @shifts = Shift.order(created_at: :desc).includes(user: [:organization]).select {|shift| shift.user.organization == current_user.organization}\n\n #order shifts by user names\n @shifts = Shift.sort_by_name(@shifts) if params[:order_by_name]\n\n\n #search all shifts by users name\n @shifts = Shift.search_by_shifts_user_name(@shifts, session[:search_by_name]) if session[:search_by_name]\n end", "def track\n # session[:search] = {} unless session[:search].is_a?(Hash)\n # session[:search]['counter'] = params[:counter]\n #\n # # Blacklight wants this....\n # # session[:search]['per_page'] = params[:per_page]\n # # But our per-page/rows value is persisted here:\n # session[:search]['per_page'] = get_browser_option('catalog_per_page')\n\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = get_browser_option('catalog_per_page')\n\n path = case active_source\n when 'databases'\n databases_show_path\n when 'journals'\n journals_show_path\n when 'archives'\n archives_show_path\n when 'new_arrivals'\n new_arrivals_show_path\n else\n { action: 'show' }\n end\n\n # If there's a 'redirect' param (the original 'href' of the clicked link),\n # respect that instead.\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI.regexp)\n path = URI.parse(params[:redirect]).path\n end\n\n redirect_to path, status: 303\n end", "def track\n # session[:search] = {} unless session[:search].is_a?(Hash)\n # session[:search]['counter'] = params[:counter]\n #\n # # Blacklight wants this....\n # # session[:search]['per_page'] = params[:per_page]\n # # But our per-page/rows value is persisted here:\n # session[:search]['per_page'] = get_browser_option('catalog_per_page')\n\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = get_browser_option('catalog_per_page')\n\n path = case active_source\n when 'databases'\n databases_show_path\n when 'journals'\n journals_show_path\n when 'archives'\n archives_show_path\n when 'govdocs'\n govdocs_show_path\n when 'new_arrivals'\n new_arrivals_show_path\n else\n { action: 'show' }\n end\n\n # If there's a 'redirect' param (the original 'href' of the clicked link),\n # respect that instead.\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI.regexp)\n path = URI.parse(params[:redirect]).path\n end\n\n redirect_to path, status: 303\n end", "def index\n if(params[:search]) then\n search_condition = \"%\" + params[:search] + \"%\"\n session[:search] = params[:search]\n session.delete :page\n elsif(session[:search])\n search_condition = \"%\" + session[:search] + \"%\"\n else\n search_condition = \"%\"\n session.delete :search\n end\n if(params[:page]) then\n session[:page] = params[:page]\n elsif(session[:page])\n nil\n else\n session.delete :page\n end\n @db_names = DbName.where(\"name like ?\", search_condition).order(:name).paginate :page => session[:page], :per_page => 25\n end", "def search(model=User, instance=\"users\")\n @search = model.search(params[:q])\n instance_variable_set(\"@#{instance}\", @search.result)\n if params[:q]\n redirect_to(:controller => :users, :action => :index, :q => params[:q]) and return\n end\n end", "def index\n @search = Product.search(params[:q])\n \n if params[:q].present?\n cookies.permanent.signed[:search_keyword] = {\n value: params[:q]\n }\n else\n cookies.permanent.signed[:search_keyword] = {\n value: \"\"\n }\n end\n @products = @search.result\n @search.build_condition\n end", "def search(model=User, instance=\"users\")\n begin\n @search = model.search(params[:q])\n instance_variable_set(\"@#{instance}\", @search.result)\n rescue Exception => e\n Rails.logger.info \"Exception in search: #{e.inspect}\"\n end\n if params[:q]\n redirect_to(:controller => :users, :action => :index, :q => params[:q]) and return\n end\n end", "def history_session\n session[:history] ||= []\n @searches = searches_from_history # <- in ApplicationController\n end", "def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end", "def index\n session[:search_filter_info] = {}\n\t\t@screen = Screen.find(params[:id])\n @action_source = params[:action_source] || 'index'\n @quick_operation = params[:quick_operation] || 'index'\n @filtered_reference = params[:filtered_reference] || {}\n @row_ids = []\n @row_pattern = Row.find(params[:row_pattern_id].to_i) unless params[:row_pattern_id].nil?\n\n rpp = ApplicationController.current_user.rows_per_page\n @pageno = (!@action_source.include?('page_')) ? 1 : params[:pageno].gsub('/','')\n\n case @action_source\n when 'index'\n options = @quick_operation == 'index' ? Row.filter_by_custom_fields(params[:id].to_i, {}, 'index', false) : {}\n\n @row_ids = options[:filtered_row_ids] || []\n @row_ids_wo_limit = options[:filtered_row_ids_wo_limit] || []\n @row_pattern = Row.find(options[:row_pattern_id]) unless options[:row_pattern_id].nil?\n session[:sort_field_id_order] = options[:sort_field_id_order] || []\n\n RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids, @row_ids_wo_limit)\n\n when 'search', 'page_search', 'page_index'\n\n session[:search_filter_info] = {}\n\n @filtered_reference.each do |key, other|\n cf = CustomField.find(key)\n case cf\n when CustomFields::TextField\n fieldValue = other\n session[:search_filter_info][cf.name] = fieldValue\n when CustomFields::Reference\n fieldValue = Cell.find(:first, :conditions => {:row_id => other.values}).value\n session[:search_filter_info][cf.name] = fieldValue\n when CustomFields::DateTimeField\n count = other.length\n i=0\n for i in 0..(count-1)\n fieldDate = other.keys[i]\n fieldValue = other.values[i]\n session[:search_filter_info][fieldDate] = fieldValue\n end\n else\n fieldValue = other\n a=10\n end\n end\n\n\n\n screen_id = params[:request_id] || @screen.id\n purge = !params[:request_id].nil?\n @row_ids = RowsController.get_session_row_ids(session.session_id, screen_id.to_i, purge)\n \n if params.has_key?(:sort_field_id)\n session[:sort_field_id_order] = Row.reorder_field_sorting(session[:sort_field_id_order], params[:sort_field_id])\n\n @row_ids = Row.sort(@row_ids, session[:sort_field_id_order])\n\n RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids)\n end\n end\n\n @sort_field_id_order = session[:sort_field_id_order]\n \n @row_ids ||= []\n\n @row_count = @row_ids.size\n\n #Page generator\n pageno_from = (rpp*(@pageno.to_i-1))\n pageno_to = ((rpp*@pageno.to_i)-1)\n\n @maxpage = (@row_ids.size.to_f / rpp).ceil\n @row_ids = @row_ids[pageno_from..pageno_to] || []\n\n @rows = @screen.rows.find(:all,\n :conditions => {\n :rows => { :id => @row_ids }\n }\n )\n\n @rows.sort!{|a, b| @row_ids.index(a.id) <=> @row_ids.index(b.id)}\n\n GC.start\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rows }\n end\n end", "def setup_search\n if current_user\n @segment_search = current_user.segments.search(params[:search])\n @terms_search = current_user.translations.search(params[:search])\n else\n @terms_search = nil\n @segment_search = nil\n end\n end", "def inject_last_query_into_params\n if current_search_session\n current_search_params = current_search_session.query_params.empty? ? {} : current_search_session.query_params\n params.merge!(current_search_params.reject {|k,v| [\"controller\",\"action\"].include?(k)})\n end\n end", "def show\n admin_last_url\n search_params = YAML::load(cookies[:product_search])\n search_params[:page] = params[:page]\n do_search search_params\n end", "def index\n key = params[:key].try(:strip)\n search = params[:search].try(:strip)\n \n # if no search term is present\n if search.blank? || key.blank?\n @records = current_user.records.order(\"updated_at desc\").paginate(:page => params[:page])\n # else perform full text search\n else\n @records = current_user.records.where(\"to_tsvector(jsonb_extract_path_text(json, ?)) @@ plainto_tsquery(?)\", key, search).order(\"updated_at desc\").paginate(:page => params[:page])\n # save key to cookie\n session[:search_key] = key\n end\n end", "def index\n if session[:user]\n @user = session[:user]\n @user_logged = @user[\"name\"]\n\n else\n redirect_to(login_path) \n end\n @services = Service.search(params[:search]).paginate(:page => params[:page], :per_page => 6).order('created_at DESC')\n end", "def save_current_search_params\n # If it's got anything other than controller, action, total, we\n # consider it an actual search to be saved. Can't predict exactly\n # what the keys for a search will be, due to possible extra plugins.\n return if (search_session.keys - [:controller, :action, :total, :counter, :commit ]) == []\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n\n #new_search = Search.create(:query_params => params_copy)\n\n new_search = Search.new\n new_search.assign_attributes({:query_params => params_copy}, :without_protection => true)\n new_search.save\n\n session[:history].unshift(new_search.id)\n # Only keep most recent X searches in history, for performance.\n # both database (fetching em all), and cookies (session is in cookie)\n session[:history] = session[:history].slice(0, Blacklight::Catalog::SearchHistoryWindow )\n end\n end", "def search\n unless params[:q].blank?\n ensure_homepage\n term = \"*#{params[:q].split.join('* OR *')}*\"\n @pages=Page.paginate_search(term,:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end", "def search\n @search_term = params[:term]\n\n if !@search_term then\n @search_term = session[:last_search_term]\n end\n # Save this for after editing\n session[:last_view] = 'search'\n session[:last_search_term] = @search_term\n\n # Need this so that links show up\n @list_options = @@list_options\n @title = \"Search Results For '#{@search_term}'\"\n\n @search_count = Order.search(@search_term, true, nil)\n @order_pages = Paginator.new(self, @search_count, 30, params[:page])\n # to_sql is an array\n # it seems to return the limits in reverse order for mysql's liking\n the_sql = @order_pages.current.to_sql.reverse.join(',')\n @orders = Order.search(@search_term, false, the_sql)\n\n render :action => 'list'\n end", "def index\n @response = get_search_results(params[:q], params[:f], params[:per_page], params[:page])\n \n session[:search] ||= {}\n # we want to remove the key if the value is blank or nil\n params[:q].blank? ? session[:search].delete(:q) : session[:search][:q] = params[:q]\n params[:f].blank? ? session[:search].delete(:f) : session[:search][:f] = params[:f]\n params[:per_page].blank? ? session[:search].delete(:per_page) : session[:search][:per_page] = params[:per_page]\n params[:page].blank? ? session[:search].delete(:page) : session[:search][:page] = params[:page]\n \n logger.debug(\"***** session.inspect: #{session.inspect}\")\n respond_to do |format|\n format.html{}\n format.rss do\n render :layout=>false\n end\n end \n end", "def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort, :view].each do |pname|\n params[pname].blank? ? session[:search].delete(pname) : session[:search][pname] = params[pname]\n end\n end", "def find_or_initialize_search_session_from_params(params)\n return if Figgy.read_only_mode\n super\n end", "def find_or_initialize_search_session_from_params(params)\n return if Figgy.read_only_mode\n super\n end", "def set_search\n @search ||= Question.search(params[:q])\n end", "def index\n @searches = Search.where(save_search: true, user_id: current_user.id, searchType: params[:searchType])\n @search_type = params[:searchType]\n end", "def get_search_results(extra_controller_params={})\n Blacklight.solr.find self.solr_search_params(extra_controller_params)\n end", "def call(params)\n @controller = 'query'\n end", "def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort].each do |pname|\n params[pname].blank? ? session[:search].delete(pname) : session[:search][pname] = params[pname]\n end\n end", "def track\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = params[:per_page]\n search_session['document_id'] = params[:document_id]\n\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI::DEFAULT_PARSER.make_regexp)\n uri = URI.parse(params[:redirect])\n path = uri.query ? \"#{uri.path}?#{uri.query}\" : uri.path\n redirect_to path, status: :see_other\n else\n redirect_to({ action: :show, id: params[:id] }, status: :see_other)\n end\n end", "def index\n params[:search] ? @actions = policy_scope(Action).where(\"lower(name) LIKE ?\", \"%#{params[:search][:name].downcase}%\").order(name: :asc) : @actions = policy_scope(Action).order(name: :asc)\n end", "def index\n authorize_action_for User, at: current_store\n query = saved_search_query('user', 'admin_user_search')\n @search = UserSearch.new(query.merge(search_constrains))\n @users = @search.results.page(params[:page])\n end", "def adv_search\r\n\r\n redirect_to :action => :search\r\n end", "def index\n @showResult = false\n if !(params[:q].blank?)\n @showResult = true#code\n end\n @search = Login.search(params[:q])\n @searchadmin = @search.result\n @search.build_condition if @search.conditions.empty?\n end", "def index\n @customers = customer_scope\n session['by_reseller'] = nil\n\n @filters = {search: params[:search]}\n\n if @filters[:search].present?\n @customers = @customers.where(\"LOWER(companies.name) LIKE :search\", search: \"%#{@filters[:search].downcase}%\")\n end\n\n @customers = @customers.order(:name).page(params[:page]).per_page(default_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @customers }\n end\n end", "def spsearch\r\n\r\n if request.post?\r\n if params[:remember].to_i == 1\r\n session[:query] = params.select { |k, v| !['authenticity_token', 'controller', 'action'].include?(k.to_s) }.map { |k, v| \"#{k}=#{URI.encode(v)}\" }.join(\"&\")\r\n else\r\n session[:query] = nil\r\n end\r\n end\r\n \r\n if params[:r1]\r\n session[:change_js]=params[:r1].to_i\r\n end\r\n\r\n if params[:flag]==nil\r\n @tabs='tabs_1'\r\n params[:flag]='tabs_1'\r\n else\r\n @tabs=params[:flag]\r\n end\r\n\r\n unless params[:page].blank?\r\n session[:sp_page] = params[:page]\r\n else\r\n session[:sp_page] = 1\r\n params[:page] = 1\r\n end\r\n\r\n @sp_bsbs,@ending_time,@begin_time = SpBsb.search(params,session[:change_js],current_user,is_sheng?,is_city?,is_county_level?,is_shengshi?,all_super_departments,\"spsearch\")\r\n @sp_bsbs = @sp_bsbs.paginate(page: params[:page], per_page: 10) \r\n respond_to do |format|\r\n format.html {\r\n if @sp_bsbs.respond_to?(:total_pages)\r\n render action: \"index\"\r\n else\r\n render text: '账号存在异常,请联系系统维护方。'\r\n end\r\n }\r\n format.json { render json: @sp_bsbs }\r\n end\r\n end", "def search\n @users ||= User.search_user(params[:search])\n authorize! :read, @user\n end", "def index\n session[:event_params] = params if params[:q].present?\n if params[:q].present? || params[:search_flg]\n session_params = ActionController::Parameters.new(session[:event_params])\n @search = Event.ransack(session_params[:q])\n @events = @search.result if session_params[:q].present?\n flash.now[:warning] = '検索結果は0件です。' if session_params[:q].present? && @events.count == 0\n else\n @search = Event.ransack(params[:q])\n @events = @search.result\n end\n end", "def index\n sleep 1\n # @products = Product.search(params[:search])\n # if params[:search]\n # @products = Product.find(:all, :conditions => ['name LIKE ?', \"%#{params[:search]}%\"])\n # else\n # @products = Product.find(:all)\n \n # end\n if !session[:is_admin]\n redirect_to root_url\n end\n if params[:search].blank?\n # @products = Product.all.paginate(:page => params[:page], :per_page => 10)\n @products = Product.all\n else\n # @products = Product.search(params[:search]).paginate(:page => params[:page], :per_page => 10)\n @products = Product.search(params[:search])\n \n end\n \n end", "def index\r\n if session[:search_query].blank?\r\n @posts = Post.all.order(\"created_at DESC\").page(params[:page])\r\n\r\n else\r\n st = \"%#{session[:search_query]}%\"\r\n @posts = Post.where(\"spot_name like ?\", st).order(\"created_at DESC\").page(params[:page])\r\n end\r\n @requests = Post.where(service_type: 'request').order(\"created_at DESC\").page(params[:page_1]).per(5)\r\n @provides = Post.where(service_type: 'provide').order(\"created_at DESC\").page(params[:page_2]).per(5)\r\n end", "def editor_search\n @results = Soc_med.where text: params[:term]\n redirect_to '/dashboard'\n end", "def start_new_search_session?\n params[:action] == 'show'\n end", "def index\n @docs = SearchController.search(params[:query]) if params[:query].present?\n end", "def delete_or_assign_search_session_params\n session[:search] = {}\n params.each_pair do |key, value|\n session[:search][key.to_sym] = value unless [\"commit\", \"counter\"].include?(key.to_s) ||\n value.blank?\n end\n end", "def index\n# @devices = Device.per_user(current_user).order(updated_at: :desc).paginate(:page => params[:page], per_page: 100)\n @devices = Device.per_user(current_user).order(last_seen: :desc).paginate(:page => params[:page], per_page: 100)\n\n if params[:q]\n q = params[:q]\n @devices = Device.per_user(current_user).where(\"given_name LIKE '%#{q}%'\")\n else\n @devices = Device.per_user(current_user)\n end\n\n @devices = @devices.order(last_seen: :desc).paginate(:page => params[:page], per_page: 100)\n end", "def search\n location = Location.friendly.find(params[:location_selector])\n session[:categoryFilter] = params[:categoryFilter]\n\n redirect_to(location_listings_path(location))\n end", "def results\n Rails.logger.debug(\"Sphinxsearchlogic: #{klass.to_s}.search('#{all}', #{search_options.inspect})\")\n if scopes.empty?\n klass.search(all, search_options)\n else\n cloned_scopes = scopes.clone # Clone scopes since we're deleting form the hash.\n # Get the first scope and call all others on this one..\n first_scope = cloned_scopes.keys.first\n first_args = cloned_scopes.delete(first_scope)\n result = klass.send(first_scope, first_args)\n # Call remaining scopes on this scope.\n cloned_scopes.each do |scope, args|\n result = result.send(scope, args)\n end\n result.search(all, search_options)\n end\n end", "def search\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n @data = search_term(sname)\n render partial: \"shared/search\"\n end", "def search\n check_throttle_limits\n @search ||= Savon.client(\n wsdl: SEARCH_WSDL,\n headers: { 'Cookie' => \"SID=\\\"#{session_id}\\\"\", 'SOAPAction' => '' },\n env_namespace: :soapenv,\n logger:,\n log: true,\n log_level: @log_level,\n pretty_print_xml: true\n )\n rescue Savon::SOAPFault => e\n # this may occur if the session identifier timed out and we didn't catch it, this allows us to request\n # a new session identifier and try the API call again\n # see https://github.com/sul-dlss/sul_pub/wiki/Web-of-Sciences-Expanded-API-Throttle-Limits for known API limits\n # the number of queries per session should already be accounted for, but not the time out limit\n raise e unless e.message.include? 'There is a problem with your session identifier (SID)'\n\n session_close\n retry\n end", "def index\n # Set session variables\n if session[:selected_borrowed_items].blank?\n session[:selected_borrowed_items] = Hash.new\n end\n \n # reset search param\n if !params[:from].blank? && params[:from].match('reset_search')\n session[:crm_borrowed_items_search_details] = nil\n end\n \n # any previous borrowed items search in session?\n if session[:crm_borrowed_items_search_details] != nil\n @search = session[:crm_borrowed_items_search_details]\n else\n @search = CrmBorrowedItemsSearchDetails.new\n end\n \n end", "def save_current_search_params\n # If it's got anything other than controller, action, total, we\n # consider it an actual search to be saved. Can't predict exactly\n # what the keys for a search will be, due to possible extra plugins.\n# return if (search_session.keys - [:controller, :action, :total, :counter, :commit ]) == []\n# params_copy_h = search_session.clone # don't think we need a deep copy for this\n# params_copy_h.delete(:page)\n# params_copy = ActiveSupport::HashWithIndifferentAccess.new(params_copy_h)\n\n# unless @searches.collect { |search| search.query_params }.include?(params_copy)\n\n #new_search = Search.create(:query_params => params_copy)\n\n# new_search = Search.new\n# new_search.assign_attributes({:query_params => params_copy}, :without_protection => true)\n# new_search.save\n\n# session[:history].unshift(new_search.id)\n # Only keep most recent X searches in history, for performance.\n # both database (fetching em all), and cookies (session is in cookie)\n# session[:history] = session[:history].slice(0, Blacklight::Catalog::SearchHistoryWindow )\n# end\n end", "def index\n #Search function defined privately below; params[:search] from search_form in index.html.erb\n key_search(params[:search])\n end", "def index\n @usuarios = @empresa.usuarios.activos.paginate(page: params[:page], per_page: 5)\n if params[:search].present? \n @search_terms = params[:search]\n @usuarios = @usuarios.search_by(@search_terms)\n end\n end", "def search\n # Recall that '%' represents wildcard in SQL\n search_by_keywords = \"%#{params[:keywords]}%\"\n\n # @returned_players will be shared with /players/search.html.erb\n @returned_players = Player.where(\"name LIKE ?\", search_by_keywords).paginate(:page => params[:page], :per_page => 50)\n end", "def save_current_search_params\n return if search_session[:q].blank? && search_session[:f].blank?\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n new_search = Search.create(:query_params => params_copy)\n session[:history].unshift(new_search.id)\n end\n end", "def delete_or_assign_search_session_params\n session[:search] = {}\n params.each_pair do |key, value|\n value = value.to_unsafe_h if key == \"f\"\n session[:search][key.to_sym] = value unless ['commit', 'counter'].include?(key.to_s) ||\n value.blank?\n end\n session[:gearch] = {}\n params.each_pair do |key, value|\n session[:gearch][key.to_sym] = value unless ['commit', 'counter'].include?(key.to_s) ||\n value.blank?\n end\n end", "def index\n @estAdmin = admin?\n id = session[:user]['id']\n search = params[:search]&.downcase\n @factures = if @estAdmin && !search\n Facture.includes('client').all\n elsif @estAdmin && search\n Facture.includes('client').search(search).all\n elsif search\n Facture.includes('client').where(user_id: id).search(search)\n else\n Facture.includes('client').where(user_id: id)\n end\n\n @factures = @factures.page(params[:page]).per(7)\n end", "def search\n @categories = (auth_user) ? Category.for_user(auth_user) : Category.all\n\n execute_search\n\n set_after_search_info\n\n respond_to do |format|\n format.js\n format.html {}\n format.json { render json: items_search_json }\n end\n end", "def set_search\n @search_adie = Adie.search(params[:q])\n @search_company = Company.search(params[:q])\n @search_employee = Employee.search(params[:q])\n end", "def index\n session[:search_params] = params[:language] ? params[:language] : nil\n\n session[:set_pager_number] = params[:set_pager_number] if params[:set_pager_number]\n\n if session[:set_pager_number].nil?\n session[:set_pager_number] = PER_PAGE\n end\n\n @o_all = Language.\n search(session[:search_params]).\n order(sort_column + \" \" + sort_direction).\n paginate(:per_page => session[:set_pager_number], :page => params[:page])\n\n @params_arr = { :name => { \"type\" => 'text' }, :code => { \"type\" => 'text' } }\n\n @o_single = controller_name.classify.constantize.new\n end", "def index\n @q = UsuarioCurso.where(curso_id: current_usuario.curso_atual_id).ransack(params[:q])\n @usuario_curso = @q.result.paginate(page: params[:page]).order('nickname')\n authorize! :index, UsuarioCurso\n end", "def search\n end", "def search\r\nend", "def index\n\t eval(\"@#{controller_name} = #{controller_name.classify}.search(params[:query],params[:page],current_user.admin_list_limit)\")\n\t\t\n\t\tindex_callback\n \n\t\trespond_to do |format|\n format.html # index.html.erb\n format.js { render :layout=>false }\n\t\t\tformat.ac { render :layout=>false }\n format.xml { render :xml => eval(\"@#{controller_name}\") }\n end\n end", "def search\n # if the user has selected to clear the search, or there is no search params, start from the top\n if params[:clear] || params[:q] == \"\"\n Rails.logger.info(\"Kind: #{params.inspect}\")\n redirect_to kinds_path\n else \n @kinds = Kind.search(params[:q]).page params[:page]\n #@page = 1\n render :index\n end\n end", "def search\n\n end", "def add_search_vrn\n session[:payment_query] = {}\n session[:payment_query][:search] = params.dig(:payment, :vrn_search)\n end", "def index\n store_location()\n @search = Search.new\n @search.update_columns(keys: params[:keys])\n \n if params[:keys].present?\n \n end\n \n redirect_back_or(admin_search_url)\n end", "def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n search_params[params[:update_filter]] = nil\n session[:search_key][params[:update_filter]] = nil\n end\n #session.delete('search_key')\n else\n if session[:search_key].nil?\n session[:search_key] = {}\n end\n session[:search_key][params[:update_filter]] = params[:q][params[:update_filter]]\n end\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def search_results\n search_name = params[\"customer\"]\n @customers = Customer.where(florist_id: session[\"found_florist_id\"]).where(\"name ilike ?\",\"%#{params[\"customer\"]}%\") \n render(:search_results) and return\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def index\n @current_user = current_user\n\n search_term = params[:search]\n @dolls = Doll.search do\n query { string search_term }\n end\n end", "def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end", "def update\n if params[:counter] && session[:search][:counter] != params[:counter]\n session[:search][:counter] = params[:counter]\n end\n\n if params[:id]\n redirect_to action: \"show\", controller: :catalog, id: params[:id]\n else\n redirect_to action: \"index\", controller: :catalog\n end\n end", "def search params = {}\n send_and_receive search_path(params), params.reverse_merge(qt: blacklight_config.qt)\n end", "def search_results\n pages = Alchemy::PgSearch.config[:page_search_scope].pages\n # Since CanCan cannot (oh the irony) merge +accessible_by+ scope with pg_search scopes,\n # we need to fake a page object here\n if can? :show, Alchemy::Page.new(restricted: true, public_on: Date.current)\n pages.full_text_search(params[:query])\n else\n pages.not_restricted.full_text_search(params[:query])\n end\n end", "def cached_results\n if session[:cached_query] \n @objects = eval(session[:cached_query])\n if !@objects.empty?\n eval(session[:active_search] + \"(@objects)\")\n else\n flash[:notice] = \"No rows returned\"\n render :inline => %{},:layout => 'content'\n end\n else\n flash[:notice] = \"No search results have been cached\"\n render :inline => %{},:layout => 'content'\n end\n \n end", "def restore_for_current_user\n return unless current_user\n\n search = current_user.search_params.find_or_initialize_by(model: search_key)\n if resetting_search?\n search&.destroy\n redirect_to action: params[:action]\n elsif actively_searching?\n search.params = {\n scope: params[:scope].dup,\n s: params[:s].dup,\n fs: params[:fs].dup,\n f: params[:f].dup\n }\n search.save\n elsif search.persisted?\n redirect_to search.params.merge(action: params[:action])\n end\n\n true\n end", "def search\nend", "def index\n query = ''\n searchparam = \"\"\n if params[:search] && params[:search] != ''\n query += ' lower(name) LIKE ?'\n searchparam = \"%#{params[:search].downcase}%\"\n end\n\n @users = User.where(query, searchparam).paginate(page: params[:page])\n @searched = query != ''\n end", "def index\n authorize! :index_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n if unidad.nil?\n flash[:error] = \"Seleccione una Unidad Funcional \"\n redirect_to root_path \n else\n @sigesp_solicituds = Sigesp::Solicitud.search_almacen(params[:page],params[:search],params[:sort],unidad)\n end \n end" ]
[ "0.66462785", "0.6454236", "0.6440791", "0.6408878", "0.63576627", "0.62517464", "0.61903757", "0.61287576", "0.61168456", "0.60714304", "0.606207", "0.6042536", "0.6034373", "0.6015495", "0.5995451", "0.5992801", "0.598637", "0.5981894", "0.5942771", "0.59143424", "0.58729255", "0.58681864", "0.58439803", "0.58151513", "0.5807238", "0.5800007", "0.5779423", "0.57720023", "0.57594085", "0.57563114", "0.57483363", "0.5724076", "0.5706118", "0.5702934", "0.5702934", "0.5698976", "0.56779915", "0.5644459", "0.56373817", "0.5629211", "0.56179386", "0.56160873", "0.560863", "0.5600974", "0.55903673", "0.5588917", "0.5581274", "0.5575272", "0.55661327", "0.5565891", "0.556154", "0.5539543", "0.5538827", "0.55382", "0.5528583", "0.55284643", "0.5509439", "0.5499481", "0.5496969", "0.54944545", "0.5491138", "0.54882145", "0.5481133", "0.5480985", "0.5480974", "0.5479952", "0.5477294", "0.54734766", "0.5470461", "0.5469299", "0.5466848", "0.546672", "0.54650134", "0.5464519", "0.546411", "0.54606056", "0.5459344", "0.5455811", "0.545364", "0.5450897", "0.5447772", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54472935", "0.54445314", "0.543896", "0.543538", "0.54216975", "0.54186827", "0.54158056", "0.5413615", "0.5411123", "0.5393621", "0.53921795" ]
0.0
-1
method to define all printable menu items
def define_menu_items add_menu_item("Weekly worktime.", 1) add_menu_item("Monthly worktime.", 2) add_menu_item("Custom worktime interval.", 3) add_menu_item("Cancel and return to previous menu.", 4) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_menu_items\n check_attributes\n @menu_description.concat(\"\\n #{set_boundaries}\")\n add_menu_item(\"All tasks to a person in the given #{time_string}.\", 1)\n add_menu_item(\"Worktime of a person in that #{time_string}.\", 2)\n add_menu_item(\"All tasks running during the interval.\", 3)\n add_menu_item(\"Write Query result to csv-file.\", 4)\n add_menu_item(\"Cancel and return to previous menu.\", 5)\n end", "def menu_items\n\n menu.items(self)\n\n end", "def print_menu\n self.menu_items.each do |item|\n p \"#{item.dish_name.upcase} 😋 $#{item.price}\"\n end\n end", "def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend", "def define_menu_items\n add_menu_item(\"File storage.\", 1)\n add_menu_item(\"Sqlite3.\", 2)\n end", "def print_menu\n MENU.each do |i| \n # in general, avoid printing things.\n # Return them instead and let the code that called it\n # to return it\n puts \"#{i[:name]} costs #{i[:price]}\"\n end\n end", "def print_menu\n\t\tsystem ('cls') or system ('clear')\n\t\t@todo_list.print_list\n\t\tprint_menu_options\n\tend", "def define_menu_items\n add_menu_item(\"Http request\", 1)\n add_menu_item(\"Http status\", 2)\n add_menu_item(\"Sourceadress\", 3)\n add_menu_item(\"Timestamp\", 4)\n end", "def menu_items\n menu.items(self)\n end", "def menu_items\n menu.items(self)\n end", "def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend", "def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend", "def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend", "def print_items\n if @past_menu.nil?\n term.erase_body\n @items.each_with_index do |item, i|\n print_item(item, i, reverse: i == @cur_menu)\n end\n else\n print_item(@items[@past_menu], @past_menu)\n print_item(@items[@cur_menu], @cur_menu, reverse: true)\n end\n end", "def create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend", "def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend", "def print_menu\n puts \"1. List patients\"\n # ....\n end", "def assigned_menu\n\n end", "def create_menus\n @file_menu = menu_bar.add_menu(tr(\"&File\"))\n @currency_menu = menu_bar.add_menu(tr(\"&Currency\"))\n @currency_menu.add_action(@import_file_action)\n @currency_menu.add_action(@import_url_action)\n @token_menu = menu_bar.add_menu(tr(\"&Token\"))\n @token_menu.add_action(@verify_action)\n @token_menu.add_action(@reissue_action)\n menu_bar.add_separator\n @help_menu = menu_bar.add_menu(tr(\"&Help\"))\n @help_menu.add_action(@about_action)\n end", "def print_menu(options)\n i = 0\n options.each do |attribute|\n puts \"[#{i}] #{attribute}\"\n i += 1\n end\n end", "def customizeMenu\n menu[:proteins] = [\"Tofurkey\", \"Hummus\"]\n menu[:veggies] = [:ginger_carrots , :potatoes, :yams]\n menu[:desserts] = { :pies => [:pumkin_pie],\n :other => [\"Chocolate Moose\"],\n :molds => [:cranberry, :mango, :cherry] }\n end", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def print_menu\n isFinished = true\n while (isFinished)\n puts @menu_description\n @menu_items.each_pair { |key, value|\n puts \"(#{key}) #{value}\"\n }\n\n isFinished = determine_action(get_entry(\"Select option: \"))\n end\n end", "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def initialize(*args)\n super\n @cur_menu = 0\n @past_menu = nil\n @items = [Item.new('New', :read_new_menu),\n Item.new('Boards', :print_board_menu),\n Item.new('Select', :select_board_menu),\n Item.new('Read', :read_board_menu)]\n @items.concat(\n %w(Post Talk Mail Diary Welcome Xyz Goodbye Help)\n .map { |name| Item.new(name) })\n # @items.concat(%w(Extra Visit InfoBBS).map { |name| Item.new(name) }))\n @items << Item.new('Admin') if term.current_user.admin?\n @items.freeze\n end", "def print_menu menu_level= '0'\n print_menu_header menu_level\n\n 20.times do |counter|\n lvl = \"#{menu_level}.#{counter}\"\n puts \" #{counter} : \" + @menu_map[lvl][0] if @menu_map.has_key?(lvl)\n end\n puts \"Make a choice between those items. (X to exit)\"\n puts \"Use left arrow to go back\"\n end", "def menu # can do custom methods within a method/class\n end", "def create_menu\n items = Hash.new\n # action shd be a hash\n # menu should have array of hashes (or just a string)\n #db = { :name => \"Databases\", :accelerator => \"M-d\", :enabled = true, :on_right => :get_databases }\n #or = { :name => \"Open Recent\", :accelerator => \"M-o\", :enabled = true, :on_right => :get_recent }\n #find_array = {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev}\n items[\"File >\"] = [\"Open ... C-o\" , \"Open Recent\", \"Databases\" , \"Tables\", \"Exit\"]\n items[\"Window >\"] = { \"Tile\" => nil, \"Find >\" => {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev},\n \"Edit\" => nil, \"Whatever\" => nil}\n items[\"Others >\"] = { \"Shell Output ...\" => :shell_output, \"Suspend ...\" => :suspend , \"View File\" => :choose_file_and_view}\n\n # in the case of generated names how will call back know that it is a db name or a table name\n # We get back an array containing the entire path of selections\n right_actions = {}\n right_actions[\"Databases\"] = Proc.new { Dir.glob(\"**/*.{sqlite,db}\") }\n right_actions[\"Tables\"] = :get_table_names\n\n ret = popupmenu items, :row => 1, :col => 0, :bgcolor => :cyan, :color => :white, :right_actions => right_actions\n # ret can be nil, or have a symbol to execute, or a String for an item with no leaf/symbol\n if ret\n alert \"Got #{ret}\"\n last = ret.last\n if last.is_a? Symbol\n if respond_to?(last, true)\n send(last)\n end\n end\n end\n\n return\n r = 1\n ix = popuplist( top , :title => \" Menu \" , :row => r, :col => 0, :bgcolor => :cyan, :color => :white)\n if ix\n value = top[ix]\n ix = popuplist( items[value] , :row => r + 2 + ix, :col => 10, :bgcolor => :cyan, :color => :white)\n end\nend", "def print_menu_entry(sons, entry, view_ctrl)\n has_submenu = sons[entry.id].present?\n is_current_page = (@page && @page == entry.target) || request.path == entry.url\n item_class = entry.html_class.present? ? [entry.html_class] : []\n item_class << 'sub' if has_submenu\n item_class << 'current_page' if is_current_page\n\n content_tag :li, id: \"menu_item_#{entry.id}\", class: item_class.join(' ') do\n title_link = link_to(entry.title,\n entry.target_id.to_i > 0 ? main_app.site_page_path(entry.target_id) : entry.url,\n alt: entry.title, title: entry.description, target: entry.new_tab ? '_blank' : '')\n\n li_content = []\n li_content << content_tag(:div, '', class: 'hierarchy') if view_ctrl\n li_content << if view_ctrl\n content_tag(:div, style: 'min-height: 25px', class: \"menuitem-ctrl#{' deactivated' unless entry.publish}\") do\n div_content = []\n div_content << content_tag(:span) do\n [\n toggle_field(entry, 'publish', 'toggle', controller: 'sites/admin/menus/menu_items', menu_id: entry.menu_id),\n \" #{title_link}\",\n ( (entry and entry.target) ? \" [ #{entry.target.try(:title)} ] \" : \" [ #{entry.url unless entry.url.blank?} ] \")\n ].join.html_safe\n end\n div_content << content_tag(:div, class: 'pull-right') do\n menu_content = []\n menu_content << link_to(icon('edit', text: ''), edit_site_admin_menu_menu_item_path(entry.menu_id, entry.id), title: t('edit')) if test_permission(:menu_items, :edit)\n menu_content << link_to(icon('trash', text: ''), site_admin_menu_menu_item_path(entry.menu_id, entry.id), method: :delete, data: { confirm: t('are_you_sure') }, title: t('destroy')) if test_permission(:menu_items, :destroy)\n menu_content << link_to(icon('move', text: ''), '#', class: 'handle', title: t('move')) if test_permission(:menu_items, :change_position)\n menu_content << link_to('+', new_site_admin_menu_menu_item_path(entry.menu_id, parent_id: entry.id), class: 'btn btn-success btn-xs', title: t('add_sub_menu')) if test_permission(:menu_items, :new)\n menu_content.join.html_safe\n end\n div_content.join.html_safe\n end\n else\n title_link\n end\n li_content << content_tag(:menu, class: 'submenu') do\n sons[entry.id].map do |child|\n print_menu_entry(sons, child, view_ctrl)\n end.join.html_safe\n end if has_submenu\n li_content.join.html_safe\n end\n end", "def createMenu\n\n # File menu\n recordAction = @actions.addNew(i18n('Start Download'), self, \\\n { :icon => 'arrow-down', :triggered => :startDownload })\n reloadStyleAction = @actions.addNew(i18n('&Reload StyleSheet'), self, \\\n { :icon => 'view-refresh', :shortCut => 'Ctrl+R', :triggered => :reloadStyleSheet })\n clearStyleAction = @actions.addNew(i18n('&Clear StyleSheet'), self, \\\n { :icon => 'list-remove', :shortCut => 'Ctrl+L', :triggered => :clearStyleSheet })\n quitAction = @actions.addNew(i18n('&Quit'), self, \\\n { :icon => 'application-exit', :shortCut => 'Ctrl+Q', :triggered => :close })\n\n updateScheduleAction = @actions.addNew(i18n('Update Schedule'), @scheduleWin, \\\n { :shortCut => 'Ctrl+U', :triggered => :updateAllFilters })\n\n fileMenu = KDE::Menu.new('&File', self)\n fileMenu.addAction(recordAction)\n fileMenu.addAction(reloadStyleAction)\n fileMenu.addAction(clearStyleAction)\n fileMenu.addAction(updateScheduleAction)\n fileMenu.addAction(quitAction)\n\n\n # settings menu\n playerDockAction = @playerDock.toggleViewAction\n playerDockAction.text = i18n('Show Player')\n configureAppAction = @actions.addNew(i18n('Configure %s') % APP_NAME, self, \\\n { :icon => 'configure', :shortCut => 'F2', :triggered => :configureApp })\n\n settingsMenu = KDE::Menu.new(i18n('&Settings'), self)\n settingsMenu.addAction(playerDockAction)\n settingsMenu.addSeparator\n settingsMenu.addAction(configureAppAction)\n\n\n # Help menu\n aboutDlg = KDE::AboutApplicationDialog.new(KDE::CmdLineArgs.aboutData)\n openAboutAction = @actions.addNew(i18n('About %s') % APP_NAME, self, \\\n { :icon => 'irecorder', :triggered =>[aboutDlg, :exec] })\n openDocUrlAction = @actions.addNew(i18n('Open Document Wiki'), self, \\\n { :icon => 'help-contents', :triggered =>:openDocUrl})\n openReportIssueUrlAction = @actions.addNew(i18n('Report Bug'), self, \\\n { :icon => 'tools-report-bug', :triggered =>:openReportIssueUrl })\n openRdocAction = @actions.addNew(i18n('Open Rdoc'), self, \\\n { :icon => 'help-contents', :triggered =>:openRdoc })\n openSourceAction = @actions.addNew(i18n('Open Source Folder'), self, \\\n { :icon => 'document-open-folder', :triggered =>:openSource })\n\n\n helpMenu = KDE::Menu.new(i18n('&Help'), self)\n helpMenu.addAction(openDocUrlAction)\n helpMenu.addAction(openReportIssueUrlAction)\n helpMenu.addAction(openRdocAction)\n helpMenu.addAction(openSourceAction)\n helpMenu.addSeparator\n helpMenu.addAction(openAboutAction)\n\n # insert menus in MenuBar\n menu = KDE::MenuBar.new\n menu.addMenu( fileMenu )\n menu.addMenu( settingsMenu )\n menu.addSeparator\n menu.addMenu( helpMenu )\n setMenuBar(menu)\n end", "def print_menu()\n menu = [\"Add Item charge\",\"Add Labor\",\"Apply Discount\",\"total\",\"New Transaction\", \"Exit Application\"];\n\n for i in 1..6 do\n puts(\"#{i}\\t\\t#{menu[i-1]}\");\n end \nend", "def print_menu\n puts \"\\nMAIN MENU\"\n puts \"add (+)\"\n puts \"subtract (-)\"\n puts \"multiply (*)\"\n puts \"divide (/)\"\n puts \"modulo (%)\"\n puts \"exponify (^)\"\nend", "def nMenuItems _obj, _args\n \"_obj nMenuItems _args;\" \n end", "def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end", "def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend", "def generate_menu\n @items = []\n @x = @window.width / 3 + Const::FONT_SMALL_SIZE\n @y = @title_image.height * @img_size_factor + Const::GAME_WIN_GAP\n n_g = proc { @window.state = GameState.new(@window, @window.width / 3, 40) }\n cr_n = proc { @window.state = NetSetupState.new(@window) }\n j_n = proc { @window.state = NetJoinState.new(@window) }\n exit = proc { @window.close }\n @items << MenuItem.new(@window, Const::MENU_NEW, 0, n_g, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_CREATE, 1, cr_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_JOIN, 2, j_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_QUIT, 3, exit, @font, @x, @y)\n end", "def menu_items\n {\n :dashboard => {\n :content => \"#{link_to \"Dashboard\", url(:root)} [#{active_task_count}]\",\n :position => 1\n },\n :projects => {\n :content => link_to(\"Projects\", url(:projects)),\n :position => 2\n },\n :contexts => {\n :content => link_to(\"Contexts\", url(:contexts)),\n :position => 3\n },\n :new_action => {\n :content => \"+ #{link_to(\"Action\", url(:new_task))}\",\n :position => 4,\n :attrs => { :class => \"right\" }\n }\n }\n end", "def print_menu\n #print menu message\n border = @menu[:message].gsub(/\\s|\\S/, '*')\n puts border\n puts @menu[:message]\n puts border\n\n #print dishes This is very convoluted but using nested loops i can \n #print the menu and keep it organized the way i want it\n @menu[:options].each do |item| #this grabs all the items in the options hash\n item[:dish].each_with_index do |item2, index| #this grabs the dish array within the option hash\n puts \"#{index+1}. #{item2} - $#{(item[:price][index])}\"#the item[:price][index] grabs all the prices associated with each menu item\n end \n end\n end", "def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end", "def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|method_name, index| puts \"#{index + 1}: #{method_name.to_s.humanize}\"}\n puts \"\\nPlease enter your selection:\"\nend", "def menu_items\n elements = []\n\n if display_parent_work && display_parent_work.rights.present?\n elements << \"<h3 class='dropdown-header'>Rights</h3>\".html_safe\n elements << rights_statement_item\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if has_work_download_options?\n elements << \"<h3 class='dropdown-header'>Download all #{display_parent_work.member_count} images</h3>\".html_safe\n whole_work_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if viewer_template_mode?\n elements << \"<h3 class='dropdown-header'>Download selected image</h3>\".html_safe\n elements << '<div data-slot=\"selected-downloads\"></div>'.html_safe\n elsif asset_download_options\n elements << \"<h3 class='dropdown-header'>Download selected #{thing_name}</h3>\".html_safe\n asset_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n end\n\n safe_join(elements)\n end", "def print_descriptions(menu)\n\tmenu.each_with_index { |menu, index| puts \"\\t#{index + 1}) #{menu.item}: #{menu.description}\\n\\n\"}\nend", "def display_menu()\n print \"\\n\"\n $menu.keys.each do |i|\n puts \" #{i}. $#{'%.2f' % $menu[:\"#{i}\"][:cost]} #{$menu[:\"#{i}\"][:selection]}\"\n end\n\n puts \"\\nEnter the letter of the item you want: \"\nend", "def render_menu\n output = []\n\n @paginator.paginate(@choices, @page_active, @per_page) do |choice, index|\n num = (index + 1).to_s + @enum + \" \"\n selected = num.to_s + choice.name.to_s\n output << if index + 1 == @active && !choice.disabled?\n (\" \" * 2) + @prompt.decorate(selected, @active_color)\n elsif choice.disabled?\n @prompt.decorate(@symbols[:cross], :red) + \" \" +\n selected + \" \" + choice.disabled.to_s\n else\n (\" \" * 2) + selected\n end\n output << \"\\n\"\n end\n\n output.join\n end", "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "def interactive_menu\n loop do\n print_menu\n selection\n end\nend", "def getMenu(menu)\n end", "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def build_menu\n comment = table_info['comment']\n # #puts \"build Rails menu for #{model_name} (#{comment}) in\n # app/views/shared\"\n @@menus << { :model_name => model_name, :comment => comment, :route => \"/\"+ plural_table_name}\n \n end", "def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend", "def menu title, h\n return unless h\n\n clear_last_line # 2019-03-30 - required since cursor is not longer at bottom\n pbold title.to_s\n # h.each_pair { |k, v| puts \" #{k}: #{v}\" }\n # 2019-03-09 - trying out using `column` to print in cols\n ary = []\n\n # 2019-04-07 - check @bindings for shortcut and get key, add global\n # binding in brackets\n h.each_pair do |k, v|\n # get global binding\n vs = v.to_s\n scut = @bindings.key(vs)\n scut = \" (#{scut})\" if scut\n\n # ary << \" #{k}: #{v} #{scut}\"\n vs = vs.sub('_menu', '...') if vs.end_with?('_menu')\n vs = vs.tr('_', ' ')\n ary << \" [#{k}] #{vs} #{scut}\"\n end\n x = ary.join(\"\\n\")\n # echo column line bombs when x contains a single quote.\n # If i double quote it then it bombs with double quote or backtick\n # and prints the entire main menu two times.\n x = x.gsub(\"'\", 'single quote')\n # x = x.gsub(\"`\", \"back-tick\")\n puts `echo '#{x}' | column`\n\n key = get_char\n binding = h[key]\n binding ||= h[key.to_sym]\n # TODO: 2019-03-21 - menu's do not have comments, they are symbols\n # binding, _ = binding.split(':')\n if binding\n # 2019-04-18 - true removed, else 'open' binds to ruby open not OS open\n # without true, many methods here don't get triggered\n send(binding) if respond_to?(binding, true)\n # send(binding) if respond_to?(binding)\n end\n redraw_required\n [key, binding]\nend", "def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end", "def default_context_menu\n [\n :row_counter.action,\n \"-\",\n :ctrl_manage.action,\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end", "def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend", "def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])\n menu.push([t(\"menu.users\"), admin_users_path, Proc.new {controller_name == \"users\"}])\n menu.push([t(\"menu.profile\"), admin_profile_path, Proc.new {controller_name == \"profile\"}])\n menu.push([t(\"menu.logout\"), logout_path])\n end\n menu\n end", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end", "def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [{:path => '/system',\n :options => {\n \t:title => app.t.system_admin_menu.system_menu,\n :description => 'System menu',\n :module => :system,\n :weight => 0\n }\n },\n {:path => '/system/logger', \n :options => {:title => app.t.system_admin_menu.logger,\n :link_route => \"/admin/logger\",\n :description => 'Reads the logs',\n :module => :system,\n :weight => 1}\n },\n {:path => '/system/business-events', \n :options => {:title => app.t.system_admin_menu.business_event,\n :link_route => \"/admin/business-events\",\n :description => 'Manages business events',\n :module => :system,\n :weight => 0}\n }\n ] \n \n end", "def print_menu\n print <<MENU\n \\nPlease choose one of the following options:\n 1. Encrypt\n 2. Decrypt\n 3. Exit\nMENU\nend", "def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end", "def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end", "def print_menu(menu, view_ctrl: false, html_class: 'expanded')\n return '' unless menu\n menuitems = menu.items_by_parent(!view_ctrl)\n content_tag :menu, class: html_class do\n menuitems.fetch(nil, []).map do |child|\n print_menu_entry(menuitems, child, view_ctrl)\n end.join.html_safe\n end\n end", "def print_menu(options_types)\n min_length = options_types.collect { |item| item.length }.min\n num_of_items = get_number(\"menu items\", min_length)\n puts \"\\nHere's your menu:\"\n (1..num_of_items).each do |item_num|\n print \" #{item_num}.\"\n options_types.each { |type| print \" #{type.delete_at(rand(type.length - 1))}\" }\n puts\n end\nend", "def menu(options = {})\n config.menu_item_options = options\n end", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n # add one more menu item to save the students\n puts \"3. Save the list to students.csv\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def do_render_menu (menu_items)\n\n result = menu_items.collect do |i|\n controller_name, action, text, title = i\n if controller.controller_name == controller_name\n text\n else\n link_to(\n text,\n {\n :controller => controller_name,\n :action => action\n },\n {\n :title => title\n })\n end\n end\n result.join(\" | \")\n end", "def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end", "def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end", "def theatre_menu\n theatre = Menu.new(\"What would you like to do with theatres?\")\n theatre.add_menu_item({key_user_returns: 1, user_message: \"Create a theatre.\", do_if_chosen: [\"create_theatre\"]})\n theatre.add_menu_item({key_user_returns: 2, user_message: \"Update a theatre.\", do_if_chosen: [\"update_object\", Location, \"theatre_menu\"]})\n theatre.add_menu_item({key_user_returns: 3, user_message: \"Show me theatres.\", do_if_chosen: [\"show_object\", Location, \"theatre_menu\"]})\n theatre.add_menu_item({key_user_returns: 4, user_message: \"Delete a theatre.\", do_if_chosen: [\"delete_object\", Location, \"theatre_menu\"]})\n theatre.add_menu_item({key_user_returns: 5, user_message: \"Return to main menu.\", do_if_chosen: \n [\"main_menu\"]})\n run_menu_and_call_next(theatre)\n end", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "def movie_menu\n movie = Menu.new(\"What would you like to do with movies?\")\n movie.add_menu_item({key_user_returns: 1, user_message: \"Create a movie.\", do_if_chosen: [\"create_movie\"]})\n movie.add_menu_item({key_user_returns: 2, user_message: \"Update a movie.\", do_if_chosen: [\"update_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 3, user_message: \"Show me movies.\", do_if_chosen: [\"show_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 4, user_message: \"Delete a movie.\", do_if_chosen: [\"delete_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 5, user_message: \"Return to main menu.\", do_if_chosen: \n [\"main_menu\"]})\n run_menu_and_call_next(movie)\n end", "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n :del.action,\n \"-\", # Adds a separator\n :add_in_form.action,\n :edit_in_form.action\n ]\n end", "def print_menu\n # 1. print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"9. Exit\" # '9' because we'll be adding more items later\nend", "def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend", "def render_menus \n# student_menu = add_menu('#{@studentb.full_name}')\n student_menu = add_menu('#{image_tag(@studentb.thumb_image,:style=>\";float:left;height:25px;margin-right:10px;\") + \" \" + @studentb.full_name + \"&nbsp;&nbsp;\"}',:action=>'profile')\n student_menu.add_submenu('Profile',:action=>'profile')\n student_menu.add_submenu('Photos',:action=>'photo',:if=>\"@studentb.visible_album_counts(@me) > 0\") \n student_menu.add_submenu('Binder',:action=>'show_notes',:if=>\"@studentb.notes.not_anonymous.size > 0\") \n \n end", "def menu\n @menu ||= Interface::Menu.new(self)\n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY ARITMETICO]]-----\"\n puts \"______________________________\"\n puts \"1) Suma\"\n puts \"2) Resta\"\n puts \"3) División\"\n puts \"4) Multiplicación\"\n puts \"5) Potencia\"\n puts \"6) Residuo\"\n puts \"7) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend", "def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end", "def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end", "def object_menu(class_name, action)\n class_string = class_name.to_s.underscore.downcase\n create_menu = Menu.new(menu_title_hash_by_action(class_string.humanize.downcase)[action])\n all = class_name.all\n all.each_with_index do |object, x|\n create_menu.add_menu_item({user_message: get_object_display_message(object), method_name: \"#{class_string}/#{action}/#{object.id}\"})\n end\n create_menu\n end", "def print_menu\n puts \"User's Menu\\n-----------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def display_item_menu\n item_menu = [\n 'Add Item to Cart',\n 'See description',\n 'Back to Categories',\n 'Back to Main Menu'\n ]\n item_menu.each_with_index do |item, i|\n puts \" #{i + 1} : #{item}\"\n end\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def setupMenus\n # Menus:\n fileMenu = menuBar().addMenu(tr(\"&File\"))\n helpMenu = menuBar().addMenu(tr(\"&Help\"))\n # Menu items:\n openFile = fileMenu.addAction(tr(\"&Open...\"))\n openFile.shortcut = Qt::KeySequence.new(tr(\"Ctrl+O\"))\n exitAction = fileMenu.addAction(tr(\"E&xit\"))\n exitAction.shortcut = Qt::KeySequence.new(tr(\"Ctrl+X\"))\n aboutView = helpMenu.addAction(tr(\"&About\"))\n aboutView.shortcut = Qt::KeySequence.new(tr(\"Ctrl+A\"))\n # Menu item actions:\n connect(openFile, SIGNAL('triggered()'), self, SLOT('open_file()'))\n connect(exitAction, SIGNAL('triggered()'), $qApp, SLOT('quit()'))\n connect(aboutView, SIGNAL('triggered()'), self, SLOT('about()'))\n end", "def menu\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def addMenu _obj, _args\n \"_obj addMenu _args;\" \n end", "def menu_code\n menu = \"<span class=\\\"list-settings\\\" data-list-ref=\\\"#{uid}\\\">\"\n menu << \"<a class=\\\"settings-start\\\"><i></i>' + h('list.menu'.t) + '</a>\"\n menu << '<ul>'\n if table.paginate?\n # Per page\n list = [5, 10, 20, 50, 100, 200]\n list << table.options[:per_page].to_i if table.options[:per_page].to_i > 0\n list = list.uniq.sort\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"pages\\\"><i></i>' + h('list.items_per_page'.t) + '</a><ul>\"\n list.each do |n|\n menu << \"<li data-list-change-page-size=\\\"#{n}\\\" '+(#{var_name(:params)}[:per_page] == #{n} ? ' class=\\\"check\\\"' : '') + '><a><i></i>' + h('list.x_per_page'.t(count: #{n})) + '</a></li>\"\n end\n menu << '</ul></li>'\n end\n\n # Column selector\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"columns\\\"><i></i>' + h('list.columns'.t) + '</a><ul>\"\n for column in table.data_columns\n menu << \"<li data-list-toggle-column=\\\"#{column.name}\\\" class=\\\"' + (#{var_name(:params)}[:hidden_columns].include?(:#{column.name}) ? 'unchecked' : 'checked') + '\\\"><a><i></i>' + h(#{column.header_code}) + '</a></li>\"\n end\n menu << '</ul></li>'\n\n # Separator\n menu << '<li class=\"separator\"></li>'\n # Exports\n ActiveList.exporters.each do |format, _exporter|\n menu << \"<li class=\\\"export export-#{format}\\\">' + link_to(content_tag(:i) + h('list.export_as'.t(exported: :#{format}.t(scope: 'list.export.formats'))), __params.merge(action: :#{generator.controller_method_name}, sort: #{var_name(:params)}[:sort], dir: #{var_name(:params)}[:dir], format: '#{format}')) + '</li>\"\n end\n menu << '</ul></span>'\n menu\n end", "def menu\n \nend", "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend", "def main_menu_link; MAIN_MENU_LINK; end", "def menu\n \n \n\nend" ]
[ "0.7533588", "0.7339405", "0.72757214", "0.72261703", "0.7217888", "0.7196568", "0.7135591", "0.7123347", "0.7101928", "0.7101928", "0.70330614", "0.70162296", "0.6995714", "0.69668365", "0.6911753", "0.68937", "0.68584585", "0.68399435", "0.6831014", "0.678548", "0.6774596", "0.67718434", "0.67483336", "0.6729844", "0.6723134", "0.6709913", "0.66808295", "0.66377914", "0.662047", "0.6613902", "0.6599694", "0.65941083", "0.65930104", "0.6588859", "0.6587056", "0.65814555", "0.65781736", "0.65773505", "0.6546331", "0.6543417", "0.65304387", "0.6516519", "0.64860624", "0.64758825", "0.64729315", "0.6444133", "0.6423514", "0.6423514", "0.6418395", "0.6410814", "0.6409408", "0.6403768", "0.6395161", "0.637947", "0.6377407", "0.6376068", "0.6375995", "0.63739485", "0.63393277", "0.6339216", "0.633322", "0.6317557", "0.63094455", "0.62943846", "0.62939745", "0.6291592", "0.6274704", "0.626768", "0.62625015", "0.6254768", "0.62411624", "0.6228795", "0.6228795", "0.62287444", "0.6227219", "0.62264735", "0.62169635", "0.62148327", "0.6211406", "0.62087476", "0.6207217", "0.62062836", "0.61865973", "0.61856663", "0.61760753", "0.6173036", "0.617153", "0.61710185", "0.61696416", "0.6167866", "0.6157518", "0.61484087", "0.61482406", "0.6145837", "0.6144075", "0.6130852", "0.61175615", "0.6115152", "0.6114965", "0.611448" ]
0.6971963
13
method to process the provided input
def determine_action(input) case (input.to_i) when 1 then TimeMenu::WeektimeMenu.new.print_menu when 2 then TimeMenu::MonthtimeMenu.new.print_menu when 3 then TimeMenu::CustomtimeMenu.new.print_menu when 4 then return false else handle_wrong_option end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(input)\n process(input)\n end", "def preprocess_input(input)\nend", "def call(input)\r\n process(*input)\r\n end", "def preprocess(input); end", "def preprocess_input(input)\n input\nend", "def process(input)\n\t\tr = processString(input) if input.is_a?(String)\n\t\tr = processArray(input) if input.is_a?(Array)\n\t\tr[:type] = 'error' if !r.has_key?(:result) || r[:result].nil?\n\t\tr.delete(:result) if r[:type] == 'error'\n\n\t\treturn r\n\tend", "def process_input\n if @process == 'directory'\n process_directory\n elsif @process == 'file'\n process_compiled_file\n elsif @process == 'zip'\n process_zip_file\n elsif @process == 'zip-stream'\n process_zip_stream\n end\n end", "def input_handler(input)\n processed = case \n when input.class == Hash\n [ input ]\n when input.class == Array\n input\n else\n raise ArgumentError, \"Unrecognized input class: #{input.class}\"\n end\n end", "def input; end", "def input; end", "def input; end", "def processed_input!\n unknown_handling :process\n not_researched_handling :process\n self\n end", "def process_input\n if state.current_input == :star\n input_star\n elsif state.current_input == :target\n input_target\n elsif state.current_input == :remove_wall\n input_remove_wall\n elsif state.current_input == :add_wall\n input_add_wall\n end\n end", "def process_input\n if state.user_input == :star\n input_star\n elsif state.user_input == :star2\n input_star2\n elsif state.user_input == :target\n input_target\n elsif state.user_input == :target2\n input_target2\n elsif state.user_input == :remove_wall\n input_remove_wall\n elsif state.user_input == :remove_wall2\n input_remove_wall2\n elsif state.user_input == :add_hill\n input_add_hill\n elsif state.user_input == :add_hill2\n input_add_hill2\n elsif state.user_input == :add_wall\n input_add_wall\n elsif state.user_input == :add_wall2\n input_add_wall2\n end\n end", "def input; @input; end", "def input; @input; end", "def input_handler\n STDIN.read.split(\"\\n\").each do |line|\n process_line(line)\n end\n end", "def process(input)\n\n str = convert(input)\n # Sanitize strings.\n str = sanitize(str)\n # Mark the beginning of the text.\n if not @inside_input\n str = \"#{BEGIN_MARKER}\\n#{str}\\n\"\n @inside_input = true\n else\n str = str + \"\\n\"\n end\n @mutex.synchronize { @enqueued_tokens += 1 }\n @pipe.print(str)\n end", "def process_input(input_lines)\n input_lines.first.chomp.to_i\nend", "def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end", "def parse_input(params, resource); end", "def parse_input (input_file)\nend", "def input_process (*args)\n if(args.size == 1)\n input = args[0]\n operation = input.initial\n elsif(args.size == 2)\n input = args[1]\n operation = input[0]\n else\n return\n end\n \n total = get_numbers(input, operation)\n\n if operation == \"+\"\n $totalvalue += addition(*total)\n elsif operation == \"-\"\n $totalvalue += subtraction(*total)\n elsif operation == \"*\"\n $totalvalue = multiplication($totalvalue, *total)\n elsif operation == \"/\"\n $totalvalue = division($totalvalue, *total)\n end\n total.clear\nend", "def process(input = nil)\n if input.nil?\n input = STDIN\n end\n\n input.each_line do |line|\n detect_filename_in line\n parse line if @filename\n end\n\n if input.is_a? IO\n puts result_as(Suspiciouss::Result::PlainText)\n else\n result_as(Suspiciouss::Result::Markdown)\n end\n end", "def read_input; end", "def dispatch(input)\n continue = true\n commands = input.split(\" \")\n case commands[0].downcase\n when \"store\"\n continue = process_store(commands[1..-1])\n when \"factory\"\n continue = process_factory(commands[1..-1])\n when \"quit\"\n continue = process_quit\n when \"resources\"\n continue = process_resources\n when \"project\"\n continue = process_projects(commands[1..-1])\n when \"produce\"\n continue = process_production(commands[1..-1])\n when \"pick\"\n continue = process_pick(commands[1..-1])\n when \"next\"\n continue = process_next\n when \"save\"\n continue = process_save\n when \"scheduling\"\n continue = process_scheduling\n else\n puts \"unknown command: #{input}\"\n end\n return continue\n end", "def process(input)\n add_input(input)\n flush_context_stack\n end", "def run input, params = {}\n @klass.new(input, options).process\n end", "def read_input\n end", "def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend", "def parse_input(input_file); end", "def parse_input(input_file); end", "def process_input()\n\n if (@input_type == 'STRING')\n\n if (@inp[@start, @increment] == 'PLACE')\n return [true, @increment, 0, 0]\n else\n return [false, @increment, 0, 0]\n end\n\n elsif (@input_type == 'INTEGER')\n\n if ((@inp[@start, @increment].to_i).to_s == @inp[@start, @increment])\n return [true, @increment, @inp[@start, @increment].to_i, 0]\n else\n return [false, @increment, @inp[@start, @increment].to_i, 0]\n end\n\n elsif (@input_type === 'ORIENTATION')\n\n orientation_array = ['N', 'E', 'S', 'W']\n orientation_num = nil\n h = 0\n while (h < 4) && (orientation_num == nil)\n if orientation_array[h] == @inp[@start, @increment]\n orientation_num = h\n end\n h = h + 1\n end\n if @increment == 1\n if orientation_num != nil\n return [true, @increment, orientation_num, 0]\n end\n end\n return [false, 0, 0, 0]\n end\n\n return nil\n end", "def process_input\n\n while movement = connection.gets.chomp\n begin\n parse movement\n end\n end\n end", "def handle_input(input)\n result = eval(input)\n puts(\" => #{result}\")\nend", "def handle_input(input)\n result = eval(input)\n puts(\" => #{result}\")\nend", "def process(data)\n end", "def input(input)\n cleaned_input = sanatise_input input\n\n if valid_input? cleaned_input\n process_input cleaned_input\n else\n # Return error message\n return AppConfig.msg_place_args\n end\n end", "def input=(_arg0); end", "def process(data)\n end", "def process_input(input) \n @input = input\n if @input.include?(\"sec\")\n @section = @input.gsub(\"sec \",\"\")\n @section = @section.split('.')\n @chapter = @section.first.to_i\n @subsection = @section.last.to_i\n puts \"Finding section #{@chapter}.#{@subsection}...\"\n elsif\n @input =~ /^[0-9]+$/\n @page = @input.to_i\n puts \"Finding page #{@page}...\"\n else puts \"Not a page or section.\" \n end \n end", "def process_input(input)\n case input\n when 1 then return process_legend_input(\n get_entry(\"Input value (0: false, 1:true) : \").to_i)\n when 2 then return process_ydim_input(get_entry(\"Input value: \").to_i)\n when 3 then return process_scale_input(\n get_entry(\"Input value (0: false, 1:true) : \").to_i)\n when 4 then return save_to_file(get_entry(\"Save destination: \"))\n when 5 then return false\n else\n puts \" Error: Input #{input} is not valid.\".red\n return true\n end\n end", "def handle_input(input)\n return \"Invalid input\" unless self.respond_to? input\n self.send input\n end", "def parse_input \n \t\tformat_input\n\n \t\tp \"Input is #{@input_params}\"\n #begin\n\t\t\t# check if the input refers to an explicit datetime like today etc\n\t\t\tif explicit_date? @input_params\n\t\t\t\tinterpret_explicit_date @input_params\n\t\t\t# check if the input refers to relative input like next friday or next month etc\n\t\t\telsif relative_date? @input_params\n\t\t\t\tinterpret_relative_date @input_params\n\t\t\t# check if the input refers to a past of future date and interpret it\n\t\t\telsif date = past_or_future_date(@input_params)\n\t\t\t\tdate\n\t\t\t# Try Ruby Date Parser \n\t\t\telse\n\t\t\t\tDateTime.parse(@input_params)\n\t\t\tend\n \t\t#rescue\n\t\t#\tp \"Sorry!! Something went wrong. Pls. check and try again\"\t\n #end\n \tend", "def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end", "def process_input(input)\n command = match_command(input)\n begin\n return command ? execute_command(command, input) : unknown_command_message\n rescue ArgumentError => error\n error.to_s\n end\n end", "def handle(input)\n search(input)\n end", "def parse_input(input)\n\tinput.split(\" \")\nend", "def get_input;\t@input \t\tend", "def match(input); end", "def input_string; end", "def parse(input = nil, options = 0)\n end", "def process_input(raw_input)\n @engine.inject_command(normalized_input(raw_input), self)\n @engine.execute_pending_commands\n end", "def source=(input); end", "def process_input(file)\n if file == '-'\n read_stdin\n else\n call_write(\n process_input_file(load_data(Pathname.new(file)).split(\"\\n\"))\n )\n end\n end", "def process_input(input)\n args = input.split(' ')\n command = args.shift\n return false if command.nil?\n results = self.class.search(command, ConsoleProgram.scopes.active)\n if results.length == 1\n results.first.new(args)\n else\n multiple_commands = []\n results.each do |klass|\n multiple_commands << klass unless klass.has_alternate_commands? && klass.alternate_commands.include?(command)\n end\n result = (multiple_commands.length == 1 ? multiple_commands.first : nil)\n tell_user 'Multiple commands found, which do you mean?' if result.nil?\n while result.nil?\n output_string = []\n results.each_with_index{|r, i| output_string << \"#{i + 1}: #{r.to_s.split('::')[1..-1].join('->')}\" }\n get output_string.join(results.length > 5 ? \"\\n\" : ', ')\n result = results[input.to_i - 1]\n tell_user 'Unrecognized input' if result.nil?\n end\n result.new(*args)\n end\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 preprocess(input)\n\t\tperform_substitutions(input)\n\tend", "def parse_input(input)\n input.split(\"\\n\").map{|name| parse_name(name) }\nend", "def process(input)\n if input == \"q\"\n puts \"Goodbye\"\n elsif input == \"tweet\"\n puts \"tweeting\"\n elsif input == \"dm\"\n puts \"direct messaging\"\n elsif input == \"help\"\n puts \"helping\"\n end\nend", "def source\n visit(input)\n end", "def process(*)\n end", "def process_input(input_lines)\n input_lines.map { |instr| instr.chomp.gsub('inc', '+').gsub('dec', '-') }\nend", "def match(input)\n input \n end", "def call_input_data\n if creates && input\n input[/a165627a7a72305820\\w{64}0029(\\w*)/,1]\n elsif input && input.length>10\n input[10..input.length]\n else\n []\n end\n end", "def call_input_data\n if creates && input\n input[/a165627a7a72305820\\w{64}0029(\\w*)/,1]\n elsif input && input.length>10\n input[10..input.length]\n else\n []\n end\n end", "def read_input_line line_in, line_number\n\t\tinput_params = line_in.split(\" \")\n\t\tunless input_params.empty? \n\t\t\tbegin\t \n\t\t\t\tcase input_params[0]\n\t\t\t\twhen \"Driver\"\n\t\t\t\t\tself.handle_driver_command input_params\t\t\n\t\t\t\twhen \"Trip\"\n\t\t\t\t\tself.handle_trip_command input_params\t\t\n\t\t\t\telse\n\t\t\t\t\tputs \"#{input_params[0]} id not a supported command\"\n\t\t\t\tend\n\t\t\trescue => err\n\t\t\t puts \"line #{line_number} not parsed, Incorrect input format #{line_in} - #{err}\"\n\t\t\t err\n\t\t\tend\t\t\t\n\t\tend\n\tend", "def parse_input(input)\n begin\n\n parsed = input.scan(/\\A([fr])\\((\\d),(\\d)\\)\\z/)\n if parsed.empty? && input.downcase != \"save\"\n raise \"Invalid input\"\n end\n \n rescue\n puts \"Sorry, invalid format. Please try again with format: \\'r(2,3)\\'\"\n retry\n end\n \n parsed.flatten\n \n end", "def process_input(question)\n @input = read_input(question)\n if Utils.blank?(@input)\n @input = default ? positive : negative\n end\n @evaluator.call(@input)\n end", "def process_next_input\n next_input = @input.read_next_input\n\n if next_input == :exit_command\n return :exit_command\n end\n\n validation = @validator.validate(next_input)\n unless validation.response == :valid_input\n @output.output_error(validation.response)\n return\n end\n\n if input_complete?(next_input)\n process_new_answer(InputParser.new(next_input).input)\n else\n if @last_answer\n input = InputParser.new(next_input).input\n process_new_answer(ParsedInput.new(input.numbers.push(@last_answer), input.operator))\n else\n @output.output_error(\"#{next_input} is not a complete calculation!\")\n end\n end\n end", "def processInput(tweet, input)\n if input == 'done' then return false end\n if input == 'skip' then return true end\n grade = input.to_i\n if grade < 1 || grade > 10\n puts \"You must enter a number between 1 and 10. Moving to next tweet.\"\n return true\n else\n File.open(@@training_data_filename, 'a') do |file|\n file.write(@@format_before_tweet + tweet + @@format_before_rating + grade + @@format_after_rating)\n end\n end\n\n end", "def process(*)\n end", "def process(*)\n end", "def process_user_input(user_input)\n continue_program = true\n\n case user_input\n when 'h'\n Classifieds::CLI.display_help\n when 'i'\n select_item_type\n when 'p'\n tmp_page_size = Classifieds::CLI.prompt('Enter new page size: ').to_i\n @page_size = tmp_page_size if 0 < tmp_page_size\n when 'q'\n continue_program = false\n# when 's'\n# # list sellers instead of items\n when ''\n # display next summary rows\n else\n if (item_number = user_input.to_i).between?(1, Classifieds::Listing.all.size)\n Classifieds::Listing.all[item_number-1].print_detail(item_number)\n else\n STDERR.puts Classifieds::CLI.red('Invalid selection')\n end\n Classifieds::CLI.prompt 'Press Enter to continue...'\n end\n continue_program\n end", "def run_cmd(input); end", "def handle_input(input)\n raise ArgumentError unless input.instance_of?(String)\n begin\n output = \"\"\n case input.strip\n when PuppetDebugger::InputResponders::Commands.command_list_regex\n args = input.split(\" \")\n command = args.shift\n plugin = PuppetDebugger::InputResponders::Commands.plugin_from_command(command)\n output = plugin.execute(args, self)\n return out_buffer.puts output\n when \"_\"\n output = \" => #{@last_item}\"\n else\n result = puppet_eval(input)\n @last_item = result\n output = normalize_output(result)\n output = output.nil? ? \"\" : output.ai\n end\n rescue PuppetDebugger::Exception::InvalidCommand => e\n output = e.message.fatal\n rescue LoadError => e\n output = e.message.fatal\n rescue Errno::ETIMEDOUT => e\n output = e.message.fatal\n rescue ArgumentError => e\n output = e.message.fatal\n rescue Puppet::ResourceError => e\n output = e.message.fatal\n rescue Puppet::Error => e\n output = e.message.fatal\n rescue Puppet::ParseErrorWithIssue => e\n output = e.message.fatal\n rescue PuppetDebugger::Exception::FatalError => e\n output = e.message.fatal\n out_buffer.puts output\n exit 1 # this can sometimes causes tests to fail\n rescue PuppetDebugger::Exception::Error => e\n output = e.message.fatal\n rescue ::RuntimeError => e\n output = e.message.fatal\n out_buffer.puts output\n exit 1\n end\n unless output.empty?\n out_buffer.print \" => \"\n out_buffer.puts output unless output.empty?\n exec_hook :after_output, out_buffer, self, self\n end\n end", "def preprocess(input)\n perform_substitutions(input)\n end", "def process(input,parse_aliases=true)\n return @session.process(input,parse_aliases)\n end", "def parse input\n ## split input into lines, remove comments and evaluate any variables\n\n lines = input.split(\"\\n\").delete_if { |l| \n l == \"\" || l =~ /^;;/ }.map{ |l| evaluate_line l }\n\n scan lines\n end", "def input_validation(input)\n case input\n when Array\n puts \"It's an Array\"\n puts array_to_binary_array(input)\n when String\n puts \"A string\"\n string_to_binary_array(input)\n when Fixnum\n puts \"Integer\"\n fixnum_to_binary_array(input)\n else puts \"God knows!\"\n end\nend", "def process_stdin\n process_file_handle($stdin)\n end", "def parse_input(input)\n input = input.strip\n case input\n when ReservedWords::TRUE\n Memory::Value.bool true\n when ReservedWords::FALSE\n Memory::Value.bool false\n when /^(-?)[0-9]+\\.[0-9]+$/\n Memory::Value.float input.to_f\n when /^(-?)[0-9]+$/\n Memory::Value.int input.to_i\n when /^\\[.*\\,.*\\]$/\n array = input.tr('[', '').tr(']', '').split(',')\n array = array.map { |s| parse_input(s) }\n Memory::Value.array array\n else\n Memory::Value.string input\n end\n end", "def process(raw_input)\n clean_input, verbosity = sanitize_input raw_input\n\n if clean_input.length > 0\n command = find_command(clean_input) || @modes.current_mode.dynamic_command(clean_input) || @modes.global_mode.command_not_found\n user_args = extract_user_args command, clean_input\n command_ctx = build_context(command, user_args, verbosity)\n args = resolve_args(command, command_ctx)\n\n command.method.call(*args)\n end\n end", "def text_input; end", "def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end", "def input?; @input; end", "def process(input,parse_aliases=false)\n ret = super(input,parse_aliases)\n self.update_status\n return ret\n end", "def get_input\n #Get input from the user\nend", "def get_input\n @input = gets.strip\n end", "def read_and_process\n process(read)\n end", "def process_input(input_lines)\n input_lines.map(&:chomp).map { |line| line.split('<->').map(&:strip) }\n .map { |k, v| [k, v.split(', ')] }.to_h\nend", "def process(parser)\n end", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def handle(data)\n\t\t\t\tprocess_line(data)\n\t\t\tend", "def input\n STDIN.read.split(\"\\n\")\nend", "def read_stdin()\n # Purpose: import data out of STDIN\n # Input : none\n # Output : Array of inbound scores, array ouf outbound scores\n # Remarks: Empty values are mapped to nil, non-integer values are mapped to 0\n \n vprint \"Starting to read STDIN\"\n\n def map_data(data,nils,stats)\n if data == \"-\" or data == \"\"\n nils = nils + 1\n else\n stats << data.to_i\n end\n return nils, stats\n end\n\n stats_in = Array.new()\n stats_out = Array.new()\n nils_in = 0 \n nils_out = 0 \n \n n = 0\n formatcheck_ok = false\n\n STDIN.each do |line| # we checked for STDIN in check parameter phase\n n = n + 1\n dprint \"Processing line ##{n}: #{line.chomp}\"\n begin\n in_data, out_data = line.chomp.split(\";\")\n unless formatcheck_ok\n if in_data != in_data.to_i.to_s\n \t puts_error(\"Input's first line indicates, input is not in CSV format as\")\n\t puts_error(\"explained by help text. This is fatal. Aborting.\")\n\t exit 1\n else\n formatcheck_ok = true\n end\n end\n nils_in, stats_in = map_data(in_data, nils_in, stats_in)\n nils_out, stats_out = map_data(out_data, nils_out, stats_out)\n rescue => detail\n puts_error(\"Could not read line ##{n}: \\\"#{line.chomp}\\\". Ignoring.\")\n end\n\n end\n\n 1.upto($params[:baseline]) do\n\t stats_in << 0\n\t stats_out << 0\n end\n\n vprint \"Done reading STDIN (imported #{n} lines of data)\"\n\n return nils_in, stats_in, nils_out, stats_out\n\nend", "def get_input input\n\n case input\n\n # avancar\n when 'a'\n case menu\n when 'do_inicio',\n 'continuar' then line_forth\n when 'escrevendo' then next_char\n when 'ler' then @filelist.rotate!\n else next_option\n end\n\n # voltar\n when 'v'\n case menu\n when 'do_inicio',\n 'continuar' then line_back\n when 'escrevendo' then last_char\n when 'ler' then @filelist.rotate! -1\n else last_option\n end\n\n # fim\n when 'f'\n case menu\n when 'escrevendo' then end_of_text\n end\n\n # enter\n when 'e'\n case menu\n\n when 'ler'\n @filename = @filelist.first[:file]\n seleciona_ler_modo\n\n when 'principal',\n 'ler_modo'\n self.send \"seleciona_#{@options.first.gsub(\" \",\"_\")}\"\n\n when 'escrever'\n @writer = Writer.new('nota')\n @options = ['nota']\n seleciona_escrevendo\n\n when 'escrevendo' then end_of_line\n\n when 'salvar' then save_action\n\n end\n\n # backspace\n when 'b'\n case menu\n when 'escrevendo' then delete_char\n end\n\n # esc\n when 's'\n case menu\n when 'ler','escrever' then seleciona_principal\n when 'ler_modo',\n 'do_inicio',\n 'continuar' then seleciona_ler\n when 'escrevendo'\n save_options\n seleciona_salvar\n end\n\n # inputs de dados\n else\n case menu\n when 'escrevendo' then insert_char(input)\n end\n end\n\n end", "def inspect(input); end", "def process_input_file\n\t\t\tinput_file = File.open(@params[:input_file], 'r')\n\t\t\tfile_terms = convert_contents_to_search_string(input_file.read)\n\t\t\tadd_terms(file_terms)\n\t\tend", "def format_input\n\t\t# removing white spaces at the beginning and the end\n\t\t@input_params = @input_params.downcase.strip()\n \tend", "def get_input\n @input = gets.chomp\n end" ]
[ "0.755243", "0.75354415", "0.7515326", "0.7389755", "0.72351545", "0.7180728", "0.7153225", "0.70450014", "0.7027385", "0.7027385", "0.7027385", "0.6989074", "0.6931572", "0.6921981", "0.68323624", "0.68323624", "0.6760511", "0.6726066", "0.66878957", "0.6669344", "0.66663736", "0.6664951", "0.66634387", "0.66267043", "0.6617294", "0.66148746", "0.6600012", "0.6547038", "0.65153193", "0.65140367", "0.6511618", "0.6511618", "0.6509909", "0.65055937", "0.65039575", "0.65039575", "0.64796704", "0.64424187", "0.64259946", "0.6417692", "0.6401238", "0.6396858", "0.63938725", "0.63777906", "0.63288486", "0.63206977", "0.6320435", "0.63188416", "0.63019186", "0.62818867", "0.6276463", "0.6270397", "0.6268902", "0.62470573", "0.6237894", "0.6208198", "0.62075067", "0.6180889", "0.6177476", "0.6153252", "0.6126353", "0.610277", "0.6086251", "0.6065294", "0.60643965", "0.60643965", "0.6057963", "0.60558206", "0.6026104", "0.6024861", "0.6016065", "0.600033", "0.600033", "0.5998038", "0.59958285", "0.59914374", "0.59914094", "0.5987581", "0.59625447", "0.5960128", "0.5959874", "0.59324014", "0.59304214", "0.59251416", "0.59099793", "0.5895819", "0.5891082", "0.5883344", "0.58796895", "0.5871632", "0.58562213", "0.5851255", "0.58483016", "0.5842243", "0.583519", "0.5829307", "0.58186436", "0.5809484", "0.58079195", "0.579696", "0.579242" ]
0.0
-1
List all cookbooks user has access to.
def index @page_title = "Welcome, #{current_user.first_name}! Let's Get Cooking..." @info_panel_title = "Membership info" @user = current_user @cookbooks = @user.owned_cookbooks @contributed_cookbooks = @user.contributed_cookbooks @completed_orders = @user.completed_orders end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cookbooks = Cookbook.all\n end", "def index\n @cook_books = CookBook.all\n end", "def index\n @books = current_user.books.all\n end", "def index\n @cooks = Cook.includes(:user)\n end", "def index\n @cookbooks = CookbooksDecorator.decorate_collection(Cookbook.all)\n end", "def index\n @realistic_fiction_books = current_user.realistic_fiction_books\n end", "def index\n @mystery_books = current_user.mystery_books\n end", "def index\n @science_fiction_books = current_user.science_fiction_books\n end", "def index\n @books = current_user.books\n end", "def index\n @books = Book.of_user current_user\n end", "def index\n if view_context.is_admin?\n @books = Book.all\n elsif user_signed_in?\n @books = Book.where(\"is_approved = ? or user_id = ?\", true, current_user.id)\n else\n @books = Book.where(\"is_approved = ?\", true)\n end\n end", "def index\n if current_user.has_role? :admin\n @booklists = Booklist.all\n else\n @booklists = Booklist.where(user_id: current_user.id).order(:serial)\n end\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def index\n @poetry_anthology_books = current_user.poetry_anthology_books\n end", "def index\n \t@users = User.accessible_by(current_ability)\n \tauthorize! :read, User\n end", "def index\n @bocs = Boc.all_user(current_user.registry_id)\n end", "def index\n @users = User.find_all_with_authorization(current_user)\n end", "def index\n # The notebooks of the current user\n @notebooks = current_user.notebooks\n end", "def index\n @users = User.select{ |_| can? :read, _ }\n end", "def index\n # @categories = current_user.categories\n @categories = Category.accessible_by(current_ability).all\n end", "def index\n @catalogs = current_user.catalogs.all\n end", "def list\n @categories = current_user.categories.where locked: false\n end", "def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend", "def index\n @biography_books = current_user.biography_books\n end", "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def index\n @user_has_viewing_privileges = UserHasViewingPrivilege.all\n end", "def index\n @recipes = Recipe.where(user_id: current_user.id)\n end", "def index\n if current_user\n @books = current_user.books\n render json: @books, status: 201\n end\n end", "def index\n @book_users = BookUser.set_current_user_records(current_user)\n end", "def index\n @bookmarks = Bookmark.where(owner: current_user)\n end", "def index\n \n @user = current_user\n @search = current_user.books.search(params[:q])\n @books = @search.result\n end", "def index\n books = current_user.books.all\n render json: { books: books }\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def index\n\t\trespond_with current_user.bookmarks\n\tend", "def index\n @unaffirmedbooks = Unaffirmedbook.all\n end", "def index\n # byebug\n if current_user\n recipes = Recipe.all \n render json: recipes\n else \n render json: { errors: [\"Not Authorized\"] }, status: :unauthorized\n end\n end", "def index\n @bookmarks = Bookmark.user_bookmarks(current_user)\n end", "def index\n @authorizedusers = Authorizeduser.all\n end", "def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end", "def index\n @traditional_literature_books = current_user.traditional_literature_books\n end", "def index\n @cabals=[]\n if !current_user.cabals.nil?\n @cabals=current_user.cabals\n end\n end", "def index\n @total = Cookbook.count\n @cookbooks = Cookbook.order('name ASC').limit(@items).offset(@start)\n end", "def index\n @lcb_access_items = LcbAccessItem.all\n end", "def index\n @users = User.all\n authorize @users\n end", "def index\n @cursos = current_user.cursos.all\n end", "def index\n if can?(:read, User)\n @users = User.accessible_by(current_ability, :index)\n else\n @users = []\n end\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n format.html\n end\n end", "def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end", "def index \n @cooks = Cook.all\n\n end", "def index\n @appmen = @current_user.appmen.all\n end", "def index\n @current_user = current_user\n @books = []\n if !@current_user.student?\n @books = Book.all\n end\n end", "def index\n\t\t@users = User.paginate(:page => params[:page], :per_page => 5)\n\t\tauthorize @users\n\tend", "def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end", "def index\n @cookbooks = Cookbook.includes(:cookbook_versions).order(:deprecated)\n\n @current_params = cookbook_index_params\n\n if @current_params[:q].present?\n @cookbooks = @cookbooks.search(@current_params[:q]).with_pg_search_rank\n end\n\n if @current_params[:featured].present?\n @cookbooks = @cookbooks.featured\n end\n\n if @current_params[:deprecated].blank?\n @cookbooks = @cookbooks.not_deprecated\n end\n\n if @current_params[:order].present?\n @cookbooks = @cookbooks.ordered_by(@current_params[:order])\n end\n\n if @current_params[:order].blank? && @current_params[:q].blank?\n @cookbooks = @cookbooks.order(:name)\n end\n\n apply_filters @current_params\n\n @number_of_cookbooks = @cookbooks.count(:all)\n @cookbooks = @cookbooks.page(cookbook_index_params[:page]).per(20)\n\n respond_to do |format|\n format.html\n format.atom\n end\n end", "def index\n @lists = current.user.list\n end", "def index\n @award_winner_books = current_user.award_winner_books\n end", "def index\n @customer = Customer.all\n authorize! :list, @customer\n end", "def index\n current_user = Borrow.where(user_id: session[:user_id]).distinct.pluck(:user_id)\n @borrows = Borrow.joins(:indentify, :book).where(user_id: current_user,mode:0).select(\"indentifies.*,borrows.*,books.*,borrows.mode\",).paginate(:per_page => 2, :page => params[:page])\n end", "def index\n @recipe_users = RecipeUser.all\n end", "def my_books\n @books = current_user.books\n end", "def index\n @users = policy_scope(User)\n end", "def index\n @administracao_cargos = Administracao::Cargo.accessible_by(current_ability)\n end", "def index\n unless age_group\n @books = Book.all\n @user = current_user\n end\n end", "def show_recipes_in_my_kitchen\n list_recipes(@user.recipes.order(:title) ) # just list all recipes associated to the users kitchen\n end", "def index\n @bookings = current_user.bookings\n end", "def listings\n authorize! :read, @user\n end", "def index\n @authoriziedstaffs = Authorizedstaff.all\n end", "def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end", "def cookbooks\n get_directories_absolute_paths cookbooks_path\n end", "def index\n recipes = current_user.recipes\n render json: { recipes: recipes}.to_json, status: :ok\n end", "def index\n @userbarries = Userbarry.all\n end", "def index\n #redirect_if_not_logged_in\n @books = Book.all\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\n \t@stocks = Stock.all\n \t#@stock = current_user.stocks\n end", "def index\n @borrowtables = Borrowtable.all\n if current_user.student?\n @my_borrowtables = current_user.student.borrowtables\n end\n end", "def index\n @collections = current_user.collections.ordered\n end", "def index\n # We'll need to page this later!\n @purchases = current_user.purchases.all\n end", "def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end", "def index\n #authorize(User.new)\n @users = User.all #policy_scope(User)\n end", "def index\n @categories = current_user.categories\n end", "def index\n user = find_user\n\n expose user.favorite_tags\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def index\n @inventories = current_user.inventories\n end", "def index\n @collections = current_user.collections\n end", "def index\n if current_user.has_role?(:superadmin) \n @bookings=Booking.all\n \n else\n @bookings=Booking.where(user_id: current_user.id)\n \n end\n\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def index\n if (!current_user.admin?)\n @user= current_user\n @bookings = @user.bookings.all\n else\n @bookings = Booking.all\n end\n end", "def index\n # to get list of stocks associated with the current user only\n @stocks = Stock.where(\"user_id = ?\" , current_user.id)\n end", "def index\n @liberry_users = LiberryUser.all\n end", "def index\n @becarios = Becario.all\n # authorize @becarios\n end", "def index\n @books = Book.get_avaible_books\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def index\n @purchases = current_user.purchases.all\n end", "def index\n @authorizations = Authorization.all\n end", "def index\n @authorizations = Authorization.all\n end", "def get_user_collections()\n uri = build_uri('info/collections')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end", "def index\n if current_user.admin?\n @itineraries = Itinerary.all\n else\n @itineraries = current_user.itineraries.where(user_id: current_user)\n end\n end", "def index\n #currenbt user all libearies\n @libraries = current_user.libraries.all\n end", "def index\n @cbooks = Cbook.all\n end", "def index\n @users = User.all\n authorize User\n end" ]
[ "0.6798504", "0.66155815", "0.65833116", "0.6545027", "0.65061873", "0.6465697", "0.6434549", "0.6430269", "0.6372158", "0.62748116", "0.62626386", "0.620772", "0.6165968", "0.6126005", "0.61235654", "0.61105585", "0.607098", "0.60628957", "0.6047489", "0.6027409", "0.60084593", "0.5954209", "0.5904695", "0.5880716", "0.58685356", "0.586586", "0.5829487", "0.5826861", "0.58060175", "0.57926565", "0.5789559", "0.5754749", "0.57509005", "0.5733174", "0.5723352", "0.572299", "0.5721692", "0.571105", "0.57070106", "0.5703081", "0.57017565", "0.5699977", "0.56931543", "0.5686378", "0.56862223", "0.56844664", "0.5680912", "0.5671916", "0.5663522", "0.56507534", "0.56464666", "0.5633242", "0.5629777", "0.5618497", "0.5617185", "0.56035304", "0.5603433", "0.56005704", "0.559758", "0.55853516", "0.55853367", "0.55851465", "0.5580398", "0.5565236", "0.55620897", "0.55617565", "0.5559723", "0.55564463", "0.55519867", "0.5548737", "0.5534063", "0.5529048", "0.5525277", "0.5520683", "0.55151784", "0.55104274", "0.55090785", "0.5507598", "0.5503952", "0.54984516", "0.5490443", "0.5490443", "0.5490443", "0.54869586", "0.5481924", "0.5481321", "0.5470957", "0.5452821", "0.54496175", "0.54492116", "0.5430164", "0.5429513", "0.5428951", "0.54259044", "0.5422982", "0.5422982", "0.5418059", "0.5417911", "0.5416322", "0.54160464", "0.5415404" ]
0.0
-1
Select a cookbook to work on. Alert the user if the cookbook owner account has expired.
def select @cookbook = Cookbook.find params[:id] user_is_owner = current_user.owns_cookbook(@cookbook) user_is_contributor = current_user.contributes_to(@cookbook) # Verify the user is authorized to work on this cookbook. if @cookbook && (user_is_owner || user_is_contributor) # User must have a paid account to work on its cookbooks # (Contributor wasn't allowed to create cookbooks but due to a bug some contributors may have cookbooks to works on) if has_contributor_plan? && user_is_owner redirect_to upgrade_account_path(current_user.id), alert: "You must have a paid membership to work on your own cookbooks" return end load_user_cookbook @cookbook # Alert the user it will not be able to work on this cookbook if its owner has expired. if current_cookbook.owner.expired? if user_is_owner flash[:alert] = "Because your membership has expired you can no longer work on your cookbooks." elsif user_is_contributor flash[:alert] = "The owner of this cookbook's membership has expired. They will have to extend it for you to gain access to this cookbook." end end redirect_to templates_path else redirect_to cookbooks_path, alert: "Unable to select cookbook. Either it doesn't exist or you have no permission accessing it." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookbook_selected?\n if !current_cookbook\n redirect_to cookbooks_path, alert: \"You must have selected a Cookbook project to work on first.\"\n end\n end", "def account_expired?\n if current_user.expired? && current_user.owns_cookbook(current_cookbook)\n redirect_to upgrade_account_path(current_user)\n end\n end", "def adoption\n AdoptionMailer.delay.interest_email(@cookbook.id, @cookbook.class.name, current_user.id)\n redirect_to(\n cookbook_path(@cookbook),\n notice: t(\n \"adoption.email_sent\",\n cookbook_or_tool: @cookbook.name\n )\n )\n end", "def new\n cookbook_id = current_user.create_cookbook\n if cookbook_id\n @cookbook = Cookbook.find cookbook_id\n load_user_cookbook @cookbook\n redirect_to templates_path, notice: \"A new cookbook was created for you.\"\n else\n redirect_to upgrade_account_path(current_user.id), alert: \"You must have a paid membership to work on your own cookbooks\"\n end\n end", "def cookbook_locked_for_printing?\n if current_cookbook && current_cookbook.is_locked_for_printing?\n redirect_to cookbooks_path, alert: \"This cookbook is locked and cannot be edited until the file has been sent to the printer\"\n end\n end", "def verify_cookbook_creation\n fail 'You need to specify the cookbook name' if @opts[:cookbook].nil?\n end", "def target_cookbook\n return @target_cookbook unless @target_cookbook.nil?\n\n begin\n @target_cookbook = if version_constraint\n conn.cookbook.satisfy(name, version_constraint)\n else\n conn.cookbook.latest_version(name)\n end\n rescue Ridley::Errors::HTTPNotFound,\n Ridley::Errors::ResourceNotFound\n @target_cookbook = nil\n end\n\n if @target_cookbook.nil?\n msg = \"Cookbook '#{name}' found at #{self}\"\n msg << \" that would satisfy constraint (#{version_constraint})\" if version_constraint\n raise CookbookNotFound, msg\n end\n\n @target_cookbook\n end", "def cookbook_resolution_complete(cookbook_collection)\n end", "def accept!\n return unless accepted.nil?\n\n update(accepted: true)\n if add_owner_as_collaborator\n Collaborator.find_or_create_by!(user_id: cookbook.owner.id, resourceable: cookbook)\n end\n\n cookbook.update(user_id: recipient.id)\n end", "def cookbook(arg = nil)\n set_or_return(:cookbook,\n arg,\n kind_of: [String, NilClass],\n default: nil)\n end", "def load_user_cookbook(cookbook=nil)\n if session[:user_id]\n user = User.find session[:user_id]\n if cookbook\n if user && (user.owns_cookbook(cookbook) || user.contributes_to(cookbook))\n session[:cookbook_id] = cookbook.id\n end\n else\n if user && !user.owned_cookbooks.empty?\n session[:cookbook_id] = user.owned_cookbooks.first.id\n elsif user && !user.contributed_cookbooks.empty?\n cookbook = user.contributed_cookbooks.first\n session[:cookbook_id] = cookbook.id unless cookbook.owner.expired?\n end\n end\n end\n end", "def cook(cooking_time = DEFAULT_COOKING_TIME)\n CookingWorker.work(id, cooking_time)\n end", "def perform_fieri(cookbook)\n if Feature.active?(:fieri) && ENV[\"FIERI_URL\"].present?\n FieriNotifyWorker.perform_async(\n cookbook.latest_cookbook_version.id\n )\n end\n end", "def set_cookbook\n @cookbook = Cookbook.find(params[:id])\n end", "def unreachable_cookbook?(cookbook_name)\n !reachable_cookbooks.include?(cookbook_name)\n end", "def find_cookbook\n @cookbook = Cookbook.with_name(params[:cookbook_id]).first!\n end", "def current_cookbook\n @current_cookbook ||= Cookbook.find session[:cookbook_id] if session[:cookbook_id]\n end", "def checkout(user, book)\n if user.can_rent_books? && book.status = \"available\"\n book.status = \"checked out\"\n book.due_date = Time.now + (7*24*60*60)\n user.checkout_book(book)\n else\n puts \"Sorry, that book can't be checked out.\"\n end\n end", "def check_for_selected\n if changes[:selected] && self.selected == true\n BetaMailer.send_beta_acceptance_email(self).deliver_later\n end\n end", "def select\n self.alert = 'select'\n end", "def cookbook_owner?\n if current_cookbook && current_user.id != current_cookbook.owner.id\n redirect_to sections_path, alert: \"As a Contributor you may only access the \\\"Recipes\\\" and \\\"Preview\\\" pages for the cookbook.\"\n end\n end", "def cookbook_clean_complete\n end", "def user_is_owner?\n current_cookbook.is_owner?(current_user)\n end", "def set_cookbook\n @cookbook = Cookbook.friendly.find(params[:id])\n end", "def cookbook(name, options = {})\n @name = name\n @options = manipulate(options)\n end", "def synchronized_cookbook(cookbook_name)\n puts \" - #{cookbook_name}\"\n end", "def buyer_chosen(c_id)\n pending = true\n\n self.buyer = User.find(c_id)\n self.save\n end", "def prompt_to_buy_ticket_or_see_all_bands\n puts \"#{pastel.bright_cyan('Please make a selection:')}\"\n puts \" \"\n puts \"#{pastel.bright_cyan('buy')} - buy tickets to this concert.\"\n puts \"#{pastel.bright_cyan('1')} - see the concert list again.\"\n puts \"#{pastel.bright_cyan('2')} - see all top bands in the US.\"\n puts \"#{pastel.bright_cyan('exit')} - to quit the app.\"\n end", "def select_object_audit_category(data_set)\n obj_audit = data_set[ConditionCheck::OBJ_AUDIT_CATEGORY.name]\n obj_audit_options_locator = input_options_locator([fieldset(ConditionCheck::OBJ_AUDIT_CATEGORY.name, 0)])\n wait_for_options_and_select(obj_audit_input_locator(0),obj_audit_options_locator, obj_audit) if obj_audit\n end", "def company_cookbook(name, version = '>= 0.0.0', options = {})\n cookbook(name, version, { git: \"https://github.com/EagleGenomics-cookbooks/#{name}.git\" }.merge(options))\nend", "def adoption\n AdoptionMailer.delay.interest_email(@tool.id, @tool.class.name, current_user.id)\n\n redirect_to(\n @tool,\n notice: t(\n \"adoption.email_sent\",\n cookbook_or_tool: @tool.name\n )\n )\n end", "def synchronized_cookbook(cookbook_name)\n print '.'\n end", "def edit\n @cookbook = current_cookbook\n end", "def cookbook_file(*args, &block)\n Log.instance << \"About to cook the file: #{args[0]}\"\n @@chef_orig_cookbook_file.bind(self).call(args, &block)\n Log.instance << \"Hoora the file: #{args[0]} has been cooked\"\n end", "def set_cooking_time\n @cooking_time = CookingTime.find(params[:id])\n end", "def cookbook\n @cookbook ||= CachedCookbook.from_path(path, name: name)\n end", "def check_out_book\n\tselect = make_selection.to_i\n\tselect = verify_book_exists(select)\n\tb = Book.find(select)\n\tif b.patron_id.nil?\n\t\tputs \"\\nPlease select patron that would like to check out book\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tb.update_attributes(patron_id: select)\n\telse\n\t\tputs \"\\nThis book is already checked out\\n\"\n\tend\nend", "def guest\n @old_order = Order.find params[:id]\n if @old_order && @old_order.filename\n @cookbook = @old_order.cookbook\n @order = @cookbook.get_active_reorder(@old_order.id, current_user)\n else\n redirect_to root_url, alert: \"Sorry, this cookbook is not available for order yet.\"\n end\n end", "def creden\n \n criacao.click\n taske.click\n\n end", "def select_reservation\n end", "def get_new_client_opt_in(effective_date = nil)\n client = get_new_client_not_opt_in\n effective_date = effective_date || Date.yesterday.strftime(\"%d/%m/%Y\")\n\n ms = client.member_supplementry_histories.first\n ms.opt_in_flag = 'Y'\n ms.effective_date = effective_date\n ms.acurity_update \n sleep 1\n puts(\"#{client_number} opt in on #{effective_date}\")\n return client\n end", "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def find_cookbook_collaborator\n @cookbook_collaborator = CookbookCollaborator.with_cookbook_and_user(@cookbook, @user)\n end", "def set_cookbook\n @cookbook = CookbooksDecorator.new(Cookbook.find(params[:id]))\n end", "def load_cookbook!\n @cookbook = current_cookbook\n end", "def cookbook_clean_start\n end", "def transfer\n if @cookbook_collaborator.nil?\n not_found!\n else\n authorize!(@cookbook_collaborator)\n @cookbook_collaborator.transfer_ownership\n\n redirect_to cookbook_path(@cookbook), notice: 'Owner changed'\n end\n end", "def cancel_certificate\n @booking = Booking.where(user_id: current_user.id).first\n if @booking.certificate == true\n @booking.toggle!(:certificate)\n redirect_to account_users_path, flash: {notice: \"Successfully cancelled request!\"}\n end\n end", "def select_hobby_option(hobby)\n # Consider something like a case statement and check the selenium selected? method\n case hobby.downcase\n when 'dance'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[0].click\n when 'reading'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[1].click\n when 'cricket'\n @chrome_driver.find_elements(:name, HOBBY_STATUS)[2].click\n end\n end", "def resource_cookbook\n @new_resource.cookbook || @new_resource.cookbook_name\n end", "def choose_presenter\n @presenter = Presenter.find(params[:presenter_id])\n @booking = Booking.find(params[:booking_id])\n \n @booking.chosen_presenter = @presenter\n @booking.rate = @presenter.bids.find_by(booking: @booking).rate\n @booking.help_required = false\n @booking.save\n @booking.remove_all_bids\n\n Notification.send_message(@presenter.user, \"You've been locked in for a booking!\", booking_path(@booking), :choose_presenter)\n flash[:success] = \"#{@presenter.get_private_full_name(current_user)} has been assigned to this booking.\"\n \n redirect_to booking_path(@booking)\n end", "def package_picked_up\n self.status = CONSTANT['BOX_IDLE']\n package = self.package\n package.user.send_picked_up_notification #TODO\n package.status = CONSTANT['PACKAGE_DONE_DELIVERY']\n if package.save\n self.package = nil\n if self.save\n if self.access.clear\n return true\n end\n end\n end\n return false\n end", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def cancel_event?\n puts \"WARNING: Action can not be undone.\".colorize(:yellow)\n self.class.prompt.select(\"Are you sure you want to cancel this event?\") do |menu|\n menu.choice \"Yes\", -> {cancel_event_confirmed}\n menu.choice \"No\"\n end\n end", "def working\n current_user.chef.toggle(:currently_working).save\n end", "def cookbook_copyright(*args, &block)\n ChefConfig::Config.cookbook_copyright(*args, &block) || \"YOUR_NAME\"\n end", "def checkout_cookbook_repos\n return true unless @cookbook_repo_retriever.has_cookbooks?\n\n @audit.create_new_section('Checking out cookbooks for development')\n @audit.append_info(\"Cookbook repositories will be checked out to #{@cookbook_repo_retriever.checkout_root}\")\n\n audit_time do\n # only create a scraper if there are dev cookbooks\n @cookbook_repo_retriever.checkout_cookbook_repos do |state, operation, explanation, exception|\n # audit progress\n case state\n when :begin\n @audit.append_info(\"start #{operation} #{explanation}\") if AUDIT_BEGIN_OPERATIONS.include?(operation)\n when :commit\n @audit.append_info(\"finish #{operation} #{explanation}\") if AUDIT_COMMIT_OPERATIONS.include?(operation)\n when :abort\n @audit.append_error(\"Failed #{operation} #{explanation}\")\n Log.error(Log.format(\"Failed #{operation} #{explanation}\", exception, :trace))\n end\n end\n end\n end", "def alert_reserved_and_exit\n cli.say \"The current branch #{config.github_repo}/#{git.current_branch} is a reserved branch and can not have pull requests.\"\n exit 1\n end", "def cook_sink_eat\n delay = 4\n refresh\n HowMuch.amount(6) if click_on 'Mix/Add Honey'\n sleep delay\n refresh\n HowMuch.amount(1) if click_on 'Mix/Add Coconut'\n\n sleep delay\n refresh\n click_on 'Cook'\n popup = PopupWindow.find\n popup.click_on 'OK' if popup\n sleep delay\n\n # Eat!\n refresh\n click_on 'Enjoy'\n sleep delay\n end", "def borrowBook()\n puts \"Enter the user name: \"\n user_name = gets.chomp\n\n # check if the user name is valid\n if isUserValid?(user_name)\n then\n # check if the user's book limit is exceeded\n if !isUserBookLimitExceeded?(user_name)\n then\n puts \"\\nEnter the book to be borrowed: \"\n book_name = gets.chomp\n # check if the requested book is available\n if isBookAvailable?(book_name)\n then\n puts \"The book is available!\\n\"\n # add the book to the user's list of borrowed books\n updateUserBooks(user_name, book_name)\n # decrement the number of available copies\n updateBookCopies(book_name)\n # display the details\n displayLibraryDetails()\n else\n # error message\n puts \"Sorry! This book is not available!\"\n end\n else\n # error message\n puts \"Book limit exceeded!\"\n end\n else\n # error message\n puts \"Invalid user!!\"\n end\n end", "def set_cook_book\n @cook_book = CookBook.find(params[:id])\n end", "def check_out(book,user)\n\t\tif user.book_count > 2\n\t\t\tputs \"Sorry! You can't check out any more books.\"\n\t\telsif user.checked_out_books.any? { |book| book.overdue? == true}\n\t\t\tputs \"Sorry! You have an overdue book.\"\n\t\telsif book.status == \"available\" \n\t\t\tbook.due_date = Time.now + (7*24*3600)\n user.checked_out_books << book\n\t\t\tuser.borrow(book)\n book.status = \"checked out\"\n\t\t\tputs \"You have checked out #{book.title}.\"\n\t\telse \n\t\t\tputs \"#{book.title} is checked out. Please check back soon.\"\n\t\tend\n\tend", "def cook_time_prompts\n print \"Please provide cooking time desired: \"\n ##TODO Error here if given time is not in the data base\n lowest_cook_time = $default_recipe.recipe_name_and_cooktime.values.sort.first\n cooking_time = gets.chomp.to_i\n raise InvalidCookingTimeError if cooking_time == 0\n raise NotInDatabaseError if cooking_time < lowest_cook_time\n search_by_cooking_time(cooking_time)\nend", "def set_over_due(book)\n @borrowed_books[book.title.to_sym] = book\n time = Time.now - (60 * 60 * 24 * 30)\n\n @time_table[book.title.to_sym] = time\n puts \"#{book.title} is now set to overdue\"\n end", "def cookbook_sync_complete\n puts 'done.'\n end", "def ensure_cookbooks!\n raise 'No existing cookbook paths found.' if cookbooks_paths.empty?\n end", "def cookbook_deleted_email(name, user)\n @name = name\n @email_preference = user.email_preference_for(\"Cookbook deleted\")\n @to = user.email\n\n auto_reply_headers_off\n\n mail(to: @to, subject: \"The #{name} cookbook has been deleted\")\n end", "def cancel_hold\n if self.status == 'Held'\n create_delivery('HoldCancelled', :details => \"The hold on this validation has been removed without action.\")\n end\n end", "def block_kyc_submit_job_hard_check\n\n if (@user_kyc_detail.kyc_approved? || @user_kyc_detail.kyc_denied?)\n fail \"KYC is already approved for user id: #{@user_id}.\"\n end\n\n if @user.id != @user_extended_detail.user_id\n fail \"KYC doesn't belong to user id: #{@user_id}.\"\n end\n\n Rails.logger.info('-- block_kyc_submit_job_hard_check done')\n end", "def add_data_center_with_retry(value)\n ActiveSupport::Notifications.instrument 'mmt.performance', activity: 'Helpers::DraftHelpers#add_data_center_with_retry' do\n find('.select2-container .select2-selection').click\n begin\n find(:xpath, '//body').find('.select2-dropdown li.select2-results__option', text: value)\n rescue Capybara::ElementNotFound\n find('.select2-container .select2-selection').click\n end\n find(:xpath, '//body').find('.select2-dropdown li.select2-results__option', text: value).click\n end\n end", "def cooked_mode!\n switch_mode!(:cooked)\n end", "def create\n @cookbook = Cookbook.new(cookbook_params)\n @cookbook.user_id = current_user.id\n\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully created.' }\n format.json { render :show, status: :created, location: @cookbook }\n else\n format.html { render :new }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def select\n menu = [\n \"Model X\",\n \"Model M\",\n \"Speedster\",\n \"Cybertruck\",\n {name: \"Model 4\", disabled: \"(Unavailable)\"},\n {name: \"Space X Shuttle\", disabled: \"(Unavailable)\"}\n ]\n\n model = TTY::Prompt.new.select(\"Please chose the Testla model you would like to purchase today:\", menu, active_color: :red)\n clear\n\n return model\n end", "def new\n @order = @cookbook.get_active_order if @cookbook.is_owner? current_user\n\n # Only allow owner to order\n if @order\n\n # Redirect user if cookbook has too much pages for the selected binding\n if @cookbook.num_pages > @cookbook.book_binding.max_number_of_pages\n redirect_to notify_binding_problem_order_path(@order)\n return\n end\n\n # Make sure that the active order is not a canceled reorder (from old code)\n @order.update_attribute(:reorder_id, nil) \n end\n end", "def check_moneypouch\r\r\n if item.csca_money_pouch?\r\r\n @currency_window.refresh\r\r\n open_currency_window \r\r\n end\r\r\n end", "def borrow(currentuser)\n self.borrower ? self.borrower = nil : self.borrower = currentuser.email\n save\n log(currentuser)\n end", "def borrowed\n self.decrement!(:availability)\n end", "def check_out(borrower, book)\n if borrower.borrowed_books.size == 2\n puts \"Sorry, \" + borrower.name + \", you cannot check out any more books until you return one.\"\n elsif (book.status == \"Checked out\") \n puts \"Sorry, \" + borrower.name + \", that book is not available.\"\n else\n borrower.borrowed_books_count = borrower.borrowed_books_count + 1\n book.status = \"Checked out\"\n borrower.borrowed_books << book\n book.borrower = borrower\n puts borrower.name + \" has checked out \" + book.title + \".\"\n return borrower\n end\n end", "def choke=(now_choke)\n queue_message(now_choke ? :choke : :unchoke) unless @choking == now_choke\n @choking = now_choke\n end", "def test\n # grab the version of the cookbook in the local metadata\n result = system \"knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1\"\n\n puts 'Running knife cookbook test:'\n puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbook test was NOT successful'.indent.to_red\n result\n end", "def follower_notification_email(cookbook_follower)\n @cookbook = cookbook_follower.cookbook\n @to = cookbook_follower.user.email\n\n mail(to: @to, subject: \"A new version of the #{@cookbook.name} cookbook has been released\")\n end", "def follower_notification_email(cookbook_follower)\n @cookbook = cookbook_follower.cookbook\n @to = cookbook_follower.user.email\n\n mail(to: @to, subject: \"A new version of the #{@cookbook.name} cookbook has been released\")\n end", "def add_clearance_course(selection)\n if add_course selection\n update_status :awaiting_decisions\n\n StudentMailer.clearance_application(self.student, selection.course).deliver_later\n StudentMessenger.new.clearance_application(self.student, selection.course)\n\n return true\n end\n false\n end", "def cancel_bid\n @booking = Booking.find(params[:id])\n @booking.presenters.delete(current_user.presenter)\n flash[:success] = \"Success! You've withdrawn your bid.\"\n if @booking.presenters.count < 2\n @booking.help_required = false\n @booking.save\n end\n Notification.send_message(@booking.creator.user, \"#{current_user.presenter.get_private_full_name(current_user)} has withdrawn their bid.\", booking_path(@booking), :cancel_bid)\n redirect_to root_url\n end", "def select(...)\n prompt.select(...)\n end", "def confirm_sales_return\n @sales_return = SalesReturn.find_by_id params[:sales_return_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_return.confirm( current_user )\n @sales_return.reload \n # sleep 5 \n end", "def retrieved_cookbook(name, version, opts = {})\n if platform.server_api_version >= 2\n retrieved_cookbook_v2(name, version, opts)\n else\n retrieved_cookbook_v0(name, version, opts)\n end\n end", "def choose_city\n city_choices = [City.capital_cities.sort, {name: \"Exit\", value: \"exit\"}].flatten\n prompt = TTY::Prompt.new\n chosen_city = prompt.select(\"Please choose your city\", city_choices)\n converted_city = convert_city(chosen_city) #converts well formatted city name to searchable in the database\n if chosen_city != \"exit\"\n chosen_city_object = City.find_by(name: converted_city) #finds the city object\n else\n chosen_city_object = \"exit\"\n end\n end", "def cancelled?; end", "def select_hobby_option\n # Consider something like a case statement and check the selenium selected? method\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"checkbox_5[]\")\n status.each do |stat|\n if stat['value'] == HOBBY_STATUS[ran_num]\n stat.click\n return stat.selected?\n end\n end\n end", "def new_to_do\n p \"Okay, let's make a new To-Do!\"\n @user_category = @prompt.select(\"Please choose or make a new category for your To-Do.\", Task.task_categories.push(\"Make a new category!\"))\n if @user_category == \"Make a new category!\"\n @user_category = @prompt.ask(\"What do you want to name this category (think subject, class, or type of activity)?\")\n end\n find_category\nend", "def set_cook\n @cook = Cook.find(params[:id])\n end", "def set_cook\n @cook = Cook.find(params[:id])\n end", "def cookbook_sync_start(cookbook_count)\n puts 'synchronizing cookbooks'\n end", "def choose\n @customers = current_user.customers\n if current_customer && CustomerUser.linked?(current_customer, current_user)\n redirect_back_or_default root_url(:subdomain => current_customer.subdomain), :subdomain => current_customer.subdomain\n elsif !@customers || @customers.count == 0\n logger.warn(\"Ouch! #{current_user.email} has no customers\")\n redirect_back_or_default(secure_subdomain(:action => \"new\"), secure_subdomain)\n elsif @customers.count == 1\n if !CustomerUser.linked?(@customers[0], current_user)\n logout_keeping_session!\n access_denied\n else\n redirect_back_or_default root_url(:subdomain => @customers[0].subdomain), :subdomain => @customers[0].subdomain\n end\n else\n # Render choice page\n end\n end", "def select_recipe_from_book(recipes)\n if recipes.length == 0\n puts ''\n puts \"*** You don't have any saved recipes. ***\".colorize(:color => :red)\n puts ''\n main_menu\n else\n puts ''\n options = [recipes, \"Delete a recipe\", \"Back\"]\n selection = @prompt.select(\"Your recipe book\", (options))\n if selection == \"Delete a recipe\"\n select_recipe_to_delete(recipes)\n elsif selection == \"Back\"\n main_menu\n else\n puts ''\n selected_user_rec = User.find(@id).recipes.find { |recipe| recipe.title == selection }\n puts selected_user_rec.content\n puts ''\n main_menu\n end\n end\n end", "def confirm_checkout\n system 'clear'\n CoffeeMan.stay_logo\n choice = self.prompt.select(\"Are you done\") do |menu|\n menu.choice \"Yes\", -> {checkout}\n menu.choice \"No\", -> {view_cart}\n end\n end", "def toggle_availability\n if @chef.availability == true\n @chef.availability = false\n else\n @chef.availability = true\n end\n end", "def cookbook_upload()\n # Git meuk should not be uploaded use chefignore file instead\n # FileUtils.remove_entry(\"#{@github_tmp}/git/#{@cookbook_name}/.git\")\n\t\t args = ['cookbook', 'upload', @cookbook_name ]\n if config[:final]\n args.push \"--freeze\"\n end\n upload = Chef::Knife::CookbookUpload.new(args)\n # upload.config[:cookbook_path] = \"#{@github_tmp}/git\"\n # plugin will throw its own errors\n upload.run\n end", "def cooked_mode!\n Vedeu.log(\"Terminal switching to 'cooked' mode\")\n\n @_mode = :cooked\n end" ]
[ "0.6314082", "0.573691", "0.5581856", "0.5515331", "0.54199946", "0.5390674", "0.5250885", "0.51905346", "0.51675564", "0.51355153", "0.51146585", "0.51081425", "0.5051597", "0.50263315", "0.4994299", "0.4979852", "0.49525097", "0.49263906", "0.49219006", "0.49213073", "0.49124783", "0.48953328", "0.4894758", "0.48902068", "0.48900512", "0.4866616", "0.48592412", "0.48387378", "0.47915718", "0.47864166", "0.47736016", "0.47588298", "0.47295588", "0.47172138", "0.47011912", "0.4695801", "0.46937013", "0.46900445", "0.4674143", "0.46704283", "0.4658572", "0.46272", "0.46223", "0.46082455", "0.46074226", "0.4601716", "0.46005598", "0.4597654", "0.45951137", "0.4567891", "0.4563648", "0.453817", "0.45316842", "0.45299077", "0.45276168", "0.4520118", "0.4508801", "0.4497245", "0.4495862", "0.44928062", "0.44920644", "0.44883192", "0.44867852", "0.4467765", "0.44629207", "0.44575074", "0.44490653", "0.44413793", "0.44351178", "0.44340786", "0.44206136", "0.44189373", "0.4417372", "0.4410028", "0.43995613", "0.43979847", "0.43956676", "0.4395478", "0.43928698", "0.43927446", "0.43899056", "0.43899056", "0.43862367", "0.4385791", "0.43850994", "0.43818095", "0.43802553", "0.43801844", "0.4378315", "0.4376355", "0.4375228", "0.43741292", "0.43741292", "0.43722016", "0.4371609", "0.4363328", "0.43603778", "0.4360261", "0.43533862", "0.43513283" ]
0.7531907
0
Create a new cookbook. The cookbook is created automatically and assigned as the current cookbook.
def new cookbook_id = current_user.create_cookbook if cookbook_id @cookbook = Cookbook.find cookbook_id load_user_cookbook @cookbook redirect_to templates_path, notice: "A new cookbook was created for you." else redirect_to upgrade_account_path(current_user.id), alert: "You must have a paid membership to work on your own cookbooks" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_cookbook(cookbook)\n berksfile = Berkshelf::Berksfile.from_file(File.join(cookbook[:path], \"Berksfile\"))\n berksfile.vendor(\"berks-cookbooks\")\n\n File.open(\"berks-cookbooks/Berksfile\", 'w') { |file|\n file.write(\"source \\\"https://supermarket.chef.io\\\"\\n\\n\")\n file.write(\"cookbook \\\"#{cookbook[:name]}\\\", path: \\\"./#{cookbook[:name]}\\\"\")\n }\n\n if cookbook[:cookbook_filename].end_with? \".zip\"\n zf = ZipFileGenerator.new(\"berks-cookbooks\", cookbook[:cookbook_filename])\n zf.write\n elsif cookbook[:cookbook_filename].end_with? \".tar.gz\"\n system(\"tar -czvf #{cookbook[:cookbook_filename]} -C berks-cookbooks . > /dev/null 2>&1\")\n end\n end", "def create_cookbook(name, type, tmp)\n target = File.join(tmp, name)\n template_org = locate_config_value(\"github_template_org\")\n if template_org.nil? || template_org.empty?\n Chef::Log.fatal(\"Cannot find github_template_org within your configuration\")\n else\n\n github_url = @github_url.gsub('http://', 'git://') if @github_url =~ /^http:\\/\\/.*$/\n github_url = @github_url if @github_url =~ /^https:\\/\\/.*$/\n\n template_path = File.join(github_url, template_org, \"chef_template_#{type}.git\")\n shell_out!(\"git clone #{template_path} #{target}\") # , :cwd => cookbook_path)\n end\n end", "def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end", "def create\n @cookbook = Cookbook.new(cookbook_params)\n\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cookbook }\n else\n format.html { render action: 'new' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(name)\n @cookbook.add_recipe(name)\n end", "def make_fake_cookbook\n info(\"Berksfile, Cheffile, cookbooks/, or metadata.rb not found \" \\\n \"so Chef will run with effectively no cookbooks. Is this intended?\")\n name = File.basename(config[:kitchen_root])\n fake_cb = File.join(tmpbooks_dir, name)\n FileUtils.mkdir_p(fake_cb)\n File.open(File.join(fake_cb, \"metadata.rb\"), \"wb\") do |file|\n file.write(%{name \"#{name}\"\\n})\n end\n end", "def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end", "def cookbook(arg = nil)\n set_or_return(:cookbook,\n arg,\n kind_of: [String, NilClass],\n default: nil)\n end", "def cookbook(name, options = {})\n @name = name\n @options = manipulate(options)\n end", "def create\n @cookbook = Cookbook.new(cookbook_params)\n @cookbook.user_id = current_user.id\n\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully created.' }\n format.json { render :show, status: :created, location: @cookbook }\n else\n format.html { render :new }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookbook\n @cookbook ||= CachedCookbook.from_path(path, name: name)\n end", "def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end", "def cp_this_cookbook\n info(\"Preparing current project directory as a cookbook\")\n debug(\"Using metadata.rb from #{metadata_rb}\")\n\n cb_name = MetadataChopper.extract(metadata_rb).first || raise(UserError,\n \"The metadata.rb does not define the 'name' key.\" \\\n \" Please add: `name '<cookbook_name>'` to metadata.rb and retry\")\n\n cb_path = File.join(tmpbooks_dir, cb_name)\n\n glob = Util.list_directory(config[:kitchen_root])\n\n FileUtils.mkdir_p(cb_path)\n FileUtils.cp_r(glob, cb_path)\n end", "def local_cookbook(name, path=nil)\n if path\n cookbook name, path: \"#{path}/#{name}\"\n else\n cookbook name, path: \"#{ENV['CHEF_REPO']}/cookbooks/#{name}\"\n end\nend", "def verify_cookbook_creation\n fail 'You need to specify the cookbook name' if @opts[:cookbook].nil?\n end", "def init\n clone_appd_cookbook\n chef_gem \"install berkshelf\"\n end", "def set_cookbook\n @cookbook = CookbooksDecorator.new(Cookbook.find(params[:id]))\n end", "def set_cookbook\n @cookbook = Cookbook.find(params[:id])\n end", "def create\n @cookbook = Cookbook.new(params[:cookbook])\n @cookbook.user = current_user\n @cookbook_like = CookbookLike.create( cookbook: @cookbook )\n @cookbook.cookbook_like = @cookbook_like\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to cookbooks_url, notice: 'Cookbook was successfully created.' }\n format.json { render json: @cookbook, status: :created, location: @cookbook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def install(source, cookbook)\n cookbooks[cookbook.name] ||= {}\n cookbooks[cookbook.name][:version] = cookbook.version\n\n unless source.default?\n cookbooks[cookbook.name][:api_source] = source.uri\n cookbooks[cookbook.name][:location_path] = cookbook.location_path\n end\n end", "def resource_cookbook\n @new_resource.cookbook || @new_resource.cookbook_name\n end", "def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end", "def set_cookbook\n @cookbook = Cookbook.friendly.find(params[:id])\n end", "def load_cookbook!\n @cookbook = current_cookbook\n end", "def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend", "def create\n tmpl = ERB.new(load_erb_file('rubocop/rubocop.yml'))\n data = tmpl.result(binding)\n\n info 'Setting up Rubocop configuration'\n write_file(cookbook_file_path('.rubocop.yml'), data)\n end", "def generate_temp_cookbook(cli_arguments)\n temp_cookbook = TempCookbook.new\n if recipe_strategy?(cli_arguments)\n recipe_specifier = cli_arguments.shift\n ChefCLI::Log.debug(\"Beginning to look for recipe specified as #{recipe_specifier}\")\n if File.file?(recipe_specifier)\n ChefCLI::Log.debug(\"#{recipe_specifier} is a valid path to a recipe\")\n recipe_path = recipe_specifier\n else\n rl = RecipeLookup.new(config[:cookbook_repo_paths])\n cookbook_path_or_name, optional_recipe_name = rl.split(recipe_specifier)\n cookbook = rl.load_cookbook(cookbook_path_or_name)\n recipe_path = rl.find_recipe(cookbook, optional_recipe_name)\n end\n temp_cookbook.from_existing_recipe(recipe_path)\n initial_status_msg = TS.converge.converging_recipe(recipe_specifier)\n else\n resource_type = cli_arguments.shift\n resource_name = cli_arguments.shift\n temp_cookbook.from_resource(resource_type, resource_name, format_properties(cli_arguments))\n full_rs_name = \"#{resource_type}[#{resource_name}]\"\n ChefCLI::Log.debug(\"Converging resource #{full_rs_name} on target\")\n initial_status_msg = TS.converge.converging_resource(full_rs_name)\n end\n\n [temp_cookbook, initial_status_msg]\n end", "def company_cookbook(name, version = '>= 0.0.0', options = {})\n cookbook(name, version, { git: \"https://github.com/EagleGenomics-cookbooks/#{name}.git\" }.merge(options))\nend", "def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)\nsuper if defined?(::Chef::ResourceBuilder)\n @type = type\n @name = name\n @created_at = created_at\n @params = params\n @run_context = run_context\n @cookbook_name = cookbook_name\n @recipe_name = recipe_name\n @enclosing_provider = enclosing_provider\n end", "def upload_cookbook(cookbook)\n execute \"Upload Cookbook => #{cookbook}\" do\n command \"knife cookbook upload #{cookbook} --cookbook-path #{Chef::Config[:cookbook_path]}\"\n environment(\n 'KNIFE_HOME' => cluster_data_dir\n )\n not_if \"knife cookbook show #{cookbook}\"\n end\n end", "def generate_temp_cookbook(cli_arguments)\n temp_cookbook = TempCookbook.new\n if recipe_strategy?(cli_arguments)\n recipe_specifier = cli_arguments.shift\n ChefRun::Log.debug(\"Beginning to look for recipe specified as #{recipe_specifier}\")\n if File.file?(recipe_specifier)\n ChefRun::Log.debug(\"#{recipe_specifier} is a valid path to a recipe\")\n recipe_path = recipe_specifier\n else\n rl = RecipeLookup.new(parsed_options[:cookbook_repo_paths])\n cookbook_path_or_name, optional_recipe_name = rl.split(recipe_specifier)\n cookbook = rl.load_cookbook(cookbook_path_or_name)\n recipe_path = rl.find_recipe(cookbook, optional_recipe_name)\n end\n temp_cookbook.from_existing_recipe(recipe_path)\n initial_status_msg = TS.converge.converging_recipe(recipe_specifier)\n else\n resource_type = cli_arguments.shift\n resource_name = cli_arguments.shift\n temp_cookbook.from_resource(resource_type, resource_name, format_properties(cli_arguments))\n full_rs_name = \"#{resource_type}[#{resource_name}]\"\n ChefRun::Log.debug(\"Converging resource #{full_rs_name} on target\")\n initial_status_msg = TS.converge.converging_resource(full_rs_name)\n end\n\n [temp_cookbook, initial_status_msg]\n end", "def new\n @chef = Chef.new\n end", "def create(options = {})\n optional = [:description,\n \t\t\t :compatible_with,\n \t\t\t :script_type\n ]\n params.required(:label).accepts(optional).validate!(options)\n response = request(:post, \"/recipes.json\", default_params(options))\n response['recipe']\n end", "def create\n tmpl = ERB.new(load_erb_file('metadata.erb'))\n @cookbook = @opts[:cookbook]\n @maintainer = @opts[:souschef][:maintainer]\n @maintainer_email = @opts[:souschef][:maintainer_email]\n @license = @opts[:souschef][:license]\n data = tmpl.result(binding)\n\n info 'Updating metadata.rb'\n write_file(cookbook_file_path('metadata.rb'), data)\n end", "def add_cookbook_params\n params.require(:cookbook).permit(:name)\n end", "def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end", "def cookbook_params\n params.require(:cookbook).permit(:name, :vcs_url, :project_id)\n end", "def generate_temp_cookbook(arguments, reporter)\n opts = if arguments.length == 1\n { recipe_spec: arguments.shift,\n cookbook_repo_paths: parsed_options[:cookbook_repo_paths] }\n else\n { resource_type: arguments.shift,\n resource_name: arguments.shift,\n resource_properties: properties_from_string(arguments) }\n end\n action = ChefApply::Action::GenerateTempCookbook.from_options(opts)\n action.run do |event, data|\n case event\n when :generating\n reporter.update(TS.generate_temp_cookbook.generating)\n when :success\n reporter.success(TS.generate_temp_cookbook.success)\n else\n handle_message(event, data, reporter)\n end\n end\n action.generated_cookbook\n end", "def _create_chef_node(&block)\n step(\" creating chef node\", :green)\n @chef_node = Chef::Node.new\n @chef_node.name(fullname)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_client.post_rest('nodes', @chef_node)\n end", "def package(cookbook, destination)\n cookbooks[cookbook] ||= {}\n cookbooks[cookbook][:destination] = destination\n end", "def init\n create_file options[:inventory_config] do\n<<-YML\n# sources:\n# - \"https://supermarket.getchef.com\"\n# cookbooks:\n# cookbook-name:\n# versions:\n# - \"~> 4.0.2\"\n# - \"> 5.0.0\"\n# git:\n# location: url | path\n# branches:\n# - a_branch_name\n# refs:\n# - SHA\n\nYML\n end\n end", "def cookbook_file(*args, &block)\n Log.instance << \"About to cook the file: #{args[0]}\"\n @@chef_orig_cookbook_file.bind(self).call(args, &block)\n Log.instance << \"Hoora the file: #{args[0]} has been cooked\"\n end", "def install(cookbook, version, location)\n cookbooks[cookbook] ||= {}\n cookbooks[cookbook][:version] = version\n cookbooks[cookbook][:location] = location.to_s\n end", "def update_appd_cookbook\n @ssh.exec! \"cd #{APPD_COOKBOOK_PATH}; git pull origin master\", sudo: true\n chef_exec \"berks install --path #{@cookbook_path.first} --berksfile #{APPD_COOKBOOK_PATH}/Berksfile\"\n end", "def deploy_cookbook(cookbook)\n cookbook[:targets].each do |target|\n if system(\"scp #{@ssh_opts} #{cookbook[:cookbook_filename]} #{target}:/tmp #{@q_all}\")\n `ssh #{@ssh_opts} #{target} sudo rm -rf /var/chef/cookbooks/* #{@q_all}`\n `ssh #{@ssh_opts} #{target} sudo tar -xzvf /tmp/#{cookbook[:cookbook_filename]} -C /var/chef/cookbooks #{@q_all}`\n `ssh #{@ssh_opts} #{target} sudo rm -rf /tmp/#{cookbook[:cookbook_filename]} #{@q_all}`\n else\n DreamOps.ui.error \"Failed to copy cookbook to host '#{target}'\"\n end\n\n if !system(\n \"ssh #{@ssh_opts} #{target} \"+\n \"\\\"echo '#{cookbook[:local_sha]}' | sudo tee /var/chef/#{cookbook[:sha_filename]}\\\" #{@q_all}\"\n )\n DreamOps.ui.error \"Failed to update remote cookbook sha\"\n end\n end\n end", "def cookbook_upload()\n # Git meuk should not be uploaded use chefignore file instead\n # FileUtils.remove_entry(\"#{@github_tmp}/git/#{@cookbook_name}/.git\")\n\t\t args = ['cookbook', 'upload', @cookbook_name ]\n if config[:final]\n args.push \"--freeze\"\n end\n upload = Chef::Knife::CookbookUpload.new(args)\n # upload.config[:cookbook_path] = \"#{@github_tmp}/git\"\n # plugin will throw its own errors\n upload.run\n end", "def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end", "def save_dummy_cookbook_with_recipes(cookbook_name, cookbook_version, recipe_list)\n recipe_specs = normalize_recipe_specs(recipe_list)\n content_list = recipe_specs.map { |r| r[:content] }\n files = content_list.map { |content| Pedant::Utility.new_temp_file(content) }\n upload_files_to_sandbox(files)\n checksums = files.map { |f| Pedant::Utility.checksum(f) }\n recipes = recipe_specs.zip(checksums).map do |r, sum|\n dummy_recipe(r[:name], sum)\n end.sort { |a, b| a[:name] <=> b[:name] }\n opts = { :recipes => recipes }\n make_cookbook(admin_user, cookbook_name, cookbook_version, opts)\n end", "def cookbook_params\n params.require(:cookbook).permit(:name, :user_id)\n end", "def cookbook_runlist\n verify_cookbook_creation\n\n Souschef::Print.header 'Berkshelf configuration'\n Souschef::Berkshelf.new(@opts).berks_create\n Souschef::Print.header 'Configure gemfile'\n Souschef::Gemfile.new(@opts).write\n Souschef::Print.header 'Create essential template files'\n Souschef::Template.run(@opts)\n # Mock Scaffold to generate default recipe and tests\n\n Souschef::Print.header 'Create default recipe and tests'\n Souschef::Scaffold.new(path: @opts[:path],\n recipe: 'default',\n profile: @opts[:profile],\n force: true,\n verbose: @opts[:verbose]).start\n\n Souschef::Print.header 'Testkitchen configuration'\n Souschef::Testkitchen.new(@opts).setup\n\n Souschef::Print.header \"Don't forget to run bundle install!\"\n end", "def populate_chef_secure_path\n chef_secure_path.run_action(:create)\n\n unless new_resource.encrypted_data_bag_secret.nil?\n r = Chef::Resource::File.new(::File.join(new_resource.chef_secure_path, 'encrypted_data_bag_secret'), run_context)\n r.content(new_resource.encrypted_data_bag_secret)\n r.sensitive(true)\n r.run_action(:create)\n end\n\n unless chef_client_valid(chef_server_url, new_resource.service_name, client_key_file)\n r = Chef::Resource::File.new(client_key_file, run_context)\n r.sensitive(true)\n r.run_action(:delete)\n end\n\n unless ::File.exists?(client_key_file) or new_resource.validation_key.nil?\n r = Chef::Resource::File.new(::File.join(new_resource.chef_secure_path, 'validation.pem'), run_context)\n r.content(new_resource.validation_key)\n r.sensitive(true)\n r.run_action(:create)\n end\n\n unless new_resource.data_bags.empty?\n write_data_bags(new_resource.data_bags(new_resource.chef_secure_path, 'data_bags'))\n end\n end", "def create\n if %w{Cookbook Tool}.include?(collaborator_params[:resourceable_type])\n resource = collaborator_params[:resourceable_type].constantize.find(\n collaborator_params[:resourceable_id]\n )\n\n add_users_as_collaborators(resource, collaborator_params[:user_ids]) if collaborator_params[:user_ids].present?\n\n add_group_members_as_collaborators(resource, collaborator_params[:group_ids]) if collaborator_params[:group_ids].present?\n\n if resource.class == Cookbook\n perform_fieri(resource)\n end\n\n redirect_to resource, notice: t(\"collaborator.added\")\n else\n not_found!\n end\n end", "def synchronized_cookbook(cookbook_name)\n puts \" - #{cookbook_name}\"\n end", "def release_step\n super\n puts @source_git_parent_path\n pem_path = File.expand_path('~/client.pem')\n knife_path = File.expand_path('~/knife.rb')\n\n unless @config.chef_supermarket_username || @config.chef_supermarket_key\n fail CapsuleCD::Error::ReleaseCredentialsMissing, 'cannot deploy cookbook to supermarket, credentials missing'\n end\n\n # knife is really sensitive to folder names. The cookbook name MUST match the folder name otherwise knife throws up\n # when doing a knife cookbook share. So we're going to make a new tmp directory, create a subdirectory with the EXACT\n # cookbook name, and then copy the cookbook contents into it. Yeah yeah, its pretty nasty, but blame Chef.\n metadata_str = CapsuleCD::Chef::ChefHelper.read_repo_metadata(@source_git_local_path)\n chef_metadata = CapsuleCD::Chef::ChefHelper.parse_metadata(metadata_str)\n\n Dir.mktmpdir {|tmp_parent_path|\n # create cookbook folder\n tmp_local_path = File.join(tmp_parent_path, chef_metadata.name)\n FileUtils.mkdir_p(tmp_local_path)\n FileUtils.copy_entry(@source_git_local_path, tmp_local_path)\n\n # write the knife.rb config jfile.\n File.open(knife_path, 'w+') do |file|\n file.write(<<-EOT.gsub(/^\\s+/, '')\n node_name \"#{@config.chef_supermarket_username }\" # Replace with the login name you use to login to the Supermarket.\n client_key \"#{pem_path}\" # Define the path to wherever your client.pem file lives. This is the key you generated when you signed up for a Chef account.\n cookbook_path [ '#{tmp_parent_path}' ] # Directory where the cookbook you're uploading resides.\n EOT\n )\n end\n\n File.open(pem_path, 'w+') do |file|\n file.write(@config.chef_supermarket_key)\n end\n\n command = \"knife cookbook site share #{chef_metadata.name} #{@config.chef_supermarket_type} -c #{knife_path}\"\n Open3.popen3(command) do |_stdin, stdout, stderr, external|\n { stdout: stdout, stderr: stderr }. each do |name, stream_buffer|\n Thread.new do\n until (line = stream_buffer.gets).nil?\n puts \"#{name} -> #{line}\"\n end\n end\n end\n # wait for process\n external.join\n unless external.value.success?\n fail CapsuleCD::Error::ReleasePackageError, 'knife cookbook upload to supermarket failed'\n end\n end\n }\n end", "def company_cookbook(*args)\n options = args.last.is_a?(Hash) ? args.pop : Hash.new\n name, constraint = args\n id, repo = company_repo.to_a.first\n locations = Berkshelf.constants.map {|c| c.to_s}.select {|c| c.end_with?(\"Location\") }\n\n # unless the location is explicitly specified use custom company repository\n if options.keys.none? {|k| lid = k.to_s.capitalize; locations.include?(\"#{lid}Location\") }\n cookbook_name = options.delete(:cookbook_name) || name\n location_hash = {id => eval(%Q(\"#{repo}\"))}\n else\n location_hash = {}\n end\n cookbook(name, constraint, options.merge(location_hash))\n end", "def target_cookbook\n return @target_cookbook unless @target_cookbook.nil?\n\n begin\n @target_cookbook = if version_constraint\n conn.cookbook.satisfy(name, version_constraint)\n else\n conn.cookbook.latest_version(name)\n end\n rescue Ridley::Errors::HTTPNotFound,\n Ridley::Errors::ResourceNotFound\n @target_cookbook = nil\n end\n\n if @target_cookbook.nil?\n msg = \"Cookbook '#{name}' found at #{self}\"\n msg << \" that would satisfy constraint (#{version_constraint})\" if version_constraint\n raise CookbookNotFound, msg\n end\n\n @target_cookbook\n end", "def test\n # grab the version of the cookbook in the local metadata\n result = system \"knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1\"\n\n puts 'Running knife cookbook test:'\n puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbook test was NOT successful'.indent.to_red\n result\n end", "def create_bag(bag_name)\n # check that the name is valid\n begin\n Chef::DataBag.validate_name!(bag_name)\n rescue Chef::Exceptions::InvalidDataBagName => e\n ui.fatal(e.message)\n exit(1)\n end\n\n # create the data bag\n begin\n data_bag = Chef::DataBag.new\n data_bag.name(bag_name)\n data_bag.create\n ui.info(\"Created topology data bag [#{bag_name}]\")\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^409/\n data_bag = Chef::DataBag.load(bag_name)\n ui.info(\"Topology data bag #{bag_name} already exists\")\n end\n\n data_bag\n end", "def cp_cookbooks\n info(\"Preparing cookbooks from project directory\")\n debug(\"Using cookbooks from #{cookbooks_dir}\")\n\n FileUtils.mkdir_p(tmpbooks_dir)\n FileUtils.cp_r(File.join(cookbooks_dir, \".\"), tmpbooks_dir)\n\n cp_site_cookbooks if File.directory?(site_cookbooks_dir)\n cp_this_cookbook if File.exist?(metadata_rb)\n end", "def create(label, name, summary, arch, parent)\n @connection.call('channel.software.create', @sid, label, name, summary, arch, parent)\n end", "def set_cookbook_attribute\n run_context.cookbook_collection.each do |cookbook_name, cookbook|\n automatic_attrs[:cookbooks][cookbook_name][:version] = cookbook.version\n end\n end", "def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end", "def upload_cookbooks(args) \n begin\n run_cmd(Chef::Knife::TopoCookbookUpload, args)\n rescue Exception => e\n raise if Chef::Config[:verbosity] == 2\n end \n end", "def create\n spec_dir = File.join(@path, 'spec')\n\n tmpl = ERB.new(load_erb_file('chefspec/spec_helper.rb'))\n data = tmpl.result(binding)\n\n create_spec_dir(spec_dir) unless File.directory?(spec_dir)\n\n info 'Creating Chefspec helper'\n write_file(cookbook_file_path('spec/spec_helper.rb'), data)\n end", "def upload(cookbook, version, chef_api_url)\n cookbooks[cookbook] ||= {}\n cookbooks[cookbook][:version] = version\n cookbooks[cookbook][:uploaded_to] = chef_api_url\n end", "def cookbook_store\n Berkshelf.cookbook_store\n end", "def cookbook_collection\n run_context.cookbook_collection\n end", "def register_cookbooks\n @cookbooks.each do |name, git_address|\n if ssh.exec? \"ls #{COOKBOOKS_PATH}/#{name}\"\n ssh.exec! \"cd #{COOKBOOKS_PATH}/#{name}; git pull origin master\", sudo: true\n else\n ssh.exec! \"git clone #{git_address} #{COOKBOOKS_PATH}/#{name}\", sudo: true\n end\n ssh.exec! \"berks vendored #{VENDOR_COOKBOOKS_PATH} --berksfile #{COOKBOOKS_PATH}/#{name}/Berksfile\"\n end\n end", "def run\n Souschef::Print.header \"Using Souschef profile: #{opts[:profile]}\"\n\n if @opts[:scaffold]\n Souschef::Scaffold.new(@opts).start\n elsif @opts[:configure]\n verify_configure_input\n Souschef::Configure::Yaml.new(@opts)\n else\n Souschef::Print.header \"Starting cookbook creation...\\n\"\n cookbook_runlist\n end\n end", "def cookbook_url_base\n \"cookbooks\"\n end", "def cook(&block)\n the_recipes = [\n self.class.standard_recipes,\n self.base_recipe,\n self.recipes,\n (block_given? ? block : nil)\n ].flatten.compact.uniq\n the_recipes.each do |r|\n if r.is_a?(Proc)\n self.cap_config.load(:proc => r)\n else # assume recipe filename\n self.cap_config.load(:file => r)\n end\n end\n @cooked = true\n self.cap_config\n end", "def upload_cookbook!(uploader, options = {})\n if uploader.respond_to?(:upload_cookbook)\n uploader.upload_cookbook\n else\n uploader.upload_cookbooks\n end\n end", "def create\n @recipe = Recipe.new(recipe_params)\n @recipe.chef = Chef.find(2)\n \n if @recipe.save\n # shows a message when saved \n flash[:success] = \"Your recipe was created successfully!\"\n # redirect - index page\n redirect_to recipes_path\n else\n render :new\n end\n end", "def cookbook_name\n @cookbook_name ||= begin\n metadata = Ridley::Chef::Cookbook::Metadata.from_file(target.join('metadata.rb').to_s)\n metadata.name.empty? ? File.basename(target) : metadata.name\n rescue CookbookNotFound, IOError\n File.basename(target)\n end\n end", "def create\n @cook_book = CookBook.new(cook_book_params)\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render :show, status: :created, location: @cook_book }\n else\n format.html { render :new }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def show(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end", "def install_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package 'chefdk' do\n version new_resource.version unless new_resource.version == 'latest'\n end\n end", "def info(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end", "def create\n @cook_book = CookBook.new(params[:cook_book])\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render json: @cook_book, status: :created, location: @cook_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookbook_sync_start(cookbook_count)\n puts 'synchronizing cookbooks'\n end", "def cookbook_clean_start\n end", "def create\n payload = {\n name: name,\n validator: validator,\n # this field is ignored in API V1, but left for backwards-compat,\n # can remove after OSC 11 support is finished?\n admin: admin,\n }\n begin\n # try API V1\n raise Chef::Exceptions::InvalidClientAttribute, \"You cannot set both public_key and create_key for create.\" if !create_key.nil? && !public_key.nil?\n\n payload[:public_key] = public_key unless public_key.nil?\n payload[:create_key] = create_key unless create_key.nil?\n\n new_client = if Chef::Config[:migrate_key_to_keystore] == true\n chef_rest_v1_with_validator.post(\"clients\", payload)\n else\n chef_rest_v1.post(\"clients\", payload)\n end\n\n # get the private_key out of the chef_key hash if it exists\n if new_client[\"chef_key\"]\n if new_client[\"chef_key\"][\"private_key\"]\n new_client[\"private_key\"] = new_client[\"chef_key\"][\"private_key\"]\n end\n new_client[\"public_key\"] = new_client[\"chef_key\"][\"public_key\"]\n new_client.delete(\"chef_key\")\n end\n\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n # under API V0, a key pair will always be created unless public_key is\n # passed on initial POST\n payload[:public_key] = public_key unless public_key.nil?\n\n new_client = chef_rest_v0.post(\"clients\", payload)\n end\n Chef::ApiClientV1.from_hash(to_h.merge(new_client))\n end", "def push_cookbooks(cbs, commit_msg)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"cb:\"\n first_add = true\n Dir.chdir(Chef::Config[:git_repo]) do\n cbs.each do |cbname, cb|\n ui.info(\"- cookbook #{cbname} \")\n git.add(\"cookbooks/#{cbname}\")\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += \"#{cbname}\"\n end\n push(commit_prefix, commit_msg)\n end\n end", "def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end", "def create_recipe(rcp_file, keyword, *args, &block)\n keyword = keyword.to_s.to_sym unless Symbol === keyword\n if recipe_types.has_key?(keyword)\n return recipe_types[keyword].new(rcp_file, *args, &block)\n end\n\n nil\n end", "def berks_install\n puts 'Retrieving cookbooks'\n `berks install -b #{@config.workspace}/Berksfile`\n fail 'Failed to retrieve cookbooks' unless process_last_status.success?\n end", "def clone_appd_cookbook\n @ssh.exec! \"rm -rf #{APPD_COOKBOOK_PATH}\", sudo: true\n @ssh.exec! \"git clone #{APPD_COOKBOOK_URI} #{APPD_COOKBOOK_PATH}\", sudo: true\n end", "def ensure_cookbooks!\n raise 'No existing cookbook paths found.' if cookbooks_paths.empty?\n end", "def generate_chef_config()\n Kitchenplan::Log.info 'Generating the Chef configs'\n #$: << File.join((File.expand_path(\"../\", Pathname.new(__FILE__).realpath)), \"/lib\")\n File.open(\"kitchenplan-attributes.json\", 'w') do |out|\n\tout.write(::JSON.pretty_generate(self.config['attributes']))\n end\n File.open(\"solo.rb\", 'w') do |out|\n\tout.write(\"cookbook_path [ \\\"#{Dir.pwd}/cookbooks\\\" ]\")\n end\n end", "def show(cookbook)\n cookbooks[cookbook.cookbook_name] = cookbook.pretty_hash\n end", "def create\n @chef_resource = ChefResource.new(chef_resource_params)\n\n respond_to do |format|\n if @chef_resource.save\n format.html { redirect_to @chef_resource, notice: 'Chef resource was successfully created.' }\n format.json { render :show, status: :created, location: @chef_resource }\n else\n format.html { render :new }\n format.json { render json: @chef_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sslcert\n converge_by(\"Create Cert #{new_resource}\") do\n Chef::Log.info \"Create #{new_resource}\"\n\n update_sslcert\n\n new_resource.updated_by_last_action(true)\n end\n end", "def find_cookbook\n @cookbook = Cookbook.with_name(params[:cookbook_id]).first!\n end", "def new\n @cookbook = Cookbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cookbook }\n end\n end", "def add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, cookbook)\n return false if seen_cookbooks.key?(cookbook)\n\n seen_cookbooks[cookbook] = true\n each_cookbook_dep(cookbook) do |dependency|\n add_cookbook_with_deps(ordered_cookbooks, seen_cookbooks, dependency)\n end\n ordered_cookbooks << cookbook\n end", "def berks_upload\n puts 'Running berks upload'\n command = ['berks upload']\n command << \"#{cookbook.name}\" unless recursive\n command << \"-b #{@config.workspace}/Berksfile\"\n command << '--no-freeze' unless freeze\n puts `#{command.join(' ')}`\n fail 'Failed to upload cookbook' unless process_last_status.success?\n end", "def synchronized_cookbook(cookbook_name)\n print '.'\n end", "def render_defaults\n template '/etc/default/haproxy' do\n cookbook 'consul-haproxy'\n source 'haproxy_defaults.erb'\n mode '0644'\n action :create\n end\nend", "def build_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n # Checks the new platform => short_name => resource mapping initially\n # then fall back to the older approach (Chef::Resource.const_get) for\n # backward compatibility\n resource_class = resource_class_for(type)\n\n raise ArgumentError, \"You must supply a name when declaring a #{type} resource\" if name.nil?\n\n resource = resource_class.new(name, run_context)\n resource.source_line = created_at\n resource.declared_type = type\n # If we have a resource like this one, we want to steal its state\n # This behavior is very counter-intuitive and should be removed.\n # See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694\n # Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052\n resource.load_prior_resource(type, name)\n resource.cookbook_name = cookbook_name\n resource.recipe_name = recipe_name\n # Determine whether this resource is being created in the context of an enclosing Provider\n resource.enclosing_provider = self.is_a?(Chef::Provider) ? self : nil\n\n # XXX: This is very crufty, but it's required for resource definitions\n # to work properly :(\n resource.params = @params\n\n # Evaluate resource attribute DSL\n resource.instance_eval(&resource_attrs_block) if block_given?\n\n # Run optional resource hook\n resource.after_created\n\n resource\n end", "def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end" ]
[ "0.70700115", "0.70054996", "0.6918313", "0.68459415", "0.6825474", "0.6716979", "0.67027557", "0.66202694", "0.6540583", "0.65399444", "0.65264964", "0.64844555", "0.6471256", "0.6381962", "0.63623846", "0.6323584", "0.63169324", "0.6266003", "0.62150544", "0.62010705", "0.6198749", "0.6179747", "0.6142141", "0.6123624", "0.611989", "0.6100777", "0.60997427", "0.60962003", "0.60833925", "0.6070884", "0.6047488", "0.596296", "0.594547", "0.59289", "0.5918132", "0.5853609", "0.5826172", "0.5792516", "0.57855594", "0.5774752", "0.5749963", "0.5735439", "0.569492", "0.5672578", "0.5633953", "0.5621855", "0.56009364", "0.559805", "0.5589642", "0.5581552", "0.5577081", "0.5552314", "0.5540426", "0.55252707", "0.55192995", "0.54919356", "0.5489525", "0.5477856", "0.5466334", "0.5462263", "0.54575586", "0.54500407", "0.5436504", "0.5420802", "0.54088604", "0.53890526", "0.5388262", "0.53796273", "0.53753644", "0.53410506", "0.5332316", "0.5329463", "0.5322597", "0.5320369", "0.53149647", "0.5309499", "0.5299556", "0.5299469", "0.5296747", "0.52948946", "0.52862436", "0.52797353", "0.5276188", "0.52693355", "0.5266969", "0.5252864", "0.5252289", "0.525009", "0.52489036", "0.52474445", "0.5244899", "0.52313185", "0.5227323", "0.52002895", "0.5186011", "0.5175777", "0.51692814", "0.51660573", "0.51645905", "0.5163856" ]
0.68842936
3
Edit the cookbook informations Respond with a content type of plain/text to support IE and Opera see:
def edit @cookbook = current_cookbook end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_introduction\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n\n if params[:cookbook]\n @cookbook.intro_type = params[:cookbook][:intro_type] if params[:cookbook][:intro_type]\n @cookbook.center_introduction = params[:cookbook][:center_introduction] if params[:cookbook][:center_introduction]\n @cookbook.intro_text = params[:cookbook][:intro_text] if params[:cookbook][:intro_text]\n @cookbook.intro_image_grayscale = params[:cookbook][:intro_image_grayscale] if params[:cookbook][:intro_image_grayscale]\n @cookbook.intro_image = params[:cookbook][:intro_image] if !params[:cookbook][:intro_image].nil?\n\n # If the user has checked the \"Do not include this page\" checkbox, set the intro_type do '2'\n @cookbook.intro_type = 2 if params[:do_not_include]\n @cookbook.intro_type = 0 if !params[:do_not_include] && @cookbook.intro_type == 2\n end\n\n if @cookbook.save\n flash[:notice] = 'The introduction of your cookbook was saved.'\n end\n respond_to do |format|\n format.js { render :update_introduction, content_type: \"text/plain\" }\n end\n end", "def update_content\n @note = Note.find(params[:id], :select => \"article_id\")\n\n respond_to do |format|\n if @note.article.update_attribute(:content, params[:newContent])\n # Technically html :)\n format.text { render :text => RedCloth.new(white_list(@note.article.content),[:filter_styles]).to_html(:textile, :youtube, :note) }\n else\n format.text { render :text => \"<p>Content update error.</p>\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_to do |format|\n format.html # show.rhtml\n format.js\n format.xml { render :xml => @recipe.to_xml }\n end\n end", "def update\n respond_to_creative :ok, 'Book was successfully updated.', :edit \n end", "def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\n end", "def update\n respond_to_creative :ok, 'Review was successfully updated.', :edit\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_introduction\n @cookbook = current_cookbook\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def supplier_product_description\n @product_combobox = ProductCombobox.db_active_both_operation\n arr_desc = ProductCombobox.put_description(@product_combobox)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: arr_desc }\n end\n end", "def edit\n respond_with(reagent)\n end", "def edit\n\t@desktop_override = true\n\n\trespond_to do |format|\n\t format.html do\n\t\trender :layout => \"restlessnapkin\" # new.html.erb\n\t end\n\tend\n end", "def update\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n get_resource_types\n format.html { render action: :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_expense_entry_description\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @tne_invoice_expense_entry.update_attribute(:description,data[:value])\n render :text => @tne_invoice_expense_entry.description\n end", "def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend", "def show\n @administration_offering.description=HTMLEntities.decode_entities(@administration_offering.description)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration_offering.nil? ? \"<error><code>400</code><status>Not found</status></error>\":@administration_offering}\n end\n end", "def update_raw_text(item); end", "def update_raw_text(item); end", "def edit_description\n end", "def update\n respond_to do |format|\n if @admin_catalogo.update(admin_catalogo_params)\n format.html { redirect_to admin_catalogos_path, notice: \"El catálogo \\\"#{@admin_catalogo.descripcion}\\\" fue actualizado correcamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_resource_content\n resource_content\n end", "def update\n respond_to do |format|\n if @characteristic_detail.update(feature_params)\n flash[:notice] = 'Características Modificada'\n format.html { redirect_to admin_characteristic_path(session[:characteristic]) }\n format.json { render :show, status: :ok, location: @characteristic_detail }\n else\n format.html { render :edit }\n format.json { render json: @characteristic_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_kit_description\n if can?(:>=, \"5\")\n params[:new_desc] = params[:new_desc].strip rescue nil\n if params[:new_desc].present?\n if params[:kit_id] && params[:kit_number]\n kit_to_edit = Kitting::Kit.where(:kit_number => params[:kit_number],:commit_id => nil)\n updated_kit = Kitting::Kit.where(:kit_number => params[:kit_number],:commit_status =>false).first\n if kit_to_edit.present?\n kit_to_edit = kit_to_edit.first\n end\n if kit_to_edit.present?\n if kit_to_edit.kit_media_type.kit_type == \"multi-media-type\"\n misc_arr= Array.new;parts_arr=Array.new;quantity_arr=Array.new ;uom_arr=Array.new;in_contract_arr=Array.new\n kit_mmt_kits = Kitting::Kit.find_all_by_parent_kit_id_and_deleted(kit_to_edit.id, false).sort\n kit_mmt_kits.each_with_index do |orig_kit, index|\n mmt_kit_details = Kitting::Kit.get_kit_data(orig_kit,\"multi-media-type\",index)\n misc_arr.push(*mmt_kit_details[:misc])\n parts_arr.push(*mmt_kit_details[:parts])\n quantity_arr.push(*mmt_kit_details[:quantity])\n uom_arr.push(*mmt_kit_details[:uom])\n in_contract_arr.push(*mmt_kit_details[:in_contract_status])\n end\n kit_details = { :misc =>misc_arr,:parts=>parts_arr,:quantity => quantity_arr, :uom=> uom_arr, :in_contract_status =>in_contract_arr }\n else\n kit_details = Kitting::Kit.get_kit_data(kit_to_edit)\n end\n if updated_kit.present?\n kit_to_edit.update_attribute(\"description\", params[:new_desc])\n updated_kit.update_attribute(\"description\", params[:new_desc])\n flash[:success] = \"Description Updated Successfully For #{params[:kit_number]}\"\n redirect_to :back\n else\n if kit_details[:parts].present?\n contract_parts = []\n contract_misc = []\n contract_quantity = []\n contract_uom = []\n kit_details[:in_contract_status].each_with_index do |contract_status,index|\n if contract_status\n contract_parts << kit_details[:parts][index]\n contract_misc << kit_details[:misc][index]\n contract_quantity << kit_details[:quantity][index]\n contract_uom << kit_details[:uom][index]\n end\n end\n end\n check_kit = invoke_webservice method: \"get\", action: \"kitting\", query_string: { action: \"I\",custNo: current_user,kitStatuses: \"1,2\",kitNo: params[:kit_number].upcase }\n if check_kit && check_kit[\"errMsg\"].blank?\n @response = invoke_webservice method: 'post',action: 'kitting',\n data: {\n action: \"M\",\n custNo: current_user,\n user: session[:user_name],\n kitNo: kit_to_edit.kit_number.upcase,\n kitStatus: \"1\",\n kitLoc: kit_to_edit.bincenter,\n partNo: contract_parts,\n um: contract_uom,\n misc1: contract_misc,\n qty: contract_quantity,\n kitVer: \"001\",\n kitDesc: params[:new_desc],\n kitNotes: [kit_to_edit.notes.nil? ? \"\" : kit_to_edit.notes ]\n }\n if @response.present? && @response[\"errCode\"]==\"0\"\n kit_to_edit.update_attribute(\"description\", params[:new_desc])\n flash[:success] = \"Description Updated Successfully For #{params[:kit_number]}\"\n redirect_to :back\n else\n err_msg = @response[\"errMsg\"] if @response\n flash[:error] = err_msg || 'Service Temporarily Unavailable'\n redirect_to :back\n end\n else\n err_msg = check_kit[\"errMsg\"] if check_kit\n flash[:error] = err_msg || 'Service Temporarily Unavailable'\n redirect_to :back\n end\n end\n else\n flash[:error] = 'Kit Not Found'\n redirect_to :back\n end\n else\n flash[:error] = 'Kit Not Found'\n redirect_to :back\n end\n else\n flash[:error] = 'Kit Not Found'\n redirect_to :back\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def update\n respond_to do |format|\n if @description_of_pc.update(description_of_pc_params)\n format.html { redirect_to @description_of_pc, notice: 'Description of pc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @description_of_pc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @az_tr_text = AzTrText.find(params[:id])\n @title = 'Шаблон текста технического задания \"' + @az_tr_text.name + '\"'\n\n respond_to do |format|\n if @az_tr_text.update_attributes(params[:az_tr_text])\n format.html { redirect_to(@az_tr_text, :notice => 'Шаблон текста успешно изменен.') }\n format.xml { head :ok }\n else\n prepare_default_data()\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_tr_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_custom_text.update(api_v1_custom_text_params)\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_custom_text }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_custom_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @content = Content.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @content }\n end\n end", "def update_doi\n response = RestClient.post \"#{DoiConfig.url_for_updating_doi}#{doi}\", sanitize_data, :content_type => 'text/plain; charset=UTF-8', :content_length => sanitize_data.size, :accept => 'text/plain'\n return response\n end", "def update\n respond_to do |format|\n if @request_text.update(request_text_params)\n format.html { redirect_to @request_text, notice: 'Request text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package_description.update(:package_number => managed_params, :package_name=>params[:package_pack_type])\n format.html { redirect_to @package_description, notice: 'Package description was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_description }\n else\n format.html { render :edit }\n format.json { render json: @package_description.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalog_item.update(name: params[:name], description: params[:description])\n format.json { render json: @catalog_item }\n end\n end\n end", "def update\n respond_to do |format|\n if @interactivekit.update(interactivekit_params)\n format.html { redirect_to @interactivekit, notice: 'Interactivekit was successfully updated.' }\n format.json { render :show, status: :ok, location: @interactivekit }\n else\n format.html { render :edit }\n format.json { render json: @interactivekit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_description\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = \"Course updated Successfully\"\n else\n flash[:error] = \"An error occured!\"\n end\n format.html\n format.js\n end\n end", "def edit(&block)\n respond_with(entry, &block)\n end", "def update\n respond_to do |format|\n if @citation.update(citation_params)\n format.html { redirect_to @citation.citation_object.metamorphosize, notice: 'Citation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Citation was NOT successfully updated.' }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @richcontent = Richcontent.find(params[:id])\n\n respond_to do |format|\n if @richcontent.update_attributes(params[:richcontent])\n format.html { redirect_to(@richcontent, :notice => 'Richcontent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @richcontent.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @crit_note = CritNote.find(params[:id])\n\n respond_to do |format|\n if @crit_note.update_attributes(params[:crit_note])\n format.html { redirect_to(@crit_note, :notice => 'Crit note was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crit_note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_additional_description.update(admin_additional_description_params)\n format.html { redirect_to admin_products_path, notice: 'Additional description was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_additional_description }\n else\n format.html { render :edit }\n format.json { render json: @admin_additional_description.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @c_titul.update(c_titul_params)\n format.html { redirect_to @c_titul, notice: 'C titul was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @c_titul.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @description.update(description_params)\n format.html { redirect_to @description, notice: 'Description was successfully updated.' }\n format.json { render :show, status: :ok, location: @description }\n else\n format.html { render :edit }\n format.json { render json: @description.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @description.update(description_params)\n format.html { redirect_to @description, notice: 'Description was successfully updated.' }\n format.json { render :show, status: :ok, location: @description }\n else\n format.html { render :edit }\n format.json { render json: @description.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_info(info)\n puts Paint[\"Editing the info about: #{publisher.namespace}\", :blue]\n\n listing = Google::Apis::AndroidpublisherV2::Listing.new\n listing.full_description = info['full_description']\n listing.short_description = info['short_description']\n listing.title = info['title']\n listing.language = info['language']\n\n publisher.edit_info(listing)\n\n puts Paint['Alterações realizadas :)', :green]\n end", "def update\n @isncription = Isncription.find(params[:id])\n\n respond_to do |format|\n if @isncription.update_attributes(params[:isncription])\n format.html { redirect_to @isncription, notice: 'Isncription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @isncription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @description_template.update(description_template_params)\n format.html { redirect_to @description_template, notice: 'Description template was successfully updated.' }\n format.json { render :show, status: :ok, location: @description_template }\n else\n format.html { render :edit }\n format.json { render json: @description_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_description.update(admin_description_params)\n format.html { redirect_to @admin_description, notice: 'Description was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_description }\n else\n format.html { render :edit }\n format.json { render json: @admin_description.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef_att_deb.update(chef_att_deb_params)\n format.html { redirect_to @chef_att_deb, notice: 'Chef att deb was successfully updated.' }\n format.json { render :show, status: :ok, location: @chef_att_deb }\n else\n format.html { render :edit }\n format.json { render json: @chef_att_deb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @methodology.update(methodology_params)\n User.post_feed(current_user, \"#{current_user.full_name} editou uma metodologia - #{@methodology.title}\")\n format.html { redirect_to @methodology, notice: 'Metodologia atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @methodology.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coyote.update(coyote_params)\n format.html { redirect_to @coyote, notice: 'Coyote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_title\n @cookbook = current_cookbook\n end", "def update\n respond_to do |format|\n if @description.update(description_params)\n format.html do\n redirect_to @description,\n notice: 'Description was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @description }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @description.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def new\n @richcontent = Richcontent.new\n @richcontent.content_type = 2\n @richcontent.review_id = Review.find(params[:id]).id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @richcontent }\n end\n \n end", "def update\n @cut = Cut.find(params[:id])\n\n respond_to do |format|\n if @cut.update_attributes(params[:cut])\n format.html {render :template => 'shared/close', :layout => \"fancybox\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cut.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_scrap_topic\n if can_modify_scrap_topic?\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'edit_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n else\n render_401 and return\n end\n end", "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @convenience_item.update(convenience_item_params)\n format.html { redirect_to @convenience_item, notice: 'Convenience item was successfully updated.' }\n format.json { render :show, status: :ok, location: @convenience_item }\n else\n format.html { render :edit }\n format.json { render json: @convenience_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @knowledge.update(knowledge_params)\n format.html { redirect_to knowledges_path , notice: 'Área do conhecimento atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @knowledge }\n else\n format.html { render :edit }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @batale_text.update(batale_text_params)\n format.html { redirect_to @batale_text, notice: 'Texto editado com sucesso.' }\n format.json { render :show, status: :ok, location: @batale_text }\n else\n format.html { render :edit }\n format.json { render json: @batale_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def smart_edit(content_type=0,save_url)\n if content_type == 1\n render \"shared/wysihtml5_js\", {url: save_url}\n else\n render \"shared/autosave_js\", {url: save_url}\n end\n end", "def help_text\n options = {question_pairing_id: params[:question_pairing_id]}\n options[:disability_ids] = params[:disability_ids].split(',') if params[:disability_ids].present?\n\n @help_text = QuestionPairingDisability.with_names(options)\n\n respond_to do |format|\n format.html { render layout: 'fancybox'}\n format.json { render json: @data }\n end\n\n end", "def update_readme\n @provider = Provider.find(params[:provider_id])\n\n respond_to do |format|\n if @provider.readme.update_attributes(params[:readme])\n format.html { redirect_to provider_readme_url(@provider), notice: 'ReadMe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit_readme\" }\n format.json { render json: @readme.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n @snippet.text = ActionView::Base.full_sanitizer.sanitize(@snippet.content)\n format.html { redirect_to @snippet, notice: 'Snippet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tool_part.update_attributes(params[:tool_part])\n format.html { redirect_to @tool_part, notice: I18n.t('controllers.update_success', name: @tool_part.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tool_part.errors, status: :unprocessable_entity }\n format.xml { render xml: @tool_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @file_description.update(file_description_params)\n format.html { redirect_to @file_description, notice: 'File description was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_description }\n else\n format.html { render :edit }\n format.json { render json: @file_description.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def lget_body_json(cookbook_name, description=\"Please fill in the description.\")\n body = {\n \"name\" => cookbook_name,\n \"description\" => description,\n \"private\" => false,\n \"has_issues\" => true,\n \"has_wiki\" => true,\n \"has_downloads\" => true\n }.to_json\n end", "def edit\n @page_title = @content.locale_title(I18n.locale)\n @content.setup_uri_path # be sure to recover uri_path or scope will get messed up when the content is saved.\n respond_to do |format|\n format.html { render :template => @edit_template || 'contents/edit'}\n format.pjs { render :template => @edit_template || 'contents/edit', :layout => 'popup'}\n end\n end", "def update\n respond_to do |format|\n if @cetegory.update(cetegory_params)\n format.html { redirect_to @cetegory, notice: 'Cetegory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cetegory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to my_meals_path, notice: \"Chef was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end", "def new\n @crit_note = CritNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crit_note }\n end\n end", "def update\n respond_to do |format|\n if @tips_trick.update_attributes(params[:tips_trick])\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe.update(update_recipe_params)\n #if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'レシピが更新されました。' }\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 render_textarea_json(data)\n headers[\"Content-Type\"] = \"text/html; charset=utf-8\"\n render :text => \"<textarea>#{data.to_json}</textarea>\" \n end", "def update\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 { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customization.update(customization_params)\n format.html { redirect_to edit_customization_path(@customization), notice: 'Customization was successfully updated.' } \n else\n format.html { render :edit } \n end\n end\n end", "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Registro actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @choretype = Choretype.find(params[:id])\n\n respond_to do |format|\n if @choretype.update_attributes(params[:choretype])\n format.html { redirect_to @choretype, notice: 'Choretype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @choretype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @oncokb.update(oncokb_params)\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully updated.' }\n format.json { render :show, status: :ok, location: @oncokb }\n else\n format.html { render :edit }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef_specialty.update(chef_specialty_params)\n format.html { redirect_to @chef_specialty, notice: 'Chef specialty was successfully updated.' }\n format.json { render :show, status: :ok, location: @chef_specialty }\n else\n format.html { render :edit }\n format.json { render json: @chef_specialty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @desc = Desc.find(params[:id])\n\n respond_to do |format|\n if @desc.update_attributes(params[:desc])\n format.html { redirect_to @desc, notice: 'Desc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @desc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @textblock = Textblock.find(params[:id])\n\n respond_to do |format|\n if @textblock.update_attributes(params[:textblock])\n format.html { redirect_to(@textblock, :notice => 'Textblock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @textblock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @safe_cooking_temp.update(safe_cooking_temp_params)\n format.html { redirect_to @safe_cooking_temp, notice: 'Safe cooking temp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @safe_cooking_temp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n action_message_for(@guide.content_item.status)\n if update_guide\n format.html { redirect_to redirect_target(@guide), flash: @feedback_flash }\n format.json { render :show, status: :ok, location: @guide }\n else\n 1.times { @guide.sections.new } if @guide.subtype == 'detailed_guide'\n @guide.content_item.status = session[:content_item_status]\n format.html { render :edit }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poi_string_info.update(poi_string_info_params)\n format.html { redirect_to @poi_string_info, notice: 'Poi string info was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_string_info }\n else\n format.html { render :edit }\n format.json { render json: @poi_string_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(source)\n end", "def update\n news_topic_params[:context].gsub!(\"\\n\", '</br>')\n news_topic_params[:short_context].gsub!(\"\\n\", '</br>')\n\n respond_to do |format|\n if @news_topic.update(news_topic_params)\n format.html { redirect_to news_topics_path, :notice => 'News topic was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @news_topic }\n else\n format.html { render :edit }\n format.json { render :json => @news_topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @consumer_info.update(consumer_info_params)\n format.js { render_js_for_form @consumer_info, consumer_infos_path, '客户信息新建成功!' }\n else\n format.html { render :edit }\n format.json { render json: @consumer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def readme\n @provider = Provider.find(params[:provider_id])\n @readme=@provider.readme\n respond_to do |format|\n format.html\n format.json { render json: @readme }\n end\n end", "def edit\n respond_with(@sicoss_situation)\n end", "def set_time_entry_description\n data=params\n @time_entry = TneInvoiceTimeEntry.find(data[:id])\n @time_entry.update_attribute(:description,data[:value])\n render :text => @time_entry.description\n end", "def update\n respond_to do |format|\n if @hack_tip.update(hack_tip_params)\n format.html { redirect_to @hack_tip, notice: 'Hack tip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hack_tip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'La recette a été mise à jour.' }\n else\n format.html { render :edit }\n end\n end\n end", "def edit\n respond_with(@sicoss_location)\n end", "def update\n # respond_to do |format|\n # if @attention.update(attention_params)\n # format.html { redirect_to @attention, notice: 'Attention was successfully updated.' }\n # format.json { render :show, status: :ok, location: @attention }\n # else\n # format.html { render :edit }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @book_catalog_entrie = BookCatalogEntrie.find(params[:id])\n\n respond_to do |format|\n if @book_catalog_entrie.update_attributes(params[:book_catalog_entrie])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @crit_note = CritNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_note }\n end\n end", "def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end", "def update\n respond_to do |format|\n if @contraindication.update(contraindication_params)\n format.html { redirect_to @contraindication, notice: 'Contraindication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contraindication.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.59516615", "0.59106183", "0.5907394", "0.57482374", "0.5710021", "0.567092", "0.56481665", "0.56384623", "0.563044", "0.5624531", "0.5585982", "0.55820984", "0.557699", "0.55722475", "0.5553311", "0.55373937", "0.5483171", "0.54820913", "0.547613", "0.547613", "0.54696006", "0.5465436", "0.5409239", "0.5384436", "0.5378815", "0.53769886", "0.53742903", "0.53595084", "0.5358938", "0.53521043", "0.5351226", "0.53393215", "0.53171307", "0.5315092", "0.53102314", "0.5309102", "0.53075737", "0.5305417", "0.52905846", "0.5284373", "0.52777994", "0.52764934", "0.52764934", "0.5270828", "0.52627116", "0.525848", "0.5250232", "0.5247888", "0.5246719", "0.5245711", "0.5239575", "0.5234158", "0.5233611", "0.5228564", "0.52220225", "0.5221822", "0.52210915", "0.52201104", "0.5219805", "0.52190304", "0.521409", "0.52130175", "0.5210847", "0.5209771", "0.5208344", "0.52072376", "0.5197001", "0.5196823", "0.51920503", "0.51910996", "0.5187532", "0.5184774", "0.51823306", "0.5176344", "0.5175446", "0.517156", "0.51711583", "0.5169149", "0.5166143", "0.51655805", "0.516434", "0.51640034", "0.51561254", "0.51553255", "0.51507527", "0.5149024", "0.51458", "0.5142517", "0.51421136", "0.51404464", "0.5139739", "0.5134197", "0.51307136", "0.51286685", "0.5120869", "0.5119531", "0.51188195", "0.51163566", "0.51113373", "0.5107978", "0.51044035" ]
0.0
-1
Update the cookbook attributes.
def update @cookbook = current_cookbook # Process Paperclip attachments @cookbook.process_attachments(params) if @cookbook.update_attributes_individually params[:cookbook] flash[:notice] = 'The template was updated.' end respond_to do |format| format.js { render :update, content_type: "text/plain" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookbook_attribute\n run_context.cookbook_collection.each do |cookbook_name, cookbook|\n automatic_attrs[:cookbooks][cookbook_name][:version] = cookbook.version\n end\n end", "def update_appd_cookbook\n @ssh.exec! \"cd #{APPD_COOKBOOK_PATH}; git pull origin master\", sudo: true\n chef_exec \"berks install --path #{@cookbook_path.first} --berksfile #{APPD_COOKBOOK_PATH}/Berksfile\"\n end", "def chef_set_client_attributes(name, attributes={})\n @chef_client_attributes = (@chef_client_attributes || {}).merge(attributes) { |k,o,n| (k = (o + n)) }\n end", "def update_attribute(attr_name, attr_value)\n update_attributes(attr_name => attr_value)\n end", "def update_cookbooks()\n self.resolver.debug = self.options[:debug]\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running Librarian to download necessary cookbooks.\"\n\tself.normaldo self.resolver.fetch_dependencies()\n\t#self.normaldo \"bin/librarian-chef install --clean #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n if self.options[:update_cookbooks]\n\tKitchenplan::Log.info \"Updating cookbooks with #{self.resolver.name}\"\n\tself.normaldo self.resolver.update_dependencies()\n\t#self.normaldo \"bin/librarian-chef update #{(self.options[:debug] ? '--verbose' : '--quiet')}\"\n end\n end", "def update_attributes(attribs = {})\n attribs.each { |name, value| write_attribute(name, value) }\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n end", "def load_attributes()\n recipes, default_attrs, override_attrs = expand_node\n\n @cookbook_loader.each do |cookbook|\n cookbook.load_attributes(@node)\n end\n\n true\n end", "def check_for_old_attributes!\n unless node['build_essential'].nil?\n Chef::Log.warn <<-EOH\nnode['build_essential'] has been changed to node['build-essential'] to match the\ncookbook name and community standards. I have gracefully converted the attribute\nfor you, but this warning and conversion will be removed in the next major\nrelease of the build-essential cookbook.\nEOH\n node.default['build-essential'] = node['build_essential']\n end\n\n unless node['build-essential']['compiletime'].nil?\n Chef::Log.warn <<-EOH\nnode['build-essential']['compiletime'] has been deprecated. Please use\nnode['build-essential']['compile_time'] instead. I have gracefully converted the\nattribute for you, but this warning and converstion will be removed in the next\nmajor release of the build-essential cookbook.\nEOH\n node.default['build-essential']['compile_time'] = node['build-essential']['compiletime']\n end\n end", "def new_attributes(name, library)\n (library.commands_hash[name] || {}).merge(name: name).\n update(library_attributes(library))\n end", "def update_cookbooks()\n self.resolver.config_dir = self.options[:config_dir] ? self.options[:config_dir] : Dir.pwd\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running #{self.resolver.name} to download necessary cookbooks.\"\n\tself.platform.normaldo self.resolver.fetch_dependencies()\n end\n if self.options[:update_cookbooks]\n\tKitchenplan::Log.info \"Updating cookbooks with #{self.resolver.name}\"\n\tself.platform.normaldo self.resolver.update_dependencies()\n end\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @usage_info = args[:usage_info] if args.key?(:usage_info)\n end", "def update!(**args)\n @crowding_attribute = args[:crowding_attribute] if args.key?(:crowding_attribute)\n end", "def update!(**args)\n @crowding_attribute = args[:crowding_attribute] if args.key?(:crowding_attribute)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def updated_cookbook_file(cookbook_name, path)\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attr_value = args[:attr_value] if args.key?(:attr_value)\n end", "def scaffold_update_attributes(object, attributes)\n scaffold_set_attributes(object, scaffold_filter_attributes(:edit, attributes))\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update_attributes(attrs)\n self.attributes = attrs\n save\n end", "def update_attributes(atts)\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def update_attributes!(args = {})\n assign_attributes(args)\n save!\n end", "def update_attributes(args = {})\n assign_attributes(args)\n save\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def owncloud_config_update\n owncloud_config.merge(owncloud_cookbook_config)\n owncloud_config.write\n owncloud_config\n end", "def sync_volume_attributes\n step(\" updating volume attributes\")\n end", "def update!(**args)\n @attribute = args[:attribute] if args.key?(:attribute)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def _update_chef_node\n step(\" updating chef node\", :blue)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_admin.put_rest(\"nodes/#{@chef_node.name}\", @chef_node)\n end", "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n save\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update!(**args)\n @enable_feature_attributes = args[:enable_feature_attributes] if args.key?(:enable_feature_attributes)\n @explanation_baseline = args[:explanation_baseline] if args.key?(:explanation_baseline)\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update!(**args)\n @attribute_protos = args[:attribute_protos] if args.key?(:attribute_protos)\n end", "def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def compile_attributes\n events.attribute_load_start(count_files_by_segment(:attributes, \"attributes.rb\"))\n cookbook_order.each do |cookbook|\n load_attributes_from_cookbook(cookbook)\n end\n events.attribute_load_complete\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\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 update_attributes(data)\n\n unless data.nil?\n @attr_list.each do |attr|\n data.has_key?(attr) ? value = data[attr].to_s : value = ''\n self.__send__((\"#{attr}=\"), value)\n end\n end\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def update_attribute\n end", "def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end", "def update_attributes(attributes)\n assign_attributes attributes\n save\n end", "def update_resource(object, attributes)\n object.update(*attributes)\n end", "def update!\n parse\n return true if skipped?\n attributes = Attributes.new klass, @blocks[:attributes]\n attributes.update!\n @blocks[:attributes] = attributes.lines\n update_file\n end", "def update!(**args)\n @attribute_count = args[:attribute_count] if args.key?(:attribute_count)\n @create_time = args[:create_time] if args.key?(:create_time)\n @data_access_spec = args[:data_access_spec] if args.key?(:data_access_spec)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @parent_id = args[:parent_id] if args.key?(:parent_id)\n @resource_access_spec = args[:resource_access_spec] if args.key?(:resource_access_spec)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update_attribute(key, value)\n self.update_attributes(key => value)\n end", "def attributes=(should)\n connect unless @connection\n case @resource[:entry_management]\n when :inclusive\n Puppet.debug(\"Replacing entire #{@resource[:name]} entry\")\n data = should\n data['objectclass'] = @resource[:objectclass]\n @connection.delete(:dn => @resource[:name])\n @connection.add(:dn => @resource[:name], :attributes => data)\n when :minimal\n attributes_to_update.each do |k, v|\n Puppet.debug(\"Updating #{k} with #{v} for entry #{@resource[:name]}\")\n @connection.modify(:dn => @resource[:name], :operations => [[ :replace, k.to_sym, v ]])\n end\n end\n end", "def update_attributes(attributes)\n attributes, rdf_attributes = extract_attributes!(attributes)\n rdf_attributes.each do |k,v|\n send(k + \"=\", v)\n send('save_' + k)\n end\n end", "def resource_update\n @new_name = @data.delete('new_name')\n @item = @resource_type.new(@client, @data)\n return false unless @item.retrieve!\n parse_new_name\n if @item.like?(@data)\n Puppet.notice \"#{@resource_type} #{@data['name']} is up to date.\"\n else\n Puppet.notice \"#{@resource_type} #{@data['name']} differs from resource in appliance.\"\n Puppet.debug \"Current attributes: #{JSON.pretty_generate(@item.data)}\"\n Puppet.debug \"Desired attributes: #{JSON.pretty_generate(@data)}\"\n @item.update(@data)\n @property_hash[:data] = @item.data\n end\n true\nend", "def update!(**args)\n @attribute_key = args[:attribute_key] if args.key?(:attribute_key)\n @attribute_value = args[:attribute_value] if args.key?(:attribute_value)\n end", "def update_attributes(attributes = {})\n raise ArgumentError.new(\"Cannot set attributes on new record\") if @label.to_s.empty?\n \n attributes.each do |k,v|\n if [\"status\", \"sync_period\", \"service_level\", \"password\", \"provider_token\", \"provider_token_secret\", \"provider_consumer_key\"].include? k\n send(\"#{k}=\", v)\n end\n end\n update_record\n end", "def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end", "def update!(**args)\n @bid_modifier = args[:bid_modifier] if args.key?(:bid_modifier)\n @device = args[:device] if args.key?(:device)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update(resource, attributes = {})\n resource.client = self\n resource.update(attributes)\n end", "def update_attributes!(attributes)\n assign_attributes attributes\n save!\n end", "def update_attributes(attributes)\n update_attributes!(attributes)\n rescue AnsibleTowerClient::Error\n false\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @attribute_name = args[:attribute_name] if args.key?(:attribute_name)\n @attribute_value = args[:attribute_value] if args.key?(:attribute_value)\n @section_name = args[:section_name] if args.key?(:section_name)\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def update_attributes(atts)\n atts.delete('_type')\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def update!(**args)\n @conflation_method = args[:conflation_method] if args.key?(:conflation_method)\n @description = args[:description] if args.key?(:description)\n @key = args[:key] if args.key?(:key)\n @label = args[:label] if args.key?(:label)\n end", "def update!(**args)\n @attribute_resources = args[:attribute_resources] if args.key?(:attribute_resources)\n @category = args[:category] if args.key?(:category)\n @data_type = args[:data_type] if args.key?(:data_type)\n @enum_values = args[:enum_values] if args.key?(:enum_values)\n @filterable = args[:filterable] if args.key?(:filterable)\n @is_repeated = args[:is_repeated] if args.key?(:is_repeated)\n @metrics = args[:metrics] if args.key?(:metrics)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @segments = args[:segments] if args.key?(:segments)\n @selectable = args[:selectable] if args.key?(:selectable)\n @selectable_with = args[:selectable_with] if args.key?(:selectable_with)\n @sortable = args[:sortable] if args.key?(:sortable)\n @type_url = args[:type_url] if args.key?(:type_url)\n end", "def update_attributes(attributes={})\n attributes = convert_attributes(attributes)\n \n attributes.each { |name, value| send( \"#{name}=\", value ) }\n end", "def update\n @attribute_master.update(attribute_master_params)\n @attribute_masters = AttributeMaster.all \n @attribute_master = AttributeMaster.new \n end", "def update(attributes)\n @name = attributes.fetch('name')\n @id = self.id\n DB.exec(\"UPDATE stylists SET name = '#{@name}' WHERE id = #{@id};\")\n end", "def update_attributes(attributes = nil)\r\n self.attributes = attributes\r\n save\r\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end", "def update!(**args)\n @attribute_count = args[:attribute_count] if args.key?(:attribute_count)\n @class_count = args[:class_count] if args.key?(:class_count)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update_attributes!(attributes = nil)\r\n self.attributes = attributes\r\n save!\r\n end", "def update\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n if @catalog_product_attributes.update_attributes(params[:catalog_product_attributes])\n flash[:notice] = 'CatalogProductAttributes was successfully updated.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_cookbook_path\n # both cookbook sequences and paths are listed in same order as\n # presented in repo UI. previous to RL v5.7 we received cookbook sequences\n # in an arbitrary order, but this has been fixed as of the release of v5.8\n # (we will not change the order for v5.7-).\n # for chef to execute repos and paths in the order listed, both of these\n # ordered lists need to be inserted in reverse order because the chef code\n # replaces cookbook paths as it reads the array from beginning to end.\n @cookbooks.reverse.each do |cookbook_sequence|\n local_basedir = File.join(@download_path, cookbook_sequence.hash)\n cookbook_sequence.paths.reverse.each do |path|\n dir = File.expand_path(File.join(local_basedir, path))\n unless Chef::Config[:cookbook_path].include?(dir)\n if File.directory?(dir)\n Chef::Config[:cookbook_path] << dir\n else\n RightScale::Log.info(\"Excluding #{path} from chef cookbooks_path because it was not downloaded\")\n end\n end\n end\n end\n RightScale::Log.info(\"Updated cookbook_path to: #{Chef::Config[:cookbook_path].join(\", \")}\")\n true\n end", "def update_cookbooks(timeout = 150)\n puts 'Updating cookbooks'.light_white.bold\n create_deployment({name: 'update_custom_cookbooks'}, nil, timeout)\n end", "def update!(**args)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @boot_disk_type = args[:boot_disk_type] if args.key?(:boot_disk_type)\n end", "def update(attributes = {})\n self.attributes = attributes\n self.save\n end", "def update!(**args)\n @release_ready_condition = args[:release_ready_condition] if args.key?(:release_ready_condition)\n @skaffold_supported_condition = args[:skaffold_supported_condition] if args.key?(:skaffold_supported_condition)\n end", "def update(attributes)\n assign_attributes(attributes)\n save\n end", "def update\n Puppet.debug(\"Debconf: updating #{resource[:name]}\")\n\n # Build the string to send\n args = [:package, :item, :type, :value].map { |e| resource[e] }.join(' ')\n\n IO.popen('/usr/bin/debconf-set-selections', 'w+') do |pipe|\n Puppet.debug(\"Debconf: debconf-set-selections #{args}\")\n pipe.puts(args)\n\n # Ignore remaining output from command\n pipe.close_write\n pipe.read(nil)\n end\n end", "def update_attribute(attribute, attribute_type, value)\n\t\tresults = submit_cmd('update app attribute',:db, \"-env #{self.belongs_to.env} \\\n -app_instance #{self.name} -attribute #{attribute} -attribute_type #{attribute_type} \\\n -new_value #{value}\")\n\t \n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \traise \"update attribute failed\" \n\t else\n\t \tself.attributes[attribute.intern] = value\n\t end\n\tend", "def set_node_attributes(job)\n return if node_attributes.empty?\n\n nodes.concurrent_map do |node|\n node.reload\n\n node_attributes.each do |attribute|\n key, value, options = attribute[:key], attribute[:value], attribute[:options]\n\n if options[:toggle]\n original_value = node.chef_attributes.dig(key)\n\n toggle_callbacks << ->(job) {\n message = if original_value.nil?\n \"Toggling off node attribute '#{key}' on #{node.name}\"\n elsif !options[:force_value_to].nil?\n \"Forcing node attribute to '#{options[:force_value_to]}' on #{node.name}\"\n else\n \"Toggling node attribute '#{key}' back to '#{original_value.inspect}' on #{node.name}\"\n end\n job.set_status(message)\n value_to_set = options[:force_value_to].nil? ? original_value : options[:force_value_to]\n node.set_chef_attribute(key, value_to_set)\n node.save\n }\n end\n\n job.set_status(\"Setting node attribute '#{key}' to #{value.inspect} on #{node.name}\")\n node.set_chef_attribute(key, value)\n end\n\n node.save\n end\n end", "def consume_attributes(attrs)\n normal_attrs_to_merge = consume_run_list(attrs)\n normal_attrs_to_merge = consume_chef_environment(normal_attrs_to_merge)\n # FIXME(log): should be trace\n logger.debug(\"Applying attributes from json file\")\n self.normal_attrs = Chef::Mixin::DeepMerge.merge(normal_attrs, normal_attrs_to_merge)\n tags # make sure they're defined\n end", "def update(attributes)\n self.attributes = process_attributes(attributes)\n save\n end", "def update_feature(feature_key, attributes)\n features[feature_key].update_attribute(attributes)\n save\n end", "def update!(**args)\n @category = args[:category] if args.key?(:category)\n @classifier_version = args[:classifier_version] if args.key?(:classifier_version)\n @taxonomy = args[:taxonomy] if args.key?(:taxonomy)\n @taxonomy_name = args[:taxonomy_name] if args.key?(:taxonomy_name)\n end", "def update!(**args)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @cpus = args[:cpus] if args.key?(:cpus)\n @enable_load_balancer = args[:enable_load_balancer] if args.key?(:enable_load_balancer)\n @image = args[:image] if args.key?(:image)\n @image_type = args[:image_type] if args.key?(:image_type)\n @labels = args[:labels] if args.key?(:labels)\n @memory_mb = args[:memory_mb] if args.key?(:memory_mb)\n @replicas = args[:replicas] if args.key?(:replicas)\n @taints = args[:taints] if args.key?(:taints)\n @vsphere_config = args[:vsphere_config] if args.key?(:vsphere_config)\n end", "def update!(attributes)\n assign_attributes(attributes)\n save!\n end" ]
[ "0.6996817", "0.639421", "0.6291651", "0.60460126", "0.6008001", "0.5998508", "0.5947056", "0.5924024", "0.59169406", "0.5898999", "0.58650047", "0.5859821", "0.58571523", "0.58571523", "0.5847785", "0.5847785", "0.5847785", "0.5847785", "0.5840827", "0.58240795", "0.5801777", "0.5788666", "0.5785744", "0.57853717", "0.57718325", "0.57622594", "0.57547355", "0.57367337", "0.5736378", "0.5734678", "0.5717735", "0.5709349", "0.5708913", "0.5704094", "0.56961095", "0.568878", "0.568878", "0.568878", "0.568878", "0.56854594", "0.5681092", "0.56609994", "0.5639556", "0.56352574", "0.56338793", "0.5622795", "0.5609185", "0.5595935", "0.55834043", "0.55834043", "0.55834043", "0.55790955", "0.5571743", "0.55710864", "0.55673206", "0.55668193", "0.5556201", "0.5551153", "0.5546984", "0.5544126", "0.55434275", "0.5543426", "0.55378234", "0.55374545", "0.5536999", "0.5532526", "0.55321676", "0.5531236", "0.5529765", "0.55296725", "0.55296725", "0.55277723", "0.55266035", "0.55227095", "0.55212116", "0.5519293", "0.5519132", "0.5508835", "0.55068874", "0.5501763", "0.5500756", "0.5497574", "0.54812074", "0.5478619", "0.546979", "0.54554063", "0.54508847", "0.54501206", "0.54492474", "0.54460037", "0.54387575", "0.54305494", "0.5426626", "0.54129636", "0.540948", "0.54018646", "0.53986186", "0.53910446", "0.53854483", "0.53795063" ]
0.54358226
91
Edit the cookbook title.
def edit_title @cookbook = current_cookbook end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_title\n @cookbook = current_cookbook\n @cookbook.title = params[:cookbook][:title]\n if @cookbook.save\n redirect_to templates_path, notice: \"Your Cookbook name has been changed!\"\n else\n render :edit_title\n end\n end", "def ctitle(title)\n self.title = title\n end", "def title=(title)\n @attributes.occi!.core!.title = title\n end", "def title=( new_title )\n if not @read_only\n @title = new_title\n end\n end", "def title=( new_title )\n unless @read_only\n @title = new_title\n end\n end", "def title=( new_title ) ##(main\n unless @read_only\n @title = new_title \n end \n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def title_set(title)\n self.sirname.set title\n end", "def set_title(title)\n @title = title\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n\t\t\t@title = value\n\t\tend", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def title(title)\n @title = title\n end", "def title(title)\n @title=title\n end", "def edit_book_title(selected)\n\tb = Book.find(selected)\n\tprint \"\\nTo edit the book title please enter here: \"\n\ttitle = gets.chomp\n\tb.update_attributes(title: title)\nend", "def title=(new_title)\n @title= Book.titleize(new_title)\n end", "def title=(value)\n write_attribute(:title, value.capitalize)\n end", "def book_choir\r\n\t@title = \"Book the Choir\"\r\n end", "def title(title)\n @item.title = title\n self\n end", "def title=(new_title = nil)\n @info[:Title] = new_title\n end", "def edit_title(article)\n capture do\n concat(\"#{:EDITING.l}: \")\n concat(show_title(article))\n end\n end", "def start_book_title(attributes)\n @mode = 'book-title' if @mode == 'book'\n end", "def title=(v)\n if @title != v\n @needs_commit = true\n @title = v\n end\n end", "def update_window_title(new_title)\n hc_main_view.title = new_title\n end", "def set_recipe_title\n @recipe_title = RecipeTitle.find(params[:id])\n end", "def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend", "def capitalize_title\n self.title = title.capitalize\n end", "def title=(title)\n if self.kind == TITLE && !title.blank? && title.first == \"\\r\"\n write_attribute(:title, \" #{title}\")\n else\n write_attribute(:title, title)\n end\n end", "def set_title_locally(title)\n @title = title\n end", "def edit\n @title = t 'oportunity.edit_title'\n end", "def title=(text); end", "def title=(text); end", "def edit_title_for(text, value)\n title I18n.t(\"backend.general.editForm\", :model => text.is_a?(String) ? text : text.send(:human_name), :value => value)\n end", "def setTitle (title)\n @title = title.to_s\n end", "def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end", "def title=(new_title)\n @title = new_title\n self.cache_object.title = new_title unless self.cache_object.nil?\n end", "def SetTitle(title)\n\t\t#Title of document\n\t\t@title = title\n\tend", "def title=(value)\n if value\n @title = value if value.is_a? String\n end\n end", "def title(title)\n filename(title)\n @methods[:title] = title\n end", "def title=(title)\n @attributes[:title] = title\n end", "def handle_title(name, attrs) \n \n end", "def title=(title)\n\t super(standardize_title(title))\n\t\t\t#self[:title] = title.strip\n\tend", "def retitle(retitle)\n @o_title = title\n @title = retitle.upcase\n conf_message(@o_title, \"retitled\")\n end", "def update!(**args)\n @new_title = args[:new_title] if args.key?(:new_title)\n @old_title = args[:old_title] if args.key?(:old_title)\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def title(new_title=nil)\n if new_title\n @title = new_title\n end\n Lolita::Utils.dynamic_string(@title, :default => @name && @dbi.klass.human_attribute_name(@name))\n end", "def title= title\n @title = title\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def title(val)\n args_def.title = val\n end", "def edit_article_title(article)\n capture do\n concat(\"#{:EDITING.l}: \")\n concat(show_article_title(article))\n end\n end", "def set_title\n @title = \"#{controller_name}.#{action_name}.title\"\n end", "def title=(title)\n title = nil unless title.present?\n settings.title = title\n end", "def update_help\n @help_window.set_item(title)\n end", "def title=(value)\n super(value)\n self.set_prefix\n return self.title\n end", "def title=(title)\n t = Title.new\n t.content = title\n self.dc_titles = [t]\n title\n end", "def edit_introduction\n @cookbook = current_cookbook\n end", "def title=( new_title )\nif @writable\n@title = new_title\nend\nend", "def add_title\n @bib.title.to_bibtex @item\n end", "def set(args, ac=true)\n super(args, ac)\n @title_label.value = @style[:title] if @title_label\n end", "def set(args, ac=true)\n super(args, ac)\n @title_label.value = @style[:title] if @title_label\n end", "def title(title = nil)\n @title = title if title\n @title\n end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def apply_updates_title(title)\n return if title.to_s.empty?\n\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /title\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"title %q{#{title}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end", "def capitalize_title\n self.title = title.capitalize if title.present?\n end", "def title(title)\n content_for(:title, title)\n end", "def edit\n @title = \"Edit user\"\n end", "def edit\n @title = \"Edit user\"\n end", "def title=(title)\n Element.attr self, 'title', title\n end", "def setTitle(title)\n if title\n DOM.setAttribute(@element, \"title\", title)\n else\n DOM.removeAttribute(@element, \"title\")\n end\n end", "def title=(new_title)\n write_attribute(:permalink, Permalink.from(new_title)) unless self.custom_permalink?\n write_attribute(:title, new_title)\n end", "def set_name_title\n @name_title = NameTitle.find(params[:id])\n end", "def title=(new_title)\n new_title.capitalize!\n arr = ['over', 'the', 'and', 'in', 'of', 'a', 'an']\n @title = new_title.split(' ').map! { |word| arr.include?(word) ? word : word.capitalize }.join(' ')\n end", "def title\n end", "def titlecase_title\n self.title=(title().titlecase())\n end", "def update_title( doc_id:, title: )\n send_request :post, \"document/#{@app}/#{doc_id}/title/#{URI.escape title}\", {}, :json\n end", "def title=(title)\n title = nil if title.blank?\n @settings.title = title\n end", "def titlecase_title\n self.title = self.title.titlecase\n end", "def title(*args, &block)\n element.title(*args, &block)\n end", "def title(title_name)\n h.content_tag :h2 do\n title_name.present? ? title_name : \"Perfis\"\n end\n end", "def title=(args)\n unless args.is_a?(String) || args.is_a?(Array)\n raise ArgumentError, \"You must provide a string or an array. You provided #{args.inspect}\"\n end\n args = Array(args)\n if args.first.is_a?(String)\n return if args == [''] \n args.each do |title_name|\n self.title_attributes = [{value: title_name, title_type: \"Program\"}]\n end\n else\n descMetadata.title=args\n end\n end" ]
[ "0.80122495", "0.72350585", "0.713863", "0.70878845", "0.70584404", "0.7019702", "0.6919573", "0.6919573", "0.6901882", "0.6879555", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.68733776", "0.6863989", "0.6863989", "0.6863989", "0.6863989", "0.6863989", "0.6863989", "0.6863989", "0.6851898", "0.68419147", "0.68390554", "0.6832685", "0.68025595", "0.67979413", "0.67932004", "0.67507774", "0.6734512", "0.6731453", "0.6721435", "0.6693534", "0.6685", "0.6674717", "0.66624624", "0.6643414", "0.66077864", "0.6574154", "0.65721285", "0.65336925", "0.6482679", "0.6482679", "0.6480642", "0.6470699", "0.6438906", "0.6420631", "0.64179754", "0.6410251", "0.6392718", "0.63916373", "0.6373359", "0.63660264", "0.6342376", "0.6338355", "0.6334889", "0.63258064", "0.631996", "0.63157237", "0.63157237", "0.63157237", "0.63157237", "0.63157237", "0.6315205", "0.63113356", "0.6306035", "0.6305431", "0.6303896", "0.62971383", "0.6270235", "0.6267439", "0.62630534", "0.62616307", "0.6239852", "0.6239852", "0.6232708", "0.6229885", "0.6223242", "0.6213875", "0.6213324", "0.62104094", "0.62104094", "0.6191082", "0.6190727", "0.61600417", "0.6155277", "0.6150866", "0.6149386", "0.6142234", "0.6128008", "0.6104063", "0.61019045", "0.6098805", "0.60954297", "0.6094399" ]
0.8330037
0
Update the cookbook title
def update_title @cookbook = current_cookbook @cookbook.title = params[:cookbook][:title] if @cookbook.save redirect_to templates_path, notice: "Your Cookbook name has been changed!" else render :edit_title end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_title\n @cookbook = current_cookbook\n end", "def ctitle(title)\n self.title = title\n end", "def title=(title)\n @attributes.occi!.core!.title = title\n end", "def update_window_title(new_title)\n hc_main_view.title = new_title\n end", "def title=(v)\n if @title != v\n @needs_commit = true\n @title = v\n end\n end", "def title=( new_title ) ##(main\n unless @read_only\n @title = new_title \n end \n end", "def title_set(title)\n self.sirname.set title\n end", "def title=( new_title )\n if not @read_only\n @title = new_title\n end\n end", "def title=(value)\n write_attribute(:title, value.capitalize)\n end", "def title=( new_title )\n unless @read_only\n @title = new_title\n end\n end", "def book_choir\r\n\t@title = \"Book the Choir\"\r\n end", "def set_title(title)\n @title = title\n end", "def title(title)\n @title = title\n end", "def title(title)\n @title=title\n end", "def title=(new_title)\n @title= Book.titleize(new_title)\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n\t\t\t@title = value\n\t\tend", "def capitalize_title\n self.title = title.capitalize\n end", "def start_book_title(attributes)\n @mode = 'book-title' if @mode == 'book'\n end", "def set_title_locally(title)\n @title = title\n end", "def title(title)\n @item.title = title\n self\n end", "def title=(new_title = nil)\n @info[:Title] = new_title\n end", "def set_recipe_title\n @recipe_title = RecipeTitle.find(params[:id])\n end", "def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend", "def add_title\n @bib.title.to_bibtex @item\n end", "def title=(new_title)\n @title = new_title\n self.cache_object.title = new_title unless self.cache_object.nil?\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def title=(text); end", "def title=(text); end", "def apply_updates_title(title)\n return if title.to_s.empty?\n\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /title\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"title %q{#{title}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end", "def setTitle (title)\n @title = title.to_s\n end", "def update_pr_title(title)\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n api.update_pull_request(@repo, @number, title: title)\n end", "def title=(title)\n if self.kind == TITLE && !title.blank? && title.first == \"\\r\"\n write_attribute(:title, \" #{title}\")\n else\n write_attribute(:title, title)\n end\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @title = args[:title] if args.key?(:title)\n end", "def edit_book_title(selected)\n\tb = Book.find(selected)\n\tprint \"\\nTo edit the book title please enter here: \"\n\ttitle = gets.chomp\n\tb.update_attributes(title: title)\nend", "def title(new_title=nil)\n if new_title\n @title = new_title\n end\n Lolita::Utils.dynamic_string(@title, :default => @name && @dbi.klass.human_attribute_name(@name))\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def update!(**args)\n @new_title = args[:new_title] if args.key?(:new_title)\n @old_title = args[:old_title] if args.key?(:old_title)\n end", "def title=(title)\n t = Title.new\n t.content = title\n self.dc_titles = [t]\n title\n end", "def retitle(retitle)\n @o_title = title\n @title = retitle.upcase\n conf_message(@o_title, \"retitled\")\n end", "def title\n\t\tbase_title = \"Black Market Books\"\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_title\n @title = \"#{controller_name}.#{action_name}.title\"\n end", "def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end", "def capitalize_title\n self.title = title.capitalize if title.present?\n end", "def title(title)\n filename(title)\n @methods[:title] = title\n end", "def title=(value)\n super(value)\n self.set_prefix\n return self.title\n end", "def title=(title)\n @attributes[:title] = title\n end", "def title=(title)\n\t super(standardize_title(title))\n\t\t\t#self[:title] = title.strip\n\tend", "def populate_title\n if self.title.blank?\n self.title = self.file_file_name.blank? ? \"\" : self.file_file_name.gsub(/_/, \" \").capitalize\n end\n\tend", "def SetTitle(title)\n\t\t#Title of document\n\t\t@title = title\n\tend", "def title= title\n @title = title\n end", "def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end", "def update_help\n @help_window.set_item(title)\n end", "def title=(value)\n if value\n @title = value if value.is_a? String\n end\n end", "def title(title = nil)\n @title = title if title\n @title\n end", "def update_title( doc_id:, title: )\n send_request :post, \"document/#{@app}/#{doc_id}/title/#{URI.escape title}\", {}, :json\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\n else\n self.title = \"Untitled 1\"\n end\n else\n self.title = \"Untitled 1\"\n end\n end\n end", "def handle_title(name, attrs) \n \n end", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def setup\n @base_title = \"BookRecommender\"\n end", "def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end", "def title=(new_title)\n write_attribute(:permalink, Permalink.from(new_title)) unless self.custom_permalink?\n write_attribute(:title, new_title)\n end", "def set(args, ac=true)\n super(args, ac)\n @title_label.value = @style[:title] if @title_label\n end", "def set(args, ac=true)\n super(args, ac)\n @title_label.value = @style[:title] if @title_label\n end", "def title(val)\n args_def.title = val\n end", "def titlecase_title\n self.title=(title().titlecase())\n end", "def define_title\n @title = @deal.title\n @description = @deal.title + ' - ' + Deal.i18n_category(@deal.category)\n end", "def titlecase_title\n self.title = self.title.titlecase\n end", "def title\n \"#{artist.name} - #{name} [#{release.catalog_number}]\"\n end", "def update_project\n project.update_title\n end", "def title=( new_title )\nif @writable\n@title = new_title\nend\nend", "def set_title\n @title = File.basename(@absolute_path)\n @title.sub!(/^[0-9][0-9]-/, '')\n @title.gsub!(/_/, ' ')\n @title.gsub!(/-/, ', ')\n end", "def title=(title)\n title = nil unless title.present?\n settings.title = title\n end", "def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end", "def add_booktitle\n included_in = @bib.relation.detect { |r| r.type == \"includedIn\" }\n return unless included_in\n\n @item.booktitle = included_in.bibitem.title.first.title\n end", "def title=(new_title)\n new_title.capitalize!\n arr = ['over', 'the', 'and', 'in', 'of', 'a', 'an']\n @title = new_title.split(' ').map! { |word| arr.include?(word) ? word : word.capitalize }.join(' ')\n end", "def setTitle(title)\n if title\n DOM.setAttribute(@element, \"title\", title)\n else\n DOM.removeAttribute(@element, \"title\")\n end\n end", "def title=(string)\n @title ||= string\n end" ]
[ "0.77194446", "0.7060066", "0.69450605", "0.6818465", "0.6657042", "0.66266453", "0.6600145", "0.6594344", "0.6585583", "0.65775865", "0.6567257", "0.6566344", "0.6553564", "0.6546017", "0.65452695", "0.65447783", "0.65447783", "0.65447783", "0.65447783", "0.65447783", "0.65447783", "0.65447783", "0.6530692", "0.6529052", "0.65037364", "0.64763844", "0.6460463", "0.64556104", "0.6439286", "0.64206225", "0.6418769", "0.6382618", "0.6332099", "0.63046795", "0.63046795", "0.63006264", "0.62879056", "0.62832475", "0.6275644", "0.62357527", "0.62357527", "0.62357527", "0.62357527", "0.62357527", "0.62338924", "0.62296104", "0.6220069", "0.6220069", "0.6205264", "0.6196995", "0.6194815", "0.6190485", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61874396", "0.61778", "0.6174751", "0.61729896", "0.6151481", "0.61424416", "0.61343795", "0.61049896", "0.6094108", "0.6091316", "0.6085351", "0.60838246", "0.6076417", "0.6074017", "0.60737294", "0.6066486", "0.6063157", "0.6058847", "0.60554165", "0.60528946", "0.6038321", "0.6036967", "0.6032526", "0.60190934", "0.60119617", "0.60119617", "0.6005503", "0.6001409", "0.59922814", "0.5981702", "0.59771746", "0.5968307", "0.59600335", "0.59592164", "0.5956078", "0.5954398", "0.59537065", "0.5949987", "0.59301436", "0.5928618" ]
0.7828986
0
Edit the cookbook introduction
def edit_introduction @cookbook = current_cookbook end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_introduction\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n\n if params[:cookbook]\n @cookbook.intro_type = params[:cookbook][:intro_type] if params[:cookbook][:intro_type]\n @cookbook.center_introduction = params[:cookbook][:center_introduction] if params[:cookbook][:center_introduction]\n @cookbook.intro_text = params[:cookbook][:intro_text] if params[:cookbook][:intro_text]\n @cookbook.intro_image_grayscale = params[:cookbook][:intro_image_grayscale] if params[:cookbook][:intro_image_grayscale]\n @cookbook.intro_image = params[:cookbook][:intro_image] if !params[:cookbook][:intro_image].nil?\n\n # If the user has checked the \"Do not include this page\" checkbox, set the intro_type do '2'\n @cookbook.intro_type = 2 if params[:do_not_include]\n @cookbook.intro_type = 0 if !params[:do_not_include] && @cookbook.intro_type == 2\n end\n\n if @cookbook.save\n flash[:notice] = 'The introduction of your cookbook was saved.'\n end\n respond_to do |format|\n format.js { render :update_introduction, content_type: \"text/plain\" }\n end\n end", "def introduction\r\n\r\n end", "def edit_title\n @cookbook = current_cookbook\n end", "def update_help\n @help_window.set_item(recipe)\n @ingredient_window.recipe = recipe\n end", "def introduction(&proc)\n @introduction = proc\n end", "def editintro(value)\n merge(editintro: value.to_s)\n end", "def elearning\n @title = \"e-Learning\"\n end", "def intro()\n show do\n title \"Introduction - Illumina RNA Seq Library Prep\"\n separator\n note \"This is the first step in the: <a href=https://support.illumina.com/downloads/truseq_stranded_total_rna_sample_preparation_guide_15031048.html>Illumina TruSeq Stranded Total RNA with RiboZero Guide</a>\"\n note \"In this protocol, you will be depleting the abundant ribosomal RNA from your sample.\"\n note \"Then, you will be chemically fragmenting the depleted RNA, since the Illumina platform is optimized for short reads.\"\n note \"<b>1.</b> Deplete riboRNA\"\n note \"<b>2.</b> Isolate & Wash Depleted RNA\"\n note \"<b>3.</b> Chemically Fragment RNA\"\n end\n end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n date = Date.parse(intro.elements[0].text).to_s\n devices = generate_table(intro.elements[1].elements)\n security_issue_overview = {}\n intro.elements[2].elements[1..4].map do |issue|\n security_issue_overview[issue['title']] = issue.text\n end\n rating = generate_table(intro.elements[3].elements[2].elements[1].elements)\n\n Introduction.new(\n index, title, reference, date, devices,\n security_issue_overview, rating\n )\n end", "def intro()\n show do\n title \"Introduction - RNA Quality Control\"\n separator\n note \"In this protocol you will prepare <a href=https://www.labviva.com/pub/static/frontend/Ueg/new/en_US/images/docs/HB-2326-001_1105695_IAS_QX_RNA_Quality_Control_0117_WW.pdf>RNA samples for analysis on the QIAxcel Bioanalyzer</a>.\"\n note \"1. Gather materials and reagents\"\n note \"2. Mix and place samples on thermocycler\"\n note \"3. Dilute\"\n end\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @guidelines = args[:guidelines] if args.key?(:guidelines)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @guidelines = args[:guidelines] if args.key?(:guidelines)\n end", "def add(name)\n @cookbook.add_recipe(name)\n end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n devices = generate_table(intro.elements[1].elements)\n\n Introduction.new(index, title, reference, devices)\n end", "def texte_aide\n <<-EOT\n=== Aide pour les tâches ===\\033[0m\n\nAjouter une tâche (avec ou sans description)\n #{jaune('add \"<tâche>\"[ \"description\"][ <priorité>]')}\n La priorité est un nombre de 0 (aucune priorité) à\n 9 (priorité maximale).\n\nMarquer une tâche finie\n #{jaune('close/done <id tâche>')}\n\nVoir toutes les informations de la tâche\n #{jaune('show <id tâche>')}\n\n(Re)définir les attributs d'une tâche\n #{jaune('set <id tâche> m=\"contenu\" d=\"description\" p=[0-9]')}\n p pour la priorité (0 par défaut)\n\nDétruire une tâche\n #{jaune('remove/delete <id tâche>')}\n\nQuitter\n #{jaune('q/quit/quitter')}\n\n EOT\n end", "def about\n require \"github/markup\"\n @readme = GitHub::Markup.render(\"README.md\", File.read(\"README.md\")).html_safe\n end", "def introduction\n puts \"1. Create a customer account\\n2. Choose active customer\\n3. Create a payment option\\n4. Add product to sell\\n5. Add product to shopping cart\\n6. Complete an order\\n7. Remove customer product\\n8. Update product information\\n9. Show stale products\\n10. Show customer revenue report\\n11. Show overall product popularity\\n12. Leave Bangazon!\"\n end", "def update_readme\n snippet = <<~CODE\n <tr>\n <td>DATABASE_URL</td>\n <td>Yes</td>\n <td>\n `sqlite3:db/test.db` (for the test environment <em>only</em>)\n </td>\n <td>\n Connection URL to the database. The format varies according\n database adapter. Refer to the documentation for the adapter\n you're using for more information. Some examples:\n <dl>\n <dt>Sqlite3</dt>\n <dd>`sqlite3:db/development.db`</dd>\n <dt>PostgreSQL</dt>\n <dd>`postgresql://localhost/myapp_development?pool=5`</dd>\n </dl>\n </td>\n </tr>\n CODE\n\n insert_into_file('README.md', after: /<tbody>\\n/) do\n indent(snippet, 8)\n end\n end", "def help\n puts 'add help'\n end", "def intro\n\tputs \"\\nHey, this is Grandma. HOW ARE YOU DEARY?\"\nend", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def intro\n\tputs \"\\nHello, welcome to Secret Number, created by Jonathan Wang.\"\nend", "def edit_description\n end", "def about\n \n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def update_help\n @help_window.set_item(title)\n end", "def help_text\n build_html do\n p <<-P1\n This is the list of changes that a particular defect or\n feature introduced. The changes are grouped by release. Each\n change provides a link to the file or files involved along with a\n link to a diff of the changes for that file. The link to the diff\n is the '->' between the two SCCS ids.\n P1\n end\n end", "def createupdateintro\n current_user.update(:introduction => user_params[:introduction])\n redirect_to homes_path\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def intro\n puts \"************************************************\"\n puts \"Hi #{ @user.strip }, I'm the #{ $0 } script\"\n puts \"************************************************\"\n puts \"\\tWelcome to Talkbox\"\n puts \"\\ttype 'help' to get started\"\n puts \"************************************************\"\n end", "def self_introduction\n \"Hello #{user_link(source_user)}, very nice to meet you!\"\n end", "def edit\n @cookbook = current_cookbook\n end", "def introduction\n if title\n clear\n yes_no('Do you want to read the rules and see a live demo?') ? rules : nil\n clear\n difficulty_key = difficulty_menu\n @difficulty = DIFFICULTY[difficulty_key]\n @promptarr = prompt_select(difficulty_key)\n else\n @running = false\n exit\n end\n end", "def learning_help(m)\n m.reply \"Learning module\"\n m.reply \"===========\"\n m.reply \"Description: Teach the bot about things, and have it repeat that info back later.\"\n m.reply \"Usage: [botname] [thing] is [information] (to store additional [information] under the keyword [thing].)\"\n m.reply \"[botname] [thing] (to get whatever the bot knows about [thing].)\"\n end", "def replace_readme(&block)\n remove_file 'README.doc'\n remove_file 'README.md'\n\n create_file 'README.md'\n append_file 'README.md', yield\nend", "def intro\r\n clear # execute method clear to clear screen and place logo\r\n puts ' \"I cant stand the rain!!\" '\r\n puts ' Welcome to GK Rainfall collection application'\r\n puts ' Version 0.205'\r\n puts ' Hit enter to continue'\r\n gets\r\n end", "def description\n @description = \"Espresso\"\n end", "def contstruct_readme\n config = template.config\n\n s = []\n s << \"# %s - %s\" % [config[:name], config[:summary]]\n s << \"## SYNOPSIS\"\n s << Array(usage).join(\"\\n\")\n s << \"## DESCRIPTION\"\n s << config[:description]\n s << \"## COPYRIGHT\"\n s << config[:copyright]\n s.join(\"\\n\\n\")\n end", "def help(some, arg)\n say \"Bootic CLI v#{BooticCli::VERSION}\\n\\n\", :bold\n super\n\n examples if respond_to?(:examples)\n end", "def aboutButton\n \"* marked:'About'\"\n end", "def set_intro\n @intro = Intro.find(params[:id])\n end", "def about_command(stem, sender, reply_to, msg)\n # This method renders the file \"about.txt.erb\"\n end", "def template_guide\n @title = \"Template Guide\"\n end", "def set_introduction\n @introduction = current_user.introductions.find(params[:id])\n end", "def edit(title, content, options={})\n create(title, content, {:overwrite => true}.merge(options))\n end", "def add_plugins_to_readme(plugins = {})\n lines = File.readlines(README_FILE).map{|l| l.chomp}\n index = lines.index(PLUGIN_LIST_TAG)\n unless index.nil?\n lines.insert(index+1, \"\\n#{PLUGIN_LIST_NOTE}\\n\\n\")\n lines.insert(index+2, format_plugin_list(plugins))\n write_lines_to_readme(lines)\n else\n puts \"Error: Plugin List Tag (#{PLUGIN_LIST_TAG}) not found\"\n end\nend", "def about\n\n end", "def intro(*args); say $terminal.color(format(*args), :bold); say(''); end", "def readme(path)\n begin\n say \"#{option_color}\"\n super\n ensure\n say \"#{no_color}\"\n end\n end", "def introduction(name)\n\t pharase =\"Hi, my name is #{name}.\"\n\t puts pharase\nend", "def introduction(target) #introduction method\n puts \"Greetings #{target}, I'm #{first_name}!\"\n end", "def about\n\n end", "def about\n\n end", "def about\n\n end", "def about\n end", "def about\r\n end", "def about\n # STUB\n end", "def add_to_doc idea\n GDFile.update_from_string(\n append_idea(IdeaTemplate % [idea[:user],\n idea[:message],\n idea[:link]] ))\nend", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def about\n end", "def intro\n link = link_to(@parent.name, @parent.html_url)\n \"This is a fork of #{link}, with pull requests:\"\n end", "def description\n desc = readme_description\n if has_wrapper?\n desc += \" Note that #{name} is a version-specific client library.\" \\\n \" For most uses, we recommend installing the main client library\" \\\n \" #{wrapper_name} instead. See the readme for more details.\"\n end\n desc\n end", "def explanation\n explanation_intro_html + explanations_array_html_list\n end", "def introduction(greeting, name)\n puts \"#{greeting}, #{name}.\"\nend", "def about; end", "def about; end", "def introduction(name)\n puts \"Hi, my name is #{name}.\\n\"\nend", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @title = args[:title] if args.key?(:title)\n end", "def recipe args=1\n self.summary.recipe args\n end", "def introduction\n puts \"Hi #{target}, I'm #{first_name}!\"\n end", "def description_section\n section_of( 'README.md', 'DESCRIPTION')\n end", "def handle_option_intro(key = current_option_key)\n print_margin message(option_intro(key))\n end", "def help(title, text)\n @__help_topics ||= {}\n @__help_topics[title] = text.strip\n end", "def show_readme\n readme \"README\" if behavior == :invoke\n end", "def show_readme\n readme \"README\" if behavior == :invoke\n end", "def show_readme\n readme \"README\" if behavior == :invoke\n end", "def learning_new\n puts \"I am Learning #{TECH_ONE}\"\n end" ]
[ "0.6936561", "0.67870855", "0.6385627", "0.6292402", "0.6228709", "0.6201686", "0.6119712", "0.61154443", "0.6063954", "0.60586244", "0.6041879", "0.6041879", "0.60394824", "0.5984697", "0.59635437", "0.59521246", "0.59503376", "0.58997184", "0.5824278", "0.5823441", "0.58144", "0.57861906", "0.5784718", "0.57701", "0.57665014", "0.57665014", "0.57665014", "0.572546", "0.5718531", "0.57151026", "0.5699433", "0.5699433", "0.5699433", "0.5699433", "0.5699433", "0.569211", "0.569149", "0.56836474", "0.56748134", "0.56617534", "0.56602013", "0.56348777", "0.5606565", "0.5605493", "0.55947804", "0.55858046", "0.55813414", "0.55786896", "0.55668235", "0.5565644", "0.5565176", "0.5557172", "0.5544826", "0.5544754", "0.55356485", "0.5532034", "0.5531319", "0.5518583", "0.5518583", "0.5518583", "0.551626", "0.55159426", "0.5513978", "0.5505897", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502893", "0.5502274", "0.5496665", "0.5491935", "0.54899704", "0.54874146", "0.54874146", "0.5479552", "0.5476982", "0.5459687", "0.5459416", "0.5458705", "0.5457249", "0.54474354", "0.5443169", "0.5443169", "0.5443169", "0.5441424" ]
0.79031426
0
Update introduction elements Respond with a content type of plain/text to support IE and Opera see:
def update_introduction @cookbook = current_cookbook # Process Paperclip attachments @cookbook.process_attachments(params) if params[:cookbook] @cookbook.intro_type = params[:cookbook][:intro_type] if params[:cookbook][:intro_type] @cookbook.center_introduction = params[:cookbook][:center_introduction] if params[:cookbook][:center_introduction] @cookbook.intro_text = params[:cookbook][:intro_text] if params[:cookbook][:intro_text] @cookbook.intro_image_grayscale = params[:cookbook][:intro_image_grayscale] if params[:cookbook][:intro_image_grayscale] @cookbook.intro_image = params[:cookbook][:intro_image] if !params[:cookbook][:intro_image].nil? # If the user has checked the "Do not include this page" checkbox, set the intro_type do '2' @cookbook.intro_type = 2 if params[:do_not_include] @cookbook.intro_type = 0 if !params[:do_not_include] && @cookbook.intro_type == 2 end if @cookbook.save flash[:notice] = 'The introduction of your cookbook was saved.' end respond_to do |format| format.js { render :update_introduction, content_type: "text/plain" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def introduction\r\n\r\n end", "def content_for_intro(interpret=true)\n if interpret\n render_for_html(body.paragraphs[0])\n else\n body.paragraphs[0]\n end\n end", "def update\n respond_to do |format|\n if @intro.update(intro_params)\n format.html { redirect_to @intro, notice: 'Intro was successfully updated.' }\n format.json { render :show, status: :ok, location: @intro }\n else\n format.html { render :edit }\n format.json { render json: @intro.errors, status: :unprocessable_entity }\n end\n end\n end", "def introduction_params\n params.require(:introduction).permit(:title, :content)\n end", "def about\n respond_to do |format|\n format.html # about.html.erb\n format.xml { render :xml => nil }\n end\n end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n date = Date.parse(intro.elements[0].text).to_s\n devices = generate_table(intro.elements[1].elements)\n security_issue_overview = {}\n intro.elements[2].elements[1..4].map do |issue|\n security_issue_overview[issue['title']] = issue.text\n end\n rating = generate_table(intro.elements[3].elements[2].elements[1].elements)\n\n Introduction.new(\n index, title, reference, date, devices,\n security_issue_overview, rating\n )\n end", "def start_process_intro\n # called upon event reached_intro\n \n puts \"Processing intro\"\n process_content\n end", "def introduction\n #DEFAULT ROUTE DO NOT DELETE\n render 'layouts/application'\n end", "def help_text\n options = {question_pairing_id: params[:question_pairing_id]}\n options[:disability_ids] = params[:disability_ids].split(',') if params[:disability_ids].present?\n\n @help_text = QuestionPairingDisability.with_names(options)\n\n respond_to do |format|\n format.html { render layout: 'fancybox'}\n format.json { render json: @data }\n end\n\n end", "def update_content\n @note = Note.find(params[:id], :select => \"article_id\")\n\n respond_to do |format|\n if @note.article.update_attribute(:content, params[:newContent])\n # Technically html :)\n format.text { render :text => RedCloth.new(white_list(@note.article.content),[:filter_styles]).to_html(:textile, :youtube, :note) }\n else\n format.text { render :text => \"<p>Content update error.</p>\" }\n end\n end\n end", "def set_text\n {\n status: 'generated',\n div: '<div><h1>Pre-Visit Questionnaire</h1></div>'\n }\n end", "def set_intro\n @intro = Intro.find(params[:id])\n end", "def update\n @intro = Intro.find(params[:id])\n\n @intro.update_attributes(params[:intro])\n\n respond_to do |format|\n if @intro.update_attributes(params[:contact])\n format.html { redirect_to manage_intro_index_url, notice: 'Manage contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intro.errors, status: :unprocessable_entity }\n end\n end\n end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n devices = generate_table(intro.elements[1].elements)\n\n Introduction.new(index, title, reference, devices)\n end", "def accept_heading heading\n @res << \"<p>#{to_html heading.text}\\n\"\n\n add_paragraph\n end", "def intro()\n show do\n title \"Introduction - Illumina RNA Seq Library Prep\"\n separator\n note \"This is the first step in the: <a href=https://support.illumina.com/downloads/truseq_stranded_total_rna_sample_preparation_guide_15031048.html>Illumina TruSeq Stranded Total RNA with RiboZero Guide</a>\"\n note \"In this protocol, you will be depleting the abundant ribosomal RNA from your sample.\"\n note \"Then, you will be chemically fragmenting the depleted RNA, since the Illumina platform is optimized for short reads.\"\n note \"<b>1.</b> Deplete riboRNA\"\n note \"<b>2.</b> Isolate & Wash Depleted RNA\"\n note \"<b>3.</b> Chemically Fragment RNA\"\n end\n end", "def update\n respond_to do |format|\n if @product_intro.update(product_intro_params)\n format.html { redirect_to @product_intro, notice: 'Product intro was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_intro }\n else\n format.html { render :edit }\n format.json { render json: @product_intro.errors, status: :unprocessable_entity }\n end\n end\n end", "def intro()\n show do\n title \"Introduction - RNA Quality Control\"\n separator\n note \"In this protocol you will prepare <a href=https://www.labviva.com/pub/static/frontend/Ueg/new/en_US/images/docs/HB-2326-001_1105695_IAS_QX_RNA_Quality_Control_0117_WW.pdf>RNA samples for analysis on the QIAxcel Bioanalyzer</a>.\"\n note \"1. Gather materials and reagents\"\n note \"2. Mix and place samples on thermocycler\"\n note \"3. Dilute\"\n end\n end", "def about\n respond_to do |format|\n format.html { render :about }\n end\n end", "def update\n flash[:notice] = 'About Successfully update' if @about.update_attributes! params[:about]\n respond_with @about\n end", "def div_introduction\n if ureponses.nil?\n (\n (avant_description_quiz || '') +\n description_formated +\n (apres_description_quiz || '')\n ).in_div(id: 'quiz_description')\n else\n ''\n end\n end", "def create\n @intro = Intro.new(intro_params)\n\n respond_to do |format|\n if @intro.save\n format.html { redirect_to @intro, notice: 'Intro was successfully created.' }\n format.json { render :show, status: :created, location: @intro }\n else\n format.html { render :new }\n format.json { render json: @intro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @welcome_content.update(welcome_content_params)\n format.html { redirect_to @welcome_content, notice: 'Welcome content was successfully updated.' }\n format.json { render :show, status: :ok, location: @welcome_content }\n else\n format.html { render :edit }\n format.json { render json: @welcome_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_help(id, text)\n url = URI.parse(\"http://#{@@api_url}/helps/add/#{id}.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path+@config[:apikey])\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n\n end", "def inicio\n cadena = 'Content-Type: text/html; charset=utf-8\\n\\n'\n cadena << '<!DOCTYPE html>'\n cadena << \"<html lang='es'>\"\n end", "def spec_intro\n show do\n title \"Spectrophotometer Measurements\"\n \n note \"This protocol will instruct you on how to take measurements on the Seelig Lab Spectrophotometer.\"\n note \"ODs are a quick and easy way to measure the growth rate of your culture.\"\n note \"GFP measurements help researchers assess a response to a biological condition <i>in vivo</i>.\"\n note \"<b>1.</b> Transfer cultures to cuvettes and make blank.\"\n note \"<b>2.</b> Setup spectrophotometer workspace.\"\n note \"<b>3.</b> Take and enter OD measurements.\"\n end\n \n end", "def update!(**args)\n @has_intro = args[:has_intro] if args.key?(:has_intro)\n @intro_end_ms = args[:intro_end_ms] if args.key?(:intro_end_ms)\n @intro_start_ms = args[:intro_start_ms] if args.key?(:intro_start_ms)\n end", "def update_help\n enc = $game_party.bestiary_known_data[:ene].keys.size\n text = \"Encountered: #{enc}/#{SES::Bestiary.get_enemy_list.size}\"\n @help_window.set_text(text)\n end", "def explanation\n explanation_intro_html + explanations_array_html_list\n end", "def editintro(value)\n merge(editintro: value.to_s)\n end", "def update_help\n case current_symbol\n when :name\n text = Vocab.registration_help_name\n when :avatar\n text = Vocab.registration_help_avatar\n when :register\n text = Vocab.registration_help_submit\n when :title\n text = Vocab.registration_help_title\n else\n text = ''\n end\n @help_window.set_text(text)\n end", "def replace_in_pure_html_message(new_part)\n if new_part.content_type.include?('text/html')\n message.body = new_part.decoded\n message.content_type = new_part.content_type\n else\n message.body = nil\n message.content_type = new_part.content_type\n new_part.parts.each do |part|\n message.add_part(part)\n end\n end\n end", "def introduction(&proc)\n @introduction = proc\n end", "def render_help_text(text, options={})\n options.stringify_keys!\n mapping = {:notice => \"helpInfo\", :info => \"helpInfo\", :warning => \"helpWarning\", :error => \"helpError\"}\n\n id = options.delete('id')\n display = options.delete('display') || false\n onclick = options.delete('onclick') || visual_effect(:blind_up, id, :duration => 0.3)\n type = mapping[(options.delete('type') || 'info').to_sym]\n<<-HTML\n<div id=\"#{id}\" class=\"helpInfoBox\" onclick='#{onclick}' style=\"#{display ? '' : 'display:none;'}\">\n <table cellpadding=0 cellspacing=0>\n \t<tr>\n \t\t<td class=\"helpInfoLeft\">\n \t\t\t<div class=\"#{type}\"></div>\n \t\t</td>\n \t\t<td class=\"helpInfoContent\">\n \t\t #{text}\n \t\t</td>\n \t</tr>\n </table>\n</div>\nHTML\n end", "def introduction\n if title\n clear\n yes_no('Do you want to read the rules and see a live demo?') ? rules : nil\n clear\n difficulty_key = difficulty_menu\n @difficulty = DIFFICULTY[difficulty_key]\n @promptarr = prompt_select(difficulty_key)\n else\n @running = false\n exit\n end\n end", "def update\n respond_to do |format|\n action_message_for(@guide.content_item.status)\n if update_guide\n format.html { redirect_to redirect_target(@guide), flash: @feedback_flash }\n format.json { render :show, status: :ok, location: @guide }\n else\n 1.times { @guide.sections.new } if @guide.subtype == 'detailed_guide'\n @guide.content_item.status = session[:content_item_status]\n format.html { render :edit }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end", "def about\n\t\tcontent = Content.first.about_content\n\t\tif content.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {about_content: content.as_json} },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"About Content is not present\" },:status=> 203\n\t end \n\tend", "def preview\n # generate html according to wiki notation type\n result = ContentFormatter.to_html(params[:content], params[:notation_type])\n respond_to do |format|\n format.html {\n # return html text\n render text: result\n }\n end\n end", "def force_content(newcont)\n @ios = [{:str => newcont, :done => true}]\n end", "def createupdateintro\n current_user.update(:introduction => user_params[:introduction])\n redirect_to homes_path\n end", "def about\n @main_heading='<span>Hello</span> <span>my</span> <span>name</span> <span>is</span> <span>Jim</span><span class=\"punctuation\">.</span>'\n end", "def pr_intro\n show do\n title \"Plate Reader Measurements\"\n \n note \"This protocol will instruct you on how to take measurements on the BioTek Plate Reader.\"\n note \"ODs are a quick and easy way to measure the growth rate of your culture.\"\n note \"GFP measurements help researchers assess a response to a biological condition <i>in vivo</i>.\"\n note \"<b>1.</b> Transfer culture to plate reader plate and add blank.\"\n note \"<b>2.</b> Setup plate reader workspace.\"\n note \"<b>3.</b> Take measurement, save data, & upload.\"\n end\n end", "def process_help\n send_data \"250 Ok, but unimplemented\\r\\n\"\n end", "def update\n respond_to do |format|\n if @about.update(about_params)\n format.html { redirect_to @about, notice: 'el About fue actualizado con éxito, perlín.' }\n format.json { render :show, status: :ok, location: @about }\n else\n format.html { render :edit }\n format.json { render json: @about.errors, status: :unprocessable_entity }\n end\n end\n end", "def end\n\t\ttexts = get_texts(\"end\")\n\t\t@title = texts.title.html_safe\n\t\t@heading = texts.heading.html_safe\n\t\t@text = texts.body.html_safe\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\t# format.xml { render :xml => @foobar } #.to_xml }\n\t\t\t# format.json { render :json => @foobar } #.to_json }\n\t\tend\n\tend", "def update_info_window(msg)\n self << 'jQuery(\"#information_modal\").html(#{format_type_to_js(msg)});'\n nil\n end", "def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end", "def intro()\n show do\n title \"Stitching Fragments by Overlap Extention (SOE)\"\n separator\n note \"In this protocol you will be guided in preparing an SOE reaction.\"\n note \"This method takes advantage of DNA fragments that have overlapping sequences.\"\n note \"The overlapping fragments will act as primers themselves and polymerize to create the desired amplicon.\"\n note \"<b>1.</b> Gather materials and fill with KAPA Master Mix\"\n note \"<b>2.</b> Add fragments in either equimolar ratios or similar mass - OPTIMIZE WHICH TO USE\"\n note \"<b>3.</b> Setup thermocycler conditions for SOE\"\n note \"<b>4.</b> Transfer samples from stripwells to labelled microfuge tubes for storage.\"\n end\n end", "def texte_aide\n <<-EOT\n=== Aide pour les notifications ===\\033[0m\n\nAjouter une notification\n #{jaune('add \"<notification>\" \"AAAA MM JJ\"[ \"titre\"]')}\n\n Note : la date peut être définie soit par JJ/MM/AAAA,\n soit par JJ MM AAAA, soit 'AAAA MM J' ou\n 'AAAA/M/J', peu importe.\n\nSupprimer une notification\n #{jaune('remove/delete <id notification>')}\n\nVoir toutes les informations de la notification\n #{jaune('show <id notification>')}\n\n(Re)définir les attributs d'une notification\n #{jaune('set <id notification> m=\"message\" t=\"titre\" d=\"AAAA MM JJ\"')}\n\nQuitter\n #{jaune('q/quit/quitter')}\n\n EOT\n end", "def edit\n @page_title = @content.locale_title(I18n.locale)\n @content.setup_uri_path # be sure to recover uri_path or scope will get messed up when the content is saved.\n respond_to do |format|\n format.html { render :template => @edit_template || 'contents/edit'}\n format.pjs { render :template => @edit_template || 'contents/edit', :layout => 'popup'}\n end\n end", "def about; render; end", "def faq\n respond_to do |format|\n format.html # faq.html.erb\n format.xml { render :xml => nil }\n end\n end", "def introduction\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will gather stripwells of fragments, organize them in the fragment analyzer machine, and upload the analysis results to Aquarium.\"\n end\n end", "def intro\n\tputs \"\\nHey, this is Grandma. HOW ARE YOU DEARY?\"\nend", "def append(text, summary = nil, minor = true, bot = true)\n #require login\n @site.login\n puts text\n result = @site.query_prop_info(:titles => @normtitle, :intoken => 'edit')\n token = result['query']['pages']['page']['edittoken']\n result = @site.edit(:title => @normtitle, :text => text, :token => token, :summary => summary, \n\t\t:minor => minor, :bot => bot, :appendtext => text)\n if result.key?('error')\n raise RbmediawikiError, \"#{title}: \"+result['error']['code']\n else\n return true\n end\n end", "def new\n @htm_help_type = HtmHelpType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @htm_help_type }\n end\n end", "def set_system_announcement\n flash.now[:system_announcement] = \"This is the <strong>Ajax on Rails Intranet</strong>, <br/>released as part of <a href=\\\"http://www.oreilly.com/catalog/9780596527440/\\\"><em>Ajax on Rails</em></a> from O&rsquo;Reilly Media.\"\n end", "def help_text\n t = <<-P1\n<p>\n\n This is a table of \"swinfo\" entries for a particular item. The help\n on the welcome page describes various items that can be searched\n for such as defect, APAR, PTF, etc.\n\n</p><p>\n\n The column names in the header can be clicked to sort the table.\n There are three columns that are sorted. The first column has the\n darkest up or down arrow while the third column has the lightest up\n or down arrow. For example, the default is to sort by the defect\n first, then by the APAR, and finally by the PTF.\n\n</p><p>\n\n The page implements an \"endless page\" user interface where only the\n first 1000 rows are rendered. When the bottom of the page is\n scrolled to, then the next 1000 rows are fetched and appended to the\n original. Remember this if you ever search using the in browser, in\n page search because you may not be searching on the complete list of\n items that matched.\n\n</p><p>\n\n The entries under the Defect, APAR, PTF, VRMF, and Service Pack\n columns are links to do a \"swinfo\" search for that particular item.\n\n</p><p>\n\n The little triangles on the right edge of many items presents a menu\n of available actions when clicked. For example, if one of the\n triangles by a defect is clicked, the user is presented with the\n ability to retrieve the CMVC defect, the changes the defect resulted\n in, the APAR draft (if any) associated with the defect. Each of\n these menus also has a \"Select text\" option to select the text. The\n text is <b>not</b> copied to the clipboard. To do that requires\n flash which I did not want to depend upon. Part of the goal is to\n make the UI tablet friendly and flash is definitely not tablet\n friendly.\n\n</p>\nP1\n return t.html_safe\n end", "def update_help\n if @ucEnemyGraphic.enemy != nil\n if @scan_mode.include?(BESTIARY_CONFIG::SHOW_NOTE)\n @help_window.window_update(@ucEnemyGraphic.enemy.note)\n else\n @help_window.window_update(BESTIARY_CONFIG::DEFAULT_HIDE_PATTERN)\n end\n else\n @help_window.window_update(\"\")\n end\n end", "def action_not_recognize(input)\n response = WxTextResponse.new\n set_common_response response\n response.Content = WxReplyMsg.get_msg_by_key 'help'\n response\n end", "def update\n respond_to do |format|\n if @introexam.update(introexam_params)\n format.html { redirect_to @introexam, notice: 'Introexam was successfully updated.' }\n format.json { render :show, status: :ok, location: @introexam }\n else\n format.html { render :edit }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @about_content.update(about_content_params)\n format.html { redirect_to @about_content, notice: 'About content was successfully updated.' }\n format.json { render :show, status: :ok, location: @about_content }\n else\n format.html { render :edit }\n format.json { render json: @about_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def append_info(text, options={})\n options[:category] ||= EventCategories::NONE # Do not event by default\n send_request('append_info', normalize_options(text, options))\n end", "def update\n respond_to do |format|\n if @guides_text.update(guides_text_params)\n format.html { redirect_to @guides_text, notice: 'Text was successfully updated.' }\n format.json { render :show, status: :ok, location: @guides_text }\n else\n format.html { render :edit }\n format.json { render json: @guides_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def conekta\n #to add more logic here\n head :ok, content_type: \"text/html\"\n end", "def intro_params\n params.require(:intro).permit(:name, :sex, :tel, :email, :position, :info, :photo)\n end", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def intro()\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will do the following:\"\n note \"- gather stripwells of fragments\"\n note \"- organize them in the fragment analyzer machine\"\n note \"- set up and run the analyzer\"\n note \"- upload the analysis results to Aquarium\"\n end\n end", "def help\n\t\thelps = Help.all\n\t\tif helps.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {help_content: helps.as_json} },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Help Content is not present\" },:status=> 203\n\t end\n\tend", "def update_about_me\n\t if @user.update_attributes(about_text: params[:about_text])\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"About me Successfully Updated.\", response: {about_me: @user.about_text} },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend", "def update\n respond_to do |format|\n if @welcome.update(welcome_params)\n format.html { redirect_to @welcome, notice: 'Welcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @welcome }\n else\n format.html { render :edit }\n format.json { render json: @welcome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @welcome.update(welcome_params)\n format.html { redirect_to @welcome, notice: 'Welcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @welcome }\n else\n format.html { render :edit }\n format.json { render json: @welcome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @about_u.body = params['body']\n @about_u.save\n\n respond_to do |format|\n if @about_u.update(about_u_params)\n format.html { redirect_to @about_u, notice: 'About us was successfully updated.' }\n format.json { render :show, status: :ok, location: @about_u }\n else\n format.html { render :edit }\n format.json { render json: @about_u.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_introduction\n @introduction = current_user.introductions.find(params[:id])\n end", "def update\n @htm_help_type = HtmHelpType.find(params[:id])\n\n respond_to do |format|\n if @htm_help_type.update_attributes(params[:htm_help_type])\n format.html { redirect_to htm_help_types_path, notice: I18n.t(:record_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @htm_help_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @text_content = TextContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text_content }\n end\n end", "def prepend(text, summary = nil, minor = true, bot = true)\n #require login\n @site.login\n result = @site.query_prop_info(@normtitle, nil, 'edit') \n token = result['query']['pages']['page']['edittoken']\n result = @site.edit(@normtitle, nil, text, token, summary, minor, nil, bot, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, text)\n if result.key?('error')\n raise RbmediawikiError, \"#{title}: \"+result['error']['code']\n else\n return true\n end\n end", "def append_text(content)\n temp_text_ele = @text_ele.clone\n temp_text_ele.elements[1].content = content\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(temp_text_ele)\n end", "def show_text(string, *params)\r\n @content.last << string\r\n end", "def show_text(string, *params)\n @content.last << string\n end", "def show_text(string, *params)\n @content.last << string\n end", "def show_text(string, *params)\n @content.last << string\n end", "def respond_help\n help = []\n help << \"Hi human, if you need documentation about any Ruby Core/Stdlib class, module or method, you can ask me in this way:\"\n help << ''\n MATCHERS.each do |matcher|\n help << \"_#{matcher.pattern_example(@client.self.name)}_\"\n end\n\n help << ''\n help << 'I understand any of the following formats:'\n help << '_Class | Module | Module::Class | Class::method | Class#method | Class.method | method_'\n\n help.join(\"\\n\")\n end", "def update\n respond_to do |format|\n if @about.update(about_params)\n format.html { redirect_to url_for(action: 'show', id: @about), notice: f(@about) }\n format.json { render :show, status: :ok, location: url_for(action: 'show', id: @about) }\n else\n format.html { render :edit }\n format.json { render json: @about.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'About Created' if @about.save\n respond_with @about\n end", "def footnote_content; end", "def description_html\n convert_html description\n end", "def intro\n puts \"************************************************\"\n puts \"Hi #{ @user.strip }, I'm the #{ $0 } script\"\n puts \"************************************************\"\n puts \"\\tWelcome to Talkbox\"\n puts \"\\ttype 'help' to get started\"\n puts \"************************************************\"\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def about\n @toc_id = 'about'\n end", "def update_help\n @help_window.set_item(title)\n end", "def intro\n if eval(\"defined?(MTS_INTRO_ANIM#{@intro})\")\n intro = eval(\"MTS_INTRO_ANIM#{@intro}.new(@viewport,@sprites)\")\n else\n intro = MTS_INTRO_ANIM.new(@viewport,@sprites)\n end\n @currentFrame = intro.currentFrame\n @sprites[\"start\"].visible = true\n end", "def about_command(stem, sender, reply_to, msg)\n # This method renders the file \"about.txt.erb\"\n end", "def editing_help(editing_help_type)\n case editing_help_type\n when 'Partial'\n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n # help << '<h4>Tags for this Custom Type</h4>'\n when 'Layout' \n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n end\n end", "def texte_aide\n <<-EOT\n=== Aide pour les tâches ===\\033[0m\n\nAjouter une tâche (avec ou sans description)\n #{jaune('add \"<tâche>\"[ \"description\"][ <priorité>]')}\n La priorité est un nombre de 0 (aucune priorité) à\n 9 (priorité maximale).\n\nMarquer une tâche finie\n #{jaune('close/done <id tâche>')}\n\nVoir toutes les informations de la tâche\n #{jaune('show <id tâche>')}\n\n(Re)définir les attributs d'une tâche\n #{jaune('set <id tâche> m=\"contenu\" d=\"description\" p=[0-9]')}\n p pour la priorité (0 par défaut)\n\nDétruire une tâche\n #{jaune('remove/delete <id tâche>')}\n\nQuitter\n #{jaune('q/quit/quitter')}\n\n EOT\n end", "def update\n respond_to do |format|\n if @welcome_page.update(welcome_page_params)\n format.html { redirect_to @welcome_page, notice: 'Welcome page was successfully updated.' }\n format.json { render :show, status: :ok, location: @welcome_page }\n else\n format.html { render :edit }\n format.json { render json: @welcome_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_explanation\n @question.explanation = params[:question][:explanation]\n if @question.save\n flash[:success] = \"Explication modifiée.\"\n redirect_to chapter_path(@chapter, :type => 5, :which => @question.id)\n else\n render 'explanation'\n end\n end", "def update\n respond_to do |format|\n if @about.update(about_params)\n format.html { redirect_to admin_abouts_path, notice: 'about was successfully updated.' }\n format.json { render :show, status: :ok, location: @about }\n else\n format.html { render :edit }\n format.json { render json: @about.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n # @topic = current_user.topics.find(params[:lesson][:topic_id])\n # @course = @topic.courses.first\n\n # @lesson.title = 'New Lesson (rename)' if params[:title] = ''\n respond_to do |format|\n if @lesson.update(lesson_update)\n format.html { redirect_to course_topic_lesson_path(@lesson.topic.course, @lesson.topic, @lesson), notice: 'Lesson was updated created.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6250985", "0.61511034", "0.59314656", "0.5552826", "0.5540283", "0.5529689", "0.55242527", "0.5460215", "0.5401076", "0.5359251", "0.53455067", "0.5310336", "0.53064615", "0.5302194", "0.5291925", "0.52763087", "0.5234108", "0.5215682", "0.52042013", "0.52030325", "0.51799786", "0.5174466", "0.517011", "0.51512766", "0.5109551", "0.51063603", "0.5101323", "0.5100829", "0.5082093", "0.5077019", "0.5068794", "0.5067883", "0.50512886", "0.5043326", "0.5009221", "0.50065", "0.5004138", "0.49711084", "0.4964036", "0.4963125", "0.49631158", "0.49564803", "0.4936375", "0.4928746", "0.49081588", "0.49014813", "0.48993728", "0.48829347", "0.48774055", "0.4876194", "0.48758084", "0.4875008", "0.48731244", "0.48586896", "0.48579156", "0.48506024", "0.48425156", "0.4842361", "0.48419014", "0.48415002", "0.48352188", "0.48347336", "0.48208547", "0.48203498", "0.48171005", "0.48114526", "0.4807188", "0.48071536", "0.47982898", "0.4793923", "0.47876987", "0.47876987", "0.47831503", "0.47826058", "0.4763704", "0.47563154", "0.47470254", "0.47451752", "0.47354737", "0.47256088", "0.47256088", "0.47256088", "0.47246063", "0.4723888", "0.471819", "0.47179866", "0.47159827", "0.4713612", "0.47128418", "0.47128418", "0.4707912", "0.4697965", "0.46976104", "0.4690704", "0.46860918", "0.468317", "0.4682571", "0.4666897", "0.46638703", "0.46496087" ]
0.6728914
0
Display the cookbook price
def check_price @num_cookbooks = (params[:num_cookbooks] && params[:num_cookbooks].to_i > 3) ? params[:num_cookbooks].to_i : 4 ccc = CookbookCostCalculator.new( num_bw_pages: current_cookbook.num_bw_pages, num_color_pages: current_cookbook.num_color_pages, num_books: @num_cookbooks, binding: current_cookbook.book_binding.to_sym ) @cookbook = current_cookbook @printing_cost = ccc.printing_cost || "Unknown" @cost_per_book = (@printing_cost != "Unknown") ? (@printing_cost.to_f / @num_cookbooks).round(2) : "Unknown" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_price(options = {})\n price_unpacked.to_s + '€ per piece, ' + price_packed.to_s + '€ per box'\n end", "def display_price\n Spree::Money.new(new_amount, currency: currency)\n end", "def price\n # puts \"$#{(num_beds*1000) + (num_baths*500)}\"\n (num_beds*1000) + (num_baths*500)\n end", "def display_price\n Spree::Money.new(new_amount, {currency: currency})\n end", "def price_display\n 'INR ' + price.to_s\n end", "def product_price(toy)\n \"Retail Price: $#{toy.price}\"\n end", "def display_price\n case mode\n when 'boxed' then boxed_price\n else price\n end\n end", "def grab_price\n\t\tcurrent_price = \"$\" + @price_span.content\n\t\t#close_price = \"$\" + @close_span\n\t\tputs \"The greatest car company in the world has a stock price of \"\n\t\tputs current_price\n\t\t#puts \"Yesterday the stock closed at #{close_price}.\"\n\n\tend", "def price\n \n end", "def price\n MoneyUtils.format(self.price_basis)\n end", "def price\n @longboard.price + @custom_print.price\n end", "def price\n flavor_info[:price]\n end", "def cigaret_price\n 0.30\n end", "def price\n 0.25 + @coffee.price\n end", "def sales_price\n Dowstore.priceMarkup(commodity.price,0,2)\n end", "def price # getter for rent in cents\n\t\tread_attribute(:price_in_cents)\n\tend", "def display_price\n\t variations = self.variations.find(:all, :order => \"price ASC\")\n\t if variations.size == 0\n\t return self.price\n\t else\n\t low_price = variations[0].price\n\t high_price = variations[variations.size-1].price\n if low_price == high_price\n return low_price\n else\n return [low_price, high_price]\n end\n end\n end", "def price\n @price\n end", "def price\n @price\n end", "def price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.child(\"h3\"), format_method(__method__)).inner_text\n end", "def price\n \n end", "def sell_price\r\n price\r\n end", "def price\n ConversionTool.convert_to_currency(self.unit_price)\n end", "def get_price\n item_prc_1\n end", "def price\n 2.50\n end", "def price_display\n lookup = {\n 'cheap' => '$',\n 'affordable' => '$$',\n 'pricey' => '$$$',\n 'expensive' => '$$$$'\n }\n lookup[price] # return the dollar signs corresponding to this price enum value\n end", "def formatted_price\n price / 100.0\n end", "def price\n total\n end", "def display_price=(price_value)\n case mode\n when 'boxed'\n self.boxed_price = price_value\n else\n self.price = price_value\n end\n end", "def price\n BigDecimal('3.0')\n end", "def price\n base_price * discount_factor\n end", "def price\n response[\"price\"]\n end", "def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end", "def price\n BigDecimal('5.0')\n end", "def sales_price\r\n\t\tmarkup = @aquisition_cost*1.10\r\n\t\tmarkup.to_s\r\n\tend", "def price_in_cents\n read_attribute(:price) \n end", "def pretty_price\n \"$#{price_in_cents / 100.0}\"\n end", "def product_price\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-price\")), __method__)\n end", "def price_as_a_string()\n puts format(\"$%.2f\", @price)\n end", "def format_price price\n \"$#{'%.2f' % price}\"\n end", "def price_as_string\n return \"$\" + '%.2f' % @price\n end", "def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (Closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable' #retrun unavailable to neither closing price or opending price is available\n end", "def calculated_price\n msrp\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "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 price\n case category \n when 'book'\n unit_cost * 1.10\n when 'audiobook'\n unit_cost * 1.20\n when 'magazine'\n unit_cost * 1.15\n end\n end", "def amount\n price\n end", "def display_object\n\tputs \"Name: #{name}\"\n\tpretty_price = format(\"%0.2f\", price)\n\tputs \"Price: $#{pretty_price}\"\n\tputs \"Size: #{size}\"\n end", "def display_price\n price = if respond_to?(:display_amount)\n display_amount\n else\n display_base_price\n end.to_s\n\n return price if ::Spree::Avatax::Config.tax_calculation\n return price if taxes.empty? || amount == 0\n\n tax_explanations = taxes.map(&:label).join(tax_label_separator)\n\n I18n.t :display_price_with_explanations,\n scope: 'spree.shipping_rate.display_price',\n price: price,\n explanations: tax_explanations\n end", "def price\n @sibit.price\n end", "def price_as_string\n \"$%.2f\" % @price\n end", "def price(opts = {})\n opts.reverse_merge! ThreadLocal.price_preferences\n with_prices(opts).sum(\"formulation_ingredients.quantity * (#{opts[:currency_code].to_s.downcase} / 1000)\")\n end", "def price_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.li.className(create_ats_regex_string(\"price\")).find.a, format_method( __method__), @browser)\n end", "def draw_total_price\r\r\n width = contents_width - 8\r\r\n draw_currency_value(@price * @number, @currency_unit, 4, price_y, width, @currency)\r\r\n end", "def price action\n result = api_customers_command\n exchange_rate = result[:exchange_rate]\n exchange_rate.to_f\n end", "def price\n @coffee.price += 0.50\n end", "def aow_price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.parent(\"p\").span, format_method(__method__))\n end", "def price\n return base_price - quantity_discount + shipping\nend", "def price_as_string\n return \"$%0.2f\" % [@price]\n end", "def kase_price(*args, &proc)\n content, options = filter_tag_args(*args)\n content = capture(&proc) if block_given?\n html = tag(:span, {:class => \"statusPrice #{options[:class]}\", :id => options[:id]}, true)\n html << \"&nbsp;#{content}&nbsp;\" if content\n html << \"</span>\"\n block_given? ? concat(html, proc.binding) : html\n end", "def price\n price_tier ? price_tier : 'Unknown'\n end", "def single\n format(@price)\n end", "def print_price hash\n\thash[:price]\nend", "def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end", "def show_discounts(prices)\n prices.each do |price|\n amount_off = price / 3.0\n puts format(\"Your discount: $%.2f\", amount_off)\n end\nend", "def price_pretty\n number_to_currency(price_dollars)\n end", "def price_for_customer(customer)\n price\n end", "def output_price(final_price)\n price = '%.2f' % final_price\n formatted_price= price.to_s.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n @price = \"$#{formatted_price}\"\n end", "def price\n self.default_variant ? self.default_variant.price : read_attribute(:price)\n end", "def price_as_string\n \"$\"+format(\"%0.2f\",@price)\n end", "def price\n hash[\"Price\"]\n end", "def price( items )\n self.parser.price(items)\n end", "def edit\n @listing.price /= 100\n end", "def product_value\n puts \"You have #{@quantity} #{@id} remaining at #{@price} dollars each!\"\n end", "def show\n @inform = @study.inform\n @all_cups_price = 0\n @inform.studies.each do |study|\n @all_cups_price += study.price * study.factor\n end\n end", "def ticket_price\n\t\t#There is no base cost\n\t\tticket_price = @price\n\t\t@items.each 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 price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n end", "def rent_price(price)\n format(\"%.0f\", (price * 7.0) / 100)\n end", "def price_for_order(order)\n price\n end", "def dealer_markup\n (origin_price*0.08).round\n end", "def price\n (price_in_cents / 100.0) unless price_in_cents.nil?\n end", "def display_product\n STDOUT.puts \"--\"*50\n STDOUT.puts \"title: \\t\\t#{$title}\"\n STDOUT.puts \"seller: \\t#{$seller}\"\n STDOUT.puts \"price: \\t\\t#{$price}\"\n STDOUT.puts \"stars: \\t\\t#{$stars}\"\n STDOUT.puts \"reviews: \\t#{$reviews}\"\n STDOUT.puts \"image url: \\t#{$image_href}\"\n STDOUT.puts \"product url: \\t#{$url}\"\n end", "def price_in_sterling \n\t\tprice * 1.5\n\tend", "def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable'\n end", "def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend", "def price\n return 0 unless self.persisted?\n\n return product.master.price if with_master_price?\n\n default_price.price\n end", "def mid_price\n price\n end", "def print_price hash \n\thash[:price]\nend", "def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end", "def price_string\r\n \"#{self.player_name} $#{self.price}\"\r\n end", "def calculate_price(_flavor)\n end", "def promo_price\n price*0.75\n end", "def cost\n @beverage.cost\n end", "def full_price\n\t\tunit_price * quantity\n\tend", "def price_as_string\n format(\"$%.2f\", @price)\n end", "def price_as_string\n format(\"$%.2f\", @price)\n end", "def price_as_string\n\t\tformat(\"$%2.2f\", @price)\n\tend", "def price_as_string\n \"$\"+\"%0.2f\" % @price\n end", "def price_as_string\n \"$\"+\"%.2f\" % @price\n end", "def usage_price\n data.usage_price\n end" ]
[ "0.70465463", "0.6970083", "0.69522715", "0.69375265", "0.6929888", "0.69052213", "0.6887135", "0.6852347", "0.6720946", "0.6630209", "0.66119945", "0.65844077", "0.6576495", "0.6561258", "0.6548831", "0.6509127", "0.6491853", "0.6490294", "0.6490294", "0.64888716", "0.6486251", "0.646128", "0.6448522", "0.6444189", "0.642038", "0.64191025", "0.6408056", "0.64078426", "0.63912815", "0.63398176", "0.63364047", "0.63207996", "0.63143927", "0.62933135", "0.6285975", "0.625096", "0.6219559", "0.6213445", "0.6196581", "0.6175712", "0.6166864", "0.61559206", "0.6154728", "0.61441797", "0.6116386", "0.6108311", "0.60958904", "0.60908395", "0.6077865", "0.60567033", "0.6050212", "0.6045039", "0.60366386", "0.603397", "0.602501", "0.6022902", "0.60166186", "0.60131854", "0.60037935", "0.59970254", "0.59963685", "0.5995957", "0.5993637", "0.5991859", "0.59915787", "0.5990971", "0.5989629", "0.5989598", "0.5984947", "0.5979853", "0.5979278", "0.59742075", "0.59703916", "0.59681255", "0.5960431", "0.59543496", "0.59482944", "0.59482783", "0.59444904", "0.594283", "0.5937767", "0.593523", "0.59317935", "0.59306824", "0.59270203", "0.5926984", "0.59256786", "0.5923532", "0.5921645", "0.5920007", "0.5918453", "0.5908669", "0.5904965", "0.5902741", "0.59006065", "0.59006065", "0.5900248", "0.5898716", "0.5896261", "0.58958375" ]
0.65562564
14
Preview the cookbook This can be the current cookbook or a cookbook of another person if an order has been created (guest order)
def preview order = current_user.orders.find_by_cookbook_id(params[:id]) @cookbook = (order) ? order.cookbook : current_cookbook preview_path = "#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf" session[:preview_filename] = preview_path preview = CookbookPreviewWorker.new( cookbook: @cookbook, filename: preview_path ) preview.cookbook render "previews/preview" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @cookbook = current_cookbook\n end", "def edit_introduction\n @cookbook = current_cookbook\n end", "def show(cookbook)\n cookbooks[cookbook.cookbook_name] = cookbook.pretty_hash\n end", "def edit_title\n @cookbook = current_cookbook\n end", "def show(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end", "def guest\n @old_order = Order.find params[:id]\n if @old_order && @old_order.filename\n @cookbook = @old_order.cookbook\n @order = @cookbook.get_active_reorder(@old_order.id, current_user)\n else\n redirect_to root_url, alert: \"Sorry, this cookbook is not available for order yet.\"\n end\n end", "def find_cookbook\n @cookbook = Cookbook.with_name(params[:cookbook_id]).first!\n end", "def set_cookbook\n @cookbook = Cookbook.find(params[:id])\n end", "def cookbook\n @cookbook ||= CachedCookbook.from_path(path, name: name)\n end", "def current_cookbook\n @current_cookbook ||= Cookbook.find session[:cookbook_id] if session[:cookbook_id]\n end", "def show\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cookbook }\n end\n end", "def show\n @cookbook = Cookbook.with_name(params[:cookbook]).\n includes(:cookbook_versions).first!\n @latest_cookbook_version_url = api_v1_cookbook_version_url(\n @cookbook, @cookbook.latest_cookbook_version\n )\n\n @cookbook_versions_urls = @cookbook.sorted_cookbook_versions.map do |version|\n api_v1_cookbook_version_url(@cookbook, version)\n end\n end", "def resource_cookbook\n @new_resource.cookbook || @new_resource.cookbook_name\n end", "def preview_cover\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.cover\n render \"previews/preview\"\n end", "def set_cookbook\n @cookbook = Cookbook.friendly.find(params[:id])\n end", "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def new\n cookbook_id = current_user.create_cookbook\n if cookbook_id\n @cookbook = Cookbook.find cookbook_id\n load_user_cookbook @cookbook\n redirect_to templates_path, notice: \"A new cookbook was created for you.\"\n else\n redirect_to upgrade_account_path(current_user.id), alert: \"You must have a paid membership to work on your own cookbooks\"\n end\n end", "def load_cookbook!\n @cookbook = current_cookbook\n end", "def set_cookbook\n @cookbook = CookbooksDecorator.new(Cookbook.find(params[:id]))\n end", "def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end", "def company_cookbook(name, version = '>= 0.0.0', options = {})\n cookbook(name, version, { git: \"https://github.com/EagleGenomics-cookbooks/#{name}.git\" }.merge(options))\nend", "def create\n @cookbook = Cookbook.new(cookbook_params)\n @cookbook.user_id = current_user.id\n\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully created.' }\n format.json { render :show, status: :created, location: @cookbook }\n else\n format.html { render :new }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cookbook = Cookbook.new(cookbook_params)\n\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cookbook }\n else\n format.html { render action: 'new' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def synchronized_cookbook(cookbook_name)\n puts \" - #{cookbook_name}\"\n end", "def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end", "def cookbook(arg = nil)\n set_or_return(:cookbook,\n arg,\n kind_of: [String, NilClass],\n default: nil)\n end", "def select\n @cookbook = Cookbook.find params[:id]\n user_is_owner = current_user.owns_cookbook(@cookbook)\n user_is_contributor = current_user.contributes_to(@cookbook)\n\n # Verify the user is authorized to work on this cookbook.\n if @cookbook && (user_is_owner || user_is_contributor)\n \n # User must have a paid account to work on its cookbooks\n # (Contributor wasn't allowed to create cookbooks but due to a bug some contributors may have cookbooks to works on)\n if has_contributor_plan? && user_is_owner\n redirect_to upgrade_account_path(current_user.id), alert: \"You must have a paid membership to work on your own cookbooks\"\n return\n end\n\n load_user_cookbook @cookbook\n\n # Alert the user it will not be able to work on this cookbook if its owner has expired.\n if current_cookbook.owner.expired?\n if user_is_owner\n flash[:alert] = \"Because your membership has expired you can no longer work on your cookbooks.\"\n elsif user_is_contributor\n flash[:alert] = \"The owner of this cookbook's membership has expired. They will have to extend it for you to gain access to this cookbook.\"\n end\n end\n redirect_to templates_path\n else\n redirect_to cookbooks_path, alert: \"Unable to select cookbook. Either it doesn't exist or you have no permission accessing it.\"\n end\n end", "def show\n @cookbook = Cookbook.with_name(params[:cookbook]).first!\n @cookbook_version = @cookbook.get_version!(params[:version])\n @cookbook_version_metrics = @cookbook_version.metric_results.includes(:quality_metric)\n end", "def cookbook_collection\n run_context.cookbook_collection\n end", "def retrieved_cookbook(name, version, opts = {})\n if platform.server_api_version >= 2\n retrieved_cookbook_v2(name, version, opts)\n else\n retrieved_cookbook_v0(name, version, opts)\n end\n end", "def local_cookbook(name, path=nil)\n if path\n cookbook name, path: \"#{path}/#{name}\"\n else\n cookbook name, path: \"#{ENV['CHEF_REPO']}/cookbooks/#{name}\"\n end\nend", "def preview_ingredient\n @_preview_ingredient ||= ingredients.detect(&:preview_ingredient?) || first_ingredient_by_definition\n end", "def cookbook_selected?\n if !current_cookbook\n redirect_to cookbooks_path, alert: \"You must have selected a Cookbook project to work on first.\"\n end\n end", "def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end", "def cookbook(name, options = {})\n @name = name\n @options = manipulate(options)\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def target_cookbook\n return @target_cookbook unless @target_cookbook.nil?\n\n begin\n @target_cookbook = if version_constraint\n conn.cookbook.satisfy(name, version_constraint)\n else\n conn.cookbook.latest_version(name)\n end\n rescue Ridley::Errors::HTTPNotFound,\n Ridley::Errors::ResourceNotFound\n @target_cookbook = nil\n end\n\n if @target_cookbook.nil?\n msg = \"Cookbook '#{name}' found at #{self}\"\n msg << \" that would satisfy constraint (#{version_constraint})\" if version_constraint\n raise CookbookNotFound, msg\n end\n\n @target_cookbook\n end", "def cookbook_path\n @cookbook_paths.first\n end", "def new\n @cookbook = Cookbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cookbook }\n end\n end", "def preview_title_and_toc\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.title_and_toc\n render \"previews/preview\"\n end", "def new\n @order = @cookbook.get_active_order if @cookbook.is_owner? current_user\n\n # Only allow owner to order\n if @order\n\n # Redirect user if cookbook has too much pages for the selected binding\n if @cookbook.num_pages > @cookbook.book_binding.max_number_of_pages\n redirect_to notify_binding_problem_order_path(@order)\n return\n end\n\n # Make sure that the active order is not a canceled reorder (from old code)\n @order.update_attribute(:reorder_id, nil) \n end\n end", "def synchronized_cookbook(cookbook_name)\n print '.'\n end", "def create\n @cookbook = Cookbook.new(params[:cookbook])\n @cookbook.user = current_user\n @cookbook_like = CookbookLike.create( cookbook: @cookbook )\n @cookbook.cookbook_like = @cookbook_like\n respond_to do |format|\n if @cookbook.save\n format.html { redirect_to cookbooks_url, notice: 'Cookbook was successfully created.' }\n format.json { render json: @cookbook, status: :created, location: @cookbook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookbook_params\n params.require(:cookbook).permit(:name, :vcs_url, :project_id)\n end", "def build_cookbook(cookbook)\n berksfile = Berkshelf::Berksfile.from_file(File.join(cookbook[:path], \"Berksfile\"))\n berksfile.vendor(\"berks-cookbooks\")\n\n File.open(\"berks-cookbooks/Berksfile\", 'w') { |file|\n file.write(\"source \\\"https://supermarket.chef.io\\\"\\n\\n\")\n file.write(\"cookbook \\\"#{cookbook[:name]}\\\", path: \\\"./#{cookbook[:name]}\\\"\")\n }\n\n if cookbook[:cookbook_filename].end_with? \".zip\"\n zf = ZipFileGenerator.new(\"berks-cookbooks\", cookbook[:cookbook_filename])\n zf.write\n elsif cookbook[:cookbook_filename].end_with? \".tar.gz\"\n system(\"tar -czvf #{cookbook[:cookbook_filename]} -C berks-cookbooks . > /dev/null 2>&1\")\n end\n end", "def info(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end", "def cookbook_params\n params.require(:cookbook).permit(:name, :user_id)\n end", "def cookbook_file(*args, &block)\n Log.instance << \"About to cook the file: #{args[0]}\"\n @@chef_orig_cookbook_file.bind(self).call(args, &block)\n Log.instance << \"Hoora the file: #{args[0]} has been cooked\"\n end", "def cookbook_owner?\n if current_cookbook && current_user.id != current_cookbook.owner.id\n redirect_to sections_path, alert: \"As a Contributor you may only access the \\\"Recipes\\\" and \\\"Preview\\\" pages for the cookbook.\"\n end\n end", "def preview_index\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.index\n render \"previews/preview\"\n end", "def show\n @cooking_recipe = CookingRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cooking_recipe }\n end\n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow\n @cookbook.cookbook_followers.create(user: current_user)\n Supermarket::Metrics.increment \"cookbook.followed\"\n\n render_follow_button\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_cookbook(data)\n default_cookbook = 'nginx-app'\n\n return default_cookbook if data.is_a?(String)\n\n data.fetch('cookbook', default_cookbook)\nend", "def show\n @descriptions = @recipe.descriptions\n @rating = @recipe.ratings.average(:rating)\n unless current_user.nil?\n @favorites = current_user.favorites.pluck(:recipe_id)\n @favorite = @recipe.favorites.where(user: current_user)[0]\n end\n @parts = @recipe.parts\n @notes = @recipe.notes\n @comments = @recipe.comments.order(\"created_at DESC\")\n end", "def recipe args=1\n self.summary.recipe args\n end", "def show\n @client = Client.find(@receipt.client_id)\n end", "def build_recipe_with_or_without_cookbook\n if Cookbook.where(id: params[:cookbook_id]).exists?\n cookbook = Cookbook.find(params[:cookbook_id])\n @recipe = cookbook.recipes.build(recipe_params)\n @recipe.user = current_user\n else\n @recipe = current_user.recipes.build(recipe_params)\n end\n end", "def display_resource(recipe)\n recipe.name\n end", "def display_resource(recipe)\n recipe.name\n end", "def user_is_owner?\n current_cookbook.is_owner?(current_user)\n end", "def show\n add_breadcrumb \"#{@product.recipe.name}\", :product_path\n end", "def cookbook_name\n @cookbook_name ||= begin\n metadata = Ridley::Chef::Cookbook::Metadata.from_file(target.join('metadata.rb').to_s)\n metadata.name.empty? ? File.basename(target) : metadata.name\n rescue CookbookNotFound, IOError\n File.basename(target)\n end\n end", "def show\n @cooking_ingredient = CookingIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cooking_ingredient }\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 associate_user\n return redirect_to root_path unless @order.line_items.length > 0\n # product = @order.line_items.first.product\n # # @recommend_products = product.recommended_products\n # # unless @recommend_products.length > 0\n # # @recommend_products = product.get_recom_products\n # # end\n @title = \"Your Shipping Bag – Brandcruz.com Secure Shopping\"\n @keywords = \"brandcruz, Brand Cruz, Brandcruz.com\"\n @description = \"Shop for shopping cart cover at Brandcruz.com. Free Shipping. Free Returns. All the time.\"\n end", "def test\n # grab the version of the cookbook in the local metadata\n result = system \"knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1\"\n\n puts 'Running knife cookbook test:'\n puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbook test was NOT successful'.indent.to_red\n result\n end", "def verify_cookbook_creation\n fail 'You need to specify the cookbook name' if @opts[:cookbook].nil?\n end", "def preview\n end", "def preview\n end", "def load_user_cookbook(cookbook=nil)\n if session[:user_id]\n user = User.find session[:user_id]\n if cookbook\n if user && (user.owns_cookbook(cookbook) || user.contributes_to(cookbook))\n session[:cookbook_id] = cookbook.id\n end\n else\n if user && !user.owned_cookbooks.empty?\n session[:cookbook_id] = user.owned_cookbooks.first.id\n elsif user && !user.contributed_cookbooks.empty?\n cookbook = user.contributed_cookbooks.first\n session[:cookbook_id] = cookbook.id unless cookbook.owner.expired?\n end\n end\n end\n end", "def display_resource(recipe)\n \"Recipe ##{recipe.id} - #{recipe.name}\"\n end", "def show\n @recipe = Recipe.new\n end", "def create_cookbook(name, type, tmp)\n target = File.join(tmp, name)\n template_org = locate_config_value(\"github_template_org\")\n if template_org.nil? || template_org.empty?\n Chef::Log.fatal(\"Cannot find github_template_org within your configuration\")\n else\n\n github_url = @github_url.gsub('http://', 'git://') if @github_url =~ /^http:\\/\\/.*$/\n github_url = @github_url if @github_url =~ /^https:\\/\\/.*$/\n\n template_path = File.join(github_url, template_org, \"chef_template_#{type}.git\")\n shell_out!(\"git clone #{template_path} #{target}\") # , :cwd => cookbook_path)\n end\n end", "def show\n raise RecipeNotComplete unless @recipe.complete?\n @beerxml = BeerxmlParser.new(@recipe.beerxml).recipe\n @presenter = RecipePresenter.new(@recipe, @beerxml)\n @brew_steps = BrewStepsPresenter.new(@recipe)\n @brewlog = @recipe.brew_logs.build\n @brewlogs = @recipe.brew_logs.ordered.persisted\n\n Recipe.unscoped do\n commontator_thread_show(@recipe)\n end\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :layout => false }\n format.xml {\n send_data @recipe.beerxml, {\n type: 'application/xml',\n disposition: 'attachment',\n filename: \"#{@recipe.name}.xml\"\n }\n @recipe.increment!(:downloads)\n }\n end\n end", "def preview\n return @preview\n end", "def add_to_cookbook(recipe)\n @cookbook.push(recipe)\n end", "def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end", "def preview\n @referral = ReferralCategory.order(\"id ASC\")\n @title_page = \"More Info\"\n if order.items.select{|i| i.premium? }.blank?\n redirect_to premium_manage_orders_path\n elsif order.total.to_i < 1\n redirect_to dashboard_path\n end\n\n if current_user && order\n customer_profile = order.orderable ? order.orderable.profile : nil\n if customer_profile\n customer_profile.referal_id = current_user.code \n customer_profile.referal = current_user.referral_category.name if current_user.referral_category\n else\n redirect_to new_customer_manage_orders_path\n end\n end\n end", "def new\n # new cocktail part\n # @cocktail = Cocktail.new\n end", "def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\n end", "def set_cook_book\n @cook_book = CookBook.find(params[:id])\n end", "def cookbook_store\n Berkshelf.cookbook_store\n end", "def show\n @ingredients = @recipe.ingredients\n @owner = @recipe.owner\n @owner_user = User.find(@recipe.owner)\n @potluck = Potluck.new\n end", "def edit\n @page_title = \"Edit Recipe\"\n @recipe = current_user.recipes.find(params[:id])\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def edit\n @page_title = \"Edit Recipe\"\n @recipe = current_user.recipes.find(params[:id])\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def show\n @parts = @recipe.parts\n @avaliable = @recipe.avaliable\n end", "def show\n @course = @preview.course\n @sections = @course.sections\n @stripe_btn_data = {\n key: \"#{ Rails.configuration.stripe[:publishable_key] }\",\n description: \"#{@course.title}\",\n amount: @course.price * 100\n }\n end", "def contingent_link(dependency)\n version = dependency.cookbook_version\n cookbook = version.cookbook\n txt = \"#{cookbook.name} #{version.version}\"\n link_to(txt, cookbook_path(cookbook))\n end", "def flavor\n #object is whatever object you're passing through\n \"Spooky #{object.flavor}\"\n end", "def peek\n @receipt = BuyerOrder.new(@order)\n @market = @receipt.market.decorate\n @needs_js = true\n\n render \"show\", layout: false, locals: { receipt: @receipt, market: @market, user: current_user }\n end", "def show\n @recipes = @category.recipes.where is_draft: false\n end", "def cook\n @bread.mix\n @bread.let_rise\n @bread.bake\n end", "def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end", "def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end", "def current_chef\n @current_chef ||= Chef.find(session[:chef_id]) if session[:chef_id]\n end", "def set_cbook\n @cbook = Cbook.find(params[:id])\n end", "def cookbook_name(dependency)\n dependency.is_a?(Berkshelf::Dependency) ? dependency.name : dependency.to_s\n end", "def add(name)\n @cookbook.add_recipe(name)\n end", "def edit\n @customer = Effective::Customer.where(user: current_user).first!\n EffectiveOrders.authorized?(self, :edit, @customer)\n\n @subscripter = Effective::Subscripter.new(customer: @customer, user: @customer.user)\n\n @page_title ||= \"Customer #{current_user.to_s}\"\n end" ]
[ "0.6933546", "0.6590305", "0.6458196", "0.6370931", "0.616484", "0.60808307", "0.60649455", "0.6053982", "0.60436743", "0.6009953", "0.59808934", "0.5940761", "0.593446", "0.59180933", "0.5885206", "0.58740807", "0.58616465", "0.58076125", "0.5764444", "0.57035583", "0.56224686", "0.5609629", "0.5599958", "0.55441684", "0.55420905", "0.5533985", "0.55331683", "0.5498307", "0.5490709", "0.5474885", "0.5453168", "0.5444541", "0.5434365", "0.543369", "0.5372844", "0.5320216", "0.5306303", "0.53025335", "0.5287914", "0.5283054", "0.52648187", "0.5260437", "0.52590275", "0.52516", "0.5250209", "0.5236001", "0.5194606", "0.5187688", "0.5174624", "0.5136213", "0.51311475", "0.5123628", "0.5083851", "0.5075951", "0.50614434", "0.50476265", "0.5031678", "0.5029162", "0.50219953", "0.5009406", "0.5009406", "0.50000846", "0.50000423", "0.49962285", "0.49881884", "0.49754137", "0.49706876", "0.49603996", "0.49411765", "0.49411765", "0.4927785", "0.4927368", "0.49264914", "0.4916899", "0.49097213", "0.4907763", "0.490403", "0.48908207", "0.48871484", "0.48854408", "0.48727623", "0.48546416", "0.48485675", "0.4847517", "0.4844848", "0.4844848", "0.4843889", "0.48413792", "0.48392203", "0.48375732", "0.4835454", "0.48336053", "0.4818886", "0.48184884", "0.48184884", "0.48184285", "0.48172587", "0.48130625", "0.48118952", "0.48054478" ]
0.69126475
1
Preview the cookbook cover
def preview_cover preview_path = "#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf" session[:preview_filename] = preview_path preview = CookbookPreviewWorker.new( cookbook: current_cookbook, filename: preview_path ) preview.cover render "previews/preview" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n order = current_user.orders.find_by_cookbook_id(params[:id])\n @cookbook = (order) ? order.cookbook : current_cookbook\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: @cookbook, \n filename: preview_path\n )\n preview.cookbook\n render \"previews/preview\"\n end", "def preview\n end", "def preview\n end", "def cover_art\n if @cover_art.nil?\n @cover_art = container.img(:class, 's-access-image').src\n end\n\n @cover_art\n end", "def cover_image\n end", "def save_book_cover_image\n view = Openlibrary::View\n return unless self.isbn_10.present?\n book = view.find_by_isbn(self.isbn_10)\n if(!self.image.present?)\n if book.thumbnail_url.present?\n self.remote_image_url = book.thumbnail_url \n self.save\n end\n end\n end", "def save_book_cover_image\n view = Openlibrary::View\n return unless self.isbn_10.present?\n book = view.find_by_isbn(self.isbn_10)\n if(!self.image.present?)\n if book.thumbnail_url.present?\n self.remote_image_url = book.thumbnail_url \n self.save\n end\n end\n end", "def course_image_preview(entity)\n return '' if entity.image.blank?\n\n versions = \"#{entity.image.preview_2x.url} 2x\"\n image_tag(entity.image.preview.url, alt: entity.title, srcset: versions)\n end", "def preview(command)\n path = '/' + clean_up(command[1])\n dst = command[2]\n out, metadata = @client.files.preview(path)\n pp metadata\n open(dest, 'w') { |f| f.puts out }\n puts \"wrote thumbnail #{ dst }.\"\n end", "def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end", "def cover_image\n add_property('cover-image')\n end", "def preview\n redirect_to preview_url\n end", "def preview_index\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.index\n render \"previews/preview\"\n end", "def show_preview path\n @windows.load_preview path\n end", "def preview\n if params[:image].present?\n app = Dragonfly.app\n image = params[:image]\n content = Dragonfly::Content.new(app, image)\n uid = app.store(content)\n @image = app.fetch(uid)\n attrs = {uid: uid, name: image.original_filename, width: @image.width, height: @image.height}\n @retained_image = Dragonfly::Serializer.json_b64_encode(attrs)\n @colors = Miro::DominantColors.new(params[:image].tempfile).to_hex\n end\n\n render layout: false\n end", "def preview\n return @preview\n end", "def preview_title_and_toc\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.title_and_toc\n render \"previews/preview\"\n end", "def preview(*)\n nil\n end", "def preview(*)\n nil\n end", "def set_cover_image(format)\n case format\n when \"Book\"\n return \"cornell/virtual-browse/book_cvr.png\"\n when \"Journal/Periodical\"\n return \"cornell/virtual-browse/journal_cvr.png\"\n when \"Manuscript/Archive\"\n return \"cornell/virtual-browse/manuscript_cvr.png\"\n when \"Map\"\n return \"cornell/virtual-browse/map_cvr.png\"\n when \"Musical Recording\"\n return \"cornell/virtual-browse/musical_recording_cvr.png\"\n when \"Musical Score\"\n return \"cornell/virtual-browse/musical_score_cvr.png\"\n when \"Non-musical Recording\"\n return \"cornell/virtual-browse/non_musical_cvr.png\"\n when \"Thesis\"\n return \"cornell/virtual-browse/thesis_cvr.png\"\n when \"Video\"\n return \"cornell/virtual-browse/video_cvr.png\"\n when \"Microform\"\n return \"cornell/virtual-browse/microform_cvr.png\"\n else\n return \"cornell/virtual-browse/generic_cvr.png\"\n end\n\n end", "def show\n @proof = Proof.new\n @new_images = \"\"\n end", "def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end", "def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end", "def edit_introduction\n @cookbook = current_cookbook\n end", "def show\n @cookbook = Cookbook.with_name(params[:cookbook]).first!\n @cookbook_version = @cookbook.get_version!(params[:version])\n @cookbook_version_metrics = @cookbook_version.metric_results.includes(:quality_metric)\n end", "def show_compact(classification)\n curi = classification.complianceClassification.uri\n image_description = image_compact(curi) if CLASSIFICATION_IMAGES.key?(curi)\n image = image_description &&\n \"<img src='#{image_description[:src]}' alt='#{image_description[:alt]}'></img>\"\n \"#{classification.year} #{image} #{classification.complianceClassification.name}\"\n end", "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "def show\n @cake = Cake.find params[:id]\n cake_pictures = @cake.cake_pictures\n render_pictures cake_pictures, @cake.name.titleize\n end", "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end", "def get_job_preview_sample(client)\n response = client[\"jobs/#{$job_id}/preview/1\"].get\n\n p ''\n p 'Get job preview'\n uri = \"data:image/jpeg;base64,#{Base64.strict_encode64 response}\"\n p uri\nend", "def S(args)\n puts \"\\n=>\\n\"\n @image.show\n end", "def frontcover_url\n if @collateral_detail\n @collateral_detail.frontcover_url\n end\n end", "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def show\n @cover = Cover.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cover }\n end\n end", "def afficher\n @image.display\n end", "def brief_planted_crops\n planted_array = self.seed_bags.where(\"planted = ?\", 1)\n planted_array.each_with_index do |planted_seed_bag, index|\n puts \"#{index+1}. #{planted_seed_bag.crop_type.crop_name} Growth: #{(planted_seed_bag.growth/planted_seed_bag.crop_type.days_to_grow.to_f*100).round(1)}%\"\n end\n end", "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "def extract_preview(preview_properties, path)\n raise NotImplementedError.new 'This is only a function body for documentation'\n end", "def cover_fetcher\n if ENV['CI']\n File.open('./spec/factories/images/crysis.jpg')\n else\n # TODO: Make the dimensions more random.\n URI.open(\"#{Faker::LoremPixel.image(size: '560x800', is_gray: false)}/\")\n end\nend", "def preview=(value)\n @preview = value\n end", "def preview\n render :template => \"preview\", :layout => false\n end", "def show\n puts \"=====================================================\"\n puts @vip.image.url\n end", "def main_preview_img_header_variant\n if realty.preview_img.attached?\n view_context.image_tag realty.preview_img.variant(resize: '750X484^').processed, class: 'img-responsive project_img_top box-shadow img-rounded'\n end\n end", "def show\n commontator_thread_show(@diff.new_image)\n end", "def content_preview\n self.description.present? ? self.description : self.main_content\n end", "def preview\n attachments.first.file.url(:preview)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving preview #{exc.message}\")\n 'empty_file.png'\n end", "def image\n #images = Musicbrainz_db.get_cover_art(self.id)[\"images\"]\n\n images = SearchModule.get_cover_art(self.id)\n if images != nil\n return images[\"images\"].first[\"thumbnails\"][\"large\"]\n else\n return 'http://djpunjab.in/cover.jpg'\n end\n end", "def use_technology_preview; end", "def get_preview\n get_filtered_dataset false, 10\n end", "def with_no_cover\n build_image\n self\n end", "def show_preview(model_class, options = {}, &block)\n return unless params[:preview_id]\n previewed = model_class.find(params[:preview_id], options)\n return unless previewed\n locals = {:body=>capture(previewed, &block)}\n concat(render(:partial => \"shared/ubiquo/preview_box\", :locals => locals))\n end", "def show(cookbook)\n path = File.expand_path(cookbook.path)\n cookbooks[cookbook.cookbook_name] = { path: path }\n end", "def preview\n render 'preview', :layout => false\n end", "def edit\n @cookbook = current_cookbook\n end", "def cover_url\n #rails_blob_path(image, disposition: 'attachment', only_path: true)\n end", "def preview\n @text = params[:deliverable][:description]\n render :partial => 'common/preview'\n end", "def cover\n\t\tself.image.blank? ? \"default.jpg\" : self.image\n\tend", "def show\n find_edition(params)\n if !@edition.imageurl && @edition.image\n @edition.imageurl = @edition.image.public_filename\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @edition.to_xml(:include => [:image, :descriptions]) }\n end\n end", "def cover\n # we have cover set test because not sufficient to\n # just test for @cover.nil? because nil is a valid\n # condition for @cover and we don't want to go\n # back through all the logic again\n if !@cover_set\n @cover = cover_fetch\n @cover_set = true\n end\n @cover\n end", "def show\n @cover = Cover.find(params[:id])\n @plan = Plan.find(@cover.plan_id)\n @incident = Incident.find(@plan.incident_id)\n @block = Block.new\n @blocks = @cover.blocks.order(position: :asc)\n end", "def display_image\n image.variant(combine_options: {\n auto_orient: true,\n gravity: \"center\",\n resize: \"250x250^\",\n crop: \"250x250+0+0\"\n })\n end", "def edit\n @album = current_user.albums.find(params[:id])\n @cover = @album.covers.first\n \n if @cover.nil?\n @cover = Cover.new\n end \n end", "def preview\n content[0..19]\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def set_cover_image\n @cover_image = CoverImage.find(params[:id])\n end", "def cover\n \"http://lorempixel.com/100/150/\" +\n %w(abstract nightlife transport).sample +\n \"?a=\" + SecureRandom.uuid\n end", "def extract_cover(replace_cover=true)\n if cover && !replace_cover\n return false\n end\n return false if tracks.empty?\n if full_path = tracks.first.extract_cover\n self.cover = File.basename(full_path)\n self.thumbnail = \"#{id}.png\"\n end\n end", "def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end", "def show(preset, source_path, format)\n only_provides(*graphics_mime_types)\n raise NotFound unless source_path && preset_exists?(preset)\n img = ImMagick::Image.file(source_path)\n render_preset(preset, img)\n if image_path = save_file(img)\n store_cache_reference!(params[:doc_id], GraphicsSlice[:expire_cache] || 0) if respond_to?(:store_cache_reference!) && params[:doc_id]\n send_file(image_path, :disposition => 'inline', :type => content_type_for(format))\n else\n raise NotFound\n end\n end", "def show_previews\n session[:solution] == nil && generate\n load_sections(nil, true)\n end", "def preview\n assign_attributes\n @post\n end", "def content_preview\n self.send(content_preview_method)\n end", "def preview\n @preview ||= Preview.new(self) #if has_preview?\n end", "def content_preview(options = {})\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n raise 'Unable to generate preview' if options[:silence] != true && preferences[:content_preview] != true\n\n image_resize(file.content, 200)\n end", "def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end", "def preview() @page.find(input_elements[:preview]) end", "def preview\n begin\n page = ComatosePage.new(params[:page])\n page.author = fetch_author_name\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end", "def preview?\n false\n end", "def show\n\n \n end", "def show\n unless @image.image.attached?\n @image_preview = ImagePreview.find_by(image_id: @image.id, preview_type: 'original')\n respond_to do |format|\n if @image_preview\n format.html { redirect_to admin_image_preview_url(@image) }\n else\n format.html { redirect_to new_admin_image_preview_url(image_id: @image.id) }\n end\n end\n end\n end", "def show(preset, character_data, format)\n only_provides(*graphics_mime_types)\n raise NotFound unless content_type && preset_exists?(preset)\n runner = send(:\"#{rubify(preset)}_preset\", character_data) \n raise InternalServerError unless runner.is_a?(ImMagick::Command::Runner)\n image_path = save_file(runner).filename\n store_cache_reference!(params[:doc_id], GraphicsSlice[:expire_cache] || 0) if respond_to?(:store_cache_reference!) && params[:doc_id]\n send_file(image_path, :disposition => 'inline', :type => content_type_for(format))\n end", "def update_thumbs\n File.open(self.cover_art) do |f|\n self.default_cover_art = f\n self.default_cover_art.recreate_versions!\n self.save!\n end\n end", "def extract_cover\n puts 'Extract front cover'\n extract_png(1, 'cover')\n puts 'Extract back cover'\n extract_png(page_count, 'back')\n end", "def process_previews!\n source = Magick::ImageList.new(preview_path).first\n\n previews.each do |name, blk|\n path = File.join(@dir, \"#{name}_preview.jpg\")\n\n copy = source.copy\n blk.call(copy)\n copy.write(path)\n\n @paths << path\n end\n\n @paths\n end", "def show\n @samples = ImageReaderService.new(@image).analyze.generate_samples 4\n end", "def list_items_preview\n end", "def edit_title\n @cookbook = current_cookbook\n end", "def cover\n document.at(\"img[@id='coverImage']\")['src'] rescue nil\n end", "def update\n @highlight = @celebration.highlights.find(params[:id])\n\n respond_to do |format|\n if @highlight.update_attributes(params[:highlight])\n if params[:highlight][:cover_photo].present?\n format.html {render :crop}\n else\n crop\n \n format.html { redirect_to [@celebration,@highlight], notice: 'Highlight was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: [@celebration,@highlight].errors, status: :unprocessable_entity }\n end\n end\n end", "def get_cover_image(book, url)\n if not url.nil?\n name = book.name || \"#{book.series.name} \\##{book.number}\"\n log(\"attempting to retrieve cover art [#{url}]\", :debug)\n cover_image = book.build_cover_image(:uploaded_data => UrlUpload.new(url))\n if cover_image.save\n log(\"successfully added cover art [#{name}]\", :debug)\n else\n log(\"unable to add cover art [#{name}]\", :debug)\n end\n else\n log(\"invalid URL for cover art [#{name}]\", :debug)\n end\n rescue OpenURI::HTTPError\n log(\"cover art not found [#{name}]\", :debug)\n end", "def preview_local\n preview('--config _config.yml,_config.local.yml')\nend", "def show\n @crop = Crop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crop }\n end\n end", "def show\n @crop = Crop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crop }\n end\n end", "def revise_cover_status\n if self.cover?\n Plant.find(self.plant_id).pictures.each do |picture|\n if (picture.cover? && picture.id != self.id)\n picture.cover = false\n picture.save\n end\n end\n end\n end", "def show\n @cookbook = Cookbook.with_name(params[:cookbook]).\n includes(:cookbook_versions).first!\n @latest_cookbook_version_url = api_v1_cookbook_version_url(\n @cookbook, @cookbook.latest_cookbook_version\n )\n\n @cookbook_versions_urls = @cookbook.sorted_cookbook_versions.map do |version|\n api_v1_cookbook_version_url(@cookbook, version)\n end\n end" ]
[ "0.6626343", "0.6560433", "0.6560433", "0.6156586", "0.6087413", "0.59966797", "0.59966797", "0.59686", "0.5883065", "0.58734447", "0.5836019", "0.5792734", "0.57913464", "0.57071495", "0.57039464", "0.56878126", "0.5681726", "0.5663612", "0.5663612", "0.56445384", "0.5624729", "0.5615977", "0.5615977", "0.5548196", "0.5525174", "0.5521577", "0.5518048", "0.5518048", "0.55066866", "0.55054706", "0.54943717", "0.54773086", "0.547153", "0.54648525", "0.5457506", "0.5445111", "0.5444303", "0.5428905", "0.5423255", "0.5423255", "0.5398287", "0.53956795", "0.5381514", "0.538006", "0.5367521", "0.53565174", "0.53543633", "0.5350286", "0.5334471", "0.53253263", "0.53188664", "0.531694", "0.5311244", "0.5306982", "0.5306016", "0.52902204", "0.52899134", "0.5277581", "0.52670014", "0.5259812", "0.52588344", "0.52547395", "0.52529037", "0.5251316", "0.52496004", "0.52464724", "0.5241276", "0.5241276", "0.5241276", "0.5241202", "0.5236578", "0.52361375", "0.5235855", "0.5235578", "0.5230621", "0.522723", "0.5225435", "0.5224412", "0.5222616", "0.5220645", "0.52201086", "0.5217136", "0.5216862", "0.521502", "0.52145433", "0.5213119", "0.5208132", "0.5205278", "0.52000016", "0.51962566", "0.51922554", "0.51908445", "0.5188337", "0.5187841", "0.5185776", "0.51833427", "0.51821786", "0.51821786", "0.5181537", "0.5174247" ]
0.7587635
0
Preview the title and the table of contents pages
def preview_title_and_toc preview_path = "#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf" session[:preview_filename] = preview_path preview = CookbookPreviewWorker.new( cookbook: current_cookbook, filename: preview_path ) preview.title_and_toc render "previews/preview" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n end", "def preview\n end", "def preview_page(name, data, format)\n page = @page_class.new(self)\n ext = @page_class.format_to_ext(format.to_sym)\n path = @page_class.cname(name) + '.' + ext\n blob = OpenStruct.new(:name => path, :data => data)\n page.populate(blob, path)\n page.version = @access.commit('HEAD')\n page\n end", "def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end", "def show_previews\n session[:solution] == nil && generate\n load_sections(nil, true)\n end", "def content_preview\n self.description.present? ? self.description : self.main_content\n end", "def preview\n begin\n page = ComatosePage.new(params[:page])\n page.author = fetch_author_name\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end", "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "def show\r\n @page_title = @page.title\r\n end", "def document_show_html_title document=nil\n document ||= @document\n\n presenter(document).html_title\n end", "def show\n\n p \"---------\"\n p @contents\n\n end", "def preview\n content[0..19]\n end", "def page_title\n end", "def show\n @title = @content.title\n end", "def preview\n begin\n page = Comatose::Page.new(params[:page])\n page.author = current_user\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '&lt;')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end", "def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend", "def page_title; end", "def index\n page_title = params[:page]\n @page = @wiki.find_or_new_page(page_title)\n if @page.new_record?\n edit\n render :action => 'edit' and return\n end\n @content = @page.content_for_version(params[:version])\n if params[:export] == 'html'\n export = render_to_string :action => 'export', :layout => false\n send_data(export, :type => 'text/html', :filename => \"#{@page.title}.html\")\n return\n elsif params[:export] == 'txt'\n send_data(@content.text, :type => 'text/plain', :filename => \"#{@page.title}.txt\")\n return\n end\n render :action => 'show'\n end", "def display\n\t\ttitle\n\tend", "def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end", "def show\n @page_title = @tutorial.title\n @seo_keywords = @tutorial.body\n end", "def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end", "def show\n\n # extract the content\n extract_content\n generate_titles\n\n rescue ActiveRecord::RecordNotFound\n\n not_found and return\n\n end", "def pages; end", "def preview\n render :template => \"preview\", :layout => false\n end", "def show\n @object = @story\n @title = @story.name\n respond_to do |format|\n format.html { render :show }\n format.pdf do\n render pdf: 'export',\n disposition: 'attachment',\n header: { right: '[page] of [topage]' },\n outline: { outline: false,\n outline_depth: 2 },\n toc: {\n disable_dotted_lines: true,\n disable_toc_links: true,\n level_indentation: 4,\n header_text: @story.name,\n text_size_shrink: 0.5\n }\n end\n end\n end", "def overview\n\n end", "def preview\n #for debug\n params[:d] = 'www.rubyecommerce.com'\n \n the_website=the_menu=the_layout=the_theme = nil\n the_website = Website.find_by_url(params[:d])\n if params[:c]\n the_menu = Menu.find_by_id(params[:c])\n else\n the_menu = Menu.find_by_id(the_website.index_page) \n end\n the_theme = TemplateTheme.find(the_menu.find_theme_id(is_preview=true))\n do_preview(the_theme.id, the_theme.layout_id, the_menu.id)\n render :text => File.read(\"#{Rails.public_path}/shops/#{the_theme.file_name('html')}\")\n end", "def show\n @page_title = \"Voluntips | Projekt: \" + @project.title\n set_show_keywords\n end", "def display_body\n pages = $repo.commits.first.tree.contents.map { |blob| Page.new(blob.name) }\n \n # mostly taken from JunebugWiki, regexps this beautiful should be shared\n body.gsub(/\\[\\[([\\w0-9A-Za-z -]+)[|]?([^\\]]*)\\]\\]/) do\n page = title = $1.strip\n title = $2 unless $2.empty?\n page_url = page.gsub(/ /, '_')\n\n if pages.map(&:name).include?(page_url)\n %Q{<a href=\"/#{page_url}\">#{title}</a>}\n else\n %Q{<span>#{title}<a href=\"/e/#{page_url}\">?</a></span>}\n end\n end\n \n end", "def document_show_html_title\n @document[Blacklight.config[:show][:html_title]]\n end", "def display_preview!(theme, header_text)\n PryTheme.set_theme(theme)\n display_header(header_text, output)\n test_theme\n end", "def display_body \n # mostly taken from JunebugWiki, regexps this beautiful should be shared\n content = self.body.gsub(/\\[\\[([\\w0-9A-Za-z -]+)[|]?([^\\]]*)\\]\\]/) do\n page = title = $1.strip\n title = $2 unless $2.empty?\n page_url = page.gsub(/ /, '_')\n \n if Page.find(:name => page_url).first\n %Q{<a href=\"/show/#{page_url}\">#{title}</a>}\n else\n %Q{<span>#{title}<a href=\"/new/#{page_url}\">?</a></span>}\n end\n end\n RedCloth.new(content, []).to_html\n end", "def show_title\n h2 { h @title.titles }\n text gs_title(@title)\n sources = []\n sources << a('Anime News Network Encyclopdia', :href => \"http://www.animenewsnetwork.com/encyclopedia/anime.php?id=#{@title.ann_id}\") unless @title.ann_id.nil?\n sources << a('AniDB', :href => \"http://anidb.net/perl-bin/animedb.pl?show=anime&aid=#{@title.anidb_id}\") unless @title.anidb_id.nil?\n \n unless sources.empty?\n p { \"View #{h @title.title} in #{sources.join(\", \")}.\" }\n end\n end", "def show\n @preview_page_1=@member.preview_page_1\n @preview_page_2=@member.preview_page_2\n end", "def preview_index\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.index\n render \"previews/preview\"\n end", "def get_page_contents(title)\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => title,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def title\n page.title\n end", "def display_all_titles\n # Interface method\n end", "def prt\n puts \"Federalist #@fedno\\n\"\n puts \"\\n#@title\\n\"\n puts \"\\n#@author\\n\"\n puts \"\\n#@content\\n\"\n end", "def preview_page(name, data, format)\n ::Gollum::PreviewPage.new(self, \"#{name}.#{::Gollum::Page.format_to_ext(format.to_sym)}\", data, @access.commit(@ref))\n end", "def title_page(controller_name)\n raw=controller_name.split(/[_\\/]/)\n if raw[0] == \"order\"\n 3.times do |i|\n raw.shift\n end\n end\n\n if raw[0] == \"setting\"\n raw.shift\n end\n\n case params[:action]\n when 'show'\n raw.insert((raw.count + 1), 'detail')\n when \"new\"\n raw.insert(0, 'new')\n when \"edit\"\n raw.insert(0, 'edit')\n when \"edit_level_limit\"\n raw.insert(0, 'change level limit')\n when \"get_grn_history\"\n raw.insert(0, 'History of')\n when \"get_grpc_history\"\n raw.insert(0, 'History of')\n when \"features\"\n raw.insert(0, 'Set Feature')\n when \"get_report\"\n raw.insert(0, \"#{params[:search][:order_type].gsub('_', ' ')} Report\")\n when \"detail_report_return\"\n raw.insert(0, \"Detail #{params[:title].gsub('_', ' ')} Report\")\n when \"detail_report_orders\"\n raw.insert(0, \"Detail #{params[:title].gsub('_', ' ')} Report\")\n when \"detail_report_debit_note\"\n raw.insert(0, \"Detail #{params[:title].gsub('_', ' ')} Report\")\n when \"service_level_suppliers\"\n raw.insert(0, \"#{params[:action].gsub('_', ' ')}\")\n when \"on_going_disputes\"\n type = params[:type] == \"GRN\" ? GRN : GRPC\n raw.insert(0, \"#{params[:action].gsub('_', ' ')} (#{type})\")\n when \"pending_deliveries\"\n raw.insert(0, \"#{params[:action].gsub('_', ' ')}\")\n when \"returned_histories\"\n raw.insert(0, \"#{params[:action].gsub('_', ' ')}\")\n when \"returned_history_details\"\n raw.insert(0, \"#{params[:action].gsub('_', ' ')}\")\n when \"on_going_dispute_details\"\n type = params[:type] == \"GRN\" ? GRN : GRPC\n raw.insert(0, \"#{params[:action].gsub('_', ' ')} (#{type})\")\n when \"pending_delivery_details\"\n raw.insert(0, \"#{params[:action].gsub('_', ' ')}\")\n end\n\n unless params[:action] == \"index\"\n temp = raw[-1].singularize\n raw[-1] = temp\n end\n\n #khusus hanya untuk reporting dashboard\n if params[:controller].downcase == \"dashboards\" && params[:action] == \"get_report\"\n title=raw[0].titleize\n elsif params[:controller].downcase == \"dashboards\" && params[:action] == \"detail_report_orders\"\n title=raw[0].titleize\n elsif params[:controller].downcase == \"dashboards\" && params[:action] == \"detail_report_debit_note\"\n title=raw[0].titleize\n elsif params[:controller].downcase == \"dashboards\" && params[:action] == \"detail_report_return\"\n title=raw[0].titleize\n else\n title=raw.join(' ').titleize\n end\n\n if title == 'Companies' || title == 'Company'\n case params[:action]\n when 'index'\n title = \"Company Profile\"\n when 'new'\n title = \"Create Company Profile\"\n when 'edit'\n title = \"Edit Company Profile\"\n end\n end\n\n js= \"<script>\n $('.title-page').html('#{get_alias_title_name_controller(title)}');\n </script>\"\n return js.html_safe\n end", "def show\n @page_title = \"Our lessons\"\n end", "def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end", "def preview_index(urls, path: request.path)\n render(path: __dir__ + \"/index.erb\", locals: { urls: Array(urls), path: path })\n end", "def preview\n render 'preview', :layout => false\n end", "def show\n @page_title = \"BNUOJ #{@problem.pid} - #{@problem.title}\"\n end", "def pages\n end", "def index \n \n @title=\"Administration page - \"\n \n end", "def page_title\n \"Changes Introduced by CMVC #{type}#{defect_name}\"\n end", "def content_preview\n self.send(content_preview_method)\n end", "def title(page_title)\n \tcontent_for(:title) { page_title }\n \tend", "def preview() @page.find(input_elements[:preview]) end", "def full_page\n end", "def page_title() nil end", "def view(title=nil, id=nil)\n if title\n encoded = title.split.join(\"_\")\n endpoint = \"https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=wikitext&page=#{encoded}&redirects\"\n elsif id\n encoded = title.split.join(\"_\")\n endpoint = \"https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=wikitext&pageid=#{encoded}\"\n end\n hash = get(endpoint)\n page = hash[\"parse\"][\"wikitext\"].to_s.gsub( '\\n', \"\\n\" )\n tmp = Tempfile.new(\"wik-#{encoded}-\")\n tmp.puts page\n system \"less #{tmp.path}\"\n tmp.close\n tmp.unlink\n return hash\n end", "def index\n @title = \"All pages\"\n @pages = Page.all\n end", "def show\n @page_title='Aktuator'\n end", "def show\n @page_title = @news.title\n @page_description = @news.description\n end", "def title\n preview_json['title']\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def show\n @page_title = @book.title\n end", "def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end", "def title_view\n html = \"\"\n html << \"<span class=\\\"icon12 icomoon-icon-home home_page\\\"></span>\" if self[:home_page]\n html << (ActionController::Base.helpers.link_to self[:title], ApplicationController.helpers.edit_url(self.class.base_class, self))\n html.html_safe\n end", "def show\n @page_title = t(:front_show_title)\n @page_descr = @article.text.truncate(120)\n end", "def show\n @page_title = \"#{@book.title}\"\n end", "def viewHtmlDocContent (queries = {} )\r\n closeHtmlDocWithTitle (queries ) \r\n end", "def show\n @editable = @page\n @title = PageTitle.new I18n.t(\"page_titles.about.#{@page.slug}\")\n\n # no layout\n render html: @page.content.html_safe, layout: false if @page.content_in_html?\n end", "def page_title(title)\n content_for :page_title, title\n end", "def page_title\n \"which fileset for #{path}\"\n end" ]
[ "0.64124614", "0.64124614", "0.6228087", "0.61932886", "0.61879516", "0.6138907", "0.6136847", "0.61265945", "0.6119841", "0.6118165", "0.60977024", "0.6089731", "0.6074166", "0.6062032", "0.60570693", "0.6053675", "0.6051556", "0.6033562", "0.6026164", "0.6017094", "0.600442", "0.59942293", "0.59911877", "0.59653383", "0.5964551", "0.59594125", "0.5932843", "0.59280455", "0.5924382", "0.59195316", "0.5919506", "0.5909169", "0.59086955", "0.5899473", "0.5892035", "0.58701634", "0.5851182", "0.5849366", "0.58436507", "0.58248204", "0.58243567", "0.58233625", "0.57980156", "0.57854575", "0.57733876", "0.574558", "0.57401395", "0.57346684", "0.57341415", "0.57241994", "0.57241285", "0.57232964", "0.57230496", "0.57196146", "0.57134783", "0.5705858", "0.57040066", "0.5702555", "0.57006365", "0.56967217", "0.56941456", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.56919974", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5690845", "0.5681733", "0.5681645", "0.5680598", "0.5667558", "0.5667228", "0.5666419", "0.5658526", "0.56524706", "0.5650614" ]
0.76360786
0
Preview the index page
def preview_index preview_path = "#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf" session[:preview_filename] = preview_path preview = CookbookPreviewWorker.new( cookbook: current_cookbook, filename: preview_path ) preview.index render "previews/preview" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview_index(urls, path: request.path)\n render(path: __dir__ + \"/index.erb\", locals: { urls: Array(urls), path: path })\n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n render\n end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def show\n index\n end", "def index\r\n end", "def index\r\n end", "def index\r\n end", "def index\r\n end", "def index\n \t\n end", "def index\n \t\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n puts \"\\n******* index *******\"\n end", "def index\n if current_user.admin?\n @previews = Preview.all\n else\n redirect_to root_path\n flash[:notice] = \"Whoops! You're not supposed to be there!\"\n end\n end", "def index\n \n \n\n end", "def preview\n redirect_to preview_url\n end", "def index \n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end" ]
[ "0.7894774", "0.74425375", "0.74425375", "0.74425375", "0.7379633", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.73158634", "0.7315406", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.7274211", "0.72635037", "0.7244502", "0.7234572", "0.7234572", "0.7234572", "0.7204477", "0.71929735", "0.71929735", "0.7152316", "0.7152316", "0.7152316", "0.7152316", "0.7152316", "0.7152316", "0.7152316", "0.7152316", "0.7144478", "0.71412516", "0.7134303", "0.7121705", "0.7104271", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817", "0.70971817" ]
0.77508557
1
Respond with the number of pages for the current cookbook
def count_page num_pages = current_cookbook.num_pages render json: {num_pages: num_pages} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_count; pages.count; end", "def getPageCount()\n return @helper.getPageCount()\n end", "def getPageCount()\n return @helper.getPageCount()\n end", "def getPageCount()\n return @helper.getPageCount()\n end", "def getPageCount()\n return @helper.getPageCount()\n end", "def page_count\n @page_counter\n end", "def page_count\n bib_page_count\n end", "def total_pages; end", "def page_count\n @pages.count\n end", "def get_page_count( rb, tagged )\n\n verbose( \"Getting #{$params[ :product ]} page count...\" )\n verbose( \"Only looking for #{$params[ :product ]} tagged with \\\"#{tagged}\\\"\" ) if tagged \n\n # Download the first page of art and grab the body.\n page = grab_art_page( rb, tagged, 1 )\n\n # Find the number of the last page of art.\n last = page.elements.to_a( \"//li[@class='page-link']/a\" ).last\n\n # If we managed to get that...\n if last then\n # ...return it as a number.\n verbose( \"Done (max page is #{last.text.to_i}).\" )\n last.text.to_i\n else\n # ...or, if we didn't, moan...\n $stderr.puts \"Could not find maximum page number. Assuming just one page.\"\n # ...and assime it's a single page.\n 1\n end\n \nend", "def page_count\n @page_count\n end", "def page_count\n @total_pages\n end", "def number_of_pages\n return @number_of_pages\n end", "def count\n @document.page_count\n end", "def page_count\n 1\n end", "def num_pages\n if order_bw_pages && order_color_pages\n return 2 + order_bw_pages + order_color_pages\n end\n end", "def num_pages\n 26\n end", "def actual_page_count\n warn \"WARNING: actual_page_count is not yet implemented properly.\"\n warn \" Please send patches.\"\n @pages.count\n end", "def get_links_count page_number\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if page_number == ''\n raise 'page number not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/links'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Links']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def page_count(arg)\n @pages = arg\n end", "def num_pages\n \n # Retrieve postings that match the given conditions\n postings = getPostings(params)\n \n # Escapes the case when @postings is nil\n num_pages = postings.blank? ? 0 : postings.num_pages\n \n respond_to do |format|\n format.json { render json: num_pages }\n end\n \n end", "def total_pages\n collection.total_pages\n end", "def total_pages\n pages.size\n end", "def count\n resource = @client.send(:head, self.next, **@options)\n resource.get_response.total_records\n end", "def page_count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_pages\n end", "def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end", "def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end", "def number_of_json_pages(state) #this will return an integer representing number of pages, use this to refactor\n state_locations(state)[\"numberOfPages\"]\n end", "def page_count\n @page_count ||= get_page_count\n end", "def current_page_number\n @pageset.size\n end", "def num_pages\n groups = self.groups.includes(:descriptions)\n groups.map {|g| g.descriptions.length > 0 ? 1 : 0}.sum\n end", "def total_pages\n @total_pages\n end", "def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end", "def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end", "def page_count\n @collection.max + 1\n end", "def page_count\n if item_count % @items_per_page == 0\n item_count / @items_per_page\n else\n 1 + (item_count / @items_per_page)\n end\n end", "def get_page_count(response)\n page_links = response.headers['link'].scan(/<(\\S+)>/).flatten\n /\\?page\\=(\\d+)\\&/.match(page_links.last)[1].to_i\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end", "def total_pages\n (items.size - 1) / max_items + 1\n end", "def page_count\n @page_count = notices_count/30 + 1\n @page_count = max_pages if @page_count > max_pages\n @page_count\n end", "def page_item_count(page_index)\n return -1 if page_index < 0 || page_index >= self.page_count\n @pages[page_index].count\n end", "def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end", "def total_pages\n -1\n end", "def page_count\n file_groups\n @highest_page_count\n end", "def item_count\n @pages.inject(0){|item_count, page| item_count + page.count}\n end", "def number_of_pages=(value)\n @number_of_pages = value\n end", "def page_count\n # Integer arithmetic is simpler and faster.\n @page_count ||= item_count > 0 ? (item_count - 1) / items_per_page + 1 : 1\n end", "def pages(board)\n get(board, 1)[:pages].size\n end", "def get_total_pages\n list = @parsed_response[\"#{@collection}List\"]\n @total_pages = (list['total_results'].to_f/list['page_size'].to_f).ceil\n end", "def num_pages\n (count.to_f / options[:limit]).ceil\n end", "def total_words\n respond_with(total_words: @page.total_words)\n end", "def page_item_count(page_index)\n return -1 if page_index > @collection[-1] || page_index < 0\n @collection.count {|v| v == page_index}\n end", "def getTotalPageCount()\n return @helper.getTotalPageCount()\n end", "def page_count=(num)\n @page_count = num\n end", "def get_catagory_num_page catagory_url\n doc = FetchUri.new(catagory_url,{}).doc\n begin\n doc.css('.dropdown.adr-dropdown ul.dropdown-menu li').last.text.gsub(/\\D/, '').to_i\n rescue => e\n return 1\n end\n end", "def pages_per_bookkeeping_page\n page_size\n end", "def page_count \n (item_count / @per_page.to_f).ceil \n end", "def pages\n project_size = Project.all.length\n\n puts project_size\n\n respond_to do |format|\n format.json {\n @pages = (project_size/10.0).ceil\n render :json => @pages \n }\n end\n end", "def page_count\n (item_count / @items_per_page.to_f).ceil\n end", "def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size\n end\n end", "def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end", "def page_num_getter\n\t\t##Nokogiri\n\t\t# doc = Nokogiri::HTML(open(@page_name))\n\t\t# puts doc.css('result custom-right-inner')\n\t\t##Mechanize\n\t\t##new agent\n\t\t@agent = Mechanize.new\n\t\tstr = @agent.get(@page_name).search('span.custom-right-inner')[0].text\n\t\t@total_page = str.scan(/\\d+/)[0].to_i\n\tend", "def page_count(doc)\n doc.at_css('.pagination') && doc.at_css('.pagination')\n .css('b')\n .map(&:text)\n .map(&:to_i)\n .max\n end", "def get_total_pages\n\t\turl = \"#{@base_url}partners?city=#{@city}\"\n\t\tpage = @mechanize.get(url)\n\t\ttotal_pages = page.search('.pagination li:last a')[0]['href'].split('=')[2].to_i\n\tend", "def nbpages\n attachments.order(position: 'asc').first.nbpages\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end", "def page_count(input)\n info = info(input)\n return nil if info.nil?\n info['Pages'].to_i\n end", "def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end", "def get_num_pages\n record_count = @model_class.count\n if record_count % @items_per_page == 0\n (record_count / @items_per_page)\n else\n (record_count / @items_per_page) + 1\n end\n end", "def number_of_pages job\r\n count = 0\r\n pages = job.client_images_to_jobs.length\r\n if (@facility.image_type == 1) && (pages < 2)\r\n job.images_for_jobs.each do |image|\r\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\r\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\r\n end\r\n pages = count\r\n end\r\n pages\r\n end", "def get_bookmarks_count\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/bookmarks'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Bookmarks']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/Parser/Images/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def get_page_count(status)\n data.pages.select { |page| page.status == status }.count\n end", "def page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end", "def extract_total_pages\n pag = setup.fetch_page.css('.Ver12C')[70].text\n pag.scan(/\\d+/)[2].to_i\n end", "def get_collections_count()\n uri = build_uri('info/collection_counts')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end", "def max_pages() 1 end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def page_size\n 10\n end", "def page(req)\n req.params.fetch('page', default='1').to_i\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def page_counter\n @counter+=1\n puts \"Page #{@counter} done\"\n get_next_page until @counter >= @pages\n end", "def page_item_count(page_index)\n return -1 if page_index < 0 || page_index > page_count-1 \n return @per_page if page_index < page_count-1 \n return item_count - ((page_count-1) * @per_page) \n end", "def index\n @total = Cookbook.count\n @cookbooks = Cookbook.order('name ASC').limit(@items).offset(@start)\n end", "def total_words\n @page = Page.find(params[:id])\n @word_count = @page.title.length + @page.content.length\n\n respond_to do |format|\n format.json {render json: @word_count}\n format.xml {render xml: @word_count}\n end\n end", "def page_size\n @raw_page['records'].size\n end", "def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end", "def returned_count\n reply.documents.length\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages\n document.at(\"[@itemprop='numberOfPages']\").innerHTML.scan(/\\d+/).first.to_i rescue nil\n end", "def pageCount(book, page)\n return 0 if book == page || page == 1\n diff1 = page / 2\n diff2 = ((book - page) / 2) + ((book - page) == 1 && book.even? ? 1 : 0)\n diff1 < diff2 ? diff1 : diff2\nend", "def num_pages\n (@limit / 10.0).ceil\n end", "def page_count()\n if @pages >= 500\n return true\n end\n else\n return false\n end", "def total_pages\n total = total_items / page_size\n if total_items % page_size != 0\n total += 1\n end\n total\n end", "def resource_per_page\n 10\n end", "def total_pages\n pagination_adapter.total_pages\n end", "def total_pages\n nil\n end", "def total_pages\n nil\n end", "def total_words\n p = Page.find_by_id(params[:id])\n c = {:count =>\n p.title.split(%r{\\s+}).count + p.content.split(%r{\\s+}).count}\n respond_with c\n end", "def how_many(klass)\n JSON.parse(@client.raw_read(resource: klass, summary: \"count\").response[:body])[\"total\"].to_i\n end" ]
[ "0.710333", "0.69140714", "0.69140714", "0.69140714", "0.69140714", "0.69040275", "0.6766329", "0.6764628", "0.6753337", "0.67044806", "0.6690332", "0.6689448", "0.6682994", "0.66608137", "0.6655366", "0.6606979", "0.65942544", "0.6583469", "0.65683705", "0.6565279", "0.6549658", "0.64750534", "0.6475037", "0.6461059", "0.6426401", "0.64253414", "0.6419475", "0.6388016", "0.63742423", "0.6360127", "0.6352048", "0.63506716", "0.6344843", "0.63333136", "0.6301274", "0.62925327", "0.62891585", "0.6288987", "0.62878376", "0.6278968", "0.6276985", "0.6276825", "0.6263914", "0.62573195", "0.6252889", "0.6234216", "0.6225198", "0.62105405", "0.62084544", "0.6194479", "0.6178539", "0.61588526", "0.6149019", "0.6148998", "0.6145934", "0.613638", "0.61361533", "0.61292404", "0.6128274", "0.6121952", "0.61190933", "0.61190355", "0.611388", "0.61075723", "0.6096425", "0.6081463", "0.60532403", "0.60401165", "0.6018855", "0.6016894", "0.6014256", "0.6003534", "0.5997311", "0.5983077", "0.5976258", "0.5975679", "0.5975566", "0.5972142", "0.5969718", "0.59677285", "0.59625876", "0.5960037", "0.5952005", "0.5943172", "0.5940452", "0.5931215", "0.5927208", "0.59260947", "0.59260947", "0.59241796", "0.5920759", "0.59180814", "0.5915911", "0.5915419", "0.5913655", "0.5907233", "0.5902449", "0.5902449", "0.590137", "0.5898224" ]
0.87572855
0
Add Money to users account
def deposit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_money\n\t\t# get current user's money\n \t@user = current_user\n\t\t@money = @user.money\n\t\t# get refill limit\n\t\t@allowed = @user.money_refill\n\n\t\t# if limit has not been reached, add money to account\n\t\tif @allowed > 0\n\t\t\t@user.money = @money + 1000\n\t\t\t@user.money_refill = @allowed - 1\n\t\t\t@user.save\n\t\t\tgflash :success => \"Money Successfully Transferred to your account!\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\telse\n\t\t\t# otherwise flash pop up regarding depleted money reserve\n\t\t\tgflash :error => \"You have depleted your money reserve.\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\tend\n end", "def add_to_balance\n self.user.balance += self.price\n self.user.save\n end", "def console_add_money(amount)\n credits.create!(amount: amount, note: \"Admin added #{amount} cents\")\n end", "def add_money\n @total += fee\n end", "def add_credit\n#\t\tcurrent_user.update(balance: current_user.balance + params[:amount])\n\tend", "def add_money(value)\n @calculator.add_money value\n end", "def add_amount(amount)\n @balance += amount\n end", "def store_cash(price)\n @cash = cash + Money.new(price * 100)\n end", "def add_money!(json)\n put_inside!(money_from_json(json))\n end", "def deposit(money)\n @balance += money\nend", "def add_money_to_wallet\n puts \"\\n-----------------------\".colorize(:blue)\n puts \"How much more money do you want to add?\".colorize(:red)\n print \"> $\"\n new_money = gets.to_i\n @player.wallet += new_money\n puts \"Your wallet now has: $#{@player.wallet}\".colorize(:blue)\n end", "def update_user_credits\n user.credits += credits - used_credit.to_f\n user.save\n end", "def give_shnack_credit(creditor_id, amount)\n @creditor = User.find(creditor_id)\n creditor.account_credit = creditor.account_credit + amount\n end", "def deposit(money_to_deposit)\n @balance += money_to_deposit\n end", "def add_money(value)\n raise_invalid_coin! if @money[value.to_s].nil?\n @money[value.to_s] += 1\n update_money\n end", "def deposit(money)\n self.balance = (self.balance + money)\n end", "def add(cash)\n @current_balance = @current_balance + cash\n end", "def send_money(amount)\n fail unless amount >= 0\n self.credits += amount\n end", "def deposit(name, amount)\n find_account(name)[:balance] += amount\n end", "def gain(money)\n\t\tself.bank_amount += money\n\t\tself.save\n\tend", "def add_amount_to(transactions, value) \n transactions.each do |transaction|\n new_balance = transaction.account_balance + value\n transaction.update(:account_balance => new_balance)\n end\n end", "def test_add_existing_user\n billcoin = BillCoin::new\n user = 'NewUser'\n billcoin.user_totals['NewUser'] = 0\n billcoin.add_user user\n assert_includes billcoin.user_totals.keys, user\n assert_equal 1, billcoin.user_totals.count\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 update_user\n user.financial_status = user.transactions.pluck(:amount).inject(0.0, &:+)\n user.save\n end", "def deposit(cash)\n @balance += cash\n end", "def fCreditCoinsTo (email, amount)\n @users.creditCoinsTo(email,amount)\n end", "def creditCoins(amount)\r\n @betESSCoins += amount\r\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 add_to_income(db, user_name, dolla_dolla_bills_yall)\r\n\tnew_income_total = (dolla_dolla_bills_yall.to_i + current_income(db, user_name))\r\n\tchange_income = '\r\n\tUPDATE users \r\n\r\n\tSET actual_income = ?\r\n\tWHERE name = ?'\r\n\tdb.execute(change_income, [new_income_total, user_name])\r\nend", "def update_user_credit(amount)\n if amount > 1\n user.update_attribute(:credit, amount)\n else\n user.update_attribute(:credit, 0)\n end\n end", "def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end", "def deposit(money) #Creating a method called deposit for the 1st user story\n @balance = @balance + money #The instance of 'balance' get recreated everytime the deposit method is called\n end", "def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(user, amount)\n user.with_lock do\n user.my_wallet.balance += amount.to_f\n user.my_wallet.save!\n end\n end", "def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end", "def pay_amount(user, amount)\r\n if(self.credits>= amount)\r\n self.credits= self.credits-amount\r\n user.receive_credits(amount)\r\n else\r\n return 'suddenly you dont have enough money'\r\n end\r\n end", "def insertCoins (email)\r\n puts \"How many coins do you wish to credit: \"\r\n coins = gets.chomp.to_f\r\n @BetESS.fCreditCoinsTo(email,coins)\r\n puts \"The amount of coins in your account is: #{@BetESS.fGetBetESSCoinsFrom(email)}\"\r\n end", "def deposit(amount_of_money)\n return @balance + amount_of_money\n end", "def money\n end", "def deposit(amt)\n @bank_acct += amt\n puts \"Your balance is #{@bank_acct}.\"\n end", "def update_money\n @amount = self.class.count_money @money\n end", "def create\n @bonu = Bonu.new(bonu_params)\n @user = @bonu.user\n\n respond_to do |format|\n if @bonu.save\n @user.addValue(@bonu.amount)\n format.html { redirect_to root_url, notice: 'Bonu was successfully created.' }\n format.json { render :show, status: :created, location: @bonu }\n else\n format.html { render :new }\n format.json { render json: @bonu.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_expenses(db, user_name, dolla_dolla_bills_yall)\r\n\tnew_expenses_total = (dolla_dolla_bills_yall.to_i + current_expenses(db, user_name))\r\n\tchange_expenses = '\r\n\r\n\tUPDATE users\r\n\r\n\tSET expenses = ?\r\n\tWHERE name = ?'\r\n\tdb.execute(change_expenses, [new_expenses_total, user_name])\r\nend", "def add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::AMOUNT, amount(money))\r\n request.Set(RocketGate::GatewayRequest::CURRENCY, options[:currency] || currency(money))\r\n end", "def money\n Spree::Money.new(amount, { currency: currency })\n end", "def updateMoney(money, id)\n parameters={money: money}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/update_money?id=\" + id.to_s , options)\n return results\n end", "def credit_in_cents\n (user.credit * 100).to_i\n end", "def add_bet_amount(amount_added)\n @bet_amount = bet_amount + amount_added\n end", "def add_to_balance(amount, payment_type='Manual')\n self.balance += amount\n if self.save\n exchange_rate = Currency.count_exchange_rate(Currency.get_default.name, currency.name)\n amount *= exchange_rate\n if payment_type == 'card_refill'\n tax_amount = 0\n else\n tax_amount = self.get_tax.count_tax_amount(amount)\n end\n payment = Payment.create_for_user(self, {:paymenttype => payment_type, :amount => amount, :tax => tax_amount, :shipped_at => Time.now, :date_added => Time.now, :completed => 1, :currency => currency.name})\n if payment.save\n return true\n else\n self.balance -= amount\n self.save\n return false\n end\n else\n return false\n end\n end", "def deposit(amount)\n @balance += amount\n @balance\n end", "def credit!(amount)\n self.balance += parse_monetary_value(amount)\n self.store\n end", "def deposit(amount)\n @balance += amount\n end", "def pay_in(balance)\n @balance += balance\nend", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def credit(amount)\n\t\t@revenue += amount\n\tend", "def create\n @money = current_user.money.build(params[:money])\n # @money = Money.new(params[:money])\n\n respond_to do |format|\n if @money.save\n format.html { redirect_to @money, notice: 'Money was successfully created.' }\n format.json { render json: @money, status: :created, location: @money }\n else\n format.html { render action: \"new\" }\n format.json { render json: @money.errors, status: :unprocessable_entity }\n end\n end\n end", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def send_credits\n @users = User.all\n receiving_user = User.find(params[:id])\n amount_sent = user_params[:credit].to_i\n sending_updated_credits = current_user.credit - amount_sent\n receiving_updated_credits = receiving_user.credit + amount_sent\n if current_user.update_attributes(credit: sending_updated_credits)\n receiving_user.update_attributes(credit: receiving_updated_credits)\n @transaction = Transaction.create(from: current_user.id, to: params[:id], amount: amount_sent)\n flash[:notice] = \"Sucessfully sent #{amount_sent} credits to #{receiving_user.email}\"\n redirect_to users_url\n else \n flash[:errors] = ['Not enough credits, please add more']\n redirect_to users_url\n end \n end", "def deposit(amount)\n @balance = @balance + amount\n end", "def spend(amount)\r\n @spend += amount\r\n end", "def increase_balance(amount)\n self.balance += amount\n save\n end", "def add_money_to_till(amount)\n @till += amount\nend", "def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end", "def money; end", "def open_account(name, amount)\n accounts.push({ :name => name, :balance => amount }) if amount >= 200\n end", "def add_account\n\tsystem('clear')\n\tputs \"Please enter an account name for the account holder:\"\n\tname = gets.chomp.upcase\n\tputs \"Enter a starting balance:\"\n\tbalance = gets.chomp.to_f\n\taccount_number = @accounts.length\n\n\tnew_account = Account.new(name, account_number, balance)\n\n\t@accounts.push(new_account)\n\tsystem('clear')\n\tputs \"Account Successfully Created\"\n\tputs \"Name: #{new_account.name}\"\n\tputs \"Account #: #{new_account.account_number}\"\n\tputs \"Balance: $#{'%.2f'%(new_account.balance)}\" #Purple code keeps it to two decimal places\n\n\nend", "def add_profit(amount)\n amount * 1.005\n end", "def add_account\n update_attribute(:account_id, Account.current.id)\n end", "def set_money\n @money = Money.find(params[:id])\n end", "def deposit(amount)\n result = BigDecimal.new(balance) + BigDecimal.new(amount)\n update_attributes(balance: result)\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def credit( amount_in_cents )\n resp = client.credit(\n token: payment.token,\n expires_at: payment.expires_at,\n amount: amount_in_cents.to_i.abs\n ).body\n user.credits.create!(\n amount_in_cents: amount_in_cents,\n description: I18n.t('transactions.credit'),\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise CreditFailure.new( ex.response )\n end", "def money\n Money.from_amount(amount.to_f)\n end", "def money(amount)\n Money.new((amount * 100).to_i)\n end", "def money_params\n params.require(:money).permit(:symbol, :user_id, :cost_per, :amount_owned)\n end", "def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end", "def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end", "def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end", "def add_credits(qty)\n update_column(:credits, credits + qty)\n end", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def transfer_pending_to_money\n @pending_money.each do |coin, value|\n @money[coin] += value\n @pending_money[coin] = 0\n end\n update_pending\n update_money\n end", "def reward\n business.add_to_balance(amount)\n end", "def deposit(account_id, accounts,action)\n account = accounts[account_id]\n show_message \"Enter amount to deposit in your account\"\n money_to_deposit = gets.chomp.to_i\n balance=account[:balance]\n #accounts[:account_id].store :balance ,balance+money_to_deposit\n account[:balance] = balance + money_to_deposit\n show_message \"wooow !!! transaction sucessful..your current balance is #{account[:balance]}\"\n create_history(account_id,accounts,action,money_to_deposit,account[:balance])\nend", "def add_account\n # make sure a second confirmation email is not sent\n skip_reconfirmation!\n\n # update before setting the account_id\n update_profile_email\n\n update_attribute(:account_id, Account.current.id)\n ensure_site_profile_exists\n end", "def create\n @bill = Bill.new(bill_params)\n @bill.user_id = current_user.id\n @user = current_user\n @accounts = Account.where(user_id: current_user.id)\n @bill.amount = @bill.amount_string.to_f\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to account_path(@bill.account_id), notice: 'Bill was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bill }\n else\n format.html { render action: 'new' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def social_money_send\n parms = params.require(:sendMoney).permit(:accountid, :amount, :currency, :message, :global)\n social_money_send_internal(parms[:amount], parms[:message], parms[:global], parms[:accountid], parms[:currency])\n end", "def test_add_system\n billcoin = BillCoin::new\n user = 'SYSTEM'\n billcoin.add_user user\n refute_includes billcoin.user_totals.keys, user\n end", "def create\n @billentry = current_user.billentries.build(billentry_params)\n @billentry[:secure] = true\n bill_amount = Company.where(id: @billentry[:company_id]).select(:total_bill_amount)\n comp_bill_amount = bill_amount[0].total_bill_amount + @billentry[:total_amount]\n\n respond_to do |format|\n if @billentry.save\n Company.where(id: @billentry[:company_id]).update(total_bill_amount: comp_bill_amount)\n format.html { redirect_to @billentry, notice: 'Billentry was successfully created.' }\n format.json { render :show, status: :created, location: @billentry }\n else\n format.html { render :new }\n format.json { render json: @billentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def put_coin(value)\n @calculator.add_pending value\n end", "def deposit (amount, account)\n if account == \"checking\"\n @checking_account_balance += amount\n elsif account == \"saving\"\n @saving_account_balance += amount\n else\n puts \"No account was selected\"\n end\n end", "def do_credit!\n # user = User.where('id=? OR rfid=?', user_param.to_i, user_param).first\n user = User.find_by(id: user_param)\n BridgePayService.new( user ).credit( credit_amount )\n end", "def add_trivia(amount)\n if amount < 10\n @credits = @credits + amount * 2\n else\n @credits = @credits + 20\n end\n end", "def save!\n redis.set('money', @money.to_json) if @use_redis\n end", "def money money, user=nil\n currency = user ? user.currency : :usd\n html = <<-HTML\n <abbr class=\"money\" title=\"#{money.to_local_s(currency)}\">#{money.to_explicit_s}</abbr>\n HTML\n html.strip\n end", "def add_currency(currency)\n @change.add_currency(currency)\n end" ]
[ "0.8001156", "0.7571441", "0.7441676", "0.7327436", "0.7324111", "0.7010685", "0.68067354", "0.67458415", "0.669875", "0.6665531", "0.6662032", "0.6647681", "0.66472596", "0.66186476", "0.65935326", "0.6566185", "0.6546947", "0.65250087", "0.65192366", "0.65171427", "0.647732", "0.6452085", "0.6443758", "0.64355886", "0.643473", "0.6419533", "0.64184415", "0.64177334", "0.64039105", "0.63976735", "0.6389834", "0.6383717", "0.6337191", "0.6330227", "0.6330227", "0.6329393", "0.6322587", "0.631677", "0.6297904", "0.62932724", "0.62825054", "0.62713027", "0.6255177", "0.6244779", "0.6238983", "0.62147045", "0.620953", "0.62082136", "0.6207564", "0.6197672", "0.6192204", "0.6191285", "0.6186895", "0.6185581", "0.61851776", "0.618274", "0.6182449", "0.6182449", "0.6182449", "0.6181973", "0.6145735", "0.6142913", "0.61357844", "0.61252755", "0.61206317", "0.6119945", "0.60879385", "0.60566425", "0.6047773", "0.60226136", "0.6021494", "0.6016108", "0.6005541", "0.6001786", "0.5985923", "0.59842783", "0.5980672", "0.5976843", "0.5971825", "0.596807", "0.5948851", "0.59443486", "0.59443486", "0.5940314", "0.5921911", "0.5892608", "0.5887", "0.5885886", "0.58824545", "0.587488", "0.58709717", "0.58695924", "0.58483404", "0.58426666", "0.58392006", "0.5835862", "0.5823966", "0.5822296", "0.58217865", "0.5821248", "0.5816112" ]
0.0
-1
returns a json representation of the specified element argv = commandline arguments, requires an element (e) argument, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9'
def cmd_get argv setup argv e = @hash['element'] response = @api.get(e) msg JSON.pretty_generate(response) return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[0]\n result[\"mongo_port\"] = host_port[1]\n else\n result[\"tenants\"] << arg\n end\n end\n return result\nend", "def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[0]\n result[\"mongo_port\"] = host_port[1]\n else\n result[\"tenants\"] << arg\n end\n end\n return result\nend", "def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[0]\n result[\"mongo_port\"] = host_port[1]\n else\n result[\"tenants\"] << arg\n end\n end\n return result\nend", "def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[0]\n result[\"mongo_port\"] = host_port[1]\n else\n result[\"tenants\"] << arg\n end\n end\n return result\nend", "def parseArgs(argv)\n\n result = { \"all\" => false, \"mongo_host\" => \"localhost\", \"mongo_port\" => 27017, \"tenants\" => [] }\n\n for arg in argv\n if arg == \"--all\"\n result[\"all\"] = true\n elsif arg.include?(\":\")\n host_port = arg.split(':')\n result[\"mongo_host\"] = host_port[0]\n result[\"mongo_port\"] = host_port[1]\n else\n result[\"tenants\"] << arg\n end\n end\n return result\nend", "def knife_output_as_hash(sub_cmd)\n sub_cmd = [sub_cmd, '-F json'].join(' ')\n output_lines = execute(knife_cmd(sub_cmd)).split(/\\n/)\n output_lines = output_lines.reject { |line| KNIFE_JSON_OUTPUT_IGNORE.include? line }\n json = JSON.parse output_lines.join(' ')\nrescue StandardError => e\n puts \"ERROR: #{e}\"\n exit 1\nend", "def parse_arguments!(argv)\n results = {\n embed: false\n }\n\n option_parser = OptionParser.new do |opts|\n opts.on(\"-h\", \"--help\", \"Prints this help\") do\n results[:help] = opts.help\n end\n\n opts.on(\"-sS\", \"--match-string=S\", \"Match nodes containing the string\") do |s|\n results[:pattern] = s\n end\n\n opts.on(\"-mD\", \"--month=D\", \"Only return results for the month containing the given date\") do |d|\n results[:month] = month_for_date(d)\n end\n\n opts.on(\"-fF\", \"--file=F\", \"Use the given file as input. If absent, will parse STDIN\") do |f|\n results[:file] = f\n end\n\n opts.on(\"-a\", \"--include-all\", \"Include all the matching results, not just the first\") do |a|\n results[:include_all] = true\n end\n\n opts.on(\"-e\", \"--embed\", \"Place resulting block refs in an embed\") do |a|\n results[:embed] = true\n end\n\n opts.on(\"-E\", \"--no-embed\", \"Do not place resulting block refs in an embed (default)\") do |a|\n results[:embed] = false\n end\n end\n\n option_parser.parse!(argv)\n if argv.count != 0 || !config_valid?(results)\n results = { :help => option_parser.help }\n end\n\n results\nend", "def parse_args\n { :ip => ARGV[1] || '0.0.0.0', :port => (ARGV[0] || '9000').to_i,\n :logging => !(ENV['DEBUG'] &&\n ['0', 'no', 'false'].include?(ENV['DEBUG'].downcase)) }\nend", "def parse!(argv)\n options = {}\n parser = configure_base!(OptionParser.new)\n parser.parse!(argv, into: options)\n unless options.key?(:input)\n puts 'Missing --input argument, which is required.'\n Advent2019.show_help(parser)\n end\n options\n end", "def parsed_argv\n Hash[ARGV.map { |arg| arg.split(\":\") }]\nend", "def parse_arguments(args)\n ret = {}\n ret[\"timeout\"] = 15\n op = OptionParser.new do |opts|\n opts.banner = \"Usage: #{__FILE__} [options]\"\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n opts.on(\"-a\", \"--argument=[JSON]\",\n \"Pass the supplied JSON data over the bridge\") do |v|\n ret[\"argument\"] = v\n end\n\n opts.on(\"-b\", \"--b64argument=[B64-JSON]\",\n \"Pass the base64-encoded JSON data over the bridge\") do |v|\n ret[\"b64argument\"] = v\n end\n\n opts.on(\"-s\", \"--selector=SELECTOR\",\n \"Call the given function (selector) via the bridge\") do |v|\n ret[\"selector\"] = v\n end\n\n opts.on(\"-c\", \"--callUID=UID\",\n \"Use the given UID to properly identify the return value of this call\") do |v|\n ret[\"callUID\"] = v\n end\n\n opts.on(\"-r\", \"--hardwareID=[HARDWAREID]\",\n \"If provided, connect to the physical iOS device with this hardware ID instead of a simulator\") do |v|\n ret[\"hardwareID\"] = v\n end\n\n opts.on(\"-t\", \"--timeout=[TIMEOUT]\",\n \"The timeout in seconds for reading a response from the bridge (default 15)\") do |v|\n ret[\"timeout\"] = v.to_i\n end\n\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n end\n op.parse!(args)\n return ret\nend", "def parse_argv(argv)\n # command line\n options = {}\n OptionParser.new do |opts|\n options[:queue_name] = nil\n opts.banner = \"Usage: #{__FILE__} [options]\"\n\n opts.on('-c', '--config CONFIG_FILE', 'config file') do |c|\n options[:file_name] = c\n end\n opts.on('-q', '--queue QUEUE', 'queue to be consumed') do |q|\n options[:queue_name] = q\n end\n end.parse!\n @options = options\n end", "def parse argv\n parse_args argv do |argv, remaining_args, arg|\n remaining_args << arg\n end\n end", "def parse(obj, argv)\n case argv\n when String\n require 'shellwords'\n argv = Shellwords.shellwords(argv)\n else\n argv = argv.dup\n end\n\n argv = argv.dup\n args, opts, i = [], {}, 0\n while argv.size > 0\n case opt = argv.shift\n when /=/\n parse_equal(obj, opt, argv)\n when /^--/\n parse_option(obj, opt, argv)\n when /^-/\n parse_flags(obj, opt, argv)\n else\n args << opt\n end\n end\n return args\n end", "def parse_argv(argv)\n # Host is always first argument\n host = argv[0]\n\n # Create array for ports\n ports = Array.new\n\n # Ignore the first argument (host), and just traverse the rest\n for i in 1..argv.length - 1\n # If argument contains a hyphen..\n if (argv[i]).include? \"-\"\n # ..split it in two..\n tokens = argv[i].split(\"-\")\n if tokens.length != 2\n # ..if we get more than two tokens, then it's not valid\n puts \"'%s' is not in the form 'number1-number2'\" % argv[i]\n exit(1)\n else\n # ..otherwise, parse both tokens..\n number1 = parse_string_to_port(tokens[0])\n if number1 == -1\n puts \"'%s' is not a valid port number\" % tokens[0]\n exit(1)\n end\n number2 = parse_string_to_port(tokens[1])\n if number2 == -1\n puts \"'%s' is not a valid port number\" % tokens[1]\n exit(1)\n end\n # ..and create the range between number1 and number2\n for j in number1..number2\n # Add the port to the array\n ports.push(j)\n end\n end\n else\n # If there's no hyphen, then just treat the parameter as\n # a single port number\n number = parse_string_to_port(argv[i])\n if number == -1\n puts \"'%s' is not a valid port number\" % argv[i]\n exit(1)\n else\n # Add the port to the array\n ports.push(number)\n end\n end\n end\n\n # Finally, return the host and the port array\n return host, ports\nend", "def arguments(model)\n\n # This calls resources/resource.rb with calls\n # resources/subfolder/subresource.rb which in turn loads a json\n # from resources/data/arguments.json\n return make_arguments()\n\n return args\n end", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def json_api_command(command, stdin = nil, *args)\n res = api_command(command, stdin, *args)\n return res if res.nil? || res == ''\n JSON.parse(res, symbolize_names: true, object_class: ActiveSupport::HashWithIndifferentAccess)\n end", "def parse_args(argv = ARGV)\n @configuration ||= {}\n # Our primary configuration hash for the length of this method\n options = {}\n\n # Environment variables always win\n options[:environment] = ENV[\"MERB_ENV\"] if ENV[\"MERB_ENV\"]\n \n # Build a parser for the command line arguments\n opts = OptionParser.new do |opts|\n opts.version = Merb::VERSION\n\n opts.banner = \"Usage: merb [uGdcIpPhmailLerkKX] [argument]\"\n opts.define_head \"Merb. Pocket rocket web framework\"\n opts.separator '*' * 80\n opts.separator \"If no flags are given, Merb starts in the \" \\\n \"foreground on port 4000.\"\n opts.separator '*' * 80\n\n opts.on(\"-u\", \"--user USER\", \"This flag is for having merb run \" \\\n \"as a user other than the one currently logged in. Note: \" \\\n \"if you set this you must also provide a --group option \" \\\n \"for it to take effect.\") do |user|\n options[:user] = user\n end\n\n opts.on(\"-G\", \"--group GROUP\", \"This flag is for having merb run \" \\\n \"as a group other than the one currently logged in. Note: \" \\\n \"if you set this you must also provide a --user option \" \\\n \"for it to take effect.\") do |group|\n options[:group] = group\n end\n\n opts.on(\"-d\", \"--daemonize\", \"This will run a single merb in the \" \\\n \"background.\") do |daemon|\n options[:daemonize] = true\n end\n \n opts.on(\"-N\", \"--no-daemonize\", \"This will allow you to run a \" \\\n \"cluster in console mode\") do |no_daemon|\n options[:daemonize] = false\n end\n\n opts.on(\"-c\", \"--cluster-nodes NUM_MERBS\", Integer, \n \"Number of merb daemons to run.\") do |nodes|\n options[:daemonize] = true unless options.key?(:daemonize)\n options[:cluster] = nodes\n end\n\n opts.on(\"-I\", \"--init-file FILE\", \"File to use for initialization \" \\\n \"on load, defaults to config/init.rb\") do |init_file|\n options[:init_file] = init_file\n end\n\n opts.on(\"-p\", \"--port PORTNUM\", Integer, \"Port to run merb on, \" \\\n \"defaults to 4000.\") do |port|\n options[:port] = port\n end\n\n opts.on(\"-o\", \"--socket-file FILE\", \"Socket file to run merb on, \" \\\n \"defaults to [Merb.root]/log/merb.sock. This is for \" \\\n \"web servers, like thin, that use sockets.\" \\\n \"Specify this *only* if you *must*.\") do |port|\n options[:socket_file] = port\n end\n\n opts.on(\"-s\", \"--socket SOCKNUM\", Integer, \"Socket number to run \" \\\n \"merb on, defaults to 0.\") do |port|\n options[:socket] = port\n end\n\n opts.on(\"-n\", \"--name NAME\", String, \"Set the name of the application. \"\\\n \"This is used in the process title and log file names.\") do |name|\n options[:name] = name\n end\n\n opts.on(\"-P\", \"--pid PIDFILE\", \"PID file, defaults to \" \\\n \"[Merb.root]/log/merb.main.pid for the master process and\" \\\n \"[Merb.root]/log/merb.[port number].pid for worker \" \\\n \"processes. For clusters, use %s to specify where \" \\\n \"in the file merb should place the port number. For \" \\\n \"instance: -P myapp.%s.pid\") do |pid_file|\n options[:pid_file] = pid_file\n end\n\n opts.on(\"-h\", \"--host HOSTNAME\", \"Host to bind to \" \\\n \"(default is 0.0.0.0).\") do |host|\n options[:host] = host\n end\n\n opts.on(\"-m\", \"--merb-root /path/to/approot\", \"The path to the \" \\\n \"Merb.root for the app you want to run \" \\\n \"(default is current working directory).\") do |root|\n options[:merb_root] = File.expand_path(root)\n end\n\n adapters = [:mongrel, :emongrel, :thin, :ebb, :fastcgi, :webrick]\n\n opts.on(\"-a\", \"--adapter ADAPTER\",\n \"The rack adapter to use to run merb (default is mongrel)\" \\\n \"[#{adapters.join(', ')}]\") do |adapter|\n options[:adapter] ||= adapter\n end\n\n opts.on(\"-R\", \"--rackup FILE\", \"Load an alternate Rack config \" \\\n \"file (default is config/rack.rb)\") do |rackup|\n options[:rackup] = rackup\n end\n\n opts.on(\"-i\", \"--irb-console\", \"This flag will start merb in \" \\\n \"irb console mode. All your models and other classes will \" \\\n \"be available for you in an irb session.\") do |console|\n options[:adapter] = 'irb'\n end\n\n opts.on(\"-S\", \"--sandbox\", \"This flag will enable a sandboxed irb \" \\\n \"console. If your ORM supports transactions, all edits will \" \\\n \"be rolled back on exit.\") do |sandbox|\n options[:sandbox] = true\n end\n\n opts.on(\"-l\", \"--log-level LEVEL\", \"Log levels can be set to any of \" \\\n \"these options: debug < info < warn < error < \" \\\n \"fatal (default is info)\") do |log_level|\n options[:log_level] = log_level.to_sym\n options[:force_logging] = true\n end\n\n opts.on(\"-L\", \"--log LOGFILE\", \"A string representing the logfile to \" \\\n \"use. Defaults to [Merb.root]/log/merb.[main].log for the \" \\\n \"master process and [Merb.root]/log/merb[port number].log\" \\\n \"for worker processes\") do |log_file|\n options[:log_file] = log_file\n options[:force_logging] = true\n end\n\n opts.on(\"-e\", \"--environment STRING\", \"Environment to run Merb \" \\\n \"under [development, production, testing] \" \\\n \"(default is development)\") do |env|\n options[:environment] = env\n end\n\n opts.on(\"-r\", \"--script-runner ['RUBY CODE'| FULL_SCRIPT_PATH]\",\n \"Command-line option to run scripts and/or code in the \" \\\n \"merb app.\") do |code_or_file|\n options[:runner_code] = code_or_file\n options[:adapter] = 'runner'\n end\n\n opts.on(\"-K\", \"--graceful PORT or all\", \"Gracefully kill one \" \\\n \"merb proceses by port number. Use merb -K all to \" \\\n \"gracefully kill all merbs.\") do |ports|\n options[:action] = :kill\n ports = \"main\" if ports == \"all\"\n options[:port] = ports\n end\n\n opts.on(\"-k\", \"--kill PORT\", \"Force kill one merb worker \" \\\n \"by port number. This will cause the worker to\" \\\n \"be respawned.\") do |port|\n options[:action] = :kill_9\n port = \"main\" if port == \"all\"\n options[:port] = port\n end\n \n opts.on(\"--fast-deploy\", \"Reload the code, but not your\" \\\n \"init.rb or gems\") do\n options[:action] = :fast_deploy\n end\n\n # @todo Do we really need this flag? It seems unlikely to want to\n # change the mutex from the command-line.\n opts.on(\"-X\", \"--mutex on/off\", \"This flag is for turning the \" \\\n \"mutex lock on and off.\") do |mutex|\n if mutex == \"off\"\n options[:use_mutex] = false\n else\n options[:use_mutex] = true\n end\n end\n\n opts.on(\"-D\", \"--debugger\", \"Run merb using rDebug.\") do\n begin\n require \"ruby-debug\"\n Debugger.start\n\n # Load up any .rdebugrc files we find\n [\".\", ENV[\"HOME\"], ENV[\"HOMEPATH\"]].each do |script_dir|\n script_file = \"#{script_dir}/.rdebugrc\"\n Debugger.run_script script_file, StringIO.new if File.exists?(script_file)\n end\n\n if Debugger.respond_to?(:settings)\n Debugger.settings[:autoeval] = true\n end\n puts \"Debugger enabled\"\n rescue LoadError\n puts \"You need to install ruby-debug to run the server in \" \\\n \"debugging mode. With gems, use `gem install ruby-debug'\"\n exit\n end\n end\n\n opts.on(\"-V\", \"--verbose\", \"Print extra information\") do\n options[:verbose] = true\n end\n\n opts.on(\"-C\", \"--console-trap\", \"Enter an irb console on ^C\") do\n options[:console_trap] = true\n end\n\n opts.on(\"-?\", \"-H\", \"--help\", \"Show this help message\") do\n puts opts\n exit\n end\n end\n\n # Parse what we have on the command line\n begin\n opts.parse!(argv)\n rescue OptionParser::InvalidOption => e\n Merb.fatal! e.message, e\n end\n Merb::Config.setup(options)\n end", "def parse_args(arg)\n if arg.is_a?(Hash) and Knj::ArrayExt.hash_numeric_keys?(arg)\n arr = []\n \n arg.each do |key, val|\n arr << val\n end\n \n return self.parse_args(arr)\n elsif arg.is_a?(Hash)\n arg.each do |key, val|\n arg[key] = self.parse_args(val)\n end\n \n return arg\n elsif arg.is_a?(Array)\n arg.each_index do |key|\n arg[key] = self.parse_args(arg[key])\n end\n \n return arg\n elsif arg.is_a?(String) and match = arg.match(/^#<Model::(.+?)::(\\d+)>$/)\n return @ob.get(match[1], match[2])\n else\n return arg\n end\n end", "def cmd_create argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.create(json, e)\n msg response\n return response\n end", "def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end", "def arguments\n result = Hash.new\n args = elements.each(\"arguments/argument\") do |arg|\n name = arg.elements[\"name\"].text\n value = arg.elements[\"value\"].text\n result[name] = value\n end\n result\n end", "def parse_args\n args = {\n :stack_name => nil,\n :parameters => {},\n :interactive => false,\n :region => default_region,\n :profile => nil,\n :nopretty => false,\n :s3_bucket => nil,\n }\n ARGV.slice_before(/^--/).each do |name, value|\n case name\n when '--stack-name'\n args[:stack_name] = value\n when '--parameters'\n args[:parameters] = Hash[value.split(/;/).map { |pair| parts = pair.split(/=/, 2); [ parts[0], Parameter.new(parts[1]) ] }]\n when '--interactive'\n args[:interactive] = true\n when '--region'\n args[:region] = value\n when '--profile'\n args[:profile] = value\n when '--nopretty'\n args[:nopretty] = true\n when '--s3-bucket'\n args[:s3_bucket] = value\n end\n end\n\n args\nend", "def convert_arg_json(*args)\n result = []\n args.each do |v|\n begin\n result << JSON.parse(v, symbolize_names: false)\n rescue StandardError => _e\n result << v\n end\n end\n result\n end", "def entry\n JSON.parse(@output.string)\n end", "def to_json(*args)\n to_arg.to_json(*args)\n end", "def parse_options\n options = {}\n case ARGV[1]\n when '-e'\n options[:e] = ARGV[2]\n when '-d'\n options[:d] = ARGV[2]\n end\n options\nend", "def sel(arg, rest=nil)\n case arg\n when '-p'; proc {|obj| pp(obj) }\n when '-j'; proc {|obj| puts json(obj) }\n when '-t'; proc {|obj| puts text(obj) }\n when '-e'; proc {|obj| obj.each {|e| rest.call(e) } }\n when '-k'; proc {|obj| obj.keys.each {|k| rest.call(k) } }\n when '-v'; proc {|obj| obj.values.each {|v| rest.call(v) } }\n else proc {|obj| r = gwim(obj, arg) ; rest.call(r) }\n end\nend", "def parse_argv(argv, &block)\n return parse_posix_argv(argv, &block) if @posix\n\n @not_parsed = []\n tagged = []\n argv.each_with_index { |e,i|\n if \"--\" == e\n @not_parsed = argv[(i+1)..(argv.size+1)]\n break\n elsif \"-\" == e\n tagged << [:arg, e] \n elsif ?- == e[0] \n m = Option::GENERAL_OPT_EQ_ARG_RE.match(e)\n if m.nil?\n tagged << [:opt, e] \n else\n tagged << [:opt, m[1]]\n tagged << [:arg, m[2]]\n end\n else\n tagged << [:arg, e]\n end\n }\n\n #\n # The tagged array has the form:\n # [\n # [:opt, \"-a\"], [:arg, \"filea\"], \n # [:opt, \"-b\"], [:arg, \"fileb\"], \n # #[:not_parsed, [\"-z\", \"-y\", \"file\", \"file2\", \"-a\", \"-b\"]]\n # ]\n\n #\n # Now, combine any adjacent args such that\n # [[:arg, \"arg1\"], [:arg, \"arg2\"]]\n # becomes\n # [[:args, [\"arg1\", \"arg2\"]]]\n # and the final result should be\n # [ \"--file\", [\"arg1\", \"arg2\"]]\n #\n\n parsed = []\n @args = []\n tagged.each { |e|\n if :opt == e[0]\n parsed << [e[1], []]\n elsif :arg == e[0]\n if Array === parsed[-1] \n parsed[-1][-1] += [e[1]]\n else\n @args << e[1]\n end\n else\n raise \"How did we get here?\"\n end\n }\n parsed.each { |e| block.call(e) }\n end", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end", "def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend", "def render_entrypoint entrypoint\n return JSON.generate entrypoint if entrypoint.is_a? Array\n return entrypoint if entrypoint.start_with? \"exec \"\n return entrypoint if entrypoint =~ /;|&&|\\|/\n \"exec #{entrypoint}\"\n end", "def to_json(*args)\n # NOTE swallowing the arguments that Rails passes by default since we don't care. This may prove to be a bad idea\n # Rails passes stuff like this: {:prefixes=>[\"ok_computer\", \"application\"], :template=>\"show\", :layout=>#<Proc>}]\n {name => call}.to_json\n end", "def argumentos(args)\n\thash = Hash.new\n\targs.each do |arg| \n\t\thash[arg.split('=').first] = arg.split('=').second\n\tend \n\treturn hash\nend", "def parse(argv)\n OptionParser.new do |opts| \n\t\t\t\t# Ayuda pra caso de errores\n opts.banner = \"Usage: anagram [ options ] word...\"\n\t\t\t\t# Especificación del diccionario\n opts.on(\"-d\", \"--dict path\", String, \"Path to dictionary\") do |dict|\n @dictionary = dict\n end \n\t\t\t\t# Opción de ayuda\n opts.on(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n\t\t\t\t# Como se realiza el parse de la entrada\n begin\n argv = [\"-h\"] if argv.empty?\n opts.parse!(argv)\n rescue OptionParser::ParseError => e\n STDERR.puts e.message, \"\\n\", opts\n exit(-1)\n end\n end \n end", "def to_json *args\n\t\t\tto_h(args[0].is_a?(Hash) && args[0][:include_config]).to_json(*args)\n\t\tend", "def serializer_args_hash\n result = {}\n #TODO: Should probably safety check these somewhere\n result[:entry_type] = params[:entry_type] if params[:entry_type].present? \n result[:section] = params[:section] if params[:section].present?\n return result\n end", "def argv; end", "def command_parse(argv)\n end", "def arguments(model)\r\n result = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n alternativeModelPath = OpenStudio::Ruleset::OSArgument::makePathArgument(\"alternativeModelPath\",true,\"osm\")\r\n alternativeModelPath.setDisplayName(\"Alternative Model Path\")\r\n result << alternativeModelPath\r\n \r\n measures_json = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"measures_json\", true)\r\n measures_json.setDisplayName(\"Alternative Measures\")\r\n measures_json.setDefaultValue(\"[]\")\r\n result << measures_json\r\n \r\n return result\r\n end", "def cmd_list argv\n setup argv\n type = @hash['type']\n response = @api.list(type)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n return response\n end", "def to_json(*a)\n Chef::JSONCompat.to_json(to_h, *a)\n end", "def to_json(*a)\n Chef::JSONCompat.to_json(to_h, *a)\n end", "def to_json(*_arg0); end", "def to_json(*_arg0); end", "def parse(*argv, into: nil)\n argv = argv[0].dup if argv.size == 1 and Array === argv[0]\n parse!(argv, into: into)\n end", "def parse_options(argv)\n\t\t\t@params = {}\n\t\t\topts = OptionParser.new\n\t\t\topts.banner = \"Usage: QUERY [options]\"\n\t\t\topts.separator \"\"\n\t\t\topts.separator \"Specific options:\"\n\n\t\t\tenforce_mutually_exclusive_rendering_modes(argv)\n\n\t\t\topts.on(\"--text\", \"Render to a text file\") { @params[:render_mode] = :text }\n\t\t\topts.on(\"--json\", \"Render to json\") { @params[:render_mode] = :json }\n\t\t\topts.on(\"--csv\", \"Render to csv\") {@params[:render_mode] = :csv }\n\n\t\t\topts.on(\"-o\", \"--output [FILENAME]\", \"Output to a file\") { |f| @params[:output_file] = f }\n\n\t\t\topts.on(\"-i\", \"--input [FILENAME]\", \"Source file for search queries\") { |f| @params[:input_file] = f}\n\n\t\t\t@params[:data_to_render] = []\n\n\t\t\topts.on(\"-s\", \"Show search term\") { @params[:data_to_render] << :search_term}\n\t\t\topts.on(\"-t\", \"Show title\") { @params[:data_to_render] << :title}\n\t\t\topts.on(\"-d\", \"Show short description\") { @params[:data_to_render] << :summary}\n\t\t\topts.on(\"-f\", \"Show full text\") { @params[:data_to_render] << :full_text}\n\n\t\t\topts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n\t\t\t\tputs opts\n\t\t\t\texit\n\t\t\tend\n\n\t\t\t@search_string = opts.parse(argv)[0]\n\n\t\t\tif @params[:input_file]\n\t\t\t\tprocess_input_file\n\t\t\tend\n\n\t\tend", "def to_json(*args); end", "def json\n add option: \"-json\"\n end", "def json(*args)\n begin\n get_json(*args)\n rescue\n nil\n end\n end", "def public_json_output(info)\n # format as JSON\n results = JSON.pretty_generate(info)\n\n # parse arguments for output file name\n if ARGV.length == 0 or ARGV.first == '-'\n\n # write to STDOUT\n puts results\n\n else\n\n write_output(ARGV.first, results)\n\n end\n\nend", "def parse(argv, env)\n @argv = argv.dup\n @env = env\n\n tuple = find_command(@context, prefix: \"\")\n\n while (val = @argv.shift)\n @remaining_argv << val\n end\n\n tuple\n end", "def parse!(argv)\n # Set default values from the environment\n opts = Options.from_env(ENV)\n\n parser = OptionParser.new do |p|\n p.banner = \"Usage: #{$PROGRAM_NAME} [options]\"\n\n p.on(\"--help\", \"Display this help\") do\n puts p\n exit 0\n end\n\n p.on(\"--debug\", \"Enable debug level logging\") do\n opts.debug = true\n end\n\n p.on(\"--foreman-username=NAME\", \"The foreman username, default: env FOREMAN_USERNAME\") do |name|\n opts.foreman[:foreman_username] = name\n end\n\n p.on(\"--foreman-password=PASSWORD\", \"The foreman password, default: env FOREMAN_PASSWORD\") do |password|\n opts.foreman[:foreman_password] = password\n end\n\n p.on(\"--foreman-url=NAME\", \"The foreman base URL, default: env FOREMAN_URL\") do |url|\n opts.foreman[:foreman_url] = url\n end\n\n p.on(\"--ssl-ca-file=FILE\", \"The Foreman CA certificate bundle, default: env SSL_CA_FILE\") do |file|\n opts.foreman[:ssl_ca_file] = file\n end\n\n p.on(\"--k8s-credentials=CREDENTIALS\", \"The Kubernetes credentials source\") do |value|\n opts.k8s[:k8s_credentials] = value\n end\n\n p.on(\"--k8s-namespace=NAMESPACE\", \"The Kubernetes namespace\") do |value|\n opts.k8s[:k8s_namespace] = value\n end\n\n p.on(\"--k8s-configmap=CONFIGMAP\", \"The Kubernetes configmap\") do |value|\n opts.k8s[:k8s_configmap] = value\n end\n\n p.on(\"--k8s-configmap-key=KEY\", \"The Kubernetes configmap key\") do |value|\n opts.k8s[:k8s_configmap_key] = value\n end\n\n p.on(\"--k8s-deployment=DEPLOYMENT\", \"The Kubernetes deployment\") do |value|\n opts.k8s[:k8s_deployment] = value\n end\n\n p.on(\"--k8s-volume=VOLUME\", \"The Kubernetes deployment volume\") do |value|\n opts.k8s[:k8s_volume] = value\n end\n\n p.on(\"--formatter-name=FORMATTER\", \"The telegraf config formatter\") do |value|\n opts.formatter[:formatter_name] = value\n end\n\n p.on(\"--formatter-options=FORMATTER\", \"The telegraf config formatter options\") do |value|\n opts.formatter[:formatter_options] = value\n end\n end\n\n # Populate values from the CLI\n parser.parse!(argv)\n\n if (errors = opts.validate!).any?\n abort \"Missing configuration:\\n#{errors.map { |e| \" #{e}\" }.join(\"\\n\")}\"\n end\n opts\nend", "def entry_filter(args)\n if args.length == 1 && args.first.is_a?(String)\n { id: @api.normalize_id(args.first) }\n elsif args.length == 2\n { name: args.first, version: args.last }\n else\n raise ArgumentError\n end\n end", "def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end", "def hacky_json(nodes)\n meta = {}\n hosts = []\n nodes.each do |node|\n hosts.push(node['fqdn'])\n meta[node['fqdn']] = { 'ansible_host' => node['ipaddress'] }\n end\n meta = { '_meta' => { 'hostvars' => meta } }\n hosts = { 'all' => { 'hosts' => hosts } }\n JSON.generate(hosts.merge(meta))\nend", "def parse!(argv=ARGV, options={})\n parser = ConfigParser.new\n parser.add(configurations)\n \n args = parser.parse!(argv, options)\n [args, parser.config]\n end", "def main(cmlInput)\n\temaillist,finalPrint = [],[]\n\temailXML = \"emails.xml\"\n\targm = nil\n\n\thelp(cmlInput.index(\"help\"))\n\t\n\targm = cmlInput.index(\"-xml\")\n\temailXML = cmlInput[argm+1] if argm != nil\n\n\temaillist = openFile(emaillist,emailXML)\n\n\targm = cmlInput.index(\"list\")\n\tif(argm)\n\t\temaillist.each {|e| finalPrint.push(e.toJson) if e.ip_address.eql? \n\t\t\tcmlInput[argm+2]} if cmlInput[argm+1].eql? \"--ip\" \n\t\t\n\t\temaillist.each {|e| finalPrint.push(e.toJson) if \n\t\t\te.first_name.downcase.include? cmlInput[argm+2].downcase or \n\t\t\te.last_name.downcase.include? cmlInput[argm+2].downcase} if \n\t\t\tcmlInput[argm+1].eql? \"--name\" \n\t\t\n\t\temaillist.each {|e| finalPrint.push(e.toJson) if\n\t\t\te.email.eql? cmlInput[argm+2]} if cmlInput[argm+1].eql? \"--email\" \n\tend\n\tputs jsonFinal(finalPrint)\nend", "def as_json(args={})\n root = args.fetch(:root, options[:root])\n data = serialize root[:type]\n \n if root[:type] == :collection && !root[:key]\n data\n else\n hash = {}\n hash.merge! serialize_meta\n hash.merge! root[:key] ? {root[:key] => data} : data\n end\n \n end", "def run(argv = ARGV)\n # => Parse CLI Configuration\n cli = Options.new\n cli.parse_options(argv)\n\n # => Parse JSON Config File (If Specified and Exists)\n json_config = Util.parse_json_config(cli.config[:config_file] || Config.config_file)\n\n # => Grab the Default Values\n default = Config.options\n\n # => Merge Configuration (CLI Wins)\n config = [default, json_config, cli.config].compact.reduce(:merge)\n\n # => Apply Configuration\n Config.setup do |cfg|\n cfg.config_file = config[:config_file]\n cfg.cache_timeout = config[:cache_timeout].to_i\n cfg.bind = config[:bind]\n cfg.port = config[:port]\n cfg.environment = config[:environment].to_sym.downcase\n cfg.do_api_key = config[:do_api_key]\n end\n\n # => Launch the API\n API.run!\n end", "def to_json(*args)\n eval(to_s).to_json(*args)\n end", "def args\n @payload['args']\n end", "def to_cmd_ary(opts={arguments:[],separator:\"=\"})\n # [program, sub_program, normalize_params(opts[:separator]), opts[:arguments]].flatten.compact\n [program, sub_program, normalize_params(opts[:separator]), opts[:arguments].map{|a| a.split}].flatten.compact\n end", "def to_json(*args)\n return @parts.to_json(*args)\n end", "def input \n @input ||= JSON.parse(File.read(ARGV[0]));\nend", "def to_json(*args)\n require \"json\"\n to_h.to_json(*args)\n end", "def json( *args )\n ::Logging::Layouts::Parseable.json(*args)\n end", "def find_serverID(argv)\n begin\n # search argv for server_id\n argv.each { |argument|\n match = /(-i|--server_id)=(\\S+)/.match(argument)\n if match != nil\n return match[2]\n end\n }\n # if no match was found:\n raise 'No valid value for action passed.'\n\n rescue Exception => e\n puts e.message\n end\nend", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # path to the floorplan JSON file to load\n floorplan_path = OpenStudio::Measure::OSArgument.makeStringArgument('floorplan_path', true)\n floorplan_path.setDisplayName('Floorplan Path')\n floorplan_path.setDescription('Path to the floorplan JSON.')\n args << floorplan_path\n\n return args\n end", "def decorate_entrypoint entrypoint\n return ::JSON.generate entrypoint if entrypoint.is_a? Array\n return entrypoint if entrypoint.start_with? \"exec \"\n return entrypoint if entrypoint =~ /;|&&|\\|/\n return entrypoint if entrypoint =~ /^\\w+=/\n \"exec #{entrypoint}\"\n end", "def get_command_from_args(args)\n raise 'A command is required' if args.empty?\n {\n :filename => 'todo_list_data.txt',\n :command => args[0],\n :modifier => args[1]\n }\n end", "def parse_args(args)\n require 'ostruct'\n require 'optparse'\n\n parser = OptionParser.new\n options = OpenStruct.new\n\n options.output = STDOUT\n options.format = :text\n options.columns = nil\n options.subnodes = [ ]\n\n parser.banner = \"Usage: #{$0} [options] agent_address service_point username password attribute_group\"\n parser.on(\"-h\", \"--help\", \"Show this message.\") { $stderr.puts parser; exit }\n parser.on(\"-f\", \"--format [ 'text' | 'html' ]\", [:text, :html],\n \"Set the output format to either plain text or HTML.\", \"[default: text]\") do |f|\n options.format = f\n end\n parser.on(\"-c\", \"--columns c1,...,cN\", Array, \"Output columns c1,...,cN.\", \"[default: all columns]\") { |c| options.columns = c }\n parser.on(\"-s\", \"--subnodes s1,...,sN\", Array, \"Collects data for subnodes s1,...,sN.\", \"[default: no subnodes]\") { |s| options.subnodes = s }\n\n rest = parser.parse(args)\n\n # Ensure we have all the required args\n if rest.length != 5\n $stderr.puts parser\n exit\n end\n\n return *rest, options\nend", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end", "def to_json(*a)\n Chef::JSONCompat.to_json(for_json, *a)\n end", "def parse_options(argv, env)\n argv_copy = argv.dup\n opts = parse_global_options!(argv_copy, env)\n subcommand = parse_subcommand!(argv_copy)\n opts[:subcommand] = subcommand\n sub_opts = parse_subcommand_options!(subcommand, argv_copy, env)\n opts.merge!(sub_opts)\n opts\n end", "def as_json(*args)\n eval(to_s).as_json(*args)\n end", "def parse(argv)\n options = parser.process!(argv)\n validate_options(options)\n Revamp.logger.level = Logger::INFO unless options[:verbose]\n options\n end", "def to_json(*args)\n as_json(args).to_json\n end", "def argv; argline.split(/ +/) unless argline.nil?; end", "def parse_arguments\n @cmd_line_arguments = {}\n\n @options = OptionParser.new do |opt|\n opt.on('-C', '--change-dir DIR', 'Change working directory to DIR') do |directory|\n @cmd_line_arguments[:working_directory] = directory\n end\n\n opt.on('-d', '--debug', 'Debug mode') do\n @cmd_line_arguments[:debug] = true\n end\n\n opt.on('-e', '--environment NAME', 'set environment to NAME') do |environment|\n @cmd_line_arguments[:environment] = environment\n end\n\n opt.on('-G', '--generate-json', 'Generate json files, which are commited to api') do\n @cmd_line_arguments[:generate_json_file] = true\n @cmd_line_arguments[:action] ||= :generate\n end\n\n opt.on('--generate-report', 'Generate report csv in output directory') do\n @cmd_line_arguments[:generate_report] = true\n end\n\n opt.on('-g', '--group NAME[,NAME]', Array, 'set groups') do |groups|\n @cmd_line_arguments[:groups] ||= []\n @cmd_line_arguments[:groups] += groups\n end\n\n opt.on('-j', '--job JOB[,JOB,...]', Array, 'Limit action to JOB, which is a regexpression') do |jobs|\n @selected_jobs += jobs\n end\n\n opt.on('-l', '--list', 'List available jobs') do\n @cmd_line_arguments[:action] = :list\n end\n\n opt.on('-p', '--project NAME', 'set project') do |project|\n @cmd_line_arguments[:project] = project\n end\n\n opt.on('-o', '--output-directory DIR', 'generate json file into DIR directory', 'default: ' + @config.output_directory) do |directory|\n @cmd_line_arguments[:output_directory] = directory\n end\n\n opt.on('-q', '--quiet', 'be quiet') do\n @cmd_line_arguments[:quiet] = true\n end\n\n opt.on('-r', '--run', 'Run all configured jobs or all jobs passed with -j') do\n @cmd_line_arguments[:action] = :run\n end\n\n opt.on('-R', '--report', 'show report') do\n @cmd_line_arguments[:report] = true\n end\n\n opt.on('-s', '--save-response', 'save respone in output directory') do\n @cmd_line_arguments[:save_response] = true\n end\n\n opt.separator \"\n\n Examples:\n # List all available jobs\n #{File.basename $0} -l\n\n # List all available jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -l\n\n # Run all configured jobs\n #{File.basename $0} -r\n\n # Run all configured jobs and show a report\n #{File.basename $0} -r --report\n\n # Run all configured jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -r\n\n # Run Job_A and Job_B, which must configured in project.yml or group.yml\n #{File.basename $0} -r -j Job_A -j Job_B\n\n # Run all Jobs, which beginn with JOB\n #{File.basename $0} -r -j JOB.*\n\n # Run all Jobs, which contains with JOB\n #{File.basename $0} -r -j .*JOB.*\n\n # Generate json files, which are going to be requested, for all configured jobs\n #{File.basename $0} -G\n\n # Generate json file, which are going to be requested, for Job_A\n #{File.basename $0} -G -j Job_A\n\n # Run jobs for delti group and generate json files\n #{File.basename $0} -r -G -g delti\n\n Available template macros:\n\n Variables and Responses:\n response('<job_name>', '<name>') - return value from the response of a job (see examples)\n response('<job_name>', - return value from the response of a job in another group (must be run before)\n '<name>',\n group: '<group_name>')\n var('<name>', - return variable defined in Job in Vars section.\n default: nil, when default is set (not nil) and variable is undefined, return default\n ignore_error: false) when variable is undefined, do not throw an error\n\n Date and Time:\n now() - returns today (now) in seconds\n yesterday() - returns yesterday in iso8601\n time([<day_shift>[, format: <format>]]) - returns time in specificied format\n defaults: day_shift = 0, format = :seconds\n format:\n :seconds : return time in seconds\n :iso8601 : return timestamp in iso8601\n :iso8601utc : return timestamp in iso8601 (utc)\n\n Examples:\n # get variable test\n var('test')\n\n # get value pdfToken from register response\n response('Delti_Create_DE', 'pdfToken')\n\n # get value pdfToken from register response, where job name is defined as variable in cancel job\n response(var('CreateJob'), 'pdfToken')\n\n # get value token from GenerateToken response in group auth\n response('GenerateToken', 'token', group: 'auth')\n\n # return time of today in seconds\n time()\n\n # return timestamp of today in iso8601\n time(format: :iso8601)\n\n # return timestamp of yesterday in iso8601\n time(-1, format: :iso8601)\n\n # return timestamp of last year in iso8601\n time(-365, format: :iso8601)\n\n # return timestamp of tomorrow in iso8601\n time(1, format: :iso8601)\n\n # return credential\n credential('PROJECT_NAME_username')\n\n # return basic auth header value\n basicauth('PROJECT_NAME_username', 'PROJECT_NAME_password')\n \"\n end\n @options.parse!\n\n @config.insert 0, '<command_line>', @cmd_line_arguments\n\n unless File.directory?(@config.output_directory)\n Dir.mkdir @config.output_directory\n end\n\n Dir.chdir @config.working_directory\n end", "def jsonify(input); end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # path to the floorplan JSON file to load\n floorplan_path = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"floorplan_path\", true)\n floorplan_path.setDisplayName(\"Floorplan Path\")\n floorplan_path.setDescription(\"Path to the floorplan JSON.\")\n args << floorplan_path\n\n return args\n end", "def parse_args(argv)\n @args ||= nil\n raise \"#{class_name}.initialize failed to call super!\" unless\n args.is_a?(Hash)\n\n #\n # if this CLI has boolean arguments which can immediately\n # precede the non-option arguments (ie those arguments which\n # don't begin with '--'), those booleans need to be declared.\n # otherwise when parsing the boolean argument, we'll mistake\n # the boolean as an option with a value:\n #\n # foo.rb --boolean firstnonoption\n #\n # becomes args = {:boolean => 'firstnonoption'}.\n #\n booleans = {}\n booleans = Hash[*(boolean_args.map { |a| [a,1] }.flatten)] if\n self.respond_to? :boolean_args\n\n skipped = []\n while argv.length > 0 do\n unless argv[0] =~ /^--?/\n skipped.push argv.shift\n\n else\n # shift the argument name out of argv\n argname = argv.shift.sub(/^--?/, '').downcase\n raise ArgumentError, \"expected: --ARGNAME; got: '#{argname.inspect}'\" unless\n argname.is_str?\n\n # strip trailing '-' then convert remaining '-' to '_'\n argsym = argname.sub(/-+$/, '').gsub(/-+/, '_').to_sym\n\n if booleans[argsym] or (argv.length < 1) or (argv[0] =~ /^--?/)\n # a boolean argument whose value is false when the argument ends with '-'\n args[argsym] = (argname =~ /-$/) ? false : true\n else\n # named argument\n args[argsym] = argv.shift\n end\n end\n end\n\n self.argv = skipped || []\n\n usage if args[:help] or args[:usage]\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n @unknown_argvs = []\n until args.empty? do\n arg = args.shift\n case\n # end of options parsing\n when arg == '--'\n self.rest += args\n break\n # --param=val or --param\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n warn \"Configliere uses _underscores not dashes for params\" if param.include?('-')\n @unknown_argvs << param.to_sym if (not has_definition?(param))\n self[param] = parse_value(val)\n # -abc\n when arg =~ /\\A-(\\w\\w+)\\z/\n $1.each_char do |flag|\n param = find_param_for_flag(flag)\n unless param then @unknown_argvs << flag ; next ; end\n self[param] = true\n end\n # -a val\n when arg =~ /\\A-(\\w)\\z/\n flag = find_param_for_flag($1)\n unless flag then @unknown_argvs << flag ; next ; end\n if (not args.empty?) && (args.first !~ /\\A-/)\n val = args.shift\n else\n val = nil\n end\n self[flag] = parse_value(val)\n # -a=val\n when arg =~ /\\A-(\\w)=(.*)\\z/\n flag, val = [find_param_for_flag($1), $2]\n unless flag then @unknown_argvs << flag ; next ; end\n self[flag] = parse_value(val)\n else\n self.rest << arg\n end\n end\n @unknown_argvs.uniq!\n end", "def parse!(argv=ARGV, opts={})\n command = argv.shift\n case command\n when '--version', '-v'\n puts \"Aladdin #{Aladdin::VERSION}\"\n exit 0\n when nil, '--help', '-h'\n puts File.read USAGE\n exit 0\n else\n require_relative 'commands/new'\n require_relative 'commands/server'\n send command, argv, opts\n end\n rescue => e\n puts e.message\n puts File.read USAGE\n exit 1\n end", "def parse( argv )\n self.data = ::Crate.data_path\n opts = option_parser\n begin\n opts.parse!( argv )\n self.project = argv.shift\n\n if project.nil?\n puts opts\n exit 1\n end\n rescue ::OptionParser::ParseError => pe\n puts \"#{opts.program_name}: #{pe}\"\n puts \"Try `#{opts.program_name} --help` for more information\"\n exit 1\n end\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n until args.empty? do\n arg = args.shift\n case\n when arg == '--'\n self.rest += args\n break\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n param.gsub!(/\\-/, '.') # translate --scoped-flag to --scoped.flag\n param = param.to_sym unless (param =~ /\\./) # symbolize non-scoped keys\n if val == nil then val = true # --flag option on its own means 'set that option'\n elsif val == '' then val = nil end # --flag='' the explicit empty string means nil\n self[param] = val\n when arg =~ /\\A-(\\w+)\\z/\n $1.each_char do |flag|\n param = param_with_flag(flag)\n self[param] = true if param\n end\n else\n self.rest << arg\n end\n end\n end", "def parse(argv = [])\n @option_parser.parse!(argv)\n\n options.each do |option|\n if option.required? and !option.has_value?\n Shebang.error(\"The -#{option.short} option is required\")\n end\n end\n\n return argv\n end", "def parse_cli!(arg_list)\n options = {}\n parser = OptionParser.new do |opts|\n VALUE_OPTIONS.each do |(short, long, message)|\n opts.on(\"-#{short} MANDATORY\", \"--#{long} MANDATORY\", message) do |val|\n options[long] = val\n end\n end\n\n FLAG_OPTIONS.each do |(short, long, message)|\n opts.on(\"-#{short}\", \"--#{long}\", message) do |val|\n options[long] = true\n end\n end\n\n opts.on(\"-F\", \"--format\", \"The format is always JSON. Deal with it.\") do\n options['format'] = 'j'\n end\n end\n\n parser.parse!(arg_list)\n options\n end", "def as_json(node)\n json = {\n name: node.name,\n ipaddress: node.ipaddress,\n domain: (node.domain if node.has_key?('domain')),\n os_version: node.os_version,\n recipes: (node.recipes.as_json if node.has_key?('recipes')),\n hostname: node.hostname,\n tags: node.tags.as_json,\n }\n if node.has_key?('network')\n network = {}\n network['default_interface'] = node.network.default_interface\n interfaces = {}\n node.network.interfaces.select{|k, v| k.start_with?('eth')}.each do |ifname, v|\n interface = {}\n if v['addresses']\n v['addresses'].each do |address, v|\n interface[v['family']] = address\n end\n end\n interfaces[ifname] = interface\n end\n network['interfaces'] = interfaces\n json['network'] = network\n end\n json\n end", "def to_json( *args )\n h = to_hash( *args )\n Oj.dump(h)\n end", "def args_builder_json(opts, use_output_option=false)\n gcovr_opts = get_opts(opts)\n args = \"\"\n\n # Determine if the gcovr JSON report is enabled. Defaults to disabled.\n if is_report_enabled(opts, ReportTypes::JSON)\n # Determine the JSON report file name.\n artifacts_file_json = GCOV_ARTIFACTS_FILE_JSON\n if !(gcovr_opts[:json_artifact_filename].nil?)\n artifacts_file_json = File.join(GCOV_ARTIFACTS_PATH, gcovr_opts[:json_artifact_filename])\n end\n\n args += \"--json-pretty \" if gcovr_opts[:json_pretty]\n # Note: In gcovr 4.2, the JSON report is output only when the --output option is specified.\n # Hopefully we can remove --output after a future gcovr release.\n args += \"--json #{use_output_option ? \"--output \" : \"\"} \\\"#{artifacts_file_json}\\\" \"\n end\n\n return args\n end", "def parse_args(args)\n result = {}\n args.each do |arg|\n pair = arg.split(\"=\")\n result[pair[0]]=pair[1]\n end\n result\n end", "def parse(argv)\n argv_copy = argv.dup\n opts = add_options(init_parser)\n opts.parse!(argv_copy)\n argv_copy\n end", "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend", "def arguments\n @arguments ||= Launchr::OrderedHash.new\n @arguments\n end", "def arguments\n @args ||= {}\n unless @args.size > 0\n ARGV.each_with_index do |arg, index|\n if arg.start_with?('-')\n if index + 1 < ARGV.size\n next_arg = ARGV[index + 1]\n if next_arg.start_with?('-') then\n @args.update(argument_present_or_direct(arg))\n else\n @args.update(arg => next_arg)\n end\n else\n @args.update(argument_present_or_direct(arg))\n end\n end\n end\n end\n @args\n end", "def go(argv)\n logger.debug(\"Using args passed in: #{argv.inspect}\")\n\n cmd = nil\n\n @optparse = OptionParser.new do |opts|\n cmd = super(argv, opts, @config)\n\n opts.on('-v', '--version', 'Print the version') do\n puts \"#{name} #{version}\"\n abort\n end\n end\n\n @optparse.parse!(argv)\n\n logger.debug(\"Parsed config: #{@config.inspect}\")\n\n cmd.execute(argv, @config)\n end", "def parse(argv=ARGV, &block)\n argv = argv.dup unless argv.kind_of?(String)\n parse!(argv, &block)\n end" ]
[ "0.6073539", "0.6073539", "0.6073539", "0.6073539", "0.6073539", "0.5711646", "0.56099266", "0.5487876", "0.54710764", "0.5397917", "0.5371958", "0.5348169", "0.53394496", "0.53031284", "0.5281803", "0.52738583", "0.5273534", "0.52599037", "0.52573115", "0.52487284", "0.5175083", "0.51190037", "0.5098809", "0.5097676", "0.5083071", "0.5078881", "0.5073138", "0.50582", "0.504482", "0.5035186", "0.5019259", "0.50121194", "0.49870643", "0.49755177", "0.49707568", "0.49530163", "0.49404514", "0.49261546", "0.49111408", "0.48934865", "0.48854217", "0.48851615", "0.48784706", "0.48784706", "0.4877726", "0.4877726", "0.4874411", "0.48663", "0.48656735", "0.48604617", "0.48602393", "0.4847451", "0.48470518", "0.4820439", "0.48201805", "0.48134297", "0.4796402", "0.47914824", "0.4789921", "0.47872165", "0.47831336", "0.4781235", "0.47711065", "0.47663885", "0.47588238", "0.4754321", "0.4750214", "0.47458875", "0.4744871", "0.47413477", "0.47375727", "0.4734155", "0.47293144", "0.47205105", "0.47124034", "0.47065735", "0.4705519", "0.46876916", "0.46869487", "0.46847963", "0.46847853", "0.46824998", "0.46823686", "0.4679817", "0.46698743", "0.46684095", "0.46654442", "0.4661393", "0.46600005", "0.46561217", "0.46554735", "0.46512133", "0.46490312", "0.46488032", "0.46413833", "0.4640123", "0.46299165", "0.46296185", "0.4616864", "0.46142274" ]
0.62305874
0
modifies a network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9'
def cmd_modify argv setup argv json = @hash['json'] e = @hash['element'] response = @api.modify(json, e) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @addon_node = args[:addon_node] if args.key?(:addon_node)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @bootstrap_cluster_membership = args[:bootstrap_cluster_membership] if args.key?(:bootstrap_cluster_membership)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @image_type = args[:image_type] if args.key?(:image_type)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @platform_config = args[:platform_config] if args.key?(:platform_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n end", "def update!(**args)\n @interface = args[:interface] if args.key?(:interface)\n @name = args[:name] if args.key?(:name)\n @port = args[:port] if args.key?(:port)\n @project = args[:project] if args.key?(:project)\n @self_link = args[:self_link] if args.key?(:self_link)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @network_interfaces = args[:network_interfaces] if args.key?(:network_interfaces)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @sub_network = args[:sub_network] if args.key?(:sub_network)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @authorized_network = args[:authorized_network] if args.key?(:authorized_network)\n @create_time = args[:create_time] if args.key?(:create_time)\n @discovery_endpoint = args[:discovery_endpoint] if args.key?(:discovery_endpoint)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_messages = args[:instance_messages] if args.key?(:instance_messages)\n @labels = args[:labels] if args.key?(:labels)\n @memcache_full_version = args[:memcache_full_version] if args.key?(:memcache_full_version)\n @memcache_nodes = args[:memcache_nodes] if args.key?(:memcache_nodes)\n @memcache_version = args[:memcache_version] if args.key?(:memcache_version)\n @name = args[:name] if args.key?(:name)\n @node_config = args[:node_config] if args.key?(:node_config)\n @node_count = args[:node_count] if args.key?(:node_count)\n @parameters = args[:parameters] if args.key?(:parameters)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @zones = args[:zones] if args.key?(:zones)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n end", "def update!(**args)\n @element = args[:element] if args.key?(:element)\n end", "def update!(**args)\n @advanced_networking = args[:advanced_networking] if args.key?(:advanced_networking)\n @island_mode_cidr = args[:island_mode_cidr] if args.key?(:island_mode_cidr)\n @multiple_network_interfaces_config = args[:multiple_network_interfaces_config] if args.key?(:multiple_network_interfaces_config)\n @sr_iov_config = args[:sr_iov_config] if args.key?(:sr_iov_config)\n end", "def update!(**args)\n @block_external_network = args[:block_external_network] if args.key?(:block_external_network)\n @commands = args[:commands] if args.key?(:commands)\n @entrypoint = args[:entrypoint] if args.key?(:entrypoint)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @options = args[:options] if args.key?(:options)\n @password = args[:password] if args.key?(:password)\n @username = args[:username] if args.key?(:username)\n @volumes = args[:volumes] if args.key?(:volumes)\n end", "def update!(**args)\n @enable_internet_access = args[:enable_internet_access] if args.key?(:enable_internet_access)\n @network = args[:network] if args.key?(:network)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @asn = args[:asn] if args.key?(:asn)\n @control_plane_nodes = args[:control_plane_nodes] if args.key?(:control_plane_nodes)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @interface = args[:interface] if args.key?(:interface)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @service_account = args[:service_account] if args.key?(:service_account)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @app_gateway = args[:app_gateway] if args.key?(:app_gateway)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @l7psc = args[:l7psc] if args.key?(:l7psc)\n @type = args[:type] if args.key?(:type)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @multi_cluster_routing_use_any = args[:multi_cluster_routing_use_any] if args.key?(:multi_cluster_routing_use_any)\n @name = args[:name] if args.key?(:name)\n @single_cluster_routing = args[:single_cluster_routing] if args.key?(:single_cluster_routing)\n end", "def update!(**args)\n @addons_node_port = args[:addons_node_port] if args.key?(:addons_node_port)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\n end", "def update!(**args)\n @gateway = args[:gateway] if args.key?(:gateway)\n @ips = args[:ips] if args.key?(:ips)\n @netmask = args[:netmask] if args.key?(:netmask)\n end", "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @ip = args[:ip] if args.key?(:ip)\n end", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def update!(**args)\n @application_endpoint = args[:application_endpoint] if args.key?(:application_endpoint)\n @application_name = args[:application_name] if args.key?(:application_name)\n @gateway = args[:gateway] if args.key?(:gateway)\n @name = args[:name] if args.key?(:name)\n @project = args[:project] if args.key?(:project)\n @tunnels_per_gateway = args[:tunnels_per_gateway] if args.key?(:tunnels_per_gateway)\n @user_port = args[:user_port] if args.key?(:user_port)\n end", "def update!(**args)\n @args = args[:args] if args.key?(:args)\n @command = args[:command] if args.key?(:command)\n @env = args[:env] if args.key?(:env)\n @health_route = args[:health_route] if args.key?(:health_route)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @ports = args[:ports] if args.key?(:ports)\n @predict_route = args[:predict_route] if args.key?(:predict_route)\n end", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @authorization = args[:authorization] if args.key?(:authorization)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dataplane_v2 = args[:dataplane_v2] if args.key?(:dataplane_v2)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @disable_bundled_ingress = args[:disable_bundled_ingress] if args.key?(:disable_bundled_ingress)\n @enable_control_plane_v2 = args[:enable_control_plane_v2] if args.key?(:enable_control_plane_v2)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n @vm_tracking_enabled = args[:vm_tracking_enabled] if args.key?(:vm_tracking_enabled)\n end", "def update!(**args)\n @interaction_type = args[:interaction_type] if args.key?(:interaction_type)\n @node_value = args[:node_value] if args.key?(:node_value)\n end", "def edit(entry)\n return \"Node hostname cannot be empty!\" if entry['hostname'].empty?\n load\n doc = REXML::Element.new(\"NODE\")\n doc.add_attributes(entry)\n if entry['oldname'].empty?\n # adding a new node\n @@nds.each{|n|\n return \"'#{n['hostname']}' already exists!\" if n['hostname'] == entry['hostname'] && n['testbed'] == entry['testbed']\n }\n result = OMF::Services.inventory.addNode(doc.to_s)\n return AM_ERROR if !XPath.match(result, \"ADD_NODE/OK\" )\n else\n # update an existing entry\n @@nds.collect! {|n|\n if n['hostname'] == entry['oldname']\n n = entry\n n.delete('oldname')\n end\n n\n }\n end\n saveDnsmasqConfig\n return \"OK\"\n end", "def update!(**args)\n @element = args[:element] if args.key?(:element)\n @extra = args[:extra] if args.key?(:extra)\n @label = args[:label] if args.key?(:label)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n end", "def update!(**args)\n @cidr = args[:cidr] if args.key?(:cidr)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @mac_address = args[:mac_address] if args.key?(:mac_address)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @vlan_id = args[:vlan_id] if args.key?(:vlan_id)\n @vrf = args[:vrf] if args.key?(:vrf)\n end", "def update!(**args)\n @cluster_network_uri = args[:cluster_network_uri] if args.key?(:cluster_network_uri)\n @cluster_uri = args[:cluster_uri] if args.key?(:cluster_uri)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n end", "def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @description = args[:description] unless args[:description].nil?\n @initial_node_count = args[:initial_node_count] unless args[:initial_node_count].nil?\n @node_config = args[:node_config] unless args[:node_config].nil?\n @master_auth = args[:master_auth] unless args[:master_auth].nil?\n @logging_service = args[:logging_service] unless args[:logging_service].nil?\n @monitoring_service = args[:monitoring_service] unless args[:monitoring_service].nil?\n @network = args[:network] unless args[:network].nil?\n @cluster_ipv4_cidr = args[:cluster_ipv4_cidr] unless args[:cluster_ipv4_cidr].nil?\n @self_link = args[:self_link] unless args[:self_link].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @endpoint = args[:endpoint] unless args[:endpoint].nil?\n @initial_cluster_version = args[:initial_cluster_version] unless args[:initial_cluster_version].nil?\n @current_master_version = args[:current_master_version] unless args[:current_master_version].nil?\n @current_node_version = args[:current_node_version] unless args[:current_node_version].nil?\n @create_time = args[:create_time] unless args[:create_time].nil?\n @status = args[:status] unless args[:status].nil?\n @status_message = args[:status_message] unless args[:status_message].nil?\n @node_ipv4_cidr_size = args[:node_ipv4_cidr_size] unless args[:node_ipv4_cidr_size].nil?\n @services_ipv4_cidr = args[:services_ipv4_cidr] unless args[:services_ipv4_cidr].nil?\n @instance_group_urls = args[:instance_group_urls] unless args[:instance_group_urls].nil?\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @labels = args[:labels] if args.key?(:labels)\n @manifest = args[:manifest] if args.key?(:manifest)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @self_link = args[:self_link] if args.key?(:self_link)\n @target = args[:target] if args.key?(:target)\n @update = args[:update] if args.key?(:update)\n end", "def update!(**args)\n @eligibility = args[:eligibility] if args.key?(:eligibility)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @nodes = args[:nodes] if args.key?(:nodes)\n @tier = args[:tier] if args.key?(:tier)\n end", "def update!(**args)\n @eligibility = args[:eligibility] if args.key?(:eligibility)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @nodes = args[:nodes] if args.key?(:nodes)\n @tier = args[:tier] if args.key?(:tier)\n end", "def update!(**args)\n @associated_networks = args[:associated_networks] if args.key?(:associated_networks)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n end", "def update!(**args)\n @ip = args[:ip] if args.key?(:ip)\n @labels = args[:labels] if args.key?(:labels)\n @port = args[:port] if args.key?(:port)\n @principal = args[:principal] if args.key?(:principal)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @port = args[:port] if args.key?(:port)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end", "def update!(**args)\n @gateway_service_mesh = args[:gateway_service_mesh] if args.key?(:gateway_service_mesh)\n @service_networking = args[:service_networking] if args.key?(:service_networking)\n end", "def update!(**args)\n @commands = args[:commands] if args.key?(:commands)\n @entrypoint = args[:entrypoint] if args.key?(:entrypoint)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @options = args[:options] if args.key?(:options)\n @volumes = args[:volumes] if args.key?(:volumes)\n end", "def update!(**args)\n @experiment_id_list = args[:experiment_id_list] if args.key?(:experiment_id_list)\n @mode = args[:mode] if args.key?(:mode)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @experiment_id_list = args[:experiment_id_list] if args.key?(:experiment_id_list)\n @mode = args[:mode] if args.key?(:mode)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @permissions = args[:permissions] if args.key?(:permissions)\n @action = args[:action] if args.key?(:action)\n @in = args[:in] if args.key?(:in)\n @not_in = args[:not_in] if args.key?(:not_in)\n @conditions = args[:conditions] if args.key?(:conditions)\n @log_config = args[:log_config] if args.key?(:log_config)\n end", "def update!(**args)\n @ip_addresses = args[:ip_addresses] if args.key?(:ip_addresses)\n @modes = args[:modes] if args.key?(:modes)\n @network = args[:network] if args.key?(:network)\n @reserved_ip_range = args[:reserved_ip_range] if args.key?(:reserved_ip_range)\n end", "def update!(**args)\n @autonomous_system_number = args[:autonomous_system_number] if args.key?(:autonomous_system_number)\n @juniper_alias = args[:juniper_alias] if args.key?(:juniper_alias)\n @name = args[:name] if args.key?(:name)\n @route_target = args[:route_target] if args.key?(:route_target)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @credential = args[:credential] if args.key?(:credential)\n @description = args[:description] if args.key?(:description)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @labels = args[:labels] if args.key?(:labels)\n @manifest = args[:manifest] if args.key?(:manifest)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @outputs = args[:outputs] if args.key?(:outputs)\n @self_link = args[:self_link] if args.key?(:self_link)\n @target = args[:target] if args.key?(:target)\n @update = args[:update] if args.key?(:update)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_models = args[:deployed_models] if args.key?(:deployed_models)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @model_deployment_monitoring_job = args[:model_deployment_monitoring_job] if args.key?(:model_deployment_monitoring_job)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @predict_request_response_logging_config = args[:predict_request_response_logging_config] if args.key?(:predict_request_response_logging_config)\n @traffic_split = args[:traffic_split] if args.key?(:traffic_split)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hyperthreading_enabled = args[:hyperthreading_enabled] if args.key?(:hyperthreading_enabled)\n @interactive_serial_console_enabled = args[:interactive_serial_console_enabled] if args.key?(:interactive_serial_console_enabled)\n @labels = args[:labels] if args.key?(:labels)\n @luns = args[:luns] if args.key?(:luns)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @name = args[:name] if args.key?(:name)\n @networks = args[:networks] if args.key?(:networks)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @binary = args[:binary] if args.key?(:binary)\n @clusters = args[:clusters] if args.key?(:clusters)\n @epoch = args[:epoch] if args.key?(:epoch)\n @lang_code = args[:lang_code] if args.key?(:lang_code)\n @rephil_model_id = args[:rephil_model_id] if args.key?(:rephil_model_id)\n @taxonomic = args[:taxonomic] if args.key?(:taxonomic)\n @url = args[:url] if args.key?(:url)\n @weight = args[:weight] if args.key?(:weight)\n end", "def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n end", "def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @port_name = args[:port_name] if args.key?(:port_name)\n @server_name = args[:server_name] if args.key?(:server_name)\n end", "def update!(**args)\n @apt = args[:apt] if args.key?(:apt)\n @goo = args[:goo] if args.key?(:goo)\n @mig_instances_allowed = args[:mig_instances_allowed] if args.key?(:mig_instances_allowed)\n @post_step = args[:post_step] if args.key?(:post_step)\n @pre_step = args[:pre_step] if args.key?(:pre_step)\n @reboot_config = args[:reboot_config] if args.key?(:reboot_config)\n @windows_update = args[:windows_update] if args.key?(:windows_update)\n @yum = args[:yum] if args.key?(:yum)\n @zypper = args[:zypper] if args.key?(:zypper)\n end", "def update!(**args)\n @credential = args[:credential] if args.key?(:credential)\n @description = args[:description] if args.key?(:description)\n @labels = args[:labels] if args.key?(:labels)\n @manifest = args[:manifest] if args.key?(:manifest)\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n end", "def update!(**args)\n @hosts = args[:hosts] if args.key?(:hosts)\n @http_header_match = args[:http_header_match] if args.key?(:http_header_match)\n @methods_prop = args[:methods_prop] if args.key?(:methods_prop)\n @ports = args[:ports] if args.key?(:ports)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_indexes = args[:deployed_indexes] if args.key?(:deployed_indexes)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @private_service_connect_config = args[:private_service_connect_config] if args.key?(:private_service_connect_config)\n @public_endpoint_domain_name = args[:public_endpoint_domain_name] if args.key?(:public_endpoint_domain_name)\n @public_endpoint_enabled = args[:public_endpoint_enabled] if args.key?(:public_endpoint_enabled)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @firewall_endpoint = args[:firewall_endpoint] if args.key?(:firewall_endpoint)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @tls_inspection_policy = args[:tls_inspection_policy] if args.key?(:tls_inspection_policy)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @allowed_projects = args[:allowed_projects] if args.key?(:allowed_projects)\n @cluster_hostname = args[:cluster_hostname] if args.key?(:cluster_hostname)\n @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint)\n @service_attachment_uri = args[:service_attachment_uri] if args.key?(:service_attachment_uri)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @manifest_file_name = args[:manifest_file_name] if args.key?(:manifest_file_name)\n @script_id = args[:script_id] if args.key?(:script_id)\n @version_number = args[:version_number] if args.key?(:version_number)\n end", "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @password = args[:password] if args.key?(:password)\n @port = args[:port] if args.key?(:port)\n @private_key = args[:private_key] if args.key?(:private_key)\n @username = args[:username] if args.key?(:username)\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 update!(**args)\n @allocated_connections = args[:allocated_connections] if args.key?(:allocated_connections)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @host_type = args[:host_type] if args.key?(:host_type)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @uuid = args[:uuid] if args.key?(:uuid)\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @location = args[:location] if args.key?(:location)\n @node_id = args[:node_id] if args.key?(:node_id)\n end", "def update!(**args)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @location = args[:location] if args.key?(:location)\n @node_id = args[:node_id] if args.key?(:node_id)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @remote_gateway = args[:remote_gateway] if args.key?(:remote_gateway)\n @remote_gateway_ip = args[:remote_gateway_ip] if args.key?(:remote_gateway_ip)\n @routing_type = args[:routing_type] if args.key?(:routing_type)\n @source_gateway = args[:source_gateway] if args.key?(:source_gateway)\n @source_gateway_ip = args[:source_gateway_ip] if args.key?(:source_gateway_ip)\n @uri = args[:uri] if args.key?(:uri)\n end", "def updateObjectTree _args\n \"updateObjectTree _args;\" \n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @uri = args[:uri] if args.key?(:uri)\n @vpn_tunnel_uri = args[:vpn_tunnel_uri] if args.key?(:vpn_tunnel_uri)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @index_item_options = args[:index_item_options] if args.key?(:index_item_options)\n @item = args[:item] if args.key?(:item)\n @mode = args[:mode] if args.key?(:mode)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @index_item_options = args[:index_item_options] if args.key?(:index_item_options)\n @item = args[:item] if args.key?(:item)\n @mode = args[:mode] if args.key?(:mode)\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @partner_permissions = args[:partner_permissions] if args.key?(:partner_permissions)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @kubelet_config = args[:kubelet_config] if args.key?(:kubelet_config)\n @labels = args[:labels] if args.key?(:labels)\n @node_configs = args[:node_configs] if args.key?(:node_configs)\n @operating_system = args[:operating_system] if args.key?(:operating_system)\n @taints = args[:taints] if args.key?(:taints)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end" ]
[ "0.5877967", "0.58464944", "0.5841025", "0.5807635", "0.5739581", "0.57103986", "0.5707734", "0.5687186", "0.5633782", "0.5558491", "0.5511202", "0.5492197", "0.54439795", "0.5435326", "0.5416061", "0.5404252", "0.5400137", "0.5397197", "0.53889453", "0.53607035", "0.5345757", "0.5337694", "0.53284734", "0.5319527", "0.53110594", "0.5301069", "0.53004694", "0.5272501", "0.525126", "0.5241404", "0.5239756", "0.5237581", "0.5232757", "0.5232757", "0.52257097", "0.52174366", "0.5209787", "0.52048624", "0.51956826", "0.5182662", "0.517651", "0.5175803", "0.5168756", "0.5168756", "0.5162269", "0.51619124", "0.5137747", "0.5137217", "0.5124905", "0.5124478", "0.510353", "0.5099409", "0.50862134", "0.5081979", "0.5081979", "0.5075774", "0.5075774", "0.5066582", "0.5060053", "0.5058601", "0.5056218", "0.50512475", "0.50506157", "0.5048759", "0.5048529", "0.5048529", "0.5048529", "0.5048529", "0.5048529", "0.5048529", "0.5048529", "0.5048529", "0.5037941", "0.50352055", "0.503371", "0.50332534", "0.5031962", "0.5019987", "0.5016728", "0.50143546", "0.5011787", "0.5010458", "0.50075644", "0.50075644", "0.5006254", "0.5002133", "0.49956167", "0.4994309", "0.4994309", "0.49934417", "0.49918598", "0.49918598", "0.49899405", "0.4985738", "0.49857154", "0.49857154", "0.49857154", "0.49857154", "0.49857154", "0.49857154" ]
0.7363384
0
creates a new network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes'
def cmd_create argv setup argv json = @hash['json'] e = @hash['element'] response = @api.create(json, e) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end", "def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)\n network_path = ''\n if site_uid\n network_path = Pathname.new(refapi_path).join(\"sites\", site_uid, \"network_equipments\")\n else\n network_path = Pathname.new(refapi_path).join(\"network_equipments\")\n end\n network_path.mkpath()\n\n write_json(network_path.join(\"#{network_uid}.json\"), network)\nend", "def addhost(config)\n\n uri = URI.parse(\"#{config[\"addurl\"]}\")\n node = { \"EntityType\" => \"Orion.Nodes\", \"IPAddress\" => \"#{config[\"ipaddr\"]}\",\n \"Caption\"=> \"#{config[\"nodename\"]}\", \"DynamicIP\" => \"False\", \"EngineID\" => \"#{config[\"engineid\"]}\", \n \"Status\" => 1, \"UnManaged\" => \"False\", \"Allow64BitCounters\" => \"True\", \n \"SysObjectID\" => \"\", \"MachineType\" => \"\", \"VendorIcon\" => \"\", \n \"ObjectSubType\" => \"SNMP\", \"SNMPVersion\" => 2, \"Community\" => \"#{config[\"community\"]}\",\n }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})\n request.body = node.to_json\n request.basic_auth(\"#{config[\"username\"]}\", \"#{config[\"password\"]}\")\n\n response = http.request(request)\nend", "def update!(**args)\n @addon_node = args[:addon_node] if args.key?(:addon_node)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @bootstrap_cluster_membership = args[:bootstrap_cluster_membership] if args.key?(:bootstrap_cluster_membership)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @image_type = args[:image_type] if args.key?(:image_type)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @platform_config = args[:platform_config] if args.key?(:platform_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n end", "def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)\n network[\"type\"] = \"network_equipment\"\n network[\"uid\"] = network_uid\n\n network_path = ''\n if site_uid\n network_path = Pathname.new(refapi_path).join(\"sites\", site_uid, \"network_equipments\")\n else\n network_path = Pathname.new(refapi_path).join(\"network_equipments\")\n end\n network_path.mkpath()\n\n # Change the format of linecard from Hash to Array\n linecards_tmp = Marshal.load(Marshal.dump(network[\"linecards\"])) # bkp (deep_copy)\n\n linecards_array = []\n network[\"linecards\"].each do |linecard_index, linecard|\n ports = []\n linecard.delete(\"ports\").each do |port_index, port|\n port = { \"uid\"=> port } if port.is_a? String\n if port.is_a? Hash\n # complete entries (see bug 8587)\n if port['port'].nil? and linecard['port']\n port['port'] = linecard['port']\n end\n if port['kind'].nil? and linecard['kind']\n port['kind'] = linecard['kind']\n end\n if port['snmp_pattern'].nil? and linecard['snmp_pattern']\n port['snmp_pattern'] = linecard['snmp_pattern']\n end\n if port['snmp_pattern']\n port['snmp_name'] = port['snmp_pattern']\n .sub('%LINECARD%',linecard_index.to_s).sub('%PORT%',port_index.to_s)\n port.delete('snmp_pattern')\n end\n if ((!linecard['kind'].nil? &&\n port['kind'].nil? &&\n linecard['kind'] == 'node') ||\n port['kind'] == 'node') &&\n port['port'].nil?\n p = port['uid'].match(/([a-z]*-[0-9]*)-?(.*)/).captures[1]\n port['port'] = p != '' ? p : 'eth0'\n port['uid'] = port['uid'].gsub(/-#{p}$/, '')\n end\n end\n ports[port_index] = port\n end\n linecard[\"ports\"] = ports.map { |p| p || {} }\n linecards_array[linecard_index] = linecard\n end\n network[\"linecards\"] = linecards_array.map{|l| l || {}}\n\n network.delete_if {|k, v| k == \"network_adapters\"} # TO DELETE\n\n write_json(network_path.join(\"#{network_uid}.json\"), network)\n\n network[\"linecards\"] = linecards_tmp # restore\nend", "def update!(**args)\n @authorized_network = args[:authorized_network] if args.key?(:authorized_network)\n @create_time = args[:create_time] if args.key?(:create_time)\n @discovery_endpoint = args[:discovery_endpoint] if args.key?(:discovery_endpoint)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_messages = args[:instance_messages] if args.key?(:instance_messages)\n @labels = args[:labels] if args.key?(:labels)\n @memcache_full_version = args[:memcache_full_version] if args.key?(:memcache_full_version)\n @memcache_nodes = args[:memcache_nodes] if args.key?(:memcache_nodes)\n @memcache_version = args[:memcache_version] if args.key?(:memcache_version)\n @name = args[:name] if args.key?(:name)\n @node_config = args[:node_config] if args.key?(:node_config)\n @node_count = args[:node_count] if args.key?(:node_count)\n @parameters = args[:parameters] if args.key?(:parameters)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @zones = args[:zones] if args.key?(:zones)\n end", "def parse_networks args\n args = args.deep_dup\n dc_networks = networks\n args[\"interfaces_attributes\"].each do |key, interface|\n # Convert network id into name\n net = dc_networks.find { |n| [n.id, n.name].include?(interface[\"network\"]) }\n raise \"Unknown Network ID: #{interface[\"network\"]}\" if net.nil?\n interface[\"network\"] = net.name\n end if args[\"interfaces_attributes\"]\n args\n end", "def run\n super\n opt_port = _get_option \"port\"\n opt_protocol = _get_option \"protocol\"\n _create_network_service_entity(@entity,opt_port,opt_protocol,{})\n end", "def create\n ethers, new_ethers = process_ethers(params[:asset])\n @asset = NetDevice.new(params[:asset])\n asset_create('network_item', network_url, ethers, new_ethers)\n end", "def update!(**args)\n @interface = args[:interface] if args.key?(:interface)\n @name = args[:name] if args.key?(:name)\n @port = args[:port] if args.key?(:port)\n @project = args[:project] if args.key?(:project)\n @self_link = args[:self_link] if args.key?(:self_link)\n @zone = args[:zone] if args.key?(:zone)\n end", "def factory(element_json)\n OZonesElement.new(element_json, @client)\n end", "def edit(entry)\n return \"Node hostname cannot be empty!\" if entry['hostname'].empty?\n load\n doc = REXML::Element.new(\"NODE\")\n doc.add_attributes(entry)\n if entry['oldname'].empty?\n # adding a new node\n @@nds.each{|n|\n return \"'#{n['hostname']}' already exists!\" if n['hostname'] == entry['hostname'] && n['testbed'] == entry['testbed']\n }\n result = OMF::Services.inventory.addNode(doc.to_s)\n return AM_ERROR if !XPath.match(result, \"ADD_NODE/OK\" )\n else\n # update an existing entry\n @@nds.collect! {|n|\n if n['hostname'] == entry['oldname']\n n = entry\n n.delete('oldname')\n end\n n\n }\n end\n saveDnsmasqConfig\n return \"OK\"\n end", "def initialize(name, comment, properties, attributes, input, output, in_out,\n stat, temp, networks)\n @name = name\n @comment = comment\n @properties = properties\n @attributes = attributes\n @input = input\n @output = output\n @in_out = in_out\n @stat = stat\n @temp = temp\n @networks = networks\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n end", "def initialize(prefix, environment, node_ip, graphite_hosts, datacenter, environment_name)\n @prefix = prefix\n @environment = environment\n @node_ip = node_ip\n @graphite_hosts = graphite_hosts\n @datacenter = datacenter\n @environment_name = environment_name\n end", "def initialize(args)\n options = {}\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: pathook.rb <options> <add|del> <remote-id>\"\n opts.define_head \"\"\"\nThe script is intended to configure port address translation on a StratusLab\nfrontend. It can also be used as a One hook script to automatically open/close\nfirewall ports at VM startup/shutdown.\n\nA task and a VM identifier are required in order to work. The task can be\neither adding port translation (add) or removing port translation (del).\n\"\"\"\n\n opts.separator \"\"\n opts.separator \"Port translation options\"\n opts.on(\"-p\", \"--ports X,Y,Z\", Array, \"Remote ports to translate (default: #{DEFAULT_REMOTE_PORTS.join(',')})\") do |list|\n options[:rports] = list.map {|x| Integer(x)}\n end\n opts.on(\"-l\", \"--local-ip IP\", \"Local IP address (default: #{get_ip_address})\") do |ip|\n options[:local_ip] = ip\n end\n opts.on(\"-i\", \"--local-if IF\", \"Local interface name (default: #{DEFAULT_LOCAL_IF})\") do |ifname|\n options[:local_if] = ifname\n end\n opts.on(\"-r\", \"--local-range X:Y\", \"Local ports range used to translate remote ports (default: #{Ports::LIMIT_MIN_PORT}:#{Ports::LIMIT_MAX_PORT})\") do |range|\n options[:minport], options[:maxport] = range.split(':', 2).map {|x| Integer(x) if not x.empty?}\n end\n opts.on(\"-c\", \"--chain-prefix PREFIX\",\n \"Prefix to add to firewall default chains, e.g. FORWARD will become PREFIX-FORWARD (default: #{DEFAULT_CHAIN_PREFIX})\",\n \"WARNING: resulting chains MUST exist in the firewall\") do |opt|\n options[:chain_prefix] = opt\n end\n opts.on(\"-m\", \"--max-assign MAX\", Integer,\n \"Maximum number of translations authorized per remote machine (default: #{DEFAULT_MAX_ASSIGN})\",\n \"Set value to 0 to unlimited assignments\") do |max|\n options[:max_assign] = max\n end\n opts.on(\"-n\", \"--networks X,Y,Z\", \"Virtual networks used to translate ports (default: #{DEFAULT_NETWORKS.join(',')})\") do |networks|\n options[:networks] = networks\n end\n opts.on(\"-f\", \"--file FILE\", \"Ports translations file (default: #{Ports::DEFAULT_FILE})\") do |file|\n options[:file] = file\n end\n\n opts.separator \"\"\n opts.separator \"Common options\"\n opts.on_tail(\"-v\", \"--[no-]verbose\", \"Verbose mode (default: #{$verbose})\") do |b|\n $verbose = b\n end\n opts.on_tail(\"-h\", \"--help\", \"Summary help\") do\n puts opts\n exit\n end\n opts.on_tail(\"--version\", \"Show version\") do\n puts \"PATHook version #{VERSION}\"\n exit\n end\n end\n\n opts.parse!(args)\n\n # Manage mandatory arguments\n raise OptionParser::MissingArgument, \"Undefined task and/or remote identifier.\" if args.size != 2\n @task = args[0]\n id = Integer(args[1])\n\n super(id, options)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @sub_network = args[:sub_network] if args.key?(:sub_network)\n end", "def create_fake_network_node(vapp_networks, network_name)\n parent_section = vapp_networks.css('NetworkConfigSection').first\n new_network = Nokogiri::XML::Node.new \"NetworkConfig\", parent_section\n new_network['networkName'] = network_name\n placeholder = Nokogiri::XML::Node.new \"PLACEHOLDER\", new_network\n new_network.add_child placeholder\n parent_section.add_child(new_network)\n vapp_networks\n end", "def initialize(options={\n :force => false,\n :deployfile => 'deploy.yml',\n :remove_elements => [],\n :environment => nil,\n })\n\n deployfile = options[:deployfile]\n @json = readFile(deployfile)\n\n if (!options[:environment].nil?)\n overrides = env_overrides(\n File.dirname(deployfile),\n options[:environment].name)\n\n @json = @json.deep_merge!(overrides)\n end\n\n missing_attributes = MarathonDefaults.missing_attributes(@json) \n \n if(!missing_attributes.empty?)\n message = \"#{deployfile} is missing required marathon API attributes: #{missing_attributes.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n missing_envs = MarathonDefaults.missing_envs(@json)\n if(!missing_envs.empty?)\n message = \"#{deployfile} is missing required environment variables: #{missing_envs.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n @deployfile = deployfile \n @json = Utils.deep_symbolize(@json) \n \n add_identifier if (options[:force])\n remove_elements(options[:remove_elements])\n \n inject_envs = ENV.select { |k,v| /^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/.match(k) }\n cleaned_envs = Hash[inject_envs.map { |k,v| [k.gsub(/^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/,''), v ] }] \n self.add_envs cleaned_envs.to_hash unless cleaned_envs.empty?\n end", "def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @description = args[:description] unless args[:description].nil?\n @initial_node_count = args[:initial_node_count] unless args[:initial_node_count].nil?\n @node_config = args[:node_config] unless args[:node_config].nil?\n @master_auth = args[:master_auth] unless args[:master_auth].nil?\n @logging_service = args[:logging_service] unless args[:logging_service].nil?\n @monitoring_service = args[:monitoring_service] unless args[:monitoring_service].nil?\n @network = args[:network] unless args[:network].nil?\n @cluster_ipv4_cidr = args[:cluster_ipv4_cidr] unless args[:cluster_ipv4_cidr].nil?\n @self_link = args[:self_link] unless args[:self_link].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @endpoint = args[:endpoint] unless args[:endpoint].nil?\n @initial_cluster_version = args[:initial_cluster_version] unless args[:initial_cluster_version].nil?\n @current_master_version = args[:current_master_version] unless args[:current_master_version].nil?\n @current_node_version = args[:current_node_version] unless args[:current_node_version].nil?\n @create_time = args[:create_time] unless args[:create_time].nil?\n @status = args[:status] unless args[:status].nil?\n @status_message = args[:status_message] unless args[:status_message].nil?\n @node_ipv4_cidr_size = args[:node_ipv4_cidr_size] unless args[:node_ipv4_cidr_size].nil?\n @services_ipv4_cidr = args[:services_ipv4_cidr] unless args[:services_ipv4_cidr].nil?\n @instance_group_urls = args[:instance_group_urls] unless args[:instance_group_urls].nil?\n end", "def create_internal_network_node(network_config)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.Configuration {\n xml.IpScopes {\n xml.IpScope {\n xml.IsInherited(network_config[:is_inherited] || \"false\")\n xml.Gateway network_config[:gateway]\n xml.Netmask network_config[:netmask]\n xml.Dns1 network_config[:dns1] if network_config[:dns1]\n xml.Dns2 network_config[:dns2] if network_config[:dns2]\n xml.DnsSuffix network_config[:dns_suffix] if network_config[:dns_suffix]\n xml.IsEnabled(network_config[:is_enabled] || true)\n xml.IpRanges {\n xml.IpRange {\n xml.StartAddress network_config[:start_address]\n xml.EndAddress network_config[:end_address]\n }\n }\n }\n }\n xml.FenceMode 'isolated'\n xml.RetainNetInfoAcrossDeployments(network_config[:retain_info] || false)\n }\n end\n builder.doc\n end", "def create(name)\n configure [\"interface #{name}\", 'no ip address', 'switchport']\n end", "def network(arg=nil)\n set_or_return(:network, arg, :kind_of => Array, :required => true)\n end", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def create_network_for_import(\n opts\n )\n nic = opts[:nic]\n ccr_ref = opts[:ccr_ref]\n ccr_name = opts[:ccr_name]\n vc_uuid = opts[:vc_uuid]\n vcenter_instance_name = opts[:vcenter_instance_name]\n dc_name = opts[:dc_name]\n template_ref = opts[:template_ref]\n dc_ref = opts[:dc_ref]\n vm_id = opts[:vm_id]\n hpool = opts[:hpool]\n vi_client = opts[:vi_client]\n\n config = {}\n config[:refs] = nic[:refs]\n\n # Let's get the OpenNebula hosts ids\n # associated to the clusters references\n config[:one_ids] = nic[:refs].map do |ref|\n VCenterDriver::VIHelper\n .find_by_ref(\n OpenNebula::HostPool,\n 'TEMPLATE/VCENTER_CCR_REF',\n ref,\n vc_uuid,\n hpool\n )['CLUSTER_ID'] rescue -1\n end\n\n if vm?\n unmanaged = 'wild'\n else\n unmanaged = 'template'\n end\n\n net = VCenterDriver::Network\n .new_from_ref(\n nic[:net_ref],\n vi_client\n )\n if net\n vid = VCenterDriver::Network.retrieve_vlanid(net.item)\n end\n case nic[:pg_type]\n # Distributed PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_DPG\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For DistributedVirtualPortgroups\n # there is networks and uplinks\n config[:uplink] = false\n # NSX-V PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXV\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For NSX-V ( is the same as\n # DistributedVirtualPortgroups )\n # there is networks and uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net = NSXDriver::VirtualWire\n .new_from_name(nsx_client, nic[:net_name])\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n # Standard PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_PG\n # There is no uplinks for standard portgroups,\n # so all Standard\n # PortGroups are networks and no uplinks\n config[:uplink] = false\n config[:sw_name] = VCenterDriver::Network\n .virtual_switch(nic[:network])\n # NSX-T PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXT\n config[:sw_name] = \\\n nic[:network].summary.opaqueNetworkType\n # There is no uplinks for NSX-T networks,\n # so all NSX-T networks\n # are networks and no uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net =\n NSXDriver::OpaqueNetwork\n .new_from_name(nsx_client, nic[:net_name])\n\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n else\n raise \"Unknown network type: #{nic[:pg_type]}\"\n end\n\n import_opts = {\n :network_name=> nic[:net_name],\n :sw_name=> config[:sw_name],\n :network_ref=> nic[:net_ref],\n :network_type=> nic[:pg_type],\n :ccr_ref=> ccr_ref,\n :ccr_name=> ccr_name,\n :vcenter_uuid=> vc_uuid,\n :vcenter_instance_name=> vcenter_instance_name,\n :dc_name=> dc_name,\n :unmanaged=> unmanaged,\n :template_ref=> template_ref,\n :dc_ref=> dc_ref,\n :template_id=> vm_id\n }\n\n if nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXV ||\n nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXT\n import_opts[:nsx_id] = config[:nsx_id]\n import_opts[:nsx_vni] = config[:nsx_vni]\n import_opts[:nsx_tz_id] = config[:nsx_tz_id]\n end\n\n if vid\n vlanid = VCenterDriver::Network.vlanid(vid)\n\n # we have vlan id\n if /\\A\\d+\\z/.match(vlanid)\n import_opts[:vlanid] = vlanid\n end\n end\n\n # Prepare the Virtual Network template\n one_vnet = VCenterDriver::Network.to_one_template(import_opts)\n\n # always has to be created because of\n # templates when they are instantiated\n ar_tmp = ''\n ar_tmp << \"AR=[\\n\"\n ar_tmp << \"TYPE=\\\"ETHER\\\",\\n\"\n ar_tmp << \"SIZE=255\\n\"\n ar_tmp << \"]\\n\"\n\n if vm?\n ar_tmp << create_ar(nic, false, nic[:ipv4]) if nic[:ipv4]\n\n if nic[:ipv6]\n ar_tmp << create_ar(nic, false, nil, nic[:ipv6])\n end\n\n ar_tmp << create_ar(nic, true) if !nic[:ipv4] && !nic[:ipv6]\n end\n\n one_vnet[:one] << ar_tmp\n config[:one_object] = one_vnet[:one]\n _cluster_id = VCenterDriver::VIHelper\n .get_cluster_id(config[:one_ids])\n\n one_vn = VCenterDriver::Network.create_one_network(config)\n VCenterDriver::VIHelper.clean_ref_hash\n one_vn.info\n\n # Wait until the virtual network is in ready state\n t_start = Time.now\n error = false\n timeout = 30\n\n while Time.now - t_start < timeout\n begin\n if one_vn.short_state_str == 'rdy'\n error = false\n break\n end\n rescue StandardError\n error = true\n end\n\n sleep 1\n one_vn.info\n end\n\n if error\n error_msg = \"VNET #{one_vn.id} in state \"\n error_msg += \"#{one_vn.short_state_str}, aborting import\"\n raise error_msg\n end\n\n one_vn\n end", "def initialize(options={ :force => false, :deployfile => 'deploy.yml', :remove_elements => []})\n\n deployfile = options[:deployfile]\n \n if (!File.exist?(deployfile))\n message = \"\\'#{File.expand_path(deployfile)}\\' not found.\"\n raise Error::IOError, message, caller\n end\n\n extension = File.extname(deployfile)\n \n case extension\n when '.json'\n @json = YamlJson.read_json_w_macros(deployfile)\n when '.yaml','.yml'\n @json = YamlJson.yaml2json(deployfile)\n else\n message = \"File extension #{extension} is not supported for deployment file #{deployfile}\"\n raise Error::UnsupportedFileExtension, message, caller\n end \n\n # JSON fix for marathon\n # marathon require ENV variables to be quoted\n @json['env'].each do |key, value|\n if (value.is_a? Numeric)\n @json['env'][key] = value.to_json\n end\n end\n \n missing_attributes = MarathonDefaults.missing_attributes(@json) \n \n if(!missing_attributes.empty?)\n message = \"#{deployfile} is missing required marathon API attributes: #{missing_attributes.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n missing_envs = MarathonDefaults.missing_envs(@json)\n if(!missing_envs.empty?)\n message = \"#{deployfile} is missing required environment variables: #{missing_envs.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n @deployfile = deployfile \n @json = Utils.deep_symbolize(@json) \n \n add_identifier if (options[:force])\n remove_elements(options[:remove_elements])\n \n inject_envs = ENV.select { |k,v| /^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/.match(k) }\n cleaned_envs = Hash[inject_envs.map { |k,v| [k.gsub(/^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/,''), v ] }] \n self.add_envs cleaned_envs.to_h unless cleaned_envs.empty?\n end", "def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end", "def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, filepath)\n msg response\n return response\n end", "def test_add_cli\n expected = \"add MSCNETWORKNODE Node_ID=1, Node_Type_1=0, Local=1, Standard=1, Routing_Choice=2, \"\n expected << \"Network_ID=6, CAMEL_Ph1=0, CAMEL_Ph2=0, CAMEL_Ph3=0, \"\n expected << \"Point_Code=211-189-244, Intl_Fmt_Addr__E_164=14054728063, MAP_Version=3, \"\n expected << \"GTT_Coding_Format=0, Nature_of_Address=0, Digit_Translation_Type=0, \"\n expected << \"Description=Own Node MSC;\"\n assert_equal expected, @obj.add\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def initialize(params={})\n @network = params.fetch(:network,0)\n @members = params.fetch(:members,'NA')\n @kegg_path = annotate_kegg(ids=@members) #get KEGG pathways annotation of all the members in a network\n @go_terms = annotate_GO(ids=@members) #get GO biological processes annotation of all the members in a network\n @@num += 1 #every time a network object is initialized count it\n @@all_interactions << self #add all the objects to this list\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def new_node(*args)\n add_node(build_node(*args))\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def create params\n raise_start_server unless Server::node\n new params\n end", "def new_node(element)\n Node.new(element)\n end", "def initialize args\n hash_make args, InPort::ARG_SPECS\n @link = nil\n end", "def build_node\n Chef::Log.trace(\"Building node object for #{@node_name}\")\n @node = Chef::Node.find_or_create(node_name)\n ohai_data = @ohai.data.merge(@node.automatic_attrs)\n @node.consume_external_attrs(ohai_data, nil)\n @run_list_expansion = @node.expand!(\"server\")\n @expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings\n Chef::Log.info(\"Run List is [#{@node.run_list}]\")\n Chef::Log.info(\"Run List expands to [#{@expanded_run_list_with_versions.join(\", \")}]\")\n @node\n end", "def initialize options = {}\n @scripts = {}\n @networks = []\n @config_path = options[:config_path]\n @environment = options[:environment] || ENVIRONMENT\n @verbose = options[:verbose] == true\n\n raise ConfigError, 'missing config file path in :config_path option' unless @config_path\n\n load_config!\n\n networks = @config['blur']['networks']\n\n if networks&.any?\n networks.each do |network_options|\n @networks.<< Network.new network_options, self\n end\n end\n\n trap 2, &method(:quit)\n end", "def factory(element_xml)\n OpenNebula::VirtualMachine.new(element_xml,@client)\n end", "def factory(element_xml)\n OpenNebula::VirtualMachine.new(element_xml,@client)\n end", "def initialize network:\n super network[:type], network[:struct], act_fn: network[:act_fn]\n end", "def update!(**args)\n @network_interfaces = args[:network_interfaces] if args.key?(:network_interfaces)\n end", "def create_port(network, subnet = nil, device = nil, device_owner = nil)\n data = {\n 'port' => {\n 'network_id' => network,\n } \n }\n unless device_owner.nil?\n data['port']['device_owner'] = device_owner\n end\n unless device.nil?\n data['port']['device_id'] = device\n end\n unless subnet.nil?\n data['port']['fixed_ips'] = [{'subnet_id' => subnet}]\n end\n \n puts data\n\n return post_request(address(\"ports\"), data, @token)\n end", "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @authorization = args[:authorization] if args.key?(:authorization)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dataplane_v2 = args[:dataplane_v2] if args.key?(:dataplane_v2)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @disable_bundled_ingress = args[:disable_bundled_ingress] if args.key?(:disable_bundled_ingress)\n @enable_control_plane_v2 = args[:enable_control_plane_v2] if args.key?(:enable_control_plane_v2)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n @vm_tracking_enabled = args[:vm_tracking_enabled] if args.key?(:vm_tracking_enabled)\n end", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def init\n if @args.first.nil?\n @ui.error('Please specify the configuration')\n return ARGUMENT_ERROR_RESULT\n end\n\n @mdbci_config = Configuration.new(@args.first, @env.labels)\n @keyfile = @env.keyFile.to_s\n unless File.exist?(@keyfile)\n @ui.error('Please specify the key file to put to nodes')\n return ARGUMENT_ERROR_RESULT\n end\n result = NetworkSettings.from_file(@mdbci_config.network_settings_file)\n if result.error?\n @ui.error(result.error)\n return ARGUMENT_ERROR_RESULT\n end\n\n @network_settings = result.value\n SUCCESS_RESULT\n end", "def new_edge(*args)\n add_edge(build_edge(*args))\n end", "def network\n\n\t\tdebug \"Network paramentrs\"\n\t\tnetwork = []\n\t\tiface = resource[:interfaces]\n\t\tif iface.nil? \n\t\t\tnetwork = [\"--network\", \"network=default\"]\n\t\telsif iface == \"disable\"\n\t\t\tnetwork = [\"--nonetworks\"]\n\t\telse\n\t\t\tiface.each do |iface|\n\t\t\t\tif interface?(iface)\t\n\t\t\t\t\tnetwork << [\"--network\",\"bridge=\"+iface]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tmacs = resource[:macaddrs]\n\t\tif macs\n\t\t\tresource[:macaddrs].each do |macaddr|\n\t\t\t\t#FIXME -m is decrepted\n\t\t\t\tnetwork << \"-m\"\n\t\t\t\tnetwork << macaddr\n\t\t\tend\n\t\tend\n\n\t\treturn network\n\tend", "def apply_network_settings container, networking\n OpenNebula.log_debug \"Configuring network\"\n nic = {:ifname => 'eth0', :host_mac => 'FE:FF:FF:FF:FF:FF'}\n\n container.add_veth nic\n OpenVZ::Util.execute \"brctl addif #{networking[:bridge]} veth#{container.ctid}.0\" unless networking[:bridge].nil?\n\n container.command \"ifconfig eth0 #{networking[:ip]}\"\n container.command \"ifconfig eth0 up\"\n end", "def create\n @config_element = ConfigElement.new(config_element_params)\n\n respond_to do |format|\n if @config_element.save\n format.html { redirect_to @config_element, notice: 'Config element was successfully created.' }\n format.json { render :show, status: :created, location: @config_element }\n else\n format.html { render :new }\n format.json { render json: @config_element.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_host(host, args = {})\n raise ArgumentError, \"Must specify ip and port\" unless \\\n args.include? :ip and args.include? :port\n\n modify_host(host, args, 'create')\n end", "def initialize(name, json = nil)\n @name = name\n if !json.nil?\n @ebs_optimized = json[\"ebs-optimized\"] || false\n @placement_group = json[\"placement-group\"]\n @profile = json[\"profile\"]\n @image = json[\"image\"]\n @key_name = json[\"key-name\"]\n @monitoring = json[\"monitoring\"] || false\n @network_interfaces = json[\"network-interfaces\"] || 0\n @source_dest_check = json[\"source-dest-check\"]\n @private_ip_address = json[\"private-ip-address\"]\n @security_groups = json[\"security-groups\"] || []\n @subnet = json[\"subnet\"]\n @tenancy = json[\"tenancy\"] || \"default\"\n @type = json[\"type\"]\n @user_data = json[\"user-data\"]\n @volume_groups = json[\"volume-groups\"] || []\n @tags = json[\"tags\"] || {}\n end\n end", "def neigh_command_builder(name, cmd, opts)\n command_builder(\"neighbor #{name} #{cmd}\", opts)\n end", "def add_edge(element1, element2)\n index1 = self.dict[element1]\n index2 = self.dict[element2]\n raise Exception.new(\"Nodes not exist!\") unless index1 && index2\n\n head_node2 = self.adj_list_array[index2].head_node\n new_node1 = Node.new(element1, head_node2.next_node)\n head_node2.next_node = new_node1\n\n\n head_node1 = self.adj_list_array[index1].head_node\n new_node2 = Node.new(element2, head_node1.next_node)\n head_node1.next_node = new_node2\n\n self\n end", "def _build_and_attach_node(endpoint_class, method_name=nil)\n # Create the new endpoint\n endpoint_instance = endpoint_class.new(@requester, method_name, self)\n # Attach the endpoint as an instance variable and method\n method_name ||= endpoint_class.name.demodulize.underscore\n self.instance_variable_set(\"@#{method_name}\", endpoint_instance)\n self.define_singleton_method(method_name.to_s) { endpoint_instance }\n endpoint_instance\n end", "def update!(**args)\n @block_external_network = args[:block_external_network] if args.key?(:block_external_network)\n @commands = args[:commands] if args.key?(:commands)\n @entrypoint = args[:entrypoint] if args.key?(:entrypoint)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @options = args[:options] if args.key?(:options)\n @password = args[:password] if args.key?(:password)\n @username = args[:username] if args.key?(:username)\n @volumes = args[:volumes] if args.key?(:volumes)\n end", "def create\n params[:deployment_id] = Deployment.find_key(params[:deployment]).id if params.has_key? :deployment\n params[:deployment_id] ||= Deployment.system\n params.require(:name)\n params.require(:deployment_id)\n default_net = nil\n Node.transaction do\n @node = Node.create!(params.permit(:name,\n :description,\n :admin,\n :deployment_id,\n :allocated,\n :alive,\n :system,\n :available,\n :bootenv))\n # Keep suport for mac and ip hints in short form around for legacy Sledgehammer purposes\n if params[:ip]\n default_net = Network.lookup_network(params[:ip]) ||\n Network.find_by_name(\"unmanaged\")\n Attrib.set(\"hint-#{default_net.name}-v4addr\",@node,params[:ip]) if default_net\n Attrib.set(\"hint-admin-macs\", @node, [params[:mac]]) if params[:mac]\n end\n end\n default_net.make_node_role(@node) if default_net\n render api_show @node\n end", "def parse(eval_ui = false)\n begin\n defaults = @config['defaults']\n\n ################################################################\n # Cluster\n ################################################################\n\n if @config['cluster'].nil?\n @config['cluster'] = { 'name' => @config['name'] }\n end\n\n @config['cluster']['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n @config['cluster']['provision'].merge!(\n defaults['provision']\n )\n end\n\n ################################################################\n # Hosts\n ################################################################\n\n if @config['hosts']\n sections = ['connection', 'provision', 'configuration']\n\n @config['hosts'].map! do |host|\n sections.each do |section|\n data = CONFIG_DEFAULTS[section] || {}\n\n if @config['defaults']\n defaults = @config['defaults'][section]\n end\n\n h_sec = host[section]\n\n # merge defaults with globals\n # and device specific params\n data.merge!(defaults) unless defaults.nil?\n data.merge!(h_sec) unless h_sec.nil?\n\n host[section] = data\n end\n\n host\n end\n end\n\n ################################################################\n # Datastores & Networks\n ################################################################\n\n ['datastores', 'networks'].each do |r|\n next unless @config[r]\n\n @config[r].map! do |x|\n x['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n x['provision'].merge!(defaults['provision'])\n end\n\n x\n end\n end\n\n # Add provision ID into ARs to evaluate it later\n if @config['networks']\n @config['networks'].each do |vnet|\n next unless vnet['ar']\n\n unless vnet['ar'].is_a? Array\n raise 'ar should be an array'\n end\n\n vnet['ar'].each do |ar|\n ar['provision_id'] = '${provision_id}'\n end\n end\n end\n\n ################################################################\n # User inputs\n ################################################################\n return unless eval_ui\n\n eval_user_inputs\n rescue StandardError => e\n Utils.fail(\"Failed to read configuration: #{e}\")\n end\n end", "def initialize args\n hash_make args, OutPort::ARG_SPECS\n @link = nil\n end", "def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end", "def add_jobs_to_manifest(manifest)\n if any_service_nodes?\n config.each do |cluster|\n server_count = cluster[\"count\"]\n server_flavor = cluster[\"flavor\"]\n job = {\n \"name\" => cluster_name(cluster),\n \"template\" => [job_node_name],\n \"instances\" => server_count,\n \"resource_pool\" => cluster_name(cluster),\n # TODO are these AWS-specific networks?\n \"networks\" => [{\n \"name\" => \"default\",\n \"default\" => [\"dns\", \"gateway\"]\n }],\n \"persistent_disk\" => system_config.common_persistent_disk\n }\n manifest[\"jobs\"] << job\n end\n end\n end", "def initialize(line)\n #(@name, therest) = line.chomp.split(/\\s+/,2)\n args = line.chomp.split(/\\s+/)\n @name = args.shift\n @opts = []\n @tunnels = []\n while !args.empty? do\n a = args.shift\n case a\n when '-L', '-R'\n @tunnels.push a\n @tunnels.push args.shift\n when '-N'\n else\n @opts.push a\n end\n end\n #puts \"new entry [#{@name}] -- #{opts()} -- #{tunnels()} !!\"\n \n @@map[@name] = self \n @@all << @name\n end", "def make_node(type, *args)\n elem = type.new self, *args\n @nodes << elem\n self.core_node ||= elem.id\n elem.expand\n elem\n end", "def init\n if @args.first.nil?\n @ui.error('Please specify the node')\n return ARGUMENT_ERROR_RESULT\n end\n @mdbci_config = Configuration.new(@args.first, @env.labels)\n result = NetworkSettings.from_file(@mdbci_config.network_settings_file)\n if result.error?\n @ui.error(result.error)\n return ARGUMENT_ERROR_RESULT\n end\n\n @network_settings = result.value\n @product = @env.nodeProduct\n @product_version = @env.productVersion\n if @product.nil? || @product_version.nil?\n @ui.error('You must specify the name and version of the product')\n return ARGUMENT_ERROR_RESULT\n end\n\n @machine_configurator = MachineConfigurator.new(@ui)\n\n SUCCESS_RESULT\n end", "def update!(**args)\n @associated_networks = args[:associated_networks] if args.key?(:associated_networks)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def network(type, options=nil); end", "def network(type, options=nil); end", "def initialize(config_file)\n\t\t\n\t\t# Load configuration\n\t\t@config = Config.read(config_file)\n\t\t@config['General']['ConfigFile'] = config_file\n\t\t@config['General']['ConfigPath'] = File.dirname(config_file) + File::SEPARATOR\n\n\t\t# Load Settings\n\t\t@config['General']['Settings'] = @config['General']['ConfigPath'] + @config['General']['Settings']\n\t\tsettings = Config.read(@config['General']['Settings'])\n\t\t\n\t\t# Links the Command ID's with the actual Procs which is defined by .add_command.\n\t\t@procs = {}\n\t\t# Index of procs that must return true for the UI element to be added.\n\t\t@val = {}\n\t\t# List of all UI Hosts (Root elements such as Toolbars, Menus).\n\t\t@hosts = JSON.new\n\t\t# Index of all the UI elements and it's properties.\n\t\t@ui = JSON.new\n\t\t# Index of the hosts and their current Group\n\t\t@groups = {}\n\t\t# Flag indicating if our menu UI has been built\n\t\t@menus_added = false\n\t\t@toolbars_added = false\n\t\t\n\t\t# Index of hosts for the UI elements. Be it Toolbars, Menus, Context Menus.\n\t\t# Build host list\n\t\t# {\n\t\t# HostID => Label,\n\t\t# HostID => Label,\n\t\t# HostID => Label,\n\t\t# }\n\t\t# The Hosts acts as root elements for the various sections.\n\t\telements = []\n\t\t@config['UI'].each { |host_id, host|\n\t\t\t# Add the new host\n\t\t\t@hosts[host_id] = host['Label'] if host.is_a?(JSON)\n\t\t\t# Add it's child UI elements to the parse list\n\t\t\thost.each { |item_id, item|\n\t\t\t\tif item.is_a?(JSON)\n\t\t\t\t\t# Merge Host ID so we know where it should belong.\n\t\t\t\t\titem['Host'] = host_id\n\t\t\t\t\telements << [item_id, item]\n\t\t\t\tend\n\t\t\t}\n\t\t\t#@ui[host_id] = host\n\t\t}\n\n\t\t# Iterate over the nested JSON objects and create a flat JSON list\n\t\t# for easy access to each element. \n\t\t# For each UI element we fetch the Label and Description based on\n\t\t# the command associated.\n\t\t# We also read in the @settings data is availible.\n\t\t# As we traverse and flatten the hash we add a Host key which references\n\t\t# the parent UI element - (toolbar, menu or sub-menu).\n\t\twhile element = elements.shift\n\t\t\tid, item = element\n\t\t\t\n\t\t\t# Add to UI list\n\t\t\t@ui[id] = item\n\t\t\t\n\t\t\t# Merge in data for the item based on it's command.\n\t\t\tcmd = @config['Commands'][ item['Command'] ]\n\t\t\tif cmd.nil?\n\t\t\t\tputs \"Error! UI_Manager.initialize: UI '#{id}' can not link to missing command '#{item['Command']}'.\"\n\t\t\t\tnext\n\t\t\tend\n\t\t\t@ui[id]['Label']\t\t= cmd['Label']\n\t\t\t@ui[id]['Description']\t= cmd['Description']\n\t\t\t@ui[id]['SmallIcon']\t= cmd['SmallIcon'] if cmd.key?('SmallIcon')\n\t\t\t@ui[id]['LargeIcon']\t= cmd['LargeIcon'] if cmd.key?('LargeIcon')\n\t\t\t\n\t\t\t# Merge @settings\n\t\t\tunless settings.nil? || settings[id].nil?\n\t\t\t\t@ui[id]['Visible'] = settings[id] unless @ui[id]['Locked']\n\t\t\tend\n\t\t\t\n\t\t\t# Look for child elements\n\t\t\titem.each { |child_id, child_item|\n\t\t\t\tif child_item.is_a?(JSON)\n\t\t\t\t\titem['sub_menu'] = true\n\t\t\t\t\t# Merge Host ID so we know where it should be inserted.\n\t\t\t\t\tchild_item['Host'] = id\n\t\t\t\t\telements << [child_id, child_item]\n\t\t\t\t\t#item.delete(child_id)\n\t\t\t\tend\n\t\t\t}\n\t\t\t#item.reject! { |key, value| value.is_a?(JSON) }\n\t\tend\n\t\t# Cleanup a bit - get rid of the child JSON elements.\n\t\t#@ui.reject! { |key, value| value.is_a?(JSON) }\n\t\t#@ui.each {|k,v| v.reject! { |key, value| value.is_a?(JSON) } }\n\t\t\n\t\t# Prepare webdialog object\n\t\tsuper @config['General']['Title'], false, 'pm_uim', 500, 325, 100, 100, true\n\t\tself.navigation_buttons_enabled = false if self.respond_to?(:navigation_buttons_enabled)\n\t\tself.min_width = 330\t if self.respond_to?(:min_width)\n\t\tself.min_height = 200\t if self.respond_to?(:min_height)\n\t\t# Callbacks\n\t\tself.add_action_callback('ready') { |dialog, params|\n\t\t\tputs '>> Dialog Ready'\n\t\t\t\n\t\t\t# Previously we sent each of these sections one by one, but due to Mac's async\n\t\t\t# nature that didn't work as the dialog had not created the hosts before it tried\n\t\t\t# to add the UI elements. So now we compile one big JSON and let JS sort it out.\n\t\t\tdata = JSON.new\n\t\t\t# Set General Info\n\t\t\tdata['Info'] = @config['General']\n\t\t\t# Add UI Hosts\n\t\t\tdata['Hosts'] = @hosts\n\t\t\t# UI Elements\n\t\t\tdata['UI'] = JSON.new\n\t\t\t@ui.each { |key, value|\n\t\t\t\tnext unless value.is_a?(JSON)\n\t\t\t\t# Push data to the webdialog\n\t\t\t\tdata['UI'][key] = value\n\t\t\t}\n\t\t\t#puts data['UI'].to_s(true) # DEBUG\n\t\t\tdialog.execute_script(\"process_data(#{data});\")\n\t\t}\n\t\tself.add_action_callback('save') { |dialog, params|\n\t\t\tputs '>> Save'\n\t\t\t# Build Settings JSON\n\t\t\tsettings = JSON.new\n\t\t\t@ui.each { |id, value|\n\t\t\t\tsetting = dialog.get_element_value(\"ui_#{id}_data\")\n\t\t\t\tsettings[id] = setting\n\t\t\t\t@ui[id]['Visible'] = Config::string_to_data(setting) unless @ui[id]['Locked']\n\t\t\t}\n\t\t\t# Write file\n\t\t\tConfig.write(@config['General']['Settings'], settings)\n\t\t\tdialog.close\n\t\t}\n\t\tself.add_action_callback('cancel') { |dialog, params|\n\t\t\tputs '>> Cancel'\n\t\t\tdialog.close\n\t\t}\n\t\t\n\tend", "def network_config\n @network_config ||= begin\n raw_config = network_params[\"network_configuration\"] || {\"interfaces\" => []}\n config = NetworkConfiguration.new(raw_config)\n config.add_nics!(device_config, :add_partitions => true) if dell_server?\n config\n end\n end", "def createInitialCommandTag\n\n\t# specify the g-parameter\n\tprint(\"Enter the g parameter: \")\n\t$g_param = $stdin.readline\n\twhile ($g_param !~ /^[0-9]+$/)\n\t\tprint(\"Enter a valid g parameter: \")\n\t\t$g_param = $stdin.readline\n\tend\n\n\t# specify the pmOrder\n\tprint(\"\\nEnter the pmOrder: \")\n\t$pm_order = $stdin.readline\n\twhile ($pm_order !~ /^[123]{1}$/)\n\t\tprint(\"Enter a valid pmOrder (1, 2, or 3): \")\n\t\t$pm_order = $stdin.readline\n\tend\n\n\t# specify the remote width\n\tprint(\"\\nEnter the remote spatial width: \")\n\t$remote_width = $stdin.readline\n\twhile ($remote_width !~ /^[0-9]+$/)\n\t\tprint(\"Enter a valid remote_width: \")\n\t\t$remote_width = $stdin.readline\n\tend\n\n\t# specify the remote height\n\tprint(\"\\nEnter the remote spatial height: \")\n\t$remote_height = $stdin.readline\n\twhile ($remote_height !~ /^[0-9]+$/)\n\t\tprint(\"Enter a valid remote_height: \")\n\t\t$remote_height = $stdin.readline\n\tend\n\n\t# specify the local width\n\tprint(\"\\nEnter the local spatial width: \")\n\t$local_width = $stdin.readline\n\twhile ($local_width !~ /^[0-9]+$/)\n\t\tprint(\"Enter a valid local_width: \")\n\t\t$local_width = $stdin.readline\n\tend\n\n\t# specify the local height\n\tprint(\"\\nEnter the local spatial height: \")\n\t$local_height = $stdin.readline\n\twhile ($local_height !~ /^[0-9]+$/)\n\t\tprint(\"Enter a valid local_height: \")\n\t\t$local_height = $stdin.readline\n\tend\n\n\t# chop off new line chars\n\t$g_param.chomp!\n\t$pm_order.chomp!\n\t$remote_width.chomp!\n\t$remote_height.chomp!\n\t$local_width.chomp!\n\t$local_height.chomp!\n\n\treturn \"<commands xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xsi:noNamespaceSchemaLocation=\\\"part3in.xsd\\\"\" +\n\t\t\t\" remoteSpatialWidth=\\\"\" + $remote_width + \"\\\" remoteSpatialHeight=\\\"\" + $remote_height +\n\t\t\t\"\\\" localSpatialWidth=\\\"\" + $local_width + \"\\\" localSpatialHeight=\\\"\" + $local_height +\n\t\t\t\"\\\" pmOrder=\\\"\" + $pm_order + \"\\\" g=\\\"\" + $g_param + \"\\\">\"\n\nend", "def build_manifest_interface(tests, intf_count: 0)\n intf_array = tests[:intf_array]\n manifest = ''\n\n 0.upto(intf_count - 1) do |i|\n case tests[:resource_name]\n when :cisco_interface\n manifest += \"\n cisco_interface { '#{intf_array[i]}':\n ensure => 'present',\n }\n \"\n when :cisco_interface_channel_group\n manifest += \"\n cisco_interface_channel_group { '#{intf_array[i]}':\n shutdown => false,\n }\n \"\n when :cisco_interface_evpn_multisite\n manifest += \"\n cisco_interface_evpn_multisite { '#{intf_array[i]}':\n ensure => present,\n }\n \"\n when :cisco_interface_ospf\n manifest += \"\n cisco_interface_ospf { '#{intf_array[i]} threshold_test':\n area => '0.0.0.0',\n }\n \"\n end\n end\n manifest\nend", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end", "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend", "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend", "def update!(**args)\n @application_endpoint = args[:application_endpoint] if args.key?(:application_endpoint)\n @application_name = args[:application_name] if args.key?(:application_name)\n @gateway = args[:gateway] if args.key?(:gateway)\n @name = args[:name] if args.key?(:name)\n @project = args[:project] if args.key?(:project)\n @tunnels_per_gateway = args[:tunnels_per_gateway] if args.key?(:tunnels_per_gateway)\n @user_port = args[:user_port] if args.key?(:user_port)\n end", "def initialize(argv=[])\n super()\n #@text = Text.new(STDOUT, STDERR, STDIN, config)\n @text ||= Megam::Text.new(STDOUT, STDERR, STDIN, config)\n command_name_words = self.class.snake_case_name.split('_')\n\n # Mixlib::CLI ignores the embedded name_args\n\n @name_args = parse_options(argv)\n\n @name_args.delete(command_name_words.join('-'))\n\n @name_args.reject! { |name_arg| command_name_words.delete(name_arg) }\n\n # meg node run_list add requires that we have extra logic to handle\n # the case that command name words could be joined by an underscore :/\n command_name_words = command_name_words.join('_')\n @name_args.reject! { |name_arg| command_name_words == name_arg }\n if config[:help]\n msg opt_parser\n exit 1\n end\n\n # copy Mixlib::CLI over so that it cab be configured in meg.rb\n # config file\n Meggy::Config[:verbosity] = config[:verbosity]\n end", "def initialize(name, json = nil)\n @name = name\n if !json.nil?\n @inbound = (json[\"inbound\"] || []).map { |entry| AclEntryConfig.new(entry) }\n @outbound = (json[\"outbound\"] || []).map { |entry| AclEntryConfig.new(entry) }\n @tags = json[\"tags\"] || {}\n end\n end", "def push_config\n command = ['VBoxManage', 'modifyvm', uid]\n command.concat board.to_params\n nics.each_with_index do |nic, index|\n if nic.nil?\n command.push \"--nic#{index + 1}\", 'none'\n else\n command.concat nic.to_params(index + 1)\n end\n end\n VirtualBox.run_command! command\n \n io_buses.each { |bus| bus.add_to self }\n \n self\n end", "def command_for(args)\n [config.to_env].tap do |cmd|\n args = args.clone\n cmd.append('node', '--inspect-brk') if args.delete('--inspect')\n cmd.append('node', '--trace-deprecation') if args.delete('--trace_deprecation')\n cmd.append(vite_executable)\n cmd.append(*args)\n cmd.append('--mode', config.mode) unless args.include?('--mode') || args.include?('-m')\n end\n end", "def initialize(pool,element,client)\n super(nil)\n\n @client = client\n @pool_name = pool.to_sym\n @element_name = element.to_sym\n end", "def action_create\n opts = generate_command_opts\n if opts.any?\n if current_resource.exists?\n converge_by(\"edit l2interface #{new_resource.name} will be modified\") do\n command = \"netdev l2interface edit #{new_resource.l2_interface_name} \"\n command << opts.join(' ')\n execute_command(command)\n end\n else\n converge_by(\"L2interface #{new_resource.name} will be created\") do\n command = \"netdev l2interface create #{new_resource.l2_interface_name} \"\n command << opts.join(' ')\n execute_command(command)\n end\n end\n end\n end", "def _test_launch_process_with_json_launchitem\n\n li = LI_WITH_DEFINITION.to_h.dup\n\n #puts \"===\"\n #p li.to_json\n #puts \"===\"\n\n li['attributes']['food'] = 'tamales'\n\n post(\n '/processes.json',\n li.to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.350\n\n puts @response.body\n\n assert_equal 'application/json', @response.headers['Content-type']\n\n fei = json_parse(@response.body)\n assert_equal 'ruote_rest', fei['engine_id']\n\n assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size\n wi = OpenWFE::Extras::ArWorkitem.find(:first)\n\n assert_equal 'tamales', wi.as_owfe_workitem.fields['food']\n end", "def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end", "def network_objects(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Network Objects\" page.\n begin\n @ff.link(:text, 'Network Objects').click\n self.msg(rule_name, :info, 'Network Objects', 'Reached page \\'Network Objects\\'.')\n rescue\n self.msg(rule_name, :error, 'Network Objects', 'Did not reach \\'Network Objects\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') && info.has_key?('Description') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'Network Objects','Some key NOT found.')\n return\n end\n \n # Click \"Add\" button. \n @ff.link(:text,'Add').click\n self.msg(rule_name,:info,'Add a network object','CLICKED')\n \n # Fill in the \"Discription\".\n @ff.text_field(:name,'desc').set(info['Description'])\n self.msg(rule_name,:info,'Description',info['Description'])\n \n # Add \"Items\"\n self.msg(rule_name,:info,'Begin adding network object items','done!')\n \n if info.has_key?('IP Address') then\n \n # Add ip address\n network_objects_add_ip(rule_name,info['IP Address'])\n self.msg(rule_name,:info,'Add ip address',info['IP Address'])\n \n end\n \n if ( info.has_key?('Subnet IP Address') &&\n info.has_key?('Subnet Mask') )then\n \n strSubnet = info['Subnet IP Address'] + \"/\" + info['Subnet Mask']\n \n # Add ip subnet\n network_objects_add_2_ip(rule_name,strSubnet,1)\n self.msg(rule_name,:info,'Add ip subnet',strSubnet)\n\n \n end\n \n if ( info.has_key?('From IP Address') &&\n info.has_key?('To IP Address') ) then\n \n strIPRange = info['From IP Address'] + \"/\" + info['To IP Address']\n \n # Add ip range\n self.msg(rule_name,:info,'Add ip range',strIPRange)\n network_objects_add_2_ip(rule_name,strIPRange,2)\n\n end\n\n if info.has_key?('MAC Address') && info.has_key?('MAC Mask') then\n \n strMAC = info['MAC Address'] + \"/\" + info['MAC Mask']\n \n # Add mac\n self.msg(rule_name,:info,'Add mac',strMAC)\n network_objects_add_mac(rule_name,strMAC)\n \n end\n \n if info.has_key?('Host Name') then \n \n # Add host\n self.msg(rule_name,:info,'Add mac',info['Host Name'])\n network_objects_add_host(rule_name,info['Host Name'])\n \n end\n \n if info.has_key?('Vendor Class ID')\n \n strDHCP = \"Vendor:\" + info['Vendor Class ID'].to_s\n \n # Add dhcp option\n self.msg(rule_name,:info,'Add dhcp option',strDHCP)\n network_objects_add_dhcp_option(rule_name,strDHCP) \n \n end\n \n if info.has_key?('Client ID')\n \n strDHCP = \"Client:\" + info['Client ID'].to_s\n \n # Add dhcp option\n self.msg(rule_name,:info,'Add dhcp option',strDHCP)\n network_objects_add_dhcp_option(rule_name,strDHCP) \n \n end \n \n if info.has_key?('User Class ID')\n \n strDHCP = \"User:\" + info['User Class ID'].to_s\n \n # Add dhcp option\n self.msg(rule_name,:info,'Add dhcp option',strDHCP)\n network_objects_add_dhcp_option(rule_name,strDHCP) \n \n end \n \n # Apply for the network ojects.\n if @ff.text.include?'Apply'\n @ff.link(:text,'Apply').click\n end\n \n # Jump out \"error\" message?\n if @ff.text.include?'Input Errors'\n # Wrong here\n self.msg(rule_name,:error,'Network Objects','Error occurred on web page.')\n return\n end\n \n # Close the page.\n @ff.link(:text,'Close').click\n self.msg(rule_name,:info,'Network Objects','SUCCESS')\n # Now, will go to main \"Advanced\" page.\n \n end", "def initialize(name, json = nil)\n @name = name\n @excludes = []\n if !json.nil?\n @routes = (json[\"routes\"] || []).map { |route| RouteConfig.new(route) }\n @propagate_vgws = json[\"propagate-vgws\"] || []\n @tags = json[\"tags\"]\n @excludes = json[\"exclude-cidr-blocks\"] || []\n end\n end", "def update!(**args)\n @element = args[:element] if args.key?(:element)\n end", "def create\n ethers, new_ethers = process_ethers(params[:asset])\n @asset = WirelessDevice.new(params[:asset])\n asset_create('wireless_item', wireless_url, ethers, new_ethers)\n end", "def create\n name, type = resource[:name].split('/')\n rdata = resource[:rdata]\n ttl = resource[:ttl]\n case type\n when 'MX'\n Array(rdata).each_with_index do |exchange, index|\n preference = Array(resource[:preference])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} MX #{preference} #{exchange}\n send\")\n end\n when 'SRV'\n Array(rdata).each_with_index do |target, index|\n port = Array(resource[:port])[index]\n weight = Array(resource[:weight])[index]\n priority = Array(resource[:priority])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n nsupdate(\"server #{server}\n update add #{name} #{ttl} #{type} #{Array(rdata).first}\n send\")\n end\n end", "def create(config_node_name)\n @call_params[:config_node_name] = config_node_name\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def copy!(deployment)\n network = Network.new(self.attributes)\n network.deployment = deployment\n network.master = deployment.master\n # The only validity concern we have is the uniqueness of the name\n # in the new deployment.\n i = 1\n name = network.name\n while i < 1000 && !network.valid? do\n network.name = \"#{name}-#{i}\"\n i += 1\n end\n\n if (i == 1000)\n raise \"Could not create network. Too many networks named '#{name}'.\"\n end\n\n if network.save(:safe => true)\n routes = {}\n services = []\n vehicle_journeys = []\n begin\n for s in self.services\n if routes[s.route.code] == nil\n routes[s.route.code] = s.route.copy!(network)\n end\n route = routes[s.route.code]\n #puts \"Copy Service #{s.id} to route #{route.id} and network #{network.id}\"\n service = s.copy!(route, network)\n #puts \"Cloned to Service #{service.id} \"\n services << service\n for vj in s.vehicle_journeys\n vehicle_journey = vj.copy!(service, network)\n vehicle_journeys << vehicle_journey\n end\n end\n network.reload\n network\n rescue Exception => boom\n routes.values.each {|x| x.delete() }\n services.each {|x| x.delete() }\n vehicle_journeys.each {|x| x.delete() }\n network.delete\n raise \"Cannot create network #{boom}\"\n end\n else\n raise \"Cannot create network #{network.errors.message}\"\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hyperthreading_enabled = args[:hyperthreading_enabled] if args.key?(:hyperthreading_enabled)\n @interactive_serial_console_enabled = args[:interactive_serial_console_enabled] if args.key?(:interactive_serial_console_enabled)\n @labels = args[:labels] if args.key?(:labels)\n @luns = args[:luns] if args.key?(:luns)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @name = args[:name] if args.key?(:name)\n @networks = args[:networks] if args.key?(:networks)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def build_network_object\n OOLog.info(\"network_address: #{@address}\")\n\n ns_list = []\n @dns_list.each do |dns_list|\n OOLog.info('dns address[' + @dns_list.index(dns_list).to_s + ']: ' + dns_list.strip)\n ns_list.push(dns_list.strip)\n end\n\n subnet = AzureNetwork::Subnet.new(@creds)\n subnet.sub_address = @sub_address\n subnet.name = @name\n sub_nets = subnet.build_subnet_object\n\n virtual_network = Fog::Network::AzureRM::VirtualNetwork.new\n virtual_network.location = @location\n virtual_network.address_prefixes = [@address]\n virtual_network.dns_servers = ns_list unless ns_list.nil?\n virtual_network.subnets = sub_nets\n virtual_network\n end", "def create(name)\n configure([\"interface #{name}\", 'no switchport'])\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @interface = args[:interface] if args.key?(:interface)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @service_account = args[:service_account] if args.key?(:service_account)\n @uri = args[:uri] if args.key?(:uri)\n end", "def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end", "def factory(element_xml)\n OpenNebula::PoolElement.new(element_xml,client)\n end", "def build_command( item )\n\t\t\t\tBuildCommand.new @interface, item\n\t\t\tend", "def create(destination, nexthop, opts = {})\n cmd = \"ip route #{destination} #{nexthop}\"\n cmd << \" #{opts[:router_ip]}\" if opts[:router_ip]\n cmd << \" #{opts[:distance]}\" if opts[:distance]\n cmd << \" tag #{opts[:tag]}\" if opts[:tag]\n cmd << \" name #{opts[:name]}\" if opts[:name]\n configure cmd\n end" ]
[ "0.57113636", "0.5529602", "0.53176737", "0.5289449", "0.52048165", "0.5111053", "0.50640666", "0.5063005", "0.50531757", "0.5027478", "0.49777773", "0.4975934", "0.4961408", "0.49605873", "0.49578798", "0.49498597", "0.49348983", "0.49090227", "0.48975217", "0.488974", "0.4851714", "0.48501584", "0.48464766", "0.4846016", "0.4841933", "0.48154852", "0.4799393", "0.47966456", "0.478579", "0.4781537", "0.47538048", "0.47514826", "0.4741087", "0.47284546", "0.47254255", "0.47163525", "0.4708127", "0.4697981", "0.46958756", "0.46869823", "0.46869823", "0.4686672", "0.46609014", "0.46552366", "0.46301728", "0.46201012", "0.4618562", "0.46061352", "0.46056628", "0.45928252", "0.458955", "0.45813718", "0.45705158", "0.4567437", "0.45620883", "0.45616612", "0.4560429", "0.45597818", "0.45569393", "0.45542744", "0.45527712", "0.45464107", "0.45357567", "0.45318907", "0.45315135", "0.45289335", "0.45289245", "0.4521403", "0.4521403", "0.45202026", "0.45195848", "0.45191085", "0.4512079", "0.4510499", "0.45086694", "0.45086694", "0.45072344", "0.44870597", "0.4486269", "0.44762754", "0.44734007", "0.44704673", "0.44674194", "0.446654", "0.44653377", "0.44636467", "0.44603786", "0.44572315", "0.44528544", "0.44526455", "0.44492552", "0.44455764", "0.44447947", "0.4441977", "0.44419628", "0.4439192", "0.44350067", "0.44317183", "0.44314966", "0.44304228" ]
0.63507545
0
deletes an existing network element argv = commandline arguments, requires a json configuration (j) and the element (e) to modify, such as 'interfaces', 'hosts' or 'routes' or 'interfaces/a1' or 'hosts/dell9'
def cmd_delete argv setup argv e = @hash['element'] response = @api.delete(e) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @sub_network = args[:sub_network] if args.key?(:sub_network)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @network_interfaces = args[:network_interfaces] if args.key?(:network_interfaces)\n end", "def edged(cmd)\n $lock.synchronize{ \n $network.remove_edge($hostname,cmd[0])\n\n if $rt.has_key? cmd[0]\n $rt.delete cmd[0] \n end\n\n }\nend", "def update!(**args)\n @interface = args[:interface] if args.key?(:interface)\n @name = args[:name] if args.key?(:name)\n @port = args[:port] if args.key?(:port)\n @project = args[:project] if args.key?(:project)\n @self_link = args[:self_link] if args.key?(:self_link)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @addon_node = args[:addon_node] if args.key?(:addon_node)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @bootstrap_cluster_membership = args[:bootstrap_cluster_membership] if args.key?(:bootstrap_cluster_membership)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @image_type = args[:image_type] if args.key?(:image_type)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @platform_config = args[:platform_config] if args.key?(:platform_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n end", "def edit(entry)\n return \"Node hostname cannot be empty!\" if entry['hostname'].empty?\n load\n doc = REXML::Element.new(\"NODE\")\n doc.add_attributes(entry)\n if entry['oldname'].empty?\n # adding a new node\n @@nds.each{|n|\n return \"'#{n['hostname']}' already exists!\" if n['hostname'] == entry['hostname'] && n['testbed'] == entry['testbed']\n }\n result = OMF::Services.inventory.addNode(doc.to_s)\n return AM_ERROR if !XPath.match(result, \"ADD_NODE/OK\" )\n else\n # update an existing entry\n @@nds.collect! {|n|\n if n['hostname'] == entry['oldname']\n n = entry\n n.delete('oldname')\n end\n n\n }\n end\n saveDnsmasqConfig\n return \"OK\"\n end", "def update!(**args)\n @authorized_network = args[:authorized_network] if args.key?(:authorized_network)\n @create_time = args[:create_time] if args.key?(:create_time)\n @discovery_endpoint = args[:discovery_endpoint] if args.key?(:discovery_endpoint)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_messages = args[:instance_messages] if args.key?(:instance_messages)\n @labels = args[:labels] if args.key?(:labels)\n @memcache_full_version = args[:memcache_full_version] if args.key?(:memcache_full_version)\n @memcache_nodes = args[:memcache_nodes] if args.key?(:memcache_nodes)\n @memcache_version = args[:memcache_version] if args.key?(:memcache_version)\n @name = args[:name] if args.key?(:name)\n @node_config = args[:node_config] if args.key?(:node_config)\n @node_count = args[:node_count] if args.key?(:node_count)\n @parameters = args[:parameters] if args.key?(:parameters)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @zones = args[:zones] if args.key?(:zones)\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete_element(element); end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def edged(cmd)\n $ips.delete(cmd[0])\n $dist[cmd[0]] = \"INF\"\n $neighbors.delete(cmd[0])\n $next[cmd[0]] = \"NA\"\n client = $clients[cmd[0]]\n client.close()\n $clients.delete(cmd[0])\nend", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @interface = args[:interface] if args.key?(:interface)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_tags = args[:network_tags] if args.key?(:network_tags)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @service_account = args[:service_account] if args.key?(:service_account)\n @uri = args[:uri] if args.key?(:uri)\n end", "def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end", "def update!(**args)\n @element = args[:element] if args.key?(:element)\n end", "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @ip = args[:ip] if args.key?(:ip)\n end", "def update!(**args)\n @block_external_network = args[:block_external_network] if args.key?(:block_external_network)\n @commands = args[:commands] if args.key?(:commands)\n @entrypoint = args[:entrypoint] if args.key?(:entrypoint)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @options = args[:options] if args.key?(:options)\n @password = args[:password] if args.key?(:password)\n @username = args[:username] if args.key?(:username)\n @volumes = args[:volumes] if args.key?(:volumes)\n end", "def update!(**args)\n @application_endpoint = args[:application_endpoint] if args.key?(:application_endpoint)\n @application_name = args[:application_name] if args.key?(:application_name)\n @gateway = args[:gateway] if args.key?(:gateway)\n @name = args[:name] if args.key?(:name)\n @project = args[:project] if args.key?(:project)\n @tunnels_per_gateway = args[:tunnels_per_gateway] if args.key?(:tunnels_per_gateway)\n @user_port = args[:user_port] if args.key?(:user_port)\n end", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @authorization = args[:authorization] if args.key?(:authorization)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dataplane_v2 = args[:dataplane_v2] if args.key?(:dataplane_v2)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @disable_bundled_ingress = args[:disable_bundled_ingress] if args.key?(:disable_bundled_ingress)\n @enable_control_plane_v2 = args[:enable_control_plane_v2] if args.key?(:enable_control_plane_v2)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n @vm_tracking_enabled = args[:vm_tracking_enabled] if args.key?(:vm_tracking_enabled)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @multi_cluster_routing_use_any = args[:multi_cluster_routing_use_any] if args.key?(:multi_cluster_routing_use_any)\n @name = args[:name] if args.key?(:name)\n @single_cluster_routing = args[:single_cluster_routing] if args.key?(:single_cluster_routing)\n end", "def update!(**args)\n @cidr = args[:cidr] if args.key?(:cidr)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @mac_address = args[:mac_address] if args.key?(:mac_address)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @vlan_id = args[:vlan_id] if args.key?(:vlan_id)\n @vrf = args[:vrf] if args.key?(:vrf)\n end", "def delete_elem\n elem = eval(params[:type]).find(params[:elem])\n eval(params[:type]).delete(params[:elem])\n elems = nil\n case params[:type]\n when \"ProcessModel\"\n elems = elem.activities\n for e in elems\n e.model_id =-1\n e.update_attributes(e.attributes)\n end\n when \"Activity\"\n elems = elem.actions\n for e in elems\n e.activity_id =-1\n e.update_attributes(e.attributes)\n end\n when \"Action\"\n elems = elem.pf_tasks\n for e in elems\n e.action_id =-1\n e.update_attributes(e.attributes)\n end\n end\n redirect_to :action => 'index', :tab =>params[:type]\n rescue\n flash[:error] = l(:error_can_not_delete_custom_field)\n redirect_to :action => 'index',:tab =>params[:type]\n end", "def update!(**args)\n @admin_cluster_membership = args[:admin_cluster_membership] if args.key?(:admin_cluster_membership)\n @admin_cluster_name = args[:admin_cluster_name] if args.key?(:admin_cluster_name)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def update!(**args)\n @gateway = args[:gateway] if args.key?(:gateway)\n @ips = args[:ips] if args.key?(:ips)\n @netmask = args[:netmask] if args.key?(:netmask)\n end", "def cmd_clear_interface argv\n setup argv\n interface = @hash['interfaces']\n response = @api.clear_interface(interface)\n msg response\n return response\n end", "def update!(**args)\n @enable_internet_access = args[:enable_internet_access] if args.key?(:enable_internet_access)\n @network = args[:network] if args.key?(:network)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def delete(element); end", "def update!(**args)\n @advanced_networking = args[:advanced_networking] if args.key?(:advanced_networking)\n @island_mode_cidr = args[:island_mode_cidr] if args.key?(:island_mode_cidr)\n @multiple_network_interfaces_config = args[:multiple_network_interfaces_config] if args.key?(:multiple_network_interfaces_config)\n @sr_iov_config = args[:sr_iov_config] if args.key?(:sr_iov_config)\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def update(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n entry.hostname = options[:hostname]\n entry.aliases = options[:aliases]\n entry.comment = options[:comment]\n entry.priority = options[:priority]\n\n remove_existing_hostnames(entry) if options[:unique]\n end\n end", "def remove_entry(params)\n index = params[:index].to_i\n @puzzle[index] = \".\"\n return JSON.generate({removed: true})\n end", "def delete_vapp_network(vAppId, network)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n netconfig_response, headers = send_request(params)\n\n picked_network = netconfig_response.css(\"NetworkConfig\").select do |net|\n net.attribute('networkName').text == network[:name]\n end.first\n\n raise WrongItemIDError, \"Network #{network[:name]} not found on this vApp.\" unless picked_network\n\n picked_network.remove\n\n params = {\n 'method' => :put,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n put_response, headers = send_request(params, netconfig_response.to_xml, \"application/vnd.vmware.vcloud.networkConfigSection+xml\")\n\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def update!(**args)\n @asn = args[:asn] if args.key?(:asn)\n @control_plane_nodes = args[:control_plane_nodes] if args.key?(:control_plane_nodes)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n end", "def update!(**args)\n @associated_networks = args[:associated_networks] if args.key?(:associated_networks)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def delete_node_data(entry)\n ['client',\n 'node'].each do |object|\n Mixlib::ShellOut.new('sudo', 'knife',\n object, 'delete',\n entry[:fqdn], '--yes').run_command\n end\n\n # Running knife with sudo can set the permissions to root:root.\n # We need to correct the permissions before running ssh-keygen.\n Mixlib::ShellOut.new('sudo', 'chown',\n `whoami`.chomp,\n \"#{ENV['HOME']}/.ssh/known_hosts\").run_command\n\n [entry[:fqdn],\n entry[:ip_address],\n entry[:hostname]].each do |ssh_name|\n del = Mixlib::ShellOut.new('ssh-keygen', '-R', ssh_name)\n del.run_command\n del.invalid! \"Failed to delete SSH key for #{ssh_name}: #{del.stderr}\" \\\n unless del.status.success?\n end\n\n puts \"Deleted SSH fingerprints and Chef objects for #{entry[:hostname]}\"\nend", "def remove(params)\n params[:real_at] ||= AtStructure.new(params[:at])\n\n # Le text-item de référence\n unless params.key?(:titem_ref)\n params.merge!(titem_ref: params[:real_at].first_titem)\n end\n\n # Pour connaitre l'opération, pour faire la distinction, plus tard, entre\n # une pure suppression et un remplacement. Elle permet aussi d'enregistrer\n # l'opération dans l'historique operations.txt\n unless params.key?(:operation)\n params.merge!(operation: 'remove')\n end\n\n # Un débug (régler les valeurs en haut de ce module)\n if debug_replace? || debug_remove?\n log(\"-> remove(params=#{params.inspect})\")\n end\n\n if params[:operation] == 'remove'\n msg = \"Suppression de “#{params[:real_at].first_titem.content}” (index absolu #{params[:real_at].abs(:at)}, index relatif #{params[:real_at].at}).\"\n log(msg, true)\n end\n\n\n # Si c'est une vraie suppression (i.e. pas un remplacement), il faut\n # supprimer aussi l'espace après. S'il n'y a pas d'espace après, il faut\n # supprimer l'espace avant s'il existe.\n # La formule est différente en fonction du fait qu'on ait un rang ou\n # un index seul et une liste discontinue d'index.\n # ATTENTION AUSSI : l'espace supplémentaire à supprimer est peut-être\n # dans la liste des index à supprimer et dans ce cas il faut étudier\n # le mot suivant et le text-item non-mot suivant.\n #\n # Le but de cette partie est donc de produire la liste exacte des text-items\n # qui doivent être finalement supprimé.\n # Elle n'est valable que pour une suppression pure car pour un replacement,\n # il faut garder tous les éléments autour du mot ou des mots remplacés.\n at = params[:real_at]\n if params[:operation] == 'remove'\n if at.list?\n # Pour une liste, on doit faire un traitement particulier : il faut\n # vérifier les text-item après chaque \"trou\"\n liste_finale = at.list.dup\n at.titems.each_with_index do |titem, idx_in_list|\n # Les non-mots doivent être passés\n next if titem.non_mot?\n # On passe ce mot si le mot suivant appartient aussi à la liste\n next if at.list[idx_in_list + 1] == idx + 1\n # On passe ce mot si le mot précédent appartient aussi à la liste\n next if at.list[idx_in_list - 1] == idx - 1\n # On doit tester ce mot qui est \"seul\" dans la liste, c'est-à-dire\n # que la liste ne contient ni son mot juste après ni son mot\n # juste avant.\n next_index = idx + 1\n next_titem = extrait_titems[next_index]\n prev_index = idx - 1\n prev_index = nil if prev_index < 0\n prev_titem = prev_index.nil? ? nil : extrait_titems[prev_index]\n if next_titem && next_titem.space?\n # On l'ajoute à la liste des items à supprimer\n liste_finale.insert(idx_in_list + 1, next_index)\n elsif prev_titem && prev_titem.space?\n liste_finale.insert(idx_in_list, prev_index)\n end\n end #/ boucle sur la liste\n\n # Si la liste finale a changé, il faut corrigé le at\n if liste_finale != at.list\n params[:real_at] = at = AtStructure.new(liste_finale.join(VG))\n end\n\n else\n # Pour un rang et un index seul, le traitement est plus simple, il\n # suffit de voir l'index après le dernier.\n # Noter qu'on ne supprime pas les espaces ici, on modifie le rang\n # ou on transforme l'index en range, ceci afin de ne pas provoquer\n # de doubles suppressions\n next_index = at.last + 1\n prev_index = at.first - 1\n prev_index = nil if prev_index < 0\n if extrait_titems[next_index].space?\n params[:real_at] = at = AtStructure.new(\"#{at.first}-#{next_index}\")\n elsif prev_index && extrait_titems[prev_index].space?\n params[:real_at] = at = AtStructure.new(\"#{prev_index}-#{at.last}\")\n end\n end\n end\n\n # On mémorise l'opération pour pouvoir l'annuler\n if params.key?(:cancellor) # pas quand c'est une annulation\n at.titems.each do |titem|\n params[:cancellor] << {operation: :insert, index: titem.index, content: params[:content]}\n end\n end\n\n # SUPPRESSION\n # ------------\n # On procède vraiment à la suppression des mots dans le texte\n # lui-même, ainsi que dans la base de données avec une formule différente en\n # fonction du fait que c'est un rang ou une liste (note : un index unique\n # a été mis dans une liste pour simplifier les opérations)\n if at.range?\n extrait_titems.slice!(at.from, at.nombre)\n itexte.db.delete_text_items(from:at.abs(:from), for:at.nombre)\n else\n at.list.each { |idx| extrait_titems.slice!(idx) }\n itexte.db.delete_text_items(at.abs(:list))\n end\n\n # Si c'est vraiment une opération de destruction, on l'enregistre\n # en tant qu'opération et on actualise l'affichage en indiquant que\n # l'extrait a changé\n if params[:operation] == 'remove'\n itexte.operator.add_text_operation(params)\n update\n end\n\nend", "def update!(**args)\n @args = args[:args] if args.key?(:args)\n @command = args[:command] if args.key?(:command)\n @env = args[:env] if args.key?(:env)\n @health_route = args[:health_route] if args.key?(:health_route)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @ports = args[:ports] if args.key?(:ports)\n @predict_route = args[:predict_route] if args.key?(:predict_route)\n end", "def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @description = args[:description] unless args[:description].nil?\n @initial_node_count = args[:initial_node_count] unless args[:initial_node_count].nil?\n @node_config = args[:node_config] unless args[:node_config].nil?\n @master_auth = args[:master_auth] unless args[:master_auth].nil?\n @logging_service = args[:logging_service] unless args[:logging_service].nil?\n @monitoring_service = args[:monitoring_service] unless args[:monitoring_service].nil?\n @network = args[:network] unless args[:network].nil?\n @cluster_ipv4_cidr = args[:cluster_ipv4_cidr] unless args[:cluster_ipv4_cidr].nil?\n @self_link = args[:self_link] unless args[:self_link].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @endpoint = args[:endpoint] unless args[:endpoint].nil?\n @initial_cluster_version = args[:initial_cluster_version] unless args[:initial_cluster_version].nil?\n @current_master_version = args[:current_master_version] unless args[:current_master_version].nil?\n @current_node_version = args[:current_node_version] unless args[:current_node_version].nil?\n @create_time = args[:create_time] unless args[:create_time].nil?\n @status = args[:status] unless args[:status].nil?\n @status_message = args[:status_message] unless args[:status_message].nil?\n @node_ipv4_cidr_size = args[:node_ipv4_cidr_size] unless args[:node_ipv4_cidr_size].nil?\n @services_ipv4_cidr = args[:services_ipv4_cidr] unless args[:services_ipv4_cidr].nil?\n @instance_group_urls = args[:instance_group_urls] unless args[:instance_group_urls].nil?\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def update!(**args)\n @cluster_network_uri = args[:cluster_network_uri] if args.key?(:cluster_network_uri)\n @cluster_uri = args[:cluster_uri] if args.key?(:cluster_uri)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @remote_gateway = args[:remote_gateway] if args.key?(:remote_gateway)\n @remote_gateway_ip = args[:remote_gateway_ip] if args.key?(:remote_gateway_ip)\n @routing_type = args[:routing_type] if args.key?(:routing_type)\n @source_gateway = args[:source_gateway] if args.key?(:source_gateway)\n @source_gateway_ip = args[:source_gateway_ip] if args.key?(:source_gateway_ip)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n end", "def remove_tenant(building)\n view_apartment_detail(building)\n puts \"Which tenant would you like to remove?\"\n tenant_to_remove = gets.chomp\n ##Step 1: Create an array with the hash of the exact apartment\n apartment_hash_to_modify = building.building_apartment_array.select {|hash| hash[:renter].include? tenant_to_remove}\n ##Step 2: Using the array from step 1:, determine the array index. \n index = building.building_apartment_array.index(apartment_hash_to_modify[0])\n ##Step 3: Remove the tenant\n building.building_apartment_array[index.to_i][:renter].delete(tenant_to_remove)\nend", "def update!(**args)\n @gateway_service_mesh = args[:gateway_service_mesh] if args.key?(:gateway_service_mesh)\n @service_networking = args[:service_networking] if args.key?(:service_networking)\n end", "def networks_del( *networks )\n\t\t\t@networks = @networks.difference( networks.flatten )\n\t\tend", "def update!(**args)\n @ip = args[:ip] if args.key?(:ip)\n @labels = args[:labels] if args.key?(:labels)\n @port = args[:port] if args.key?(:port)\n @principal = args[:principal] if args.key?(:principal)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def remove(net_or_name)\n command = ['VBoxManage', 'dhcpserver', 'remove']\n if net_or_name.kind_of? VirtualBox::Net\n command.push '--ifname', net_or_name.name\n else\n command.push '--netname', net_or_name\n end\n\n VirtualBox.run_command command\n self\n end", "def delete_fusion_vm_network(options,install_interface)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if !vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if install_interface == options['empty']\n message = \"Information:\\tGetting network interface list for \"+options['name']\n command = \"'#{options['vmrun']}' listNetworkAdapters '#{fusion_vmx_file}' |grep ^Total |cut -f2 -d:\"\n output = execute_command(options,message,command)\n last_id = output.chomp.gsub(/\\s+/,\"\")\n last_id = last_id.to_i\n if last_id == 0\n handle_output(options,\"Warning:\\tNo network interfaces found\")\n return\n else\n last_id = last_id-1\n install_interface = last_id.to_s\n end\n end\n message = \"Information:\\tDeleting network interface from \"+options['name']\n command = \"'#{options['vmrun']}' deleteNetworkAdapter '#{fusion_vmx_file}' #{install_interface}\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def update!(**args)\n @app_gateway = args[:app_gateway] if args.key?(:app_gateway)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @l7psc = args[:l7psc] if args.key?(:l7psc)\n @type = args[:type] if args.key?(:type)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @port = args[:port] if args.key?(:port)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @uri = args[:uri] if args.key?(:uri)\n @vpn_tunnel_uri = args[:vpn_tunnel_uri] if args.key?(:vpn_tunnel_uri)\n end", "def removeVest _args\n \"removeVest _args;\" \n end", "def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, filepath)\n msg response\n return response\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @conditions = args[:conditions] if args.key?(:conditions)\n @control_plane_ip = args[:control_plane_ip] if args.key?(:control_plane_ip)\n @create_time = args[:create_time] if args.key?(:create_time)\n @degraded = args[:degraded] if args.key?(:degraded)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @private_cluster_config = args[:private_cluster_config] if args.key?(:private_cluster_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @commands = args[:commands] if args.key?(:commands)\n @entrypoint = args[:entrypoint] if args.key?(:entrypoint)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @options = args[:options] if args.key?(:options)\n @volumes = args[:volumes] if args.key?(:volumes)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @labels = args[:labels] if args.key?(:labels)\n @manifest = args[:manifest] if args.key?(:manifest)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @self_link = args[:self_link] if args.key?(:self_link)\n @target = args[:target] if args.key?(:target)\n @update = args[:update] if args.key?(:update)\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 delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end", "def delete_entry(aliaz)\n\n end", "def update!(**args)\n @allocated_connections = args[:allocated_connections] if args.key?(:allocated_connections)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @host_type = args[:host_type] if args.key?(:host_type)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @uri = args[:uri] if args.key?(:uri)\n end", "def parse_networks args\n args = args.deep_dup\n dc_networks = networks\n args[\"interfaces_attributes\"].each do |key, interface|\n # Convert network id into name\n net = dc_networks.find { |n| [n.id, n.name].include?(interface[\"network\"]) }\n raise \"Unknown Network ID: #{interface[\"network\"]}\" if net.nil?\n interface[\"network\"] = net.name\n end if args[\"interfaces_attributes\"]\n args\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end", "def removeHeadgear _args\n \"removeHeadgear _args;\" \n end", "def update!(**args)\n @ip_addresses = args[:ip_addresses] if args.key?(:ip_addresses)\n @modes = args[:modes] if args.key?(:modes)\n @network = args[:network] if args.key?(:network)\n @reserved_ip_range = args[:reserved_ip_range] if args.key?(:reserved_ip_range)\n end", "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "def update!(**args)\n @eligibility = args[:eligibility] if args.key?(:eligibility)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @nodes = args[:nodes] if args.key?(:nodes)\n @tier = args[:tier] if args.key?(:tier)\n end", "def update!(**args)\n @eligibility = args[:eligibility] if args.key?(:eligibility)\n @exclusions = args[:exclusions] if args.key?(:exclusions)\n @nodes = args[:nodes] if args.key?(:nodes)\n @tier = args[:tier] if args.key?(:tier)\n end", "def delete_existing_entry()\n\t# Print overview of existing entries\n\tentry_valid = 0\n\taddr_book_array = []\n\tAddr_book.each do |entry_name, entry|\n\t\taddr_book_array.push entry_name\n\tend\n\tputs \"---\"\n\taddr_book_array.each_with_index do |element, index|\n\t\tputs index.to_s + \" \" + element\n\tend\n\t# Prompt user for entry\n\twhile entry_valid == 0\n\t\tputs \"Which entry would you like to delete? <0, 1, 2, etc.>\"\n\t\tentry_to_delete = gets.chomp.to_i\n\t\tentry_name = addr_book_array[entry_to_delete]\n\t\tif Addr_book.key?(entry_name) == true\n\t\t\tAddr_book.delete(entry_name)\n\t\t\t#.delete(key) # delete from a hash using .delete(key). give it the key you want to delete.\n\t\t\t# delete_at deletes an element at a specific index. (use for an array usually)\n\t\t\tputs \"Entry deleted!\"\n\t\t\tputs \"---\"\n\t\t\tentry_valid = 1\n\t\telse \n\t\t\tputs \"That entry is bogus. Try again.\"\n\t\tend\n\tend\n\t# Exit this workflow and return to main menu\n\t\n\nend", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_indexes = args[:deployed_indexes] if args.key?(:deployed_indexes)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @private_service_connect_config = args[:private_service_connect_config] if args.key?(:private_service_connect_config)\n @public_endpoint_domain_name = args[:public_endpoint_domain_name] if args.key?(:public_endpoint_domain_name)\n @public_endpoint_enabled = args[:public_endpoint_enabled] if args.key?(:public_endpoint_enabled)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def remove(endpoint_alias)\n puts \"Removing credential #{endpoint_alias}\"\n\n load_manifest\n @manifest.delete(endpoint_alias) if @manifest.has_key? endpoint_alias\n save_manifest\n\n end", "def delete!(*rest) end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend", "def delitem(list, item)\n# input: list and key\n list.delete(item)\n# steps: delete a given key item\nend", "def update!(**args)\n @allowed_projects = args[:allowed_projects] if args.key?(:allowed_projects)\n @cluster_hostname = args[:cluster_hostname] if args.key?(:cluster_hostname)\n @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint)\n @service_attachment_uri = args[:service_attachment_uri] if args.key?(:service_attachment_uri)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @password = args[:password] if args.key?(:password)\n @port = args[:port] if args.key?(:port)\n @private_key = args[:private_key] if args.key?(:private_key)\n @username = args[:username] if args.key?(:username)\n end", "def deleteWaypoint _args\n \"deleteWaypoint _args;\" \n end", "def update!(**args)\n @credential = args[:credential] if args.key?(:credential)\n @description = args[:description] if args.key?(:description)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @labels = args[:labels] if args.key?(:labels)\n @manifest = args[:manifest] if args.key?(:manifest)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @outputs = args[:outputs] if args.key?(:outputs)\n @self_link = args[:self_link] if args.key?(:self_link)\n @target = args[:target] if args.key?(:target)\n @update = args[:update] if args.key?(:update)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def delete(*rest) end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end", "def removeItemFromVest _obj, _args\n \"_obj removeItemFromVest _args;\" \n end", "def remove_elem\n elem =eval(params[:type]).find(params[:elem])\n elem.position= 0\n case params[:type]\n when \"Activity\"\n elem.model_id = -1\n when \"Action\"\n elem.activity_id = -1\n when 'PfTask'\n elem.action_id = -1\n end\n elem.update_attributes(elem.attributes)\n redirect_to :action => 'show_subs', :parent_id =>params[:parent_id], :parent_type =>eval(params[:type]).get_parent_name\n end", "def release_address(env,eip)\n h = JSON.parse(eip)\n # Use association_id and allocation_id for VPC, use public IP for EC2\n if h['association_id']\n env[:aws_compute].disassociate_address(nil,h['association_id'])\n env[:aws_compute].release_address(h['allocation_id'])\n else\n env[:aws_compute].disassociate_address(h['public_ip'])\n env[:aws_compute].release_address(h['public_ip'])\n end\n end", "def release_address(env,eip)\n h = JSON.parse(eip)\n # Use association_id and allocation_id for VPC, use public IP for EC2\n if h['association_id']\n env[:aws_compute].disassociate_address(nil,h['association_id'])\n env[:aws_compute].release_address(h['allocation_id'])\n else\n env[:aws_compute].disassociate_address(h['public_ip'])\n env[:aws_compute].release_address(h['public_ip'])\n end\n end", "def update!(**args)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @ha_control_plane_config = args[:ha_control_plane_config] if args.key?(:ha_control_plane_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end" ]
[ "0.6460949", "0.5475716", "0.54739", "0.54632664", "0.5437425", "0.5421944", "0.53205013", "0.5300579", "0.5272561", "0.52284783", "0.5146894", "0.50955284", "0.5074325", "0.50561506", "0.5038087", "0.50370777", "0.5027454", "0.5010529", "0.49872196", "0.49847698", "0.49739373", "0.49488077", "0.49471226", "0.49445486", "0.49388638", "0.49323228", "0.49306718", "0.49106878", "0.4908593", "0.4902037", "0.4900887", "0.489485", "0.489485", "0.489485", "0.48843047", "0.4867079", "0.4845305", "0.4836215", "0.48146594", "0.48141587", "0.48136616", "0.48079345", "0.48070338", "0.48009968", "0.47983745", "0.47963", "0.47963", "0.47805533", "0.47793996", "0.47726724", "0.47706035", "0.47519696", "0.47497672", "0.4742038", "0.4736958", "0.47366095", "0.47296742", "0.47283095", "0.47151074", "0.47127128", "0.47023958", "0.47022235", "0.46990216", "0.46990216", "0.46979147", "0.46900392", "0.4685145", "0.46769992", "0.46725217", "0.4663804", "0.46587256", "0.4658657", "0.46459985", "0.46433592", "0.46382737", "0.46291885", "0.46291885", "0.46269244", "0.46269244", "0.4623046", "0.4612362", "0.4604112", "0.46022752", "0.4593678", "0.4593678", "0.45931455", "0.45894045", "0.4588442", "0.45870477", "0.45870477", "0.45864597", "0.4584278", "0.45834976", "0.45804554", "0.45753068", "0.45738682", "0.45727926", "0.456863", "0.456863", "0.4561684" ]
0.63628566
1
restores the network configuration from a file argv = commandline arguments, requires a path to a json configuration file (f) , and a boolean (b true|false) argument indicating whether or not existing elements should be cleared
def cmd_restore argv setup argv filepath = @hash['filepath'] clear_existing = to_boolean(@hash['boolean']) response = @api.restore(filepath, clear_existing) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @config_file = nil\n set_defaults\n load_from_file if config_file\n end", "def clean_up_conf_file(conf_file_path)\n conf_items_patterns = { /^tools\\.remindInstall.*\\n/ => \"tools.remindInstall = \\\"FALSE\\\"\",\n /^uuid\\.action.*\\n/ => \"uuid.action = \\\"create\\\"\",\n /^ethernet\\.+generatedAddress.*\\n/ => '' }\n\n content = File.read conf_file_path\n content << \"\\n\"\n\n conf_items_patterns.each_pair do |pattern, new_item|\n unless content.include? new_item\n content.gsub(pattern, '').strip\n content << \"#{new_item}\\n\"\n end\n end\n\n File.open(conf_file_path, 'w') { |f| f.print content }\n end", "def merge_with_default(config, config_file, unset_nil:); end", "def clean_up\n name = 'webserver'\n tempfile = '/tmp/haproxy.cfg'\n server_config = \"server #{name}\"\n \n contents = File.read(File.expand_path(@haproxy_config_file))\n\n open(tempfile, 'w+') do |f|\n contents.each_line do |line|\n f.puts line unless line.match(server_config)\n end\n end\n FileUtils.mv(tempfile, @haproxy_config_file)\n end", "def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end", "def configure(argv = ARGV)\n # => Parse CLI Configuration\n cli = Options.new\n cli.parse_options(argv)\n\n # => Parse JSON Config File (If Specified and Exists)\n json_config = Util.parse_json(cli.config[:config_file] || Config.config_file)\n\n # => Merge Configuration (CLI Wins)\n config = [json_config, cli.config].compact.reduce(:merge)\n\n # => Apply Configuration\n config.each { |k, v| Config.send(\"#{k}=\", v) }\n end", "def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end", "def recreate_default_config(test_to_run = 3)\n File.delete('config/prefs.yml') if File.exist?('config/prefs.yml')\n newPrefFile = File.new('config/prefs.yml', 'w+')\n newPrefFile.puts(\"#[1]- Operational\n#[2]- Functionnal\n#[3]- All\ntests_to_run: #{test_to_run}\")\n newPrefFile.close\nend", "def conf_load(file, opts={})\r\n\topts={:save => true, :set => false}.merge(opts)\r\n\tchanged = false\r\n\r\n\tbegin\r\n\t\tconf = AlienConfig.load(file)\r\n\r\n\t\t[CONF_HOST,CONF_USER,CONF_PASS,CONF_CLI,CONF_PRIO].each do |param|\r\n\t\t\tnot_set = conf[param].nil? || conf[param].empty?\r\n\t\t\tif not_set || opts[:set]\r\n\t\t\t\twhile true\r\n\t\t\t\t\tprintf \"Enter '%8s'%s\", param, (not_set ? \": \" : \" [#{conf[param]}]: \")\r\n\t\t\t\t\tSTDOUT.flush\r\n\t\t\t\t\tif (str = STDIN.gets.strip).empty?\r\n\t\t\t\t\t\tnext if not_set\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\t\tconf[param] = str\r\n\t\t\t\t\tchanged = true\r\n\t\t\t\t\tbreak\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\trescue Exception => e\r\n\t\tputs\r\n\t\tputs \"#ERROR# input interrupted\"\r\n\t\treturn nil\r\n\trescue\r\n\t\tputs\r\n\t\tputs \"#ERROR# invalid input\"\r\n\t\treturn nil\r\n\tend\r\n\tconf.save if opts[:save] && changed\r\n\r\n\treturn conf\r\nend", "def config_file_settings\n Chef::Config[:knife].save(false) # this is like \"dup\" to a (real) Hash, and does not include default values (just user set values)\n end", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n optfile = @ConfFile\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @filename\n conf[\"dir\"] = @dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def reload_config!\n @config = nil\n load_config!\n self\n end", "def reload_config\n @config = nil\n end", "def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end", "def undefine_config(tool)\n @setup[tool.to_s] = false\n end", "def cli_args!(args)\n ChefBackup::Config.config = args\nend", "def initialize( configFileDNE=Conf.filename_proposal )\n#p :xxx\n raise unless configFileDNE\n @configFileDNE = configFileDNE.dup.strip.gsub('\\\\', '/')\n @instant_save = false\n @section = nil\n \n if File.file?( @configFileDNE )\n dataFromFile = read\n self.replace( dataFromFile ) if dataFromFile\n end\n#exit\n self.section = nil unless self.has_key?(nil) # section \"nil\" always needed\n\n super()\n save() # writeable?\n end", "def merge_with_default(config, config_file, unset_nil: T.unsafe(nil)); end", "def set_from_config!(arg)\n @config_data = \n if arg.include?(\"://\")\n open(arg) {|io| io.read }\n elsif File.exist?(arg)\n @config_filename = arg\n IO.read(arg)\n else\n url = \"https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}\"\n begin\n open(url) {|io| io.read }\n rescue\n raise RuntimeError, \"assuming this is a github account name, but config file does not exist!: #{url}\"\n end\n end\n raise \"config file doesn't look like config file\" unless is_config?(@config_data)\n (@data, @repos) = read_config_data(@config_data, @config_filename)\n self\n end", "def init\n depot = OPTIONS[:depot]\n detruire = OPTIONS[:detruire]\n\n if File.exists? depot\n if detruire\n FileUtils.rm_f depot # On detruit le depot existant si --detruire est specifie.\n else\n erreur \"Le fichier '#{depot}' existe.\n Si vous voulez le detruire, utilisez 'init --detruire'.\"\n end\n end\n FileUtils.touch depot\nend", "def private_chef!(args = {})\n ChefBackup::Config.config = args\nend", "def reset\n @config = empty_config\n end", "def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end", "def apply_config(config_file_path)\n Backdat::Config.from_file(config_file_path)\n Backdat::Config.merge!(config)\n end", "def reset\n @config = {}\n write_config\n end", "def reset\n @config = nil\n end", "def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end", "def configure\n\n # config file default options\n configuration = {\n :options => {\n :verbose => false,\n :coloring => 'AUTO'\n },\n :mount => {\n :source => {\n :name => nil\n },\n :mountpoint => {\n :name => nil\n },\n :passphrasefile => {\n :name => 'passphrase'\n },\n :keyfile => {\n :name => 'encfs6.xml'\n },\n :cmd => nil,\n :executable => nil\n },\n :unmount => {\n :mountpoint => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n },\n :copy => {\n :source => {\n :name => nil\n },\n :destination => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n }\n }\n\n # set default config if not given on command line\n config = @options[:config]\n unless config\n config = [\n File.join(@working_dir, \"revenc.conf\"),\n File.join(@working_dir, \".revenc.conf\"),\n File.join(@working_dir, \"config\", \"revenc.conf\"),\n File.expand_path(File.join(\"~\", \".revenc.conf\"))\n ].detect { |filename| File.exists?(filename) }\n end\n\n if config && File.exists?(config)\n # rewrite options full path for config for later use\n @options[:config] = config\n\n # load options from the config file, overwriting hard-coded defaults\n config_contents = YAML::load(File.open(config))\n configuration.merge!(config_contents.symbolize_keys!) if config_contents && config_contents.is_a?(Hash)\n else\n # user specified a config file?, no error if user did not specify config file\n raise \"config file not found\" if @options[:config]\n end\n\n # the command line options override options read from the config file\n @options = configuration[:options].merge!(@options)\n @options.symbolize_keys!\n\n # mount, unmount and copy configuration hashes\n @options[:mount] = configuration[:mount].recursively_symbolize_keys! if configuration[:mount]\n @options[:unmount] = configuration[:unmount].recursively_symbolize_keys! if configuration[:unmount]\n @options[:copy] = configuration[:copy].recursively_symbolize_keys! if configuration[:copy]\n end", "def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end", "def reset_config\n\t\t\t@config = {}\n\t\tend", "def clear_if_config_changed(config); end", "def flush\n File.open(config_file, 'w') do |f|\n f.puts JSON.pretty_generate(@conf)\n end\n end", "def flush\n File.open(config_file, 'w') do |f|\n f.puts JSON.pretty_generate(@conf)\n end\n end", "def config(options = {})\n if options[:file]\n filename = options[:filename] || File.join(Dir.home, \".bos\")\n config_hash = JSON.parse(IO.read(filename), symbolize_names: true)\n @user_id = config_hash[:user_id]\n @password = config_hash[:password]\n @security_code = config_hash[:security_code]\n else\n @user_id = options[:user_id]\n @password = options[:password]\n @security_code = options[:security_code]\n File.open(File.join(Dir.home, \".bos\"), \"w\") do |f|\n f.write options.to_json\n end\n end\n end", "def reload_configuration!\n @configuration = nil\n end", "def reload_configuration!\n @configuration = nil\n end", "def initialize(options={ :force => false, :deployfile => 'deploy.yml', :remove_elements => []})\n\n deployfile = options[:deployfile]\n \n if (!File.exist?(deployfile))\n message = \"\\'#{File.expand_path(deployfile)}\\' not found.\"\n raise Error::IOError, message, caller\n end\n\n extension = File.extname(deployfile)\n \n case extension\n when '.json'\n @json = YamlJson.read_json_w_macros(deployfile)\n when '.yaml','.yml'\n @json = YamlJson.yaml2json(deployfile)\n else\n message = \"File extension #{extension} is not supported for deployment file #{deployfile}\"\n raise Error::UnsupportedFileExtension, message, caller\n end \n\n # JSON fix for marathon\n # marathon require ENV variables to be quoted\n @json['env'].each do |key, value|\n if (value.is_a? Numeric)\n @json['env'][key] = value.to_json\n end\n end\n \n missing_attributes = MarathonDefaults.missing_attributes(@json) \n \n if(!missing_attributes.empty?)\n message = \"#{deployfile} is missing required marathon API attributes: #{missing_attributes.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n missing_envs = MarathonDefaults.missing_envs(@json)\n if(!missing_envs.empty?)\n message = \"#{deployfile} is missing required environment variables: #{missing_envs.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n @deployfile = deployfile \n @json = Utils.deep_symbolize(@json) \n \n add_identifier if (options[:force])\n remove_elements(options[:remove_elements])\n \n inject_envs = ENV.select { |k,v| /^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/.match(k) }\n cleaned_envs = Hash[inject_envs.map { |k,v| [k.gsub(/^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/,''), v ] }] \n self.add_envs cleaned_envs.to_h unless cleaned_envs.empty?\n end", "def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end", "def replace_znc_config env\n FileUtils.rm_rf(config_path) if File.directory?(config_path)\n FileUtils.cp_r config_template_path(env), config_path\n end", "def update_json_config(haproxy_config_file, backends, path, template)\n json_config = ::JSON.parse(IO.read(haproxy_config_file))\n json_config['backends'] = (\n json_config['backends'] | stringify_backends(backends))\n json_config['paths'] = json_config['paths'] | [path]\n json_config['templates'] = json_config['templates'] | [template]\n write_json_config(haproxy_config_file, json_config)\nend", "def reset!\n self.configuration = Configuration.new\n end", "def reset_configuration\n @configuration = nil\n end", "def reset!\n @config = Configuration.new\n end", "def config_build config_file, config_vars={}, parse=false\n @logger.debug \"Using config file #{config_file}.\"\n validate_file_input(config_file, \"config\")\n if config_vars.length > 0 or parse or contains_liquid(config_file)\n @logger.debug \"Config_vars: #{config_vars.length}\"\n # If config variables are passed on the CLI, we want to parse the config file\n # and use the parsed version for the rest fo this routine\n config_out = \"#{@build_dir}/pre/#{File.basename(config_file)}\"\n vars = DataObj.new()\n vars.add_data!(\"vars\", config_vars)\n liquify(vars, config_file, config_out)\n config_file = config_out\n @logger.debug \"Config parsed! Using #{config_out} for build.\"\n validate_file_input(config_file, \"config\")\n end\n begin\n config = YAML.load_file(config_file)\n rescue Exception => ex\n unless File.exists?(config_file)\n @logger.error \"Config file #{config_file} not found.\"\n else\n @logger.error \"Problem loading config file #{config_file}. #{ex} Exiting.\"\n end\n raise \"ConfigFileError\"\n end\n cfg = BuildConfig.new(config) # convert the config file to a new object called 'cfg'\n if @safemode\n commands = \"\"\n cfg.steps.each do |step|\n if step['action'] == \"execute\"\n commands = commands + \"> \" + step['command'] + \"\\n\"\n end\n end\n unless commands.to_s.strip.empty?\n puts \"\\nWARNING: This routine will execute the following shell commands:\\n\\n#{commands}\"\n ui = HighLine.new\n answer = ui.ask(\"\\nDo you approve? (YES/no): \")\n raise \"CommandExecutionsNotAuthorized\" unless answer.strip == \"YES\"\n end\n end\n iterate_build(cfg)\nend", "def sanitize_config(conf={}, keep=[], dupe=false)\n \t\t(conf = conf.clone) if dupe\n \t\tconf.reject!{|k,v| (!CONFIG_KEYS.include?(k.to_s) or [{},[],''].include?(v)) and !keep.include? k.to_s }\n \t\tconf\n \tend", "def delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend", "def reset_conf_sub\n Juli::Util::Config.instance_variable_set('@singleton__instance__', nil)\n $_repo = nil\n end", "def parse_config\r\n exec 'parse_config(true);'\r\n self.config_parsed = true\r\n end", "def deleteConfigFile(appName)\n @put.normal \"Removing Thin configuration for #{appName}\"\n configFile = \"/etc/thin/#{appName}.yml\"\n if File.exists?(configFile)\n removeCommand = @system.delete(configFile)\n if removeCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not delete Thin configuration\"\n return 1\n end\n else\n @put.error \"Config file non-existent\"\n return 1\n end\n end", "def update!(**args)\n @input_config = args[:input_config] if args.key?(:input_config)\n end", "def remove_config(name)\n\t\tend", "def update!(**args)\n @control_plane_v2_config = args[:control_plane_v2_config] if args.key?(:control_plane_v2_config)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end", "def handle_r_flag\n printf 'Are you sure that you want to reset the config? [y/n]: '\n answer = get_y_or_n\n if answer\n if File.exist? File.dirname(__FILE__)+'/config/config.yml'\n FileUtils.rm File.dirname(__FILE__)+'/config/config.yml'\n end\n puts 'Config has been reset!'\n exit\n else\n puts 'OK. Aborting...'\n exit 1\n end\n end", "def create_default_cfg\n if File.exist?(Cukedep::YMLFilename)\n puts \"OK to overwrite file #{Cukedep::YMLFilename}.\"\n puts '(Y/N)?'\n answer = $stdin.gets\n exit if answer =~ /^\\s*[Nn]\\s*$/\n end\n Config.default.write(Cukedep::YMLFilename)\n\n exit\n end", "def ensure_config\n if ! in_sync?\n File.open(configfile,\"w\") do |f|\n f.write(@config.to_json)\n end\n end\n end", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n if @ConfFile.nil?\n return conf\n end\n\n optfile = @ConfFile\n optfile = optfile.gsub(/%f/, @doc.filename)\n optfile = optfile.gsub(/%F/, @doc.file)\n optfile = optfile.gsub(/%D/, @doc.dir)\n optfile = optfile.gsub(/%E/, @doc.extname)\n optfile = optfile.gsub(/%R/, @doc.dir + \"/\" + @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%t/, @Type)\n optfile = optfile.gsub(/%B/, $basedir)\n optfile = optfile.gsub(/%b/, $confdir)\n\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @doc.filename\n conf[\"dir\"] = @doc.dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def initialize\n @config = config_from_file || empty_config\n end", "def reset_config\n config.reset_to_defaults\n end", "def revert_config\n config_temp = @config + '.tmp'\n return unless File.exist?(config_temp)\n\n File.delete(@config) if File.exist?(@config)\n File.rename(config_temp, @config)\n end", "def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend", "def file_clear_options(file)\n file.sections.each do |sec|\n block_clear_options(sec)\n sec.interfaces.each do |itf|\n block_clear_options(itf)\n end\n end\nend", "def update!(**args)\n @advanced_networking = args[:advanced_networking] if args.key?(:advanced_networking)\n @island_mode_cidr = args[:island_mode_cidr] if args.key?(:island_mode_cidr)\n @multiple_network_interfaces_config = args[:multiple_network_interfaces_config] if args.key?(:multiple_network_interfaces_config)\n @sr_iov_config = args[:sr_iov_config] if args.key?(:sr_iov_config)\n end", "def update!(**args)\n @clean = args[:clean] if args.key?(:clean)\n @paths = args[:paths] if args.key?(:paths)\n end", "def read_config(fi,conf,curDir)\n\tDir.chdir curDir\n\tbDirs=bFiles=false\n \n\tIO.readlines(fi).each do |line|\n\t\tline.chomp!\n line.strip!\n\t\tnext if line[0,1]=='#' #comment line ?\n\t\tnext if line.empty? # ignore empty lines\n\t\tif line=~/^-exdirs/i\n\t\t\tbDirs,bFiles=true, false\n\t\telsif line=~/^-exfiles/i\n\t\t\tbFiles,bDirs=true, false\n\t\telsif line=~/^-server/i\n\t\t\tconf[:server]=getVal(line)\n\t\telsif line=~/^-user/i\n\t\t\tconf[:user]=getVal(line)\t\t\n\t\telsif line=~/^-port/i\n\t\t\tconf[:port]=getVal(line).to_i\n\t\telsif line=~/^-pass/i\n\t\t\tconf[:pass]=getVal(line)\n\t\telsif line=~/^-ftpdir/i\n\t\t\tconf[:ftpDir]=getVal(line)\n \t\telsif line=~/^-backupDrive/i\n\t\t\tconf[:backupDrive]=getVal(line)\n\n\t\telsif line=~/^-backupFile/i\n\t\t\tconf[:backupFile]=getVal(line)\n \t elsif line=~/^-generations/i\n\t\t\tconf[:generations]=getVal(line).to_i\n unless conf[:generations]>0\n puts 'error in config: generations must be > 0 !'\n puts line\n exit 1\n end\n elsif line=~/^-cryptpass/i\n\tconf[:passphrase]=getVal(line)\n \tif conf[:passphrase].size<8\n \tputs 'error in config: cryptpass minimum length is 8 chars !'\n \t \tputs line\n \texit 1\n end\n elsif bDirs\n\t\t\tconf[:exDirs]<< line # collect directories to exclude/(nclude empty only)\n elsif bFiles\n\t\t\tconf[:exFiles]<< line # collect file masks to exclude\n else\n\t\t\tconf[:saveDirs]<< line # collect directories to backup\n end\n end\nend", "def sync_configuration!\n load_configuration_if_needed! and save\n save_configuration_if_needed!\n end", "def update!(**args)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @ha_control_plane_config = args[:ha_control_plane_config] if args.key?(:ha_control_plane_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end", "def generate_settings(cmdline, configuration)\n loaded = YAML::load(configuration)\n\n if loaded[:properties].nil?\n loaded[:properties] = {}\n end\n\n unless cmdline['--pattern'].nil? \n loaded[:vcs][:release_regex] = input['--pattern']\n end\n\n #User name override\n if cmdline['-c']\n (0..cmdline['-c']-1).each do |it|\n u = cmdline['<user>'][it]\n p = cmdline['<password>'][it]\n t = cmdline['<target>'][it]\n loaded[:task_systems].each do |ts|\n if ts[:name] == t\n ts[:usr] = u\n ts[:pw] = p\n end\n end\n end\n end\n \n unless cmdline['--properties'].nil? \n json_value = JSON.parse(cmdline['--properties'])\n loaded[:properties] = loaded[:properties].merge(json_value)\n end\n loaded[:verbosity] = Logging.calc_verbosity(cmdline)\n loaded \n end", "def config(opts)\n if opts.reset\n Config.instance.reset\n else\n Config.instance.edit\n end\n end", "def initialize(options={\n :force => false,\n :deployfile => 'deploy.yml',\n :remove_elements => [],\n :environment => nil,\n })\n\n deployfile = options[:deployfile]\n @json = readFile(deployfile)\n\n if (!options[:environment].nil?)\n overrides = env_overrides(\n File.dirname(deployfile),\n options[:environment].name)\n\n @json = @json.deep_merge!(overrides)\n end\n\n missing_attributes = MarathonDefaults.missing_attributes(@json) \n \n if(!missing_attributes.empty?)\n message = \"#{deployfile} is missing required marathon API attributes: #{missing_attributes.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n missing_envs = MarathonDefaults.missing_envs(@json)\n if(!missing_envs.empty?)\n message = \"#{deployfile} is missing required environment variables: #{missing_envs.join(',')}\"\n raise Error::MissingMarathonAttributesError, message, caller\n end\n \n @deployfile = deployfile \n @json = Utils.deep_symbolize(@json) \n \n add_identifier if (options[:force])\n remove_elements(options[:remove_elements])\n \n inject_envs = ENV.select { |k,v| /^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/.match(k) }\n cleaned_envs = Hash[inject_envs.map { |k,v| [k.gsub(/^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/,''), v ] }] \n self.add_envs cleaned_envs.to_hash unless cleaned_envs.empty?\n end", "def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end", "def cleanup_options\n # Ensure configuration file make reference to an absolute path.\n if options[:configuration_file]\n options[:configuration_file] = pathname(working_path, options[:configuration_file]).to_s\n end\n end", "def reconfig(config)\n self.config = config\n end", "def cfgremove(fabrickey, cfgname, *zonenames)\n result = @zones.altercfg(fabrickey, 'REMOVE', cfgname, *zonenames)\n result[1]\n end", "def reset\n @options = Marshal.load(@default)\nend", "def configure_manifest\n @configuration = YAML.load_file(manifest.to_s) if exist?\n end", "def parse!(configuration_file)\n instance_eval(File.read(configuration_file))\n\n ##\n # If no configuration is found by environment then\n # it will re-parse it in a forced manner, meaning it won't\n # care about the environment and it will just parse everything it finds.\n # This is done because we can then extract all set \"modules\" from the configuration\n # file and display them in the \"Help\" screen so users can look up information/examples on them.\n #\n # This will only occur if no environment is found/specified. So when doing anything\n # environment specific, it will never force the parsing.\n if not found? and environment.nil?\n @force_parse = true\n instance_eval(File.read(configuration_file))\n @additional_modules.uniq!\n end\n\n if not found? and not environment.nil?\n GitPusshuTen::Log.error \"Could not find any configuration for #{environment.to_s.color(:yellow)}.\"\n exit\n end\n\n ##\n # Default to port 22 if no port is specified\n @port ||= '22'\n\n self\n end", "def clean(mute=false)\n return if @options[:dirty]\n UI.say \"Cleaning up eb remote config and local files\" unless mute\n eb.delete_configuration_template(\n application_name: @updater.app_name,\n template_name: current_name\n ) unless @options[:noop]\n FileUtils.rm_f(@current_path)\n end", "def remove_config(name)\n variables[name] = nil\n end", "def update!(**args)\n @configuration_name = args[:configuration_name] if args.key?(:configuration_name)\n @metadata = args[:metadata] if args.key?(:metadata)\n @status = args[:status] if args.key?(:status)\n end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def reset\n Configuration.new\n end", "def clear(config)\n Array(config).each do |setting|\n delete_setting setting\n end\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_dataset = args[:destination_dataset] if args.key?(:destination_dataset)\n end", "def read_configuration filename\n puts \"Reading configuration from #{filename}\"\n lines=File.readlines(filename)\n cfg={}\n #change in the dir of the file to calculate paths correctly\n cfg_dir=File.dirname(filename)\n lines.each do |l|\n l.gsub!(\"\\t\",\"\")\n l.chomp!\n #ignore if it starts with a hash\n unless l=~/^#/ || l.empty?\n #clean up by trimming whitespaces\n l.gsub!(/\\s*=\\s*/,'=')\n l.gsub!(/\\s*,\\s*/,',')\n #\n if l=~/=$/\n trailing_equals=true\n end\n #split on equals\n fields=l.split('=')\n #more than one part needed\n if fields.size>1\n #the key is the first\n key=fields.first\n #take the key out of the array\n values=fields.drop(1)\n #the value to each key is the values array joined with space\n case key \n when \"include\",\"depend\",\"interface\",\"external\" \n cfg[key]||=[]\n #here we want to handle a comma separated list of prefixes\n incs=values.join\n cfg[key]+=incs.split(',')\n cfg[key].uniq!\n when \"out_dir\",\"base_dir\",\"model\" \n cfg[key]=File.expand_path(File.join(cfg_dir,values.join))\n else\n cfg[key]=values.join('=')\n end#case\n cfg[key]<<'=' if trailing_equals\n else\n puts \"ERROR - Configuration syntax error in #{filename}:\\n'#{l}'\"\n end#if size>1\n end#unless\n end#lines.each\n return cfg\nend", "def read_options args={}, update_options={}\n args = {:environment => nil,\n :config_file => nil,\n :verbose => 'silent'\n }.update(args)\n\n options = {}\n\n if File.exists? @cfg_file\n vputs \"Loading '#{@cfg_file}'\", args[:verbose]\n options = load_file @cfg_file\n end\n\n if args[:config_file]\n if !File.exists? args[:config_file]\n vputs \"ERROR: Config file '#{args[:config_file]}' not found!\", args[:verbose]\n exit\n end\n vputs \"Loading '#{args[:config_file]}'\", args[:verbose]\n update_options(args[:config_file], options)\n elsif @persistent_local_cfg_file && File.exists?(@persistent_local_cfg_file)\n vputs \"Loading '#{@persistent_local_cfg_file}'\", args[:verbose]\n update_options(@persistent_local_cfg_file, options)\n elsif @local_cfg_file && File.exists?(@local_cfg_file)\n vputs \"Loading '#{@local_cfg_file}'\", args[:verbose]\n update_options(@local_cfg_file, options)\n end\n\n if args[:environment]\n vputs \"Using environment '#{args[:environment]}'\", args[:verbose]\n options = (options['default']||{}).deep_merge!(options[args[:environment]]||{})\n end\n\n options.update(update_options)\n options['environment'] = 'development' if options['environment'].nil?\n options['verbose'] = false if options['verbose'].nil?\n\n if args[:verbose] == true\n len = options.keys.map { |k| k.size }.sort.last\n vputs \"Loaded options:\", args[:verbose]\n options.each { |k, v| puts \" #{k.ljust(len)} => #{v}\" }\n end\n\n options\n end", "def parse_config_file\n if !File.exist?(options[:config_file])\n puts \"Configuration file is not found\"\n exit 1\n end\n\n configs = YAML.load_file(options[:config_file]).deep_symbolize_keys\n options.reverse_merge!(configs[environment.to_sym] || {})\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @f5_config = args[:f5_config] if args.key?(:f5_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 @seesaw_config = args[:seesaw_config] if args.key?(:seesaw_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update!(**args)\n @f5_config = args[:f5_config] if args.key?(:f5_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 @seesaw_config = args[:seesaw_config] if args.key?(:seesaw_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def loadConfig(path)\n\t#TODO: Load from file\n\t$identKey = 12345 # Identifies us to server\n\t$timeout = 10\n\tiName = \"eth0\"\n\t$interFace = \"eth0\" # Our interface name\n\t$dstIP = \"192.168.119.133\"\n\t$srcIP = \"192.168.119.134\"\n\t$cmdPort = 80 # TCP goes here\n\tcmdField = \"seq-number\" # Options: seq-number,ack-number\n\t$dataPort = \"2289\" # UDP goes here\n\t$dataCmdField = \"src-port\" # Options: src-port, dst-port\n\tuserCmdRun = \"20\" # Identifies a run command\n\t$config = PacketFu::Config.new(PacketFu::Utils.whoami?(:iface=> iName)).config # set interface\n #$config = PacketFu::Config.new(:iface=> iName).config # use this line instead of above if you face `whoami?': uninitialized constant PacketFu::Capture (NameError)\nend", "def reset!(options = {})\n if options.is_a? String\n options = parse_connection_string(options)\n elsif options.is_a? Hash\n # When the options are provided via singleton setup: Azure::Storage.setup()\n options = setup_options if options.length == 0\n\n options = parse_connection_string(options[:storage_connection_string]) if options[:storage_connection_string]\n end\n\n # Load from environment when no valid input\n options = load_env if options.length == 0\n\n @ca_file = options.delete(:ca_file)\n @ssl_version = options.delete(:ssl_version)\n @ssl_min_version = options.delete(:ssl_min_version)\n @ssl_max_version = options.delete(:ssl_max_version)\n @options = filter(options)\n self.send(:reset_config!, @options) if self.respond_to?(:reset_config!)\n self\n end", "def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.rpc_spec_path = ::ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s\n options\n end", "def reload!\n @configuration = nil\n load\n self\n end", "def generate_config(local_file,remote_file,use_sudo=false)\n temp_file = '/tmp/' + File.basename(local_file)\n buffer = parse_config(local_file)\n File.open(temp_file, 'w+') { |f| f << buffer }\n upload temp_file, temp_file, :via => :scp\n run \"#{use_sudo ? sudo : \"\"} mv #{temp_file} #{remote_file}\"\n `rm #{temp_file}`\nend" ]
[ "0.5522984", "0.5496737", "0.54178774", "0.53766453", "0.53382134", "0.53363556", "0.53073454", "0.5293508", "0.52713937", "0.5251322", "0.5152444", "0.51470655", "0.5146332", "0.51406515", "0.5125433", "0.5118058", "0.51074433", "0.5100331", "0.5094668", "0.5092635", "0.50638914", "0.50616884", "0.50455755", "0.5036515", "0.50318366", "0.50167376", "0.5009383", "0.5001479", "0.49851564", "0.49760485", "0.49697843", "0.49663237", "0.49663237", "0.49531215", "0.4939503", "0.4939503", "0.49343696", "0.49316815", "0.4916515", "0.49103215", "0.48883846", "0.488346", "0.48832658", "0.48639807", "0.48577455", "0.48559442", "0.48491666", "0.4845662", "0.48446858", "0.48412037", "0.48390546", "0.48363018", "0.48260528", "0.48145017", "0.48043308", "0.47978002", "0.47972554", "0.47931165", "0.47906384", "0.47885153", "0.47872028", "0.47867766", "0.47851673", "0.4780964", "0.47769433", "0.47685683", "0.47681823", "0.4761465", "0.47602767", "0.475757", "0.47537902", "0.47396532", "0.47308004", "0.47279075", "0.47254056", "0.47205672", "0.47199008", "0.4717541", "0.4714902", "0.47140118", "0.47140118", "0.47140118", "0.47140118", "0.47140118", "0.47115886", "0.47114098", "0.47103724", "0.47070977", "0.47013804", "0.46951413", "0.46930358", "0.46930358", "0.46873868", "0.46855545", "0.46855545", "0.4684921", "0.46843567", "0.4675679", "0.46748674", "0.46734175" ]
0.50177276
25
clears existing network configuration hosts argv = commandline arguments
def cmd_clear_hosts argv setup argv response = @api.clear_hosts msg JSON.pretty_generate(response) return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_unused_host_only_networks\n end", "def clear_host!\n @host_key_files = []\n @known_host_identities = nil\n self\n end", "def reset!\n @hosts = nil\n end", "def delete_unused_host_only_networks\n networks = []\n execute(\"list\", \"hostonlyifs\").split(\"\\n\").each do |line|\n networks << $1.to_s if line =~ /^Name:\\s+(.+?)$/\n end\n\n execute(\"list\", \"vms\").split(\"\\n\").each do |line|\n if line =~ /^\".+?\"\\s+\\{(.+?)\\}$/\n execute(\"showvminfo\", $1.to_s, \"--machinereadable\").split(\"\\n\").each do |info|\n if info =~ /^hostonlyadapter\\d+=\"(.+?)\"$/\n networks.delete($1.to_s)\n end\n end\n end\n end\n\n networks.each do |name|\n execute(\"hostonlyif\", \"remove\", name)\n end\n end", "def rm(hostname)\n hosts.delete hostname\n end", "def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end", "def hosts=(hosts)\n @host = nil\n @hosts = hosts\n end", "def cleanup\n _send_command(\"hosts -d\")\n _send_command(\"services -d\")\n _send_command(\"creds -d\")\n end", "def networks_del( *networks )\n\t\t\t@networks = @networks.difference( networks.flatten )\n\t\tend", "def cmd_clear_routes argv\n setup argv\n response = @api.clear_routes\n msg response\n return response\n end", "def host=(host)\n @hosts = nil\n @host = host\n end", "def empty_argv\n ARGV.length.times{ ARGV.pop }\n end", "def remove_host(host)\r\n @hosts.delete(host)\r\n end", "def clear_cli\n system 'clear'\n end", "def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end", "def unset(*args)\n run \"unset #{OptArg.parse(*args)}\"\n nil\n end", "def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def cleanup_hostname!\n return unless machine.config.vm.hostname.nil?\n machine.communicate.sudo(\"rm -f /etc/nixos/vagrant-hostname.nix\")\n end", "def cmd_clear_interface argv\n setup argv\n interface = @hash['interfaces']\n response = @api.clear_interface(interface)\n msg response\n return response\n end", "def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end", "def unmanage_host(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.headers['Accept'] = 'application/json,version=2'\n curl.headers['Content-Type'] = 'application/json'\n host_settings = {}\n host_settings[:host] = {}\n host_settings[:managed] = false\n host_settings_json = host_settings.to_json\n curl.http_post(host_settings_json)\n result = JSON.parse(curl.body_str)\n raise result['message'] if result['message'] =~ /^ERF51/\n result\n end", "def clearItemPool _args\n \"clearItemPool _args;\" \n end", "def cleanup_network!\n # Abort if a private network has been defined\n machine.config.vm.networks.each do |cfg|\n return if cfg[0] == :private_network\n end\n machine.communicate.sudo(\"rm -f /etc/nixos/vagrant-network.nix\")\n end", "def clear(config)\n Array(config).each do |setting|\n delete_setting setting\n end\n end", "def delete_unused_host_only_networks\n networks = read_virtual_networks\n\n # Exclude all host-only network interfaces which were not created by vagrant provider.\n networks.keep_if do |net|\n net['Type'] == 'host-only' && net['Network ID'] =~ /^vagrant-vnet(\\d+)$/\n end\n\n read_vms_info.each do |vm|\n used_nets = vm.fetch('Hardware', {}).select { |name, _| name.start_with? 'net' }\n used_nets.each_value do |net_params|\n networks.delete_if { |net| net['Network ID'] == net_params.fetch('iface', nil) }\n end\n end\n\n # Delete all unused network interfaces.\n networks.each do |net|\n execute_prlsrvctl('net', 'del', net['Network ID'])\n end\n end", "def clear(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would clear #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::ClearCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Cleared #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def clear\n validate_arguments!\n action(\"Removing all domain names from #{app}\") do\n api.delete_domains(app)\n end\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def unconfigure_cc_server(options)\n unconfigure_ks_repo(options['service'])\nend", "def __rebuild_connections(arguments={})\n @hosts = arguments[:hosts] || []\n @options = arguments[:options] || {}\n __close_connections\n @connections = __build_connections\n end", "def removeAllContainers _args\n \"removeAllContainers _args;\" \n end", "def cleanup_unused_ip_addresses\n fog_compute.addresses.each do |a|\n unless a.server\n print \"Deleting unused IP address #{a.public_ip}... \"\n a.destroy\n puts \"done\"\n end\n end\n end", "def delete_host(opts)\n raise ArgumentError.new(\"The following options are required: :ids\") if opts[:ids].nil?\n\n ::ApplicationRecord.connection_pool.with_connection {\n deleted = []\n opts[:ids].each do |host_id|\n host = Mdm::Host.find(host_id)\n begin\n deleted << host.destroy\n rescue # refs suck\n elog(\"Forcibly deleting #{host.address}\")\n deleted << host.delete\n end\n end\n\n return deleted\n }\n end", "def clean\n what = ARGV.shift\n\n case what\n when 'collections'\n clean_collections\n else\n ARGV.unshift what\n original_clean\n end\n end", "def clear_all!\n @commands_and_opts.clear\n self\n end", "def asr_delete_orphaned_config(agent_host)\n elektron_networking.delete(\"/asr1k/orphans/#{agent_host}\").body\n end", "def unset\n requires_preauth\n if args.empty?\n error(\"Usage: heroku config:unset KEY1 [KEY2 ...]\\nMust specify KEY to unset.\")\n end\n\n args.each do |key|\n action(\"Unsetting #{key} and restarting #{app}\") do\n api.delete_config_var(app, key)\n\n @status = begin\n if release = api.get_release(app, 'current').body\n release['name']\n end\n rescue Heroku::API::Errors::RequestFailed\n end\n end\n end\n end", "def remove_host(name)\n configure \"no logging host #{name}\"\n end", "def options_clear opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" clear\".colorize(colors[:yellow]) + \n\t\t\t\t\" clears a completed tasks\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:clear].colorize(colors[:red])\n\t\t\t\topts.on('-a', 'resets the entire list') do\n\t\t\t\t\tOPTIONS[:clear_all] = true\n\t\t\t\tend\n\t\t\tend", "def remove_host(host_name)\n raise 'Server Name Indication (SNI) not configured for default host' unless @hosts\n raise 'only valid for server mode context' unless @is_server\n context = @hosts[host_name.to_s]\n if context\n @hosts.delete(host_name.to_s)\n context.cleanup\n end\n nil\n end", "def clear\n validate_arguments!\n\n action(\"Removing all SSH keys\") do\n api.delete_keys\n end\n end", "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end", "def host_delete_all(hosts = @hosts_delta)\n hosts.each do |host|\n host_delete(host)\n unmanage_host(host)\n end\n end", "def clean!\n for duplicate in duplicates.map{|duplicate| duplicate[0]}\n @commands.delete_if{ |i| i[0] == duplicate}\n @commands << [duplicate, ENV[duplicate]]\n end\n end", "def reset\n self.remote_host = DEFAULT_REMOTE_HOST\n self.remote_port = DEFAULT_REMOTE_PORT\n self.local_host = DEFAULT_LOCAL_HOST\n self.local_port = DEFAULT_LOCAL_PORT\n self.auto_connect = DEFAULT_AUTO_CONNECT\n self\n end", "def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end", "def moped_arguments\n [hosts, options]\n end", "def reset(options={})\n options = {\n :clear => true\n }.merge(options)\n\n registry.each do |option|\n if option.respond_to?(:reset)\n option.reset\n end\n end\n\n config.clear if options[:clear]\n self\n end", "def cleardnscach(session)\n\tprint_status(\"Clearing the DNS Cache\")\n\tsession.sys.process.execute(\"cmd /c ipconfig /flushdns\",nil, {'Hidden' => true})\nend", "def test_add_and_remove_host\n hostname = `hostname`.chomp\n assert_nil(cmk.add_host(hostname, 'folder1'))\n assert_nil(cmk.activate)\n assert_nil(cmk.delete_host(hostname, 'folder1'))\n assert_nil(cmk.activate)\n end", "def rmhost(host_name)\n call_rpc_for_target(ZONE_METHODS[:rmhost], host_name)\n end", "def delete_all_cluster_ips\n super\n end", "def de_duplicate\n\t\t\t@known_hosts.keys.map do |key|\n\t\t\t\tip=@known_hosts[key]\n\t\t\t\tif @known_ips.key?(ip)\n\t\t\t\t\t@known_hosts.delete(key)\n\t\t\t\telse\n\t\t\t\t\t@known_ips[ip]=true\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def reset!\n @cached_descriptions = nil\n @nodes = nil\n @cloud_nodes = nil\n end", "def remove_defaults_on(hosts)\n block_on hosts do |host|\n if host['type']\n # clean up the naming conventions here (some teams use foss-package, git-whatever, we need\n # to correctly handle that\n # don't worry about aio, that happens in the aio_version? check\n host_type = normalize_type(host['type'])\n remove_puppet_paths_on(hosts)\n remove_method = \"remove_#{host_type}_defaults_on\"\n raise \"cannot remove defaults of type #{host_type} associated with host #{host.name} (#{remove_method} not present)\" unless respond_to?(\n remove_method, host\n )\n\n send(remove_method, host)\n\n remove_aio_defaults_on(host) if aio_version?(host)\n end\n end\n end", "def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end", "def remove_mirror(hostname)\n if running?\n puts \"shut down the daemon first\"\n else\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n mirror.destroy\n\n puts \"done\"\n else\n puts \"hostname not found\"\n end\n end\n\n nil\nend", "def cleanup\n @logger.notify \"Cleaning up Lxc Container\"\n\n @hosts.each do | host |\n if container = host['lxc_container']\n @logger.debug(\"stop container #{host}\")\n begin\n ip = container.ip_addresses.join(\",\")\n # If IP is empty it was deleting the /etc/hosts file.\n # So checking first if IP is available or not\n if !ip.empty?\n @logger.notify \"Deleting hostname #{host} in /etc/host\"\n system \"sed -i '/^#{ip}/d' /etc/hosts\"\n else\n @logger.notify \"IP address not found, skipping to delete hostname from /etc/hosts file\"\n end\n # Stop the container\n container.stop\n sleep 2\n rescue Exception => e\n @logger.warn(\"stop of container #{host} failed: #{e}\")\n end\n @logger.debug(\"delete container #{host}\")\n begin\n container.destroy\n rescue Exception => e\n @logger.warn(\"deletion of container #{host} failed: #{e}\")\n end\n end\n end\n end", "def remove_network_id_from_addresses\n self.addresses.update_all('network_id = NULL')\n end", "def remove(net_or_name)\n command = ['VBoxManage', 'dhcpserver', 'remove']\n if net_or_name.kind_of? VirtualBox::Net\n command.push '--ifname', net_or_name.name\n else\n command.push '--netname', net_or_name\n end\n\n VirtualBox.run_command command\n self\n end", "def clear_forwarded_ports\n end", "def ntp_servers_clear(handle:, ntp_servers: Array.new)\n mo = _get_mo(handle: handle, dn: NTP_DN)\n args = {}\n\n if ntp_servers.size > 0\n NTP_SERVER_LIST.each do |x|\n ntp_server_ip = mo.instance_variable_get(\"@\" + x )\n if ntp_servers.include? ntp_server_ip\n args[x.to_sym] = \"\"\n end\n end\n #args = {x => \"\" for x in NTP_SERVER_LIST if mo.instance_variable_get(\"@\" + x) in ntp_servers}\n else\n NTP_SERVER_LIST.each do |x|\n args[x.to_sym] = \"\"\n end\n end\n\n if [\"yes\", \"true\"].include? mo.ntp_enable.downcase and args.size == NTP_SERVER_LIST.size\n raise ImcOperationError.new(\"Clear NTP Servers\", \"Cannot clear all NTP servers when NTP is enabled\")\n end\n mo.set_prop(:ntp_enable, mo.ntp_enable)\n mo.set_prop_multiple(**args)\n handle.set_mo(mo: mo)\n return handle.query_dn(dn: mo.dn)\nend", "def clean_up(multi_id)\n\t\t\tnet = get_multi_config(multi_id)[:network]\n\t\t\t@redis.del(network_path(net, :sensor, :value, multi_id))\n\t\t\t@redis.del(network_path(net, :actuator, :value, multi_id))\n\t\t\t@redis.del(network_path(net, :sensor, :config, multi_id))\n\t\t\t@redis.del(network_path(net, :actuator, :config, multi_id))\n\t\tend", "def reset\n @config = nil\n @client = nil\n end", "def unhost\n hosts_file_path = '/etc/hosts'\n hosts_file = File.read(hosts_file_path)\n return $stdout.puts 'Pow is not in the host file, and there is no backup file. Please run `powify server host`' unless hosts_file =~ /.+(#powify)/ || File.exists?(\"#{hosts_file_path}.powify.bak\")\n\n hosts_file = hosts_file.split(\"\\n\").delete_if { |row| row =~ /.+(#powify)/ } # remove any existing records\n\n File.open(hosts_file_path, 'w+') { |f| f.puts hosts_file.join(\"\\n\") }\n %x{sudo rm #{hosts_file_path}.powify.bak}\n\n %x{dscacheutil -flushcache}\n $stdout.puts \"All Pow apps were removed from the hosts file.\"\n end", "def cleanup_host(machine_spec)\n if machine_spec.location[\"ip_address\"]\n %x(ssh-keygen -R \"#{machine_spec.location[\"ip_address\"]}\")\n end\n end", "def lbClear _args\n \"lbClear _args;\" \n end", "def destroy_and_undefine\n # Shamb0_TODO_20200609=>POC/WT-bringup\n # old_net = @virt.lookup_network_by_name(@net_name)\n # old_net.destroy if old_net.active?\n # old_net.undefine\n rescue StandardError\n # Nothing to clean up\n end", "def reset\n @config = empty_config\n end", "def clearBackpackCargo _args\n \"clearBackpackCargo _args;\" \n end", "def clear(options)\n if options[:softbin] || options[:softbins]\n store['assigned']['softbin'] = {}\n store['manually_assigned']['softbin'] = {}\n store['pointers']['softbin'] = nil\n store['references']['softbin'] = {}\n end\n if options[:bin] || options[:bins]\n store['assigned']['bin'] = {}\n store['manually_assigned']['bin'] = {}\n store['pointers']['bin'] = nil\n store['references']['bin'] = {}\n end\n if options[:number] || options[:numbers]\n store['assigned']['number'] = {}\n store['manually_assigned']['number'] = {}\n store['pointers']['number'] = nil\n store['references']['number'] = {}\n end\n end", "def reset\n NETWORKS_KEYS.each do |network_key|\n network = {}\n DEFAULT_SETTINGS_KEYS.each do |key|\n network[key] = \"SharingCounter::Configuration::#{default(key)}\".constantize\n end\n INDIVIDUAL_SETTINGS_KEYS.each do |key|\n network[key] = \"SharingCounter::API::#{network_key.to_s.capitalize }::#{ default(key) }\".constantize\n end\n send \"#{network_key}=\", network\n end\n end", "def reset_cli\n self.request.reset\n end", "def reset\n @config = nil\n end", "def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end", "def remove_hosts?(description)\n !description.config.empty? &&\n (description.primary? ||\n description.me_mismatch? ||\n description.hosts.empty? ||\n !member_of_this_set?(description))\n end", "def delete(host)\n\t\tputs \"Remove entry from the local host repository: #{host} \"\n\t\thost=host.strip.downcase\n\t\tif @known_hosts.key?(host)\n\t\t\t@known_hosts.delete(host)\n\t\t\tputs \"Entry cleared.\"\n\t\t\treturn host\n\t\telse\n\t\t\tputs \"Entry not fund. Skip: #{host}\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def destroy!(options={})\n info \"Destroying...\" if verbose?\n servers.each do |server|\n server.destroy\n end\n end", "def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend", "def update(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n entry.hostname = options[:hostname]\n entry.aliases = options[:aliases]\n entry.comment = options[:comment]\n entry.priority = options[:priority]\n\n remove_existing_hostnames(entry) if options[:unique]\n end\n end", "def clear\n @adapter.clear.map { |impression| impression.update(ip: @config.machine_ip) }\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def cmd_reset(*args)\n if args.length > 0\n cmd_reset_help\n return\n end\n client.reset\n end", "def del_host(wspace, address, comm='')\n\t\thost = wspace.hosts.find_by_address_and_comm(address, comm)\n\t\thost.destroy if host\n\tend", "def reset_infrastructure_network_for_testing\n return nil unless infrastructure_networks\n @available_infrastructure_networks = infrastructure_networks.clone\n @allocated_infrastructure_networks = []\n end", "def remove\n unless name.nil?\n dhcp.remove self if dhcp\n VirtualBox.run_command ['VBoxManage', 'hostonlyif', 'remove', name]\n end\n self\n end", "def delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end", "def lnbClear _args\n \"lnbClear _args;\" \n end", "def update_etc_hosts\n comm = machine.communicate\n network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]\n if network_with_hostname\n replace_host(comm, new_hostname, network_with_hostname[:ip])\n else\n add_hostname_to_loopback_interface(comm, new_hostname)\n end\n end", "def clear_tags\n keys_to_remove = extra_config_keys\n\n spec_hash =\n keys_to_remove.map {|key| { :key => key, :value => '' } }\n\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(\n :extraConfig => spec_hash\n )\n @item.ReconfigVM_Task(:spec => spec).wait_for_completion\n end", "def clear(option)\n @client.call('config.unset', option)\n end", "def clear_towers\n Node.destroy_all\n OutConnector.destroy_all\n InConnector.destroy_all\n end", "def clean\n help = [\n '',\n \"Use: #{me} clean\",\n '',\n 'Removes dangling docker images/volumes and exited containers',\n ]\n\n if ARGV[1] == '--help'\n show help\n exit succeeded\n end\n\n unless ARGV[1].nil?\n STDERR.puts \"FAILED: unknown argument [#{ARGV[1]}]\"\n exit failed\n end\n\n command = \"docker images --quiet --filter='dangling=true' | xargs --no-run-if-empty docker rmi --force\"\n run command\n command = \"docker ps --all --quiet --filter='status=exited' | xargs --no-run-if-empty docker rm --force\"\n run command\n\n # TODO: Bug - this removes start-point volumes\n #command = \"docker volume ls --quiet --filter='dangling=true' | xargs --no-run-if-empty docker volume rm\"\n #run command\nend", "def cleanup\n cleanup_primitive full_name, hostname\n wait_for_status name\n end", "def network_config\n return '--net=host' unless @vpn_tunnel\n\n hostname = `hostname`.chomp\n \"--net=container:#{hostname}\"\n end" ]
[ "0.6695341", "0.6572044", "0.6545548", "0.6206237", "0.617071", "0.5949854", "0.5934213", "0.5871286", "0.58433074", "0.57184565", "0.5705588", "0.5698112", "0.5680054", "0.5645454", "0.56192917", "0.5600557", "0.55954653", "0.5586551", "0.5586551", "0.55767447", "0.5560001", "0.55590785", "0.55585843", "0.55555016", "0.5539107", "0.5522547", "0.5501492", "0.549953", "0.5493867", "0.54731244", "0.54731244", "0.54731244", "0.5458581", "0.5454151", "0.54498094", "0.54278725", "0.5418024", "0.541633", "0.5413152", "0.53989166", "0.53967804", "0.5387173", "0.5379727", "0.5365899", "0.53507966", "0.5341514", "0.5326545", "0.53189653", "0.5300065", "0.5297843", "0.5288895", "0.5277337", "0.5272368", "0.5271232", "0.527031", "0.526605", "0.52632576", "0.52613145", "0.52512145", "0.5251034", "0.52473557", "0.5242899", "0.52416056", "0.52223164", "0.52104723", "0.5195008", "0.51870704", "0.51859105", "0.5181377", "0.51679444", "0.51674455", "0.51621646", "0.5153652", "0.5139286", "0.5137912", "0.51368666", "0.51309425", "0.5129069", "0.51283187", "0.5127488", "0.51270324", "0.5122864", "0.5122291", "0.5120686", "0.51204115", "0.51186275", "0.51186275", "0.51129305", "0.51128036", "0.51057655", "0.5105529", "0.50934047", "0.50910825", "0.5090261", "0.5081872", "0.5078383", "0.50720376", "0.5063396", "0.50597703", "0.5056933" ]
0.73461294
0
resolves network configuration hosts argv = commandline arguments, requires the name (n) of the host to resolve (determines its ip address and adds it to the network configuration)
def cmd_resolve_hosts argv setup argv name = @hash['name'] response = @api.resolve_hosts(name) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end", "def network_config\n return '--net=host' unless @vpn_tunnel\n\n hostname = `hostname`.chomp\n \"--net=container:#{hostname}\"\n end", "def resolve_addressing(host)\n @uri = URI.parse(host)\n unless uri.scheme\n @options[:type] = :icmp\n @options[:host] = uri.to_s\n @options[:url] = \"#{@options[:type]}://#{@options[:host]}\"\n return\n end\n @options[:url] = uri.to_s\n @options[:type] = uri.scheme.to_sym\n @options[:port] = uri.port\n @options[:host] = uri.host\n end", "def parse_host\n args = ENV['host'].split(',')\n hosts = []\n args.each do |arg|\n if XP5K::Role.listnames.include? arg\n hosts << roles(arg)\n else\n hosts << arg\n end\n end\n hosts.flatten\nend", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "def resolve_host(host)\n sleep_time = 5\n timeout_at = Time.now + 60\n msg = \"Waiting to resolve hostname '#{host}'; next attempt in #{sleep_time} seconds until #{timeout_at}\"\n resolved_host = \"\"\n wait_until(msg, timeout_at.to_i, sleep_time, {}) do\n resolved_host = `dig +short #{host} | head -n1`.rstrip\n !resolved_host.empty?\n end\n resolved_host\n end", "def resolve(adr)\n adr.ip = program.size\n end", "def address_for(network); end", "def get_host_info(s)\n\n # Prepare response array of aliases (IP and addresses)\n aliases = []\n\n # Get information from the given IP or name\n begin\n resp = Socket.getaddrinfo(s, nil)\n rescue\n aliases << s\n else\n\n fqdn = resp.first[2]\n ip = resp.first[3]\n aliases << fqdn\n\n if fqdn != ip\n host_dom = fqdn.split('.', 2)\n if $local_domain && host_dom.length == 2 && host_dom.last == $local_domain\n aliases << host_dom.first\n end\n aliases << ip\n end\n\n end\n\n return aliases\n\nend", "def resolve!\n Resolv.each_address(host) do |address|\n return @ip = address if address =~ pattern\n end\n end", "def usage()\n puts \"ruby DNS.rb domain-host lookup-host1..lookup-hostN\"\n puts \"e.g. ruby DNS.rb 192.168.0.1 news.bbc.co.uk\"\n puts \"e.g. ruby DNS.rb 192.168.0.1 www.facebook.com www.twitter.com www.instagram.com\"\n exit(0)\nend", "def parse_dns(address)\n fwd_entries={}\n aliases=nil\n begin\n Socket.getaddrinfo(address,nil).each do |addr_struct|\n addr=addr_struct[2]\n ip=addr_struct[3]\n if fwd_entries[addr].nil?\n fwd_entries[addr]=[ip]\n elsif !fwd_entries[addr].include?(ip)\n fwd_entries[addr] << ip\n end\n end\n rescue SocketError =>e\n end\n ret_arr=[]\n if fwd_entries.empty? then\n puts \"[warning] Could not determine an IP address for \\\"#{address}\\\"\"\n else\n fwd_entries.each do |fwd,ips|\n ips.each do |ip|\n ret_arr << {:ip=>ip, :addr=>fwd}\n end\n end\n end\n return ret_arr\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 update_dns()\n #\n # Handle each host in the config file at a time\n #\n @config['hosts'].each {|h|\n #\n # Skip update if current public IP matches the IP for the host in the cache file\n #\n if @cache[h['host']] && @myip.eql?(@cache[h['host']]['ip'])\n @logger.info \"Skipping #{h['host']} - Already pointing to #{@myip}\"\n else\n url = \"https://domains.google.com/nic/update?hostname=#{h['host']}&myip=#{@myip}\"\n @logger.info \"Updating host [#{h['host']}] - #{url}\"\n\n #\n # Access Google Domains API to update IP\n #\n open(url,\n :http_basic_authentication => [h['username'],h['password']],\n \"User-Agent\" => \"#{@options[:user_agent]}\") {|r|\n if r.status[0] == \"200\"\n r.each_line {|line|\n if (/(?<sts>(good|nochg))\\s+(?<ip>(\\d+\\.\\d+\\.\\d+\\.\\d+)?)/ =~ line)\n #\n # Cache if API call was successful\n #\n @cache[h['host']] = {'ip' => ip}\n @logger.debug \"[#{@responses[sts][0]}][#{sts}] : [#{@responses[sts][1]}]\"\n else\n @logger.warn \"[#{@responses[line][0]}][#{line}] : [#{@responses[line][1]}]\"\n end\n }\n else\n @logger.error \"Error status returned #{r.status.inspect}\"\n end\n }\n write_cache_file\n end\n }\n end", "def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend", "def hostname_to_ip hostname\n begin \n ip = Resolv.getaddress(config[:host])\n rescue Resolv::ResolvError => resolv_err\n raise Exception.new(\"Resolver error: #{resolv_err}\")\n end\n return ip\n end", "def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def process_nix(r,ns_opt)\n\t\tr.each_line do |l|\n\t\t\tdata = l.scan(/(\\S*) has address (\\S*)$/)\n\t\t\tif not data.empty?\n\t\t\t\tdata.each do |e|\n\t\t\t\t\tprint_good(\"#{ns_opt} #{e[1]}\")\n\t\t\t\t\treport_host(:host=>e[1], :name=>ns_opt.strip)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def initialize(*args)\n # @TODO@ Should we allow :namesver to be an RRSet of NS records? Would then need to randomly order them?\n @resolver_ruby = nil\n @src_address = nil\n @src_address6 = nil\n @single_res_mutex = Mutex.new\n @configured = false\n @do_caching = true\n @config = Config.new()\n reset_attributes\n\n # Process args\n if args.length == 1\n if args[0].class == Hash\n args[0].keys.each do |key|\n begin\n if key == :config_info\n @config.set_config_info(args[0][:config_info])\n elsif key == :nameserver\n set_config_nameserver(args[0][:nameserver])\n elsif key == :nameservers\n set_config_nameserver(args[0][:nameservers])\n else\n send(key.to_s + '=', args[0][key])\n end\n rescue Exception => e\n Dnsruby.log.error{\"Argument #{key} not valid : #{e}\\n\"}\n end\n end\n elsif args[0].class == String\n set_config_nameserver(args[0])\n elsif args[0].class == Config\n # also accepts a Config object from Dnsruby::Resolv\n @config = args[0]\n end\n else\n # Anything to do?\n end\n update\n end", "def retrieve_resolv_data\n resolv_data = ::File.read(::File.expand_path(::File.join('etc', 'resolv.conf'),'/')).\n split(\"\\n\").\n grep(/^search.*cloudapp.net$/).\n first.\n split.\n fetch(1).\n split('.') || nil rescue nil\n return nil if ((! resolv_data) || (! resolv_data[0]) || (! resolv_data[1]) || (! resolv_data[3]))\n {\n :deployment_id => resolv_data[0],\n :public_hostname => \"#{resolv_data[1]}.cloudapp.net\",\n :location => resolv_data[3]\n }\nend", "def add_forward_lookup(_ip, _hostname)\n end", "def initialize(*args)\r\n arg=args[0]\r\n @packet_timeout = Resolver::DefaultPacketTimeout\r\n @port = Resolver::DefaultPort\r\n @udp_size = Resolver::DefaultUDPSize\r\n @use_tcp = false\r\n @tsig = nil\r\n @ignore_truncation = false\r\n @src_addr = '0.0.0.0'\r\n @src_port = 0\r\n @recurse = true\r\n @persistent_udp = false\r\n @persistent_tcp = false\r\n @dnssec = false\r\n \r\n if (arg==nil)\r\n # Get default config\r\n config = Config.new\r\n @server = config.nameserver[0]\r\n elsif (arg.kind_of?String)\r\n @server=arg\r\n elsif (arg.kind_of?Hash)\r\n arg.keys.each do |attr|\r\n begin\r\n send(attr.to_s+\"=\", arg[attr])\r\n rescue Exception\r\n TheLog.error(\"Argument #{attr} not valid\\n\")\r\n end\r\n # end\r\n end\r\n end\r\n #Check server is IP\r\n @server=Config.resolve_server(@server)\r\n \r\n end", "def initialize(*args)\r\n @resolver_em = nil\r\n @resolver_ruby = nil\r\n @src_address = nil\r\n reset_attributes\r\n \r\n # Process args\r\n if (args.length==1)\r\n if (args[0].class == Hash)\r\n args[0].keys.each do |key|\r\n begin\r\n if (key == :config_info)\r\n @config.set_config_info(args[0][:config_info])\r\n elsif (key==:nameserver)\r\n set_config_nameserver(args[0][:nameserver])\r\n else\r\n send(key.to_s+\"=\", args[0][key])\r\n end\r\n rescue Exception\r\n TheLog.error(\"Argument #{key} not valid\\n\")\r\n end\r\n end\r\n elsif (args[0].class == String)\r\n set_config_nameserver(args[0]) \r\n elsif (args[0].class == Config)\r\n # also accepts a Config object from Dnsruby::Resolv\r\n @config = args[0]\r\n end\r\n else\r\n # Anything to do?\r\n end\r\n if (@single_resolvers==[])\r\n add_config_nameservers\r\n end\r\n update\r\n end", "def main\nusage = 'USAGE : \\'Lookup.rb <domainname> <cidre>\\''\n\n\nsoa = ARGV[0].to_s\ncidre = ARGV[1].to_i\nif ARGV.length != 2 || ARGV[1].to_i == 0 || ARGV[1].to_i > 32\n\tputs usage\n\nelse\n\n\tdatum\n\tip = get_own_ip\n\tget_arpa(cidre,ip)\n\tforward_zone(soa)\n\tarpa = get_arpa(cidre,ip)\n\treverse_zone(soa,arpa)\nend\n\n\t\nend", "def resolve_filename (filename, port)\n s = TCPSocket.open('localhost', port)\n s.puts(\"RESOLVE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n r = s.gets\n values = r.split(\":\")\n server = values[0]\n file = values[1].strip\n s.close\n return server, file\nend", "def parse_argv(argv)\n # Host is always first argument\n host = argv[0]\n\n # Create array for ports\n ports = Array.new\n\n # Ignore the first argument (host), and just traverse the rest\n for i in 1..argv.length - 1\n # If argument contains a hyphen..\n if (argv[i]).include? \"-\"\n # ..split it in two..\n tokens = argv[i].split(\"-\")\n if tokens.length != 2\n # ..if we get more than two tokens, then it's not valid\n puts \"'%s' is not in the form 'number1-number2'\" % argv[i]\n exit(1)\n else\n # ..otherwise, parse both tokens..\n number1 = parse_string_to_port(tokens[0])\n if number1 == -1\n puts \"'%s' is not a valid port number\" % tokens[0]\n exit(1)\n end\n number2 = parse_string_to_port(tokens[1])\n if number2 == -1\n puts \"'%s' is not a valid port number\" % tokens[1]\n exit(1)\n end\n # ..and create the range between number1 and number2\n for j in number1..number2\n # Add the port to the array\n ports.push(j)\n end\n end\n else\n # If there's no hyphen, then just treat the parameter as\n # a single port number\n number = parse_string_to_port(argv[i])\n if number == -1\n puts \"'%s' is not a valid port number\" % argv[i]\n exit(1)\n else\n # Add the port to the array\n ports.push(number)\n end\n end\n end\n\n # Finally, return the host and the port array\n return host, ports\nend", "def resolver(fqdn)\n dns = Resolv.new([Resolv::DNS.new( :nameserver => @resolvers, :search => [] )])\n\n # attempt to get address of fqdn\n x = dns.getaddresses(fqdn)\n rescue Resolv::ResolvError\n # move on\n rescue Errno::ENETUNREACH \n raise DomainError.new \"Host #{fqdn} unreachable\"\n else\n x\n end", "def resolve(hostname)\n return @resolvers.reduce([]) do |memo, resolver|\n result = resolver.resolve(hostname)\n memo += result unless result.nil?\n end\n end", "def resolve( hostname )\n if( not hostname.empty? )\n begin\n return Rex::Socket.addr_itoa( Rex::Socket.gethostbyname( hostname )[3].unpack( 'N' ).first )\n rescue ::SocketError\n return nil\n end\n end\n return nil\n end", "def inventario_portainer()\n $rango_ip = crear_rango_ip($ip_a, $ip_z) \n $rango_ip.each do | ip | \n if portainer?(ip) \n $portainer_hosts.push(ip) \n end\n end\nend", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def build_hosts_list(env_vms)\n\n int_id = 10\n\n first = true\n env_vms.each do |vm, vmconfig|\n vmconfig[\"networks\"].each do |name, netcfg|\n if netcfg[\"type\"] == \"private\" then\n if netcfg['ip'].nil? then\n netcfg['ip'] = \"192.168.50.\" + int_id.to_s\n #add the default IP to the environment definnition\n env_vms[vm][\"networks\"][name][\"ip\"] = \"192.168.50.\" + int_id.to_s\n int_id += 1\n end\n if first then\n $base_vars = \"vms_hosts={\"\n $base_vars << \"\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n first = false\n elsif\n $base_vars << \",\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n end\n end\n end if vmconfig[\"networks\"]\n end\n $base_vars << \"}\" if $base_vars\nend", "def local_ip_2_host (ip)\n\t\tputs \"Reverse DNS lookup from the local host repository\" if @verbose\n\t\tip=ip.strip unless ip.nil?\n\t\tif @known_hosts.key?(ip)\n\t\t\treturn @known_hosts[ip]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def parse_remote_as(config, name)\n value = config.scan(/neighbor #{name} remote-as (\\d+)/)\n remote_as = value[0] ? value[0][0] : nil\n { remote_as: remote_as }\n end", "def resolve_addresses packet # :nodoc:\n source = packet.source @resolver\n source = \"\\\"druby://#{source.sub(/\\.(\\d+)$/, ':\\1')}\\\"\"\n\n destination = packet.destination @resolver\n destination = \"\\\"druby://#{destination.sub(/\\.(\\d+)$/, ':\\1')}\\\"\"\n\n return source, destination\n end", "def add_hostname_to_loopback_interface(comm, name, loop_bound=DEAFAULT_LOOPBACK_CHECK_LIMIT)\n basename = name.split(\".\", 2)[0]\n comm.sudo <<-EOH.gsub(/^ {14}/, '')\n grep -w '#{name}' /etc/hosts || {\n for i in {1..#{loop_bound}}; do\n grep -w \"127.0.${i}.1\" /etc/hosts || {\n echo \"127.0.${i}.1 #{name} #{basename}\" >> /etc/hosts\n break\n }\n done\n }\n EOH\n end", "def host(n=nil)\n if n.nil? \n @host ||= dns_name\n else\n @host = n\n end\n end", "def address_resolve(hostname)\n\t\tif hostname =~ /\\Ascheduler-(.*)/\n\t\t\thostname = $1\n\t\tend\n\t\tsuper(hostname)\n\tend", "def update_etc_hosts\n comm = machine.communicate\n network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]\n if network_with_hostname\n replace_host(comm, new_hostname, network_with_hostname[:ip])\n else\n add_hostname_to_loopback_interface(comm, new_hostname)\n end\n end", "def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end", "def host(name, *parents, &block)\n\t\t\t\tenvironment = merge(name, *parents, &block)\n\t\t\t\t\n\t\t\t\tenvironment[:root] = @root\n\t\t\t\tenvironment[:authority] = name\n\t\t\t\t\n\t\t\t\t@configuration.add(environment.flatten)\n\t\t\tend", "def conn_ip(n_s, n_d)\n nodes_to_addrs2 = File.readlines(ARGV[0])\n #puts \"\\nn_s = \" + n_s + \" n_d = \" + n_d\n \n n_s_ip_lines = nodes_to_addrs2.select{ |line| line =~ /#{n_s}\\s/ }\n #puts \"\\nPRINT N_S LINES\"\n #puts n_s_ip_lines\n\n\n n_s_ip = []\n n_s_ip_lines.each {|line|\n n_s_ip.push line.split[1..2].join('\\t')\n }\n\n #puts \"\\nPRINTING N_S IPs\"\n #puts n_s_ip\n \n\n n_d_ip_lines = nodes_to_addrs2.select { |line| line =~ /#{n_d}\\s/ }\n #puts \"\\nPRINTING N_D LINES\"\n #puts n_d_ip_lines\n\n\n n_d_ip = []\n n_d_ip_lines.each {|line|\n n_d_ip.push line.split[1..2].join('\\t')\n }\n #puts \"\\nPRINTING N_D IPs\"\n #puts n_d_ip\n\n n_s_ip.each{ |s_ip| \n n_d_ip.each{ |d_ip|\n if ((destination_of_addr s_ip) == d_ip)\n #puts \"CONNECTION WITH \" + d_ip\n return d_ip\n end\n }\n }\nend", "def determine_docker_host_for_container_ports\n\n begin\n docker_host = Resolv.getaddress('docker')\n puts \"Host alias for 'docker' found. Assuming container ports are exposed on ip '#{docker_host}'\"\n rescue\n docker_host = Resolv.getaddress(Socket.gethostname)\n puts \"No host alias for 'docker' found. Assuming container ports are exposed on '#{docker_host}'\"\n end\n\n docker_host\n\nend", "def update(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n entry.hostname = options[:hostname]\n entry.aliases = options[:aliases]\n entry.comment = options[:comment]\n entry.priority = options[:priority]\n\n remove_existing_hostnames(entry) if options[:unique]\n end\n end", "def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err \"Could not resolve #{result[:ip]}: #{detail}\"\n end\n result[:ip]\n end", "def test_nil_getaddrinfo\n hostlookup({ 'x' => '1.1.1.1' }, nil)\n end", "def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err _(\"Could not resolve %{ip}: %{detail}\") % { ip: result[:ip], detail: detail }\n end\n result[:ip]\n end", "def host_aliases (host)\n\t\tputs \"Search aliases in the local hosts data repository for host: #{host}\" if @verbose\n\t\thost.strip!\n\t\traise \"Unknown method input: #{host} We expect a FQDN host-name string from you. \" unless is_fqdn?(host)\n\t\taliases=Array.new\n\t\tif @known_hosts.key?(host)\n\t\t\tip=local_host_2_ip(host)\n\t\t\t@known_hosts.keys.map do |key|\n\t\t\t\tmy_ip=local_host_2_ip(key)\n\t\t\t\tif ip == my_ip\n\t\t\t\t\taliases.push(key)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\traise \"Unknown host-name in the local hosts data repository: #{host}\"\n\t\tend\n\t\treturn aliases-[host]\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def simplify_hosts_2(e)\n name = e[\"name\"]\n comps = e[\"components\"]\n [name, comps]\nend", "def inventory_discovery (fileVInventory, fileAInventory, ipMap, groups)\n\n # set proxy if defined in ENV\n proxy = \"\"\n if (ENV.has_key?('HTTP_PROXY'))\n proxy = ENV['HTTP_PROXY']\n end\n if (ENV.has_key?('http_proxy'))\n proxy = ENV['http_proxy']\n end\n\n # Initialize variable to keep track of group name\n groupName = \"\"\n nodeCount = 0\n\n # Read Vagrant inventory file\n File.open(fileVInventory, \"r\") do |f|\n\n # For each line in the inventory file\n f.each_line do |line|\n\n # Remove comments\n line = line.gsub(/#.*/, '')\n\n # If the line has a group name\n if (line =~ /\\[(.*)\\]/)\n\n # Remember the group name\n\tgroupName = $1\n\tnodeCount = 1 \n\n\t# If this group name is not in the hash, then set it up and use defaults\n\tif (!groups.has_key?(groupName))\n\t groups[groupName] = {}\n groups[\"default\"].each do |parameterName, parameter|\n\t groups[groupName][parameterName] = parameter\n end\n if (!(groups[groupName][\":kubernetes_stem\"] == \"true\") && (proxy != \"\"))\n groups[groupName][\":proxy\"] = proxy\n end\n end\n\n # If the line contains an IP address\n elsif (line =~ /:ip\\s+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/)\n\n ipaddrs = line.split(\" \")\n\n\t# Initialize IP address list if needed\n\tif (!groups[groupName].has_key?(\":ip\"))\n\t groups[groupName][\":ip\"] = []\n\tend\n\n # Generate node name\n nodeName = groupName + groups[groupName][\":format\"] % nodeCount\n nodeCount = nodeCount + 1\n\n\t# Record critical information for IP address\n groups[groupName][\":ip\"] << $1\n\tif (!ipMap.has_key?($1))\n\t ipMap[$1] = {}\n if (ipaddrs.length == 3)\n ipMap[$1][\":extip\"] = ipaddrs[2]\n end\n ipMap[$1][\":hostname\"] = nodeName\n\t ipMap[$1][\":box\"] = groups[groupName][\":box\"]\n\t ipMap[$1][\":memory\"] = 0.0\n\t ipMap[$1][\":cores\"] = 0.0\n\t if (!(groups[groupName][\":kubernetes_stem\"] == \"true\"))\n\t if (groups[groupName].has_key?(\":proxy\"))\n\t ipMap[$1][\":proxy\"] = groups[groupName][\":proxy\"]\n\t end\n else\n ipMap[$1][\":kubernetes_stem\"] = groups[groupName][\":kubernetes_stem\"]\n end\n end\n ipMap[$1][\":memory\"] += groups[groupName][\":memory\"].to_f\n ipMap[$1][\":cores\"] += groups[groupName][\":cores\"].to_f\n\n # Generic group information\n elsif (line =~ /(:\\S+)\\s+(\\S+)/)\n\n groups[groupName][$1] = $2\n\n\n end\n\n end\n\n end\n\n # Write Ansible inventory file\n File.open(fileAInventory, \"w\") do |f|\n\n # Find current Vagrant home directory\n vagrantHome = File.dirname(__FILE__)\n\n # Set up the group vars for kubernetes. You must use kubernetes and not \n # mesos_proxy since this will break the proxy env that vagrant\n # sets up.\n top_level_group = 'kubernetes'\n f.puts \"[\" + top_level_group + \":children]\"\n\n flannel_var = '' \n if (groups['default'].has_key?(':flannel_interface'))\n flannel_var = ' flannel_interface=' + groups['default'][':flannel_interface']\n end\n provider = 'virtualbox'\n if (groups['default'].has_key?(':provider'))\n provider = groups['default'][':provider']\n end\n puts \"provider \" + provider\n\n groups.each do |groupName, group|\n if groupName == 'default'\n next\n end\n f.puts groupName\n end\n\n # For each group...\n groups.each do |groupName, group|\n\n # Print out group name\n if (groupName != \"default\")\n f.puts \"[\" + groupName + \"]\"\n end\n\n if (group.has_key?(\":ip\"))\n\n # For each ip address in the group...\n group[\":ip\"].each do |ip|\n\n\t multiple_registry_hosts = \"\"\n if (group.has_key?(\":multiple_registry_hosts\"))\n multiple_registry_hosts = \" multiple_registry_hosts=\" + group[\":multiple_registry_hosts\"]\n end\n\n use_vault_opt = \"\"\n\t if (group.has_key?(\":use_vault\"))\n use_vault_opt = \" use_vault=\" + group[\":use_vault\"]\n end\n\n\t # Generate the inventory entry\n # you need ansible_ssh_user for < 2.0 ansible, which most setups in picasso group\n # is using currently\n line = ipMap[ip][\":hostname\"] + \" ansible_ssh_host=\" + ip +\n\t \" ansible_ssh_user=vagrant ansible_user=vagrant ansible_ssh_private_key_file=\" +\n vagrantHome + \"/.vagrant/machines/\" + ipMap[ip][\":hostname\"] + \"/\" + provider + \"/private_key\" +\n multiple_registry_hosts + flannel_var + use_vault_opt\n\n f.puts line\n\n end\n\n end\n\n f.puts \"\"\n\n end\n\n end\n\nend", "def resolve_hostname_on(host, hostname)\n match = curl_on(host, \"--verbose #{hostname}\", accept_all_exit_codes: true).stderr.match(ipv4_regex)\n match ? match[0] : nil\n end", "def host=(_arg0); end", "def host=(_arg0); end", "def nameserver_config\n return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC']\n\n address, port = ENV['MM_DNSRC'].split(/:/)\n\n {\n nameserver_port: [[address, port.to_i]]\n }\n rescue StandardError\n {}\n end", "def resolve_alias(addresses, ipvers)\n addresses = [addresses] unless addresses.is_a?(Array)\n result = []\n addresses.each do |address|\n if address =~ /^([\\w\\-]+)$/\n if aliases[address]\n result += select_ipvers(aliases[address], ipvers)\n else\n raise \"Alias is not defined: #{address}\"\n end\n else\n result += select_ipvers(address, ipvers)\n end\n end\n result\n end", "def host(i)\n \"node#{i}\"\nend", "def dns_check\n gen_host_records # These are the hosts we have\n load_all_subnets # These are the DNS entries\n \n # We want a standard layout, with the hypervisor API entries being \n @host_record.each do |hr| # Array of host record Hash's\n hn = hr[:hostname]\n shn = hn.split('.',2)[0] # Remove the domain\n forward_hr = @forward_host_record[hn] # Find Host Record\n if forward_hr.nil?\n # We have no IPAM entry for this hostname\n if (rhr = @reverse_host_records[hr[:ip]])\n puts \"Only Reverse IPAM entry for #{shn}: #{rhr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n else\n puts \"No IPAM entry for hostrecord: #{hr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n end\n else\n # We have an IPAM record for this hostname\n if forward_hr[:ip] != hr[:ip]\n puts \"IP mismatch #{shn} #{hr[:ip]} != #{forward_hr[:ip]} for IPAM: #{forward_hr}\"\n elsif forward_hr[:hostname] != hn\n # Reference must be via ALIASES or CNAMES\n if forward_hr[:aliases].include?(shn)\n puts \"Hostname #{shn} is an ALIAS. IPAM: #{forward_hr}\"\n elsif forward_hr[:cnames].include?(hn)\n puts \"Hostname #{shn} is a CNAME. IPAM: #{forward_hr}\"\n end\n end\n end\n end\n \n # We want to find IPAM entries, not matching existing @host_record entries\n @reverse_host_records.each do |ip, ahr| # Hash to array of host records from IPAM, indexed by IP\n ahr.each do |hr| # One IP can have multiple host records, with associated ALIAS and CNAME records\n local_hr = @host_record_index[hr[:hostname]]\n if local_hr.nil?\n puts \"No local entry #{hr[:hostname]} for #{hr}\"\n end\n end\n end\nend", "def load_known_hosts_from_file (f_hosts=@hosts_file)\n\t\tputs \"Loading local hosts from file: #{f_hosts} ...\" if @verbose\n\t\tknown_hosts=Hash.new\n\t\t@alias = Hash.new\n\t\tFile.write(f_hosts, \"\") unless File.exist?(f_hosts)\n\t\tf=File.open(f_hosts, 'r')\n\t\tf.each do |line|\n\t\t\tnext unless line =~ /\\d+\\.\\d+\\.\\d+\\.\\d+/\n\t\t\tentry=line.chomp.split(%r{\\t+|\\s+|\\,})\n\t\t\tkey=entry[0].downcase\n\t\t\tvalue=entry[1]\n\t\t\tputs \"Loading key value pair: #{key} - #{value}\" if @verbose\n\t\t\tknown_hosts[key] = Hash.new unless known_hosts.key?(key)\n\t\t\tknown_hosts[key]= value\n\t\t\t# For reverse host lookup\n\t\t\tknown_hosts[value] = Hash.new unless known_hosts.key?(value)\n\t\t\tknown_hosts[value] = key\n\t\t\t# Count the number of alias for the recorded IP\n\t\t\tif @alias.key?(value)\n\t\t\t\t@alias[value]+=1\n\t\t\telse\n\t\t\t\t@alias[value]=1\n\t\t\tend\n\t\tend\n\t\tf.close\n\t\treturn known_hosts\n\t\t#rescue => ee\n\t\t#\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\t#\treturn known_hosts\n\tend", "def run_host(ip)\n begin\n\n epm = dcerpc_endpoint_list()\n if(not epm)\n print_status(\"Could not contact the endpoint mapper on #{ip}\")\n return\n end\n\n eports = {}\n\n epm.each do |ep|\n next if !(ep[:port] and ep[:prot] and ep[:prot] == \"tcp\")\n eports[ep[:port]] ||= {}\n eports[ep[:port]][ep[:uuid]+'_'+ep[:vers]] = true\n end\n\n eports.each_pair do |eport, servs|\n\n rport = eport\n print_status(\"Looking for services on #{ip}:#{rport}...\")\n\n ids = dcerpc_mgmt_inq_if_ids(rport)\n next if not ids\n\n ids.each do |id|\n if (not servs.has_key?(id[0]+'_'+id[1]))\n print_status(\"\\tHIDDEN: UUID #{id[0]} v#{id[1]}\")\n\n conn = nil\n bind = nil\n call = nil\n data = nil\n error = nil\n begin\n connect(true, { 'RPORT' => eport })\n conn = true\n\n handle = dcerpc_handle(id[0], id[1], 'ncacn_ip_tcp', [eport])\n dcerpc_bind(handle)\n bind = true\n\n res = dcerpc.call(0, NDR.long(0) * 128)\n call = true\n\n if (dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil)\n data = dcerpc.last_response.stub_data\n end\n\n rescue ::Interrupt\n raise $!\n rescue ::Exception => e\n error = e.to_s\n end\n\n if (error and error =~ /DCERPC FAULT/ and error !~ /nca_s_fault_access_denied/)\n call = true\n end\n\n status = \"\\t\\t\"\n status << \"CONN \" if conn\n status << \"BIND \" if bind\n status << \"CALL \" if call\n status << \"DATA=#{data.unpack(\"H*\")[0]} \" if data\n status << \"ERROR=#{error} \" if error\n\n print_status(status)\n print_status(\"\")\n\n ## Add Report\n report_note(\n :host => ip,\n :proto => 'tcp',\n :port => datastore['RPORT'],\n :type => \"DCERPC HIDDEN: UUID #{id[0]} v#{id[1]}\",\n :data => status\n )\n\n end\n end\n end\n\n rescue ::Interrupt\n raise $!\n rescue ::Exception => e\n print_status(\"Error: #{e}\")\n end\n end", "def test_resolver_converts_ipaddrs_array\n @parser.log_reader\n assert_equal @parser.ipaddrs_q.size, 12\n assert_equal @parser.records_q.size, 12\n @parser.resolve_names\n assert_equal @parser.domains_hash.map { |k,v| [ k, v[0] ] }.sort, [\n [\"208.77.188.166\", \"www.example.com\"],\n [\"74.125.67.100\", \"gw-in-f100.google.com\"],\n [\"75.119.201.189\", \"apache2-moon.legs.dreamhost.com\"],\n [\"75.146.57.34\", \"greed.zenspider.com\"]\n]\n end", "def setup_dns(node)\n # Set up /etc/hosts\n node.vm.provision \"setup-hosts\", :type => \"shell\", :path => \"ubuntu/vagrant/setup-hosts.sh\" do |s|\n s.args = [\"enp0s8\", node.vm.hostname]\n end\n # Set up DNS resolution\n node.vm.provision \"setup-dns\", type: \"shell\", :path => \"ubuntu/update-dns.sh\"\nend", "def hosts_entry\n \"#{@ip} #{name}\"\n end", "def build_hostname_list(unique, hosts)\n hostnames = []\n if $stdin.tty?\n # reading hostnames from command line\n hosts.each do |hostname|\n hostnames.push(ServerData.to_hostname(hostname))\n end\n else\n # reading hostnames from a pipe\n STDIN.each do |hostname|\n if hostname != \"\\n\"\n hostname.chomp!\n hostnames.push(ServerData.to_hostname(hostname))\n end\n end\n end\n\n # remove duplicate hostnames\n if unique\n hostnames.uniq!\n end\n hostnames\n end", "def get_host( name )\n @hosts[ name ]\n end", "def format_hosts\n all_hosts.inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def reverse_dns_delegation_entries(name_servers, opts = {})\n # Validation\n if version == 4 && cidr_obj.bits <= 24\n return \"Not supported: address block too larger (/24 or larger)\"\n end\n\n if version == 6 && cidr_obj.bits != 48\n return \"Not supported: address block not equal to /48\"\n end\n\n name_servers = [name_servers].flatten # Make into array\n\n entry = ''\n\n if version == 6\n third_part = cidr_obj.to_s(:Short => true).\\\n sub(/^([0-9a-f]+:){2}(.*)::\\/48$/i, '\\2')\n record = third_part.reverse.gsub(/(.)/, '\\1.').chop\n\n name_servers.each do |name_server|\n entry += \"#{record} IN NS #{name_server}.\\n\"\n end\n end\n\n if version == 4\n first = cidr_obj.first.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n last = cidr_obj.last.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n\n entry = \"; BEGIN: RFC 2317 sub-Class C delegation\\n\"\n entry += \";\\n\"\n\n first_time_in_loop = true\n name_servers.each do |name_server|\n if first_time_in_loop\n entry += \"#{first}-#{last}\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n else\n entry += \"\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n end\n\n first_time_in_loop = false\n end\n\n entry += \";\\n\"\n\n begin_at = first.to_i + 2\n end_at = last.to_i - 1\n\n (begin_at..end_at).each do |ip|\n entry += \"#{ip}\\t\\tIN\\tCNAME\\t#{ip}.#{rfc2317_zone_name}.\\n\"\n end\n\n entry += \";\\n\"\n entry += \"; END\\n\"\n end\n\n entry\n end", "def determine_hosts\n if [:deploy_hook, :instant_trace].include?(type)\n config.value('direct_host')\n elsif [:errors].include?(type)\n config.value('errors_host')\n else\n config.value('host')\n end\n end", "def resolve(node)\n begin\n Timeout::timeout(@timeout) do\n Resolv.each_address(host) do |ip|\n if ip =~ Resolv::IPv4::Regex\n @ip ||= ip\n break\n end\n end\n raise Resolv::ResolvError unless @ip\n end\n @resolved ||= \"#{ip}:#{port}\"\n rescue Timeout::Error, Resolv::ResolvError\n Loggable.warn(\" MOPED:\", \"Could not resolve IP for: #{original}\", \"n/a\")\n node.down! and false\n end\n end", "def frwdlp(session,hostlst,domain,dest)\n\tdest = dest + \"-DNS-forward-lookup.txt\"\n\tprint_status(\"Performing DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tfilewrt(dest,\"DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tresult = []\n\tthreads = []\n\ttmpout = []\n\tbegin\n\tif ::File.exists?(hostlst)\n\t\t::File.open(hostlst).each {|line|\n \t\t\tthreads << ::Thread.new(line) { |h|\n \t\t\t#print_status(\"checking #{h.chomp}\")\n\t\t \tr = session.sys.process.execute(\"nslookup #{h.chomp}.#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n \t\t \twhile(d = r.channel.read)\n \t\t\tif d =~ /(Name)/\n \t\t\t\td.scan(/Name:\\s*\\S*\\s*Address\\w*:\\s*.*?.*?.*/) do |n|\n \t\t\t\ttmpout << n.split\n \t\t\tend\n \t\t\tbreak\n \t\tend\n end\n\n r.channel.close\n r.close\n\t\t\t}\n\t\t}\n\tthreads.each { |aThread| aThread.join }\n\ttmpout.uniq.each do |t|\n \tprint_status(\"\\t#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n \tfilewrt(dest,\"#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n end\n\n\telse\n\t\tprint_status(\"File #{hostlst}does not exists!\")\n\t\texit\n\tend\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend", "def resolve_fqdn\n hostname = from_cmd(\"hostname\")\n addrinfo = Socket.getaddrinfo(hostname, nil).first\n iaddr = IPAddr.new(addrinfo[3])\n Socket.gethostbyaddr(iaddr.hton)[0]\n rescue\n nil\n end", "def addr_list_from_inventory_file(inventory_file, group_name)\n inventory_str = `./common-utils/inventory/static/hostsfile.py --filename #{inventory_file} --list`\n inventory_json = JSON.parse(inventory_str)\n inventory_group = inventory_json[group_name]\n # if we found a corresponding group in the inventory file, then\n # return the hosts list in that group, otherwise, return the keys\n # in the 'hostvars' hash map under the '_meta' hash map\n (inventory_group ? inventory_group['hosts'] : inventory_json['_meta']['hostvars'].keys)\nend", "def addr_list_from_inventory_file(inventory_file, group_name)\n inventory_str = `./common-utils/inventory/static/hostsfile.py --filename #{inventory_file} --list`\n inventory_json = JSON.parse(inventory_str)\n inventory_group = inventory_json[group_name]\n # if we found a corresponding group in the inventory file, then\n # return the hosts list in that group, otherwise, return the keys\n # in the 'hostvars' hash map under the '_meta' hash map\n (inventory_group ? inventory_group['hosts'] : inventory_json['_meta']['hostvars'].keys)\nend", "def index\n cmd = `cd ../dispatch-proxy/bin; node dispatch.js list`\n @networks = JSON.parse(cmd).select { |network| network['address'] =~ /\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/ } - [{\"name\"=>\"lo0\", \"address\"=>\"127.0.0.1\"}]\n # @networks.each { |n| puts \"#{n}\" }\n\n all_network_services = `networksetup -listallnetworkservices `.to_s.split(/\\r?\\n/)[1..-1] # Ignore the first line which describes about the command\n # puts \"All Services #{all_network_services}\"\n \n all_network_services_info = all_network_services.collect do |service| \n info_command = \"networksetup -getinfo '#{service}'\"\n info = `#{info_command}`.to_s.split(/\\r?\\n/)\n info.each_with_object({'name' => service}) { |str, hash| key_value = str.split(':', 2); hash[key_value.first] = key_value.last.strip }\n end\n # puts \"All Services Info #{all_network_services_info}\"\n\n @networks.each do |network|\n matching_network = all_network_services_info.find { |n| n['IP address'] == network['address'] }\n network['full_name'] = matching_network ? matching_network['name'] : network['name']\n end\n end", "def Chef_Solo_IPs *args\n Chef_Solo_Nodes(*args).map { |h| \n u = h['user'] || h['login']\n a = h['ipaddress'] || h['hostname'] \n p = h['port'] \n\n final = [u, a].compact.join('@')\n final = [final, p].compact.join(':')\n final\n }\nend", "def dns; settings.components.dns.config end", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def expand_nmap(arg)\n\t\t# Can't really do anything with IPv6\n\t\treturn false if arg.include?(\":\")\n\n\t\t# nmap calls these errors, but it's hard to catch them with our\n\t\t# splitting below, so short-cut them here\n\t\treturn false if arg.include?(\",-\") or arg.include?(\"-,\")\n\n\t\tbytes = []\n\t\tsections = arg.split('.')\n\t\tif sections.length != 4\n\t\t\t# Too many or not enough dots\n\t\t\treturn false\n\t\tend\n\t\tsections.each { |section|\n\t\t\tif section.empty?\n\t\t\t\t# pretty sure this is an unintentional artifact of the C\n\t\t\t\t# functions that turn strings into ints, but it sort of makes\n\t\t\t\t# sense, so why not\n\t\t\t\t# \"10...1\" => \"10.0.0.1\"\n\t\t\t\tsection = \"0\"\n\t\t\tend\n\n\t\t\tif section == \"*\"\n\t\t\t\t# I think this ought to be 1-254, but this is how nmap does it.\n\t\t\t\tsection = \"0-255\"\n\t\t\telsif section.include?(\"*\")\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\t# Break down the sections into ranges like so\n\t\t\t# \"1-3,5-7\" => [\"1-3\", \"5-7\"]\n\t\t\tranges = section.split(',', -1)\n\t\t\tsets = []\n\t\t\tranges.each { |r| \n\t\t\t\tbounds = []\n\t\t\t\tif r.include?('-')\n\t\t\t\t\t# Then it's an actual range, break it down into start,stop\n\t\t\t\t\t# pairs:\n\t\t\t\t\t# \"1-3\" => [ 1, 3 ]\n\t\t\t\t\t# if the lower bound is empty, start at 0\n\t\t\t\t\t# if the upper bound is empty, stop at 255\n\t\t\t\t\t#\n\t\t\t\t\tbounds = r.split('-', -1)\n\t\t\t\t\treturn false if (bounds.length > 2)\n\n\t\t\t\t\tbounds[0] = 0 if bounds[0].nil? or bounds[0].empty?\n\t\t\t\t\tbounds[1] = 255 if bounds[1].nil? or bounds[1].empty?\n\t\t\t\t\tbounds.map!{|b| b.to_i}\n\t\t\t\t\treturn false if bounds[0] > bounds[1]\n\t\t\t\telse\n\t\t\t\t\t# Then it's a single value\n\t\t\t\t\tbounds[0] = r.to_i\n\t\t\t\tend\n\t\t\t\treturn false if bounds[0] > 255 or (bounds[1] and bounds[1] > 255)\n\t\t\t\treturn false if bounds[1] and bounds[0] > bounds[1]\n\t\t\t\tif bounds[1]\n\t\t\t\t\tbounds[0].upto(bounds[1]) do |i| \n\t\t\t\t\t\tsets.push(i)\n\t\t\t\t\tend\n\t\t\t\telsif bounds[0]\n\t\t\t\t\tsets.push(bounds[0])\n\t\t\t\tend\n\t\t\t}\n\t\t\tbytes.push(sets.sort.uniq)\n\t\t}\n\n\t\t#\n\t\t# Combinitorically squish all of the quads together into a big list of\n\t\t# ip addresses, stored as ints\n\t\t#\n\t\t# e.g.: \n\t\t# [[1],[1],[1,2],[1,2]] \n\t\t# => \n\t\t# [atoi(\"1.1.1.1\"),atoi(\"1.1.1.2\"),atoi(\"1.1.2.1\"),atoi(\"1.1.2.2\")]\n\t\taddrs = []\n\t\tfor a in bytes[0]\n\t\t\tfor b in bytes[1]\n\t\t\t\tfor c in bytes[2]\n\t\t\t\t\tfor d in bytes[3]\n\t\t\t\t\t\tip = (a << 24) + (b << 16) + (c << 8) + d\n\t\t\t\t\t\taddrs.push ip\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\taddrs.sort!\n\t\taddrs.uniq!\n\t\trng = Range.new\n\t\trng.start = addrs[0]\n\t\tranges = []\n\t\t1.upto(addrs.length - 1) do |idx|\n\t\t\tif addrs[idx - 1] + 1 == addrs[idx]\n\t\t\t\t# Then this address is contained in the current range\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\t# Then this address is the upper bound for the current range\n\t\t\t\trng.stop = addrs[idx - 1]\n\t\t\t\tranges.push(rng.dup)\n\t\t\t\trng.start = addrs[idx]\n\t\t\tend\n\t\tend\n\t\trng.stop = addrs[addrs.length - 1]\n\t\tranges.push(rng.dup)\n\t\treturn ranges\n\tend", "def host_2_ips (hostname)\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tips.push(hostname)\n\t\t\t\treturn ips\n\t\t\telse\n\t\t\t\tips = Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\treturn ips\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ips for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def update_network_adapter(ip, tld)\n # Need to defer loading to ensure cross OS compatibility\n require 'win32/registry'\n if admin_mode?\n network_name = get_network_name(ip)\n if network_name.nil?\n info(\"unable to determine network interface for #{ip}. DNS on host cannot be configured. Try manual configuration.\")\n return\n else\n info(\"adding Landrush'es DNS server to network '#{network_name}' using DNS IP '#{ip}'' and search domain '#{tld}'\")\n end\n network_guid = get_guid(network_name)\n if network_guid.nil?\n info(\"unable to determine network GUID for #{ip}. DNS on host cannot be configured. Try manual configuration.\")\n return\n end\n interface_path = INTERFACES + \"\\\\{#{network_guid}}\"\n Win32::Registry::HKEY_LOCAL_MACHINE.open(interface_path, Win32::Registry::KEY_ALL_ACCESS) do |reg|\n reg['NameServer'] = '127.0.0.1'\n reg['Domain'] = tld\n end\n else\n run_with_admin_privileges(__FILE__.to_s, ip, tld)\n end\n end", "def parse_hostname(config)\n mdata = /(?<=^hostname\\s)(.+)$/.match(config)\n { hostname: mdata.nil? ? '' : mdata[1] }\n end", "def parse_name_servers\n servers = config.scan(/(?:ip name-server vrf )(?:\\w+)\\s(.+)/)\n values = servers.each_with_object([]) { |srv, arry| arry << srv.first }\n { name_servers: values }\n end", "def scanWarp(command = 'arp -a')\n self.hosts = [] \n lines = IO.popen(command)\n lines.each do |sys|\n if sys.count(' ') == 6\n m = sys.split\n ip = \"#{m[1].sub(/\\((.*)\\)/,'\\1')}\"\n mac = \"#{m[3]}\"\n iface = \"#{m[6]}\"\n hosts.push(Host.new(ip, \"host#{ip}\", mac, iface, \"ping\", \"nmap\"))\n end\n end\n end", "def ip_addresses( hostname )\n @@resolve ||= Resolv.new\n @@ip_addresses_cached ||= {}\n\n @@ip_addresses_cached[hostname.to_s] ||= @@resolve.getaddresses( hostname )\n end", "def configHost\n unless File.open('nagios.cfg').read() =~ /hosts.cfg/ && File.open('nagios.cfg').read() =~ /services.cfg/\n\tcfg = File.read('nagios.cfg')\n\tcfg = cfg.gsub(/templates.cfg/, \"templates.cfg\\ncfg_file=/usr/local/nagios/etc/hosts.cfg\\ncfg_file=/usr/local/nagios/etc/services.cfg\")\n\tFile.open('nagios.cfg', 'w') { |file| file.puts cfg }\n end\n File.open('hosts.cfg', 'a+') { |file|\n\tfile.puts \"define host{\\nname\\t\\t\\tlinux-box\\nuse\\t\\t\\tgeneric-host\\ncheck_period\\t\\t24x7\\ncheck_interval\\t\\t5\\nretry_interval\\t\\t1\\nmax_check_attempts\\t10\\ncheck_command\\t\\tcheck-host-alive\\nnotification_period\\t24x7\\nnotification_interval\\t30\\nnotification_options\\td,r\\ncontact_groups\\t\\tadmins\\nregister\\t\\t\\t0\\n}\\n\" unless File.open('hosts.cfg').read() =~ /name\\t\\t\\tlinux-box/\n\t@names.length.times do |x|\n\t file.puts \"define host{\\nuse\\t\\t\\tlinux-box\\nhost_name\\t\\t#{@names[x]}\\nalias\\t\\t\\t#{@names[x]}\\naddress\\t\\t\\t#{@ips[x]}\\n}\\n\\n\"\n\tend\n }\n File.open('services.cfg', 'a') { |file| \n @names.length.times do |x|\n file.puts \"define service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCPU Load\\n\\tcheck_command\\t\\tcheck_nrpe!check_load\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tTotal Processes\\n\\tcheck_command\\t\\tcheck_nrpe!check_total_procs\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCurrent Users\\n\\tcheck_command\\t\\tcheck_nrpe!check_users\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tSSH\\n\\tcheck_command\\t\\tcheck_ssh\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tPING\\n\\tcheck_command\\t\\tcheck_ping!100.0,20%!500.0,60%\\n}\\n\\n\" \n end\n }\n end", "def initialize(resolvers=[Hosts.new, DNS.new])\n @resolvers = resolvers\n end", "def discover_from_ips(ips)\n ip = ips.first\n if @leader = get(ip, \"/v1/status/leader\")\n @leader =~ /\"(.*):(\\d+)\"/\n @leader, @cluster_port = $1, $2\n @peers = JSON.parse(get(ip, \"/v1/status/peers\"))\n @peers.map! do |peer|\n peer =~ /(.*):(\\d+)/\n $1\n end\n end\n end", "def moped_arguments\n [hosts, options]\n end", "def forward_port\n if `ssh docker@192.168.99.100 pwd`.strip != '/home/docker'\n puts Ow::red(\"* Make sure that you can ssh into docker machine.\")\n exit 2\n end\n\n name = args[1]\n ip = @instances\n .select { |i| i.container_name.include?(name) }\n .map { |i| i.container_ip }\n .first\n ports_map = args[2..args.length].each_slice(2).map do |src, dest|\n \"-L #{src}:#{ip}:#{dest}\"\n end.join(\" \")\n forward_cmd = \"ssh -nNT #{ports_map} docker@192.168.99.100\"\n puts Ow::yellow(\"> Will forward with command: \\n#{forward_cmd}\")\n exec(forward_cmd)\n end", "def remote_addr=(_arg0); end", "def configure(dry_run = false)\n changes = 0\n prefix = self.prefix # prevent exists? check on each use\n\n local_primary, *local_aliases = local_ips\n meta_primary, *meta_aliases = meta_ips\n\n # ensure primary ip address is correct\n if name != 'eth0' && local_primary != meta_primary\n unless dry_run\n deconfigure\n cmd(\"addr add #{meta_primary}/#{prefix} brd + dev #{name}\")\n end\n changes += 1\n end\n\n # add missing secondary ips\n (meta_aliases - local_aliases).each do |ip|\n cmd(\"addr add #{ip}/#{prefix} brd + dev #{name}\") unless dry_run\n changes += 1\n end\n\n # remove extra secondary ips\n (local_aliases - meta_aliases).each do |ip|\n cmd(\"addr del #{ip}/#{prefix} dev #{name}\") unless dry_run\n changes += 1\n end\n\n # add and remove source-ip based rules\n unless name == 'eth0'\n rules_to_add = meta_ips || []\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*\\s([0-9\\.]+)\\s+lookup #{route_table}/) do\n unless rules_to_add.delete($2)\n cmd(\"rule delete pref #{$1}\") unless dry_run\n changes += 1\n end\n end\n rules_to_add.each do |ip|\n cmd(\"rule add from #{ip} lookup #{route_table}\") unless dry_run\n changes += 1\n end\n end\n\n @clean = nil\n changes\n end", "def __rebuild_connections(arguments={})\n @hosts = arguments[:hosts] || []\n @options = arguments[:options] || {}\n __close_connections\n @connections = __build_connections\n end", "def run\n super\n\n # Allow the user to set the port ranges\n #ports = _get_option \"ports\"\n\n # Get range, or host\n to_scan = _get_entity_attribute \"name\"\n\n # Create a tempfile to store results\n temp_file = \"#{Dir::tmpdir}/nmap_scan_#{rand(100000000)}.xml\"\n\n # Check to see if nmap is in the path, and raise an error if not\n return \"Unable to find nmap\" unless _unsafe_system(\"sudo nmap\") =~ /http:\\/\\/nmap.org/\n\n\n # Check for IPv6\n # XXX - SECURITY!\n nmap_options = \"\"\n nmap_options << \"-6 \" if to_scan =~ /:/\n #nmap_options << \"-p #{ports}\" if ports\n\n # shell out to nmap and run the scan\n @task_log.log \"Scanning #{to_scan} and storing in #{temp_file}\"\n @task_log.log \"NMap options: #{nmap_options}\"\n nmap_string = \"nmap #{to_scan} #{nmap_options} -P0 --top-ports 100 --min-parallelism 10 -oX #{temp_file}\"\n @task_log.log \"Running... #{nmap_string}\"\n _unsafe_system(nmap_string)\n\n # Gather the XML and parse\n #@task_log.log \"Raw Result:\\n #{File.open(temp_file).read}\"\n @task_log.log \"Parsing #{temp_file}\"\n\n parser = ::Nmap::Parser.parsefile(temp_file)\n\n # Create entities for each discovered service\n parser.hosts(\"up\") do |host|\n\n @task_log.log \"Handling nmap data for #{host.addr}\"\n\n # Handle the case of a netblock or domain - where we will need to create host entity(s)\n if @entity[\"type\"] == \"NetBlock\" or @entity[\"type\"] == \"DnsRecord\"\n host_entity = _create_entity(\"IpAddress\", { :name => host.addr } )\n else\n host_entity = @entity # We already have a host\n end\n\n [:tcp, :udp].each do |proto_type|\n\n host.getports(proto_type, \"open\") do |port|\n\n # Create a NetSvc for each open port\n entity = _create_entity(\"NetSvc\", {\n :name => \"#{host.addr}:#{port.num}/#{port.proto}\",\n :ip_address => \"#{host.addr}\",\n :port_num => port.num,\n :proto => port.proto,\n :fingerprint => \"#{port.service.name}\"})\n\n # Go ahead and create webapps if this is a known webapp port\n if entity.attributes[:proto] == \"tcp\" &&\n [80,443,8080,8081,8443].include?(entity.attributes[:port_num])\n\n # determine if this is an SSL application\n ssl = true if [443,8443].include?(entity.attributes[:port_num])\n protocol = ssl ? \"https://\" : \"http://\" # construct uri\n uri = \"#{protocol}#{host.addr}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri, :uri => uri ) # create an entity\n\n # and create the entities if we have dns\n host.hostnames.each do |hostname|\n uri = \"#{protocol}#{hostname}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri )\n end\n\n end # end if\n\n end # end host.getports\n end # end tcp/udp\n end # end parser\n\n # Clean up!\n begin\n File.delete(temp_file)\n rescue Errno::EPERM\n @task_log.error \"Unable to delete file\"\n end\n\n end", "def report_host(opts)\n\n return if !active\n addr = opts.delete(:host) || return\n\n # Sometimes a host setup through a pivot will see the address as \"Remote Pipe\"\n if addr.eql? \"Remote Pipe\"\n return\n end\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone\n opts.delete(:workspace)\n\n begin\n retry_attempts ||= 0\n if !addr.kind_of? ::Mdm::Host\n addr = Msf::Util::Host.normalize_host(addr)\n\n unless ipv46_validator(addr)\n raise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n end\n\n conditions = {address: addr}\n conditions[:comm] = opts[:comm] if !opts[:comm].nil? && opts[:comm].length > 0\n host = wspace.hosts.where(conditions).first_or_initialize\n else\n host = addr\n end\n\n ostate = host.state\n\n # Truncate the info field at the maximum field length\n if opts[:info]\n opts[:info] = opts[:info][0,65535]\n end\n\n # Truncate the name field at the maximum field length\n if opts[:name]\n opts[:name] = opts[:name][0,255]\n end\n\n if opts[:os_name]\n os_name, os_flavor = split_windows_os_name(opts[:os_name])\n opts[:os_name] = os_name if os_name.present?\n if opts[:os_flavor].present?\n if os_flavor.present? # only prepend if there is a value that needs it\n opts[:os_flavor] = os_flavor + opts[:os_flavor]\n end\n else\n opts[:os_flavor] = os_flavor\n end\n end\n\n opts.each do |k,v|\n if host.attribute_names.include?(k.to_s)\n unless host.attribute_locked?(k.to_s)\n host[k] = v.to_s.gsub(/[\\x00-\\x1f]/n, '')\n end\n elsif !v.blank?\n dlog(\"Unknown attribute for ::Mdm::Host: #{k}\")\n end\n end\n host.info = host.info[0,::Mdm::Host.columns_hash[\"info\"].limit] if host.info\n\n # Set default fields if needed\n host.state = Msf::HostState::Alive if host.state.nil? || host.state.empty?\n host.comm = '' unless host.comm\n host.workspace = wspace unless host.workspace\n\n begin\n framework.events.on_db_host(host) if host.new_record?\n rescue => e\n wlog(\"Exception in on_db_host event handler: #{e.class}: #{e}\")\n wlog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n end\n\n host_state_changed(host, ostate) if host.state != ostate\n\n if host.changed?\n msf_import_timestamps(opts, host)\n host.save!\n end\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n # two concurrent report requests for a new host could result in a RecordNotUnique or\n # RecordInvalid exception, simply retry the report once more as an optimistic approach\n retry if (retry_attempts+=1) <= 1\n raise\n end\n\n if opts[:task]\n Mdm::TaskHost.create(\n :task => opts[:task],\n :host => host\n )\n end\n\n host\n }\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def host_2_ip (hostname)\n\t\tputs \"Perform DNS query on host: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tputs \"No change - same IP is returned. \" if @verbose\n\t\t\t\treturn hostname.strip\n\t\t\telse\n\t\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tputs \"IP found: #{ips.first}\" if @verbose\n\t\t\t\t\treturn ips.first.strip\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ip for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def run_lookup(argv = ARGV)\n lng = argv[1].to_f\n lat = argv[2].to_f\n\n res = dstk.coordinates2politics([lat, lng])\n nbh = res[0]['politics'].select { |r| r['friendly_type'] == 'neighborhood'}\n puts \"#{lng},#{lat},#{nbh.first['name']}\"\n end", "def parse(parseme)\n\t\treturn nil if not parseme\n\t\tranges = []\n\t\tparseme.split(', ').map{ |a| a.split(' ') }.flatten.each { |arg|\n\t\t\tif arg.include?(\"/\")\n\t\t\t\t# Then it's CIDR notation and needs special case\n\t\t\t\treturn false if arg =~ /[,-]/ # Improper CIDR notation (can't mix with 1,3 or 1-3 style IP ranges)\n\t\t\t\treturn false if arg.scan(\"/\").size > 1 # ..but there are too many slashes\n\t\t\t\tip_part,mask_part = arg.split(\"/\")\n\t\t\t\treturn false if ip_part.nil? or ip_part.empty? or mask_part.nil? or mask_part.empty?\n\t\t\t\treturn false if mask_part !~ /^[0-9]{1,2}$/ # Illegal mask -- numerals only\n\t\t\t\treturn false if mask_part.to_i > 32 # This too -- between 0 and 32.\n\t\t\t\tbegin\n\t\t\t\t\tRex::Socket.addr_atoi(ip_part) # This allows for \"www.metasploit.com/24\" which is fun.\n\t\t\t\trescue Resolv::ResolvError\n\t\t\t\t\treturn false # Can't resolve the ip_part, so bail.\n\t\t\t\tend\n\n\t\t\t\texpanded = expand_cidr(arg)\n\t\t\t\tif expanded\n\t\t\t\t\tranges += expanded\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif arg.include?(\":\")\n\t\t\t\t# Then it's IPv6\n\t\t\t\t# Can't really do much with IPv6 right now, just return it and\n\t\t\t\t# hope for the best\n\t\t\t\taddr = Rex::Socket.addr_atoi(arg)\n\t\t\t\tranges.push [addr, addr, true]\n\t\t\telsif arg =~ /[^-0-9,.*]/\n\t\t\t\t# Then it's a domain name and we should send it on to addr_atoi\n\t\t\t\t# unmolested to force a DNS lookup.\n\t\t\t\taddr = Rex::Socket.addr_atoi(arg)\n\t\t\t\tranges.push [addr, addr]\n\t\t\telsif arg =~ /^([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)$/\n\t\t\t\t# Then it's in the format of 1.2.3.4-5.6.7.8\n\t\t\t\t# Note, this will /not/ deal with DNS names, or the fancy/obscure 10...1-10...2\n\t\t\t\tbegin \n\t\t\t\t\taddrs = [Rex::Socket.addr_atoi($1), Rex::Socket.addr_atoi($2)]\n\t\t\t\t\treturn false if addrs[0] > addrs[1] # The end is greater than the beginning.\n\t\t\t\t\tranges.push [addrs[0], addrs[1]]\n\t\t\t\trescue Resolv::ResolvError # Something's broken, forget it.\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\texpanded = expand_nmap(arg)\n\t\t\t\tif expanded\n\t\t\t\t\tranges += expanded\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\n\t\treturn ranges\n\tend" ]
[ "0.6984021", "0.60479033", "0.59377795", "0.5851572", "0.5738252", "0.5738252", "0.5715469", "0.5711686", "0.56538963", "0.5591599", "0.55742544", "0.5562225", "0.5532942", "0.5500179", "0.5493819", "0.5484015", "0.5450859", "0.5385188", "0.5376823", "0.53705746", "0.5348531", "0.5348307", "0.5339781", "0.5324516", "0.5300413", "0.52867424", "0.52856845", "0.5275065", "0.52663696", "0.5264705", "0.5244753", "0.5243798", "0.5242353", "0.5242353", "0.5239606", "0.52392083", "0.5235972", "0.52339196", "0.5228461", "0.5216717", "0.5202925", "0.5197767", "0.51883715", "0.5178607", "0.51727", "0.517066", "0.5166064", "0.5155655", "0.5131682", "0.5127439", "0.51265574", "0.51254207", "0.51207346", "0.51095194", "0.5098317", "0.5098317", "0.50981176", "0.5097786", "0.5096031", "0.5094576", "0.50884795", "0.50876", "0.50867236", "0.5085641", "0.5062236", "0.5056517", "0.50521964", "0.5051991", "0.50344265", "0.5034391", "0.5032285", "0.50203943", "0.50136375", "0.5012423", "0.5012423", "0.50086343", "0.49990934", "0.49973276", "0.4987254", "0.49799472", "0.49776685", "0.49756593", "0.4975521", "0.4967553", "0.49612573", "0.4954997", "0.49522585", "0.49502766", "0.4943466", "0.49403942", "0.49365133", "0.4935882", "0.4935259", "0.49350446", "0.49269176", "0.4922581", "0.49219614", "0.4921005", "0.491881", "0.4916914" ]
0.7583121
0
clears existing network interfaces argv = commandline arguments, require the names of the interfaces to clear (i name)
def cmd_clear_interface argv setup argv interface = @hash['interfaces'] response = @api.clear_interface(interface) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end", "def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def networks_del( *networks )\n\t\t\t@networks = @networks.difference( networks.flatten )\n\t\tend", "def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end", "def delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end", "def clearItemPool _args\n \"clearItemPool _args;\" \n end", "def remove_netif(netifs, netif)\n end", "def clear(interface, options = {})\n if interface.visible?\n new(interface, options).write\n\n else\n []\n\n end\n end", "def update!(**args)\n @network_interfaces = args[:network_interfaces] if args.key?(:network_interfaces)\n end", "def interface_cleanup(intf_name)\n cfg = get_interface_cleanup_config(intf_name)\n config(*cfg)\n end", "def delete_unused_host_only_networks\n networks = []\n execute(\"list\", \"hostonlyifs\").split(\"\\n\").each do |line|\n networks << $1.to_s if line =~ /^Name:\\s+(.+?)$/\n end\n\n execute(\"list\", \"vms\").split(\"\\n\").each do |line|\n if line =~ /^\".+?\"\\s+\\{(.+?)\\}$/\n execute(\"showvminfo\", $1.to_s, \"--machinereadable\").split(\"\\n\").each do |info|\n if info =~ /^hostonlyadapter\\d+=\"(.+?)\"$/\n networks.delete($1.to_s)\n end\n end\n end\n end\n\n networks.each do |name|\n execute(\"hostonlyif\", \"remove\", name)\n end\n end", "def remove_alias(ip)\n cmd(\"addr del #{ip}/#{prefix} dev #{name}\")\n unless name == 'eth0' || !cmd(\"rule list\").match(/([0-9]+):\\s+from #{ip} lookup #{route_table}/)\n cmd(\"rule delete pref #{$1}\")\n end\n end", "def removeAllContainers _args\n \"removeAllContainers _args;\" \n end", "def delete_nic(*nics)\n # Trying to remove a NIC without removing the network connection\n # first will cause an error. Removing the network connection of a NIC\n # in the NetworkConnectionSection will automatically delete the NIC.\n net_conn_section = network_connection_section\n vhw_section = hardware_section\n nics.each do |nic|\n nic_index = nic.nic_index\n net_conn_section.remove_network_connection(nic_index)\n vhw_section.remove_nic(nic_index)\n end\n end", "def empty_argv\n ARGV.length.times{ ARGV.pop }\n end", "def delete\n client_opts = {}\n client_opts[:network_interface_id] = network_interface_id\n client.delete_network_interface(client_opts)\n nil\n end", "def clear_cli\n system 'clear'\n end", "def cmd_clear_hosts argv\n setup argv\n response = @api.clear_hosts\n msg JSON.pretty_generate(response)\n return response\n end", "def clear(options = nil)\n begin\n @gibson.mdel @namespace + \"::\"\n rescue\n 0\n end\n end", "def lbClear _args\n \"lbClear _args;\" \n end", "def lnbClear _args\n \"lnbClear _args;\" \n end", "def destroy_and_undefine\n # Shamb0_TODO_20200609=>POC/WT-bringup\n # old_net = @virt.lookup_network_by_name(@net_name)\n # old_net.destroy if old_net.active?\n # old_net.undefine\n rescue StandardError\n # Nothing to clean up\n end", "def unset(*args)\n run \"unset #{OptArg.parse(*args)}\"\n nil\n end", "def clearAllItemsFromBackpack _args\n \"clearAllItemsFromBackpack _args;\" \n end", "def get_interface_cleanup_config(intf_name)\n if platform == :ios_xr\n [\"no interface #{intf_name}\", \"interface #{intf_name} shutdown\"]\n else\n [\"default interface #{intf_name}\"]\n end\n end", "def teardown_server_networking(server)\n server.configured_interfaces.each do |interface|\n partition = interface.partitions.first\n\n next unless port = type.find_mac(partition[\"mac_address\"], :server => server)\n\n logger.info(\"Resetting port %s / %s to untagged vlan 1 and no tagged vlans\" % [server.puppet_certname, partition.fqdd])\n\n resource_creator.configure_interface_vlan(port, \"1\", false, true)\n end\n end", "def reset_tables\n %w[filter nat mangle raw security].each do |table|\n iptables *%W[-t #{table} --flush]\n iptables *%W[-t #{table} --delete-chain]\n end\nend", "def clearGroupIcons _args\n \"clearGroupIcons _args;\" \n end", "def destroy\n @interface = Interface.find(params[:id])\n @interface.destroy\n\t\tredirect_to edit_host_path(@interface.host)\n end", "def remove(net_or_name)\n command = ['VBoxManage', 'dhcpserver', 'remove']\n if net_or_name.kind_of? VirtualBox::Net\n command.push '--ifname', net_or_name.name\n else\n command.push '--netname', net_or_name\n end\n\n VirtualBox.run_command command\n self\n end", "def destroy\n @interface = Interface.find(params[:id])\n @virtualmachine = Virtualmachine.find(@interface.virtualmachine_id)\n position_networkcard = `cat /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml | grep -n \"slot='0x#{@interface.pci_slot}\" | cut -d ':' -f1`\n begin_networkcard = position_networkcard.to_i - 4\n end_networkcard = position_networkcard.to_i + 1\n delete_networkcard = `sed -i '#{begin_networkcard},#{end_networkcard}d' /etc/libvirt/qemu/#{@virtualmachine.hostname}.xml`\n\n @interface.destroy\n\n respond_to do |format|\n format.html { redirect_to interfaces_url }\n format.json { head :no_content }\n end\n end", "def cmd_clear_routes argv\n setup argv\n response = @api.clear_routes\n msg response\n return response\n end", "def remove_netif(opts)\n do_remove_netif(opts[:netif].name)\n end", "def unmanaged_interfaces\n if_list = cr_ohai_network.map { |x| x[0] }\n\n conduit_to_if_map.each do |conduit_name, conduit_def|\n next unless conduit_def.key?(\"if_list\")\n\n conduit_def[\"if_list\"].each do |interface|\n if_list.delete(interface)\n end\n end\n\n if_list\n end", "def remove_netif(netifs, netif)\n do_remove_netif(netif.name)\n setup_for_nm(netifs)\n end", "def detach_all_nics\n spec_hash = {}\n device_change = []\n\n nics_each(:exists?) do |nic|\n device_change << {\n :operation => :remove,\n :device => nic.vc_item\n }\n end\n\n return if device_change.empty?\n\n # Remove NIC from VM in the ReconfigVM_Task\n spec_hash[:deviceChange] = device_change\n\n begin\n @item.ReconfigVM_Task(:spec => spec_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot detach all NICs from VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace}\"\n end\n\n raise error\n end\n end", "def delete_unused_host_only_networks\n end", "def delete_fusion_vm_network(options,install_interface)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if !vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if install_interface == options['empty']\n message = \"Information:\\tGetting network interface list for \"+options['name']\n command = \"'#{options['vmrun']}' listNetworkAdapters '#{fusion_vmx_file}' |grep ^Total |cut -f2 -d:\"\n output = execute_command(options,message,command)\n last_id = output.chomp.gsub(/\\s+/,\"\")\n last_id = last_id.to_i\n if last_id == 0\n handle_output(options,\"Warning:\\tNo network interfaces found\")\n return\n else\n last_id = last_id-1\n install_interface = last_id.to_s\n end\n end\n message = \"Information:\\tDeleting network interface from \"+options['name']\n command = \"'#{options['vmrun']}' deleteNetworkAdapter '#{fusion_vmx_file}' #{install_interface}\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def removeAllItems _args\n \"removeAllItems _args;\" \n end", "def destroy!\n release_eip! if eip?\n print \"Deleting ENI (#{interface.id})...\"\n interface.delete\n # There is ~a second or so where the API can still find the ENI even\n # though it's \"deleted\".\n sleep(3)\n @interface = nil\n puts 'OK'\n end", "def reset\n $iptr = 0\n $program = []\n $labels = {}\n $binding = binding\nend", "def clear\n @names = {}\n @processes = []\n end", "def reset_cli\n self.request.reset\n end", "def clear\n validate_arguments!\n\n action(\"Removing all SSH keys\") do\n api.delete_keys\n end\n end", "def removeAllAssignedItems _args\n \"removeAllAssignedItems _args;\" \n end", "def cleanup_network!\n # Abort if a private network has been defined\n machine.config.vm.networks.each do |cfg|\n return if cfg[0] == :private_network\n end\n machine.communicate.sudo(\"rm -f /etc/nixos/vagrant-network.nix\")\n end", "def cmd_reset(*args)\n if args.length > 0\n cmd_reset_help\n return\n end\n client.reset\n end", "def removeAllHandgunItems _args\n \"removeAllHandgunItems _args;\" \n end", "def clear\n @adapter.clear.map { |impression| impression.update(ip: @config.machine_ip) }\n end", "def delete(*names)\n names.each { |name| commands.delete name }\n end", "def unset(*args, **kwargs)\n queue UnsetCommand, args, kwargs\n end", "def clean\n what = ARGV.shift\n\n case what\n when 'collections'\n clean_collections\n else\n ARGV.unshift what\n original_clean\n end\n end", "def clear\n ve 'rm(list=ls())'\n end", "def remove_netif(netifs, netif)\n do_remove_netif(netif.name)\n end", "def remove_netif(netifs, netif)\n do_remove_netif(netif.name)\n end", "def parse_networks args\n args = args.deep_dup\n dc_networks = networks\n args[\"interfaces_attributes\"].each do |key, interface|\n # Convert network id into name\n net = dc_networks.find { |n| [n.id, n.name].include?(interface[\"network\"]) }\n raise \"Unknown Network ID: #{interface[\"network\"]}\" if net.nil?\n interface[\"network\"] = net.name\n end if args[\"interfaces_attributes\"]\n args\n end", "def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end", "def clean\n help = [\n '',\n \"Use: #{me} clean\",\n '',\n 'Removes dangling docker images/volumes and exited containers',\n ]\n\n if ARGV[1] == '--help'\n show help\n exit succeeded\n end\n\n unless ARGV[1].nil?\n STDERR.puts \"FAILED: unknown argument [#{ARGV[1]}]\"\n exit failed\n end\n\n command = \"docker images --quiet --filter='dangling=true' | xargs --no-run-if-empty docker rmi --force\"\n run command\n command = \"docker ps --all --quiet --filter='status=exited' | xargs --no-run-if-empty docker rm --force\"\n run command\n\n # TODO: Bug - this removes start-point volumes\n #command = \"docker volume ls --quiet --filter='dangling=true' | xargs --no-run-if-empty docker volume rm\"\n #run command\nend", "def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def clear(options)\n if options[:softbin] || options[:softbins]\n store['assigned']['softbin'] = {}\n store['manually_assigned']['softbin'] = {}\n store['pointers']['softbin'] = nil\n store['references']['softbin'] = {}\n end\n if options[:bin] || options[:bins]\n store['assigned']['bin'] = {}\n store['manually_assigned']['bin'] = {}\n store['pointers']['bin'] = nil\n store['references']['bin'] = {}\n end\n if options[:number] || options[:numbers]\n store['assigned']['number'] = {}\n store['manually_assigned']['number'] = {}\n store['pointers']['number'] = nil\n store['references']['number'] = {}\n end\n end", "def clearOverlay _args\n \"clearOverlay _args;\" \n end", "def unconnect(args)\n raise ArgumentError, \"No object given.\" if !args[\"object\"]\n object = args[\"object\"].to_sym\n raise ArgumentError, \"Object doesnt exist: '#{object}'.\" if !@callbacks.key?(object)\n\n if args[\"conn_id\"]\n conn_ids = [args[\"conn_id\"]]\n elsif args[\"conn_ids\"]\n conn_ids = args[\"conn_ids\"]\n else\n raise ArgumentError, \"Could not figure out connection IDs.\"\n end\n\n conn_ids.each do |conn_id|\n raise Errno::ENOENT, \"Conn ID doest exist: '#{conn_id}' (#{args}).\" if !@callbacks[object].key?(conn_id)\n @callbacks[object].delete(conn_id)\n end\n end", "def drop(interface)\n @pool.drop\n end", "def clean_up(multi_id)\n\t\t\tnet = get_multi_config(multi_id)[:network]\n\t\t\t@redis.del(network_path(net, :sensor, :value, multi_id))\n\t\t\t@redis.del(network_path(net, :actuator, :value, multi_id))\n\t\t\t@redis.del(network_path(net, :sensor, :config, multi_id))\n\t\t\t@redis.del(network_path(net, :actuator, :config, multi_id))\n\t\tend", "def uninit\n command('uninit')\n end", "def clear_instructions\n instructions.clear\n end", "def remove\n unless name.nil?\n dhcp.remove self if dhcp\n VirtualBox.run_command ['VBoxManage', 'hostonlyif', 'remove', name]\n end\n self\n end", "def clear\n validate_arguments!\n action(\"Removing all domain names from #{app}\") do\n api.delete_domains(app)\n end\n end", "def clear_all!\n @commands_and_opts.clear\n self\n end", "def flush_iptables\n\n sudo(%@\n pacman -Syu iptables\n\n iptables -P INPUT ACCEPT\n iptables -P FORWARD ACCEPT\n iptables -P OUTPUT ACCEPT\n\n iptables -F\n iptables -X\n iptables -t nat -F\n iptables -t nat -X\n iptables -t mangle -F\n iptables -t mangle -X\n\n iptables -P INPUT ACCEPT\n iptables -P FORWARD ACCEPT\n iptables -P OUTPUT ACCEPT\n\n iptables -I INPUT 1 -m state --state INVALID -j DROP \n iptables -I INPUT 2 -p tcp -m tcp --tcp-flags SYN,FIN SYN,FIN -j DROP\n iptables -I INPUT 3 -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP\n\n iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT\n @)\n\n end", "def clear()\n @library = []\n prompt\n end", "def clear\r\n @commands.clear\r\n nil\r\n end", "def reset\n NETWORKS_KEYS.each do |network_key|\n network = {}\n DEFAULT_SETTINGS_KEYS.each do |key|\n network[key] = \"SharingCounter::Configuration::#{default(key)}\".constantize\n end\n INDIVIDUAL_SETTINGS_KEYS.each do |key|\n network[key] = \"SharingCounter::API::#{network_key.to_s.capitalize }::#{ default(key) }\".constantize\n end\n send \"#{network_key}=\", network\n end\n end", "def clear\n @instructions = []\n end", "def nop(*argv) end", "def unassign(ip, external, _opts = {})\n filter = [{ :name => 'public-ip', :values => [external] }]\n aws_ip = @ec2.describe_addresses({ :filters => filter }).addresses[0]\n\n if aws_ip.nil? \\\n || aws_ip.network_interface_id.nil? \\\n || aws_ip.private_ip_address.nil?\n return\n end\n\n # free associated private ip, it frees associated public ip\n @ec2.unassign_private_ip_addresses(\n { :network_interface_id => aws_ip.network_interface_id,\n :private_ip_addresses => [aws_ip.private_ip_address] }\n )\n rescue StandardError\n OpenNebula.log_error(\"Error unassiging #{ip}:#{e.message}\")\n end", "def cleanup_unused_ip_addresses\n fog_compute.addresses.each do |a|\n unless a.server\n print \"Deleting unused IP address #{a.public_ip}... \"\n a.destroy\n puts \"done\"\n end\n end\n end", "def reset\n self.curr_ip = self.subnet.split('.')\n self.num_ips = (1 << (32 - Socket.net2bitmask(self.netmask).to_i))\n self.curr_ip_idx = 0\n end", "def reset(options={})\n options = {\n :clear => true\n }.merge(options)\n\n registry.each do |option|\n if option.respond_to?(:reset)\n option.reset\n end\n end\n\n config.clear if options[:clear]\n self\n end", "def rename_netif(opts)\n\n end", "def rename_netif(opts)\n\n end", "def rename_netif(opts)\n\n end", "def main\n # Check correct arguments\n if ARGV.length < 1\n puts \"Usage #{$0} <netgroup> [<netgroup> [...]]\"\n exit 1\n end\n ARGV.each do |netgroup|\n copy_netgroup netgroup\n end\nend", "def clear(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would clear #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::ClearCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Cleared #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def clear(collection)\n @mutex.synchronize do\n command(collection).clear\n end\n end", "def clear\n @instructions = []\n end", "def remove(*names); end", "def delete_unused_host_only_networks\n networks = read_virtual_networks\n\n # Exclude all host-only network interfaces which were not created by vagrant provider.\n networks.keep_if do |net|\n net['Type'] == 'host-only' && net['Network ID'] =~ /^vagrant-vnet(\\d+)$/\n end\n\n read_vms_info.each do |vm|\n used_nets = vm.fetch('Hardware', {}).select { |name, _| name.start_with? 'net' }\n used_nets.each_value do |net_params|\n networks.delete_if { |net| net['Network ID'] == net_params.fetch('iface', nil) }\n end\n end\n\n # Delete all unused network interfaces.\n networks.each do |net|\n execute_prlsrvctl('net', 'del', net['Network ID'])\n end\n end", "def remove_agent_interface(opts)\n opts = check_params(opts,[:agent_intf])\n super(opts)\n end", "def clearItemCargo _args\n \"clearItemCargo _args;\" \n end", "def reset_services(services=[])\n request :put, '/services', services\n end", "def usage\n\tputs \" Usage: #{$0} net.work.octets portnum\"\n\tputs \" Example: #{$0} 10.0.0 80 # Ack port 80 on 10.0.0.0..255\"\n\texit 1\nend", "def removeAllActions _args\n \"removeAllActions _args;\" \n end", "def output\n Vedeu.timer(\"Clearing interface: '#{name}'\") do\n @_clear ||= Vedeu::Buffers::Clear.new(height: height,\n name: name,\n width: width).buffer\n end\n end", "def clear_parameters\n @interface.clear_parameters\n current_parameters\n end", "def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end" ]
[ "0.62533665", "0.59918845", "0.5898995", "0.5898995", "0.5898995", "0.58098364", "0.5726285", "0.5708749", "0.5697775", "0.56189936", "0.5596491", "0.5579363", "0.55717564", "0.54868674", "0.5479407", "0.5453402", "0.54292", "0.5410123", "0.5400418", "0.53941184", "0.5381248", "0.5377767", "0.5368506", "0.5334122", "0.52935666", "0.5248735", "0.5234094", "0.5218885", "0.52119637", "0.51879406", "0.5183412", "0.51770025", "0.51739544", "0.5167006", "0.5161809", "0.5160756", "0.5148533", "0.5145718", "0.5139108", "0.51302254", "0.51287025", "0.5124654", "0.5121521", "0.5086788", "0.5047597", "0.5042495", "0.5037471", "0.50157225", "0.50031906", "0.49932402", "0.4992384", "0.49844638", "0.49766424", "0.4967984", "0.495696", "0.49474728", "0.4928048", "0.4928048", "0.4927715", "0.49254164", "0.49140185", "0.49034384", "0.49034384", "0.48900402", "0.4887359", "0.48816368", "0.48794344", "0.48613805", "0.48536876", "0.48481748", "0.4847931", "0.48404607", "0.48402455", "0.483599", "0.48343235", "0.48141474", "0.48134863", "0.4811192", "0.48004112", "0.47893423", "0.47884184", "0.47753817", "0.47723892", "0.47658503", "0.47658503", "0.47658503", "0.476071", "0.47585025", "0.47577244", "0.47545263", "0.47428975", "0.47405058", "0.47404078", "0.47335264", "0.472299", "0.4722367", "0.47213727", "0.4720843", "0.47182003", "0.47104788" ]
0.7769497
0
clears existing vlan configurations argv = commandline arguments
def cmd_clear_vlans argv setup argv response = @api.clear_vlans msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset(*args)\n run \"unset #{OptArg.parse(*args)}\"\n nil\n end", "def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end", "def clear_tags\n keys_to_remove = extra_config_keys\n\n spec_hash =\n keys_to_remove.map {|key| { :key => key, :value => '' } }\n\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(\n :extraConfig => spec_hash\n )\n @item.ReconfigVM_Task(:spec => spec).wait_for_completion\n end", "def empty_argv\n ARGV.length.times{ ARGV.pop }\n end", "def unset\n requires_preauth\n if args.empty?\n error(\"Usage: heroku config:unset KEY1 [KEY2 ...]\\nMust specify KEY to unset.\")\n end\n\n args.each do |key|\n action(\"Unsetting #{key} and restarting #{app}\") do\n api.delete_config_var(app, key)\n\n @status = begin\n if release = api.get_release(app, 'current').body\n release['name']\n end\n rescue Heroku::API::Errors::RequestFailed\n end\n end\n end\n end", "def clear(config)\n Array(config).each do |setting|\n delete_setting setting\n end\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def ac_ac_nountg( this, xml )\n xml.vlan Netconf::JunosConfig::DELETE\n end", "def remove_vlan(name, vlan)\n configure_interface(name, \"no vxlan vlan #{vlan} vni\")\n end", "def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end", "def cmd_clear_interface argv\n setup argv\n interface = @hash['interfaces']\n response = @api.clear_interface(interface)\n msg response\n return response\n end", "def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end", "def tvClear _args\n \"tvClear _args;\" \n end", "def lnbClear _args\n \"lnbClear _args;\" \n end", "def delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end", "def undefine_config(tool)\n @setup[tool.to_s] = false\n end", "def clean\n what = ARGV.shift\n\n case what\n when 'collections'\n clean_collections\n else\n ARGV.unshift what\n original_clean\n end\n end", "def lbClear _args\n \"lbClear _args;\" \n end", "def clear_all!\n @commands_and_opts.clear\n self\n end", "def reset\n @config = nil\n end", "def remove_all_vlans\n remove_all_bridge_domains\n remove_all_svis\n Vlan.vlans.each do |vlan, obj|\n # skip reserved vlan\n next if vlan == '1'\n next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)\n obj.destroy\n end\n end", "def cmd_clear_hosts argv\n setup argv\n response = @api.clear_hosts\n msg JSON.pretty_generate(response)\n return response\n end", "def clearBackpackCargo _args\n \"clearBackpackCargo _args;\" \n end", "def teardown_server_networking(server)\n server.configured_interfaces.each do |interface|\n partition = interface.partitions.first\n\n next unless port = type.find_mac(partition[\"mac_address\"], :server => server)\n\n logger.info(\"Resetting port %s / %s to untagged vlan 1 and no tagged vlans\" % [server.puppet_certname, partition.fqdd])\n\n resource_creator.configure_interface_vlan(port, \"1\", false, true)\n end\n end", "def clearItemPool _args\n \"clearItemPool _args;\" \n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def clear_cli\n system 'clear'\n end", "def remove_config(name)\n\t\tend", "def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end", "def reset\n @config = empty_config\n end", "def unconfigure_parallels_vm(options)\n check_parallels_is_installed(options)\n exists = check_parallels_vm_exists(options)\n if exists == false\n handle_output(options,\"Parallels VM #{options['name']} does not exist\")\n quit(options)\n end\n stop_parallels_vm(options)\n sleep(5)\n message = \"Deleting Parallels VM \"+options['name']\n command = \"prlctl delete #{options['name']}\"\n execute_command(options,message,command)\n message = \"Unregistering Parallels VM \"+options['name']\n command = \"prlctl unregister #{options['name']}\"\n execute_command(options,message,command)\n return\nend", "def remove_config(name)\n variables[name] = nil\n end", "def unset(*args, **kwargs)\n queue UnsetCommand, args, kwargs\n end", "def empty_action\n cli.argv << '-h'\n end", "def clear(option)\n @client.call('config.unset', option)\n end", "def clean!\n for duplicate in duplicates.map{|duplicate| duplicate[0]}\n @commands.delete_if{ |i| i[0] == duplicate}\n @commands << [duplicate, ENV[duplicate]]\n end\n end", "def clearBackpackCargoGlobal _args\n \"clearBackpackCargoGlobal _args;\" \n end", "def unconfigure_fusion_vm(options)\n stop_fusion_vm(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n stop_fusion_vm(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Deleting:\\t#{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteVM '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n vm_dir = options['name']+\".vmwarevm\"\n message = \"Removing:\\t#{options['vmapp']} VM \"+options['name']+\" directory\"\n command = \"cd \\\"#{options['fusiondir']}\\\" ; rm -rf \\\"#{vm_dir}\\\"\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n end\n return\nend", "def destroy\n return unless Feature.bfd_enabled?\n [:interval,\n :ipv4_interval,\n :ipv6_interval,\n :fabricpath_interval,\n :echo_interface,\n :echo_rx_interval,\n :ipv4_echo_rx_interval,\n :ipv6_echo_rx_interval,\n :fabricpath_vlan,\n :slow_timer,\n :ipv4_slow_timer,\n :ipv6_slow_timer,\n :fabricpath_slow_timer,\n :startup_timer,\n ].each do |prop|\n send(\"#{prop}=\", send(\"default_#{prop}\")) if\n send prop\n end\n set_args_keys_default\n end", "def remove(net_or_name)\n command = ['VBoxManage', 'dhcpserver', 'remove']\n if net_or_name.kind_of? VirtualBox::Net\n command.push '--ifname', net_or_name.name\n else\n command.push '--netname', net_or_name\n end\n\n VirtualBox.run_command command\n self\n end", "def clear_if_config_changed(config); end", "def run_destroy\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .destroy(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .disable_input\n .maybe_no_color(toggle: !config_color)\n .parallelism(concurrent_operations: config_parallelism)\n .enable_refresh\n .state(path: config_state)\n .state_out(path: config_state)\n .vars(keys_and_values: config_variables)\n .var_files(paths: config_variable_files)\n .force,\n working_directory: instance_directory\n )\n )\n end", "def delete_vbox_vm_config(client_name)\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n message = \"Removing:\\tVirtualbox configuration file \"+config_file\n command = \"rm \\\"#{config_file}\\\"\"\n execute_command(message,command)\n end\n return\nend", "def configure_vlans\n logger.debug(\"Configuring vlans on %s\" % type.puppet_certname)\n desired = desired_port_channels\n desired_vlans = vlans_from_desired(desired)\n current_vlans = switch.vlan_information.keys\n\n desired_vlans.each do |vlan|\n port_channels = vlan_portchannels_from_desired(desired, vlan)\n\n logger.info(\"Adding vlan %d with tagged port channels %s to %s\" % [vlan, port_channels, type.puppet_certname])\n if switch.model =~ /MXL/ || switch.model =~ /PE-FN/\n switch.provider.mxl_vlan_resource(vlan, vlan_name(vlan), vlan_description(vlan), port_channels)\n else\n switch.provider.mxl_vlan_resource(vlan, vlan_name(vlan), vlan_description(vlan), [])\n end\n end\n\n # IOAs cannot set their vlan membership on the mxl_vlan resources\n # so need to get ioa_interfaces made for them instead\n\n unless switch.model =~ /PE-FN/\n desired.keys.each do |port_channel|\n switch.provider.ioa_interface_resource(\"po %s\" % port_channel, desired_vlans, [])\n end\n logger.debug(\"created IOA interface vlans for %s\" % type.puppet_certname)\n end\n\n (current_vlans - desired_vlans).each do |vlan|\n next if vlan == \"1\"\n\n # old code did not support removing vlans from !MXLs,\n # we might support this now in puppet so worth checking\n # if that is still good behaviour\n next unless switch.model =~ /MXL/\n\n logger.info(\"Removing VLAN %s from %s\" % [vlan, type.puppet_certname])\n switch.provider.mxl_vlan_resource(vlan, \"\", \"\", [], true)\n end\n\n nil\n end", "def cmd_clear_routes argv\n setup argv\n response = @api.clear_routes\n msg response\n return response\n end", "def cli_args!(args)\n ChefBackup::Config.config = args\nend", "def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end", "def change_untagged_vlan( this, xml )\n proc = @@untgv_jmptbl[this.is_trunk?][this.should_trunk?][this.resource[:untagged_vlan].empty?]\n proc.call( this, xml )\n end", "def reset\n self.options = nil\n self.option_processors = nil\n end", "def clean(options)\n options[:softbin] ||= options.delete(:sbin) || options.delete(:soft_bin)\n options[:number] ||= options.delete(:test_number) || options.delete(:tnum) ||\n options.delete(:testnumber)\n options[:name] ||= options.delete(:tname) || options.delete(:testname) ||\n options.delete(:test_name)\n options[:index] ||= options.delete(:ix)\n end", "def unconfigure_vs_pxe_client(options)\n options['mac'] = get_install_nac(options)\n if not options['mac']\n handle_output(options,\"Warning:\\tNo MAC Address entry found for #{options['name']}\")\n quit(options)\n end\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = options['tftpdir']+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Information:\\tRemoving PXE boot file \"+tftp_pxe_file+\" for \"+options['name']\n command = \"rm #{tftp_pxe_file}\"\n execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n pxe_cfg_file1 = options['mac'].gsub(/:/,\"-\")\n pxe_cfg_file1 = \"01-\"+pxe_cfg_file1\n pxe_cfg_file1 = pxe_cfg_file1.downcase\n pxe_cfg_file1 = pxe_cfg_dir+\"/\"+pxe_cfg_file1\n pxe_cfg_file2 = options['mac'].split(\":\")[0..3].join+\"-\"+options['mac'].split(\":\")[4..5].join+\"-0000-0000-\"+options['mac'].gsub(/\\:/,\"\")\n pxe_cfg_file2 = pxe_cfg_file2.downcase\n pxe_cfg_file2 = pxe_cfg_dir+\"/\"+pxe_cfg_file2\n if File.exist?(pxe_cfg_file1)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file1+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file1}\"\n execute_command(options,message,command)\n end\n if File.exist?(pxe_cfg_file2)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file2+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file2}\"\n execute_command(options,message,command)\n end\n client_info = get_vs_clients()\n options['service'] = client_info.grep(/#{options['name']}/)[0].split(/ = /)[1].chomp\n ks_dir = options['tftpdir']+\"/\"+options['service']\n ks_cfg_file = ks_dir+\"/\"+options['name']+\".cfg\"\n if File.exist?(ks_cfg_file)\n message = \"Information:\\tRemoving Kickstart boot config file \"+ks_cfg_file+\" for \"+options['name']\n command = \"rm #{ks_cfg_file}\"\n execute_command(options,message,command)\n end\n unconfigure_vs_dhcp_client(options)\n return\nend", "def lazy_space_removal\n params = ARGV.join(\" \").slice(/(--parameters\\s|-p\\s).*?(?=\\s-|\\z)/)\n return ARGV if params.nil?\n params = params.split(' ')\n new_args = ARGV\n params.each {|p| new_args.delete_if {|x| x == p} }\n new_args << \"-p\"\n new_args << params[1..-1].join(' ').gsub(/\\s,/, ',')\n return new_args\nend", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # bool for removing air loops\n remove_air_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_air_loops',true)\n remove_air_loops.setDisplayName('Remove Air Loops?:')\n remove_air_loops.setDefaultValue(true)\n args << remove_air_loops\n\n # bool for removing plant loops\n remove_plant_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_plant_loops',true)\n remove_plant_loops.setDisplayName('Remove Plant Loops?:')\n remove_plant_loops.setDefaultValue(true)\n args << remove_plant_loops\n\n # bool for removing service hot water loops\n remove_shw_loops = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_shw_loops',true)\n remove_shw_loops.setDisplayName('Also Remove Service Hot Water Plant Loops?:')\n remove_shw_loops.setDefaultValue(false)\n args << remove_shw_loops\n\n # bool for removing zone equipment\n remove_zone_equipment = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_zone_equipment',true)\n remove_zone_equipment.setDisplayName('Remove Zone Equipment?:')\n remove_zone_equipment.setDefaultValue(true)\n args << remove_zone_equipment\n\n # bool for removing zone exhaust fans\n remove_zone_exhaust_fans = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_zone_exhaust_fans',true)\n remove_zone_exhaust_fans.setDisplayName('Also Zone Exhaust Fans?:')\n remove_zone_exhaust_fans.setDefaultValue(false)\n args << remove_zone_exhaust_fans\n\n # bool for removing vrf equipment\n remove_vrf = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_vrf',true)\n remove_vrf.setDisplayName('Remove VRF?:')\n remove_vrf.setDefaultValue(true)\n args << remove_vrf\n\n # bool for removing unused curves\n remove_unused_curves = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_unused_curves',true)\n remove_unused_curves.setDisplayName('Remove Unused Curves?:')\n remove_unused_curves.setDefaultValue(true)\n args << remove_unused_curves\n\n return args\n end", "def clearMagazineCargoGlobal _args\n \"clearMagazineCargoGlobal _args;\" \n end", "def reset # :nodoc:\n switches.clear\n flags.clear\n commands.clear\n @@version = nil\n @@config_file = nil\n @@use_openstruct = false\n @@prog_desc = nil\n @@default_command = :help\n clear_nexts\n\n desc 'Show this message'\n switch :help\n end", "def uninit\n command('uninit')\n end", "def unconfigure_cc_server(options)\n unconfigure_ks_repo(options['service'])\nend", "def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend", "def delete_all_vlan_groups\n super\n end", "def clear_options\n @entries = {}\n end", "def initialize\n @argv_option = {}\n @config = {}\n end", "def reset\n @git = nil\n @configuration = nil\n end", "def clean(options={})\n send(run_method, %{sh -c \"#{APT_GET} -qy clean\"}, options)\n end", "def removeAllContainers _args\n \"removeAllContainers _args;\" \n end", "def clearAllItemsFromBackpack _args\n \"clearAllItemsFromBackpack _args;\" \n end", "def clearWeaponCargoGlobal _args\n \"clearWeaponCargoGlobal _args;\" \n end", "def cfgremove(fabrickey, cfgname, *zonenames)\n result = @zones.altercfg(fabrickey, 'REMOVE', cfgname, *zonenames)\n result[1]\n end", "def clear\n ve 'rm(list=ls())'\n end", "def options_clear opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" clear\".colorize(colors[:yellow]) + \n\t\t\t\t\" clears a completed tasks\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:clear].colorize(colors[:red])\n\t\t\t\topts.on('-a', 'resets the entire list') do\n\t\t\t\t\tOPTIONS[:clear_all] = true\n\t\t\t\tend\n\t\t\tend", "def clean_up\n name = 'webserver'\n tempfile = '/tmp/haproxy.cfg'\n server_config = \"server #{name}\"\n \n contents = File.read(File.expand_path(@haproxy_config_file))\n\n open(tempfile, 'w+') do |f|\n contents.each_line do |line|\n f.puts line unless line.match(server_config)\n end\n end\n FileUtils.mv(tempfile, @haproxy_config_file)\n end", "def nop(*argv) end", "def clear(options)\n if options[:softbin] || options[:softbins]\n store['assigned']['softbin'] = {}\n store['manually_assigned']['softbin'] = {}\n store['pointers']['softbin'] = nil\n store['references']['softbin'] = {}\n end\n if options[:bin] || options[:bins]\n store['assigned']['bin'] = {}\n store['manually_assigned']['bin'] = {}\n store['pointers']['bin'] = nil\n store['references']['bin'] = {}\n end\n if options[:number] || options[:numbers]\n store['assigned']['number'] = {}\n store['manually_assigned']['number'] = {}\n store['pointers']['number'] = nil\n store['references']['number'] = {}\n end\n end", "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.send(\"#{opt}=\", nil) }\n self.logger = nil\n end", "def removeVest _args\n \"removeVest _args;\" \n end", "def reset_cli\n self.request.reset\n end", "def unconfigure_vs_pxe_client(client_name)\n client_mac = get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = $tftp_dir+\"/\"+tftp_pxe_file\n if File.exists?(tftp_pxe_file)\n message = \"Removing:\\tPXE boot file \"+tftp_pxe_file+\" for \"+client_name\n command = \"rm #{tftp_pxe_file}\"\n execute_command(message,command)\n end\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n if File.exists?(pxe_cfg_file)\n message = \"Removing:\\tPXE boot config file \"+pxe_cfg_file+\" for \"+client_name\n command = \"rm #{pxe_cfg_file}\"\n execute_command(message,command)\n end\n client_info = get_vs_clients()\n service_name = client_info.grep(/#{client_name}/)[0].split(/ = /)[1].chomp\n ks_dir = $tftp_dir+\"/\"+service_name\n ks_cfg_file = ks_dir+\"/\"+client_name+\".cfg\"\n if File.exist?(ks_cfg_file)\n message = \"Removing:\\tKickstart boot config file \"+ks_cfg_file+\" for \"+client_name\n command = \"rm #{ks_cfg_file}\"\n execute_command(message,command)\n end\n unconfigure_vs_dhcp_client(client_name)\n return\nend", "def destroy_and_undefine\n # Shamb0_TODO_20200609=>POC/WT-bringup\n # old_net = @virt.lookup_network_by_name(@net_name)\n # old_net.destroy if old_net.active?\n # old_net.undefine\n rescue StandardError\n # Nothing to clean up\n end", "def delete_vlan_group\n super\n end", "def delete_unused_host_only_networks\n end", "def asr_delete_orphaned_config(agent_host)\n elektron_networking.delete(\"/asr1k/orphans/#{agent_host}\").body\n end", "def reset_config\n config.reset_to_defaults\n end", "def destroy\n ret = qmgmt(['volume', 'config', 'delete', resource[:name]])\n if ( ret.exitstatus != 0 )\n fail(\"quobyte volume config delete #{resource[:name]} failed with status #{ret.exitstatus.to_s}. Output follows.\" + out.join(\"\\n\"))\n end\n end", "def empty_config\n nil\n end", "def clearItemCargoGlobal _args\n \"clearItemCargoGlobal _args;\" \n end", "def reset_for_next_command\n # self.args, self.switches, self.options = [], [], {}\n self.output, self.capture = false, false\n end", "def reset\n self.cmd_string = ''\n self.clear\n self.dcase_hash.clear\n end", "def reset_all\n clear_commands\n reset_colors\n @app_info = nil\n @app_exe = nil\n @verbose_parameters = true\n @@default_method = nil\n @@class_cache = {}\n end", "def reset_conf_sub\n Juli::Util::Config.instance_variable_set('@singleton__instance__', nil)\n $_repo = nil\n end", "def clearWeaponCargo _args\n \"clearWeaponCargo _args;\" \n end", "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.reset_attribute(opt) }\n end", "def removeSwitchableUnit _args\n \"removeSwitchableUnit _args;\" \n end", "def clear(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would clear #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::ClearCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Cleared #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end" ]
[ "0.59625125", "0.58159935", "0.5785312", "0.57039493", "0.557716", "0.5531423", "0.5521691", "0.5521691", "0.5518103", "0.5449379", "0.54206073", "0.5378676", "0.53448755", "0.53358364", "0.5332073", "0.53293234", "0.5310814", "0.5303817", "0.53019005", "0.52892244", "0.5286988", "0.5254872", "0.5243076", "0.52362055", "0.52269703", "0.51861095", "0.5182278", "0.5182278", "0.5182278", "0.51665175", "0.51640844", "0.5162852", "0.5154529", "0.5132823", "0.5108637", "0.5100332", "0.5095332", "0.50895625", "0.5088842", "0.50784636", "0.50764704", "0.50732374", "0.50731796", "0.50596267", "0.50534433", "0.50521076", "0.50500196", "0.50458014", "0.5022818", "0.50113875", "0.5009456", "0.5009054", "0.50081664", "0.5006634", "0.5004153", "0.5002954", "0.4987468", "0.49859527", "0.49857798", "0.49704805", "0.4958696", "0.49526834", "0.49495894", "0.49471712", "0.4944785", "0.49254417", "0.4922622", "0.49216878", "0.49212614", "0.49156627", "0.49096665", "0.49092495", "0.490795", "0.49061993", "0.489965", "0.48926672", "0.48897392", "0.48814565", "0.48778704", "0.4876731", "0.4876138", "0.48725444", "0.48696864", "0.48566636", "0.48554596", "0.4849997", "0.48431486", "0.48362145", "0.48287308", "0.48255578", "0.48198813", "0.48179162", "0.48150843", "0.48087776", "0.48069695", "0.48041624", "0.48041624", "0.48041624", "0.48041624", "0.48041624" ]
0.57085794
3
clears existing network routes argv = commandline arguments
def cmd_clear_routes argv setup argv response = @api.clear_routes msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset!\n ATTRIBUTES.each {|attr| send(\"#{attr.to_s}=\", nil)}\n routes.clear\n end", "def reset\n @routes.clear\n end", "def flush_routes\n _init\n\n # Remove each of the individual routes so the comms don't think they're\n # still routing after a flush.\n self.routes.each { |r|\n if r.comm.respond_to? :routes\n r.comm.routes.delete(\"#{r.subnet}/#{r.netmask}\")\n end\n }\n # Re-initialize to an empty array\n self.routes = Array.new\n end", "def reset!\n @routes = []\n @current = 0\n @prepared = nil\n end", "def empty_argv\n ARGV.length.times{ ARGV.pop }\n end", "def reset!\n @routes = []\n @current_order = 0\n @prepared = nil\n end", "def reset_routes(routes=[])\n request :put, '/routes', routes\n end", "def clear_routes\n @routes = Hash.new { |h, k| h[k] = Set.new }\n end", "def remove_weakest_individual\n sort_routes\n @routes = @routes[0..-2]\n end", "def cmd_clear_hosts argv\n setup argv\n response = @api.clear_hosts\n msg JSON.pretty_generate(response)\n return response\n end", "def reset!\n @route_map = {}\n end", "def reset\n @args = nil\n end", "def reset_cli\n self.request.reset\n end", "def reset_routes!\n router.reset!\n default_routes!\n end", "def unset(*args)\n run \"unset #{OptArg.parse(*args)}\"\n nil\n end", "def deconfigure\n # assume eth0 primary ip is managed by dhcp\n if name == 'eth0'\n cmd(\"addr flush dev eth0 secondary\")\n else\n cmd(\"rule list\").lines.grep(/^([0-9]+):.*lookup #{route_table}/) do\n cmd(\"rule delete pref #{$1}\")\n end\n cmd(\"addr flush dev #{name}\")\n cmd(\"route flush table #{route_table}\")\n cmd(\"route flush cache\")\n end\n @clean = true\n end", "def clear_cli\n system 'clear'\n end", "def clean\n what = ARGV.shift\n\n case what\n when 'collections'\n clean_collections\n else\n ARGV.unshift what\n original_clean\n end\n end", "def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end", "def lbClear _args\n \"lbClear _args;\" \n end", "def lnbClear _args\n \"lnbClear _args;\" \n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end", "def clearMagazineCargoGlobal _args\n \"clearMagazineCargoGlobal _args;\" \n end", "def clearBackpackCargo _args\n \"clearBackpackCargo _args;\" \n end", "def clearOverlay _args\n \"clearOverlay _args;\" \n end", "def clear_all!\n @commands_and_opts.clear\n self\n end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def empty_action\n cli.argv << '-h'\n end", "def reset!\n reset_endpoints!\n reset_routes!\n reset_validations!\n end", "def clearBackpackCargoGlobal _args\n \"clearBackpackCargoGlobal _args;\" \n end", "def reset!\n @root = Node::Root.new(self, request_methods)\n @named_routes = {}\n @routes = []\n @grapher = Grapher.new(self)\n @priority_lookups = false\n end", "def cmd_clear_interface argv\n setup argv\n interface = @hash['interfaces']\n response = @api.clear_interface(interface)\n msg response\n return response\n end", "def remove_route(city1, city2, direction)\n if(node_hash[city1] == nil || node_hash[city2] == nil)\n puts \"INVALID CITY CODES\"\n return\n else\n if(direction == \"FORWARD\")\n puts \"Removing #{city2} from #{city1} routes\"\n remove_city_from_linked(node_hash[city1].linked_cities, city2)\n elsif(direction == \"BACKWARD\")\n puts \"Removing #{city1} from #{city2} routes\"\n remove_city_from_linked(node_hash[city2].linked_cities, city1)\n elsif(direction == \"BOTH\")\n puts \"Removing #{city1} from #{city2} routes\"\n puts \"Removing #{city2} from #{city1} routes\"\n remove_city_from_linked(node_hash[city1].linked_cities, city2)\n remove_city_from_linked(node_hash[city2].linked_cities, city1)\n else\n puts \"INVALID DIRECTION INPUT\"\n end\n end\n end", "def remove_route(route={})\n request :delete, '/routes', route\n end", "def clear(options = nil)\n begin\n @gibson.mdel @namespace + \"::\"\n rescue\n 0\n end\n end", "def reset!\n @root = Root.new(self)\n @request_methods_specified = Set.new\n @routes = []\n @named_routes = {}\n @variable_names = Set.new\n end", "def reset\n @lookup_paths = {} # (Hash.new)\n @tree = Rack::App::Router::Tree.new\n compile_registered_endpoints!\n end", "def deleteWaypoint _args\n \"deleteWaypoint _args;\" \n end", "def networks_del( *networks )\n\t\t\t@networks = @networks.difference( networks.flatten )\n\t\tend", "def clear_towers\n Node.destroy_all\n OutConnector.destroy_all\n InConnector.destroy_all\n end", "def nop(*argv) end", "def reset!\n @hosts = nil\n end", "def clear\n arg = {\n uprn: nil,\n addressMode: nil,\n houseNumber: nil,\n addressLine1: nil,\n addressLine2: nil,\n addressLine3: nil,\n addressLine4: nil,\n townCity: nil,\n postcode: nil,\n country: nil,\n dependentLocality: nil,\n dependentThoroughfare: nil,\n administrativeArea: nil,\n localAuthorityUpdateDate: nil,\n royalMailUpdateDate: nil,\n easting: nil,\n northing: nil,\n firstName: nil,\n lastName: nil }\n update_attributes(arg)\n\n location[0] = nil if location[0]\n save\n end", "def clearItemPool _args\n \"clearItemPool _args;\" \n end", "def recover(argv)\n argv[0, 0] = @args\n argv\n end", "def clear(options)\n if options[:softbin] || options[:softbins]\n store['assigned']['softbin'] = {}\n store['manually_assigned']['softbin'] = {}\n store['pointers']['softbin'] = nil\n store['references']['softbin'] = {}\n end\n if options[:bin] || options[:bins]\n store['assigned']['bin'] = {}\n store['manually_assigned']['bin'] = {}\n store['pointers']['bin'] = nil\n store['references']['bin'] = {}\n end\n if options[:number] || options[:numbers]\n store['assigned']['number'] = {}\n store['manually_assigned']['number'] = {}\n store['pointers']['number'] = nil\n store['references']['number'] = {}\n end\n end", "def clear_app\n\t\t@routers_locker.synchronize {GReactor.clear_listeners; @routers.clear}\n\tend", "def router=(_arg0); end", "def lazy_space_removal\n params = ARGV.join(\" \").slice(/(--parameters\\s|-p\\s).*?(?=\\s-|\\z)/)\n return ARGV if params.nil?\n params = params.split(' ')\n new_args = ARGV\n params.each {|p| new_args.delete_if {|x| x == p} }\n new_args << \"-p\"\n new_args << params[1..-1].join(' ').gsub(/\\s,/, ',')\n return new_args\nend", "def clearWeaponCargoGlobal _args\n \"clearWeaponCargoGlobal _args;\" \n end", "def remove_all_bgps\n require_relative '../lib/cisco_node_utils/bgp'\n RouterBgp.routers.each do |_asn, vrfs|\n vrfs.each do |vrf, obj|\n if vrf == 'default'\n obj.destroy\n break\n end\n end\n end\n end", "def clearItemCargoGlobal _args\n \"clearItemCargoGlobal _args;\" \n end", "def clear_request\n @url = nil\n @options = nil\n end", "def reset\n self.cmd_string = ''\n self.clear\n self.dcase_hash.clear\n end", "def destroy\n router_bgp('no')\n end", "def clear!\n @paths = []\n end", "def test_generator_route1\n s1 = File.read(\"routes.rb\")\n `./bin/nephos-generator --test -r get test ctr#mth`\n s2 = File.read(\"routes.rb\")\n `./bin/nephos-generator --test -r get test ctr#mth --rm`\n s3 = File.read(\"routes.rb\")\n assert_equal s1, s3\n assert_not_equal s1, s2\n end", "def clear\n patch.stop\n patch.connections = []\n patch.start\nend", "def removeAllCuratorCameraAreas _args\n \"removeAllCuratorCameraAreas _args;\" \n end", "def remove_alias(ip)\n cmd(\"addr del #{ip}/#{prefix} dev #{name}\")\n unless name == 'eth0' || !cmd(\"rule list\").match(/([0-9]+):\\s+from #{ip} lookup #{route_table}/)\n cmd(\"rule delete pref #{$1}\")\n end\n end", "def CleanUp\n\tallGroups.exec(\"killall ITGRecv >/dev/null 2>&1;\")\n\tallGroups.exec(\"killall ITGManager >/dev/null 2>&1; killall ITGSend >/dev/null 2>&1;\") \n\t#set the interfaces down\n @nodes.each do |node|\n\t\tif node.GetType()==\"R\"\n\t\t node.GetInterfaces().each do |ifn|\n\t\t # self.GetGroupInterface(node, ifn).down\n\t\t end\n\t\tend\n\t\t\n\t\tnode.GetInterfaces().each do |ifn| \n\t\t ifn.GetAddresses().each do |add|\n\t\t #info(\"Deleting address #{add.ip} from interface #{add.interface} on node #{node.id}\")\n\t\t Node(node.id).exec(\"ip addr del #{add.ip}/#{add.netmask} dev #{ifn.GetName()}\")\n\t\t end\n\t\tend\n\tend\n end", "def clear\n @nodes = Hash.new\n @ways = Hash.new\n @relations = Hash.new\n end", "def reset\n @protocols = {}\n @servers = {}\n @routes = {}\n @subscribers = {}\n @agents = {}\n @channels = {}\n end", "def clear\n # clear the lineage\n @lineage.clear\n # if the visited hash is not shared, then clear it\n @visited.clear unless @options.has_key?(:visited)\n end", "def reset!\n @apps = {}\n @default_params = {}\n @basic_auth = nil\n end", "def clear(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would clear #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::ClearCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Cleared #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def reset_all\n clear_commands\n reset_colors\n @app_info = nil\n @app_exe = nil\n @verbose_parameters = true\n @@default_method = nil\n @@class_cache = {}\n end", "def clearMagazineCargo _args\n \"clearMagazineCargo _args;\" \n end", "def clear_forwarded_ports\n end", "def enforce_exclusivity\n unless @@exclusive_routes == :false\n existing = Dir[\"#{@@config_dir}route-*\"].map { |f| File.basename(f) }\n (existing - @@configured_routes).each do |parasite_file|\n Puppet.notice \"puppet-network exclusive: removing #{parasite_file}\"\n File.delete(\"#{@@config_dir}#{parasite_file}\")\n end\n end\n clear()\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_netif(opts)\n\n end", "def remove_params(route)\n route, args = route.split('?')\n @params = Hash.new\n return route unless args\n args.split('&').each do |var|\n key, value = var.split('=')\n @params[key.to_sym] = value\n end\n puts @params\n route\n end", "def test_generator_route2\n s1 = File.read(\"routes.rb\")\n `./bin/nephos-generator --test -r get test ctr#mth`\n s2 = File.read(\"routes.rb\")\n `./bin/nephos-generator --test -r get test ctr mth`\n s3 = File.read(\"routes.rb\")\n `./bin/nephos-generator --test -r get test ctr mth --rm`\n s4 = File.read(\"routes.rb\")\n assert_equal s2, s3\n assert_equal s1, s4\n end", "def clean(options={})\n send(run_method, %{sh -c \"#{APT_GET} -qy clean\"}, options)\n end", "def reset!\n @root = class_for_root.new(self, request_methods)\n @named_routes = {}\n @routes = []\n @grapher = Grapher.new(self)\n @priority_lookups = false\n @parser = Util::Parser.new(self, valid_regex)\n end", "def clear\n @names = {}\n @processes = []\n end", "def delete_unused_host_only_networks\n end", "def clear\r\n @commands.clear\r\n nil\r\n end", "def remove_all_ospfs\n require_relative '../lib/cisco_node_utils/router_ospf'\n RouterOspf.routers.each do |_, obj|\n obj.destroy\n end\n end", "def clear_graph\n @g_inputs = []\n end", "def reset\n $iptr = 0\n $program = []\n $labels = {}\n $binding = binding\nend", "def manage_routes_delete_station\n @ui.manage_routes_delete_station_msg(routes, stations)\n route_name = gets.chomp\n route = routes.find { |route_elem| route_elem.name == route_name }\n validate_route_for_delete!\n @ui.manage_routes_delete_station_input_station_msg(route)\n station_name = gets.chomp\n validate_route_deletion!\n manage_routes_delete_station_delete(route_name, station_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end", "def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end", "def clear\n @adjacencies[:in].clear\n @adjacencies[:out].clear\n @vertex = nil\n end", "def clear\n validate_arguments!\n\n action(\"Removing all SSH keys\") do\n api.delete_keys\n end\n end", "def run\n while @running\n display_tasks\n action = gets.chomp.to_i\n print `clear`\n route_action(action)\n end\n end", "def options_clear opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" clear\".colorize(colors[:yellow]) + \n\t\t\t\t\" clears a completed tasks\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:clear].colorize(colors[:red])\n\t\t\t\topts.on('-a', 'resets the entire list') do\n\t\t\t\t\tOPTIONS[:clear_all] = true\n\t\t\t\tend\n\t\t\tend", "def reset!\n class << self\n alias_method :match, :match_before_compilation\n end\n self.routes, self.named_routes = [], {}\n end", "def cmd_reset(*args)\n if args.length > 0\n cmd_reset_help\n return\n end\n client.reset\n end", "def pin_clear\n @pinmap.each { |pin_name, pin| pin.destroy }\n @pinmap.clear\n @patternpinindex.clear\n @patternorder.delete_if { true }\n @cycletiming.clear\n 'P:'\n end", "def clear\n ve 'rm(list=ls())'\n end", "def reset!\n class << self\n alias_method :match, :match_before_compilation\n end\n self.routes, self.named_routes, self.resource_routes = [], {}, {}\n end", "def reset\n @config = nil\n @client = nil\n end", "def clear\n @commands.clear\n nil\n end" ]
[ "0.6123719", "0.60387725", "0.60188967", "0.6004334", "0.593301", "0.5913294", "0.58890086", "0.5653833", "0.55848956", "0.55750537", "0.55709225", "0.5569863", "0.5560173", "0.5555922", "0.55414546", "0.5516868", "0.54875404", "0.5485673", "0.54714286", "0.5470428", "0.54601693", "0.545839", "0.545839", "0.54076815", "0.5377994", "0.5336925", "0.5320402", "0.5313568", "0.5307314", "0.5307314", "0.5307314", "0.5293834", "0.5289446", "0.52884287", "0.5279573", "0.5263825", "0.5256441", "0.5230353", "0.5210129", "0.52043897", "0.5186359", "0.51818335", "0.51799434", "0.517988", "0.51626456", "0.5137601", "0.5135386", "0.51300263", "0.5121577", "0.511747", "0.5108153", "0.50998783", "0.50869256", "0.50827", "0.5078223", "0.50712675", "0.5067987", "0.50668144", "0.5064775", "0.5061854", "0.5058241", "0.5056322", "0.5050753", "0.5050664", "0.50382066", "0.50382006", "0.50374395", "0.5033576", "0.5029146", "0.5024822", "0.50237834", "0.5022049", "0.501383", "0.50088733", "0.5006924", "0.5006924", "0.5006924", "0.5005968", "0.49990347", "0.49851927", "0.4980009", "0.49780416", "0.49762467", "0.497419", "0.49717665", "0.49705508", "0.4961905", "0.495105", "0.49495077", "0.4944027", "0.49247855", "0.4924365", "0.49227178", "0.4914811", "0.49120474", "0.49007893", "0.4893016", "0.48861468", "0.48846725", "0.48785788" ]
0.74620134
0
saves the network configuration to a file argv = commandline arguments, requires the element (e element, such as 'interfaces', or e all) to save, and a file name (f) to save the settings to
def cmd_save argv setup argv e = @hash['elements'] filepath = @hash['filepath'] || "config.json" response = @api.save(e, filepath) msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_config()\nafile = File.open(\"cp3nodes.conf\", \"w\")\nafile.puts \"1 127.0.0.1 25500 25501 25502\\n\"\nafile.puts \"2 127.0.0.1 25503 25504 25505\\n\"\nafile.puts \"3 127.0.0.1 25506 25507 25508\\n\"\nafile.close\nend", "def save(fn)\n begin\n File.open(fn,\"w\") do |file|\n output = \"\"\n self.each do |key, value|\n output << key.to_s + \"=\" + value.to_s + \"\\r\\n\"\n end\n\n file.print output\n file.close\n end\n rescue\n raise \"Error: trouble saving configuration file: #{fn}.\\nDetails: #{$!}\"\n end\n end", "def save(file = nil)\n @file = file if file\n raise Error.new(Error::FileError) unless @file\n File.open(@file, 'w') do |f|\n f.puts(@prefix) if @prefix\n YAML.dump(@cfg, f)\n f.puts ''\n f.puts(@suffix) if @suffix\n end\n end", "def save( file = @hobix_yaml )\n unless file\n raise ArgumentError, \"Missing argument: path to save configuration (0 of 1)\"\n end\n File::open( file, 'w' ) do |f|\n YAML::dump( self, f )\n end\n self\n end", "def save(file,params={})\n dir = File.dirname(file)\n if not File.exists?(dir)\n msg = \"Creating directory #{dir}\"\n respond_to?(:debug) ? debug(msg) : Puppet.debug(msg)\n params[:mkdir_p] ? FileUtils.mkdir_p(dir) : Dir.mkdir(dir)\n end\n msg = params[:pkgname] ?\n \"Saving options for '#{params[:pkgname]}' port to file '#{file}'\" :\n \"Saving port options to file '#{file}'\"\n respond_to?(:debug) ? debug(msg) : Puppet.debug(msg)\n File.open(file, 'w') { |f| f.write(generate(params)) }\n end", "def save_settings(filename, settings)\n require 'yaml'\n\n File.open(filename, 'w') do |file|\n file.write(settings.to_yaml)\n Log.instance.info(\"Settings written to [ #{filename} ]\")\n end\n end", "def cmd_notify_save\n\t\t\t\tprint_status(\"Saving options to config file\")\n\t\t\t\tif @user_name and @webhook_url and $source\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url, 'source' => $source}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All settings saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend", "def to_config_file lanes = [1,2,3,4,5,6,7,8]\n view = ConfigFileView.new(self, lanes)\n view.write\n end", "def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end", "def saveFile(saveTag)\n aFile = File.new(\"config.version\", \"w+\")\n if aFile\n aFile.syswrite(\"version=#{saveTag}\")\n aFile.close\n else\n puts \"Unable to write a config.version file!\"\n end\n end", "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def save_configuration\n File.open(config_file, \"w\") do |file|\n file.write(YAML.dump(@config))\n end\n end", "def save_settings\n open(@@FN_CREDENTIALS, \"wb\") { |fd| fd.write(YAML::dump(@credentials)) }\n open(@@FN_CONFIG, \"wb\") { |fd| fd.write(YAML::dump(@configuration)) }\n open(@@FN_SETTINGS, \"wb\") { |fd| fd.write(YAML::dump(@settings)) }\n end", "def write_config\n File.open(@config_file, \"w\"){|f| YAML.dump(config, f)}\n end", "def write_configure(config = nil)\n config ||= $configure\n File.open($configure_file, \"w\"){|f| YAML.dump(config, f)}\nend", "def cmd_notify_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @user_name and @webhook_url\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend", "def save_settings settings\n File.open(@settings_file, 'w') {|file| file << YAML::dump(settings)}\n end", "def writeFile\n\n\toutputFile = File.new(\"./rules\", \"w\")\n\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\toutputFile.puts \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\toutputFile.close\n\n\tputs \"Rules Saved!\"\nend", "def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end", "def config(peers = [])\n if(peers.none? { |p| p.id == @selfEntry.id } )\n peers << @selfEntry\n end\n\n #better to not touch it after the initial setup\n open(\"#{getConfigFilePath()}\", 'w') { |file|\n #hardcode it as false excluding other possible value\n file << \"standaloneEnabled=false\\n\"\n file << \"dataDir=#{@dataDir}\\n\"\n file << \"syncLimit=#{@syncLimit}\\n\"\n file << \"tickTime=#{@tickTime}\\n\"\n file << \"initLimit=#{@initLimit}\\n\"\n peers.each { |peer|\n file << peer.toDynamicEntry() + \"\\n\"\n }\n }\n\n #write myid file\n open(\"#{getMyIDFilePath()}\", 'w') { |file|\n file << \"#{@selfEntry.id}\"\n }\n end", "def save!\n File.open(connections_file, 'w') {|f| f.write(@connections.to_yaml) }\n end", "def write(opts = {})\n filename = opts.fetch(:filename, @filename)\n encoding = opts.fetch(:encoding, @encoding)\n mode = encoding ? \"w:#{encoding}\" : 'w'\n\n File.open(filename, mode) do |f|\n @ini.each do |section, hash|\n f.puts \"[#{section}]\"\n hash.each { |param, val| f.puts \"#{param} #{@param} #{escape_value val}\" }\n f.puts\n end\n end\n\n self\n end", "def store_network_configuration(configuration)\n store_network_settings(configuration)\n store_labels_information(configuration)\n generate_ssh_configuration(configuration)\n end", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def sauvegarder()\n begin\n File.open(CONSTANT_FICHIER_DATA_CONFIG, \"w\") do |f|\n \tf.puts Marshal.dump(self)\n end\n rescue Errno::ENOENT\n puts \"ERREUR: Configuration: sauvegarder(): le fichier #{CONSTANT_FICHIER_DATA_CONFIG} n'est pas accessible.\"\n end\n end", "def save args={}\n raise ArgumentError, \"No file name provided\" if args[:filename].nil?\n @savable_sgf = \"(\"\n @root.children.each { |child| write_node child }\n @savable_sgf << \")\"\n\n File.open(args[:filename], 'w') { |f| f << @savable_sgf }\n end", "def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end", "def save_settings\n File.open( @settings_filename, 'w' ) do |out|\n YAML.dump( @app_settings, out )\n end\n @log.debug \"Settings saved into #{@settings_filename}\"\n end", "def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end", "def save_cache!(config_file = File.expand_path(Assh::CONFIG_CACHE),\n timestamp_file = File.expand_path(Assh::CONFIG_CACHE_AT))\n cache = {\n hosts: @hosts,\n groups: @groups\n }\n File.open(config_file, 'w') { |f| f << cache.to_yaml }\n File.open(timestamp_file, 'w') { |f| f << current_time }\n\n end", "def dump_settings\n File.open(SETTINGS_FILE, 'w') do |out|\n YAML.dump( { :targets => @targets, :src => @src }, out)\n end\n end", "def saveConfigFile(app)\n appName = app[\"name\"]\n appPorts = app[\"ports\"]\n appFirst = appPorts[0]\n servers = appPorts.count\n @put.normal \"Saving Thin configuration for #{appName}\"\n\n thinCommand = @system.execute(\"#{@thinPath} config -C /etc/thin/#{appName}.yml -c /var/www/#{appName} --servers #{servers} -e production -p #{appFirst}\")\n if thinCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not save Thin configuration for #{appName}\"\n return 1\n end\n end", "def save fname, options={}\n File.open(fname,\"wb\"){ |f| f << export(options) }\n end", "def write( filename = nil, opts={} )\n @fn = filename unless filename.nil?\n\n encoding = opts[:encoding] || @encoding\n mode = (RUBY_VERSION >= '1.9' && @encoding) ?\n \"w:#{encoding.to_s}\" :\n 'w'\n\n File.open(@fn, mode) do |f|\n @ini.each do |section,hash|\n f.puts \"[#{section}]\"\n hash.each {|param,val| f.puts \"#{param} #{@param} #{escape val}\"}\n f.puts\n end\n end\n self\n end", "def save_config\n config = $bot[:config].clone\n config.delete :client\n File.open \"./#{Twittbot::CONFIG_FILE_NAME}\", 'w' do |f|\n f.write config.to_yaml\n end\n end", "def ini_write_entry(filename,stanza,entry,value)\n require 'inifile'\n if not ::File.exist? filename\n ::File.open(filename,'w').close\n end\n f = IniFile.load(filename, :comment => '#')\n f[stanza][entry]=value\n f.write\nend", "def save_config\n plist = CFPropertyList::List.new\n plist.value = CFPropertyList.guess(@config)\n plist.save(@file, CFPropertyList::List::FORMAT_XML)\n end", "def saveConfig(configFile, config)\n #For Shoes compatability change to a known directory\n Dir.chdir(ENV['HOME'])\n #Test if exists\n if !(File.exist?(\".photoflow\"))\n FileUtils.mkdir_p (\".photoflow\")\n end\n open(configFile, 'w') {|f| YAML.dump(config, f)}\nend", "def save_config(scope = :user)\n case scope\n when :global\n if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin/\n path = ENV['ALLUSERSPROFILE']\n else\n path = '/etc'\n end\n when :local\n path = File.expand_path '.'\n when :user\n path = File.expand_path '~'\n else\n path = scope\n end\n\n @config_factory.save_config @config,\n File.join(path, @settings[:config_file])\n end", "def config_write\n # Putting it in a format that zfm can also read and write\n f1 = File.expand_path(CONFIG_FILE)\n hash = {}\n hash['DIRS'] = @used_dirs.select { |dir| File.exist? dir }\n hash['FILES'] = @visited_files.select { |file| File.exist? file }\n # NOTE bookmarks is a hash and contains FILE:cursor_pos\n hash['BOOKMARKS'] = @bookmarks # .select {|file| File.exist? file}\n writeYML hash, f1\n @writing = @modified = false\n message \"Saved #{f1}\"\nend", "def save_to_file(filename)\n begin\n TerminalVis::option_handler.save_options(filename)\n puts \"Saved options to #{filename}\".green\n rescue StandardError => e\n puts \" Error while saving options: \".concat(e.message).red\n end\n return true\n end", "def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end", "def write_config\n # Allow disabling the local settings.\n return unless new_resource.local_settings_path\n file new_resource.local_settings_path do\n content new_resource.local_settings_content\n mode '640'\n owner new_resource.parent.owner\n group new_resource.parent.group\n end\n end", "def save\n fann.save(\"#{Rails.root}/data/#{self.class.to_s.tableize.singularize}.conf\")\n end", "def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end", "def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end", "def save\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--network\", \"mac=#{@mac}\"])\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--boot\", @boot_order.join(\",\")])\n read_definition\n end", "def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end", "def save_config_signature\n Origen.app.session.origen_sim[\"#{id}_config\"] = config\n end", "def save(filename, constraints = {})\n File.open(filename, 'wb') { |io| write(io, constraints) }\n end", "def save(filename, constraints = {})\n File.open(filename, \"wb\") { |io| write(io, constraints) }\n end", "def cmd_notify_pushover_save\n\t\t\t\tprint_status(\"Saving parameters to config file\")\n\t\t\t\tif @app_key and @user_key\n\t\t\t\t\tconfig = {'app_key' => @app_key, 'user_key' => @user_key}\n\t\t\t\t\tFile.open(Notify_pushover_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_pushover_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend", "def dump fname=\"dumps/atari_#{Time.now.strftime '%y%m%d_%H%M'}.bin\"\n raise NotImplementedError, \"doesn't work with BDNES atm\" if config[:opt][:type] == :BDNES\n File.open(fname, 'wb') do |f|\n Marshal.dump(\n { config: config,\n best: opt.best.last,\n mu: opt.mu,\n sigma: opt.sigma,\n centrs: compr.centrs\n }, f)\n end\n puts \"Experiment data dumped to `#{fname}`\"\n true\n end", "def save(name = @name)\n raise OneCfg::Config::Exception::NoContent if @content.nil?\n\n file_operation(name, 'w') {|file| file.write(to_s) }\n end", "def save_solution(filename)\n raise ArgumentError, \"Argument must be a file name\" unless filename.kind_of? String\n File.open(filename, 'w') { |file| YAML.dump(@ocp_solution, file) }\n end", "def save_config\n\t\t# Build out the console config group\n\t\tgroup = {}\n\n\t\tif (active_module)\n\t\t\tgroup['ActiveModule'] = active_module.fullname\n\t\tend\n\n\t\t# Save it\n\t\tbegin\n\t\t\tMsf::Config.save(ConfigGroup => group)\n\t\trescue ::Exception\n\t\t\tprint_error(\"Failed to save console config: #{$!}\")\n\t\tend\n\tend", "def write_host_file\n puts \"Writing Apocalypse host file...\"\n host_config = {\n :hostname => @hostname,\n :server_address => @address, \n :port => @port, \n :username => @username, \n :password => @password\n }\n file = File.open(::Apocalypse::Client.host_file, \"w\") do |f|\n f.write host_config.to_yaml\n end \n end", "def save_config\n botpart_config = Hash[@config.to_a - $bot[:config].to_a]\n\n unless botpart_config.empty?\n File.open @botpart_config_path, 'w' do |f|\n f.write botpart_config.to_yaml\n end\n end\n end", "def save_opf!\n file.write(opf_path, opf_xml.to_s)\n\n opf_xml\n end", "def store\n File.open(@config_file, 'w') do |f|\n f.chmod(0600)\n f.write(@config.to_json)\n end\n end", "def save filename\n File.open(filename, 'w') { |file| @properties.each {|key,value| file.write(\"#{key}:#{value},\\n\") } } \n end", "def save_config_signature\n Origen.app.session.origen_sim[\"#{id}_config\"] = config.except(*NON_DATA_CONFIG_ATTRIBUTES)\n end", "def write_config\n info(\"writing config.yml\")\n AIPP.config.write! config_file\n end", "def save file='GOL.sav'\n File.open(file,'w') do |f|\n Marshal.dump(state,f)\n end\n end", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\n file.close\n end", "def save_configuration\n create_config_dir_if_needed\n\n if configuration_writable?\n File.write(configuration_path, configuration_data.deep_stringify_keys!.to_yaml)\n configuration_data = read_configuration\n else\n throw StandardError.new \"Configuration cannot be saved at '#{configuration_path}'\"\n end\n end", "def _save_worker(id, worker, args)\n File.open(File.join(TEMP_W_DIR, \"#{id}.yml\"), 'w') do |f|\n f.write(YAML.dump({ worker => args }))\n end\n end", "def save(filename = nil, compact = false)\n\t\tend", "def save_game\n #yaml = YAML::dump(self)\n puts \"Please enter a filename for the saved game.\"\n save_file_name = gets.chomp.downcase\n save_file = File.write(\"saved_games/#{save_file_name}.yaml\", self.to_yaml)\n #save_file.write(yaml)\n puts \"Your game has been saved!\"\n puts \"Goodbye!\"\n end", "def config_dhcp\t\n\tsystem(\"echo > /etc/dnsmasq.leases\")\n\tdhcp = File.new(\"conf/#@dhcpfile\",\"w+\")\n\tdhcp.puts(\"interface=#@interface\")\n\tdhcp.puts(\"dhcp-range=192.168.10.5,192.168.10.20\\n\")\n\tdhcp.puts(\"dhcp-leasefile=/etc/dnsmasq.leases\\n\")\n\tdhcp.puts(\"dhcp-authoritative\\n\")\n\tdhcp.puts(\"address=/#/192.168.10.1\\n\")\n\tdhcp.close\n\tsystem(\"killall dnsmasq && dnsmasq -C conf/#@dhcpfile\")\nend", "def dumpNodeConfig(outfile, allParams=true, builtin=true, manifestDir=\"#{@workdir}/manifests/\", binDir=nil)\n\n\t\t\t@objects.each do |name,manifest|\n\t\t\t\tif (!manifest.isBinary)\n\t\t\t\t\ttype_ = manifest.getType\n\t\t\t\t\tparent = manifest.findParent(\"#{manifestDir}/#{type_}\",\".pp\")\n\t\t\t\t\tif ( (!parent.nil?) and (!@qm.nil?) )\n\t\t\t\t\t\tqh = @qm.getQuirk(parent.chomp(\".pp\"));\n\t\t\t\t\t\tif ( qh != nil and qh.is_a?(Hash) and qh.has_key?(:readFunc) )\n\t\t\t\t\t\t\tjson = @qm.send(qh[:readFunc], manifest.getJSON )\n\t\t\t\t\t\t\tmanifest.setJSON(json)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tpreReq = Marshal.load(Marshal.dump(@preReq))\n\t\t\t\tmanifest.genNodeConfig(outfile, allParams, builtin, preReq, manifestDir, binDir)\n\t\t\tend\n\n\t\tend", "def write( name=@name, *args )\n\t\traise ArgumentError,\n\t\t\t\"No name associated with this config.\" unless name\n\t\tlobj = self.loader\n\t\tstrHash = stringify_keys( @struct.to_h )\n\t\tself.loader.save( strHash, name, *args )\n\tend", "def config_write\n return\n # Putting it in a format that zfm can also read and write\n #f1 = File.expand_path(\"~/.zfminfo\")\n f1 = File.expand_path(CONFIG_FILE)\n d = $used_dirs.join \":\"\n f = $visited_files.join \":\"\n File.open(f1, 'w+') do |f2| \n # use \"\\n\" for two lines of text \n f2.puts \"DIRS=\\\"#{d}\\\"\"\n f2.puts \"FILES=\\\"#{f}\\\"\"\n $bookmarks.each_pair { |k, val| \n f2.puts \"BM_#{k}=\\\"#{val}\\\"\"\n #f2.puts \"BOOKMARKS[\\\"#{k}\\\"]=\\\"#{val}\\\"\"\n }\n end\n $writing = $modified = false\nend", "def dump_config\n send_command \"--dump-config\"\n end", "def save_configuration_files(server)\n puts \"Saving config files\"\n object_behavior(server, :spot_check_command, 'mkdir -p /root/start_stop_backup')\n object_behavior(server, :spot_check_command, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n object_behavior(server, :spot_check_command, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end", "def generateConfigurationToFile(configuration,filePath)\n conf=generateConfigData(configuration)\n file=File.new(filePath,\"w\")\n file.write(conf)\n file.close\n end", "def write_config_entry(key, value)\n if $has_config.call then\n curr_config = YAML.load(File.read($config_filename))\n else\n curr_config = {}\n end\n\n curr_config[key] = value\n\n File.open($config_filename, 'w') { |f| f.write(curr_config.to_yaml) }\nend", "def save\n unless File.exist?(config_dir)\n FileUtils.mkdir_p(config_dir, :mode => 0700)\n end\n\n tmpfile = File.join(config_dir, \"tmpconfig_#{rand 999999}\")\n File.open(tmpfile, \"w\") do |f|\n YAML.dump(conf, f )\n end\n\n FileUtils.mv(tmpfile, config_file)\n end", "def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end", "def write_config\n File.open(CONFIG_OUT, 'w') do |f|\n f.write(ssh_config + \"\\n\")\n end\nend", "def output_config_for_locale(locale)\n save_config_file(locale, \"config\")\n save_config_file(locale, \"faq\")\n save_config_file(locale, \"form\")\nend", "def save_configuration_files(server)\n puts \"Saving config files\"\n probe(server, 'mkdir -p /root/start_stop_backup')\n probe(server, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n probe(server, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end", "def cfg_save\n response = interactive_mode do\n query(\"cfgsave\",\"y\")\n end\n \n case\n when response.data.match(/#{Replies::OPERATION_CANCELLED}/)\n raise Agent::Error.new(Agent::Error::CFGSAVE_CANC)\n when response.data.match(/#{Replies::NO_CHANGE}/)\n raise Agent::Error.new(Agent::Error::CFGSAVE_NOCHANGE)\n when response.data.match(/#{Replies::FLASH_UPDT}/) \n @transaction=nil\n return true\n else\n raise Agent::Error.new(response.data)\n end\n end", "def write_to_file(filename = \"listsave\")\n\t\tIO.write(filename, @tasks.map(&:to_s).join(\"\\n\"))\n\t\tputs \"List has been successfully saved to #{filename}...\"\n\tend", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\nend", "def save_persist_state\n return unless @persist_file\n new_persist_options = {}\n BaseWorker.worker_classes.each do |worker_class|\n worker_class.each_config(@adapter_factory.worker_config_class) do |config_name, ignored_extended_worker_config_class, default_options|\n static_options = default_options.merge(@worker_options[config_name] || {})\n worker_config = self[config_name]\n hash = {}\n # Only store off the config values that are specifically different from default values or values set in the workers.yml file\n # Then updates to these values will be allowed w/o being hardcoded to an old default value.\n worker_config.bean_get_attributes do |attribute_info|\n if attribute_info.attribute[:config_item] && attribute_info.ancestry.size == 1\n param_name = attribute_info.ancestry[0].to_sym\n value = attribute_info.value\n hash[param_name] = value if static_options[param_name] != value\n end\n end\n new_persist_options[config_name] = hash unless hash.empty?\n end\n end\n if new_persist_options != @persist_options\n @persist_options = new_persist_options\n File.open(@persist_file, 'w') do |out|\n YAML.dump(@persist_options, out )\n end\n end\n end", "def save_game\n save_data = YAML::dump(self)\n puts \"Please enter a name for your save game:\"\n prompt\n @filename = gets.chomp\n File.open(\"./saved/#{@filename}\", \"w\") { |file| file.write(save_data)}\n puts \"Saved\"\n get_input\n end", "def save\n file = File.new(@file, 'w+')\n @properties.each { |key, value| file.puts \"#{key}=#{value}\\n\" }\n end", "def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end", "def flush filename = Filename\r\n #puts self.to_s\r\n File.open(filename,\"w\"){|file|\r\n file.print self.to_s\r\n }\r\n rescue\r\n @logger.fatal \"Cannot save settings to file '#{filename}'\"\r\n raise\r\n end", "def save\n File.open(file, 'w') do |f|\n self.attributes.each {|key, value| f.write \"#{key}: '#{value}'\\n\" }\n end\n end", "def save\r\n SystemConfig.set name, to_h(false), true\r\n end", "def save_settings(settings)\n %x{ mkdir #{ENV[\"HOME\"]}/.wts-reader } unless File.directory?(\"#{ENV[\"HOME\"]}/.wts-reader\")\n File.open(ENV[\"HOME\"] + \"/.wts-reader/settings.txt\", 'w') do |file| \n file.write(\"Rate:#{settings[:rate]}\\nVoice:#{settings[:voice]}\\nPath:#{settings[:path] || '/tmp/'}\\n\")\n end\n end", "def save(filename = nil)\n filename ||= @file\n\n File.open(filename, \"w\") do |f|\n f << generate_xml\n end\n end", "def write_config(file, text)\n File.open(file, 'w') do |file|\n file.puts text\n file.close\n end\n end", "def save\n requires :display_text, :name, :network_offering_id, :zone_id\n\n options = {\n 'displaytext' => display_text,\n 'name' => name,\n 'zoneid' => zone_id,\n 'networkofferingid' => network_offering_id\n }\n\n response = service.create_network(options)\n merge_attributes(response['createnetworkresponse']['network'])\n end", "def create_config\n FileUtils.touch(config_file)\n \n @settings = {\n 'username' => 'username@loopiaapi',\n 'password' => 'password',\n 'remote' => 'https://api.loopia.se/RPCSERV',\n 'default_domain' => 'example.com',\n 'verbose' => 'true' \n }\n\n File.open(config_file, 'w' ) { |f| YAML.dump(@settings, f) }\n end", "def configure_email\n config = {\n :username => ask('Gmail', :required => true),\n :password => ask('Password', :required => true)\n }\n File.open(email_file, 'w') { |f| f.write(YAML.dump(config)) }\n end", "def to_config(language, filename, path)\n config = ::Inch::Config.for(language, path).codebase\n config.read_dump_file = filename\n config\n end" ]
[ "0.623356", "0.6000239", "0.5849585", "0.58137697", "0.57539123", "0.5667529", "0.5590036", "0.5588363", "0.5563063", "0.5497579", "0.54847336", "0.5457971", "0.54107577", "0.53860587", "0.5378316", "0.5337453", "0.5304921", "0.5254505", "0.5216638", "0.52010626", "0.5181774", "0.5163713", "0.51547825", "0.51533973", "0.51462203", "0.5143095", "0.51285905", "0.5119391", "0.51108134", "0.510219", "0.5091305", "0.50763947", "0.50755966", "0.50681263", "0.5063419", "0.5060337", "0.5048231", "0.50411433", "0.50191736", "0.4978518", "0.49485567", "0.49277773", "0.4923942", "0.4913921", "0.4912558", "0.4889085", "0.48781767", "0.48766243", "0.4869949", "0.4865067", "0.48467004", "0.4839701", "0.48394686", "0.48359317", "0.48256359", "0.4817665", "0.4817337", "0.4809826", "0.480957", "0.48020524", "0.479481", "0.47937608", "0.479273", "0.47879493", "0.47799817", "0.47779158", "0.47776526", "0.47751907", "0.4771147", "0.47672376", "0.4756587", "0.47561947", "0.47456148", "0.47411215", "0.47399238", "0.4734476", "0.47344568", "0.47342739", "0.4731626", "0.47293165", "0.47263443", "0.47221518", "0.4719986", "0.471658", "0.47145543", "0.4713358", "0.47018534", "0.46996835", "0.46905196", "0.4690178", "0.46839976", "0.46801782", "0.46745545", "0.46682546", "0.46645987", "0.46636462", "0.46635574", "0.4659223", "0.46568987", "0.464959" ]
0.66596174
0
Filter links whitch doesnt match with the search
def filterProviderOffer(links) useless_links = links.pop #take the offers links.delete(useless_links) links end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_links(search)\n links.select { |link| link.contains? search }\n end", "def filter_links(links)\n filtered_links = links.map do |link|\n next unless link.include?(\"data\") #TODO: Extract into query parameter\n link\n end.compact\n\n #TODO: Extract into exclusion array parameter - Could I pull in file size and exclude equal size files?\n filtered_links -= [\"/pub/time.series/ch/ch.data.0.Current\"] #Duplicate of ch.data.1.AllData - 3.3 GB\n filtered_links -= [\"/pub/time.series/cs/cs.data.0.Current\"] #Duplicate of cs.data.1.AllData - 3.1 GB\n\n filtered_links.reject { |link| link =~ /(dataset|datatype|dataelement|dataclass|data.type|data_type|tdata|dataseries)/ }\n end", "def filter_shows(links)\n\t\t\t@filters.each do |f| # Apply each filter\n\t\t\t\tnew_links = links.reject { |name, _link| f.(name) }\n\t\t\t\t# Stop if the filter removes every release\n\t\t\t\tbreak if new_links.size == 0\n\n\t\t\t\tlinks = new_links\n\t\t\tend\n\n\t\t\tlinks\n\t\tend", "def search_links(page,content)\n page.links_with( :text => Regexp.new(content, true))\n end", "def extract_desired_links(links)\n links.reduce([]) do |subset, page| \n subset << page if whitelisted_page? page\n subset\n end\n end", "def filter(links)\n link_set = Set.new(links)\n (link_set - @set).each do |link|\n yield(link)\n end\n @set += link_set\n end", "def hashtag_link_filter(text)\n self.class.hashtags_in(text) do |match, hashtag|\n result[:hashtags] |= [hashtag]\n\n link = if hashtag_validator.call(hashtag)\n hashtag_tag_buider.call(hashtag)\n else\n \"##{hashtag}\"\n end\n\n link ? match.sub(\"##{hashtag}\", link) : match\n end\n end", "def filter_links(links, filter_method, paths)\n links.send(filter_method) do |link|\n # Turn http://example.com into / meaning index.\n link = link.to_endpoint == '/' ? '/' : link.omit_base\n\n match = false\n paths.each do |pattern|\n match = File.fnmatch?(pattern, link, File::FNM_EXTGLOB)\n break if match\n end\n\n match\n end\n end", "def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n node.set_attribute('data-bare-link', 'true')\n end\n end", "def check_only_links\n end", "def prune_links\n links = []\n result = self.perform\n ft_links = result.ft_links\n ft_links.each do |ft_link|\n http = Curl.get(ft_link)\n doc = Nokogiri::HTML(http.body_str)\n link = doc.xpath('//*[@id=\"copy_paste_links\"]').children.first.to_s.chomp\n links.push link if link.empty? == false\n end\n links\n end", "def ignore_links\n @link_rules.reject\n end", "def index\n #if params[:search]\n # @links = current_user.links.limit(500).group(:short_url).paginate :page => params[:page], :per_page => 20, :order => 'post_date DESC'\n #else\n @links = current_user.links.search(params[:search]).paginate :page => params[:page], :per_page => 20\n #end\n \n=begin\n #delete duplicates almost there TODO\n dups = current_user.links.group(:short_url).count\n\n @links.each_with_index do |link, i|\n link.count = dups[link.short_url]\n if dups[link.short_url] > 1\n @links.delete_if do |v| \n v.short_url == link.short_url\n puts v.short_url\n puts \"=====hit=====\"\n end\n end\n end\n=end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end", "def select_eo_links(irs_doc)\n irs_doc.xpath('//a/@href').select { |link| link.to_s =~ LINK_REGEX }.map(&:to_s)\n end", "def keyword_filter\n @keyword = params[:keyword]\n @destination = params[:destination]\n @urls = Url\n .by_keyword(@keyword)\n .created_by_id(current_user.context_group_id)\n end", "def object_link_filter(text, pattern, link_text: nil)\n references_in(text, pattern) do |match, id, project_ref, matches|\n project = project_from_ref(project_ref)\n\n if project && object = find_object(project, id)\n title = object_link_title(object)\n klass = reference_class(object_sym)\n\n data = data_attribute(\n original: link_text || match,\n project: project.id,\n object_sym => object.id\n )\n\n url = matches[:url] if matches.names.include?(\"url\")\n url ||= url_for_object(object, project)\n\n text = link_text || object_link_text(object, matches)\n\n %(<a href=\"#{url}\" #{data}\n title=\"#{escape_once(title)}\"\n class=\"#{klass}\">#{escape_once(text)}</a>)\n else\n match\n end\n end\n end", "def merge_request_link_filter(text)\n self.class.references_in(text) do |match, id, project_ref|\n project = self.project_from_ref(project_ref)\n\n if project && merge_request = project.merge_requests.find_by(iid: id)\n push_result(:merge_request, merge_request)\n\n title = escape_once(\"Merge Request: #{merge_request.title}\")\n klass = reference_class(:merge_request)\n data = data_attribute(project.id)\n\n url = url_for_merge_request(merge_request, project)\n\n %(<a href=\"#{url}\" #{data}\n title=\"#{title}\"\n class=\"#{klass}\">#{match}</a>)\n else\n match\n end\n end\n end", "def strip_google_tracking_links(doc)\n doc.css(\"a\").each do |node|\n href = node.attr(\"href\").to_s\n next if href.blank?\n\n query_string = URI.parse(href).query\n actual_url = Rack::Utils.parse_nested_query(query_string)[\"q\"]\n\n node[\"href\"] = actual_url\n end\n end", "def search(date_str)\n doc = get_page_results\n rows = get_todays_rows(doc, date_str)\n # to get the relevant links\n regex = /puppy|pup|Pup|dog|Dog/\n results = filter_links(rows, regex)\nend", "def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end", "def extract_links\n content.css('a').map { |a| a['href'] unless a['href'] == '#' }.compact.uniq\n end", "def filter_link_helper_all(text, filter_params={}, other_params={}, opts={})\n filter_link_helper(text, filter_params.merge(ErrataFilter::FILTER_DEFAULTS_ALL), other_params, opts)\n end", "def extractLinks(page)\n\tbase_wiki_url = \"https://en.wikipedia.org\"\n\tlinks = page.search(\"//a\")\n\tlinks = links.map{|item| item[\"href\"]}\n\n\t#Appending with base_wiki_page to make it full fledged page.\n\tlinks = links.map{|link| base_wiki_url+link.to_s}\n\n\treturn stripUnwantedLinksBasedOnCondition(links)\nend", "def snippet_link_filter(text)\n self.class.references_in(text) do |match, id, project_ref|\n project = self.project_from_ref(project_ref)\n\n if project && snippet = project.snippets.find_by(id: id)\n push_result(:snippet, snippet)\n\n title = escape_once(\"Snippet: #{snippet.title}\")\n klass = reference_class(:snippet)\n data = data_attribute(project.id)\n\n url = url_for_snippet(snippet, project)\n\n %(<a href=\"#{url}\" #{data}\n title=\"#{title}\"\n class=\"#{klass}\">#{match}</a>)\n else\n match\n end\n end\n end", "def non_fulltext_links\n links = []\n other_customlinks = @record.fetch('CustomLinks',{})\n if other_customlinks.count > 0\n other_customlinks.each do |other_customlink|\n link_url = other_customlink['Url']\n link_label = other_customlink['Text']\n link_icon = other_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-other'})\n end\n end\n\n links\n end", "def process_links!(source)\r\n links.each{ |l| source.gsub!(\"[[#{l}]]\", link(l)) }\r\n end", "def asset_link_filter(asset_array)\n asset_array.select do |asset|\n asset.split(//).last != '/'\n end\n # TODO: also filter out .html endings\n end", "def list_links(args = {})\n if args.empty?\n links\n else\n links.select { |link| link.match? args }\n end\n end", "def object_link_filter(text, pattern, link_content: nil, link_reference: false)\n references_in(text, pattern) do |match, id, project_ref, namespace_ref, matches|\n parent_path = if parent_type == :group\n reference_cache.full_group_path(namespace_ref)\n else\n reference_cache.full_project_path(namespace_ref, project_ref)\n end\n\n parent = from_ref_cached(parent_path)\n\n if parent\n object =\n if link_reference\n find_object_from_link_cached(parent, id)\n else\n find_object_cached(parent, id)\n end\n end\n\n if object\n title = object_link_title(object, matches)\n klass = reference_class(object_sym)\n\n data_attributes = data_attributes_for(link_content || match, parent, object,\n link_content: !!link_content,\n link_reference: link_reference)\n data_attributes[:reference_format] = matches[:format] if matches.names.include?(\"format\")\n\n data = data_attribute(data_attributes)\n\n url =\n if matches.names.include?(\"url\") && matches[:url]\n matches[:url]\n else\n url_for_object_cached(object, parent)\n end\n\n url.chomp!(matches[:format]) if matches.names.include?(\"format\")\n\n content = link_content || object_link_text(object, matches)\n\n link = %(<a href=\"#{url}\" #{data}\n title=\"#{escape_once(title)}\"\n class=\"#{klass}\">#{content}</a>)\n\n wrap_link(link, object)\n else\n match\n end\n end\n end", "def mention_link_filter(text, base_url='/', issueid_pattern)\n self.class.mentioned_issues_in(text, issueid_pattern) do |match, issueid|\n link = link_to_mentioned_issue(issueid)\n link ? match.sub(\"\\##{issueid}\", link) : match\n end\n end", "def filter_links(html_string)\n\thash = {}\n\t# Get links from HTML content\n\tlink_regex = /<a href=\"\\/wiki[^>]*?>/\n\thtml_string.each_line { |line|\n\t\tmatches = line.scan(link_regex)\n\t\tmatches.each { |link|\n\t\t\t# Remove special links\n\t\t\tif link !~ /\\/wiki\\/(Book|Book_talk|Category|File|Forum|Help|Portal|Portal_talk|Special|Talk|Template|Thread|User|User_blog|User_talk|Wikipedia|Wikipedia_talk):/\n\t\t\t\t# Remove ?redirect=no links\n\t\t\t\tif link !~ /\\?redirect=no/\n\t\t\t\t\t# Remove links without title=\"...\"\n\t\t\t\t\tif link =~ /title=\".*?\"/\n\t\t\t\t\t\t# Remove any fragments\n\t\t\t\t\t\tif link =~ /(.*)#.*?(\".*)/\n\t\t\t\t\t\t\tlink = $1 + $2\n\t\t\t\t\t\tend\n\t\t\t\t\t\tlink = link.to_sym\n\t\t\t\t\t\tif !hash.has_key?(link)\n\t\t\t\t\t\t\thash[link] = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\t}\n\treturn hash\nend", "def search\n \n\t# Verifica se os parametros nao estao nulos\n if not params[:description].nil? and not params[:link][:category_id].nil? then\n\t\n\t\t# Formata a variavel descricao para fazer a consulta com LIKE corretamente\n\t\tdescription = \"%\" + params[:description] + \"%\"\n\t\t\n\t\t# Define as condicoes de busca\n\t\tconditions = \"category_id = :category AND description LIKE :description\"\n\t\t\n\t\t# Realiza a busca no banco de dados\n\t\t@links = Link.where(conditions, {:category => params[:link][:category_id], :description => description})\n\t\t\n\tend\n end", "def filter_urls(url_hash)\n if @filter\n Youtube.notify \"Using filter: #{@filter}\"\n filtered = url_hash.select { |url, title| title =~ @filter }\n filtered.keys\n else\n url_hash.keys\n end\n end", "def initialize_url_filters\n # We use a hash which tells the domains to filter.\n # The hash value tells that if company name contains that string then don't filter\n @url_filter = Hash.new\n @url_filter[\"facebook.com\"] = \"facebook\"\n @url_filter[\"linkedin.com\"] = \"linkedin\"\n @url_filter[\"wikipedia.org\"] = \"wikipedia\"\n @url_filter[\"yahoo.com\"] = \"yahoo\"\n @url_filter[\"zdnet.com\"] = \"zdnet\"\n @url_filter[\"yelp.com\"] = \"yelp\"\n @url_filter[\"yellowpages.com\"] = \"yellowpages\"\n @url_filter[\"thefreelibrary.com\"] = \"thefreelibrary\"\n @url_filter[\"thefreedictionary.com\"] = \"thefreedictionary\"\n @url_filter[\"superpages.com\"] = \"superpages\"\n @url_filter[\"businessweek.com\"] = \"week\"\n @url_filter[\"indiamart.com\"] = \"mart\"\n @url_filter[\"naukri.com\"] = \"naukri\"\n @url_filter[\"monsterindia.com\"] = \"monster\"\n @url_filter[\"answers.com\"] = \"answers\"\n @url_filter[\"sulekha.com\"] = \"sulekha\"\n @url_filter[\"asklaila.com\"] = \"asklaila\"\n @url_filter[\"blogspot.com\"] = \"blogspot\"\n @url_filter[\"manta.com\"] = \"manta\"\n @url_filter[\"zoominfo.com\"] = \"zoom\"\n @url_filter[\"twitter.com\"] = \"twitter\"\n @url_filter[\"hotfrog.com\"] = \"hotfrog\"\n @url_filter[\"amazon.com\"] = \"amazon\"\n end", "def get_link_filter\n return super if datastore['ExcludePathPatterns'].to_s.empty?\n\n patterns = opt_patterns_to_regexps( datastore['ExcludePathPatterns'].to_s )\n patterns = patterns.map { |r| \"(#{r.source})\" }\n\n Regexp.new( [[\"(#{super.source})\"] | patterns].join( '|' ) )\n end", "def label_link_filter(text)\n project = context[:project]\n\n self.class.references_in(text) do |match, id, name|\n params = label_params(id, name)\n\n if label = project.labels.find_by(params)\n push_result(:label, label)\n\n url = url_for_label(project, label)\n klass = reference_class(:label)\n\n %(<a href=\"#{url}\"\n class=\"#{klass}\">#{render_colored_label(label)}</a>)\n else\n match\n end\n end\n end", "def find_links_to(url, &block)\n url, selector = if url.kind_of? Array\n [url[1], url[0]]\n else\n [url, 'a']\n end\n \n links = (@data/selector).find_all do |link|\n link[:href].match(strip_url_params(url)) if link and link[:href]\n end\n \n links = links.compact.collect { |link| [link[:href], link.inner_text] }.uniq[0..@_hits - 1]\n \n links.collect do |link|\n yield link[0]\n end\n end", "def extract_links(doc)\n (doc/'a').map { |link|\n href = link['href']\n CGI.unescapeHTML(href) if href && href !~ /^#/\n }.compact\n end", "def links(doc)\n links = []\n doc.search(\"//a[@href]\").each do |a|\n u = a['href']\n next if u.nil? or u.empty?\n links << u\n end\n links.uniq!\n links\n end", "def assert_absence_of_non_kamishibai_links(options = {})\n ignores = options[:except] || []\n ignores += accepted_non_kamishibai_links\n\n css_select(\"a\").each do |anchor|\n href = anchor.attributes[\"href\"]\n next if ignores.detect{|regexp| href =~ regexp}\n method = anchor.attributes[\"method\"] || anchor.attributes[\"data-method\"]\n next if !method.blank? && method.upcase != \"GET\"\n if @request.user_agent != user_agent_strings_for(:galapagos)\n if href !~ /^http/ && href !~ /^#/\n assert false, \"Non-kamishibai local link for #{href} in #{@templates.keys}\"\n end\n else\n if href =~ /^#!_/\n assert false, \"Kamishibai local link advertantly for #{href} in #{@templates.keys}\"\n end\n end\n end\n end", "def strip_links(html); end", "def strip_links(html); end", "def strip_links(html); end", "def search2(doc)\n doc.search('.subtext > a:nth-child(3)').map {|link| link['href'] }\n end", "def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://search.yahoo.com/search?p=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Technorati\", 'http://www.technorati.com/search' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Wikipedia\", 'http://en.wikipedia.org/w/wiki.phtml?search=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"del.icio.us\", 'http://del.icio.us/search/?all=' + search_str, :target => '_blank'\n end", "def matching_links(type)\n link_pattern = config.public_send(\"link_#{type}_pattern\")\n return [] unless link_pattern\n\n metadata\n .select { |key| __send__(\"#{type}?\", key) }\n .map { |key, value| Allure::ResultUtils.public_send(\"#{type}_link\", key.to_s, value, link_pattern) }\n end", "def hide_filter\n perm_links = ministry.lmi_hide.map { |lmi| \"lmi_total_#{lmi}\" }\n query = table[:perm_link].does_not_match(\"%_custom_%\")\n query = query.and(table[:perm_link].not_in(perm_links)) if perm_links.any?\n query\n end", "def strip_links\n gsub(%r{</?a.*?>}, \"\")\n end", "def groups_links\n noko.css('div.toc li a').partition { |a| a.attr('href').include? CEASED_MEMBERS_URL }\n end", "def render_rlb_filter_link( filter, name, count, html_options = {} )\n return if count <= 0\n link = @more_results_url.dup\n link << \"?\" unless link.match(/\\?/)\n link << \"&\" unless link.match(/(\\?|\\&)$/)\n link << \"#{filter}=1\"\n \" - \" + link_to( t( name, :count => count ), link , html_options )\n end", "def urlFilter(url)\n nameRegex = /^#{Page::NAME_FORMAT}$/\n\n # check if link matches name spec already\n return url if nameRegex.match url\n\n if url.start_with? \"/\"\n # this is an url that leads to somewhere on samfundet.no\n begin\n uri = URI.join(request.protocol + request.host, url)\n rescue\n return url\n end\n else\n begin\n uri = URI(url)\n rescue\n return url\n end\n end\n\n # We only handle http, https. We also let uris not specifying protocol go trough, since they probably are http.\n unless uri.scheme.nil? || uri.scheme == \"http\" || uri.scheme == \"https\"\n # This is an url, but we a different protocol than http.\n # drop this url\n return nil\n end\n\n if uri.host == request.host\n # this is a link that leads to samfundet.no\n begin\n # recognize_path throws 404 if it doesn't find a valid distination\n destination = Rails.application.routes.recognize_path uri.to_s\n if destination[:controller] == \"pages\" && destination[:action] == \"show\"\n # this is some link that resolves to an info page\n return destination[:id]\n else\n # this is a link that leads to something else than an info page\n return uri.path\n end\n rescue\n # recognizing path failed\n # this link probably doesn't lead anywhere on the page\n return uri.path\n end\n else\n return url\n end\n end", "def unconnected_links\n\t\tLink.available.select { |l| links.find_by(provider: l[:link_name] || l[:name].downcase) == nil }\n\tend", "def links\n @links ||= parsed_links.map{ |l| absolutify_url(unrelativize_url(l)) }.compact.uniq\n end", "def show_links?\n edata = extra_data\n bitvalue = edata[\"m_search_engines\"].to_i\n is_a_search_link_set = [1,2,4,8,16].map do |a| \n (bitvalue & a) > 0 ? 1 : nil \n end.compact.size > 0\n is_a_search_link_set || (edata[\"artist\"] &&\n !edata[\"artist\"][\"name\"].blank? &&\n !edata[\"artist\"][\"url\"].blank?)\n end", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def visit_links\n @link_rules.accept\n end", "def links\n return @links if (defined?(@links) && !@links.nil?)\n @links = Nokogiri::HTML.parse(@html).css('a')\n @links = @links.map {|link| link.attribute('href').to_s}\n @links = @links.delete_if{ |link| (link.nil? || link.to_s == '') }\n\n # remove non-HTTP links\n @links = @links.delete_if{|x| x if !x.match(\"http\")}\n\n # handle HTTP redirect links\n # i.e. 'http://www.google.com/?=http://www.cats.com'\n @links = @links.map{|x| \"http\" + x.split(\"http\").last}.compact\n\n # Remove URL params from links\n @links = @links.map{|x| x.split(/\\?|\\&/).first}.compact\n\n # Sanitize links\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n\n # Remove link proxies(i.e. from Google) & decode URI again\n if url.match(/google\\.com/i)\n @links = @links.map{|x| x.split(\"%2b\").first}.compact\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n end\n\n return @links.uniq\n end", "def index\n @links = Link.where('owners LIKE ?', current_user.email).order(:name)\n end", "def html_filter_manual_reference_links\n return if index.nil?\n\n name_pattern = '[0-9A-Za-z_:.+=@~-]+'\n\n # Convert \"name(section)\" by traversing text nodes searching for\n # text that fits the pattern. This is the original implementation.\n @html.search('.//text() | text()').each do |node|\n next unless node.content.include?(')')\n next if %w[pre code h1 h2 h3].include?(node.parent.name)\n next if child_of?(node, 'a')\n node.swap(node.content.gsub(/(#{name_pattern})(\\(\\d+\\w*\\))/) do\n html_build_manual_reference_link($1, $2)\n end)\n end\n\n # Convert \"<code>name</code>(section)\" by traversing <code> nodes.\n # For each one that contains exactly an acceptable manual page name,\n # the next sibling is checked and must be a text node beginning\n # with a valid section in parentheses.\n @html.search('code').each do |node|\n next if %w[pre code h1 h2 h3].include?(node.parent.name)\n next if child_of?(node, 'a')\n next unless node.inner_text =~ /^#{name_pattern}$/\n sibling = node.next\n next unless sibling\n next unless sibling.text?\n next unless sibling.content =~ /^\\((\\d+\\w*)\\)/\n node.swap(html_build_manual_reference_link(node, \"(#{$1})\"))\n sibling.content = sibling.content.gsub(/^\\(\\d+\\w*\\)/, '')\n end\n end", "def get_urls(target)\n trail_urls = []\n i = 24\n while i < 162\n search_page_hike_url = target[i].to_s\n search_page_hike_url = search_page_hike_url.gsub(\"&amp;\", \"&\")\n search_page_hike_url = search_page_hike_url.gsub(/\\<a href=\"/, \"\")\n search_page_hike_url = search_page_hike_url.gsub(/\" .*/, \"\")\n trail_urls << search_page_hike_url\n i+=1\n end\n trail_urls\nend", "def to_links(per_page = 100)\n htag_set = Set.new\n\n search = Twitter::Search.new\n @search.per_page(100).fetch.each do |msg|\n links = msg.text.split(\" \").select { |f| f.strip =~ /^https?:/ }\n links.each { |link| htag_set.add(link.strip) }\n end\n\n htag_set\n end", "def filter_entries(entries)\n entries = entries.reject do |e|\n unless ['.htaccess'].include?(e)\n ['_', '#'].include?(e[0..0]) ||\n e[-1..-1] == '~' ||\n File.symlink?(e)\n end\n end\n end", "def reject_social_links(attributes)\n attributes[\"url\"].blank? && !self.social_links.where(site: attributes[\"site\"]).exists?\n end", "def search_page_use_hpricot(url)\n # do something and put the new urls into the queue\n doc = Hpricot(open(url,{\n 'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.0)'\n }))\n converter = Iconv.new('utf-8', 'GBK')\n doc.search('a').each do |a|\n # a.inner_html.force_encoding('utf-8') is useless\n begin\n if a.attributes['href'] != nil && !filtered?(a.attributes['href'])\n #sync_puts \"#{converter.iconv(a.inner_html)} => #{a.attributes['href']}\"\n @queue.push(a.attributes['href'])\n end\n rescue ArgumentError\n sync_puts \"ArgumentError!!!\"\n end\n end\n end", "def filter_link_for(ctype)\n link_to ctype.to_name_s, :action => 'index', :filter => ctype.to_name_s('+')\n end", "def search3(doc)\n doc.search('.title > a:first-child').map { |link| link.inner_text}\n end", "def get_mag_index_pages(mag_url)\n links = []\n doc = Nokogiri::HTML(open(mag_url, :allow_redirections => :safe)) \n doc.css(\"a[href]\").each do |p|\n if p.attribute('href').to_s.include? \"#issues\"\n links.push(p.attribute('href').to_s)\n end\n end\n # the link of the actual url is not in the array. it needs to be,\n # since this is the first page that index issues.\n links.push(mag_url)\n return links.uniq\nend", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact\n self\n end", "def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end", "def relevant_fulltext_link?(link)\n relevant_links.map { |x| link[:url].include?(x) }.any?\n end", "def links\n @data.links ||= parsed_document.search(\"//a\") \\\n .map {|link| link.attributes[\"href\"] \\\n .to_s.strip}.uniq rescue nil\n end", "def duplicate_amp_recipes\n base_url = URI.parse(recipe_url).host\n Recipe.where(title: title).where(\"recipe_url LIKE '%#{base_url}%'\").where(\"recipe_url LIKE '%/amp%'\")\n end", "def get_other_apps_url(url)\n developper_url = check_developper(url)\n dev_page = Nokogiri::HTML(open(developper_url).read)\n tmp = dev_page.search('.card-click-target')\n apps_arr = Array.new(dev_page.search('a.card-click-target'))\n urls = []\n for i in apps_arr do\n tmp = i.attribute('href').value\n tmp = modify_link(tmp)\n urls << tmp\n end\n urls = urls.uniq\n self_url = $self_url.gsub(/https:..play.google.com/,'')\n #here\n urls.include?(self_url)\n return urls\nend", "def get_movelist_urls_sf(search_url)\n results = Nokogiri::HTML(open(MOVELIST_SEARCH_URL_SF))\n result_links = results.css('li.result > article > h1 > a')\n movelist_urls = result_links.select{ |el|\n el.text.downcase.include? \"list of moves\"\n }.map{ |el|\n el.attribute('href').value\n }\nend", "def index\n raise 'no page params' if params[:search][:page].blank?\n page, value = params[:search][:page], params[:search][:value]\n\n if page.include? 'home'\n logger.debug('!! searging by all')\n @links = Link.search value\n elsif page.include? 'favorit'\n logger.debug('!! searging by favorits')\n @links = Link.search value, :with => {:favorits_user_id => current_user.id}\n elsif page.include? 'links'\n logger.debug('!! searging by my links')\n @links = Link.search value, :with => {:user_id => current_user.id}\n end\n\n respond_to do |format|\n format.html\n end\n end", "def open_links\n WebLink.where(archived: false).joins(\"LEFT OUTER JOIN archive_links ON archive_links.web_link_id = web_links.id AND archive_links.user_id = #{self.id}\").where(\"archive_links.id IS NULL\")\n end", "def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end", "def filtered_references\n super.select do |ref|\n ref.candidate_uris.for(class:URI::DOI).nil?\n end\n end", "def extracthref(serps)\n split_array=[]\n #go through the serps NodeList one by one and extract the href attribute of the anchor tags\n (0..serps.length-1).each {|i|\n serps_url = serps[i]['href']\n #remove junk that Google appends before and after the end of the returned search result pages\n #using a funky regular expression and push it into a new array\n split_array.push(serps_url.split(/(http.*?)(?=&)/))\n }\n #delete the junk in the array before the element we need\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(0)\n }\n #delete the junk in the array after the element we need (note all elements have moved index by one)\n #due to the last function\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(1)\n }\n split_array\nend", "def backlinks(title, filter = \"all\")\n titles = []\n blcontinue = nil\n begin\n form_data =\n {'action' => 'query',\n 'list' => 'backlinks',\n 'bltitle' => title,\n 'blfilterredir' => filter,\n 'bllimit' => @options[:limit] }\n form_data['blcontinue'] = blcontinue if blcontinue\n res, blcontinue = make_api_request(form_data, '//query-continue/backlinks/@blcontinue')\n titles += REXML::XPath.match(res, \"//bl\").map { |x| x.attributes[\"title\"] }\n end while blcontinue\n titles\n end", "def skip_links_like(*patterns)\n if patterns\n patterns.each do |pattern|\n @skip_link_patterns << pattern\n end\n end\n self\n end", "def show_super_search_links_on_index\n false \n end", "def filter_tweets_with_urls tweets_array\n tweets_with_urls = []\n tweets_array.each do |tweets|\n tweets.each do |tweet|\n # TODO remove this, just for debugging\n# tweet.urls.each do |url|\n# p url.display_url\n# end\n tweets_with_urls << tweet unless tweet.urls.empty?\n end\n end\n tweets_with_urls\n end", "def get_internal_links(doc)\n doc.internal_full_links\n .map(&:without_anchor) # Because anchors don't change page content.\n .uniq\n .reject do |link|\n ext = link.to_extension\n ext ? !%w[htm html].include?(ext) : false\n end\n end", "def check_other_links!\n self.gsub!(OTHER_LINK_PATTERN) do |orig|\n result = orig\n prefix, type, id = $1, $2, $3\n matches = [\n ['comment'],\n ['image', 'img'],\n ['location', 'loc'],\n ['name'],\n ['observation', 'obs', 'ob'],\n ['project', 'proj'],\n ['species_list', 'spl'],\n ['user']\n ].select {|x| x[0] == type.downcase || x[1] == type.downcase}\n if matches.length == 1\n if id.match(/^\\d+$/)\n label = \"#{type} #{id}\"\n else\n label = id\n end\n result = \"#{prefix}x{#{matches.first.first.upcase} __#{label}__ }{ #{id} }x\"\n end\n result\n end\n end", "def links\n if params[:links]\n titles = params[:links][:title]\n url = params[:links][:url]\n s = titles.zip(url)\n @external_links = []\n if (params[:label] == \"Classrooms\" || params[:label] == \"Subjects\") \n if params[:label] == \"Subjects\"\n label = \"Subjects\"\n else\n label = \"Classrooms\"\n end\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:classroom_id => @classroom.id, :label => label,\n :title => a[1], :url => a[3] })\n end\n end\n else\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:title => a[1], :label => params[:label], :url => a[3] })\n end\n end\n end\n end\n end", "def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end", "def links; end", "def links; end", "def filter\n doc = @mode == :xml ? Hpricot.XML(@str) : Hpricot(@str)\n attr_rgxp = %r/\\[@(\\w+)\\]$/o\n path_to_root = \"\"\n path_parts = @page.destination.split('/') - SITE.output_dir.split('/')\n (path_parts.length - 1).times { path_to_root += \"../\" }\n Webby.site.xpaths.each do |xpath|\n @attr_name = nil\n doc.search(xpath).each do |element|\n @attr_name ||= attr_rgxp.match(xpath)[1]\n a = element.get_attribute(@attr_name)\n if a[0..0] == '/' # Only 'fix' absolute URIs\n new_uri = path_to_root + a[1..-1]\n # puts \"Updating URI: #{a}\"\n # puts \" to: #{new_uri}\"\n element.set_attribute(@attr_name, new_uri)\n end\n end\n end\n \n doc.to_html\n end", "def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end", "def extract_all_links(html, base)\n base_url = URI.parse(base)\n doc = Nokogiri::HTML(html)\n links = []\n doc.css(\"a\").each do |node|\n \n begin\n uri = URI(node['href'])\n if uri.absolute? and uri.scheme != \"javascript\" \n links << uri.to_s\n elsif uri.path.start_with?(\"/\")\n uri = base_url + uri\n end\n rescue\n # don't do anything\n end\n end \n links.uniq\n end", "def retrieve_links(search_service, site, page)\n term = search_service.and_query(\"site:#{site}\", name, page)\n result = extract_first_result(search_service, query_bing(search_service, term))\n unless (result.nil? || result.url.nil?)\n enhance_with_bing(page, result)\n end\n end", "def collect_links(html)\n Hash[Nokogiri::HTML(html).css('a').collect {|node| [node.text.strip, node.attributes['href'].to_s]}]\n end", "def link_to_remove_filter(text, params, class_name=\"remove_filter\")\n url = request.url\n url += '?' unless url.split('?').count > 1 \n @p = text.gsub(' ', '_') \n params.each do |k, v|\n url = url.sub(\"&#{k}=#{v.gsub(' ', '+')}\", '')\n end\n unless params[:st].blank?\n text = \"<input type='checkbox' checked='true' onClick='a(\\\"#{url}\\\")' /><div class='star_rating'>#{pretty_star_rating text}</div><span>#{text} Stars+</span>\".html_safe\n else \n text = \"<input type='checkbox' checked='true' onClick='a(\\\"#{url}\\\")'><span>#{text}</span>\".html_safe\n end\n \n # link_to text, url, :class => class_name\n end", "def extract_social_links(type, exclude=\"\")\n social_url = @@social_links[type] || type\n\n # find all websites for an item\n @item.links.where(:link_type_id => website_link_type_id).map { |website_link|\n # search for pages on the item's website that link to the social network\n google_search(\"link:#{social_url} #{exclude} AND \", website_link.link_url).collect(&:uri).collect { |org_page_url|\n # request a page and grab all of the links for that page\n # filter the links to only include those that are to the social networ\n URI.extract(Net::HTTP.get(URI.parse(org_page_url))).select { |link|\n link.downcase.include?(social_url)\n }\n }\n }.flatten.collect { |link| normalize_link(type, link) }.uniq.select { |link| usable_link?(type, link) }\n end" ]
[ "0.699109", "0.69394594", "0.66918635", "0.6669999", "0.66317844", "0.65998936", "0.6553799", "0.65034235", "0.64443773", "0.6410349", "0.6396636", "0.6394018", "0.6269745", "0.62178856", "0.6214081", "0.6188525", "0.6159125", "0.6129926", "0.61267155", "0.61257315", "0.61206925", "0.6064104", "0.60613745", "0.6024706", "0.60157025", "0.60153675", "0.60001886", "0.5997117", "0.59837383", "0.59361094", "0.5931155", "0.58925307", "0.5866316", "0.5844924", "0.58200544", "0.58070993", "0.57887095", "0.57724106", "0.57552606", "0.57446426", "0.57211673", "0.57211673", "0.57211673", "0.5717591", "0.56898636", "0.5676028", "0.56652176", "0.56622773", "0.56352866", "0.5631891", "0.5631885", "0.56289375", "0.5621458", "0.5614468", "0.5609295", "0.5609295", "0.5599454", "0.5582805", "0.5570187", "0.5564541", "0.55644757", "0.55609864", "0.55579954", "0.5549996", "0.55454326", "0.5536301", "0.55340135", "0.5523983", "0.55174536", "0.55174536", "0.55174536", "0.55167544", "0.55043787", "0.55016893", "0.54941803", "0.5490124", "0.54871756", "0.54843974", "0.5470054", "0.5451653", "0.54513896", "0.5449968", "0.54473996", "0.5440625", "0.5439503", "0.5436451", "0.5435325", "0.543345", "0.54334325", "0.5433298", "0.54225326", "0.5420631", "0.5420631", "0.54040277", "0.5401262", "0.5401058", "0.54007185", "0.5395679", "0.5394145", "0.53923655" ]
0.6522986
7
GET /cards GET /cards.json
def index #@cards = Card.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end", "def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end", "def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end", "def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end", "def show\n render json: @card\n end", "def show\n render json: @card\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = PkCard.find(params[:id])\n render json: @card\n end", "def show\n render json: @card, status: :ok\n end", "def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end", "def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end", "def show\n # @card = Card.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @card }\n # end\n end", "def show\n respond_to do |format|\n format.html {}\n format.json { render json: {id: @card.id, name: @card.name} }\n end\n end", "def index\n # @cards = Card.all INSTEAD, order cards by most recent card created:\n @cards = Card.order('updated_at DESC')\n render json: @cards\n end", "def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def show\n # @card = current_user.cards.find(params[:id])\n @card = Card.all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render json: { \"data\": { \"card\": @card.as_json(include: [:book, :user]) } },\n status: :ok\n }\n end\n end", "def cards\n @cards ||= @client.resource['creditCards']\n end", "def index\n @cards = @deck.cards\n end", "def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end", "def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end", "def show\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scorecard }\n end\n end", "def index\n @cards = @deck.cards.all\n end", "def show\n @team = Team.find(params[:id])\n @cards = @team.cards :all, :limit => 10\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team }\n end\n end", "def show\n @cruno_card = CrunoCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cruno_card }\n end\n end", "def index\n @scorecards = Scorecard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scorecards }\n end\n end", "def show\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_set }\n end\n end", "def show\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_number }\n end\n end", "def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end", "def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end", "def show\n \tif(!params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n render status: 200, json: {\n company_cards: card\n }.to_json\n \n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n end", "def index\n @m_cards = MCard.all\n end", "def card\n Card.from_response client.get(\"/actions/#{action_id}/card\")\n end", "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end", "def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end", "def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend", "def cards\n @cards\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end", "def get_cards\n \tif (!stripe_customer_id.nil?)\n\t customer = Stripe::Customer.retrieve(stripe_customer_id)\n\t puts customer.cards\n\t return customer.cards\n\telse\n\t\treturn nil\n\tend\n end", "def cards_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardsApi.cards_list ...'\n end\n # resource path\n local_var_path = '/cards/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2002' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardsApi#cards_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtb_card }\n end\n end", "def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end", "def uri\n 'cards'\n end", "def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end", "def show\n @card = Card.find_by_access_token!(params[:id])\n @destination = @card.destination\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @card }\n end\n end", "def random\n random_card = self.class.get('/cards/random')\n end", "def card_list(card_id, options = {})\n card_resource(card_id, \"list\", options)\n end", "def get_card_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.get_card_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/card'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCard')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#get_card_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @ccards = Ccard.all\n end", "def get_cards(deck)\n\n end", "def index\n @cards = Card.order(:full_name).page params[:page]\n end", "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "def show\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flashcard }\n end\n end", "def show\n @owner = Owner.find(params[:id])\n @cards = []\n @owner.cards.each do |card|\n @cards << [\"#{card.name} (#{card.brand.category})\", card.count]\n end \n end", "def index\n respond_with GameProcess.new(session[:game_session]).get_deck_cards\n end", "def index\n @user_cards = UserCard.all\n end", "def index\n @user_cards = UserCard.all\n end", "def index\n if params[:user_id]\n @user = User.find params[:user_id]\n @cards = @user.cards\n @actions = [{\"YGO战网\" => users_path}, @user, \"常用卡片\"]\n else\n @cards = Card.joins(:duel_user_cards)\n @actions = [{\"YGO战网\" => users_path}, \"卡片排行\"]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end", "def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end", "def first\n @cards = Card.where(:first => params[:first])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def index\n @card = @deck.cards.find(:first, :order => 'RAND()')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cards }\n end\n end", "def index\n @cards = Card.all\n\n if @cards.count < 5\n store_call_words\n end\n\n render json: @cards\n end", "def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end", "def show\n @item_cardapio = ItemCardapio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item_cardapio }\n end\n end", "def scorecard\n\n teetime_id = params.require :teetime_id\n\n @scorecard = Score.where(teetime_id: teetime_id).order(:hole)\n\n\n\n render json: @scorecard,root: :scorecard\n\n end", "def get_all_client_cards_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.get_all_client_cards_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/card/cardholder_overview'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageClientBusinessCardVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#get_all_client_cards_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reg_card }\n end\n end", "def index\n list = List.all.sort_by{ |l| l.position }\n render json: list.map { |x| [ x.name, x.cards ] }.to_h\n end", "def get_cards_from_trello\n list = get_doing_list\n return list.cards\n end", "def index\n @entry_cards = EntryCard.all\n end", "def creditCardIndex\n render json: Approved.allCreditCard\n end", "def index\n @deck_of_cards = DeckOfCard.all\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safety_card }\n end\n end", "def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end", "def show\n set_match\n profile_info\n\n @bdcard = Bdcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdcard }\n end\n end", "def cards_list(opts = {})\n data, _status_code, _headers = cards_list_with_http_info(opts)\n data\n end", "def index\n @blog_cards = Blog::Card.all\n end", "def index\n @graphic_cards = GraphicCard.all\n end", "def index\n @expansion_of_cards = ExpansionOfCard.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expansion_of_cards }\n end\n end", "def index\n @poker_cards = PokerCard.all\n end", "def scorecards\n expose Challenge.scorecards(@oauth_token, params[:challenge_id].strip)\n end", "def index\n @cards = Card.all\n # p hoge = Member.joins(:card).select(\"cards.*, members.*\").first\n # p hoge.name\n\n # 検索用のセレクトボックスに表示する、名前一覧\n @name_list = @cards.select(:name).order(:name).distinct\n\n # 表示対象のカード\n if params[:name].present?\n @cards = @cards.get_by_name(params[:name])\n end\n if params[:rarity].present?\n @cards = @cards.get_by_rarity(params[:rarity])\n end\n @cards = @cards.order(:number).page(params[:page])\n end", "def cards\n @cards ||= EbanqApi::Cards.new(self)\n end", "def index\n @card_instances = CardInstance.all\n end", "def index\n @card_instances = CardInstance.all\n end", "def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end" ]
[ "0.8067241", "0.78271", "0.7666086", "0.76476836", "0.74856645", "0.74856645", "0.7461866", "0.7461866", "0.7461866", "0.7461866", "0.7461866", "0.74300534", "0.7284355", "0.72508144", "0.72301847", "0.7220295", "0.70856464", "0.7066807", "0.70531297", "0.70461464", "0.70461464", "0.70461464", "0.70461464", "0.6944562", "0.6915544", "0.6898473", "0.6877896", "0.68741566", "0.6859904", "0.68163824", "0.6816057", "0.6769897", "0.676752", "0.6762655", "0.6740178", "0.67233986", "0.6719909", "0.6705704", "0.66787636", "0.66616756", "0.66549134", "0.663433", "0.66331095", "0.66281354", "0.66044766", "0.6594622", "0.65844154", "0.65627635", "0.65532583", "0.6545563", "0.6513036", "0.6511648", "0.6511467", "0.65007734", "0.6495973", "0.64614683", "0.64373523", "0.64318246", "0.64246255", "0.64037895", "0.6401469", "0.6375496", "0.63505065", "0.63505065", "0.634777", "0.63474154", "0.63454103", "0.6340857", "0.6340857", "0.6340857", "0.6340857", "0.6340857", "0.6334816", "0.6330622", "0.63271147", "0.63221884", "0.632071", "0.63140833", "0.6312095", "0.6310239", "0.63057536", "0.63053286", "0.63038373", "0.6297496", "0.6265184", "0.6265184", "0.62583405", "0.6258312", "0.6253479", "0.62508", "0.624763", "0.621472", "0.62098503", "0.6191811", "0.61888903", "0.61867696", "0.61802435", "0.6178642", "0.6178642", "0.61744606" ]
0.69251984
24
GET /cards/1 GET /cards/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "def show\n @card = PkCard.find(params[:id])\n render json: @card\n end", "def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end", "def show\n render json: @card\n end", "def show\n render json: @card\n end", "def show\n # @card = Card.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @card }\n # end\n end", "def show\n respond_to do |format|\n format.html {}\n format.json { render json: {id: @card.id, name: @card.name} }\n end\n end", "def show\n render json: @card, status: :ok\n end", "def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end", "def first\n @cards = Card.where(:first => params[:first])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end", "def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end", "def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end", "def show\n @cruno_card = CrunoCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cruno_card }\n end\n end", "def show\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_number }\n end\n end", "def show\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scorecard }\n end\n end", "def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end", "def show\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_set }\n end\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def index\n @cards = Card.all\n end", "def index\n # @cards = Card.all INSTEAD, order cards by most recent card created:\n @cards = Card.order('updated_at DESC')\n render json: @cards\n end", "def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end", "def index\n #@cards = Card.all\n end", "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end", "def show\n # @card = current_user.cards.find(params[:id])\n @card = Card.all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render json: { \"data\": { \"card\": @card.as_json(include: [:book, :user]) } },\n status: :ok\n }\n end\n end", "def index\n @cards = @deck.cards\n end", "def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end", "def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end", "def show\n \tif(!params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n render status: 200, json: {\n company_cards: card\n }.to_json\n \n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n end", "def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end", "def show\n @team = Team.find(params[:id])\n @cards = @team.cards :all, :limit => 10\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team }\n end\n end", "def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end", "def random\n random_card = self.class.get('/cards/random')\n end", "def show\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtb_card }\n end\n end", "def index\n @cards = @deck.cards.all\n end", "def card\n Card.from_response client.get(\"/actions/#{action_id}/card\")\n end", "def show\n @card = Card.find_by_access_token!(params[:id])\n @destination = @card.destination\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @card }\n end\n end", "def show\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flashcard }\n end\n end", "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "def show\n @item_cardapio = ItemCardapio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item_cardapio }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def uri\n 'cards'\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end", "def show\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reg_card }\n end\n end", "def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end", "def index\n @card = @deck.cards.find(:first, :order => 'RAND()')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cards }\n end\n end", "def index\n @scorecards = Scorecard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scorecards }\n end\n end", "def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end", "def index\n @m_cards = MCard.all\n end", "def new\n #@card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card }\n end\n end", "def show\n @deck = Deck.find(params[:id])\n @masters = @deck.masters\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end", "def cards\n @cards ||= @client.resource['creditCards']\n end", "def show\n set_match\n profile_info\n\n @bdcard = Bdcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdcard }\n end\n end", "def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safety_card }\n end\n end", "def last \n @cards = Card.where(:last => params[:last])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end", "def index\n @cards = Card.order(:full_name).page params[:page]\n end", "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end", "def show\n @hand = Hand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand }\n end\n end", "def show\n @hand = Hand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand }\n end\n end", "def show\n @deck = current_user.decks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end", "def show\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flash_card }\n format.xml { render :xml => @flash_card }\n end\n end", "def show\n @owner = Owner.find(params[:id])\n @cards = []\n @owner.cards.each do |card|\n @cards << [\"#{card.name} (#{card.brand.category})\", card.count]\n end \n end", "def new\n @flashcard = Flashcard.new\n @deck = Deck.find(params[:deck_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flashcard }\n end\n end", "def show\n @make_card = MakeCard.find(params[:id])\n @rechargeable_cards_ids = @make_card.rechargeable_cards.ids\n @rechargeable_cards = RechargeableCard.find(@rechargeable_cards_ids)\n @rechargeable_cards = RechargeableCard.paginate(page: params[:page])\n\n end", "def index\n @ccards = Ccard.all\n end", "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end", "def show\n @student_scorecard = StudentScorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_scorecard }\n end\n end", "def show\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ca }\n end\n end", "def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def show\n @creative = Creative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creative }\n end\n end", "def show\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_card }\n end\n end", "def show\n @card_id = params[:card_id]\n @picture = Picture.find(params[:id])\n respond_with do |format|\n format.html # show.html.erb\n end\n end", "def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end", "def get_cards(deck)\n\n end", "def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend", "def show\n @credit_card_terminal = CreditCardTerminal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_card_terminal }\n end\n end", "def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def creditCardIndex\n render json: Approved.allCreditCard\n end", "def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_set }\n end\n end", "def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card_set }\n end\n end", "def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end", "def index\n @entry_cards = EntryCard.all\n end", "def cards\n @cards\n end", "def index\n if params[:user_id]\n @user = User.find params[:user_id]\n @cards = @user.cards\n @actions = [{\"YGO战网\" => users_path}, @user, \"常用卡片\"]\n else\n @cards = Card.joins(:duel_user_cards)\n @actions = [{\"YGO战网\" => users_path}, \"卡片排行\"]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end", "def new\n @card = @deck.cards.new\n @decks = Deck.all(:order => 'title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @card }\n end\n end", "def scorecard\n\n teetime_id = params.require :teetime_id\n\n @scorecard = Score.where(teetime_id: teetime_id).order(:hole)\n\n\n\n render json: @scorecard,root: :scorecard\n\n end", "def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end", "def index\n @user_cards = UserCard.all\n end" ]
[ "0.78883135", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.76503384", "0.76283175", "0.7469136", "0.7469136", "0.7467715", "0.7419696", "0.73733157", "0.73434144", "0.7250834", "0.71437824", "0.7125837", "0.71233726", "0.70780337", "0.70430386", "0.7022959", "0.70102054", "0.6970597", "0.6970597", "0.6970597", "0.6970597", "0.6953486", "0.6928291", "0.6909738", "0.68868166", "0.6877921", "0.687626", "0.6871552", "0.6844774", "0.68293065", "0.68130034", "0.67898923", "0.6779456", "0.67739964", "0.67492366", "0.6742583", "0.6734149", "0.6699639", "0.6671449", "0.6664987", "0.66620815", "0.6645094", "0.6645094", "0.6645094", "0.6645094", "0.6645094", "0.6644796", "0.66006255", "0.65978205", "0.6595519", "0.6587294", "0.65430135", "0.6533283", "0.6522861", "0.64971423", "0.6475225", "0.64598364", "0.6458127", "0.64086777", "0.639454", "0.6383588", "0.6365025", "0.63586414", "0.6340288", "0.6340288", "0.6325933", "0.6324271", "0.63170904", "0.63119763", "0.6300549", "0.6290039", "0.62897706", "0.6288326", "0.62879866", "0.6280944", "0.6270135", "0.62686366", "0.6262008", "0.62614805", "0.62594014", "0.6259066", "0.62559086", "0.62552184", "0.6250846", "0.6250846", "0.62432635", "0.6242935", "0.6236931", "0.62273157", "0.62249273", "0.62171143", "0.62160385", "0.62143624", "0.61915326", "0.6190276", "0.6189605" ]
0.0
-1
POST /cards POST /cards.json
def create @card = Card.new(card_params) mm = 3.543307 forms = params.require(:card).permit(:name, :kana_name, :department, :postalcode, :address_prefectural, :address_city, :address_street, :address_building, :tel, :email, :course, :laboratory, :free_text, :card_template, :paper_template) paper_template = PaperTemplate.find(forms[:paper_template]) paper = File.read("app/assets/images/paper/" + paper_template.path) card_template = CardTemplate.find(forms[:card_template]) svg = REXML::Document.new(open("app/assets/images/card/" + card_template.path)) # jikanganai svg.root.elements["//*[@id='text_name']"].text = forms[:name] if card_template.department if forms[:department].present? svg.root.elements["//*[@id='text_department']"].text = School.find(Department.find(forms[:department]).school).name + Department.find(forms[:department]).name else svg.root.elements["//*[@id='text_department']"].text = "" end end if card_template.course and forms[:course] if forms[:course].present? svg.root.elements["//*[@id='text_course']"].text = Course.find(forms[:course]).name else svg.root.elements["//*[@id='text_course']"].text = "" end end if card_template.laboratory and forms[:laboratory] if forms[:laboratory].present? svg.root.elements["//*[@id='text_lab']"].text = Laboratory.find(forms[:laboratory]).name else svg.root.elements["//*[@id='text_lab']"].text = "" end end if card_template.tel if forms[:tel].present? svg.root.elements["//*[@id='text_tel']"].text = forms[:tel] else svg.root.elements["//*[@id='text_tel']"].text = "" end end if card_template.email if forms[:email].present? svg.root.elements["//*[@id='text_email']"].text = forms[:email] else svg.root.elements["//*[@id='text_email']"].text = "" end end if card_template.free if forms[:free_text].present? svg.root.elements["//*[@id='text_free']"].text = forms[:free_text] else svg.root.elements["//*[@id='text_free']"].text = "" end end if card_template.address_city if forms[:address_city].present? svg.root.elements["//*[@id='text_address']"].text = Prefectural.find(forms[:address_prefectural]).name + forms[:address_city] + forms[:address_street] + forms[:address_building] else svg.root.elements["//*[@id='text_address']"].text = "" end end card_text = "" xMargin = paper_template.margin_x * mm yMargin = paper_template.margin_y * mm xSize = card_template.size_x * mm ySize = card_template.size_y * mm debug = "" for xNum in 0..(paper_template.cols - 1) do for yNum in 0..(paper_template.rows - 1) do x = xMargin + xSize * xNum y = yMargin + ySize * yNum svgText = svg.root.to_s svgText.gsub!(/<svg[^>]+>/, '') svgText.gsub!(/<\/svg>/, '') svgText.gsub!(/id='([^']+)'/) { "id='" + $1 + xNum.to_s + "_" + yNum.to_s + "'" } svgText.gsub!(/x='([0-9.]+)'/) { "x='" + ($1.to_f + x).to_s + "'" } svgText.gsub!(/y='([0-9.]+)'/) { "y='" + ($1.to_f + y).to_s + "'" } svgText.gsub!(/d='m ([0-9.]+),([0-9.]+)/) { "d='m #{($1.to_f + x).to_s},#{($2.to_f + y).to_s}" } paper.gsub!(/<g \/>/, svgText + "<g />") end end paper.gsub!(/"/, "'") filename = SecureRandom.hex svgFile = File.open("tmp/#{filename}.svg", 'w') svgFile.puts paper pdf = `cat tmp/#{filename}.svg | cairosvg -` svgFile.close File.unlink("tmp/#{filename}.svg") #pdf = `echo "#{paper}" | cairosvg -` send_data pdf, filename: "card.pdf", type: "application/pdf", disposition: "inline" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @card = Card.new(card_params)\n\n if @card.save\n render json: @card, status: :created, location: @card\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end", "def create\n @card = Card.create(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end", "def create\n @card = Card.new(card_params)\n @card.deck_id = params[:deck_id] \n \n if @card.save!\n render :show, status: :created\n else\n render json: @card.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_path, notice: t(\".successfully_created\") }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarot.cards << Card.new(card_params)\n\n respond_to do |format|\n if @tarot.save\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = @deck.cards.build(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully created.' }\n# format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n# format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_url, :notice => 'Card was successfully created.' }\n format.json { render :json => @card, :status => :created, :location => @card }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n @card.user = current_user\n respond_to do |format|\n if @card.save\n format.json { render json: @card, status: :created }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = @deck.cards.build(card_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: deck_card_path(@deck, @card) }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to action: :index, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end", "def create\n @card = Card.new(card_params)\n # todo violation\n @wallet.cards << @card\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to wallet_path, notice: 'Card was successfully created.' }\n format.json { render json: @wallet, status: :ok, location: wallet_path }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Cartão criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(card_params)\n @card[:authorization_id] = Authorization.current_id\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_creditcard\n \n @creditcard = Creditcards.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creditcard }\n end\n end", "def create_card\n\t\t@card = Card.new(params[:card])\n\t\t@card.cardsort_id = params[:cardsort_id]\n\t\trespond_to do |format|\n\t\t\tif (@card.save)\n\t\t\t\tformat.js {render \"new_card\", :status => :created}\n\t\t\telse\n\t\t\t\tformat.js {render \"new_card\", :status => :ok}\n\t\t\tend\n\t\tend\n\tend", "def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end", "def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n notify_admin(\"Card Created (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n flash[:notice] = 'Card was successfully created.'\n format.html { redirect_to(deck_card_path(@deck, @card)) }\n format.xml { render :xml => @card, :status => :created, :location => @card }\n else\n @decks = Deck.all(:order => 'title')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(params[:card])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to create a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_card\n trello = trello_api\n card_options = {\n :name => card_title,\n :list => list_id,\n :description => card_body,\n }\n trello.create_card(card_options)\n end", "def create\n response.headers[\"Content-Type\"] = \"text/javascript\"\n @card = @plan.cards.new(card_params)\n @card.save\n $redis.publish('messages.create', @card.to_json)\n end", "def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end", "def create\n @deck_of_card = DeckOfCard.new(deck_of_card_params)\n\n respond_to do |format|\n if @deck_of_card.save\n format.html { redirect_to @deck_of_card, notice: 'Deck of card was successfully created.' }\n format.json { render :show, status: :created, location: @deck_of_card }\n else\n format.html { render :new }\n format.json { render json: @deck_of_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n token = params[:stripeToken]\n @card = AddStripeCard.call(current_user, card_params, card_additional_params, token)\n # debugger\n respond_to do |format|\n if @card.errors.blank?\n format.html { redirect_to cards_path, notice: \"Card #{current_user.cards.last.card_last_four} was successfully created.\" }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new, alert: \"There was an issue with your card, please try again.\"}\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entry_card = EntryCard.new(entry_card_params)\n\n respond_to do |format|\n if @entry_card.save\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @Point2Card = Point2Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Point2Card.save\n render json: {}, status: :created\n else\n render json: @Point2Card.errors, status: :unprocessable_entity\n end\n end", "def create\n @deck = Deck.new_from_api\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to @deck, notice: 'Deck was successfully created.' }\n format.json { render :show, status: :created, location: @deck }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = check_params_and_create(params)\n\n if @card != nil\n render json: {\n :api_key => @card.api_key ,\n :barcode => @card.cardnumber,\n :is_active => @card.is_active,\n :current_balance => @card.balance,\n :balance_total => @card.balance_total,\n :max_balance => @card.program.punch_card}, status:201\n else\n render json: \"Kan de stempelkaart niet aanmaken!\", status:409\n end #@card != nil\n\n end", "def create\n @poker_card = PokerCard.new(poker_card_params)\n\n respond_to do |format|\n if @poker_card.save\n format.html { redirect_to @poker_card, notice: 'Poker card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @poker_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @poker_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @Waste2Card = Waste2Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Waste2Card.save\n render json: {}, status: :created\n else\n render json: @Waste2Card.errors, status: :unprocessable_entity\n end\n end", "def registerCard\n parameters={user_id: (@current_user[\"id\"]).to_i, number: (params[:number]).to_i, amount: (params[:amount]).to_i, expiration_month: (params[:expiration_month]).to_i, expiration_year: (params[:expiration_year]).to_i}\n puts (parameters)\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.104:3003/credit_cards\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def create\n # @card = current_user.cards.new(user_params)\n @card = Card.new(user_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Succeed to create card!\" } }\n format.json {\n render json: @card.as_json(include: [:book, :user]),\n status: :created\n }\n else\n format.html {\n flash[:danger] = \"Error : Failed to create card.\"\n render :new\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @name_card = NameCard.new(name_card_params)\n\n respond_to do |format|\n if @name_card.save\n format.html { redirect_to @name_card, notice: 'Name card was successfully created.' }\n format.json { render :show, status: :created, location: @name_card }\n else\n format.html { render :new }\n format.json { render json: @name_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(params[:card])\n @card.user_id = session[:user_id]\n\n respond_to do |format|\n if @card.save\n listingcard = ListingCard.new do |m|\n m.memoword_id = session[:memoword_id]\n m.card_id = @card.id\n m.memorized = false\n end\n listingcard.save\n #format.html {render action: \"new\" }\n format.html { redirect_to new_card_url, notice: 'カードは作成されBookに登録されました' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = @cards.new(card_params)\n @card.assign_attributes(parent: Card.find_by_id(params[:card][:parent_id])) if params[:card][:parent_id]\n if @card.save\n @card.add_sr_event(1)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end", "def create\n @namecard = Namecard.new(namecard_params)\n\n respond_to do |format|\n if @namecard.save\n format.html { redirect_to @namecard, notice: 'Namecard was successfully created.' }\n format.json { render :show, status: :created, location: @namecard }\n else\n format.html { render :new }\n format.json { render json: @namecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @flashcard = Flashcard.new(params[:flashcard])\n @deck = Deck.find(params[:deck_id]) \n @flashcard.deck = @deck\n respond_to do |format|\n if @flashcard.save\n format.html { redirect_to @flashcard, notice: 'Flashcard was successfully created.' }\n format.json { render json: @flashcard, status: :created, location: @flashcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flashcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card_instance = CardInstance.new(card_instance_params)\n\n respond_to do |format|\n if @card_instance.save\n format.html { redirect_to @card_instance, notice: 'Card owner was successfully created.' }\n format.json { render :show, status: :created, location: @card_instance }\n else\n format.html { render :new }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_one_card\n if request.post?\n front = params[:card][:front]\n back = params[:card][:back]\n\n if front.blank? || back.blank?\n flash[:error] = 'Front and Back must not be blank'\n else\n @deck = Deck.all.select{|x| x.title =~ /^Misc/}.sort_by(&:created_at).last\n\n # first time only\n if @deck.nil?\n @deck = Deck.new(:title => 'Misc 1', :front_description => 'Thai', :back_description => 'English', :active => true)\n @deck.save!(false)\n end\n\n # already have ten cards, make a new one\n if @deck.cards.length >= 10\n @deck.title =~ /^Misc (.*)/\n number = $1.to_i + 1\n @deck = Deck.new(:title => \"Misc #{number}\", :front_description => 'Thai', :back_description => 'English', :active => true)\n @deck.save!(false)\n end\n\n Card.create(:front => front, :back => back, :deck_id => @deck.id)\n flash[:notice] = \"Added card to deck #{@deck.title}, front: #{front}, back: #{back}\"\n end\n end\n\n render :layout => false\n end", "def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end", "def create\n @user_card = UserCard.new(user_card_params)\n\n respond_to do |format|\n if @user_card.save\n format.html { redirect_to @user_card, notice: 'User card was successfully created.' }\n format.json { render :show, status: :created, location: @user_card }\n else\n format.html { render :new }\n format.json { render json: @user_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scorecard = Scorecard.new(params[:scorecard])\n\n respond_to do |format|\n if @scorecard.save\n format.html { redirect_to @scorecard, notice: 'Scorecard was successfully created.' }\n format.json { render json: @scorecard, status: :created, location: @scorecard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scorecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @m_card = MCard.new(m_card_params)\n respond_to do |format|\n if @m_card.save\n format.html { redirect_to m_cards_path, notice: 'カード追加しました' }\n format.json { render action: 'show', status: :created, location: m_cards_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end", "def create_card(list_id, name = nil, options = {})\n post \"cards\", options.merge(name: name, list_id: resource_id(list_id))\n end", "def create\n @owned_card = OwnedCard.new(owned_card_params)\n @owned_card.user = current_user\n\n respond_to do |format|\n if @owned_card.save\n format.html { redirect_to @owned_card, notice: 'Owned card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @owned_card }\n else\n @cards = @owned_card.printing.card.printings\n format.html { render action: 'new' }\n format.json { render json: @owned_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @keycard = Keycard.new(keycard_params)\n\n respond_to do |format|\n if @keycard.save\n format.html { redirect_to keycards_path, notice: 'keycard was successfully created.' }\n format.json { render :show, status: :created, location: @keycard }\n else\n format.html { render :new }\n format.json { render json: @keycard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @Point3Card = Point3Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Point3Card.save\n render json: {}, status: :created\n else\n render json: @Point3Card.errors, status: :unprocessable_entity\n end\n end", "def card_params\n params.require(:card).permit(:title, :description)\n end", "def card_params\n params.require(:card).permit(:number, :name, :text, :description)\n end", "def create\n @cruno_card = CrunoCard.new(params[:cruno_card])\n\n respond_to do |format|\n if @cruno_card.save\n format.html { redirect_to @cruno_card, notice: 'Cruno card was successfully created.' }\n format.json { render json: @cruno_card, status: :created, location: @cruno_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cruno_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment_card = PaymentCard.new(payment_card_params)\n\n respond_to do |format|\n if @payment_card.save\n format.html { redirect_to payment_cards_url, notice: 'Payment card was successfully created.' }\n format.json { render :show, status: :created, location: @payment_card }\n else\n format.html { render :new }\n format.json { render json: @payment_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @make_card = MakeCard.new(make_card_params)\n\n respond_to do |format|\n if @make_card.save\n format.html { redirect_to @make_card, notice: 'Make card was successfully created.' }\n format.json { render :show, status: :created, location: @make_card }\n else\n format.html { render :new }\n format.json { render json: @make_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tcard = Tcard.new(tcard_params)\n\n respond_to do |format|\n if @tcard.save\n format.html { redirect_to @tcard, notice: 'Tcard was successfully created.' }\n format.json { render :show, status: :created, location: @tcard }\n else\n format.html { render :new }\n format.json { render json: @tcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(list_id, name, description = \"\")\n Trello::Card.create(name: name, list_id: list_id, desc: description)\n end", "def create\n @card_sort = CardSort.new do |csp|\n csp.name = card_sort_params['name']\n csp.description = card_sort_params['description']\n csp.code = card_sort_params['code']\n csp.cards = card_sort_params['cards'].map do |card|\n {label: card}\n end\n end\n\n respond_to do |format|\n if @card_sort.save\n format.html { redirect_to @card_sort, notice: 'Card sort was successfully created.' }\n format.json { render :show, status: :created, location: @card_sort }\n else\n format.html { render :new }\n format.json { render json: @card_sort.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.find(params[:card_id])\n params[:deck_card][:card_id] = @card.id\n @deck_card = DeckCard.new(deck_card_params)\n if @deck_card.save\n flash[:success] = \"Card successfully added to deck!\"\n redirect_to @deck_card.deck\n else\n flash[:danger] = \"Card and deck are not compatible\"\n redirect_to @card\n end\n end", "def create\n @ccard = Ccard.new(ccard_params)\n\n respond_to do |format|\n if @ccard.save\n format.html { redirect_to @ccard, notice: 'Ccard was successfully created.' }\n format.json { render :show, status: :created, location: @ccard }\n else\n format.html { render :new }\n format.json { render json: @ccard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @spread = Spread.find(params[:spread_id])\n # @cards = @spreads.cards.create(card_params)\n # render json: @spread\n end", "def create_release_card summary\n # build post object\n url = 'https://api.github.com/projects/columns/%s/cards' % RELEASE\n uri = URI url\n post = Net::HTTP::Post.new uri, HEADERS\n post.body = { 'note' => summary }.to_json\n\n # create connection and send post\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = 'https' == uri.scheme\n response = http.request post\n log 'release.log', \"#{response.inspect}: #{response.body}: #{response.uri}\" if response.code >= '400'\nend", "def new\n #@card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card }\n end\n end", "def create\n @side_card = SideCard.new(side_card_params)\n\n respond_to do |format|\n if @side_card.save\n format.html { redirect_to @side_card, notice: 'Side card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @side_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if params[:user][:cards_attributes]\n cards = []\n params[:user][:cards_attributes].each do |_, v|\n card = Card.where(uid: v[:uid]).first\n cards << card if card && v[:_destroy] == 'false'\n end\n @user.cards = cards.uniq\n end\n if @user.save\n format.html { redirect_to @user, notice: t('user.create.success') }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inden_card = IndenCard.new(inden_card_params)\n\n respond_to do |format|\n if @inden_card.save\n format.html { redirect_to @inden_card, notice: (t 'inden_cards.title2')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @inden_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @inden_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card = Card.new(params[:card])\n action = @card.project.actions.create! activity: \"#{current_user.name} created \\\"#{@card.story}\\\" Card\"\n respond_to do |format|\n if @card.save\n # format.html { redirect_to @card, notice: 'Card was successfully created.' }\n # format.json { render json: @card, status: :created, location: @card }\n format.js\n else\n # format.html { render action: \"new\" }\n # format.json { render json: @card.errors, status: :unprocessable_entity }\n action.delete\n format.js\n end\n end\n end", "def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end", "def card_params\n params.require(:card).permit(:front, :back, :status, :deck_id, :image)\n end", "def create\n value = params[:value]\n suit = params[:suit] \n deck = Deck.find(params[:deck])\n @error_message = \"card: #{params[:value]} of #{params[:suit]} already exists for deck:#{deck.id}\"\n @error = \"invalid input\"\n return render json: @error unless SUITS.include?(suit) && VALUES.include?(value.to_i)\n \n card = deck.cards.where(:suit => suit, :value => value)\n if card.present?\n render json: @error_message\n else \n @new_card = Card.create(:suit => suit, :value => value, :deck_id => deck.id)\n render json: @new_card\n end\n end", "def new\n @stack = Stack.new\n @stack.set_default_attributes\n # TO DO - DON'T HAVE IT CREATE A NEW THING IN A DATABASE, YET\n @stack.save\n @card = Card.new\n @card.type = \"TextCard\"\n @card.stack_id = @stack.id\n #redirect to create a new card\n # redirect_to new_stack_card_path(@stack)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cards }\n end\n\n end", "def create\n @Waste3Card = Waste3Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Waste3Card.save\n render json: {}, status: :created\n else\n render json: @Waste3Card.errors, status: :unprocessable_entity\n end\n end", "def card_params\n params.require(:card).permit(:title, :origin, :posted_at, :user_id)\n end", "def create_json\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.limit.nil?\n msg = { id: @card.id, error: 'Must have limit on card' }\n format.json { render json: msg }\n elsif @card.limit <= 0\n msg = { id: @card.id, error: 'Cannot have a zero or negative limit' }\n format.json { render json: msg }\n elsif @card.save\n msg = { id: @card.id, limit: @card.limit }\n format.json { render json: msg }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_card_using_post(card_request, opts = {})\n data, _status_code, _headers = create_card_using_post_with_http_info(card_request, opts)\n data\n end", "def create\n @eno_card = EnoCard.new(eno_card_params)\n\n respond_to do |format|\n if @eno_card.save\n format.html { redirect_to @eno_card, notice: 'Eno card was successfully created.' }\n format.json { render :show, status: :created, location: @eno_card }\n else\n format.html { render :new }\n format.json { render json: @eno_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def card_params\n params.require(:card).permit(:title, :body, :board_id, :user_id)\n end", "def create\n respond_to do |format|\n if @safety_card.save\n format.html { redirect_to @safety_card, notice: 'Safety card was successfully created.' }\n format.json { render json: @safety_card, status: :created, location: @safety_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safety_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card_set = CardSet.new(params[:card_set])\n\n respond_to do |format|\n if @card_set.save\n format.html { redirect_to @card_set, notice: 'Card set was successfully created.' }\n format.json { render json: @card_set, status: :created, location: @card_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @card.author = params[:card][:author]\n @card.data_text = params[:card][:data_text]\n if @card.save \n current_stack.active = false\n redirect_to edit_stack_path(current_stack)\n end\n # respond_to do |format|\n # if @stack.save\n # format.html { redirect_to @stack, notice: 'Stack was successfully created.' }\n # format.json { render json: @stack, status: :created, location: @stack }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @stack.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @mtb_card = MtbCard.new(params[:mtb_card])\n\n respond_to do |format|\n if @mtb_card.save\n format.html { redirect_to @mtb_card, notice: 'Mtb card was successfully created.' }\n format.json { render json: @mtb_card, status: :created, location: @mtb_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mtb_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bcard = Bcard.new(params[:bcard])\n\n respond_to do |format|\n if @bcard.save\n format.html { redirect_to @bcard, notice: 'Bcard was successfully created.' }\n format.json { render json: @bcard, status: :created, location: @bcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @card\n end", "def show\n render json: @card\n end", "def card_params\n params.require(:card).permit(:name, :year, :description, :sku, :price, :serial_number, :front_image_url, :available, :back_image_url, :team_ids => [], :c_attribute_ids => [], :card_manufacturer_ids => [], :player_ids => [])\n end", "def create\n @debit_card = DebitCard.new(debit_card_params)\n\n respond_to do |format|\n if @debit_card.save\n format.html { redirect_to @debit_card, notice: 'Debit card was successfully created.' }\n format.json { render :show, status: :created, location: @debit_card }\n else\n format.html { render :new }\n format.json { render json: @debit_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def card_params\n params.require(:card).permit(:question, :answer)\n end", "def card_params\n params.require(:card).permit(:no, :tag, :question, :answer, :comment, :is_archive, :is_link, :original)\n end", "def create\n @timecard = Timecard.new(timecard_params)\n\n respond_to do |format|\n if @timecard.save\n format.html { redirect_to @timecard, notice: 'Timecard was successfully created.' }\n format.json { render :show, status: :created, location: @timecard }\n else\n format.html { render :new }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_card(options = {})\n trello = trello_api\n card_options = {\n :name => card_title,\n :list => list_id,\n :description => card_body,\n }.merge(options)\n trello.create_card(card_options)\n end", "def show\n render json: @card, status: :ok\n end" ]
[ "0.7442985", "0.7313761", "0.71945184", "0.7166914", "0.7153905", "0.7132376", "0.71268773", "0.7120617", "0.71131635", "0.7086562", "0.7049953", "0.69978523", "0.69978523", "0.69978523", "0.69978523", "0.69898945", "0.6973494", "0.67605746", "0.67355794", "0.66842014", "0.6676233", "0.66463065", "0.6611378", "0.65741736", "0.656457", "0.6560082", "0.6543358", "0.6519806", "0.6474515", "0.64627457", "0.64609045", "0.64573973", "0.64426935", "0.6422246", "0.6409837", "0.63909197", "0.6370848", "0.63676333", "0.6360808", "0.6360808", "0.6360808", "0.6360808", "0.6360808", "0.63459665", "0.63074714", "0.63006085", "0.62929815", "0.6292946", "0.629213", "0.6283838", "0.62763625", "0.6273145", "0.6270589", "0.6255695", "0.62532043", "0.62368566", "0.6225602", "0.62146", "0.62098056", "0.6206224", "0.62035394", "0.62013656", "0.6200558", "0.6200159", "0.6195808", "0.6193787", "0.61929095", "0.6191835", "0.61817914", "0.6178471", "0.61740506", "0.61651164", "0.6160308", "0.6145503", "0.61426973", "0.6139141", "0.61387557", "0.6133834", "0.6131437", "0.6124189", "0.61225295", "0.6121035", "0.61207086", "0.61078376", "0.61061794", "0.61024237", "0.61019135", "0.6077969", "0.60674596", "0.6057081", "0.60530066", "0.6049419", "0.6045319", "0.6045319", "0.604107", "0.6033855", "0.60293263", "0.60138667", "0.6009197", "0.60091686", "0.60088694" ]
0.0
-1
PATCH/PUT /cards/1 PATCH/PUT /cards/1.json
def update respond_to do |format| if @card.update(card_params) format.html { redirect_to @card, notice: 'Card was successfully updated.' } format.json { render :show, status: :ok, location: @card } else format.html { render :edit } format.json { render json: @card.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end", "def update\n #@card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to cards_url, :notice => 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card.update(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end", "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end", "def update\n @card = Card.find(params[:id])\n\n if @card.update(card_params)\n head :no_content\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end", "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n flash[:notice] = 'Card was successfully updated.'\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = @deck.cards.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: deck_card_path(@deck, @card) }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: t(\".successfully_updated\") }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Updated the card!\" } }\n format.json { render json: @card, status: :ok }\n else\n format.html {\n flash[:danger] = \"Error : Failed to update card.\"\n render :edit\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n puts \"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\"\n puts card_params\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n notify_admin(\"Card Updated (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(deck_card_url(@deck, @card)) }\n format.xml { head :ok }\n else\n @decks = Deck.find(:all, :order => 'title')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to plan_path(@plan), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Cartão atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(@card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xmll => @card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Tarjeta Actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poker_card.update(poker_card_params)\n format.html { redirect_to @poker_card, notice: 'Poker card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poker_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n if @card_set.update_attributes(params[:card_set])\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entry_card.update(entry_card_params)\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m_card.update(m_card_params)\n format.html { redirect_to @m_card, notice: 'M card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @cards = args[:cards] if args.key?(:cards)\n end", "def update\n respond_to do |format|\n if @side_card.update(side_card_params)\n format.html { redirect_to @side_card, notice: 'Side card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wallet.update_card(params[:id], card_params)\n format.html { redirect_to wallet_path, notice: 'Card was successfully updated.' }\n format.json { render json: @wallet, status: :ok, location: wallet_path }\n else\n @card = @wallet.find_card(params[:id])\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n if @scorecard.update_attributes(params[:scorecard])\n format.html { redirect_to @scorecard, notice: 'Scorecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scorecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @owned_card.user == current_user && @owned_card.update(owned_card_params)\n format.html { redirect_to owned_cards_path, notice: 'Owned card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @owned_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_detail.update(card_detail_params)\n format.html { redirect_to @card_detail, notice: 'Card detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_detail }\n else\n format.html { render :edit }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_set.update(card_set_params)\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_set }\n else\n format.html { render :edit }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vote_card.update(vote_card_params)\n format.html { redirect_to @vote_card, notice: 'VoteCard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to deck_cards_url(@deck), notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !(params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n card.update(card_params)\n render status: 200, json:{\n message: \"Successfully updated\",\n company_cards: card\n }.to_json\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n end", "def update\n @card = Card.find(params[:id])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to update a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_in_column.update(card_in_column_params)\n format.json { render json: @card_in_column.as_json(include: { card: { only: [:id, :name, :description, :project_id, :type] } }), status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deck_card.update(deck_card_params)\n flash[:success] = \"Deck card was successfully updated.\"\n redirect_to @deck_card.deck\n format.json { render :show, status: :ok, location: @deck_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deck_of_card.update(deck_of_card_params)\n format.html { redirect_to @deck_of_card, notice: 'Deck of card was successfully updated.' }\n format.json { render :show, status: :ok, location: @deck_of_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_of_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cruno_card = CrunoCard.find(params[:id])\n @cruno_card.player = Player.find(2)\n\n respond_to do |format|\n if @cruno_card.update_attributes(params[:cruno_card])\n format.html { redirect_to @cruno_card, notice: 'Cruno card was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cruno_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @name_card.update(name_card_params)\n format.html { redirect_to @name_card, notice: 'Name card was successfully updated.' }\n format.json { render :show, status: :ok, location: @name_card }\n else\n format.html { render :edit }\n format.json { render json: @name_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n if @flash_card.update_attributes(params[:flash_card])\n format.html { redirect_to(@flash_card, :notice => 'Flash card was successfully updated.') }\n format.json { render :json => [] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @flash_card.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @flash_card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if params[:user][:cards_attributes]\n cards = []\n params[:user][:cards_attributes].each do |_, v|\n card = Card.where(uid: v[:uid]).first\n cards << card if card && v[:_destroy] == 'false'\n end\n @user.cards = cards.uniq\n end\n if @user.update(user_params)\n format.html { redirect_to @user, notice: t('user.update.success') }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note_card.update(note_card_params)\n format.html { redirect_to @note_card, notice: 'Note card was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_card }\n else\n format.html { render :edit }\n format.json { render json: @note_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id], options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end", "def update\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n if @bcard.update_attributes(params[:bcard])\n format.html { redirect_to @bcard, notice: 'Bcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @card = args[:card] if args.key?(:card)\n @card_id = args[:card_id] if args.key?(:card_id)\n end", "def update\n respond_to do |format|\n if @score_card.update(score_card_params)\n format.html { redirect_to project_score_card_path(@project, @score_card), notice: 'Scorecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_card }\n else\n format.html { render :edit }\n format.json { render json: @score_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @old_card = OldCard.find(params[:id])\n\n respond_to do |format|\n if @old_card.update_attributes(params[:old_card])\n format.html { redirect_to(@old_card, :notice => 'Old card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_card(id, params)\n card = find_card(id)\n if card\n card.update(params)\n save\n end\n end", "def update\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n if @flashcard.update_attributes(params[:flashcard])\n format.html { redirect_to @flashcard, notice: 'Flashcard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flashcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inden_card.update(inden_card_params)\n format.html { redirect_to @inden_card, notice: (t 'inden_cards.title2')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inden_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @make_card.update(make_card_params)\n format.html { redirect_to @make_card, notice: 'Make card was successfully updated.' }\n format.json { render :show, status: :ok, location: @make_card }\n else\n format.html { render :edit }\n format.json { render json: @make_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n if @cards_question.update_attributes(params[:cards_question])\n format.html { redirect_to @cards_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @safety_card.update_attributes(params[:safety_card])\n format.html { redirect_to @safety_card, notice: 'Safety card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safety_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flash_card_set ||= FlashCardSet.find params[:id]\n\n if @flash_card_set.update_attributes update_params\n render :show, status: 200\n else\n render json: { resource: \"flashCardSet\", errors: @flash_card_set.errors }, status: 409\n end\n end", "def update\n respond_to do |format|\n if @keycard.update(keycard_params)\n format.html { redirect_to keycards_path, notice: 'keycard ' + @keycard.id.to_s + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @keycard }\n else\n format.html { render :edit }\n format.json { render json: @keycard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deck.update(deck_params)\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @namecard.update(namecard_params)\n format.html { redirect_to @namecard, notice: 'Namecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @namecard }\n else\n format.html { render :edit }\n format.json { render json: @namecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @greeting_card.update(greeting_card_params)\n format.html { redirect_to @greeting_card, notice: 'Greeting card was successfully updated.' }\n format.json { render :show, status: :ok, location: @greeting_card }\n else\n format.html { render :edit }\n format.json { render json: @greeting_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n if @card_number.update_attributes(params[:card_number])\n format.html { redirect_to @card_number, notice: 'Broj kartice je uspjesno azuriran.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_card.update(vehicle_card_params)\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n if @collection_card.update_attributes(params[:collection_card])\n format.html { redirect_to(@collection_card, :notice => 'Collection card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @collection_card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_card.update(user_card_params)\n format.html { redirect_to @user_card, notice: 'User card was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_card }\n else\n format.html { render :edit }\n format.json { render json: @user_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_card.update(company_card_params)\n format.html { redirect_to @company_card, notice: 'Company card was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_card }\n else\n format.html { render :edit }\n format.json { render json: @company_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n if @mtb_card.update_attributes(params[:mtb_card])\n format.html { redirect_to @mtb_card, notice: 'Mtb card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mtb_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @eno_card.update(eno_card_params)\n format.html { redirect_to @eno_card, notice: 'Eno card was successfully updated.' }\n format.json { render :show, status: :ok, location: @eno_card }\n else\n format.html { render :edit }\n format.json { render json: @eno_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n if @reg_card.update_attributes(params[:reg_card])\n flash[:success] = \"Card Updated!\"\n format.html { redirect_to group_path(@reg_card.group) }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @reg_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @excuse_card.update(excuse_card_params)\n format.html { redirect_to @excuse_card, notice: 'Excuse card was successfully updated.' }\n format.json { render :show, status: :ok, location: @excuse_card }\n else\n format.html { render :edit }\n format.json { render json: @excuse_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} chanded \\\"#{@card.story}\\\" to #{params[:card][:story]} Card story\"\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to project_url(@card.project), notice: 'Card updated' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n if @bizcard.update_attributes(params[:bizcard])\n format.html { redirect_to @bizcard, notice: 'Bizcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bizcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_card.update(job_card_params)\n format.html { redirect_to @job_card, notice: 'Job card was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_card }\n else\n format.html { render :edit }\n format.json { render json: @job_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expansion_of_card = ExpansionOfCard.find(params[:id])\n\n respond_to do |format|\n if @expansion_of_card.update_attributes(params[:expansion_of_card])\n flash[:notice] = 'ExpansionOfCard was successfully updated.'\n format.html { redirect_to(@expansion_of_card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expansion_of_card.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cards_partial_update_with_http_info(id, data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardsApi.cards_partial_update ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CardsApi.cards_partial_update\"\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling CardsApi.cards_partial_update\"\n end\n # resource path\n local_var_path = '/cards/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(data) \n\n # return_type\n return_type = opts[:return_type] || 'Card' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardsApi#cards_partial_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @tcard.update(tcard_params)\n format.html { redirect_to @tcard, notice: 'Tcard was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcard }\n else\n format.html { render :edit }\n format.json { render json: @tcard.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 update\n respond_to do |format|\n if @feeling_card.update(feeling_card_params)\n format.html { redirect_to @feeling_card, notice: 'Feeling card was successfully updated.' }\n format.json { render :show, status: :ok, location: @feeling_card }\n else\n format.html { render :edit }\n format.json { render json: @feeling_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deck.update(deck_params)\n score_update(deck_params, @deck.id)\n format.html { redirect_to @deck, notice: '更新されました' }\n format.json { render :show, status: :ok, location: @deck }\n else\n format.html { render :edit }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_purch.update(card_purch_params)\n format.html { redirect_to @card_purch, notice: 'Card purch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card_purch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:image_id].present?\n preloaded = Cloudinary::PreloadedFile.new(params[:image_id]) \n raise \"Invalid upload signature\" if !preloaded.valid?\n @model.image_id = preloaded.identifier\n end\n \n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card = UpdateStripeCard.call(current_user, card_params, card_additional_params)\n\n respond_to do |format|\n if @card.errors.blank?\n format.html { redirect_to card_path(@card), notice: \"Card \\# #{current_user.cards.last.card_last_four} was updated!\" }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity, alert: 'Unable to update #{current_user.cards.last.card_last_four}!' }\n end\n end\n end", "def update\n respond_to do |format|\n if @timecard.update(timecard_params)\n format.html { redirect_to @timecard, notice: 'Timecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_sort.update(\n name: card_sort_params['name'],\n description: card_sort_params['description'],\n cards: card_sort_params['cards'].map{ |card| {label: card} },\n )\n format.html { redirect_to @card_sort, notice: 'Card sort was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_sort }\n else\n format.html { render :edit }\n format.json { render json: @card_sort.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cardbox = current_user.cardboxes.find(params[:id])\n\n respond_to do |format|\n if @cardbox.update_attributes(params[:cardbox])\n format.html { redirect_to(@cardbox, :notice => _('Der Karteikasten wurde geändert')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cardbox.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @card_page.update(card_page_params)\n format.html { redirect_to @card_page, notice: 'Card page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @card = Card.find(params[:id])\n end", "def update\n respond_to do |format|\n if @payment_card.update(payment_card_params)\n format.html { redirect_to payment_cards_url, notice: 'Payment card was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_card }\n else\n format.html { render :edit }\n format.json { render json: @payment_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deck.update(deck_params)\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { render :show, status: :ok, location: @deck }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74138683", "0.73641354", "0.7332616", "0.73224586", "0.7262503", "0.7262503", "0.7262503", "0.72331095", "0.7220635", "0.72159266", "0.7201274", "0.71773446", "0.70944387", "0.70107996", "0.69666153", "0.6961331", "0.6904233", "0.68476", "0.6798736", "0.67981195", "0.6779865", "0.6765964", "0.67640734", "0.67306924", "0.66585916", "0.6642028", "0.65676725", "0.6564367", "0.6559369", "0.65498775", "0.6533609", "0.65117216", "0.65063095", "0.64964014", "0.6495442", "0.64882773", "0.6473782", "0.6472793", "0.64590776", "0.6457478", "0.6453391", "0.6426303", "0.6424554", "0.64226544", "0.64226544", "0.63950795", "0.6394242", "0.6386795", "0.6374593", "0.63695794", "0.6368275", "0.63678336", "0.63633907", "0.6360656", "0.63604134", "0.63555", "0.6354796", "0.6344595", "0.6339729", "0.6318983", "0.6315645", "0.6299675", "0.6291621", "0.62902707", "0.6289348", "0.6277385", "0.6265817", "0.62652767", "0.6253544", "0.6243121", "0.6233629", "0.62291646", "0.62116754", "0.6206977", "0.61958164", "0.61921984", "0.61824244", "0.6179414", "0.6177263", "0.61708623", "0.617004", "0.61653835", "0.61428905", "0.6134071", "0.6129043", "0.6127331", "0.6124494", "0.6113951", "0.61101943", "0.61101943", "0.6083575", "0.60718274", "0.6061066", "0.60545665", "0.6053826" ]
0.70095146
19
DELETE /cards/1 DELETE /cards/1.json
def destroy @card.destroy respond_to do |format| format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n # @card = Card.destroy(params[:id])\n # render json: 200\n end", "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url, :notice => 'Card successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.delete\n render json: {messsage: \"Movie/Series Card was successfully deleted.\"}, status: 204\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to tarot_cards_path(@tarot) }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n \n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card = @deck.cards.find(params[:id])\n @card.destroy\n respond_to do |format|\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n card = Card.find( params[:id] )\n card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: t(\".successfully_destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.update!(deleted_at: Time.now)\n head :no_content\n end", "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n notify_admin(\"Card Removed (#{@card.last_three_digits})\", @card.as_json)\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.card_parameters.destroy_all\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry_card.destroy\n respond_to do |format|\n format.html { redirect_to entry_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n\n head :no_content\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inden_card.destroy\n respond_to do |format|\n format.html { redirect_to inden_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(deck_cards_url(@deck)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cruno_card = CrunoCard.find(params[:id])\n @cruno_card.destroy\n\n respond_to do |format|\n format.html { redirect_to cruno_cards_url }\n format.json { head :ok }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Tarjeta Creada Satisfactoriamente' }\n format.json { render :show, status: :ok, location: @card }\n end\n end", "def destroy\n respond_to do |format|\n if Card.find(params[:id]).destroy\n format.html { redirect_to cards_path, notice: \"Card deleted!\" }\n format.json { head :no_content }\n else\n format.html {\n flash[:danger] = \"Error : Failed to delete card.\"\n render :index\n }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n # @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pk_card.destroy\n respond_to do |format|\n format.html { redirect_to pk_cards_url, notice: 'Pk card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to plan_path(@plan) }\n format.json { head :no_content }\n end\n end", "def destroy\n set_m_card\n @m_card.destroy\n respond_to do |format|\n format.html { redirect_to m_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to card_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bcard = Bcard.find(params[:id])\n @bcard.destroy\n\n respond_to do |format|\n format.html { redirect_to bcards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @make_card.destroy\n RechargeableCard.where(make_card_id: params[:id]).delete_all\n respond_to do |format|\n format.html { redirect_to make_cards_url, notice: 'Make card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if(params.has_key?(:card_id))\n @Waste3Card = Waste3Card.find_by_card_id(params[:card_id])\n @Waste3Card.destroy\n else\n Waste3Card.delete_all\n end\n render json: {}, status: :no_content\n end", "def destroy\n @poker_card.destroy\n respond_to do |format|\n format.html { redirect_to poker_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_purch.destroy\n respond_to do |format|\n format.html { redirect_to card_purches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @side_card.destroy\n respond_to do |format|\n format.html { redirect_to side_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bizcard = Bizcard.find(params[:id])\n @bizcard.destroy\n\n respond_to do |format|\n format.html { redirect_to bizcards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_detail.destroy\n respond_to do |format|\n format.html { redirect_to card_details_url, notice: 'Card detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if(params.has_key?(:card_id))\n @Waste2Card = Waste2Card.find_by_card_id(params[:card_id])\n @Waste2Card.destroy\n else\n Waste2Card.delete_all\n end\n render json: {}, status: :no_content\n end", "def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} destroyed \\\"#{@card.story}\\\" Card\"\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @mtb_card = MtbCard.find(params[:id])\n @mtb_card.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_cardapio = ItemCardapio.find(params[:id])\n @item_cardapio.destroy\n\n respond_to do |format|\n format.html { redirect_to item_cardapios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wallet.destroy_card(params[:id])\n respond_to do |format|\n format.html { redirect_to wallet_path, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @eno_card.destroy\n respond_to do |format|\n format.html { redirect_to eno_cards_url, notice: 'Eno card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vote_card.destroy\n respond_to do |format|\n format.html { redirect_to vote_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deck.destroy\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deck_of_card.destroy\n respond_to do |format|\n format.html { redirect_to deck_of_cards_url, notice: 'Deck of card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scorecard = Scorecard.find(params[:id])\n @scorecard.destroy\n\n respond_to do |format|\n format.html { redirect_to scorecards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_instance.destroy\n respond_to do |format|\n format.html { redirect_to card_instances_url, notice: 'Card owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ccard.destroy\n respond_to do |format|\n format.html { redirect_to ccards_url, notice: 'Ccard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to user_root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_page.destroy\n respond_to do |format|\n format.html { redirect_to card_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @greeting_card.destroy\n respond_to do |format|\n format.html { redirect_to greeting_cards_url, notice: 'Greeting card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_card.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @keycard.destroy\n respond_to do |format|\n format.html { redirect_to keycards_url, notice: 'keycard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_set = CardSet.find(params[:id])\n @card_set.destroy\n\n respond_to do |format|\n format.html { redirect_to card_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if !(params[:id].nil?)\n if (CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n card.destroy\n render status: 200, json:{\n message: \"Successfully deleted that card.\"\n }.to_json\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json \n end\n else\n render status: 422, json:{\n message: \"Unable to process your request of the server.\"\n }.to_json \n end\n end", "def destroy\n @flashcard = Flashcard.find(params[:id])\n @flashcard.destroy\n\n respond_to do |format|\n format.html { redirect_to flashcards_url }\n format.json { head :ok }\n end\n end", "def destroy\n @flash_card = FlashCard.find(params[:id])\n @flash_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(flash_cards_url) }\n format.json { render :json => [] }\n format.xml { head :ok }\n end\n end", "def delete card\n @hand.delete(Card.new(card))\n end", "def destroy\n @namecard.destroy\n respond_to do |format|\n format.html { redirect_to namecards_url, notice: 'Namecard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @timecard.destroy\n respond_to do |format|\n format.html { redirect_to timecards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank_card = BankCard.find(params[:id])\n @bank_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(bank_cards_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end", "def destroy\n if(params.has_key?(:card_id))\n @Point3Card = Point3Card.find_by_card_id(params[:card_id])\n @Point3Card.destroy\n elsif(params.has_key?(:id))\n @Point3Card = Point3Card.find_by_card_id(params[:id])\n @Point3Card.destroy\n else\n Point3Card.delete_all\n end\n render json: {}, status: :no_content\n end", "def destroy\n @name_card.destroy\n respond_to do |format|\n format.html { redirect_to name_cards_url, notice: 'Name card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_in_column.destroy\n respond_to do |format|\n format.html { redirect_to card_in_columns_url, notice: 'Card in column was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @safety_card.destroy\n\n respond_to do |format|\n format.html { redirect_to safety_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @excuse_card.destroy\n respond_to do |format|\n format.html { redirect_to excuse_cards_url, notice: 'Excuse card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cards_question = Cards::Question.find(params[:id])\n @cards_question.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @owned_card.user == current_user\n @owned_card.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to owned_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expansion_of_card = ExpansionOfCard.find(params[:id])\n @expansion_of_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(expansion_of_cards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_handle_path(@deck.handle) }\n format.json { head :ok }\n end\n end", "def destroy\n @five_card = FiveCard.find(params[:id])\n @five_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(five_card_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tcard.destroy\n respond_to do |format|\n format.html { redirect_to tcards_url, notice: 'Tcard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blog_card.destroy\n respond_to do |format|\n format.html { redirect_to blog_cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_number = CardNumber.find(params[:id])\n @card_number.destroy\n\n respond_to do |format|\n format.html { redirect_to card_numbers_url }\n format.json { head :no_content }\n end\n end", "def deleteCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n results = HTTParty.delete(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id])\n if results.code == 200\n head 200\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end", "def destroy\n @card = Card.find(params[:id])\n\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to update a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_set.destroy\n respond_to do |format|\n format.html { redirect_to card_sets_url, notice: 'Card set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @creditcard.destroy\n respond_to do |format|\n format.html { redirect_to creditcards_url, notice: 'Creditcard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if(params.has_key?(:card_id))\n @Point2Card = Point2Card.find_by_card_id(params[:card_id])\n @Point2Card.destroy\n elsif(params.has_key?(:id))\n @Point2Card = Point2Card.find_by_card_id(params[:id])\n @Point2Card.destroy\n else\n Point2Card.delete_all\n end\n render json: {}, status: :no_content\n end", "def destroy\n @card = Card.find(params[:id])\n @card.card_taggings.each do |tag|\n c = CardTag.joins(:cards).where(card_taggings: {id: tag.id})\n c.first.destroy rescue nil\n end\n @card.card_taggings.destroy_all\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @creativitycard.destroy\n respond_to do |format|\n format.html { redirect_to creativitycards_url, notice: 'Creativitycard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_card.destroy\n respond_to do |format|\n format.html { redirect_to score_cards_url, notice: 'Scorecard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @debit_card.destroy\n respond_to do |format|\n format.html { redirect_to debit_cards_url, notice: 'Debit card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @user_card.destroy\n respond_to do |format|\n format.html { redirect_to user_cards_url, notice: 'User card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_card.destroy\n respond_to do |format|\n format.html { redirect_to time_cards_url, notice: 'Time card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deck.destroy\n respond_to do |format|\n format.html { redirect_to decks_url, notice: 'Deck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @graphic_card.destroy\n respond_to do |format|\n format.html { redirect_to graphic_cards_url, notice: 'Graphic card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_card.destroy\n respond_to do |format|\n format.html { redirect_to company_cards_url, notice: 'Company card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bdcard = Bdcard.find(params[:id])\n @bdcard.destroy\n profile_info\n\n respond_to do |format|\n format.html { redirect_to bdcards_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.797766", "0.781652", "0.781652", "0.781652", "0.7773019", "0.7738249", "0.7725237", "0.7681169", "0.7677146", "0.76027936", "0.75915974", "0.7586289", "0.7575081", "0.75175333", "0.7495067", "0.74903256", "0.7441149", "0.74211055", "0.7377856", "0.73454833", "0.73294616", "0.7315473", "0.73081845", "0.72997975", "0.7292294", "0.7285929", "0.7279237", "0.7266903", "0.7266329", "0.72442746", "0.72392213", "0.72211885", "0.72201055", "0.7214866", "0.718248", "0.717347", "0.7172222", "0.715884", "0.7154696", "0.7140111", "0.7139928", "0.71377456", "0.7122098", "0.71203643", "0.71136683", "0.7098659", "0.7090828", "0.70889616", "0.7085069", "0.70817226", "0.7075948", "0.70713544", "0.7070499", "0.70523983", "0.7049111", "0.70461816", "0.7043852", "0.7042964", "0.7041866", "0.70361257", "0.7034718", "0.70343703", "0.703087", "0.7030333", "0.7023882", "0.701255", "0.7011453", "0.7004635", "0.6996806", "0.6992259", "0.699173", "0.69888127", "0.69836456", "0.6982581", "0.69787264", "0.6972598", "0.69648993", "0.6933762", "0.693321", "0.6921195", "0.69124", "0.6912321", "0.6911789", "0.69081277", "0.6900429", "0.6893846", "0.68920803", "0.6883974", "0.6883963", "0.68741566", "0.68649393", "0.6859266", "0.6853146", "0.6849566" ]
0.75335413
19
Use callbacks to share common setup or constraints between actions.
def set_card @card = Card.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; 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 around_hooks; end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516", "0.5311442", "0.52963835", "0.52955836", "0.5295297", "0.5258503", "0.52442217", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5234908", "0.5230927", "0.52263695", "0.5222485", "0.5216462", "0.52128595", "0.52070963", "0.520529", "0.517586", "0.5174021", "0.5172379", "0.5165636", "0.5161574", "0.51556087", "0.5153217", "0.5152898", "0.5151238", "0.5144674", "0.51387095", "0.51342636", "0.5113545", "0.51131564", "0.51131564", "0.5107665", "0.5107052", "0.50908124", "0.5089785", "0.50814754", "0.50807786", "0.5064482", "0.5053022", "0.50526255", "0.5050246", "0.5050246", "0.50329554", "0.5023997", "0.5021236", "0.5014815", "0.5014393", "0.4999298", "0.49990913", "0.4997733", "0.49884573", "0.49884573", "0.49840933", "0.49786162", "0.49784446", "0.49782816", "0.49659815", "0.49655175", "0.4956222", "0.49543875", "0.49536037", "0.495265", "0.4951427", "0.49438462", "0.49436793", "0.49335384", "0.49321616", "0.49264926", "0.49247074", "0.49246994", "0.49226475", "0.49194494", "0.49152806", "0.49149707", "0.49149227", "0.49144953", "0.49141943" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def card_params params[:card] 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
Converts the range to an equivalent exclusive range (one where exclude_end? is true) Only works for ranges with discrete steps between values (i.e. integers)
def exclusive if exclude_end? self else Range.new(self.begin, self.end + 1, true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_range\n min .. max\n end", "def split_range(range)\n start, finish = range.begin, range.end\n start += length if start < 0\n finish += length if finish < 0\n \n [start, finish - start - (range.exclude_end? ? 1 : 0)]\n end", "def to_range\n Range.new(self.start, self.end)\n end", "def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end", "def upto(end_key)\n unless partition_specified?\n raise IllegalQuery,\n \"Can't construct exclusive range on partition key #{range_key_name}\"\n end\n scoped(upper_bound: bound(false, true, end_key))\n end", "def normalize_range(range)\n ar = range.to_a\n if ar.min > 2 # normalizacja zadanego zakresu aby zawsze zakres zaczynał się od 2\n ar += (2..ar.min-1).to_a\n ar = ar.sort\n else\n ar.delete_if { |e| e < 2 }\n end\n ar\nend", "def remove_range(left, right)\n \n end", "def remove_range(left, right)\n \n end", "def test_Range_InstanceMethods_exclude_end?\n\t\t# TODO, need add some testcases.\n\tend", "def to_range\n case\n when open?, unknown?\n nil\n else\n Range.new(unknown_start? ? Date.new : @from, max)\n end\n end", "def range(start_num, end_num)\n # one line version\n # (start_num...end_num).to_a\n\n # version 2\n exclusive_range = []\n (start_num...end_num).each do |num|\n exclusive_range << num\n end\n exclusive_range\nend", "def reverse_range(min, max)\n new_arr = []\n\n i = max-1\n while i >= min+1 # i > min\n # reverse\n # exclude\n new_arr << i\n i -= 1\n end\n\n return new_arr\n\nend", "def day_range(rng=self)\n if rng.respond_to?(:exclude_end?) && rng.exclude_end?\n Range.new(rng.begin.to_date, rng.end.to_date, true)\n else\n Range.new(rng.begin.to_date, rng.end.to_date + 1, true)\n end\n end", "def range\n\t\t\t#(@end > @start) ? (@start .. @end) : (@end .. @start)\n\t\t\t(start .. self.end)\n\t\tend", "def build_range(key, val, negate)\n if val.exclude_end?\n # begin...end range\n if negate\n \"#{key} < #{quoted(val.begin, key)} or #{key} >= #{quoted(val.end, key)}\"\n else\n \"#{key} >= #{quoted(val.begin, key)} and #{key} < #{quoted(val.end, key)}\"\n end\n else\n # begin..end range\n if negate\n \"#{key} < #{quoted(val.begin, key)} or #{key} > #{quoted(val.end, key)}\"\n else\n \"#{key} >= #{quoted(val.begin, key)} and #{key} <= #{quoted(val.end, key)}\"\n end\n end\n end", "def to_range\n start_date..end_date\n end", "def range(start_num, end_num)\n return [] if end_num =< start_num\n range(start_num, end_num - 1) << end_num - 1\nend", "def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= range.begin && number <= range.end\n end\nend", "def to_range\n (@start_date..@end_date)\n end", "def odd_range(min, max)\n (min..max).select{|num| !(num.even?) }\nend", "def inclusive_ending\n self.exclude_end? ? ending - 1 : ending\n end", "def range(start, ending_value)\n return [] if start > ending_value\n result = [start] + range(start + 1, ending_value)\nend", "def explicit_range(rango, n_steps)\n a = n_steps==0 ? 1 : n_steps\n jump = (rango.max.to_f - rango.min)/a\n rango = rango.step(jump).to_a\n rango.delete_at(-1)\n rango\n end", "def range(start,ending)\r\n return [] if ending <= start\r\n\r\n range(start, ending-1) << ending -1\r\nend", "def range(range_start, range_end)\n return [] if range_end < range_start\n return [range_end] if range_end == range_start\n result = [range_end]\n range(range_start, range_end - 1) + result\nend", "def range_rc(start_num, end_num)\n\n return [] if end_num <= start_num\n range_rc(start_num, end_num - 1) + [end_num - 1]\nend", "def compose_not_range_node(node, value)\n validate_node_or_attribute(node)\n range_info = parse_range(value)\n\n # build using gt, lt, gteq, lteq\n if range_info[:start_include]\n start_condition = node.lt(range_info[:start_value])\n else\n start_condition = node.lteq(range_info[:start_value])\n end\n\n if range_info[:end_include]\n end_condition = node.gt(range_info[:end_value])\n else\n end_condition = node.gteq(range_info[:end_value])\n end\n\n start_condition.or(end_condition)\n end", "def range\n (start_date...end_date) #exclusive date range\n end", "def arel_exclude(start_column, end_column, start_or_instant_or_range=nil, range_end=nil)\n table = self.arel_table\n if range_end\n table[start_column].gteq(range_end).or(table[end_column].lteq(start_or_instant_or_range))\n elsif Range === start_or_instant_or_range\n table[start_column].gteq(start_or_instant_or_range.db_end).or(table[end_column].lteq(start_or_instant_or_range.db_begin))\n else\n start_or_instant_or_range ||= InfinityLiteral\n table[start_column].gt(start_or_instant_or_range).or(table[end_column].lteq(start_or_instant_or_range))\n end\n end", "def is_a_3_dot_range?(range)\n range.exclude_end?\nend", "def interval(from, to)\n return EmptyList if from > to\n interval_exclusive(from, to.next)\n end", "def is_a_3_dot_range?(range)\n\trange.exclude_end?\nend", "def conjunctionRangeExtd(r1, r2)\n\n [r1, r2].each do |er|\n return er if er.is_none?\n end\n\n r = *( sort_ranges_core([RangeExtd(r1), RangeExtd(r2)]) )\t# => Rangeary.sort_ranges\n\n ## Note: the end product will be (cBeg(:stBeg), cEnd(:stEnd))\n # where :stBeg and :stEnd mean exclude_(begin|end)?\n\n # Set the candidate begin value.\n cBeg = r[1].begin\n if r[0].begin == r[1].begin\n stBeg = (r[1].exclude_begin? || r[0].exclude_begin?)\n else\n stBeg = r[1].exclude_begin?\n end\n\n # Set the candidate end value. (Rangeary.comparable_end() for Ruby-2.6 Endless Range)\n # Note: this comparison ignores @infinities even if set,\n # because @infinities may not be defined in the arguments!\n # Anyway, nothing should be larger than the upper limit\n # and so this should be fine.\n if comparable_beginend_core(r[0]).end == comparable_beginend_core(r[1]).end\n cEndOrig = r[1].end\n cEnd = comparable_beginend_core(r[1]).end\n stEnd = (r[0].exclude_end? || r[1].exclude_end?)\n else\n a = [[comparable_beginend_core(r[0]).end, 0, r[0].end], [comparable_beginend_core(r[1]).end, 1, r[1].end]].min\n cEnd = a[0]\n cEndIndex = a[1]\t# r[cEndIndex] == RangeExtd obj that gives the end of the resultant range.\n cEndOrig = a[2]\n stEnd = nil\n end\n\n case cBeg <=> cEnd\n when 1\t# cBeg > cEnd\n RangeExtd::NONE\n\n when 0\t# cBeg == cEnd\n stEnd = r[0].exclude_end?\n if (!stBeg) && (!stEnd)\n RangeExtd(cBeg..cBeg)\t# Point range\n else\n RangeExtd::NONE\n end\n\n when -1\t# cBeg < cEnd\n # Now, the range must be (cBeg, cEnd). May need adjustment of the exclude status.\n if stEnd.nil?\n stEnd = r[cEndIndex].exclude_end?\n # else\n # # Already defined.\n end\t# if stEnd.nil?\n\n RangeExtd(cBeg, cEndOrig, :exclude_begin => stBeg, :exclude_end => stEnd)\n else\n raise\n end\t\t# case cBeg <=> cEnd\n\n end", "def range\n from_truncated..to_truncated\n end", "def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end", "def normalize_range(range)\n arr = range.to_a\n arr.empty? ? range.first.to_s : \"#{range.first}-#{arr.last}\"\n end", "def initialize(first, last, exclude_end = false)\n raise NameError, \"`initialize' called twice\" if @begin\n \n unless first.kind_of?(Fixnum) && last.kind_of?(Fixnum)\n begin\n raise ArgumentError, \"bad value for range\" unless first <=> last\n rescue\n raise ArgumentError, \"bad value for range\"\n end\n end\n \n @begin = first\n @end = last\n @excl = exclude_end\n end", "def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end", "def reverse_range(min, max)\n # Write your code here\nend", "def normalize_range_values(params, field_name, values)\n normalized = Array(values).map(&:presence).compact\n params[field_name] = (normalized.present? && values.length == 2) && (values.first...values.last) || nil\n end", "def to_ranges args = Hash.new\n min = args[:min] || -Infinity\n max = args[:max] || Infinity\n collapse = args[:collapse]\n \n ranges = Array.new\n self.split(%r{\\s*,\\s*}).each do |section|\n md = section.match(RANGE_REGEXP)\n next unless md\n \n from = _matchdata_to_number md, 1, min\n to = _has_matchdata?(md, 2) ? _matchdata_to_number(md, 3, max) : from\n\n prevrange = ranges[-1]\n\n if collapse && prevrange && prevrange.include?(from - 1) && prevrange.include?(to - 1)\n ranges[-1] = (prevrange.first .. to)\n else\n ranges << (from .. to)\n end\n end\n\n ranges\n end", "def range(range)\n opts[:min] = range.begin\n opts[:max] = range.end\n end", "def parse_range\n val = super || return\n val.begin == val.end ? val.begin : val\n end", "def auto_range(direction); end", "def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = value.exclude_end? ? last.succ : last\n include?(value.first) && (value.last <=> end_value).send(operator, 0)\n else\n include_without_range?(value)\n end\n end", "def range(start, ending)\n return [] if start >= ending - 1\n retu_arr = range(start, ending - 1)\n retu_arr << ending - 1\nend", "def range_precedes(rng,oth)\n r1, r2 = matched_range_types(rng,oth)\n diff = if r1.respond_to?(:exclude_end?) && r1.exclude_end?\n 0\n else\n 1\n end\n (r1.end + diff) == r2.begin\n end", "def range(start, stop)\n return [] if stop < start\n return [stop] if start == stop\n\n [start] + range(start+1, stop)\nend", "def to_range_within(range)\n nb_weeks_offset = self.weekly_recurring ? ((range.end - self.starts_at.to_datetime) / 7).to_i : 0\n r = Range.new(self.starts_at + nb_weeks_offset.week, self.ends_at + nb_weeks_offset.week)\n range.cover?(r.begin)&&range.cover?(r.end) ? r : nil\n end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def remove(range); end", "def to_ranges\n array = self.compact.uniq.sort\n ranges = []\n if !array.empty?\n # Initialize the left and right endpoints of the range\n left, right = array.first, nil\n array.each do |obj|\n # If the right endpoint is set and obj is not equal to right's successor \n # then we need to create a range.\n if right && obj != right.succ\n ranges << Range.new(left,right)\n left = obj\n end\n right = obj\n end\n ranges << Range.new(left,right)\n end\n ranges\n end", "def range\n @range ||= set_range\n end", "def restrict(value, range)\n [[value, range.first].max, range.last].min\n end", "def test_Range_InstanceMethods_excludes\n\t\tassert_equal(true, (1..10) === 5)\n\t\tassert_equal(false, (1..10) === 15)\n\t\tassert_equal(true, (1..10) === 3.14159)\n\t\tassert_equal(true, ('a'..'j') === 'c')\n\t\tassert_equal(false, ('a'..'j') === 'z')\n\tend", "def to_range\n\t\tIP.parse(self.start_ip)..IP.parse(self.end_ip)\n\tend", "def range(start, ending)\n return [] if start >= ending\n\n return [start] + range(start + 1, ending)\nend", "def recursive_range(start_num, end_num)\n return [] if start_num >= end_num\n recursive_range(start_num, end_num-1) << end_num - 1\nend", "def reverse_range(min, max)\n\trange = []\n \n\ti = max - 1\n\twhile i > min\n\t\trange << i\n\t\ti -= 1\n end\n \n\treturn range\nend", "def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\n end", "def range(start_val, end_val)\n return [] if start_val + 1 == end_val\n nums = [start_val + 1]\n nums + range(start_val + 1, end_val)\nend", "def range(min, max)\n # # return [] if end < start\n # if its the last one, 1, using start and end\n\n return [] if max <= min\n\n range(min, max - 1) << max - 1\n # ^ treat it like it is the same data type as base case, so treat it like an array, <<, .map\n\n # [min] + range(min + 1, max - 1)\n # ^ num ^ same data type our base case\nend", "def denormalize(lower_bound, upper_bound)\n # The first and last multiple of 360 we need to shift our range by\n start = 360 * ((lower_bound - @max).to_i / 360 + 1)\n stop = 360 * ((upper_bound - @min).to_i / 360 + 1)\n\n (start...stop).step(360).map { |s| (@min + s)..(@max + s) }\n end", "def range(min, max)\n return max if max < min\n range(min, max) << max\nend", "def test_ranges\r\n assert_equal(@range.begin.to_f, @p2.to_f)\r\n assert(@range.cover?(@p5))\r\n assert(@range.end == @p8)\r\n assert(@range2.exclude_end?)\r\n assert_false(@range.exclude_end?)\r\n assert(@range.include?(@p3))\r\n assert(@range.max == @p8)\r\n assert(@range2.max == @p7)\r\n assert(@range.last(3) == [@p6, @p7, @p8])\r\n assert(@range.size == nil)\r\n end", "def only_evens range\n range.select do |value|\n value.even?\n end\nend", "def only_evens range\n range.select do |value|\n value.even?\n end\nend", "def odd_range(min, max)\n\trange = []\n \n\ti = min\n\twhile i <= max\n\t\tif i % 2 != 0\n\t\t\trange << i\n\t\tend\n \ti += 1\n end\n\n\treturn range\nend", "def range(start_num, end_num)\n range_array = []\n range_array << start_num\n\n if(start_num < end_num)\n range_array += range(start_num + 1, end_num)\n end\n\n range_array\nend", "def &(range)\n return nil unless overlaps?(range) || touching?(range)\n PosRange.new [@start, range.start].max, [@end, range.end].min\n end", "def <=>(other) range_start <=> other.range_start end", "def range(start, last)\n return [] if last < start\n range(start, last - 1) << last - 1\nend", "def range(start, finish)\n #base case\n return nil if finish <= start\n return [start] if finish == start + 1 #return [0] for [0,1]\n #inductive step\n range(start, finish - 1) + [finish - 1]\nend", "def breakable_range; end", "def odd_range(min, max)\n\trange = []\n \ti = min \n \t\n \twhile i <= max\n if i % 2 != 0\n range << i\n end\n \n i += 1 \n end\n\treturn range\nend", "def clamp(start_range, end_range)\n Proc.new { |target|\n next start_range if target < start_range\n next end_range if target > end_range\n\n target\n }\n end", "def range(*args)\n value = \"[\"\n args.each_slice(2) do |from, to|\n from = sanitize(from)\n to = sanitize(to)\n value += \"#{from}-#{to}\"\n end\n value += \"]\"\n append value\n end", "def range(start, finish, step)\n return [] if start >= finish\n\n Enumerator.new do |y|\n y << start\n while (start += step) < finish\n y << start\n end\n end\n end", "def reverse_range(min, max)\n nums = []\n i = max\n while i > min\n if\n i == max\n i -= 1\n next\n end\n nums << i\n i -= 1\n end\n return nums\n end", "def range1(min, max)\n # Base Case / Inductive Step\n return [] if max <= min\n\n range1(min, max - 1) << max - 1\nend", "def initialize(ranges, string, exclude_end = false)\n unless ranges.is_a?(Array)\n lb = GtEqRange.new(ranges)\n if exclude_end\n ub = LtRange.new(string)\n string = \">=#{string} <#{ranges}\"\n else\n ub = LtEqRange.new(string)\n string = \"#{string} - #{ranges}\"\n end\n ranges = [MinMaxRange.create(lb, ub)]\n end\n ranges.compact!\n\n merge_happened = true\n while ranges.size > 1 && merge_happened\n # merge ranges if possible\n merge_happened = false\n result = []\n until ranges.empty?\n unmerged = []\n x = ranges.pop\n result << ranges.reduce(x) do |memo, y|\n merged = memo.merge(y)\n if merged.nil?\n unmerged << y\n else\n merge_happened = true\n memo = merged\n end\n memo\n end\n ranges = unmerged\n end\n ranges = result.reverse!\n end\n\n ranges = [LtRange::MATCH_NOTHING] if ranges.empty?\n @ranges = ranges\n @string = string.nil? ? ranges.join(' || ') : string\n end", "def exclude_ip_range(from, to)\n from_ip = IPAddr.new(from)\n to_ip = IPAddr.new(to)\n (from_ip..to_ip)\n raise 'Invalid IP range specified' if (from_ip..to_ip).to_a.size.zero?\n @excluded_scan_targets[:addresses] << IPRange.new(from, to)\n rescue ArgumentError => e\n raise \"#{e.message} in given IP range\"\n end", "def reverse_range(min, max)\n reversed = [] \n \n index = max - 1 \n \n while index > min \n reversed << index \n index -= 1\n end \n \n return reversed \n \nend", "def range\n @from..@to\n end", "def reverse_range(min, max)\n nums = []\n \n i = max - 1\n while i > min\n nums << i\n \n i -= 1\n end\n \n return nums\n end", "def range(start,finish)\n if start == finish\n return [start]\n end\n\n prev_arr = range(start+1, finish)\n prev_arr << start\n return prev_arr\nend", "def reverse_range(min, max)\n reverse_arr = []\n\n i = max -1\n while i > min\n reverse_arr << i\n i -= 1\n end\n return reverse_arr\nend", "def divide_range_into_values(range_size, start_value, end_value, is_derived_values = true)\n values = []\n # How big is x-range? What should the step size be?\n # Generally we want a hundred display points. Let's start there.\n if range_size < 1.1\n step_size = is_derived_values ? 0.01 : 0.1\n elsif range_size < 11\n step_size = is_derived_values ? 0.1 : 1\n elsif range_size < 111\n step_size = is_derived_values ? 1 : 10\n elsif range_size < 1111\n step_size = is_derived_values ? 10 : 100\n elsif range_size < 11111\n step_size = is_derived_values ? 100 : 1000\n elsif range_size < 111111\n step_size = is_derived_values ? 1000 : 10000\n else \n step_size = is_derived_values ? 10000 : 100000\n end\n grid_x = start_value\n while grid_x < end_value\n values << grid_x\n grid_x = grid_x + step_size\n end\n values\n end", "def export_range(range = Iterable::Export::TODAY)\n params = { range: range }\n Iterable.request(conf, base_path, request_params(params)).get\n end", "def range\n min, max = span\n min..max\n end", "def breakable_range=(_arg0); end", "def validate_range(value)\n classname = value.class.to_s\n case classname\n when \"Range\" \n then value\n when \"Array\"\n then value\n else\n return (value..value)\n end\n end", "def range(start, finish)\n return [] if finish < start\n return [start] if finish - 1 == start\n range(start, finish - 1) + [finish - 1]\nend", "def remove_range(from = '-inf', to = '+inf')\n connection.zremrangebyscore(key_label, from, to)\n end" ]
[ "0.67048925", "0.66411984", "0.661552", "0.65872425", "0.638718", "0.6381692", "0.63625807", "0.63625807", "0.6331616", "0.6318954", "0.6271104", "0.62284017", "0.6194463", "0.61927426", "0.6190236", "0.6157565", "0.6144774", "0.6083266", "0.60557", "0.60477036", "0.60390145", "0.60132825", "0.59921014", "0.5989963", "0.59778434", "0.5973418", "0.59610283", "0.5958354", "0.59526277", "0.5951382", "0.59406453", "0.5924957", "0.5910414", "0.59095323", "0.59072834", "0.59036535", "0.588972", "0.58752877", "0.58681875", "0.58582425", "0.5857591", "0.58461225", "0.5845167", "0.578945", "0.5785287", "0.57753766", "0.57748836", "0.5764942", "0.57586884", "0.5754255", "0.5754255", "0.5754255", "0.5754255", "0.5754255", "0.5754255", "0.5754255", "0.5754255", "0.57530016", "0.5749758", "0.57418984", "0.5739934", "0.57312495", "0.5728486", "0.57240963", "0.5712752", "0.57100993", "0.5708913", "0.56826293", "0.566348", "0.56614375", "0.56557316", "0.565413", "0.5653566", "0.5652106", "0.56467223", "0.5645657", "0.5642015", "0.56393015", "0.562286", "0.5602823", "0.56016546", "0.5597313", "0.55873716", "0.5564727", "0.55579007", "0.555721", "0.55521303", "0.55494386", "0.5544938", "0.5540607", "0.5538496", "0.55338407", "0.5532948", "0.5519787", "0.5516955", "0.55166054", "0.5511132", "0.549796", "0.5495466", "0.5492508" ]
0.73609537
0
Returns whether the range is empty A range is empty if end < begin or if begin == end and exclude_end? is true.
def empty? if exclude_end? self.end <= self.begin else self.end < self.begin end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?\n\t interval.first == interval.last && interval.exclude_end?\n end", "def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end", "def exclude_begin?\n @ranges.size == 1 ? @ranges[0].exclude_begin? : nil\n end", "def empty?\n return false if @upper_bound.nil?\n @lower_bound > @upper_bound\n end", "def empty_block? cells, start_range, stop_range\n (start_range..stop_range).each do |col|\n if cells[col].present?\n return false\n end\n end\n true\n end", "def empty?; !@from && !@to end", "def undef_overlaps?\n self.overlaps.size == 1 and self.overlaps[0].empty?\n end", "def is_a_3_dot_range?(range)\n\trange.exclude_end?\nend", "def empty?\n @start == nil\n end", "def check_non_overlapping?(indexes, range)\n return true if indexes.empty?\n\n indexes.each do |val|\n return false if val.cover?(range.begin) || val.cover?(range.end)\n end\n true\n end", "def overlaps?(range)\n !(completely_left_of?(range) || completely_right_of?(range))\n end", "def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end", "def is_a_3_dot_range?(range)\n range.exclude_end?\nend", "def start_and_end_set?\n [start, self.end].map(&:present?).uniq.length == 1\n end", "def overlap? range\n !(self & range).nil?\n end", "def empty?\n is_empty = false\n if self.bounds\n is_empty = ((self.bounds.top + self.bounds.left + self.bounds.bottom + self.bounds.right) == 0)\n end\n\n is_empty\n end", "def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= range.begin && number <= range.end\n end\nend", "def touching?(range)\n range.end == self.start || self.end == range.start\n end", "def has_range?\n !self.domain_ranges.nil?\n end", "def is_date_range?\n start_time.present? && end_time.present?\n end", "def price_range?\n !(price_range.first == price_range.last)\n end", "def price_range?\n !(price_range.first == price_range.last)\n end", "def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end", "def empty?\n\t\treturn [ self.one_of, self.all_of, self.none_of ].all?( &:empty? )\n\tend", "def empty?\n # return true if the value of the instance var @head is equal to -1\n # and the value of the instance var @tail is equal to 0\n # otherwise return false\n @head == -1 and @tail == 0\n # end of empty? method\n end", "def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end", "def exclusive\n if exclude_end?\n self\n else\n Range.new(self.begin, self.end + 1, true)\n end\n end", "def empty?\n @iterator.nil?\n end", "def test_Range_InstanceMethods_exclude_end?\n\t\t# TODO, need add some testcases.\n\tend", "def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end", "def meets?(*args)\n other = coerce_range(*args)\n self.begin == other.end or other.begin == self.end\n end", "def all_in_ranges?(nums, ranges)\n if nums.empty?\n return false\n end\n nums.each do |num|\n if !in_ranges?(num, ranges)\n return false\n end\n end\n true\nend", "def empty?\n return (@indexes.empty? and @segments_metadata.empty?)\n end", "def empty?\n raise NotImplementedError\n end", "def exclude_end?\n false\n end", "def empty?\n iterator.nil?\n end", "def empty?\n PathExpression.range(expression)[0].nil?\n end", "def empty?\n _values.all?(&:empty?)\n end", "def empty?\n each_cell do |cell|\n return false if cell\n end\n true\n end", "def empty?() end", "def empty?() end", "def empty?() end", "def exclude_end?\n @exclude_end\n end", "def empty?\n # raise NotImplementedError, \"Not yet implemented\"\n if size > 0\n return false\n end\n return true\n end", "def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end", "def exclude_begin?\n @exclude_begin\n end", "def empty?\n each do |cell|\n return false if cell.value.to_i != 0\n end\n true\n end", "def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end", "def empty?(&block)\n block ? !any?(&block) : !any?\n end", "def empty?\n raise NotImplementedError, \"Method not implemented yet...\"\n end", "def empty?\n @fragments.empty?\n end", "def test_ranges\r\n assert_equal(@range.begin.to_f, @p2.to_f)\r\n assert(@range.cover?(@p5))\r\n assert(@range.end == @p8)\r\n assert(@range2.exclude_end?)\r\n assert_false(@range.exclude_end?)\r\n assert(@range.include?(@p3))\r\n assert(@range.max == @p8)\r\n assert(@range2.max == @p7)\r\n assert(@range.last(3) == [@p6, @p7, @p8])\r\n assert(@range.size == nil)\r\n end", "def empty?\n rhs.empty?\n end", "def empty?\n @head.next == @tail && @tail.prev == @head\n end", "def __empty?\n all?(&:__empty?)\n end", "def disjoint?(other)\n if empty? && other.empty?\n @begin_pos != other.begin_pos\n else\n @begin_pos >= other.end_pos || other.begin_pos >= @end_pos\n end\n end", "def is_a_3_dot_range?(range)\n a = range.first\n b = range.last\n range != (a..b)\nend", "def range_cover?(outer, inner)\n outer.cover?(inner.begin) && outer.cover?(inner.end)\nend", "def empty?\n @data.cells_count <= 0\n end", "def empty?\n raise NotImplementedError\n end", "def empty?\n if !block_given?\n return @j_del.java_method(:isEmpty, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling empty?()\"\n end", "def exclude_end?() end", "def empty?\n @mutex.synchronize do\n return @head == @tail\n end\n end", "def empty?\n @values.values.all?(&:nil?)\n end", "def valid_cell_range\n if start_row.nil? || start_column.nil? || end_row.nil? || end_column.nil?\n errors[:base] << \"Invalid cell range entered. Must be in the format of <b>A1</b> or <b>A1:B1</b>\"\n return false\n elsif !worksheet.nil? && (start_row < 1 || start_column < 1 || end_row > worksheet.last_row || end_column > worksheet.last_column)\n errors[:base] << \"One or more cells between <b>#{to_alpha(start_column)}#{start_row}</b> and <b>#{to_alpha(end_column)}#{end_row}</b> are outside the worksheets range. Please select cells between <b>A1</b> and <b>#{to_alpha(worksheet.last_column)}#{worksheet.last_row}</b>\"\n return false\n else\n return true\n end\n end", "def empty\n @in.empty? && @out.empty?\n end", "def empty?\n _values.empty?\n end", "def empty?\n @_values.empty?\n end", "def empty?\n to_ary.empty?\n end", "def empty?\n to_ary.empty?\n end", "def empty?\n return false\n end", "def ends_before_it_begins?\n end_on? && end_on <= start_on\n end", "def empty?\n to_ary.empty?\n end", "def empty?\n @exact.empty? && @list.empty?\n end", "def empty?\n @value.nil? || (@value.respond_to?(:empty?) && @value.empty?)\n end", "def empty?\n @type == EMPTY_TYPE\n end", "def any_empty_time_segment?\n self.empty?(self, \"time_segments\", false)\n end", "def empty?\n !value\n end", "def within_bounds?\n !exceeded?\n end", "def empty?\n none? { true }\n end", "def empty?\n count <= 0\n end", "def empty?\n @is_empty\n end", "def infinite?\n !ends_at && !length\n end", "def matched_by_extended_range?(range)\n\n subtags = decomposition.dup\n subranges = range.to_str.downcase.split(HYPHEN_SPLITTER)\n\n subrange = subranges.shift\n subtag = subtags.shift\n\n while subrange\n if subrange == WILDCARD\n subrange = subranges.shift\n elsif subtag == nil\n return false\n elsif subtag == subrange\n subtag = subtags.shift\n subrange = subranges.shift\n elsif subtag.size == 1\n return false\n else\n subtag = subtags.shift\n end\n end\n true\n rescue\n false\n end", "def none_empty?\n !any_empty?\n end", "def none_empty?\n !any_empty?\n end", "def empty?\n true\n end", "def empty?\n true\n end", "def empty?\n node_next(@head, 0) == @tail\n end", "def range_includes_item?(range, item)\n range.begin <= item && item <= range.end\n end", "def empty?\n self <=> EMPTY\n end", "def empty?\n @value.nil? || @value.empty?\n end", "def contiguous?\n return nil if @data.length == 0\n (start..stop).each do |i|\n return false if get(i).nil?\n end\n return true\n end", "def empty?\n false\n end", "def empty?\n false\n end", "def intersect? (range1,range2)\n if range1.begin < range2.begin\n if range1.end < range2.begin\n nil\n else\n (range2.begin..range1.end)\n end\n else\n if range2.end < range1.begin\n nil\n else\n (range1.begin..range2.end)\n end\n end\nend", "def not_within_hypothetical_range?(dest)\n\t(dest[0] < 0 || dest[1] < 0) || (dest[0] > 7 || dest[1] > 7)\nend", "def matched_by_extended_range?(range)\n recompose\n subtags = @composition.split(Const::HYPHEN)\n subranges = range.downcase.split(Const::HYPHEN)\n\n subrange = subranges.shift\n subtag = subtags.shift\n\n while subrange\n if subrange == Const::WILDCARD\n subrange = subranges.shift\n elsif subtag == nil\n return false\n elsif subtag == subrange\n subtag = subtags.shift\n subrange = subranges.shift\n elsif subtag.size == 1\n return false\n else\n subtag = subtags.shift\n end\n end\n true\n rescue\n false\n end", "def empty?\n filter.empty?\n end", "def empty?\n @left.nil? && @middle.nil? && @right.nil?\n end" ]
[ "0.77110314", "0.75511134", "0.73856896", "0.6896937", "0.68835026", "0.6743136", "0.6574668", "0.6466301", "0.6450598", "0.64366853", "0.63932437", "0.6367697", "0.63334817", "0.6279109", "0.62450194", "0.6210988", "0.6195007", "0.6142625", "0.6123797", "0.61012787", "0.6028862", "0.6028862", "0.5977625", "0.59765077", "0.5888052", "0.5887743", "0.5859036", "0.58549744", "0.58535755", "0.58414704", "0.5835241", "0.5833493", "0.5827078", "0.5820756", "0.58131456", "0.5806786", "0.58012027", "0.5792149", "0.5790092", "0.57717437", "0.57717437", "0.57717437", "0.5766026", "0.57539135", "0.5739308", "0.57313263", "0.57308495", "0.5718702", "0.57136285", "0.5713549", "0.571309", "0.5710187", "0.57095104", "0.5694339", "0.56823164", "0.568054", "0.567581", "0.5668402", "0.56557053", "0.56539834", "0.5651503", "0.56512713", "0.5649555", "0.56437874", "0.5634275", "0.5625188", "0.5605946", "0.56045127", "0.5598423", "0.5598423", "0.55850905", "0.55843896", "0.55749375", "0.5560486", "0.55498976", "0.5541562", "0.554121", "0.5537928", "0.55278957", "0.55247897", "0.55190676", "0.54893756", "0.5486011", "0.5485846", "0.54822665", "0.54822665", "0.54775757", "0.54775757", "0.54677665", "0.546611", "0.5462815", "0.54590005", "0.5448477", "0.5446381", "0.54435676", "0.5443537", "0.54398096", "0.5434013", "0.5429479", "0.5408734" ]
0.8152051
0
resumes a given eventlet immediately, passing control to it.
def resume(*args) @fiber.resume(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume event\n f = @fiber.resume event\n\n if !f.nil? \n @finishable = f[0];\n return;\n end\n \n @is_running = false\n @event = nil\n end", "def trap_resume\n Curses.raw\n old_cont = trap 'CONT' do Curses.doupdate end\n\n yield\n\n ensure\n Curses.noraw\n trap 'CONT', old_cont\n end", "def resume\n @halt = false\n end", "def resume_next\n @condition_variable.signal\n end", "def resume(*args)\n #TODO should only allow if @status is :run, which really means\n # blocked by a call to Yield\n fiber.resume(*args)\n end", "def resume(&block)\n @pauses_manager.resume(&block)\n end", "def resume\n return if @cancelled\n begin\n @cancellation_handler = @initiation_task.call\n rescue Exception => e\n backtrace = AsyncBacktrace.create_from_exception(self.backtrace, e)\n e.set_backtrace(backtrace.backtrace) if backtrace\n @parent.fail(self, e)\n end\n end", "def resume(fiber, *arguments); end", "def resume\n with_queue_control do |control|\n control.resume\n end\n end", "def resume\n action('resume')\n end", "def resume\n @suspended = false\n end", "def resume; end", "def resume; end", "def resume\n\tend", "def resume\n end", "def resume\n end", "def resume()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_resume(@handle.ptr)\n end", "def resume(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RESUME)\n end", "def resume(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RESUME)\n end", "def resume\n\n end", "def resume\n execute_prlctl('resume', @uuid)\n end", "def resume(*)\n super.tap do\n __debug_sim(\"*** RESUME WORKFLOW STATE #{prev_state} ***\")\n end\n end", "def resume(tid); Ragweed::Wrap32::open_thread(tid) {|x| Ragweed::Wrap32::resume_thread(x)}; end", "def resume!\n raise InvalidActionError, \"Cannot resume a Say that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('household', 'resume', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def resume()\n #This is a stub, used for indexing\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume()\n @ole.Resume()\n end", "def resume_action\n Resume.new :component_id => component_id, :call_id => call_id\n end", "def resume_action\n Resume.new :component_id => component_id, :call_id => call_id\n end", "def resume_action\n Resume.new :component_id => component_id, :target_call_id => target_call_id\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume(fiber, *arguments)\n\t\t\t\toptional = Optional.new(Fiber.current)\n\t\t\t\t@ready.push(optional)\n\t\t\t\t\n\t\t\t\tfiber.transfer(*arguments)\n\t\t\tensure\n\t\t\t\toptional.nullify\n\t\t\tend", "def resume\n if !block_given?\n @j_del.java_method(:resume, []).call()\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling resume()\"\n end", "def resume(node)\n Result.new(call(CMD_RESUME % node))\n end", "def task_resume(task)\n r = CALLC[\"libc!task_resume:I=I\"].call(task).first\n raise KernelCallError.new(r) if r != 0\n end", "def resume!\n should_flush = @paused_mutex.synchronize do\n @paused -= 1 if @paused > 0\n @paused == 0\n end\n flush! if should_flush\n self\n end", "def cmd_resume argv\n setup argv\n uuid = @hash['uuid']\n response = @api.resume(uuid)\n msg response\n return response\n end", "def resume_thread(h)\r\n CALLS[\"kernel32!ResumeThread:L=L\"].call(h)\r\n end", "def resume\n @mutex.synchronize do\n if @state == :complete\n false\n else\n @sleeper.wake\n true\n end\n end\n end", "def task_resume(task)\n r = CALLS[\"libc!task_resume:I=I\"].call(task).first\n raise KernelCallError.new(:task_resume, r) if r != 0 \n end", "def resume_processing\n puts \"\\nDeferredActionChain.resume_processing: Resuming processing of DeferredActionChain[#{self.id}] of Rule #{self.rule_id}\\n\"\n rule.process_rule(event, self)\n end", "def resume\n\t\traise NotImplementedError\n\tend", "def resume\n @vm.resume\n end", "def resume\n send_resume(@token, @session.session_id, @session.sequence)\n end", "def thread_resume(thread)\n r = CALLS[\"libc!thread_resume:I=I\"].call(thread).first\n raise KernelCallError.new(:thread_resume, r) if r != 0\n end", "def resume_continuation\n t = self.continuation\n t.convert_to_runnable_state\n self.continuation = nil\n t.resume_from_continuation\n end", "def resume\n if(@paused)\n @paused = false\n reset\n end\n current_self\n end", "def resume\n # Ensure already inactive\n unless self.active\n # Set active true\n update(active: true)\n # 2. StandingEvent for resume\n StandingEvent.create(change: 0,\n standing: self,\n type: :resume)\n return true\n end\n false\n end", "def resume(value = nil)\n @fiber.resume value\n nil\n rescue FiberError\n raise DeadTaskError, \"cannot resume a dead task\"\n rescue RuntimeError => ex\n # These occur spuriously on 1.9.3 if we shut down an actor with running tasks\n return if ex.message == \"\"\n raise\n end", "def resume\n execute(:resume_vm, VmId: vm_id)\n end", "def do_resume(msg)\n\n return unless h.state == 'paused' || h.state == 'awaiting'\n\n h.state = nil\n\n m = h.delete('paused_apply')\n return do_apply(m) if m\n # if it's a paused apply, pipe it directly to #do_apply\n\n replies = h.delete('paused_replies') || []\n\n do_persist || return\n\n h.children.each { |i| @context.storage.put_msg('resume', 'fei' => i) }\n # resume children\n\n replies.each { |m| @context.storage.put_msg(m.delete('action'), m) }\n # trigger replies\n end", "def dispatch event\n @dispatch_fiber.resume event\n end", "def send_resume\n send_packet(OPCODES[:RESUME],\n { token: @identify_opts[:token], session_id: @session.id, seq: @session.seq })\n end", "def continue\n raise NoContinuation unless continuation.respond_to?(:call)\n continuation.call\n end", "def dispatch event\n raise Exception.new(\"workers cannot dispatch while blocked\") if blocked?\n @event = event\n @is_running = true\n \n self.resume event\n end", "def resume_all\n @condition_variable.broadcast\n end", "def resume_after_fork_in_parent\n logger.debug { \"##{__method__}\" }\n\n @mutex.synchronize do\n @_shutting_down = nil\n start_event_thread\n end\n end", "def inject_resume(seq)\n resume(seq || @sequence, raw_token, @session_id)\n end", "def resume_process (wfid)\n\n wfid = extract_wfid wfid\n\n root_expression = fetch_root(wfid)\n\n #\n # remove 'paused' flag\n\n @paused_instances.delete(wfid)\n root_expression.unset_variable(OpenWFE::VAR_PAUSED)\n\n #\n # notify ...\n\n onotify(:resume, root_expression.fei)\n\n #\n # replay\n #\n # select PausedError instances in separate list\n\n errors = get_error_journal.get_error_log wfid\n error_class = OpenWFE::PausedError.name\n paused_errors = errors.select { |e| e.error_class == error_class }\n\n return if paused_errors.size < 1\n\n # replay select PausedError instances\n\n paused_errors.each { |e| get_error_journal.replay_at_error e }\n end", "def resume\n super\n each_slave { |instance, iter| instance.framework.resume{ iter.next } }\n true\n end", "def strict_resume_state\n super\n end", "def resume\n FMOD.invoke(:ChannelGroup_SetPaused, self, 0)\n self\n end", "def resume\n\t\t@state = STATE_ONLINE\n\tend", "def pause\n Fiber.yield\n end", "def update_resume\n\n end", "def update_resume\n\n end", "def start(&block)\n loop do\n event_data = self.next\n block.(event_data)\n end\n end", "def resume(view)\n @ctrlDown = false\n @shiftDown = false\n end", "def paused_exec\n raise \"No block given.\" if !block_given?\n self.pause\n \n begin\n sleep 0.2 while @httpserv and @httpserv.working_count and @httpserv.working_count > 0\n @paused_mutex.synchronize do\n Timeout.timeout(15) do\n yield\n end\n end\n ensure\n self.unpause\n end\n end", "def continue\n flow.continue\n sleep(5)\n @flow = flow.reload\n end", "def resume(service_name, timeout: DEFAULT_TIMEOUT)\n Puppet.debug _(\"Resuming the %{service_name} service. Timeout set to: %{timeout} seconds\") % { service_name: service_name, timeout: timeout }\n\n valid_initial_states = [\n SERVICE_PAUSE_PENDING,\n SERVICE_PAUSED,\n SERVICE_CONTINUE_PENDING\n ]\n\n transition_service_state(service_name, valid_initial_states, SERVICE_RUNNING, timeout) do |service|\n # The SERVICE_CONTROL_CONTINUE signal can only be sent when\n # the service is in the SERVICE_PAUSED state\n wait_on_pending_state(service, SERVICE_PAUSE_PENDING, timeout)\n\n send_service_control_signal(service, SERVICE_CONTROL_CONTINUE)\n end\n\n Puppet.debug _(\"Successfully resumed the %{service_name} service\") % { service_name: service_name }\n end", "def resumed\n !!@hash_object[:resumed]\n end", "def i_continue\n yield\n puts \"after yield\"\nend", "def within_preserved_state\n lock.synchronize do\n begin\n interactor.stop if interactor\n @result = yield\n rescue Interrupt\n # Bring back Pry when the block is halted with Ctrl-C\n end\n\n interactor.start if interactor && running\n end\n\n @result\n end", "def resume\n @pauses.each do |topic, partitions|\n partitions.each do |partition, pause|\n next unless pause.paused?\n next unless pause.expired?\n\n pause.resume\n\n yield(topic, partition)\n end\n end\n end", "def inject_resume(seq)\n send_resume(raw_token, @session_id, seq || @sequence)\n end", "def resume_session\n session_tracker.resume_session\n end", "def continue\n @queue << \"continue\"\n end", "def resume_vm\n respond_to do |format|\n logger.debug \"\\n resume? \\n \"\n result = @vm.resume_vm\n # TODO! check if really resumed\n format.html { \n flash[:notice] = result[:message].html_safe \n redirect_back fallback_location: my_labs_path+(@vm.lab_vmt.lab ? \"/#{@vm.lab_vmt.lab.id}\" : '')+(@vm.lab_vmt.lab && params[:username] ? \"/#{params[:username]}\" : '')\n }\n format.json { render :json => {:success=>result[:success], :message=> result[:message] } }\n end\n end", "def continue_process_events(str=\"\")\r\n @num_of_suspend -= 1\r\n if @num_of_suspend <= 0\r\n @num_of_suspend = 0\r\n @suspend_queue_proc = false\r\n @log.debug(\"Continue to process core events (locks: #{@num_of_suspend}) (#{str})\")\r\n process_next_gevent\r\n else\r\n @log.debug(\"Suspend yet locked #{@num_of_suspend} (#{str})\")\r\n end\r\n end", "def resume_status\n Cproton.pn_ssl_resume_status(@impl)\n end", "def wake_event_loop!\n super\n end", "def wake_event_loop!\n super\n end", "def send_resume_request\n begin\n request = Net::HTTP::Get.new(\"#{@uri.request_uri}/reattach\")\n response = @http.request(request)\n rescue => e\n puts e\n end\n end", "def resume_task\n background = params[:sync] != '1'\n\n if background\n SyncTaskWorker.perform_async('token' => session[:facebook].access_token, 'task' => @task.id)\n else\n task_class = \"Tasks::\" << \"#{@task.type}_task\".camelize\n klass = task_class.constantize.new(task: @task, send_mail: false)\n klass.run\n end\n \n flash[:notice] << 'This task is now resumed.'\n redirect_to tasks_path and return\n end", "def finally_do\n pause_rt\n put \"put my compendium in my shroud\"\nend", "def resume_job!(job, data)\n job.save! do\n Burstflow::Worker.perform_later(workflow.id, job.id, data)\n end\n end", "def resume(vid)\n perform_request(action: 'vserver-unsuspend', vserverid: vid)\n end", "def resume_process (wfid)\n\n get_expression_pool.resume_process(wfid)\n end", "def schedule(&block)\n pool_fiber.resume(block)\n end", "def resume(id)\n _params = {:id => id}\n return @master.call 'subaccounts/resume', _params\n end", "def proceed(event=nil, bag={})\n r = StepResult.new(true)\n r.bag = bag\n fire_events(event, r) if event\n r\n end", "def resume!\n self.class.current(self.user).close! if self.class.current(self.user)\n self.work_times << TaskTime.create(start: DateTime.now, user: self.user)\n\n self\n end", "def resume(topic, partition)\n @mutex.lock\n\n return if @closed\n\n # Always commit synchronously offsets if any when we resume\n # This prevents resuming without offset in case it would not be committed prior\n # We can skip performance penalty since resuming should not happen too often\n internal_commit_offsets(async: false)\n\n # If we were not able, let's try to reuse the one we have (if we have)\n tpl = topic_partition_list(topic, partition) || @paused_tpls[topic][partition]\n\n return unless tpl\n # If we did not have it, it means we never paused this partition, thus no resume should\n # happen in the first place\n return unless @paused_tpls[topic].delete(partition)\n\n @kafka.resume(tpl)\n ensure\n @mutex.unlock\n end", "def suspend &block\n if block_given? then\n @mutex.synchronize {\n begin\n @suspended = true\n block.call(self)\n ensure\n @suspended = false\n end\n }\n end\n end", "def set_resumee\n @resumee = Resumee.find(params[:id])\n end", "def starting?; event(:start).pending? end", "def resume\n process_status = status\n if process_status == 'stopped'\n return status if Process.kill('CONT', @proc_attrs[:pid].to_i)\n end\n process_status\n rescue Errno::EPERM\n return 'non-privilaged operation'\n end", "def resume_all; threads.each {|x| resume(x)}; end" ]
[ "0.6952863", "0.6713674", "0.63717586", "0.63510805", "0.6338614", "0.62968886", "0.62889594", "0.62606657", "0.62525445", "0.6234762", "0.62002987", "0.6157925", "0.6157925", "0.6136757", "0.6096667", "0.6096667", "0.6064419", "0.6044233", "0.603829", "0.59458303", "0.5922767", "0.5901412", "0.58961594", "0.5874667", "0.5813519", "0.5805722", "0.5801096", "0.579954", "0.5777836", "0.5776859", "0.57573485", "0.5745174", "0.57418406", "0.57304263", "0.5662676", "0.55691785", "0.55528146", "0.5543669", "0.5540179", "0.5532721", "0.5530056", "0.5522514", "0.54977554", "0.54577506", "0.54568136", "0.54311866", "0.5430409", "0.5418465", "0.5400856", "0.5368686", "0.5366205", "0.53311163", "0.5315783", "0.5315137", "0.5199557", "0.5193939", "0.51866823", "0.5165183", "0.5132398", "0.51144934", "0.510633", "0.5097389", "0.5094007", "0.50811285", "0.5007467", "0.50028527", "0.50028527", "0.4971041", "0.49706712", "0.49671084", "0.49535567", "0.49515507", "0.4917493", "0.49142465", "0.48837867", "0.48730496", "0.4857937", "0.4854862", "0.48505923", "0.48475456", "0.48296526", "0.48020336", "0.47799593", "0.47799593", "0.4768525", "0.47620198", "0.47611687", "0.47568125", "0.47515512", "0.47502297", "0.47497922", "0.47379497", "0.47261664", "0.47097751", "0.47080487", "0.46958157", "0.46910468", "0.4690443", "0.46580023", "0.46479103" ]
0.63763976
2
GET /steps GET /steps.json
def index if params[:project_id] @steps = Step.joins(:projects).includes(:work_items, :work_items => :users, :work_items => :tasks).where('projects.id = ?', params[:project_id]).order('position ASC') steps = @steps.collect do |s| s.work_items.sort!{|a, b| a.position <=> b.position} s end @steps = steps else @steps = Step.all end respond_with @steps end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def index\n @steps = Step.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.collated.ordered.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def getsteps\n\t\t@hide_menu = true\n\n puts \"In Steps\"\n recId = params['query'].inspect\n #this is the link to the API\n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recId[1..-2] + \"/analyzedInstructions?stepBreakdown=true\"\n stepss = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n allSteps = stepss.body\n\n recSteps = Hash.new\n\n counter = 1\n #this is how the recipe information is formatted\n allSteps.each do |key|\n key.each do |key2,steps|\n if(key2.eql? \"steps\")\n steps.each do |step|\n step.each do |key3, lastStep|\n if(key3.eql? \"step\")\n recSteps[counter] = lastStep\n counter += 1\n #this gives each step a number, for ease of use\n end\n end\n end\n end\n end\n end\n puts recSteps\n\n @recipeData = recSteps\n render template: \"recipes/data3\"\n end", "def index\n @steps = @guide.steps\n end", "def index\n @steps = Step.all\n end", "def index\n @goal_steps = GoalStep.all\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def index\n\n if params[:task_id] \n task = Task.find(params[:task_id])\n if task != nil\n @steps = task.steps\n else\n @steps = []\n end\n else \n @steps = Step.all\n end\n end", "def show\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steps_log }\n end\n end", "def new\n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def steps\n @steps ||= []\n end", "def index\n redirect_to wizard_path(steps.first, request.query_parameters)\n end", "def index\n @taken_steps = TakenStep.all\n end", "def show\n @steps = @tutorial.steps\n @step = @tutorial.steps.build\n end", "def index\n @next_steps = NextStep.all\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user_steps = UserStep.all\n end", "def index\n @roadmap_steps = RoadmapStep.all\n end", "def show\n @next_step = NextStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @next_step }\n end\n end", "def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end", "def new\n @steps_log = StepsLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @steps_log }\n end\n end", "def show\n @step = @guide.steps.find(params[:id])\n end", "def index\n @project_steps = ProjectStep.all\n end", "def index\n @step_ms = StepM.all\n end", "def index\n @step_commands = StepCommand.all\n end", "def steps=(new_value)\n @steps = new_value\n end", "def create\n @step = Step.new(step_params) \n\n if @step.save\n render :show, status: :created, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def steps\n step_flows.collect(&:current_step)\n end", "def steps\n @steps ||= parser.parse\n end", "def steps\n find_solution\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @step = Step.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @step_type = StepType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_type }\n end\n end", "def new\n @step_activity = StepActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_activity }\n end\n end", "def index \n authorize! :read, @project \n @stepIDs = @project.steps.not_labels.order(\"published_on\").pluck(:id)\n\n # fix step position and ancestry if there's an error\n if @project.steps.where(:position => -1).present?\n Rails.logger.info(\"FIXING STEP POSITIONS AND ANCESTRY\")\n start_position = @project.steps.order(:position).last.position\n @project.steps.where(:position => -1).order(\"created_at\").each do |step|\n last_step = @project.steps.where(:position => start_position).first\n step.update_attributes(:ancestry => last_step.ancestry + \"/\" + last_step.id.to_s)\n step.update_attributes(:position => start_position+1)\n start_position = start_position + 1\n end\n end\n \n respond_to do |format|\n # go directly to the project overview page\n format.html \n format.json\n format.xml \n end\n end", "def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end", "def show\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead_step }\n end\n end", "def set_step\n begin\n @step = Step.find(params[:id])\n rescue => e\n puts e.message\n render json: { message: \"Id do step não encontrado\" }, status: :not_found\n end\n end", "def steps\n @steps ||= 0\n end", "def new\n @step = Step.new :phase_template_id => params[:phase_template_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def steps\n %w[first last]\n end", "def index\n @step_threes = StepThree.all\n end", "def steps\n %w[name time]\n end", "def index\n @cooking_steps = CookingStep.all\n end", "def index\n @steplogs = Steplog.all\n end", "def show\n @steps = @experiment.steps.all(:order => :step_order)\n\n #NB - in experiment/show view, experiment destroyed at end if temp==true\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @experiment }\n end\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @step2 = Step2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step2 }\n end\n end", "def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end", "def get_steps(category)\n steps = []\n params.each do |k,v|\n if (k.starts_with? \"step\") && (cat_number(k) == category[1])\n name = v\n num = step_number(k)\n steps << [cat_number(k),num,name]\n end\n end\n return steps\n end", "def new\n @step2 = Step2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step2 }\n end\n end", "def show\n @step = @script.steps.build\n end", "def get_word_by_step\n @words = Word.where(step: params[:step]).order(created_at: :desc).page params[:page]\n end", "def index\n if params[:workflow_id] \n workflow = Workflow.find(params[:workflow_id])\n if workflow != nil\n @step_definitions = workflow.step_definitions\n else\n @step_definitions = []\n end\n else \n @step_definitions = StepDefinition.all\n end\n end", "def index\n @process_steps = ProcessStep.all\n end", "def list_tree_steps(flow_step = self, skips = [])\n steps_children = []\n flow_step.my_steps.reject{ |s| skips.include? s.id }.each do |step|\n steps_children << { step: step, flow: step.my_child_flow, steps: (step.step_type == 'flow' ? list_tree_steps(step.my_child_flow, skips) : []) }\n end if flow_step.present? && flow_step.my_steps.present?\n steps_children\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def index\n @category_steps = CategoryStep.all\n end", "def index\n @steps = Step.where shop_id: session[:shopify]\n end", "def form_steps\n self.steps\n end", "def new\n @lead_step = LeadStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead_step }\n end\n end", "def new\n @pre_step = PreStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre_step }\n end\n end", "def all_steps\n\t#make calls to step here...\nend", "def steps\n steps_keywords = %w(Given When Then And But)\n nsteps = 0\n @steps = []\n while true\n print \"Add step [Y/n]: \"\n choice = gets\n if choice.downcase.strip != \"n\"\n puts \"Step #{nsteps +1}:\"\n step = gets.capitalize\n init_step_word = step.split(' ').first\n if steps_keywords.include?(init_step_word)\n @steps << step\n nsteps = nsteps ++ 1\n else\n puts \"Error: #{init_step_word} unsupported initial value\"\n puts \"Use only #{steps_keywords} keywords\"\n end\n elsif choice.downcase.strip == \"n\"\n break\n else\n \"please enter a valid choice.\"\n end\n end\n write_feature\n end", "def index\n @step_scenarios = StepScenario.where(scenario_id: current_scenario.id)\n end", "def new\n @step = Step.new\n @selection = Selection.find(params[:selection_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_step }\n end\n end", "def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end", "def run\n if @start.kind_of? String\n client = Restfulie.at(@start)\n client = client.follow if @follow\n client = client.accepts(@accepts) if @accepts\n @start = current = client.get\n else\n # probably configured thru the Rest Process Model class\n @start = current = @goal.class.get_restfulie.get\n end\n \n # load the steps and scenario\n @goal.steps \n @goal.scenario \n \n while(!@goal.completed?(current))\n current = @walker.move(@goal, current, self)\n end\n current\n end", "def next\n lesson.steps.where(\"id > ?\", id).first\n end", "def step(steps, force = false)\n #This is a stub, used for indexing\n end", "def show\n \t@step = Step.find(params[:id])\n \t\n \trespond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @step }\n end\n end", "def show\n @tc_detail_step = TcDetailStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tc_detail_step }\n end\n end", "def show\n @recipe = Recipe.find(params[:id])\n @step = @recipe.steps.build #build a new step, this new one does not have sequence_id YET\n @ingredient = @recipe.ingredients.build #build new ingredient\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def steps\n %w[\n household_member_demographics_step\n household_member_address_step\n household_member_address_search_results_step\n household_member_citizenship_step\n household_member_education_step\n household_member_employments_step\n household_member_assessment_employment_step\n household_member_incomes_step\n household_member_unearned_incomes_step\n household_member_expenses_step\n household_member_resources_step\n household_member_relations_step\n ]\n end", "def create\n @step = Step.new(params[:step])\n @step.test_case_id = params[:test_case_id].to_i\n\n respond_to do |format|\n if @step.save\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.json { render :json => @step, :status => :created, :location => @step }\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def p_steps_feed\n PStep.all\n end", "def create\n \t@step = @tutorial.steps.build(params[:step])\n authorize! :create, @step\n respond_to do |format|\n if @step.save\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully created.') }\n format.xml { render :xml => @tutorial, :status => :created, :location => @tutorial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n step_attributes = step_params\n fields_attributes = step_attributes.delete(\"fields\")\n\n @step = Step.new(step_attributes)\n @step.fields = Field.createFields(fields_attributes)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:step_number, :points, :name, :quest_id, :answer, :body)\n end", "def index\n @stepones = Stepone.all\n end", "def new\n @step = @guide.steps.new(params[:step])\n end", "def steps\n Rails.cache.fetch([self, \"pill_sequence_steps\"]) { pill_sequence_steps }\n end", "def steps\n @result['tracks'].collect {|track| track.name}\n end", "def step_params\n params.require(:step).permit(\n :milestone_id, :reached_at, :notes\n )\n end", "def set_step\n @step = @recipe_item.steps.find(params[:id])\n end", "def index\n @project_step_ms = ProjectStepM.all\n end", "def to_json\n # Convert Object to Hash\n hash = self.to_hash\n\n # Grab the Step objects and convert to Hashes\n steps = hash['steps']\n hashified_steps = []\n steps.each {|step| hashified_steps << step.to_hash}\n hash['steps'] = hashified_steps\n\n # Convert Hash to JSON\n hash.to_json\n end", "def steps\n unless @steps_loaded\n step_file = File.expand_path(\"./steps/#{self.class.name.underscore}.rb\", @@current_dir)\n if File.exists?(step_file)\n self.instance_eval File.read(step_file), __FILE__, __LINE__ + 1\n else\n raise StepsFileNotFoundError.new(\"File #{step_file} not found\")\n end\n @steps_loaded = true\n end\n end", "def set_step\n @step = @trip.steps.find_by_id params[:id]\n end", "def index\n @active_workflow_steps = ActiveWorkflowStep.all\n end", "def steps(steps)\n @step_lengths = steps.map {|keyword, name| (keyword+name).unpack(\"U*\").length}\n @max_step_length = @step_lengths.max\n @step_index = -1\n end" ]
[ "0.7637826", "0.71650946", "0.68370473", "0.68370473", "0.68370473", "0.68370473", "0.6820434", "0.67121947", "0.6697843", "0.66859204", "0.6614578", "0.6571187", "0.6571187", "0.6571187", "0.6489213", "0.6478076", "0.6385908", "0.63753617", "0.6344778", "0.6264669", "0.62381005", "0.62057096", "0.61792237", "0.61588967", "0.61372924", "0.61166376", "0.6055973", "0.6044074", "0.60266876", "0.60157454", "0.6003184", "0.59887326", "0.5988204", "0.5983245", "0.59759283", "0.5970961", "0.5963535", "0.5928957", "0.5920211", "0.5900489", "0.5888895", "0.5886303", "0.58858913", "0.58835393", "0.58081657", "0.5802995", "0.58009624", "0.58002", "0.5796894", "0.5779206", "0.5751844", "0.57474715", "0.5742418", "0.5731351", "0.5728561", "0.5713906", "0.5704631", "0.56797594", "0.5667821", "0.5664656", "0.5663201", "0.56514806", "0.5649133", "0.564495", "0.5637676", "0.5619421", "0.5602638", "0.55939716", "0.5586722", "0.5582782", "0.55721897", "0.5567494", "0.5566464", "0.55640906", "0.55631745", "0.5559274", "0.5555995", "0.5540523", "0.55343586", "0.5534257", "0.5511974", "0.55112314", "0.55085605", "0.5498964", "0.5487762", "0.54787225", "0.54770243", "0.5469162", "0.5464744", "0.5462877", "0.5460241", "0.5457021", "0.5456545", "0.5453943", "0.54528433", "0.54492736", "0.5446872", "0.5445863", "0.5441009", "0.54409796" ]
0.58727586
44
GET /steps/1 GET /steps/1.json
def show @step = Step.find_by_slug(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @step } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "def index\n @steps = Step.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def show\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steps_log }\n end\n end", "def show\n @step2 = Step2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step2 }\n end\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def show\n @step = @guide.steps.find(params[:id])\n end", "def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end", "def show\n @next_step = NextStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @next_step }\n end\n end", "def index\n @steps = @guide.steps\n end", "def index\n @steps = Step.collated.ordered.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def getsteps\n\t\t@hide_menu = true\n\n puts \"In Steps\"\n recId = params['query'].inspect\n #this is the link to the API\n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recId[1..-2] + \"/analyzedInstructions?stepBreakdown=true\"\n stepss = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n allSteps = stepss.body\n\n recSteps = Hash.new\n\n counter = 1\n #this is how the recipe information is formatted\n allSteps.each do |key|\n key.each do |key2,steps|\n if(key2.eql? \"steps\")\n steps.each do |step|\n step.each do |key3, lastStep|\n if(key3.eql? \"step\")\n recSteps[counter] = lastStep\n counter += 1\n #this gives each step a number, for ease of use\n end\n end\n end\n end\n end\n end\n puts recSteps\n\n @recipeData = recSteps\n render template: \"recipes/data3\"\n end", "def show\n @step_type = StepType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_type }\n end\n end", "def show\n @steps = @tutorial.steps\n @step = @tutorial.steps.build\n end", "def new\n @step2 = Step2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step2 }\n end\n end", "def index\n @goal_steps = GoalStep.all\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\n if params[:task_id] \n task = Task.find(params[:task_id])\n if task != nil\n @steps = task.steps\n else\n @steps = []\n end\n else \n @steps = Step.all\n end\n end", "def index\n @steps = Step.all\n end", "def set_step\n begin\n @step = Step.find(params[:id])\n rescue => e\n puts e.message\n render json: { message: \"Id do step não encontrado\" }, status: :not_found\n end\n end", "def new\n @step = Step.new :phase_template_id => params[:phase_template_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end", "def new\n @step_activity = StepActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_activity }\n end\n end", "def show\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_step }\n end\n end", "def create\n @step = Step.new(step_params) \n\n if @step.save\n render :show, status: :created, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def show\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead_step }\n end\n end", "def index\n redirect_to wizard_path(steps.first, request.query_parameters)\n end", "def new\n @steps_log = StepsLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @steps_log }\n end\n end", "def next\n lesson.steps.where(\"id > ?\", id).first\n end", "def new\n @step = Step.new\n @selection = Selection.find(params[:selection_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def show\n \t@step = Step.find(params[:id])\n \t\n \trespond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @step }\n end\n end", "def show\n @step = @script.steps.build\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pre_step = PreStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre_step }\n end\n end", "def show\n @recipe = Recipe.find(params[:id])\n @step = @recipe.steps.build #build a new step, this new one does not have sequence_id YET\n @ingredient = @recipe.ingredients.build #build new ingredient\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end", "def index\n @next_steps = NextStep.all\n end", "def show\n @tc_detail_step = TcDetailStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tc_detail_step }\n end\n end", "def index\n @taken_steps = TakenStep.all\n end", "def index \n authorize! :read, @project \n @stepIDs = @project.steps.not_labels.order(\"published_on\").pluck(:id)\n\n # fix step position and ancestry if there's an error\n if @project.steps.where(:position => -1).present?\n Rails.logger.info(\"FIXING STEP POSITIONS AND ANCESTRY\")\n start_position = @project.steps.order(:position).last.position\n @project.steps.where(:position => -1).order(\"created_at\").each do |step|\n last_step = @project.steps.where(:position => start_position).first\n step.update_attributes(:ancestry => last_step.ancestry + \"/\" + last_step.id.to_s)\n step.update_attributes(:position => start_position+1)\n start_position = start_position + 1\n end\n end\n \n respond_to do |format|\n # go directly to the project overview page\n format.html \n format.json\n format.xml \n end\n end", "def run\n if @start.kind_of? String\n client = Restfulie.at(@start)\n client = client.follow if @follow\n client = client.accepts(@accepts) if @accepts\n @start = current = client.get\n else\n # probably configured thru the Rest Process Model class\n @start = current = @goal.class.get_restfulie.get\n end\n \n # load the steps and scenario\n @goal.steps \n @goal.scenario \n \n while(!@goal.completed?(current))\n current = @walker.move(@goal, current, self)\n end\n current\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_step\n @step = @recipe_item.steps.find(params[:id])\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def index\n @project_steps = ProjectStep.all\n end", "def update\n if @step.update(step_params)\n render :show, status: :ok, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def new\n @step = Step.new\n @test_case = TestCase.find(params[:test_case_id])\n respond_with @step\n end", "def create\n @step = Step.new(params[:step])\n @step.test_case_id = params[:test_case_id].to_i\n\n respond_to do |format|\n if @step.save\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.json { render :json => @step, :status => :created, :location => @step }\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @step_commands = StepCommand.all\n end", "def index\n @user_steps = UserStep.all\n end", "def set_step\n @step = @trip.steps.find_by_id params[:id]\n end", "def step1\n\n end", "def new\n @lead_step = LeadStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead_step }\n end\n end", "def new\n @step = @guide.steps.new(params[:step])\n end", "def index\n @roadmap_steps = RoadmapStep.all\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def [](name)\n steps[name]\n end", "def [](name)\n steps[name]\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def show\n @wizard = Wizard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wizard }\n end\n end", "def update\n @step = @guide.steps.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to [@guide, @step], notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @steps = @experiment.steps.all(:order => :step_order)\n\n #NB - in experiment/show view, experiment destroyed at end if temp==true\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @experiment }\n end\n end", "def step1\n \n end", "def new\n @post = Post.new\n session[:step] = @post.step = Post::STEPS.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def update\n if @step.update(step_params)\n render :show, status: :ok\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def index\n @stepones = Stepone.all\n end", "def index\n if params[:workflow_id] \n workflow = Workflow.find(params[:workflow_id])\n if workflow != nil\n @step_definitions = workflow.step_definitions\n else\n @step_definitions = []\n end\n else \n @step_definitions = StepDefinition.all\n end\n end", "def index\n @step_scenarios = StepScenario.where(scenario_id: current_scenario.id)\n end", "def show\n @book_step = BookStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_step }\n end\n end", "def index\n @step_threes = StepThree.all\n end", "def index\n @step_ms = StepM.all\n end", "def show\n unless session[:referrer]\n session[:referrer] = request.referrer\n end\n\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @step }\n end\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def current_step \n @current_step || steps.first\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_url }\n format.json { head :no_content }\n end\n end", "def new\n @goal = Goal.new\n current_uri = request.env['PATH_INFO']\n \n if current_uri == goal_wizard_path\n render :wizard\n else\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\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 create\n @recipe = Recipe.find(params[:recipe_id])\n @step = @recipe.steps.new(step_params)\n\n if @step.save\n redirect_to @recipe, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def index\n if params[:project_id]\n @steps = Step.joins(:projects).includes(:work_items, :work_items => :users, :work_items => :tasks).where('projects.id = ?', params[:project_id]).order('position ASC')\n steps = @steps.collect do |s|\n s.work_items.sort!{|a, b| a.position <=> b.position}\n s\n end\n @steps = steps\n else\n @steps = Step.all\n end\n\n respond_with @steps\n end", "def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\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" ]
[ "0.7460156", "0.7168968", "0.7168968", "0.7168968", "0.7037824", "0.6926366", "0.68012416", "0.6732481", "0.6719113", "0.6685765", "0.6685765", "0.6685765", "0.6685765", "0.6669708", "0.6632687", "0.6623837", "0.65953994", "0.65694636", "0.6513855", "0.6479822", "0.64797056", "0.6452391", "0.6446137", "0.6440331", "0.6417251", "0.6358492", "0.6340917", "0.6308185", "0.62872314", "0.6283348", "0.62748", "0.62583727", "0.6255063", "0.62546563", "0.6201376", "0.618346", "0.61814576", "0.61555535", "0.6155187", "0.6145225", "0.612112", "0.6107107", "0.6104502", "0.6064365", "0.60535765", "0.602179", "0.59930885", "0.598527", "0.5976091", "0.5970621", "0.59607816", "0.59307384", "0.5929709", "0.5907856", "0.5902595", "0.590118", "0.5900156", "0.5898104", "0.58977723", "0.5891257", "0.5890334", "0.5888483", "0.58763933", "0.58610064", "0.58610064", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58476466", "0.58378375", "0.58249015", "0.58200574", "0.58194876", "0.5811674", "0.5800567", "0.57958674", "0.57924306", "0.5789379", "0.5759384", "0.575808", "0.5755191", "0.57512176", "0.5737421", "0.5733814", "0.57299733", "0.57274497", "0.5723351", "0.5694687", "0.56940514", "0.5693453", "0.56933266", "0.5681886", "0.5680585", "0.5680585", "0.5680585" ]
0.6544564
18
GET /steps/new GET /steps/new.json
def new @step = Step.new respond_to do |format| format.html # new.html.erb format.json { render json: @step } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end", "def new\n @step = Step.new :phase_template_id => params[:phase_template_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end", "def new\n @steps_log = StepsLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @steps_log }\n end\n end", "def new\n @step_activity = StepActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_activity }\n end\n end", "def new\n @step = Step.new\n @selection = Selection.find(params[:selection_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @pre_step = PreStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre_step }\n end\n end", "def new\n @step2 = Step2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step2 }\n end\n end", "def new\n @step = @guide.steps.new(params[:step])\n end", "def new\n @lead_step = LeadStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead_step }\n end\n end", "def new\n @step = @task.steps.build\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\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 @goal = Goal.new\n current_uri = request.env['PATH_INFO']\n \n if current_uri == goal_wizard_path\n render :wizard\n else\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end\n end", "def create\n @step = Step.new(step_params) \n\n if @step.save\n render :show, status: :created, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @post = Post.new\n session[:step] = @post.step = Post::STEPS.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n \t@step = Step.new(:tutorial=>@tutorial)\n authorize! :new, @step\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @step }\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tc_detail_step = TcDetailStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tc_detail_step }\n end\n end", "def new\n @methodstep = Methodstep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @methodstep }\n end\n end", "def create\n \t@step = @tutorial.steps.build(params[:step])\n authorize! :create, @step\n respond_to do |format|\n if @step.save\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully created.') }\n format.xml { render :xml => @tutorial, :status => :created, :location => @tutorial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @step = Step.new\n @test_case = TestCase.find(params[:test_case_id])\n respond_with @step\n end", "def create\n @recipe = Recipe.find(params[:recipe_id])\n @step = @recipe.steps.new(step_params)\n\n if @step.save\n redirect_to @recipe, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def new\n @book_step = BookStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_step }\n end\n end", "def new\n @step = Step.new\n end", "def new\n @goal_state = GoalState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal_state }\n end\n end", "def new\n @wizard = Wizard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wizard }\n end\n end", "def create\n @step = StepsTaken.new(step_params)\n\n if @step.save\n redirect_to @step, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def new\n @level_goal = LevelGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_goal }\n end\n end", "def create\n @next_step = NextStep.new(params[:next_step])\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to :back, notice: 'Next step was successfully created.' }\n format.json { render json: @next_step, status: :created, location: @next_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(params[:step])\n @step.test_case_id = params[:test_case_id].to_i\n\n respond_to do |format|\n if @step.save\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.json { render :json => @step, :status => :created, :location => @step }\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @project_step = ProjectStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_step }\n end\n end", "def new\n @trip = Trip.new\n @trip.steps.build\n end", "def create\n @taken_step = TakenStep.new(taken_step_params)\n\n respond_to do |format|\n if @taken_step.save\n format.html { redirect_to @taken_step, notice: 'Steps Taken was successfully created.' }\n format.json { render :show, status: :created, location: @taken_step }\n else\n format.html { render :new }\n format.json { render json: @taken_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def create\n @step = @task.steps.build(params[:step])\n\n if @step.save\n redirect_to [@task,@step]\n else\n render :action => \"new\"\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def create\n @goal_step = GoalStep.new(goal_step_params)\n\n respond_to do |format|\n if @goal_step.save\n format.html { redirect_to @goal_step, notice: \"Goal step was successfully created.\" }\n format.json { render :show, status: :created, location: @goal_step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @goal_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.js\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end", "def new\n @product = Product.find(params[:product_id])\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 create\n @next_step = NextStep.new(next_step_params)\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to @next_step, notice: 'Next step was successfully created.' }\n format.json { render :show, status: :created, location: @next_step }\n else\n format.html { render :new }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\n\n @goal_id = params[:id]\n @milestone = Milestone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @milestone }\n end\n end", "def create\n @step_type = StepType.new(params[:step_type])\n\n respond_to do |format|\n if @step_type.save\n format.html { redirect_to @step_type, notice: 'Step type was successfully created.' }\n format.json { render json: @step_type, status: :created, location: @step_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @v_goal = VGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @v_goal }\n end\n end", "def create\n @steps_log = StepsLog.new(params[:steps_log])\n\n respond_to do |format|\n if @steps_log.save\n format.html { redirect_to @steps_log, notice: 'Steps log was successfully created.' }\n format.json { render json: @steps_log, status: :created, location: @steps_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @steps_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lab_flow = LabFlow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_flow }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def create\n\n step_attributes = step_params\n fields_attributes = step_attributes.delete(\"fields\")\n\n @step = Step.new(step_attributes)\n @step.fields = Field.createFields(fields_attributes)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tutorial_state = Tutorial::State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_state }\n end\n end", "def new\n @scenario = Scenario.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scenario }\n end\n end", "def new_big_steps\n @program = current_practice.programs.find(params[:id])\n @program.big_steps.build\n end", "def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step = Step.new\n @project = Project.find(params[:project_id])\n @tc = TestCase.find(params[:test_case_id])\n\n render :layout => \"empty\"\n end", "def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end", "def create\n @step_m = StepM.new(step_m_params)\n\n respond_to do |format|\n if @step_m.save\n format.html { redirect_to @step_m, notice: 'Step m was successfully created.' }\n format.json { render :show, status: :created, location: @step_m }\n else\n format.html { render :new }\n format.json { render json: @step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @selection = Selection.find(params[:selection_id])\n @step = @selection.steps.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to selection_step_path(@step.selection, @step), notice: 'Step was successfully created.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\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 @lineup = Lineup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineup }\n end\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def create\n @project = Project.find(params[:project_id])\n position = Step.joins(:projects).where('projects.id = ?', @project.id).maximum('steps.position')\n position = 1 unless position\n @step = @project.steps.create(params[:step])\n @step.position = position - 1\n respond_to do |format|\n if @step.save\n ProjectMailer.notify_step_created(@step, current_user).deliver\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json do\n render json: @step, status: :created\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @training_level = TrainingLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_level }\n end\n end", "def new\n @questionnaire = current_questionnaire || Questionnaire.new\n \n if @questionnaire.step > 13\n redirect_to goodbye_path\n return\n end\n respond_to do |format|\n format.html { render \"questionnaires/steps/step#{@questionnaire.step}\" }\n format.json { render json: @questionnaire }\n end\n end", "def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @route }\n end\n end", "def new\n @trajectory = Trajectory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trajectory }\n end\n end", "def new\n @trick = Trick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trick }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def create\n @testcase = Testcase.find(params[:testcase_id])\n @step = @testcase.steps.new(step_params)\n byebug\n if @step.save\n render :show, status: :created\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def new\n @lab = Lab.find(params[:lab_id])\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def quest_new_page\n \"/#{user_path}/#{objective_path}/#{controller}/new\"\n end", "def new\n @lifecycle = Lifecycle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lifecycle }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @go_slim_sequence = GoSlimSequence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_slim_sequence }\n end\n end" ]
[ "0.8326137", "0.7754607", "0.77181315", "0.77040356", "0.76325387", "0.75851744", "0.7393559", "0.73890674", "0.7377804", "0.73325866", "0.73225975", "0.7298311", "0.7256544", "0.7219394", "0.7219394", "0.7219394", "0.72105545", "0.71799856", "0.7178456", "0.7143546", "0.71335644", "0.71310353", "0.71025795", "0.7056916", "0.70456964", "0.7008159", "0.70006555", "0.6993101", "0.6986481", "0.69757265", "0.6968657", "0.6962747", "0.69485086", "0.6946903", "0.69284886", "0.69149804", "0.69102126", "0.69083714", "0.68915766", "0.68886775", "0.68799704", "0.6877305", "0.6877305", "0.68547684", "0.68417877", "0.68354446", "0.6765458", "0.6753793", "0.67527044", "0.6745814", "0.67440575", "0.6742031", "0.672092", "0.66918117", "0.6656433", "0.6646745", "0.664509", "0.6626574", "0.6621031", "0.66122866", "0.6599456", "0.658963", "0.65791136", "0.6574539", "0.6572219", "0.65716237", "0.6553378", "0.6546866", "0.6546866", "0.6546866", "0.6546866", "0.65464514", "0.65464514", "0.6541923", "0.6529354", "0.6526004", "0.65245193", "0.65209264", "0.65209264", "0.65209264", "0.65209264", "0.6516855", "0.65088254", "0.65015304", "0.6500259", "0.6500259", "0.6500259", "0.64950985", "0.6491279", "0.6485736", "0.6482242", "0.6476305", "0.64696294", "0.6465722", "0.6461734", "0.6461734", "0.6461734", "0.6461734", "0.6460873", "0.6454501" ]
0.82181114
1
POST /steps POST /steps.json
def create @project = Project.find(params[:project_id]) position = Step.joins(:projects).where('projects.id = ?', @project.id).maximum('steps.position') position = 1 unless position @step = @project.steps.create(params[:step]) @step.position = position - 1 respond_to do |format| if @step.save ProjectMailer.notify_step_created(@step, current_user).deliver format.html { redirect_to @step, notice: 'Step was successfully created.' } format.json do render json: @step, status: :created end else format.html { render action: "new" } format.json { render json: @step.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(step_params) \n\n if @step.save\n render :show, status: :created, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n\n step_attributes = step_params\n fields_attributes = step_attributes.delete(\"fields\")\n\n @step = Step.new(step_attributes)\n @step.fields = Field.createFields(fields_attributes)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def create\n @step = Step.new(params[:step])\n @step.test_case_id = params[:test_case_id].to_i\n\n respond_to do |format|\n if @step.save\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.json { render :json => @step, :status => :created, :location => @step }\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @next_step = NextStep.new(params[:next_step])\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to :back, notice: 'Next step was successfully created.' }\n format.json { render json: @next_step, status: :created, location: @next_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @next_step = NextStep.new(next_step_params)\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to @next_step, notice: 'Next step was successfully created.' }\n format.json { render :show, status: :created, location: @next_step }\n else\n format.html { render :new }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = @task.steps.build(params[:step])\n\n if @step.save\n redirect_to [@task,@step]\n else\n render :action => \"new\"\n end\n end", "def create_steps(stage_steps)\n sequence = 1\n stage_steps.map do |stage_step|\n step = Step.new\n step.sequence = sequence\n\n begin\n action_name = stage_step['action']\n plugin = Cyclid.plugins.find(action_name, Cyclid::API::Plugins::Action)\n\n step_action = plugin.new(stage_step)\n raise if step_action.nil?\n rescue StandardError => ex\n # XXX Rescue an internal exception\n halt_with_json_response(404, INVALID_ACTION, ex.message)\n end\n\n # Serialize the object into the Step and store it in the database.\n step.action = Oj.dump(step_action)\n step.save!\n\n sequence += 1\n\n step\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.js\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.find(params[:testcase_id])\n @step = @testcase.steps.new(step_params)\n byebug\n if @step.save\n render :show, status: :created\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n @taken_step = TakenStep.new(taken_step_params)\n\n respond_to do |format|\n if @taken_step.save\n format.html { redirect_to @taken_step, notice: 'Steps Taken was successfully created.' }\n format.json { render :show, status: :created, location: @taken_step }\n else\n format.html { render :new }\n format.json { render json: @taken_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = StepsTaken.new(step_params)\n\n if @step.save\n redirect_to @step, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def create\n @step = Step.new(params[:step])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.save\n flash[:notice] = \"Successfully created step.\"\n end\n respond_with @step\n end", "def step_params\n params.require(:step).permit(:step_number, :points, :name, :quest_id, :answer, :body)\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.find(params[:recipe_id])\n @step = @recipe.steps.new(step_params)\n\n if @step.save\n redirect_to @recipe, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def create\n \t@step = @tutorial.steps.build(params[:step])\n authorize! :create, @step\n respond_to do |format|\n if @step.save\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully created.') }\n format.xml { render :xml => @tutorial, :status => :created, :location => @tutorial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @steps_log = StepsLog.new(params[:steps_log])\n\n respond_to do |format|\n if @steps_log.save\n format.html { redirect_to @steps_log, notice: 'Steps log was successfully created.' }\n format.json { render json: @steps_log, status: :created, location: @steps_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @steps_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal_step = GoalStep.new(goal_step_params)\n\n respond_to do |format|\n if @goal_step.save\n format.html { redirect_to @goal_step, notice: \"Goal step was successfully created.\" }\n format.json { render :show, status: :created, location: @goal_step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @goal_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step_m = StepM.new(step_m_params)\n\n respond_to do |format|\n if @step_m.save\n format.html { redirect_to @step_m, notice: 'Step m was successfully created.' }\n format.json { render :show, status: :created, location: @step_m }\n else\n format.html { render :new }\n format.json { render json: @step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lead_step = LeadStep.new(params[:lead_step])\n\n respond_to do |format|\n if @lead_step.save\n format.html { redirect_to @lead_step, notice: 'Lead step was successfully created.' }\n format.json { render json: @lead_step, status: :created, location: @lead_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lead_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def create\n @user_step = UserStep.new(user_step_params)\n\n respond_to do |format|\n if @user_step.save\n format.html { redirect_to @user_step, notice: 'User step was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_step }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(\n :milestone_id, :reached_at, :notes\n )\n end", "def create\n\n # params[:post][:step4] = \"TESTING4\";\n params[:post][:steps] = \"\"\n \n if params[:post][:step]\n params[:post][:step].each do |k, v|\n if params[:post][:step].length == k.to_i\n params[:post][:steps] << v\n else\n params[:post][:steps] << v + '|'\n end\n end\n params[:post].delete(\"step\")\n end\n\n #return render :text => params[:post]\n @post = current_user.posts.create(params[:post])\n\n if @post.save\n flash[:success] = 'Post was successfully created.'\n redirect_to @post\n else\n render :new\n end\n\n end", "def create\n @step_type = StepType.new(params[:step_type])\n\n respond_to do |format|\n if @step_type.save\n format.html { redirect_to @step_type, notice: 'Step type was successfully created.' }\n format.json { render json: @step_type, status: :created, location: @step_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @roadmap = Roadmap.find(params[:roadmap_id])\n @roadmap_step = @roadmap.roadmap_steps.create(roadmap_step_params)\n #@roadmap_step = RoadmapStep.new(roadmap_step_params)\n\n respond_to do |format|\n if @roadmap_step.save\n format.html { redirect_to @roadmap, notice: 'Roadmap step was successfully created.' }\n format.json { render :show, status: :created, location: @roadmap_step }\n else\n format.html { render :new }\n format.json { render json: @roadmap_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @steplog = Steplog.new(steplog_params)\n\n respond_to do |format|\n if @steplog.save\n format.html { redirect_to @steplog, notice: 'Steplog was successfully created.' }\n format.json { render :show, status: :created, location: @steplog }\n else\n format.html { render :new }\n format.json { render json: @steplog.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def step_params\n params.require(:step).permit(:recipe_id, :number, :description, :timer)\n end", "def create\n @step = Step.new(step_params)\n @step.shop_id = session[:shopify]\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # ensure that the submitted parent_id actually exists\n if !Step.exists?(params[:step][:parent_id].to_i)\n logger.debug \"Step doesn't exist!\"\n if @project.steps.last\n params[:step][:parent_id] = @project.steps.last.id\n else\n params[:step][:parent_id] = nil\n end\n end\n\n if params[:step][:pin] && params[:step][:pin].empty?\n params[:step][:pin] = nil\n end\n\n @step = @project.steps.build(params[:step])\n authorize! :create, @step \n\n if params[:step][:position]\n @step.position = params[:step][:position]\n else\n @step.position = @numSteps\n end\n \n respond_to do |format|\n if @step.save\n\n # update corresponding collections\n @step.project.collections.each do |collection|\n collection.touch\n end\n \n # create an edit entry\n Edit.create(:user_id => current_user.id, :step_id => @step.id, :project_id => @project.id)\n\n # check whether project is published\n if @project.public? || @project.privacy.blank?\n @project.set_published(current_user.id, @project.id, @step.id)\n end\n\n @project.set_built\n\n # update the project updated_at date\n @project.touch\n\n # update the user last_updated_at date\n current_user.touch\n\n @step.update_attributes(:published_on => @step.created_at)\n\n # create a public activity for any added question\n if @step.question\n Rails.logger.debug(\"created new question\")\n @step.question.create_activity :create, owner: current_user, primary: true\n end\n\n # log the creation of a new step\n @project.delay.log\n\n format.html { \n\n # update all images with new step id\n new_step_images = @project.images.where(\"step_id = -1\")\n new_step_images.each do |image|\n image.update_attributes(:saved => true)\n image.update_attributes(:step_id => @step.id)\n end\n\n # update all videos with new step id\n new_step_videos = @project.videos.where(\"step_id = -1\")\n new_step_videos.each do |video|\n video.update_attributes(:saved=>true)\n video.update_attributes(:step_id=> @step.id)\n end\n\n # push project to village if it doesn't already exist\n if @project.village_id.blank? && current_user.from_village? && @project.public? && !access_token.blank?\n create_village_project\n elsif !@project.village_id.blank? && !access_token.blank?\n update_village_project\n end\n \n redirect_to project_steps_path(@project), :flash=>{:createdStep => @step.id}\n \n }\n \n format.json { render :json => @step }\n else\n Rails.logger.debug(@step.errors.inspect)\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @selection = Selection.find(params[:selection_id])\n @step = @selection.steps.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to selection_step_path(@step.selection, @step), notice: 'Step was successfully created.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pre_step = PreStep.new(params[:pre_step])\n\n respond_to do |format|\n if @pre_step.save\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully created.' }\n format.json { render json: @pre_step, status: :created, location: @pre_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:post_id, :name)\n end", "def step_params\n params.require(:step).permit(:location, :lon, :lat, :arrive_on, :stay, :trip_id)\n end", "def create\n @step_scenario = StepScenario.new(step_scenario_params)\n @step_scenario.scenario_id = current_scenario.id\n\n respond_to do |format|\n if @step_scenario.save\n format.html { redirect_to scenario_path(current_scenario), notice: \"Passo do cenário cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: @step_scenario }\n else\n format.html { render :new }\n format.json { render json: @step_scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @process_step = ProcessStep.new(process_step_params)\n\n respond_to do |format|\n if @process_step.save\n format.html { redirect_to @process_step, notice: 'Process step was successfully created.' }\n format.json { render :show, status: :created, location: @process_step }\n else\n format.html { render :new }\n format.json { render json: @process_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step2 = Step2.new(params[:step2])\n\n respond_to do |format|\n if @step2.save\n format.html { redirect_to @step2, notice: 'Step2 was successfully created.' }\n format.json { render json: @step2, status: :created, location: @step2 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step2.errors, status: :unprocessable_entity }\n end\n end\n end", "def roadmap_step_params\n params.require(:roadmap_step).permit(:step)\n end", "def create\n @post = Post.find(params[:post_id])\n @step = Step.new(:post=>@post)\n secureEnter @step\n @step = Step.create(step_params)\n @step.content = \"\"\n respond_to do |format|\n if @step.save\n format.html { redirect_to edit_post_path(@post.id), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_step = ProjectStep.new(project_step_params)\n\n respond_to do |format|\n if @project_step.save\n format.html { redirect_to @project_step, notice: 'Project step was successfully created.' }\n format.json { render :show, status: :created, location: @project_step }\n else\n format.html { render :new }\n format.json { render json: @project_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daily_step = DailyStep.new(daily_step_params)\n\n respond_to do |format|\n if @daily_step.save\n format.html { redirect_to @daily_step, notice: 'Daily step was successfully created.' }\n format.json { render :show, status: :created, location: @daily_step }\n else\n format.html { render :new }\n format.json { render json: @daily_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def steps=(new_value)\n @steps = new_value\n end", "def step_params\n params.require(:step).permit(:name, :time)\n end", "def step_params\n params.require(:step).permit(:name, :step_url, :html, :collection_id, :next_step_id, :only_customer, :is_custom)\n end", "def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end", "def step_params\n params.require(:step).permit(:number, :description, :locator, :skip, :testcase_id, :actionValue)\n end", "def create\n @cooking_step = CookingStep.new(cooking_step_params)\n\n respond_to do |format|\n if @cooking_step.save\n format.html { redirect_to @cooking_step, notice: 'Cooking step was successfully created.' }\n format.json { render :show, status: :created, location: @cooking_step }\n else\n format.html { render :new }\n format.json { render json: @cooking_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:step_number, :pattern_step, :counter_open, :row_count, :rep_count, :pattern_id)\n end", "def create\n @step = Step.new(step_params)\n @step.screenshot = step_params[:screenshot]\n respond_to do |format|\n if @step.save\n if !params.has_key?(:bookmarklet)\n format.html { redirect_to assignment_path(@step.assignment.id)+\"/\"+@step.user_id.to_s+\"/\"+@step.id.to_s}\n else\n format.html { redirect_to bookmarkletSuccess_url}\n end\n else\n flash[:errors] = @step.errors\n format.html { redirect_to assignment_path(@step.assignment.id)+\"/\"+@step.user_id.to_s }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def next_step_params\n params.require(:next_step).permit(:goal_id, :next_step, :responsible_party, :due_date, :completed)\n end", "def create\n @step_command = StepCommand.new(step_command_params)\n\n respond_to do |format|\n if @step_command.save\n format.html { redirect_to @step_command, notice: 'Step command was successfully created.' }\n format.json { render :show, status: :created, location: @step_command }\n else\n format.html { render :new }\n format.json { render json: @step_command.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n @step_definition = StepDefinition.new(step_definition_attributes)\n @step_definition.field_definitions = FieldDefinition.createFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.save\n format.html { redirect_to @step_definition, notice: 'Step definition was successfully created.' }\n format.json { render :show, status: :created, location: @step_definition }\n else\n format.html { render :new }\n format.json { render json: @step_definition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step_comment = StepComment.new(step_comment_params)\n\n respond_to do |format|\n if @step_comment.save\n format.html { redirect_to @step_comment, notice: 'Step comment was successfully created.' }\n format.json { render :show, status: :created, location: @step_comment }\n else\n format.html { render :new }\n format.json { render json: @step_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step = @task.steps.build\n end", "def step_params\n params.require(:step).permit(:instruction)\n end", "def create\n @step_six = StepSix.new(step_six_params)\n\n respond_to do |format|\n if @step_six.save\n format.html { redirect_to \"/delivery_flows\", notice: 'Step six was successfully created.' }\n format.json { render :show, status: :created, location: @step_six }\n else\n format.html { render :new }\n format.json { render json: @step_six.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @steps_log = StepsLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @steps_log }\n end\n end", "def index\n @steps = Step.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def create\n @tc_detail_step = TcDetailStep.new(params[:tc_detail_step])\n\n respond_to do |format|\n if @tc_detail_step.save\n format.html { redirect_to @tc_detail_step, notice: 'Tc detail step was successfully created.' }\n format.json { render json: @tc_detail_step, status: :created, location: @tc_detail_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tc_detail_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # puts \"---------------------\"\n # puts workflow_params.to_json\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # @workflow = Workflow.new(workflow_attributes)\n\n # @workflow.step_definitions = StepDefinition.createStepDefinitions(step_definitions_attributes)\n\n @workflow = Workflow.new(workflow_params)\n respond_to do |format|\n if @workflow.save\n format.html { redirect_to @workflow, notice: 'Workflow was successfully created.' }\n format.json { render :show, status: :created, location: @workflow }\n else\n format.html { render :new }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step_activity = StepActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_activity }\n end\n end", "def create\n @wizard = Wizard.new(params[:wizard])\n\n respond_to do |format|\n if @wizard.save\n format.html { redirect_to @wizard, notice: 'Wizard was successfully created.' }\n format.json { render json: @wizard, status: :created, location: @wizard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wizard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @methodstep = Methodstep.new(params[:methodstep])\n\n respond_to do |format|\n if @methodstep.save\n flash[:notice] = 'Methodstep was successfully created.'\n format.html { redirect_to(@methodstep) }\n format.xml { render :xml => @methodstep, :status => :created, :location => @methodstep }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @methodstep.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n params[:post][:steps] = \"\"\n if params[:post][:step] \n params[:post][:step].each do |k, v|\n if params[:post][:step].length == k.to_i\n params[:post][:steps] << v\n else\n params[:post][:steps] << v + '|'\n end\n end\n end\n params[:post].delete(\"step\")\n\n if @post.update_attributes(params[:post])\n flash[:success] = 'Post was successfully created.'\n redirect_to @post \n else\n render action: \"edit\"\n end\n end", "def create\n @category_step = CategoryStep.new(category_step_params)\n\n respond_to do |format|\n if @category_step.save\n format.html { redirect_to @category_step, notice: 'Category step was successfully created.' }\n format.json { render :show, status: :created, location: @category_step }\n else\n format.html { render :new }\n format.json { render json: @category_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end", "def new\n @step = Step.new :phase_template_id => params[:phase_template_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def create\n @book_step = BookStep.new(params[:book_step])\n\n respond_to do |format|\n if @book_step.save\n format.html { redirect_to @book_step, notice: 'Book step was successfully created.' }\n format.json { render json: @book_step, status: :created, location: @book_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:title, :position, :board_id)\n end", "def step(steps, force = false)\n #This is a stub, used for indexing\n end", "def new\n @step = @guide.steps.new(params[:step])\n end", "def new\n @trip = Trip.new\n @trip.steps.build\n end", "def create\n @active_workflow_step = ActiveWorkflowStep.new(active_workflow_step_params)\n\n respond_to do |format|\n if @active_workflow_step.save\n format.html { redirect_to @active_workflow_step, notice: 'Active workflow step was successfully created.' }\n format.json { render :show, status: :created, location: @active_workflow_step }\n else\n format.html { render :new }\n format.json { render json: @active_workflow_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_plan = WorkPlan.find(params[:work_plan_id])\n @work_step = WorkStep.new(work_step_params)\n @work_step.work_plan=@work_plan\n\n respond_to do |format|\n if @work_step.save\n format.html { redirect_to @work_plan, notice: 'Work step was successfully created.' }\n format.json { render :show, status: :created, location: @work_plan }\n else\n format.html { render :new }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @post = Post.new\n session[:step] = @post.step = Post::STEPS.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def create\n @step_seven = StepSeven.new(step_seven_params)\n\n respond_to do |format|\n if @step_seven.save\n format.html { redirect_to \"/delivery_flows\", notice: 'Step seven was successfully created.' }\n format.json { render :show, status: :created, location: @step_seven }\n else\n format.html { render :new }\n format.json { render json: @step_seven.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:stepDate, :stepAmount)\n end", "def goal_step_params\n params.require(:goal_step).permit(:name)\n end", "def new\n @pre_step = PreStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre_step }\n end\n end", "def create\n @step_four = StepFour.new(step_four_params)\n\n respond_to do |format|\n if @step_four.save\n format.html { redirect_to \"/delivery_flows\", notice: 'Step four was successfully created.' }\n format.json { render :show, status: :created, location: @step_four }\n else\n format.html { render :new }\n format.json { render json: @step_four.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = @trip.steps.new(step_params)\n\n @locations = JSON params['locations']\n\n respond_to do |format|\n if @step.valid?\n if @step.save\n if @step.have_updated_forecast? # return true or false\n format.html { redirect_to @trip, notice: 'Step was successfully created. Updated forecast available.' }\n format.json { render action: 'show', status: :created, location: @step }\n else\n if @step.should_make_forecast?\n if @step.make_forecast == true # return true , false or nil\n format.html { redirect_to @trip, notice: 'Step was successfully created. New forecast requested.' }\n format.json { render action: 'show', status: :created, location: @step }\n else @step.make_forecast == false\n format.html { \n flash.now[:notice] = \"Cannot make forecast for #{@step.location}. City not found!\" \n render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @trip, notice: 'Step was successfully created. No forecast available for the arrival.' }\n format.json { render action: 'show', status: :created, location: @step } \n end \n end\n else\n format.html { render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n else\n format.html { \n flash.now[:notice] = \"Cannot make forecast for #{@step.location}. Arrive on should be in the past!\" \n render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n \n end\n\n end", "def step_params\n params.require(:step).permit(:user_id, :assignment_id, :title, :url, :justification, :parent_id, :lft, :rgt, :favorite, :document, :screenshot)\n end", "def taken_step_params\n params.require(:taken_step).permit(:count, :done_on)\n end", "def create\n @goal = Goal.new(params[:goal])\n @goal.set_goal_user current_user\n\n # on the wizard path, steps guarantee that this goal preceeds the plan and reward. Create empty objects for next step.\n is_wizard = (params[:user_context] == 'wizard')\n\n respond_to do |format|\n if @goal.save\n if is_wizard \n @reward = @goal.plan.reward\n puts \"reward #{@reward}\"\n format.html { render action: \"wizard_prize\" }\n else\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n end\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def steps\n steps_keywords = %w(Given When Then And But)\n nsteps = 0\n @steps = []\n while true\n print \"Add step [Y/n]: \"\n choice = gets\n if choice.downcase.strip != \"n\"\n puts \"Step #{nsteps +1}:\"\n step = gets.capitalize\n init_step_word = step.split(' ').first\n if steps_keywords.include?(init_step_word)\n @steps << step\n nsteps = nsteps ++ 1\n else\n puts \"Error: #{init_step_word} unsupported initial value\"\n puts \"Use only #{steps_keywords} keywords\"\n end\n elsif choice.downcase.strip == \"n\"\n break\n else\n \"please enter a valid choice.\"\n end\n end\n write_feature\n end", "def create\n @project_step_m = ProjectStepM.new(project_step_m_params)\n\n respond_to do |format|\n if @project_step_m.save\n format.html { redirect_to @project_step_m, notice: 'Project step m was successfully created.' }\n format.json { render :show, status: :created, location: @project_step_m }\n else\n format.html { render :new }\n format.json { render json: @project_step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stepsix = Stepsix.new(params[:stepsix])\n\n respond_to do |format|\n if @stepsix.save\n format.html { redirect_to(root_path, :notice => 'Stepsix was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stepsix.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @step2 = Step2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step2 }\n end\n end", "def create\n @project_step = ProjectStep.new(params[:project_step])\n\n respond_to do |format|\n if @project_step.save\n flash[:notice] = 'ProjectStep was successfully created.'\n format.html { redirect_to(@project_step) }\n format.xml { render :xml => @project_step, :status => :created, :location => @project_step }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project_step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def getsteps\n\t\t@hide_menu = true\n\n puts \"In Steps\"\n recId = params['query'].inspect\n #this is the link to the API\n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recId[1..-2] + \"/analyzedInstructions?stepBreakdown=true\"\n stepss = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n allSteps = stepss.body\n\n recSteps = Hash.new\n\n counter = 1\n #this is how the recipe information is formatted\n allSteps.each do |key|\n key.each do |key2,steps|\n if(key2.eql? \"steps\")\n steps.each do |step|\n step.each do |key3, lastStep|\n if(key3.eql? \"step\")\n recSteps[counter] = lastStep\n counter += 1\n #this gives each step a number, for ease of use\n end\n end\n end\n end\n end\n end\n puts recSteps\n\n @recipeData = recSteps\n render template: \"recipes/data3\"\n end", "def create\n @step_three = StepThree.new(step_three_params)\n\n respond_to do |format|\n if @step_three.save\n format.html { redirect_to \"/delivery_flows\", notice: 'Step three was successfully created.' }\n format.json { render :show, status: :created, location: @step_three }\n else\n format.html { render :new }\n format.json { render json: @step_three.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lead_step = LeadStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead_step }\n end\n end", "def create\n @step_ingredient = StepIngredient.new(params[:step_ingredient])\n\n respond_to do |format|\n if @step_ingredient.save\n format.html { redirect_to(@step_ingredient, :notice => 'Step ingredient was successfully created.') }\n format.xml { render :xml => @step_ingredient, :status => :created, :location => @step_ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @step_ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.72776073", "0.7162873", "0.7154432", "0.7053331", "0.6981029", "0.69380945", "0.6864185", "0.6797167", "0.67728835", "0.67721575", "0.6742286", "0.671232", "0.66172564", "0.6616853", "0.6608131", "0.659918", "0.6577374", "0.6566789", "0.65660614", "0.6541265", "0.6532123", "0.64957887", "0.6493571", "0.6492403", "0.64795434", "0.6448564", "0.64176327", "0.6395177", "0.63662505", "0.6361793", "0.6324372", "0.6306016", "0.63027936", "0.6294374", "0.62571776", "0.6241377", "0.6223794", "0.6188579", "0.6187251", "0.6175234", "0.61749935", "0.61557496", "0.6153728", "0.6108349", "0.6099903", "0.60941064", "0.60884523", "0.60664994", "0.6052518", "0.6045492", "0.6033619", "0.6014668", "0.6008266", "0.5993309", "0.5988699", "0.5985259", "0.5984496", "0.5971532", "0.5968117", "0.59588885", "0.59465647", "0.5927697", "0.5913197", "0.5909184", "0.5902931", "0.58999616", "0.58840185", "0.58534706", "0.5849646", "0.58363336", "0.5823475", "0.5820306", "0.5805945", "0.5796085", "0.5778746", "0.5777596", "0.5776552", "0.57713103", "0.5759831", "0.57479745", "0.57429767", "0.57364297", "0.5729515", "0.5718076", "0.5706004", "0.57033974", "0.5701667", "0.56960267", "0.569029", "0.5688361", "0.5687672", "0.5683905", "0.5676903", "0.5665762", "0.56608313", "0.56517583", "0.56489784", "0.56432587", "0.5636128", "0.5632613" ]
0.63662344
29
PUT /steps/1 PUT /steps/1.json
def update @step = Step.find(params[:id]) respond_to do |format| if @step.update_attributes(params[:step]) format.html { redirect_to @step, notice: 'Step was successfully updated.' } format.json { render :json => {:message => "Success"} } else format.html { render action: "edit" } format.json { render json: @step.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @step = @guide.steps.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to [@guide, @step], notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @step.update(step_params)\n render :show, status: :ok, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to [@task,@step], notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @step.update(step_params)\n render :show, status: :ok\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @step = Step.find(params[:id])\n\n if @step.update_attributes(params[:step])\n redirect_to (quest_path(@quest)), notice: 'Step was successfully updated.'\n\n else\n render action: \"edit\" \n end\n \n \n \n end", "def update\n @step = Step.find(params[:id])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.update_attributes(params[:step])\n flash[:notice] = 'Step was successfully updated.'\n end\n respond_with @step\n end", "def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to selection_step_path, notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = params[:step].to_i\n content = FetchContentService.new.(current_student.os, @step)\n current_student.steps << {title: content[:title] }\n current_student.save!\n\n redirect_to edit_students_path\n end", "def update\n @next_step = NextStep.find(params[:id])\n\n respond_to do |format|\n if @next_step.update_attributes(params[:next_step])\n format.html { redirect_to :back, notice: 'Next step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = current_questionnaire\n @questionnaire.step += 1\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to new_questionnaire_path }\n # format.json { head :no_content }\n else\n format.html { render \"questionnaires/steps/step#{@questionnaire.step - 1}\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.html { redirect_to assignment_path(@step.assignment.id)+\"/\"+@step.user_id.to_s+\"/\"+@step.id.to_s}\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taken_step.update(taken_step_params)\n format.html { redirect_to @taken_step, notice: 'Steps taken was successfully updated.' }\n format.json { render :show, status: :ok, location: @taken_step }\n else\n format.html { render :edit }\n format.json { render json: @taken_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_step\n begin\n @step = Step.find(params[:id])\n rescue => e\n puts e.message\n render json: { message: \"Id do step não encontrado\" }, status: :not_found\n end\n end", "def update\n\n step_attributes = step_params\n fields_attributes = step_attributes.delete(\"fields\")\n\n Field.updateFields(fields_attributes)\n\n respond_to do |format|\n if @step.update(step_attributes)\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = Step.find(params[:id])\n @tutorial = @step.tutorial\n authorize! :update, @step\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step2 = Step2.find(params[:id])\n\n respond_to do |format|\n if @step2.update_attributes(params[:step2])\n format.html { redirect_to @step2, notice: 'Step2 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step_type = StepType.find(params[:id])\n\n respond_to do |format|\n if @step_type.update_attributes(params[:step_type])\n format.html { redirect_to @step_type, notice: 'Step type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @next_step.update(next_step_params)\n format.html { redirect_to @next_step, notice: 'Next step was successfully updated.' }\n format.json { render :show, status: :ok, location: @next_step }\n else\n format.html { render :edit }\n format.json { render json: @next_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n if @steps_log.update_attributes(params[:steps_log])\n format.html { redirect_to @steps_log, notice: 'Steps log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @steps_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n params[:post][:steps] = \"\"\n if params[:post][:step] \n params[:post][:step].each do |k, v|\n if params[:post][:step].length == k.to_i\n params[:post][:steps] << v\n else\n params[:post][:steps] << v + '|'\n end\n end\n end\n params[:post].delete(\"step\")\n\n if @post.update_attributes(params[:post])\n flash[:success] = 'Post was successfully created.'\n redirect_to @post \n else\n render action: \"edit\"\n end\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def update\n respond_to do |format|\n if @step_three.update(step_three_params)\n format.html { redirect_to @step_three, notice: 'Step three was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_three }\n else\n format.html { render :edit }\n format.json { render json: @step_three.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to api_v1_step_url(@step), notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n if @pre_step.update_attributes(params[:pre_step])\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # StepDefinition.updateStepDefinitions(step_definitions_attributes)\n\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step.update(step_params)\n format.js\n format.html { redirect_to home_path, notice: 'Step was successfully updated.' }\n format.json { render :show, status: :ok, location: @step }\n else\n format.html { render :edit }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal_step.update(goal_step_params)\n format.html { redirect_to @goal_step, notice: \"Goal step was successfully updated.\" }\n format.json { render :show, status: :ok, location: @goal_step }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @goal_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stepone.update(stepone_params)\n format.html { redirect_to mainpage_path(@stepone.mainpage), notice: 'Stepone was successfully updated.' }\n format.json { render :show, status: :ok, location: @stepone }\n else\n format.html { render :edit }\n format.json { render json: @stepone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step_scenario.update(step_scenario_params)\n format.html { redirect_to scenario_path(current_scenario), notice: \"Passo do cenário atualizado com sucesso!\" }\n format.json { render :show, status: :ok, location: @step_scenario }\n else\n format.html { render :edit }\n format.json { render json: @step_scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_step\n @step = @trip.steps.find_by_id params[:id]\n end", "def update\n respond_to do |format|\n if @step_m.update(step_m_params)\n format.html { redirect_to @step_m, notice: 'Step m was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_m }\n else\n format.html { render :edit }\n format.json { render json: @step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_step\n @step = Step.find(params[:id])\n end", "def create\n @step = Step.new(params[:step])\n @step.test_case_id = params[:test_case_id].to_i\n\n respond_to do |format|\n if @step.save\n @step_activity = StepActivity.new(:activity_type => 'edit', :description => @step.description)\n @step_activity.user = current_user\n @step_activity.step = @step\n @step_activity.save!\n format.json { render :json => @step, :status => :created, :location => @step }\n format.html { redirect_to(project_test_case_path(@step.test_case.project, @step.test_case)) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_step\n @step = @recipe_item.steps.find(params[:id])\n end", "def create\n @step = Step.new(step_params) \n\n if @step.save\n render :show, status: :created, location: @step\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n @step = Step.new(step_params)\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step, notice: 'Step was successfully created.' }\n format.json { render :show, status: :created, location: @step }\n else\n format.html { render :new }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_step.update(user_step_params)\n format.html { redirect_to @user_step, notice: 'User step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step_six.update(step_six_params)\n format.html { redirect_to @step_six, notice: 'Step six was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_six }\n else\n format.html { render :edit }\n format.json { render json: @step_six.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @active_workflow_step.update(active_workflow_step_params)\n format.html { redirect_to @active_workflow_step, notice: 'Active workflow step was successfully updated.' }\n format.json { render :show, status: :ok, location: @active_workflow_step }\n else\n format.html { render :edit }\n format.json { render json: @active_workflow_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_step(step, linear)\n if linear\n self.step_flow = step_flows.find_by(current_step: step)\n self.step_status.mirror_step_flow(self.step_flow)\n self.save\n else\n self.step_status.current_step = step\n end\n self.step_status.save\n self.save\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n format.json { render json: @step, status: :created, location: @step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n if @lead_step.update_attributes(params[:lead_step])\n format.html { redirect_to @lead_step, notice: 'Lead step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lead_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_step = BookStep.find(params[:id])\n\n respond_to do |format|\n if @book_step.update_attributes(params[:book_step])\n format.html { redirect_to @book_step, notice: 'Book step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def update\n respond_to do |format|\n if @project_step.update(project_step_params)\n format.html { redirect_to @project_step, notice: 'Project step was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_step }\n else\n format.html { render :edit }\n format.json { render json: @project_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step_ingredient = StepIngredient.find(params[:id])\n\n respond_to do |format|\n if @step_ingredient.update_attributes(params[:step_ingredient])\n format.html { redirect_to(@step_ingredient, :notice => 'Step ingredient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @step_ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.status = \"deleted\"\n @step.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def update\n respond_to do |format|\n if @steplog.update(steplog_params)\n format.html { redirect_to @steplog, notice: 'Steplog was successfully updated.' }\n format.json { render :show, status: :ok, location: @steplog }\n else\n format.html { render :edit }\n format.json { render json: @steplog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @city = City.find(params[:id])\n if @city.update_attributes(:name=>params[:body][:name],:step=>\"1\")\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end", "def steps=(new_value)\n @steps = new_value\n end", "def update\n respond_to do |format|\n if @cooking_step.update(cooking_step_params)\n format.html { redirect_to @cooking_step, notice: 'Cooking step was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooking_step }\n else\n format.html { render :edit }\n format.json { render json: @cooking_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = @project.steps.find_by_position(params[:id])\n authorize! :update, @step \n\n # update corresponding collections\n @step.project.collections.each do |collection|\n collection.touch\n end\n \n @step.images.each do |image|\n image.update_attributes(:saved => true)\n end\n\n # remove question if question description is empty\n if params[:step][:question_attributes] && params[:step][:question_attributes][:description].length == 0 && @step.question\n @step.question.destroy\n end\n\n if params[:step][:published_on_date]\n date = params[:step][:published_on_date]\n logger.debug \"date: #{date}\"\n time = params[:step][:published_on_time]\n # retain the same seconds as the original published_on date\n time.insert 5, \":\" + @step.published_on.strftime(\"%S\")\n # logger.debug \"time: #{time}\"\n timeZone = params[:step][:timeZone]\n # logger.debug \"timeZone: #{timeZone}\"\n dateTime = date + \" \" + time + \" \" + timeZone\n # logger.debug \"dateTime: #{dateTime}\"\n dateTime = DateTime.strptime(dateTime, '%m/%d/%Y %I:%M:%S %p %Z')\n # logger.debug \"datetime: #{dateTime}\"\n \n params[:step][:published_on] = dateTime\n params[:step].delete :'published_on_date'\n params[:step].delete :\"published_on_time\"\n params[:step].delete :timeZone\n end\n\n # update the project \n @project.touch\n\n # update the user last updated date\n current_user.touch\n\n # remove any design attributes if they contain an ID that doesn't exist (the file had been removed)\n if params[:step][:design_files_attributes]\n params[:step][:design_files_attributes].values.each do |design_file|\n if DesignFile.exists?(design_file['id']) == false\n design_file.delete :id\n end\n end\n end\n \n respond_to do |format|\n\n if @step.update_attributes(params[:step])\n \n # clear label color if user didn't select color\n if @step.label == false\n @step.update_column(\"label_color\", nil)\n end\n\n # clear edit\n edit = Edit.where(\"user_id = ? AND step_id = ?\", current_user.id, @step.id).first\n edit.update_attributes(:started_editing_at => nil)\n if edit.project_id.blank?\n edit.update_attributes(:project_id => @project.id)\n end\n \n # check whether project is published\n if @project.public? || @project.privacy.blank?\n @project.set_published(current_user.id, @project.id, @step.id)\n end\n\n # check and set built attribute of project\n @project.set_built\n\n # create a public activity for any questions associated with the step if it doesn't already exist\n if @step.question && !PublicActivity::Activity.where(:trackable_type => \"Question\").where(:trackable_id => @step.question.id).exists?\n @step.question.create_activity :create, owner: current_user, primary: true\n end\n\n # create project on the village if the current user is a village user and the project doesn't already exist\n if @project.village_id.blank? && current_user.from_village? && !access_token.blank? && @project.public?\n create_village_project\n elsif !@project.village_id.blank? && !access_token.blank?\n update_village_project\n end\n\n format.html { \n redirect_to project_steps_path(@project), :notice => 'Step was successfully updated.', :flash => {:createdStep => @step.id} \n }\n format.json { head :no_content }\n else\n Rails.logger.info(@step.errors.inspect)\n format.html { render :action => \"edit\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n # ensure that the submitted parent_id actually exists\n if !Step.exists?(params[:step][:parent_id].to_i)\n logger.debug \"Step doesn't exist!\"\n if @project.steps.last\n params[:step][:parent_id] = @project.steps.last.id\n else\n params[:step][:parent_id] = nil\n end\n end\n\n if params[:step][:pin] && params[:step][:pin].empty?\n params[:step][:pin] = nil\n end\n\n @step = @project.steps.build(params[:step])\n authorize! :create, @step \n\n if params[:step][:position]\n @step.position = params[:step][:position]\n else\n @step.position = @numSteps\n end\n \n respond_to do |format|\n if @step.save\n\n # update corresponding collections\n @step.project.collections.each do |collection|\n collection.touch\n end\n \n # create an edit entry\n Edit.create(:user_id => current_user.id, :step_id => @step.id, :project_id => @project.id)\n\n # check whether project is published\n if @project.public? || @project.privacy.blank?\n @project.set_published(current_user.id, @project.id, @step.id)\n end\n\n @project.set_built\n\n # update the project updated_at date\n @project.touch\n\n # update the user last_updated_at date\n current_user.touch\n\n @step.update_attributes(:published_on => @step.created_at)\n\n # create a public activity for any added question\n if @step.question\n Rails.logger.debug(\"created new question\")\n @step.question.create_activity :create, owner: current_user, primary: true\n end\n\n # log the creation of a new step\n @project.delay.log\n\n format.html { \n\n # update all images with new step id\n new_step_images = @project.images.where(\"step_id = -1\")\n new_step_images.each do |image|\n image.update_attributes(:saved => true)\n image.update_attributes(:step_id => @step.id)\n end\n\n # update all videos with new step id\n new_step_videos = @project.videos.where(\"step_id = -1\")\n new_step_videos.each do |video|\n video.update_attributes(:saved=>true)\n video.update_attributes(:step_id=> @step.id)\n end\n\n # push project to village if it doesn't already exist\n if @project.village_id.blank? && current_user.from_village? && @project.public? && !access_token.blank?\n create_village_project\n elsif !@project.village_id.blank? && !access_token.blank?\n update_village_project\n end\n \n redirect_to project_steps_path(@project), :flash=>{:createdStep => @step.id}\n \n }\n \n format.json { render :json => @step }\n else\n Rails.logger.debug(@step.errors.inspect)\n format.html { render :action => \"new\" }\n format.json { render :json => @step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tc_detail_step = TcDetailStep.find(params[:id])\n\n respond_to do |format|\n if @tc_detail_step.update_attributes(params[:tc_detail_step])\n format.html { redirect_to @tc_detail_step, notice: 'Tc detail step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tc_detail_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @process_step.update(process_step_params)\n format.html { redirect_to @process_step, notice: 'Process step was successfully updated.' }\n format.json { render :show, status: :ok, location: @process_step }\n else\n format.html { render :edit }\n format.json { render json: @process_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step_command.update(step_command_params)\n format.html { redirect_to @step_command, notice: 'Step command was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_command }\n else\n format.html { render :edit }\n format.json { render json: @step_command.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @methodstep = Methodstep.find(params[:id])\n\n respond_to do |format|\n if @methodstep.update_attributes(params[:methodstep])\n flash[:notice] = 'Methodstep was successfully updated.'\n format.html { redirect_to(@methodstep) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @methodstep.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @stepsix = Stepsix.find(params[:id])\n\n respond_to do |format|\n if @stepsix.update_attributes(params[:stepsix])\n format.html { redirect_to(root_path, :notice => 'Stepsix was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stepsix.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @project_step = ProjectStep.find(params[:id])\n\n respond_to do |format|\n if @project_step.update_attributes(params[:project_step])\n flash[:notice] = 'ProjectStep was successfully updated.'\n format.html { redirect_to(@project_step) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project_step.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @roadmap = Roadmap.find(@roadmap_step.roadmap_id)\n\n respond_to do |format|\n if @roadmap_step.update(roadmap_step_params)\n format.html { redirect_to @roadmap, notice: 'Roadmap step was successfully updated.' }\n format.json { render :show, status: :ok, location: @roadmap_step }\n else\n format.html { render :edit }\n format.json { render json: @roadmap_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step_seven.update(step_seven_params)\n format.html { redirect_to @step_seven, notice: 'Step seven was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_seven }\n else\n format.html { render :edit }\n format.json { render json: @step_seven.errors, status: :unprocessable_entity }\n end\n end\n end", "def step_params\n params.require(:step).permit(:step_number, :points, :name, :quest_id, :answer, :body)\n end", "def set_goal_step\n @goal_step = GoalStep.find(params[:id])\n end", "def update\n respond_to do |format|\n if @work_step.update(work_step_params)\n format.html { redirect_to @work_plan, notice: 'Work step was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_plan }\n else\n format.html { render :edit }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n redirect_to wizard_path(steps[0])\n end", "def create\n @step = @task.steps.build(params[:step])\n\n if @step.save\n redirect_to [@task,@step]\n else\n render :action => \"new\"\n end\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 @track = Track.find(params[:id])\n\n unless (current_user?(@track.user) and !current_user.learns(@track))\n current_user.learn!(@track)\n\n @track.steps.each do |step|\n @subm = Submission.new(step_id: step.id, user_id: current_user.id, grade: 'not graded')\n @subm.save\n end\n\n end\n # redirect_to @track\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>\"step\"), notice: 'Use case was successfully updated.' }\n else\n format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_url }\n format.json { head :no_content }\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def update\n @stepnine = Stepnine.find(params[:id])\n\n respond_to do |format|\n if @stepnine.update_attributes(params[:stepnine])\n format.html { redirect_to(root_path, :notice => 'Stepnine was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stepnine.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @endpoint_info = args[:endpoint_info] if args.key?(:endpoint_info)\n @steps = args[:steps] if args.key?(:steps)\n end", "def step_params\n params.require(:step).permit(:recipe_id, :number, :description, :timer)\n end", "def set_stepone\n @stepone = Stepone.find(params[:id])\n end", "def destroy\n @step = @guide.steps.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to guide_steps_path(@guide) }\n format.json { head :no_content }\n end\n end", "def update\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n if @scenario.update_attributes(params[:scenario])\n format.html { redirect_to @scenario, notice: 'Scenario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @step_four.update(step_four_params)\n format.html { redirect_to @step_four, notice: 'Step four was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_four }\n else\n format.html { render :edit }\n format.json { render json: @step_four.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n @wizard = Wizard.find(params[:id])\n\n respond_to do |format|\n if @wizard.update_attributes(params[:wizard])\n format.html { redirect_to @wizard, notice: 'Wizard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wizard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.find(params[:recipe_id])\n @step = @recipe.steps.new(step_params)\n\n if @step.save\n redirect_to @recipe, notice: 'Step was successfully created.'\n else\n render :new\n end\n end", "def step_params\n params.require(:step).permit(\n :milestone_id, :reached_at, :notes\n )\n end", "def update\n if @scenario.update(scenario_params)\n \trender json: @scenario\n else\n \trender json: {status: 'ERROR', data: @scenario.errors}\n end\n end", "def set_next_step\n @next_step = NextStep.find(params[:id])\n end", "def update\n respond_to do |format|\n if @category_step.update(category_step_params)\n format.html { redirect_to @category_step, notice: 'Category step was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_step }\n else\n format.html { render :edit }\n format.json { render json: @category_step.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7260924", "0.7149206", "0.7111334", "0.7084085", "0.7009273", "0.69495946", "0.6942218", "0.69110596", "0.69110596", "0.68177384", "0.67457926", "0.6743555", "0.66804653", "0.6679542", "0.66236097", "0.6623572", "0.6582954", "0.6567151", "0.6558542", "0.6533719", "0.6530676", "0.6493745", "0.6454904", "0.64073306", "0.63740146", "0.63165", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63120455", "0.63071036", "0.62990177", "0.62673247", "0.6263786", "0.62429696", "0.6236642", "0.622649", "0.62217623", "0.6182253", "0.6176498", "0.6152411", "0.61420673", "0.61266845", "0.6085804", "0.60734844", "0.60653204", "0.6064361", "0.6053239", "0.6050743", "0.6044264", "0.60280144", "0.6021313", "0.5996078", "0.59958375", "0.5993054", "0.5987191", "0.59736776", "0.5952197", "0.5940161", "0.593621", "0.59177315", "0.5902725", "0.5902218", "0.59006083", "0.590046", "0.58885974", "0.5887771", "0.5886896", "0.58530766", "0.5826943", "0.58223236", "0.5821484", "0.5816858", "0.5815485", "0.58128005", "0.5801233", "0.580006", "0.57933635", "0.57820815", "0.57816327", "0.5778006", "0.5774144", "0.5769967", "0.5767791", "0.5754096", "0.57415164", "0.57359433", "0.57354146", "0.5734922", "0.5729666", "0.5720555", "0.5720423", "0.5707649", "0.57012826", "0.5681336" ]
0.711446
2
DELETE /steps/1 DELETE /steps/1.json
def destroy @step = Step.find(params[:id]) if @step.removable step_name = @step.name project = @step.projects.first @step.destroy ProjectMailer.notify_step_deleted(step_name, project, current_user).deliver respond_to do |format| format.html { redirect_to steps_url } format.json { render :json => {:message => "Success"} } end else respond_to do |format| format.html { redirect_to steps_url } format.json { render :json => "Step #{@step.name} is not removable", :status => :unprocessable_entity} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.status = \"deleted\"\n @step.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to quest_steps_url(@quest) }\n format.json { head :ok }\n end\n end", "def destroy\n @step = @guide.steps.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to guide_steps_path(@guide) }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to steps_url, notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @next_step = NextStep.find(params[:id])\n @next_step.destroy\n\n respond_to do |format|\n format.html { redirect_to next_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @step.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @tutorial, notice: 'Step was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to @task }\n format.json { head :no_content }\n end\n end", "def destroy\n @step2 = Step2.find(params[:id])\n @step2.destroy\n\n respond_to do |format|\n format.html { redirect_to step2s_url }\n format.json { head :ok }\n end\n end", "def delete_workflow_step(id)\n @client.raw('delete', \"/crm/steps/#{id}\")\n end", "def destroy\n @step_three.destroy\n respond_to do |format|\n format.html { redirect_to step_threes_url, notice: 'Step three was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end", "def destroy\n @lead_step = LeadStep.find(params[:id])\n @lead_step.destroy\n\n respond_to do |format|\n format.html { redirect_to lead_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @steps_log = StepsLog.find(params[:id])\n @steps_log.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to selection_path(params[:selection_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_scenario.destroy\n respond_to do |format|\n format.html { redirect_to step_scenarios_url, notice: 'Step scenario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_definition.destroy\n respond_to do |format|\n format.html { redirect_to step_definitions_url, notice: 'Step definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_type = StepType.find(params[:id])\n @step_type.destroy\n\n respond_to do |format|\n format.html { redirect_to step_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taken_step.destroy\n respond_to do |format|\n format.html { redirect_to taken_steps_url, notice: 'steps taken was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pre_step = PreStep.find(params[:id])\n @pre_step.destroy\n\n respond_to do |format|\n format.html { redirect_to pre_steps_url }\n format.json { head :ok }\n end\n end", "def delete_workflow_step(id)\n return @client.raw(\"delete\", \"/crm/steps/#{id}\")\n end", "def destroy\n @goal_step.destroy\n respond_to do |format|\n format.html { redirect_to goal_steps_url, notice: \"Goal step was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tc_detail_step = TcDetailStep.find(params[:id])\n @tc_detail_step.destroy\n\n respond_to do |format|\n format.html { redirect_to tc_detail_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n secureEnter @step\n @step.destroy\n respond_to do |format|\n format.html { redirect_to edit_post_path(@step.post.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_six.destroy\n respond_to do |format|\n format.html { redirect_to step_sixes_url, notice: 'Step six was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_step.destroy\n respond_to do |format|\n format.html { redirect_to user_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @next_step.destroy\n respond_to do |format|\n format.html { redirect_to next_steps_url, notice: 'Next step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step.destroy\n end", "def destroy\n @step.destroy\n end", "def destroy\n @id = @step.board_id\n @step.destroy\n respond_to do |format|\n format.html { redirect_to board_url(@id), notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stepone.destroy\n respond_to do |format|\n format.html { redirect_to mainpage_path(@stepone.mainpage), notice: 'Stepone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n authorize! :destroy, @step\n respond_to do |format|\n format.html { redirect_to(@tutorial) }\n format.xml { head :ok }\n end\n end", "def destroy\n @step_m.destroy\n respond_to do |format|\n format.html { redirect_to step_ms_url, notice: 'Step m was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @steplog.destroy\n respond_to do |format|\n format.html { redirect_to steplogs_url, notice: 'Steplog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_four.destroy\n respond_to do |format|\n format.html { redirect_to step_fours_url, notice: 'Step four was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n flash[:notice] = \"Successfully destroyed step.\"\n\n if(params[:test_case_id])\n @test_case = TestCase.find(params[:test_case_id])\n end\n @step = Step.new\n respond_with @step\n end", "def destroy\n @step_command.destroy\n respond_to do |format|\n format.html { redirect_to step_commands_url, notice: 'Step command was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_step = ProjectStep.find(params[:id])\n @project_step.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_steps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_seven.destroy\n respond_to do |format|\n format.html { redirect_to step_sevens_url, notice: 'Step seven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cooking_step.destroy\n respond_to do |format|\n format.html { redirect_to cooking_steps_url, notice: 'Cooking step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_step.destroy\n respond_to do |format|\n format.html { redirect_to project_steps_url, notice: 'Project step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @step2 = Proce.find(params[:id])\n @step2.destroy\n\n respond_to do |format|\n format.html { redirect_to(step2s_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end", "def destroy\n @book_step = BookStep.find(params[:id])\n @book_step.destroy\n\n respond_to do |format|\n format.html { redirect_to book_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @step_ingredient = StepIngredient.find(params[:id])\n @step_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to(step_ingredients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @process_step.destroy\n respond_to do |format|\n format.html { redirect_to process_steps_url, notice: 'Process step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @methodstep = Methodstep.find(params[:id])\n @methodstep.destroy\n\n respond_to do |format|\n format.html { redirect_to(methodsteps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @daily_step.destroy\n respond_to do |format|\n format.html { redirect_to daily_steps_url, notice: 'Daily step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stepnine = Stepnine.find(params[:id])\n @stepnine.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepnines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @active_workflow_step.destroy\n respond_to do |format|\n format.html { redirect_to active_workflow_steps_url, notice: 'Active workflow step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_step.destroy\n respond_to do |format|\n format.html { redirect_to category_steps_url, notice: 'Category step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def destroy\n @project_step_m.destroy\n respond_to do |format|\n format.html { redirect_to project_step_ms_url, notice: 'Project step m was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @scenario.destroy\n respond_to do |format|\n format.html { redirect_to scenarios_url, notice: 'Scenario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @step = Step.find(params[:step_id])\n authorize! :destroy, @step\n\n if @step.ancestry==\"0\" && @project.steps.where(:ancestry => @step.id.to_s).length > 1\n # can't delete root!\n respond_to do |format|\n format.html {\n flash[:error] = \"Can't delete the root of your project!\"\n redirect_to project_steps_url\n }\n end \n else\n if @step.ancestry == \"0\"\n @project.steps.where(\"id !=?\", @step.id.to_s).each do |step|\n if step.ancestry == @step.id.to_s\n step.update_attributes(:ancestry => \"0\")\n else\n step.update_attributes(:ancestry => step.ancestry.gsub(@step.id.to_s+\"/\", \"\"))\n end\n end\n end\n\n PublicActivity::Activity.where(:trackable_id => @step.id).destroy_all\n if @step.question\n PublicActivity::Activity.where(:trackable_id => @step.question.id).destroy_all\n end \n\n # destroy any news items associated with it\n News.where(:step_id => @step.id).each do |news_item|\n news_item.destroy\n end\n\n @step.destroy\n \n # update positions of subsequent steps\n if @step.position < @steps.count\n for step in @step.position+1..@steps.count\n if @steps.where(\"position\" => step).exists?\n @steps.where(\"position\" => step)[0].update_attribute(:position, step-1)\n end\n end\n end\n\n # check whether project is published\n if @project.public?\n @project.set_published(current_user.id, @project.id, nil)\n end\n\n # check and set built attribute of project\n @project.set_built\n\n @project.delay.log\n\n respond_to do |format|\n format.html { redirect_to project_steps_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wizard = Wizard.find(params[:id])\n @wizard.destroy\n\n respond_to do |format|\n format.html { redirect_to wizards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourth_scenario.destroy\n respond_to do |format|\n format.html { redirect_to fourth_scenarios_url, notice: 'Fourth scenario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @step_comment.destroy\n respond_to do |format|\n format.html { redirect_to step_comments_url, notice: 'Step comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario.destroy\n respond_to do |format|\n format.html { redirect_to scenarios_url, notice: 'Cenário deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wizard.destroy\n respond_to do |format|\n format.html { redirect_to wizards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_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 @level_goal = LevelGoal.find(params[:id])\n @level_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to level_goals_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n @go_slim_sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slim_sequences_url }\n format.json { head :no_content }\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 destroy\n story_part_id = @story_part.id\n @story_part.destroy\n render :json => story_part_id\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 delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n @exercise_instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to @exercise_instruction.exercise }\n format.json { head :no_content }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @second_scenario.destroy\n respond_to do |format|\n format.html { redirect_to second_scenarios_url, notice: 'Second scenario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wizard.destroy\n respond_to do |format|\n format.html { redirect_to house_wizards_path(@house), notice: 'Wizard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_flow = LabFlow.find(params[:id])\n @lab_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_flows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7910436", "0.78295755", "0.78116536", "0.7774464", "0.75964475", "0.7572063", "0.7572063", "0.7572063", "0.7572063", "0.742347", "0.74095196", "0.7402601", "0.7400754", "0.73675877", "0.7339873", "0.73136175", "0.73052126", "0.73025376", "0.7301966", "0.73009235", "0.728252", "0.7275749", "0.7233685", "0.7226625", "0.7225262", "0.7223025", "0.7219995", "0.7210809", "0.72035235", "0.7190595", "0.71644974", "0.71640867", "0.71376354", "0.71376354", "0.7136336", "0.7120084", "0.7094142", "0.7090143", "0.7070875", "0.7067714", "0.70634335", "0.706019", "0.70294553", "0.70199656", "0.6980445", "0.69582397", "0.69565696", "0.6947879", "0.6895283", "0.6895283", "0.68924934", "0.6884262", "0.6882513", "0.68593353", "0.6837853", "0.6830447", "0.6820749", "0.6735121", "0.66741455", "0.6643105", "0.6642436", "0.6600221", "0.65661687", "0.6564071", "0.65408486", "0.65299827", "0.65261614", "0.6516947", "0.6516947", "0.6516086", "0.65081567", "0.6500645", "0.6490229", "0.64862233", "0.64662933", "0.6462921", "0.644408", "0.6443559", "0.6443559", "0.6441871", "0.643724", "0.6437167", "0.64296806", "0.6423108", "0.6404059", "0.63907415", "0.63833666", "0.6364786", "0.6354129", "0.6351718", "0.63494366", "0.63452953", "0.63422525", "0.63417", "0.63380677", "0.63360554", "0.6334881", "0.6334881", "0.6334881", "0.6334881" ]
0.6692822
58
Use callbacks to share common setup or constraints between actions.
def set_customer_contact_person @customer_contact_person = CustomerContactPerson.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 set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def customer_contact_person_params params.require(:customer_contact_person).permit(:salutation, :first_name, :last_name, :department, :is_primary, :customer_company_id, :organization_id, contact_attributes: [:id, :email, :mobile, :fax, :is_primary], address_attributes: [:id, :address_line1,:address_line2, :city, :state, :country, :postal_code]) 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 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 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 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.7121862", "0.70524937", "0.6947974", "0.69016707", "0.6735245", "0.67157984", "0.66887176", "0.66779864", "0.6660236", "0.6554225", "0.6527208", "0.6456831", "0.6451704", "0.64509416", "0.64478475", "0.6432556", "0.6411603", "0.6411603", "0.6389978", "0.63789994", "0.63789994", "0.6374441", "0.6360967", "0.6352924", "0.6282896", "0.6279334", "0.6245072", "0.6227939", "0.6223777", "0.6222935", "0.6210708", "0.62064576", "0.6177963", "0.6171685", "0.61673856", "0.61590475", "0.6144345", "0.6135466", "0.61209214", "0.61075777", "0.6098469", "0.6075921", "0.60526955", "0.603815", "0.60347056", "0.60295635", "0.60174835", "0.6017036", "0.6015412", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60150516", "0.60045695", "0.60030454", "0.6000111", "0.59959006", "0.5994559", "0.5993364", "0.598529", "0.5982867", "0.59763765", "0.5974676", "0.596933", "0.5965601", "0.59644663", "0.59644663", "0.5956998", "0.59518063", "0.59499884", "0.5947578", "0.59442806", "0.59297687", "0.5929034", "0.59260684", "0.59240746", "0.5918179", "0.59177524", "0.5913775", "0.59130466", "0.59058845", "0.5904616", "0.5903243", "0.5902212", "0.58988374", "0.5897978", "0.58975065", "0.5894596" ]
0.0
-1
Get an object by an arbitary path. TODO: API endpoint does not play well with remote files
def get(path) path = "/#{path}" unless path[0] == '/' OneDriveItem.smart_new(self, request("drive/root:/#{url_path_encode(path[1..-1])}")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_for(path)\n # We do the traversal so that the user does not need to.\n path.split(\"/\").inject(self) {|tree, name|\n tree.objects.find {|obj| obj.name == name }\n }\n end", "def find_or_create_object_by_absolute_path(path, options = {})\n path = path.to_s\n options.to_options!\n head = options.has_key?(:head) ? options.delete(:head) : true\n object = nil\n objects(:prefix => path, :head => head).each do |candidate|\n break(object = candidate) if candidate.name == path\n end\n object ||= Object.new(bucket, path)\n end", "def get(path)\n self.class.get(path)\n end", "def perform_get_with_object(path, options, klass)\n perform_request_with_object(:get, path, options, klass)\n end", "def fetch(path = nil)\n to_ostruct(get(sanitize!(path)))\nend", "def by_path(path); end", "def get(path)\n path = \"/#{path}\" unless path[0] == '/'\n with_cache(:get, path) do\n OneDriveItem.smart_new(@od, @od.request(\"#{api_path}:/#{@od.url_path_encode(path[1..-1])}\"))\n end\n end", "def path_to_object(path)\n treeish = (@staging_index ? staging.sha : @current_branch)\n tree = self.tree(treeish, [path])\n return tree.blobs.first if tree && (not tree.blobs.empty?)\n return tree.trees.first if tree && (not tree.trees.empty?)\n\n # check staging index in case object has not been written to object DB\n staging? ? staging.path_to_object(path) : nil\n end", "def perform_get_with_objects(path, options, klass)\n perform_request_with_objects(:get, path, options, klass)\n end", "def get(path)\n # build full URL\n url = API_URL % [path]\n\n # log full URL\n @ctx.log.debug('BaseObject#get') { '%s' % [url] }\n\n # get URL from cache\n @ctx.cache.get(url)\n end", "def get_with_path(path)\n get(*key_paths(path))\n end", "def get(path)\n object = bucket.objects.find(path)\n tempfile = Tempfile.new\n tempfile.write(object.content)\n tempfile.rewind\n tempfile\n end", "def find_file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def get_job_by_object_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Job.new(obj.Get(Job::INTERFACE, 'Id').first, self)\n end", "def find_object(path)\n path_array = path.split(/\\//)\n n = CGI::unescape(path_array.shift)\n #puts \"looking for #{n} #{path} #{path_array.inspect}\"\n \n children.each do |c|\n # look for an object with named by n\n if c.name == n\n return c if path_array.empty?\n return c.find_object(path_array.join('/'))\n end\n end\n return nil\n end", "def aget(path)\n _aget(path, @contents)\n end", "def get_object!(bucket_name, key, **opts)\n bucket = get_bucket!(bucket_name, **opts)\n obj = bucket.file(key)\n return obj if obj\n raise ObjectNotFoundError.new(\n \"Object \\\"#{key}\\\" not found in bucket \\\"#{bucket.name}\\\"\"\n )\n end", "def get(path, **args); end", "def get(local_path, s3_path, bucket)\n client.get_object(\n response_target: local_path,\n bucket: bucket,\n key: s3_path)\n end", "def find(options = {})\n get_path(\n path_to_find,\n options,\n get_parser(:object, Tinybucket::Model::Repository)\n )\n end", "def get_object(o)\n p = URI.unescape(URI(o.split(\" \")[1]).path)\n return File.join('./',p) # join on the current directory\nend", "def fetch(path)\n resource = Resource.new(@access_token, path.to_s)\n\n if resource.data && resource.data.is_a?(Array)\n Collection.new(@access_token, resource.data)\n else\n Node.new(@access_token, resource)\n end\n end", "def fetch_path(path=\"\")\n read_data(@uri + path)\n end", "def get_by_objectpath objpath\n STDERR.puts \"#{self.class}.get_by_objectpath #{objpath}\" if Wbem.debug\n @client.get_instance(objpath)\n end", "def load_resource(path, args=nil)\n service.get(path, args)\n end", "def find_object\n url = get_object_url()\n\n response = self.send_request('HEAD', url)\n\n case response.code\n when '404'\n return\n when '200'\n response = self.send_request('GET', url)\n @obj = JSON.parse(response.body)['_source']\n else\n fail(\"Fail to retrieve object '%s' (HTTP response: %s/%s)\" %\n [url, response.code, response.body])\n end\n end", "def lookup_by_path(path, opts = T.unsafe(nil)); end", "def get(path)\n command(\"get #{escape(path)}\")\n end", "def get(path)\n return @contents if path.nil?\n aget(path.split(':'))\n end", "def find(path, id, params = {})\n response = get(\"/#{path.to_s.pluralize}/#{id}\", params)\n trello_class = class_from_path(path)\n trello_class.parse response do |data|\n data.client = self\n end\n end", "def object\n obj = get_result('object')\n if obj != nil\n return obj\n end\n fs = files\n if fs != nil and fs.length > 0\n return fs[0]\n end\n nil\n end", "def find_by(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n moab_path = find_moab_filepath(storage_object_id, path, file_category)\n\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(moab_path, 'rb'))\n rescue ::Moab::FileNotFoundException\n raise Valkyrie::StorageAdapter::FileNotFound\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def get(path, params = {})\n path = File.join(@prefix, path)\n JSON.parse @conn.get(path, params).body\n end", "def resource(path, params={})\n r = Resource.process_detailed(self, *do_get(path, params))\n\n # note that process_detailed will make a best-effort to return an already\n # detailed resource or array of detailed resources but there may still be\n # legacy cases where #show is still needed. calling #show on an already\n # detailed resource is a no-op.\n r.respond_to?(:show) ? r.show : r\n end", "def get_unit_by_object_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Unit.new(obj.Get(Unit::INTERFACE, 'Id').first, self)\n end", "def loadRepositoryObject(path)\n #puts \"loadRepositoryObject :: #{path}\"\n if File.exist?(\"#{path}.obj\")\n loadeOb = File.open(\"#{path}.obj\").read\n repObj = YAML::load(loadeOb)\n return repObj\n else\n return nil\n end\n end", "def perform_get_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:get, path, options, klass, collection_name)\n end", "def get_entity(path)\n c_path = path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path)\n http_get(\"path#{c_path}\")\n end", "def get_one(*path, query: nil, api_v1: true)\n url = encode_url(path: path, query: query, api_v1: api_v1)\n faraday_safe(:get, url).body\n end", "def open(path, encoding: self.encoding, tempdir: nil, **opts, &block)\n path = full_path(path)\n temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding)\n temp.close\n\n opts = opts.merge(\n response_target: temp.path,\n bucket: name,\n key: path,\n )\n @client.get_object(**opts)\n\n File.open(temp.path, encoding: encoding, &block)\n rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket, Aws::S3::Errors::NotFound\n raise BFS::FileNotFound, trim_prefix(path)\n end", "def from_path(path); end", "def get_object(type, id)\n raise ArgumentError.new(\"type needs to be one of 'node', 'way', and 'relation'\") unless type =~ /^(node|way|relation)$/\n raise TypeError.new('id needs to be a positive integer') unless(id.kind_of?(Fixnum) && id > 0)\n response = get(\"#{type}/#{id}\")\n check_response_codes(response)\n parser = OSM::StreamParser.new(:string => response.body, :callbacks => OSM::ObjectListCallbacks.new)\n list = parser.parse\n raise APITooManyObjects if list.size > 1\n list[0]\n end", "def fetch_path(path=\"\")\n @fetcher.fetch_path(path)\n end", "def get(path, busca=nil)\n @client.get(path, busca)\n end", "def object(name)\n @bucket.object(@root_path + name)\n end", "def get(id, file = nil, options = {})\n start_time = Time.now\n logger.debug(\"getting '#{id}' start: #{start_time}\")\n\n if file\n get_file(id, file)\n file.flush\n else\n result = nil\n temp_path do |path|\n File.open(path, 'w') { |f| get_file(id, f) }\n result = File.open(path, 'r') { |f| f.read }\n end\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n result\n end\n rescue BlobstoreError => e\n raise e\n rescue Exception => e\n raise BlobstoreError,\n sprintf('Failed to fetch object, underlying error: %s %s', e.inspect, e.backtrace.join(\"\\n\"))\n ensure\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n end", "def find(path)\n path = full_path(path)\n page_blob = find_blob(path)\n raise MissingResource unless page_blob\n new(page_blob, path)\n end", "def scene_object_for_path( path )\n if @scene_root.nil?\n lp \"Unable to fetch '#{path}' while @scene_root is still nil.\",\n force_color: red\n return nil\n end\n\n case path\n when @scene_root.name\n @scene_root\n when ':body'\n @story_bundle.document.body\n else\n escaped_path = path.gsub(/[\\[\\]]/){ |c| \"\\\\#{c}\" }\n @scene_root.childNodeWithName(escaped_path)\n end\n end", "def api(path)\n OodAppkit.files.api(path: path).to_s\n end", "def get_transfer_by_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Transfer.new(obj.Get(Transfer::INTERFACE, 'Id').first, self)\n end", "def parse_object(path_id)\n if path_id.class == Integer\n obj = @objects.find{|e| e.path_id == path_id}\n return nil unless obj\n elsif path_id.class == ObjectData\n obj = path_id\n else\n return nil\n end\n\n klass = (obj.class_idx ? @klasses[obj.class_idx] : @klasses.find{|e| e.class_id == obj.class_id} || @klasses.find{|e| e.class_id == obj.type_id})\n type_tree = Asset.parse_type_tree(klass)\n return nil unless type_tree\n\n parse_object_private(BinaryReader.new(obj.data, @endian), type_tree)\n end", "def fetch_file(file_path)\n client.get_file(file_path)\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def get(path, params = {})\n @connection.get(path, params)\n end", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def get\n File.read(path)\n end", "def get_file(path)\n raise FileNotFoundError.new(path) unless @files[path]\n \n return Chance.get_file(@files[path])\n end", "def get(path, options = {})\n connection.get(path, options)\n end", "def findMappedResource(resources)\n obj=nil\n resources.each { |uri|\n if uri\n case uri.scheme\n when \"file\"\n file=uri.path\n if File.exists?(file)\n obj=File.open(file)\n end\n when \"http\"\n resp=Net::HTTP.get_response(uri)\n obj=resp.body if resp.code==\"200\"\n end\n if obj\n print \"found mapped resource #{uri}\\n\"\n break\n end\n end\n }\n obj\nend", "def retrieve!(file_identifier)\n client.object(file_identifier)\n end", "def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end", "def getObject(object)\n\t\t\turi = parseURI(object)\n\t\t\tresponse = do_get(uri)\n\t\t\treturn nil if response == nil\n\t\t\treturn response\n\t\tend", "def get(*path, auto_paginate: false, query: nil, api_v1: true)\n get_method = auto_paginate ? :get_all : :get_one\n send(get_method, path, query: query, api_v1: api_v1)\n end", "def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend", "def get(path_or_id, *args)\n if path_or_id.is_a?(String)\n get_by_path(path_or_id)\n else\n super\n end\n end", "def object!\n connection.get(\"/#{URI.escape(@key)}\", @bucket_name)\n end", "def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end", "def get_file(path)\n if not @files[path]\n file_not_found(path)\n end\n \n return Chance.get_file(@files[path])\n end", "def find_resource\n get params[:resource_path]\n end", "def get(path)\n key, subkeys = split_path(path)\n if subkeys.any?\n if self[key].is_a?(Droom::LazyHash)\n self[key].get(subkeys)\n else\n nil\n end\n elsif self.key?(key)\n self[key]\n else\n nil\n end\n end", "def [](path)\n result = if path.is_a? Hash\n if path[:file]\n file(path[:file])\n elsif path[:dir]\n directory(path[:dir])\n elsif path[:directory]\n directory(path[:directory])\n elsif path[:symbolic_link]\n symbolic_link(path[:symbolic_link])\n elsif path[:character_device]\n character_device(path[:character_device])\n elsif path[:block_device]\n block_device(path[:block_device])\n elsif path[:object]\n object(path[:object])\n else\n raise UnknownResourceType, path.keys.first\n end\n else\n build(path)\n end\n\n result.add_observer(self)\n\n result\n end", "def multi_from_path(path)\n without_slash = path.gsub(/^\\//, \"\")\n request_object(:get, \"/api/multi/\" + without_slash)\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def get(path, options = nil)\n add(path, options).get\n end", "def resource_for_path(path, options = {}, debug = true)\n RestClient.log = Logger.new(STDOUT) if debug\n RestClient.proxy = credentials[:proxy] if credentials[:proxy]\n url = ['https://', credentials[:domain], path].join\n RestClient::Resource.new url, options.merge(default_options)\n end", "def find(path, type, setting); end", "def get(path, params={})\n request(:get, params.merge(:path => path))\n end", "def get(path, params = {})\n execute :get, path, params\n end", "def object_path(id)\n \"#{path}/objects/#{id[0...2]}/#{id[2..39]}\"\n end", "def get(path)\n # TODO: do more hardening on the path\n if path.include?('covid19')\n request = Net::HTTP::Get.new(path, @headers)\n else\n request = Net::HTTP::Get.new('/v2' + path, @headers)\n end\n send_request(request)\n end", "def get(path)\n request(:get, path, {})\n end", "def get(path)\n connection.get do |req|\n req.url path\n end.body\n end", "def parse_object_simple(path_id)\n Asset.object_simplify(parse_object(path_id))\n end", "def get(path, **options)\n execute :get, path, options\n end", "def get(path)\n response = Excon.get(\n 'https://' + @host + '/' + path + '.json?print=pretty',\n headers: {\n 'x-rapidapi-host' => @host,\n 'x-rapidapi-key' => @key,\n }\n )\n\n return false if response.status != 200\n\n JSON.parse(response.body)\n end", "def fetch!\n old_path = path\n if old_path && path.length > 0\n path = \"\"\n @results = get(old_path, @options)\n end\n end", "def object(object_id, opts = {})\n response = fetch_object(Array(object_id).join(':'), opts)\n response.body\n end", "def url_object(code)\n @code_bucket.get(code, :r => 1)\n rescue Riak::FailedRequest => err\n raise unless err.not_found?\n end", "def try_load_object(name, cache_path); end", "def find(path); end", "def find(path); end", "def get_file(path)\n uri = URI.join('https://stellar.mit.edu', path)\n @mech.get_file uri\n end", "def get(path, params)\n parse_response @client[path].get(:params => params)\n end", "def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end", "def get(path)\n request 'GET', path\n end", "def find_by(id:)\n return unless handles?(id: id)\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(file_path(id), 'rb'))\n end", "def find_object(name)\n @search_paths.unshift(@cache[name]) if @cache[name]\n @search_paths.unshift(Registry.yardoc_file)\n\n # Try to load it from in memory cache\n log.debug \"Searching for #{name} in memory\"\n obj = try_load_object(name, nil)\n return obj if obj\n\n log.debug \"Searching for #{name} in search paths\"\n @search_paths.each do |path|\n next unless File.exist?(path)\n log.debug \"Searching for #{name} in #{path}...\"\n Registry.load(path)\n obj = try_load_object(name, path)\n return obj if obj\n end\n nil\n end", "def s3_object(path)\n @task.s3_object(\"asgroup/#{@name}/#{path}\")\n end", "def get_entry(path, commit = @commit)\n entry_hash = get_entry_hash(path, commit)\n if entry_hash.nil?\n entry = nil\n else\n entry = @repo.lookup(entry_hash[:oid])\n end\n entry\n end" ]
[ "0.7028362", "0.6849722", "0.66434616", "0.66336113", "0.6619283", "0.65754616", "0.657161", "0.65404594", "0.64244896", "0.6402493", "0.63924587", "0.639222", "0.6360519", "0.6336129", "0.63170284", "0.6294444", "0.62215006", "0.62136877", "0.618642", "0.6165287", "0.6122037", "0.61219305", "0.6115517", "0.6108826", "0.61080784", "0.60851264", "0.6083471", "0.6055487", "0.6040356", "0.60263664", "0.6013924", "0.6009843", "0.5985896", "0.5959771", "0.59315777", "0.5926144", "0.5914038", "0.5904196", "0.5900051", "0.5894473", "0.58848894", "0.5874882", "0.5860573", "0.5858636", "0.5852918", "0.58151346", "0.5789293", "0.57865125", "0.5784904", "0.577905", "0.5767186", "0.5763142", "0.57606393", "0.57554156", "0.574742", "0.57441825", "0.57268953", "0.5725112", "0.57185966", "0.57149607", "0.5706832", "0.5705394", "0.57006747", "0.5693511", "0.5691474", "0.5691362", "0.56859976", "0.5677728", "0.5674184", "0.56649345", "0.56646353", "0.5661883", "0.56531185", "0.56464267", "0.5645195", "0.56427526", "0.5641415", "0.5636779", "0.5620957", "0.5615431", "0.5609582", "0.56080526", "0.5601472", "0.5599741", "0.55956066", "0.5583599", "0.5581425", "0.55805", "0.5579108", "0.5573637", "0.55597395", "0.55597395", "0.5553756", "0.55498564", "0.5545953", "0.5543423", "0.5543236", "0.55377495", "0.55361956", "0.5529459" ]
0.6003975
32
Responds to slash commands
def index info = ScheduleProcessor.headway_info query = params[:text] workspace = params[:enterprise_name] || params[:team_domain] user_id = params[:user_id] if query == 'help' result = help_response(info[:routes]) elsif (data = info[:routes].find { |r| r[:id] == query}) track_event('slash', "route/#{query}", user_id, workspace) result = route_response(data) elsif query == 'delays' track_event('slash', 'delays', user_id, workspace) result = delays_response(info[:routes]) else track_event('slash', 'default', user_id, workspace) result = default_response(info) end render json: result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_command(command)\n cmd = command.command\n return Response.new unless cmd\n if cmd.start_with?(\"'\")\n cmd = \"say \" + cmd[1, cmd.length-1]\n end\n if cmd.start_with?('say ')\n command.say = cmd[4, cmd.length-4].strip\n end\n command.command = cmd.downcase\n\n handlers = find_handlers(command.body)\n response = Response.new\n response.command = command.command\n handlers.each { |h|\n h.handle(response, command)\n if response.handled; return response end\n }\n if !response.handled && response.direction\n response.message = \"You can't go that way.\"\n response.handled = true\n end\n response\n end", "def command\n wall = Wall.find_by(path: params[:path])\n cmd = params[:wall][:command]\n ce = CommandExecutor.new(wall: wall, command: cmd)\n\n result = ce.run!\n\n respond_to do |format|\n if result[:success]\n flash[:notice] = 'Command Successful'\n format.html { redirect_to wall_path wall }\n format.json { render json: result, status: 200 }\n else\n flash[:notice] = 'Command Failed'\n format.html { redirect_to wall_path wall }\n format.json { render json: result, status: 406 }\n end\n end\n end", "def command_uri\n return \"/api_#{@command_name}.php\"\n end", "def command \n logger.debug \"Command: #{params[:Command]}\"\n if params[:Command] == 'GetFoldersAndFiles' || params[:Command] == 'GetFolders'\n get_folders_and_files\n elsif params[:Command] == 'CreateFolder'\n create_folder\n elsif params[:Command] == 'FileUpload'\n upload_file\n end\n \n render :inline => RXML, :type => :rxml unless params[:Command] == 'FileUpload'\n end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def commands; end", "def slash!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = SLASH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 172:9: '/'\n match( 0x2f )\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__, 37 )\n\n end", "def commands\n\t\t{ }\n\tend", "def run_respond(aCommand)\n\t\trun(aCommand) do |ch,stream,text|\n\t\t\tch[:state] ||= { :channel => ch }\n\t\t\toutput = yield(text,stream,ch[:state])\n\t\t\tch.send_data(output) if output\n\t\tend\n\tend", "def run_respond(aCommand)\n run(aCommand) do |ch,stream,text|\n \tch[:state] ||= { :channel => ch }\n \toutput = yield(text,stream,ch[:state])\n \tch.send_data(output) if output\n end\nend", "def subcommands() __subcommands__ end", "def route\n #TODO\n end", "def handle_commands(command) # rubocop:todo Metrics/CyclomaticComplexity\n case command\n when '/start'\n greet_user\n when '/stop'\n send_message \"Bye, #{message.from.first_name}\"\n when '/help'\n send_message \"Please enter any of the following commands: #{@commands}\"\n when '/news'\n handle_news\n when '/subscribe'\n handle_subscribe command\n when '/update'\n handle_update\n when '/add_birthday'\n @name = message.text if @name_set and @name.empty?\n prompt_user command\n when '/add_my_birthday'\n prompt_user command\n when '/add_anniversary'\n @name = message.text if @name_set and @name.empty?\n prompt_user command\n\n end\n end", "def run()\n command = \"%s %s\" % [:api, raw]\n Log.debug \"saying #{command}\"\n @fs_socket.say(command)\n end", "def commands\n {\n }\n end", "def redirect(command)\n ROCKET.parse_command(current_user, command)\n end", "def call_command\n verb = match.captures[match.names.index('command')]\n verb = normalize_command_string(verb)\n public_send(verb)\n end", "def on_request_uri(cli, request)\r\n random_content = '<html><head></head><body><p>'+Rex::Text.rand_text_alphanumeric(20)+'<p></body></html>'\r\n send_response(cli, random_content)\r\n\r\n @received_request = true\r\n end", "def respond(); end", "def music_cmd\n\n # The command 'refresh' does not execute any command: It only refresh\n # the player state on the view\n if params[:cmd] != 'refresh'\n\n # Execute the command\n result = execute_music_cmd_from_parms\n\n # Feedback the user?\n if result && ( result.status == :error || result.info )\n @toast = result\n end\n\n # Refresh the production queue?\n if params[:cmd] == 'remove_queue_songs'\n @refresh_queue = true\n end\n\n end\n\n # Render the response\n respond_to do |format|\n format.html { render_index }\n format.js do\n load_player_state\n load_reproduction_queue if @refresh_queue\n end\n end\n\n end", "def subcommands!() __subcommands__! end", "def commands\n abstract!\n end", "def script\n # escape command parameter\n params[:command] = params[:command].gsub('..', '').gsub(';', '');\n\n ret = @uri.script(params[:command].split(',')[0], params[:command].split(',')[1])\n render plain: ret[:message], status: ret[:status]\n end", "def handle(request)\n # Parse first 4 characters for protocol function\n cmd = request[0..3].strip.upcase\n # Remaining data is request arguments\n args = request[4..-1].strip\n\n case cmd\n when 'USER' # Incoming username information for login\n return \"You are logged in as #{args}.\"\n when 'INFO' # Server identifcation\n return \"Choder React Server 0.1a\"\n when 'WHO' # List all users online\n puts clients\n return clients.to_s\n when 'FIND' # Check if user is online\n return \"Not yet implemented.\"\n when 'MSG' # Send message to user\n return \"Not yet implemented.\"\n when 'ECHO' # Send message to server\n puts args\n return \"Server echo'd: #{args}\"\n when 'PORT' # Establish a dynamic range data port\n pieces = args.split(',')\n address = pieces[0..3].join('.')\n port = Integer(pieces[4]) * 256 + Integer(pieces[5])\n @data_socket = TCPSocket.new(address, port)\n return \"Data connection established on port #{port}.\"\n when 'LIST' # List available files on server\n connection.respond \"Available files on this server: \"\n file_list = Dir.entries(Dir.pwd).join(CRLF)\n @data_socket.write(file_list)\n @data_socket.close\n return \"End file list.\"\n when 'FILE' # Request file from server\n if File.file?(Dir.pwd + args) # Check if the target exists and is a file\n file = File.open(File.join(Dir.pwd, args), 'r')\n connection.respond \"Opening data stream, sending #{file.size} bytes.\"\n bytes = IO.copy_stream(file, @data_socket)\n @data_socket.close\n return \"Closing data stream, sent #{bytes} bytes.\"\n else\n return \"Unable to locate requested file: #{args}\"\n end\n else\n return \"Unrecognized command: #{cmd}.\"\n end # case\n end", "def command_pwd\n # Respond with absolute path for this client\n puts \"Sending #{@directory.path}\"\n @client.puts @directory.path\n end", "def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end", "def shell_api; end", "def command(node, opts = {}, &blk) \n route(:command, {:node => node, :opts => opts, :blk => blk}) \n end", "def respond\n end", "def on_request_uri(cli, request)\n\t\t@host = cli.peerhost\n\n\t\t# Reply with JavaScript Source if *.js is requested\n\t\tif request.uri =~ /\\.js/\n\t\t\tcontent_type = \"text/plain\"\n\t\t\tcontent = keylogger\n\t\t\tsend_response(cli, content, {'Content-Type'=> content_type})\n\t\t\trequest_timestamp(cli,request)\n\n\t\t# JavaScript XML HTTP GET Request is used for sending the keystrokes over network.\n\t\telsif request.uri =~ /#{@random_text}/\n\t\t\tcontent_type = \"text/plain\"\n\t\t\tsend_response(cli, @random_text, {'Content-Type'=> content_type})\n\t\t\tlog = request.uri.split(\"&\")[1]\n\t\t\thex_to_s(log)\n\t\t\t@loot << \"#{cli.peerhost} - #{current_time} - \" + @ascii_log + \"\\n\"\n\t\t\tif log.length > 1\n\t\t\t\tprint_good(\"#{cli.peerhost} - #{current_time} - [KEYLOG] - #{@ascii_log}\")\n\t\t\tend\n\n\t\t# Reply with Metasploit Shield Favicon\n\t\telsif request.uri =~ /favicon\\.ico/\n\t\t\tcontent = favicon\n\t\t\tcontent_type = \"image/icon\"\n\t\t\t\tsend_response(cli, content, {'Content-Type'=> content_type})\n\t\t\trequest_timestamp(cli,request)\n\n\t\t# Reply with Demo Page\n\t\telsif request.uri =~ /metasploit/ and datastore['DEMO']\n\t\t\tcontent = demo\n\t\t\tcontent_type = \"text/html\"\n\t\t\t\tsend_response(cli, content, {'Content-Type'=> content_type})\n\t\t\trequest_timestamp(cli,request)\n\t\telse\n\t\t\t# Reply with 404 - Content Not Found\n\t\t\tcontent = \"Error 404 (Not Found)!\"\n\t\t\tsend_response(cli, \"<html><title>#{content}</title><h1>#{content}</h1></html>\", {'Content-Type' => 'text/html'})\n\t\tend\n\tend", "def initialize(*command_path) \n @command = command_path.collect { |part| \"#{part}\".gsub('_', '-') }.join('/')\n @command = \"/#{@command}\" unless @command.start_with?('/')\n @options = {}\n @replies = []\n end", "def process(channel, message)\n\n debug_me{[ :channel, :message ]}\n\n\n if message[:payload].start_with?(\"/\")\n parts = message[:payload].split(' ')\n method_name = parts.shift()[1..]\n params = parts.join(' ')\n\n if respond_to?(method_name)\n send(method_name, params)\n else\n puts \"Unknown command: #{command}\"\n end\n\n return true\n else\n username = message[:headers][\"username\"]\n @users << username unless @users.include?(username)\n \n show(channel, username, message[:payload])\n\n return false\n end\n end", "def list\n get('/')\n end", "def respond msg\n say \"Override #{self.class.name}.respond to have your bot do something.\"\n nil\n end", "def doCommand(command, sender)\n if (command =~ /^homepage/) then\n recipients = [Jabber::JID.new(\"example@example.com\")]\n # any response should be an array of strings (in case of multiline response), can optionally also include an array of recipient JIDs\n return broadcastHomepageBuild(command), recipients\n end \n end", "def command\n raise NotImplementedError\n end", "def handle\n respond\n nil\n end", "def command\n fail 'Not implemented.'\n end", "def subcommands(cmd); end", "def subcommands(cmd); end", "def drush\n ret = @uri.drush params[:command]\n render plain: ret[:message], status: ret[:status]\n end", "def run(command={})\n # parse the query to see what we're doing\n begin\n raise RuntimeError, 400 unless command.is_a?(Hash) and command.has_key? 'path'\n result, code = command['path'][1]\n external = command['path'][1][1..-1]\n begin\n #lazily load the plugin.\n require \"#{File.dirname(__FILE__)}/external/#{external}.rb\"\n External.handle command\n rescue LoadError => e\n $stderr.puts \"#{e.class}: No such external handler for #{external}\"\n end\n rescue => e\n #$error.puts e.message if @debug\n if e.message.is_a?(Fixnum) then\n {:code => e.message, :body => e.class}\n end\n end\n {:code => code || 200, :json => result}\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def GET; end", "def reply\n end", "def tagged_response(cmd, *args)\n # We put in an otherwise unnecessary transform to hide the listen\n # method from callers for consistency with other types of responses.\n send_command(cmd, *args)\n end", "def route_command(message_body)\n route(\"#{robot.mention_name} #{message_body}\")\n end", "def show\n respond_to do |format|\n if @command.present?\n format.json { render json: @command }\n else\n msg = { :status => 'error', message: 'Records Not Found'}\n format.json { render json: msg }\n end\n end\n end", "def rest_end_point; end", "def invoke_command\n params[:sessionid] ||= Xmpp::IdGenerator.generate_id\n invoke_command_on_route do\n define_meta_class_method(:request, &route[:blk])\n define_meta_class_method(:request_handler) do \n run_command(request) \n end\n define_meta_class_method(:request_callback) do |*resp|\n resp = resp.length.eql?(1) ? resp.first : resp \n add_payload_to_container(resp)\n end\n process_request\n end\n end", "def endpoint\n\t\t\t\t@command.endpoint\n\t\t\tend", "def set_commands; end", "def shell_commands(cmd, args); end", "def supercommand!() __supercommand__ end", "def handle(args)\n options = self.getDefaultOptions()\n subcommandHandlerFactory = SubcommandHandlerFactory.new\n\n # Rememmber that ARGV does not include the program name ($0) in Ruby.\n # This is like Java; unlike Python and C/C++/Go.\n loop do\n break if args.length == 0\n break unless args[0][0] == '-'\n option = args.shift\n\n if option == '-h'\n self.usage(0)\n elsif option == '--help'\n self.usage(0)\n elsif option == '-l' || option == '--list-verbs'\n SubcommandHandlerFactory.listVerbs()\n exit(0)\n\n elsif option == '-v' || option == '--verbose'\n options['verbose'] = true\n elsif option == '-q' || option == '--quiet'\n options['verbose'] = false\n elsif option == '-s' || option == '--show-urls'\n options['showURLs'] = true\n\n elsif option == '-a' || option == '--app-token-env-name'\n self.usage(1) unless args.length >= 1\n options['accessTokenEnvName'] = args.shift\n elsif option == '-b' || option == '--base-te-url'\n self.usage(1) unless args.length >= 1\n options['baseTEURL'] = args.shift\n\n else\n $stderr.puts \"#{$0}: unrecognized option #{option}\"\n exit 1\n end\n end\n\n if args.length < 1\n self.usage(1)\n end\n verbName = args.shift\n verbArgs = args\n\n # Endpoint setup common to all verbs\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n baseTEURL = options['baseTEURL']\n unless baseTEURL.nil?\n ThreatExchange::TENet::setTEBaseURL(baseTEURL)\n end\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n\n subcommandHandler = subcommandHandlerFactory.create(verbName)\n\n if subcommandHandler.nil?\n $stderr.puts \"#{$0}: unrecognized verb \\\"#{verbName}\\\"\"\n exit 1\n end\n\n subcommandHandler.handle(args, options)\n\n end", "def nav(commands:)\n commands.each do |command|\n if @commands.has_key?(command)\n conn = multipart_connection(port: 8060)\n\n path = \"/keypress/#{@commands[command]}\"\n @logger.debug(\"Send Command: \"+path)\n response = conn.post path\n return false unless response.success?\n else\n return false\n end\n end\n return true\n end", "def command(type)\n end", "def helpCommand \n @SocketHandle.puts \"Commands are:\"\n @SocketHandle.puts \" viewall\"\n @SocketHandle.puts \" bookevent\"\n end", "def handler; end", "def handler; end", "def command *args, &block\n bind :PRESS, *args, &block\n end", "def command_found; end", "def shell_commands(cmd, *args); end", "def router; end", "def route_get_slash\n erb :index, {layout: :application}\nend", "def index\n @commands = Command.all\n render :json => @commands\n end", "def route(command)\n if command.count(\" \") == 2\n @code_writer.send(command.split(' ')[1], command.split(' '))\n else\n @code_writer.send(command)\n end\n end", "def redirect path \n full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path\n res = Rack::Response.new\n res.redirect(full)\n res.finish\n\n #$Utter.map(full) do\n #\tputs \"Redirect: #{full}\"\n #\trun lambda { |env| [200, {\"Content-Type\" => \"application/json\"}, [$Utter.instance_exec(&block)]] }\n #end\n end", "def update\n respond_to do |format|\n if @command.update(command_params)\n format.json { render :json => @command }\n else\n format.json { render json: @command.errors, status: 401 }\n end\n end\n end", "def command\n content = { id: params[:id], instruction: params[:instruction] }\n ActionCable.server.broadcast 'bingo', content: content\n\n respond_to do |format|\n format.json { render json: content, callback: params[:callback] }\n format.html { render :call }\n end\n end", "def root\n get '/'\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def shell(*) end", "def uri\n sprintf(\"%s/%s?token=%s\", API_ENDPOINT, COMMAND, config.slack_bot_token)\n end" ]
[ "0.64246076", "0.63354075", "0.62353563", "0.5973118", "0.59046525", "0.59046525", "0.59046525", "0.59046525", "0.59046525", "0.59046525", "0.58602", "0.57472044", "0.5744415", "0.5704116", "0.56972784", "0.56835073", "0.5674806", "0.564908", "0.5629635", "0.5621588", "0.5593898", "0.5582299", "0.5514173", "0.55132586", "0.5491634", "0.5491585", "0.5483642", "0.54464334", "0.54395896", "0.5433099", "0.54203004", "0.54057306", "0.5395179", "0.53743154", "0.5370596", "0.5349092", "0.5332228", "0.53179985", "0.5311567", "0.53095406", "0.5299672", "0.52980274", "0.527815", "0.5276191", "0.5276191", "0.5271593", "0.5265425", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5260499", "0.5248571", "0.52481127", "0.52398443", "0.5229937", "0.522142", "0.52134985", "0.52102226", "0.5207375", "0.5205953", "0.51982266", "0.5188289", "0.51799643", "0.51781654", "0.51774585", "0.51718163", "0.5168568", "0.5168568", "0.5163923", "0.51604074", "0.5156154", "0.5151507", "0.51444155", "0.51410955", "0.51201475", "0.5116305", "0.5115529", "0.51149887", "0.51122326", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.51072246", "0.5106", "0.51053715" ]
0.0
-1
Responds to select interactive components
def query payload = JSON.parse(params[:payload]).with_indifferent_access info = ScheduleProcessor.headway_info uri = URI(payload[:response_url]) workspace = payload.dig(:enterprise)&.dig(:name) || payload.dig(:team)&.dig(:domain) user_id = payload.dig(:user)&.dig(:id) if payload[:actions].first[:action_id] == 'select_route' if (data = info[:routes].find { |r| r[:id] == payload[:actions].first[:selected_option][:value]}) track_event('default', "route/#{data[:id]}", user_id, workspace) result = route_response(data) end elsif payload[:actions].first[:action_id] == 'select_line' if (borough, _ = info[:lines].find { |borough, lines| data = lines.find { |l| l[:id] == payload[:actions].first[:selected_option][:value]}}) track_event('default', "line/#{data[:id]}", user_id, workspace) result = line_response(borough, data) end end Net::HTTP.post(uri, result.to_json, "Content-Type" => "application/json") render json: result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_select\n end", "def selected; end", "def items\n load_selection\n import_selection or render_select\n end", "def selected_options; end", "def selected_options; end", "def select\n self[:select]\n end", "def selected?; end", "def selected?; end", "def select\n self[:select]\n end", "def block_selection\n end", "def selectable\n @selectable ||= [:select_list]\n end", "def select; end", "def select; end", "def select_list; end", "def collection_select(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def select\n self.alert = 'select'\n end", "def selectables(f, value, group)\n\t\trender :partial => \"shared/forms/panel/selection\", :locals => { :f => f, :value => value, :group => group, :select_class => \"selectables\", :selected_value => nil }\n\tend", "def select(*args, &block)\n _gestalt_call_tag(:select, args, &block)\n end", "def select(...)\n prompt.select(...)\n end", "def select locator, option_locator\r\n command 'select', locator, option_locator\r\n end", "def select locator, option_locator\r\n command 'select', locator, option_locator\r\n end", "def select(&block)\n @_componentable_container.select(&block)\n end", "def selected_changed\n return if searchable\n update_input\n end", "def general_info_for_select\n\t\t\n\tend", "def ask_select prompt=\"Enter selection pattern: \"\n ret = get_string prompt\n return if ret.nil? || ret == \"\"\n indices = get_matching_indices ret\n #$log.debug \"listselectionmodel: ask_select got matches#{@indices} \"\n return if indices.nil? || indices.empty?\n indices.each { |e|\n # will not work if single select !! FIXME\n add_row_selection_interval e,e\n }\n end", "def select\n execute_only(:select)\n end", "def render\n return ro_standard if @readonly\n set_initial_value('html','selected')\n#\n @yaml['html'].symbolize_keys!\n record = record_text_for(@yaml['name'])\n if @yaml['multiple'] \n @html << @parent.select(record, @yaml['name'], get_choices, @yaml['html'], {multiple: true})\n @js << \"$('##{record}_#{@yaml['name']}').selectMultiple();\"\n else\n @html << @parent.select(record, @yaml['name'], get_choices, @yaml['html'])\n end\n self\nend", "def render_Selection x, *args\n render x.to_s, *args\n end", "def selection_panel(f, value, group, s = nil, sc = nil)\n\t\trender :partial => \"shared/forms/panel/selection\", :locals => { :f => f, :value => value, :group => group, :selected_value => s, :select_class => sc}\n\tend", "def select_intended\n select intended\n end", "def select_intended\n select intended\n end", "def select\r\n assert_exists\r\n if(@how == :text)\r\n @select_list.select(@what)\r\n elsif(@how == :value)\r\n @select_list.select_value(@what)\r\n end \r\n end", "def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end", "def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end", "def selected?; false; end", "def selected?; false; end", "def selecione(ator) \n\t\t\t\t\tfind('.select2-selection--multiple').click #Nesse caso os elementos estão sendo encapsulados dentro do método!\n\t\t\t\t\tfind('.select2-search__field').set ator\n\t\t\t\t\tfind('.select2-results__option').click\n\t\t\t\tend", "def selected_changed\n return if searchable\n update_input\n trigger :change\n @input.blur unless multiple\n end", "def osd_select\n \n end", "def simple_selection_panel(value, options, t = nil)\n\t\trender :partial => \"shared/forms/panel/simple_selection\", :locals => { :value => value, :options => options, :title => t }\n\tend", "def initialize\n @selection\n end", "def select\n cached_fetch(:select){default_select}\n end", "def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end", "def toggle_multiple_selection\n toggle_value :multiple_selection\nend", "def set_Selection(value)\n set_input(\"Selection\", value)\n end", "def select( item )\r\n select_item_in_select_list(:text, item)\r\n end", "def select(*) end", "def selected_text\n send_command_to_control(\"GetSelected\")\n end", "def render\n return ro_standard if @readonly\n\n set_initial_value('html','selected')\n # separate options and html part\n options_part = {}\n @yaml['html'].symbolize_keys!\n %i(selected include_blank).each { |sym| options_part[sym] = @yaml['html'].delete(sym) if @yaml['html'][sym] }\n @yaml['html'][:multiple] = true if @yaml['multiple']\n\n record = record_text_for(@yaml['name'])\n if @yaml['html'][:multiple]\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n @js << \"$('##{record}_#{@yaml['name']}').selectMultiple();\"\n else\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n # add code for view more data\n @html << add_view_code() if @yaml['view']\n end\n self\nend", "def select_list\n @browser.div(:class => \"select-list\")\n end", "def select_none; end", "def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end", "def selections\n selector.send(selector_method) rescue nil\n end", "def selection *params\n opt = parse_params_for_select params\n return @adapter.selection(opt)\n end", "def select(*args, &block)\n browser.select(*args, &block)\n end", "def menu_selection \nend", "def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n say \"Using: #{command}\" \n selected = command.to_s\n end\n end\n menu.choice :exit do exit 1 end\n end\n end", "def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend", "def choose\n \n end", "def sub_select _value=0\n send_cmd(\"sub_select #{_value}\")\n end", "def on_select(tableView, tableViewDelegate)\n # implement in row class\n end", "def select_item\n @selected = @current\n\n items\n end", "def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end", "def selection\n eval_param(:selection)\n end", "def select(how, what)\n case how\n when :text, :index, :value\n raise NotImplementedError\n else\n raise ArgumentError, \"can't select options by #{how.inspect}\"\n end\n end", "def add_to_selection\n case @selection_mode \n when :multiple\n if @selected_indices.include? @current_index\n @selected_indices.delete @current_index\n else\n @selected_indices << @current_index\n end\n else\n end\n @repaint_required = true\n end", "def selectize_single_select(key, value)\n # It may be tempting to combine these into one execute_script, but don't; it will cause failures.\n open_selectize_chooser(key)\n execute_script \"\n var options = #{find_selectized_control_js(key)}.querySelectorAll('.option');\n var option = Array.from(options).find((opt) => opt.innerHTML.match(/#{value}/));\n option.click() \"\n end", "def select(&blk); end", "def select(*rest) end", "def select(*rest) end", "def build_options_and_select(type, selected, options = T.unsafe(nil)); 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 select(*args, &block)\n browser.within(component_locator) do\n browser.select(*args, &block)\n end\n end", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def select(scope) # abstract\n end", "def select(method, choices = nil, options = {}, html_options = {}, &block)\n html_options['data-bind'] = \"value: #{method}\"\n super(method, choices, options, html_options, &block)\n end", "def select_option\n return $prompt.select(\"What's your option?\",\n [\"Ladder\", \"Team's info\", \"Play a game!\", \"Training\", \"Exit\"])\n \nend", "def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend", "def select_pane(description, name, array)\r\n define_selected!(array)\r\n $pane_name = name\r\n $pane_description = description\r\n def array.name\r\n $pane_name\r\n end\r\n def array.description\r\n $pane_description\r\n end\r\n render_partial(\"select_pane\", array)\r\n end", "def add_select_options(opt)\n opt.on('--select x,y,z', Array,\n \"Select x, y, z columns only\") do |value|\n self.select = value.collect{|c| c.to_sym}\n end\n opt.on('--allbut x,y,z', Array,\n \"Select all but x, y, z columns\") do |value|\n self.allbut = value.collect{|c| c.to_sym}\n end\n 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 update_list_selection\n # If B Button is Pressed \n if Input.trigger?(Input::B)\n # Play cancel SE\n Sound.play_cancel\n quit_command()\n\n # If C Button is Pressed \n elsif Input.trigger?(Input::C)\n outline = @list_window.selected_outline\n # If you cannot view...\n if outline.contents == nil\n # Play buzzer SE\n Sound.play_buzzer\n else\n # Play decision SE\n Sound.play_decision\n outline_command()\n end\n end\n end", "def need_selection?\n fail NotImplementedError\n end", "def annotation_select_option\n [self.name, \"#{self.name}--#{self.annotation_type}--study\"]\n end", "def select_custom_fields\n group_custom_fields 'select'\n end", "def [](sel); end", "def register_choice\n end", "def update_dorm_selection; update_field(\"dorm_selection\"); end", "def do_interactive_plan_selection\n options = (@selected_plan || plans).map { |k,v| [titleize(k.to_s), v] }.to_h\n\n @selected_plan = select(\"Select a plan under #{@plan_stack.join('/')}\", options: options)\n @plan_stack << titleize(@selected_plan.name)\n end", "def select_list\n require 'pashua'\n include Pashua\n\n config = \"\n *.title = personal time tracker\n cb.type = combobox\n cb.completion = 2\n cb.width = 400\n cb.default = surfing\n cb.tooltip = Choose from the list\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\" + \"\\n\"\n\n # insert list of all choices\n cust = get_custom_cats || []\n cat = (cust ? cust + Categories : Categories)\n cat.each { |c| config << \"cb.option = #{c}\\n\" }\n pagetmp = pashua_run config\n exit if pagetmp['cancel'] == 1 || pagetmp['cb'] == nil\n\n choice = pagetmp['cb'].strip\n notify_change(choice)\n log(choice)\n\n unless cat.index(choice)\n cust << choice\n write_custom_cats(cust)\n end\nend", "def curselection\n list(tk_send_without_enc('curselection'))\n end", "def select_hint view, ch\n # a to y is direct\n # if x or z take a key IF there are those many\n #\n ix = get_index(ch, view.size)\n if ix\n f = view[ix]\n return unless f\n $cursor = $sta + ix\n\n if $mode == 'SEL'\n toggle_select f\n elsif $mode == 'COM'\n run_command f\n elsif $mode == \"forum\"\n display_forum f\n else\n on_enter f\n end\n #selectedix=ix\n end\nend", "def select_hint view, ch\n ix = get_index(ch, view.size)\n #ix = $IDX.index(ch)\n if ix\n f = view[ix]\n return unless f\n if $mode == 'SEL'\n toggle_select f\n elsif $mode == 'COM'\n run_command f\n else\n open_file f\n end\n #selectedix=ix\n end\nend", "def selected\n @selected\n end", "def update_command_selection()\n if Input.trigger?(Input::B)\n Sound.play_cancel\n quit_command()\n \n elsif Input.trigger?(Input::C)\n case @command_window.index\n when 0 # Equip\n Sound.play_decision\n equip_command()\n update_detail_window(@status_equip_window.selected_item)\n end\n \n elsif Input.trigger?(Input::R)\n Sound.play_cursor\n next_actor_command()\n elsif Input.trigger?(Input::L)\n Sound.play_cursor\n prev_actor_command()\n end\n \n end", "def _parent_selection\n if @selector_for\n render :js => select_record_js(selector_field_value) + js_choose_id(selector_field_value)\n else\n render :js => update_recordset_js\n end\n end", "def select\n self.state = @sidebar.selected.data[:id]\n end", "def selectize_multi_select(key, *values)\n values.flatten.each do |value|\n open_selectize_chooser(key)\n execute_script(\"\n #{find_selectized_control_js(key)}.querySelector('input').value = '#{value}';\n document.querySelector$('##{key}.selectized').selectize.createItem();\n \")\n end\n end", "def select_with_index(val)\n option_locator = \"index=#{val}\"\n @driver.sc_select(:view, option_locator, self.abs_path)\n stall :select\n end", "def ripe_point_treatment_type_code_changed\n\ttreatment_type_code = get_selected_combo_value(params)\n\tsession[:ripe_point_form][:treatment_type_code_combo_selection] = treatment_type_code\n\t@treatment_codes = RipePoint.treatment_codes_for_treatment_type_code(treatment_type_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('ripe_point','treatment_code',@treatment_codes)%>\n\n\t\t}\n\nend", "def option_selected\n puts \"Your option has been selected successfully!\"\nend" ]
[ "0.7299794", "0.69812965", "0.6842775", "0.6836243", "0.6836243", "0.6790073", "0.67284554", "0.67284554", "0.66756946", "0.6578907", "0.6546324", "0.64850855", "0.64850855", "0.6466827", "0.63828564", "0.63312876", "0.62928253", "0.626391", "0.62462276", "0.6235206", "0.6235206", "0.62188995", "0.61697525", "0.61619246", "0.6130568", "0.61131483", "0.61037725", "0.60962635", "0.60882384", "0.60755616", "0.60755616", "0.6062446", "0.60568094", "0.60568094", "0.60343784", "0.60343784", "0.6008445", "0.60030943", "0.5997427", "0.59959376", "0.5980198", "0.5961902", "0.5926662", "0.59250534", "0.5923524", "0.5874739", "0.5868984", "0.5868029", "0.5857944", "0.57889235", "0.57744086", "0.57618266", "0.57544947", "0.57417446", "0.57388973", "0.57307637", "0.5719534", "0.5710454", "0.56989133", "0.569479", "0.56766087", "0.56647414", "0.5661008", "0.5653825", "0.565205", "0.5645721", "0.56349427", "0.56224984", "0.56213444", "0.56213444", "0.5602932", "0.5599681", "0.5595252", "0.5592734", "0.5589493", "0.5583245", "0.55802983", "0.55729526", "0.55597043", "0.5559545", "0.55556995", "0.55554736", "0.5554531", "0.5547708", "0.553962", "0.5524268", "0.551734", "0.5506479", "0.54926866", "0.5492587", "0.54778874", "0.5470071", "0.54503584", "0.5449219", "0.54444695", "0.5443746", "0.54380614", "0.54370004", "0.54302245", "0.54246765", "0.54218954" ]
0.0
-1
scope :vendor_only, where(:organization_type_id => MasterType.find_by_type_value("vendor").id) scope :customer_only, where(:organization_type_id => MasterType.find_by_type_value("customer").id) scope :support_only, where(:organization_type_id => MasterType.find_by_type_value("support").id) Sets active to true by default. TODO: this can be done using the schema file (migration)
def default_values self.organization_active = true if attributes.key?('organization_active') && organization_active.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_to_set_scope\n #this is a commodity method\n if self.featurable.is_a?(Account)\n self.scope = \"AccountPlan\"\n end\n end", "def to_scope\r\n\r\n table_name = @model.table_name\r\n\r\n @filtering_attributes.select { |attr|\r\n @filtering_values.key?(attr)\r\n }.reduce(@model.scoped) { |model_scope, attr|\r\n\r\n filtering_value = @filtering_values[attr]\r\n\r\n filtering_column_type = @model.attribute_type(attr)\r\n\r\n column_sql = %'\"#{ table_name }\".\"#{ attr }\"'\r\n\r\n case filtering_column_type\r\n when :string\r\n case filtering_value\r\n when Set\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n else\r\n model_scope.where(\"#{ column_sql } LIKE ?\", filtering_value)\r\n end\r\n\r\n when :boolean\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n\r\n when :integer\r\n case filtering_value\r\n when Hash\r\n new_model_scope = model_scope\r\n if filtering_value.key?(:min)\r\n unless filtering_value[:min] == -Float::INFINITY\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value[:min])\r\n end\r\n end\r\n if filtering_value.key?(:max)\r\n unless filtering_value[:max] == Float::INFINITY\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value[:max])\r\n end\r\n end\r\n new_model_scope\r\n when Set\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n when Range\r\n new_model_scope = model_scope\r\n unless filtering_value.first == -Float::INFINITY\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value.first)\r\n end\r\n unless filtering_value.last == Float::INFINITY\r\n new_model_scope =\r\n if filtering_value.exclude_end?\r\n model_scope.where(\"#{ column_sql } < ?\", filtering_value.last)\r\n else\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value.last)\r\n end\r\n end\r\n new_model_scope\r\n else\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n end\r\n\r\n when :date\r\n case filtering_value\r\n when Hash\r\n new_model_scope = model_scope\r\n if filtering_value.key?(:from)\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value[:from])\r\n end\r\n if filtering_value.key?(:until)\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value[:until])\r\n end\r\n new_model_scope\r\n when Set\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n when Range\r\n new_model_scope = model_scope\r\n unless filtering_value.first == -Float::INFINITY\r\n new_model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value.first)\r\n end\r\n unless filtering_value.last == Float::INFINITY\r\n new_model_scope =\r\n if filtering_value.exclude_end?\r\n model_scope.where(\"#{ column_sql } < ?\", filtering_value.last)\r\n else\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value.last)\r\n end\r\n end\r\n new_model_scope\r\n else\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n end\r\n else\r\n model_scope\r\n end\r\n }\r\n end", "def prov_scope(opts)\n scope = []\n # Request date (created since X days ago)\n scope << [:created_recently, opts[:time_period].to_i] if opts[:time_period].present?\n # Select requester user across regions\n scope << [:with_requester, current_user.id] unless approver?\n scope << [:with_requester, opts[:user_choice]] if opts[:user_choice] && opts[:user_choice] != \"all\"\n\n scope << [:with_approval_state, opts[:applied_states]] if opts[:applied_states].present?\n scope << [:with_type, MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].keys]\n scope << [:with_request_type, opts[:type_choice]] if opts[:type_choice] && opts[:type_choice] != \"all\"\n scope << [:with_reason_like, opts[:reason_text]] if opts[:reason_text].present?\n\n scope\n end", "def scope_options; end", "def scope_options; end", "def data_scope\n if Company.columns.map(&:name).include?(\"deleted_at\")\n yield\n else\n Company.unscoped do\n Recognition.unscoped do\n User.unscoped do\n yield\n end\n end\n end\n end\n end", "def set_filtered_organizations\n scope = current_user.organizations.includes(:assignments, :group_assignments).filter_by_search(@query)\n\n scope = case @current_view_mode\n when \"Archived\" then scope.archived\n when \"Active\" then scope.not_archived\n else scope\n end\n\n @organizations = scope\n .order_by_sort_mode(@current_sort_mode)\n .order(:id)\n .page(params[:page])\n .per(12)\n end", "def scope_condition\n self.class.send( :sanitize_sql_hash_for_conditions, { :owner_type => owner_type, :owner_id => owner_id } )\n end", "def entity_scope type, viewer\n # type.constantize.tagged_by list.name_tag, [ list.owner_id, viewer.id ]\n type.constantize.joins(:taggings).merge(Tagging.list_scope @list, viewer.id)\n end", "def bt_scope_conditions\n table = self.class.arel_table\n self.class.bt_scope_columns.map do |key_attr|\n table[key_attr].eq(self[key_attr])\n end.inject do |memo, condition|\n memo.and(condition)\n end\n end", "def apply_scopes(*)\n relation = super\n relation = relation.accessible_by(current_ability) if scope_accessible?\n relation\n end", "def selected_scope\n (params[:scope] || :default).to_sym\n end", "def dynamic_scopes\n self.scope_definition.select { |_k, v| v.present? }\n end", "def add_boolean_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"#{col}\", { :conditions => { :\"#{col}\" => true } }\n politely_add_named_scope :\"not_#{col}\", { :conditions => { :\"#{col}\" => false } }\n end\n end", "def select\n @type = params[:type]\n @hosts = Host.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"host\"\n @apps = App.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"app\"\n @sites = Site.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"site\"\n @devices = Device.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"device\"\n end", "def applies_type?(scope, type); end", "def catalog_scoped?\n false\n end", "def query_scope\n record_class.public_send(include_strategy, included_associations)\n end", "def build_conditions_for_my_or_all(emp_user_id,company_id,record_type=\"My\",assigned_id=\"assigned_to_employee_user_id\")\n\t\tif record_type == \"My\"\n\t\t\t\" #{assigned_id} = #{emp_user_id} and company_id = #{company_id} \"\n\t\telse\n\t\t\t\"company_id = #{company_id}\"\n\t\tend\n\tend", "def base_scope\n ApplicationRecord.none\n end", "def dynamic_scopes\n self.scopes.select { |name, args| args.present? }\n end", "def scoped_all(organization_scoped_ar)\n organization_scoped_ar.organization_scope(organization).all\n end", "def scope\n if tree.columns.scope?\n tree.base_class.where Hash[tree.columns.scope.map { |column| [column, record[column]] }]\n else\n tree.base_class.where(nil)\n end\n end", "def init_contract_filters\n\t \n\t statusable = Category.statusable\n\t if statusable.length == 0\n\t @conditions << \"(true = false)\"\n\t else\n\t @conditions << \"(category_id in (#{Category.statusable.collect{|c|c.id}.join(',')}))\"\n end\n\tend", "def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each { |n| not_null_conds = not_null_conds.and(n) }\n result = s.project('*').where(not_null_conds)\n scope_nodes = sanitized_sandbox_scope.map do |scope_column, scope_def|\n tmp = []\n if scope_def['inclusion']\n inclusion_nodes = scope_def['inclusion'].map { |value| s[scope_column].eq(value) }\n tmp << inclusion_nodes.inject(&:or)\n end\n if scope_def['exclusion']\n exclusion_nodes = scope_def['exclusion'].map { |value| s[scope_column].not_eq(value) }\n tmp << exclusion_nodes.inject(&:or)\n end\n if scope_def['blank']\n tmp << s[scope_column].eq(nil)\n end\n tmp\n end.flatten\n scope_conds = scope_nodes.inject(&:and)\n result = result.where(scope_conds) if scope_conds\n result\n end", "def where_restrict_organisation(*args)\n args.map{|klass| \"#{klass.table_name}.organisation_id = #{Thread.current[:organisation_id]}\"}.join(\" AND \")\n end", "def search_type\n case type\n when \"opinions\"\n query.only_amendables\n when \"amendments\"\n query.only_visible_emendations_for(@current_user, @component)\n else # Assume 'all'\n query.amendables_and_visible_emendations_for(@current_user, @component)\n end\n end", "def index\n @organizations = Organization.preload(:organization_category, project: :custom_values).all\n #\n # preload(:custom_values)\n # if has_column?(:author)\n # scope = scope.preload(:author)\n # end\n end", "def organizations_with_access(access_type = ACCESS_STATES[:RESTRICTED])\n subscribed_organizations.includes(teams: :subscriptions).where(\"subscriptions.access_type = ?\", access_type)\n end", "def quota_viewable\n return Quotum.none if @force_empty\n if @user.present?\n if @user.tenant_ids\n Quotum.where(tenant_id: @user.tenant_ids).or(Quotum.where(tenant_id: nil))\n else\n Quotum.where(tenant_id: nil)\n end\n else\n Quotum.where(tenant_id: nil)\n end\n end", "def index\n @category = params[:category].nil? ? \"Vendors\" : params[:category]==\"dealer\" ? \"Dealers Room\" : \"Artists Alley\"\n @vendors = Vendor.where(approved: true)\n @vendors = @vendors.where(category: params[:category]) if params[:category]\n @vendors = @current_user ? @vendors.or(Vendor.where(user_id: @current_user)) : @vendors\n end", "def valid_scope(valid_scopes, scope)\n\t\tend", "def op_types_in_scope\n\n types_in_scope = if with_all?\n ModelMethod.supported_types_enum.dup\n else\n [*@with].dup\n end\n\n types_in_scope -= [*@exclude]\n\n types_in_scope\n end", "def scope_from_params(params)\n return default_scope if params[:scope].blank?\n scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',')\n scope = scope.map(&:downcase).map(&:strip)\n return scope & default_scope\n end", "def tenanted?\n @roomer_scope == :tenanted\n end", "def index\n @condition = {}\n @condition[:orgnization] = current_user.orginization unless current_user.orgnization == User::ORGS[0]\n @condition[:status] = params[:status] if params[:status] and AuthorityChangeRequest::STATUS.include? params[:status]\n @acrs = AuthorityChangeRequest.where @condition\n end", "def filter_scopes\n @filter_scopes ||= scopes.inject({}) do |result, element|\n result[element.first] = element.last if element.last[:type] != :boolean\n result\n end\n end", "def available_scopes\n (default_scopes << Doorkeeper.config.optional_scopes.to_a).flatten.uniq\n end", "def stats_scope\n redirect_to admin_dashboard_path, alert: \"Scope not available\" unless\n params[:scope].present? && %w(catalogs).include?(params[:scope])\n\n params[:scope]\n end", "def add_boolean_scopes(col)\n if self.column_names.include?(col.to_s)\n # have to freeze the column name in place. By the time lambda is evaluated,\n # col is long gone.\n politely_add_named_scope :\"#{col}\", lambda { where( :\"#{col}\" => true ) } \n politely_add_named_scope :\"not_#{col}\", lambda { where( :\"#{col}\" => false ) }\n end\n end", "def scope_level; end", "def scope_by_status(status)\n case status\n when 'new', 'shipped', 'paid'\n with_scope(:find => { :conditions => {:status => status}}) do\n yield\n end\n else\n yield\n end\n end", "def allowed_types\n\treturn [Organization]\nend", "def scopes\n model.scopes\n end", "def do_params_filter scope\n filter_params.each do |k,value|\n if value.present?\n if self.class.custom_filter_fields[k].present?\n scope = self.class.custom_filter_fields[k].call scope, value\n elsif resource_class.column_names.include? k\n if resource_class.columns_hash[k].type == :boolean\n if value == '0'\n puts \"Should filter\"\n scope = scope.where(k => [false,nil])\n else\n scope = scope.where(k => true)\n end\n else\n scope = scope.where(k => value)\n end\n elsif resource_class.reflect_on_association(k.to_sym).present?\n klass = resource_class.reflect_on_association(k.to_sym).klass\n scope = do_inner_params_filter klass, value, scope\n else\n Rails.logger.warn(\"No filter is available for field #{k}\")\n end\n end\n end\n scope\n end", "def organization_type_params\n params.require(:organization_type).permit(:name, :inactive)\n end", "def select_scope(scope)\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC, nil].include?(scope)\n Scopes::SCOPE_PRIVATE\n else\n scope\n end\n end", "def type_condition(table = arel_table)\n if using_multi_table_inheritance?\n nil\n else\n sti_column = table[inheritance_column]\n sti_names = ([self] + descendants).map { |model| model.sti_name }\n\n sti_column.in(sti_names)\n end\n end", "def allowed_types\n [Organization]\nend", "def index\n # @application_cases = current_user.application_cases.all\n if params[:active].present?\n @application_cases = current_user.application_cases.where(nil) # creates an anonymous scope\n @application_cases = @application_cases.active_status(params[:active]) if params[:active].present?\n else \n @application_cases = current_user.application_cases.active_status('Active')\n end\n\n end", "def conditions\n scope.conditions\n end", "def custom_filters(scope)\n scope\n end", "def build_scope_from_columns\n self.scope\n end", "def select(scope) # abstract\n end", "def index_scope(scope)\n scope\n end", "def column_filter_conditions_for(table, type)\n values = column_filters[type].join(', ')\n foreign_key = type.singularize.foreign_key\n\n if table == type\n \"\\\\`id\\\\` in (#{ values })\"\n elsif columns_for(table).include?(foreign_key)\n \"\\\\`#{ foreign_key }\\\\` in (#{ values })\"\n end\n end", "def scope\n @options[:scope]\n end", "def scope_current_tenant &block\n if current_user\n current_user.create_tenant # make sure there is a tenant\n \n current_tenant.scope_schema &block\n else\n yield\n end\n end", "def active_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper).flatten\n end", "def acceptable_filter_scopes\n []\n end", "def is_vendor?\n current_user && current_user.vendor\n end", "def scope\n finder_or_run(:scope)\n end", "def scope\n return @scope if @scope\n\n @scope = hard_scope.dup\n soft_dependencies = []\n\n enabled_dependencies.each do |dependency|\n binds = nil\n node = nil\n\n if dependency.polymorphic?\n alias_prefix = SOFT_PREFIX if @scope.manager.ast.with&.children&.map(&:left)&.map(&:name)&.include?(\"#{HARD_PREFIX}#{dependency.name.to_s.pluralize}\")\n dependency.models.each do |model|\n next unless model.scoped?\n next unless circular_dependency?(dependency, model) || alias_prefix\n\n model_manager = model.hard_scope.manager.dup\n model_manager.projections = [\n Arel::Nodes::As.new(Arel::Nodes::Quoted.new(model.clazz.name), Arel::Nodes::SqlLiteral.new(:type.to_s)),\n model.primary_key.as(:id.to_s)\n ]\n\n if node\n binds.concat(model.hard_scope.binds)\n node = node.union_all(model_manager)\n else\n binds = model.hard_scope.binds\n node = model_manager.ast\n end\n end\n else\n next unless circular_dependency?(dependency) && dependency.soft?\n next unless dependency.models.first.scoped?\n\n model = dependency.models.first\n binds = model.hard_scope.binds\n manager = model.hard_scope.manager.dup\n manager.projections = [model.primary_key.as(:id.to_s)]\n node = manager.ast\n end\n\n next unless node\n\n dependencies = Arel::Table.new(\"#{alias_prefix}#{dependency.name.to_s.pluralize}\")\n\n on = dependencies[:id].eq(arel_table[dependency.foreign_key])\n on = dependencies[:type].eq(arel_table[dependency.foreign_type]).and(on) if dependency.polymorphic?\n\n @scope.manager\n .join(dependencies, Arel::Nodes::OuterJoin)\n .on(on)\n .prepend_with(Arel::Nodes::As.new(dependencies, Arel::Nodes::Grouping.new(node)))\n @scope.binds.unshift(*binds)\n soft_dependencies << DependencyTable.new(dependency, dependencies)\n end\n\n unless soft_dependencies.empty?\n @scope.manager.projections = enabled_columns.keys.map do |column|\n info = soft_dependencies.find { |dt| dt.dependency.foreign_key == column }\n next info.table[info.dependency.models.first.clazz.primary_key].as(info.dependency.foreign_key) if info\n\n info = soft_dependencies.find { |dt| dt.dependency.foreign_type == column }\n next info.table[:type].as(info.dependency.foreign_type) if info\n\n arel_table[column]\n end\n end\n\n @scope\n end", "def index\n @visible=any_filters?\n @patients = apply_scopes(Patient).all\n if current_user.user_type==\"doctor\"\n @patients = @patients.where(health_center_id: current_user.health_center_id)\n else\n @patients = @patients.where(user_id: current_user.id)\n end\n @params = params\n\n end", "def search_scope\n super\n end", "def scope(filters)\n scope = filters.first.is_a?(Proc) ? nil : filters.shift\n scope || doc\n end", "def quota_view_only\n return Quotum.none if @force_empty\n if @user.present?\n if @user.tenant_ids\n Quotum.where.not(tenant_id: @user.tenant_ids).or(Quotum.where(tenant_id: nil))\n else\n Quotum.all\n end\n else\n Quotum.all\n end\n end", "def scopes\n read_inheritable_attribute(:scopes) || write_inheritable_attribute(:scopes, {})\n end", "def scopes\n scopes = scope ? scope.split(/\\s+/) : []\n scopes = attributes[:scope]\n Set.new(scopes).to_s\n end", "def scopes\n ENV.fetch('SCOPES', 'store_v2_products')\nend", "def organizations_in_vercinity\n\n\tend", "def boolean_scopes\n @boolean_scopes ||= scopes.inject({}) do |result, element|\n result[element.first] = element.last if element.last[:type] == :boolean\n result\n end\n end", "def add_conditions(scope)\n unless @reflection.through_reflection.klass.descends_from_active_record?\n scope = scope.where(@reflection.through_reflection.klass.send(:type_condition))\n end\n\n scope = scope.where(@reflection.source_reflection.options[:conditions])\n scope.where(through_conditions)\n end", "def get_conditions(type)\n sql = ' WHERE ' + (T_DELETABLE.include?(type) ? 'deleted_at IS NULL AND ' : '')\n\n if T_LISTS.include? type\n check_api_token\n\n unless @current_user\n return 'ERROR'\n end\n\n id = @current_user.theatre_id\n\n if type == 'theatres' && id != 0\n sql += 'id = ' + id.to_s\n\n elsif type == 'posters'\n sql += 't.theatre_id = ' + id.to_s\n\n elsif id != 0\n sql += 'theatre_id = ' + id.to_s\n end\n\n elsif type == 'u_perms'\n sql += \"perm NOT LIKE 'theatres%' AND perm NOT LIKE '%approve' AND perm NOT LIKE '%choose'\"\n\n elsif type == 'performances'\n check_api_token\n\n unless @current_user\n return 'ERROR'\n end\n\n id = @current_user.theatre_id\n\n sql += 'approved = 0 OR approved = ' + id.to_s\n\n end\n\n # Return\n if T_DELETABLE.include? type\n sql\n else\n sql == ' WHERE ' ? '' : sql\n end\n end", "def scoped_all\n # The range is shared among all subclasses of the base class, which directly extends ActiveRecord::Base\n self.class.base_class.where(scoped_condition)\n end", "def for_favoritor_type favoritor_type\n where favoritor_type: favoritor_type\n end", "def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end", "def non_profit_admin?\n managed_organization.try(:type) == 'NonProfit'\n end", "def user_type\n # if self.is_vendor\n # \"vendor\"\n # else\n # \"customer\"\n # end\n\n self.is_vendor ? 'vendor' : 'customer'\n end", "def all_orderable\n if self.class.orderable_scope.any?\n scope = self.class.orderable_scope.inject({}) do |where, scope_name|\n where[scope_name] = self[scope_name]\n where\n end\n self.class.where(scope)\n else\n self.class.scoped\n end\n end", "def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = StateComponentTypeTax.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end", "def list_scope(field)\n scope_field = self.class.mongoid_list_fields[field][:scope]\n scope_field ? self.class.where(scope_field => self[scope_field]) : self.class.all\n end", "def vendor_role_type_params\n params.require(:vendor_role_type).permit(:name, :active_flag)\n end", "def relation\n # base query relation for asset\n base_rel = TransamAsset.where(\"transam_assets.organization_id\": organization_list || [])\n\n join_tables = {}\n where_sqls = {}\n field_pairs = {}\n query_filters.each do |filter|\n query_field = filter.query_field\n # exclude organization_id as its handled above\n next unless query_field || query_field.name == 'organization_id'\n unless query_field.pairs_with.blank?\n field_pairs[query_field.name] = query_field.pairs_with\n end\n\n where_sqls_for_one_filter = []\n query_field.query_asset_classes.each do |asset_class|\n asset_table_name = asset_class.table_name\n unless join_tables.keys.include?(asset_table_name) || asset_class.transam_assets_join.blank?\n join_tables[asset_table_name] = asset_class.transam_assets_join\n end\n\n query_field_name = \"#{asset_table_name}.#{query_field.name}\"\n query_filter_type = query_field.filter_type\n\n filter_value = filter.value\n # wrap values\n if filter.op == 'like'\n filter_value = \"'%#{filter.value}%'\"\n elsif ['date', 'text'].include?(query_filter_type) and filter.op != 'in' # if coming from a list expect quotes to already be added\n filter_value = \"'#{filter.value}'\"\n end\n\n filter_op = filter.op\n if filter_op == 'in' \n if filter_value.blank?\n filter_op = 'is'\n filter_value = 'NULL'\n else\n filter_value = \"(#{filter_value})\"\n end\n end\n\n #if query_filter_type == 'text'\n #query_field_name = \"lower(#{query_field_name})\"\n #filter_value = \"lower(#{filter_value})\"\n #end\n\n where_clause_str = \"#{query_field_name} #{filter_op} #{filter_value}\"\n unless query_field.column_filter.blank? || query_field.column_filter_value.blank?\n where_clause_str = \"(#{query_field_name} #{filter_op} #{filter_value} AND #{query_field.column_filter} = '#{query_field.column_filter_value}')\"\n end\n where_sqls_for_one_filter << where_clause_str\n end\n\n where_sqls[query_field.name] = where_sqls_for_one_filter.join(\" OR \")\n end\n\n # deal with field_pairs: if both the main field and pairs_with field are filters, then they should be a OR sql relation\n # e.g., manufacturer_id in (1,2) OR other_manufacturer in ('A', 'B')\n field_pairs.each do |main_field, pairs_with|\n main_field_sql = where_sqls[main_field]\n pairs_with_sql = where_sqls[pairs_with]\n next if main_field_sql.blank? || pairs_with_sql.blank? \n where_sqls[main_field] = \"(#{main_field_sql}) OR (#{pairs_with_sql})\"\n where_sqls.delete(pairs_with) # delete pairs_with sql\n end\n\n select_sqls = []\n column_filters = {}\n query_fields.each do |field|\n unless field.column_filter.blank? || field.column_filter_value.blank?\n if column_filters[field.column_filter]\n column_filters[field.column_filter] << field.column_filter_value unless column_filters[field.column_filter].include?(field.column_filter_value)\n else\n column_filters[field.column_filter] = [field.column_filter_value]\n end\n end\n\n query_field_name = field.name\n field_association = field.query_association_class\n if field_association\n association_table_name = field_association.table_name\n association_id_field_name = field_association.id_field_name\n association_display_field_name = field_association.display_field_name\n use_field_name = field_association.use_field_name\n end\n\n field.query_asset_classes.each do |qac|\n asset_table_name = qac.table_name\n table_join = qac.transam_assets_join\n\n unless join_tables.keys.include?(asset_table_name) || table_join.blank?\n join_tables[asset_table_name] = table_join\n end\n\n unless association_table_name.blank?\n as_table_name = \"#{asset_table_name}_#{association_table_name}\"\n as_table_name += \"_#{query_field_name}\" if use_field_name\n # select value from association table\n unless join_tables.keys.include?(as_table_name)\n join_tables[as_table_name] = \"left join #{association_table_name} as #{as_table_name} on #{as_table_name}.#{association_id_field_name} = #{asset_table_name}.#{query_field_name}\"\n end\n\n unless field.column_filter.blank? || field.column_filter_value.blank?\n select_sqls << \"IF(#{field.column_filter} = '#{field.column_filter_value}',#{as_table_name}.#{association_display_field_name}, '') as #{asset_table_name}_#{query_field_name}\"\n else\n select_sqls << \"#{as_table_name}.#{association_display_field_name} as #{asset_table_name}_#{query_field_name}\"\n end\n else\n # select value directly from asset_table\n\n output_field_name = field.display_field.blank? ? \"#{asset_table_name}.#{query_field_name}\" : \"#{asset_table_name}.#{field.display_field}\"\n\n unless field.column_filter.blank? || field.column_filter_value.blank?\n select_sqls << \"IF(#{field.column_filter} = '#{field.column_filter_value}',#{output_field_name}, '') as #{asset_table_name}_#{query_field_name}\"\n else\n select_sqls << \"#{output_field_name} as #{asset_table_name}_#{query_field_name}\"\n end\n\n end\n end\n end \n\n # joins\n join_tables.each do |table_name, join_sql|\n base_rel = base_rel.joins(join_sql)\n end\n\n # wheres\n if where_sqls.any?\n base_rel = base_rel.where(where_sqls.map{ |field_name, field_sql| \"(\" + field_sql + \")\" }.join(\" AND \"))\n end\n\n # apply column filters\n if column_filters.any?\n base_rel = base_rel.where(column_filters.map{ |column_filter, column_filter_values| \"#{column_filter} in (\" + column_filter_values.map{|v| \"'#{v}'\"}.join(',') + \")\" }.join(\" OR \"))\n end\n\n # selects\n if select_sqls.any?\n base_rel = base_rel.select(\"transam_assets.id\", select_sqls.join(\", \"))\n end\n\n # return base query relation\n puts base_rel.to_sql\n base_rel\n end", "def scope_name; end", "def org_types\n organizations.map(&:organization_type)\n end", "def associations_scope\n model_class_name.constantize.all\n end", "def associations_scope\n model_class_name.constantize.all\n end", "def organ_donors\n Patient.where(is_organ_donor: true)\nend", "def active_sync_filters\n company.settings.sync_filters[provider]\n end", "def scopes; end", "def scoped_to_tenant?\n !!scoped_to_tenant_id\n end", "def filtered_by_association_type(name, type)\n type.present? ? where(\"#{name}_key.begins_with\" => \"#{type}#{ActivityNotification.config.composite_key_delimiter}\") : none\n end", "def scope\n @scope ||= {}\n end", "def scope\n @scope ||= {}\n end", "def allowed_types\n\t[Organization, Domain]\nend", "def allowed_types\n [ Entities::SearchString,\n Entities::Organization ]\nend", "def update_scope\n @scope = params[:scope] || params[:q] || {}\n end", "def default_scopes_accept_a_block?\n ! (::ActiveRecord::VERSION::MAJOR <= 3 && ::ActiveRecord::VERSION::MINOR == 0)\n end", "def project_scope(options={})\n @query.results_scope(options)\n end" ]
[ "0.6016881", "0.595855", "0.58912444", "0.5831295", "0.5831295", "0.58096254", "0.5733699", "0.5645943", "0.56291556", "0.5555973", "0.5540309", "0.5527291", "0.5523325", "0.55090195", "0.5497261", "0.5496994", "0.5495893", "0.54800564", "0.54698384", "0.5464949", "0.5461882", "0.54227513", "0.53781635", "0.5355234", "0.5333882", "0.5327192", "0.5326719", "0.5324217", "0.53163725", "0.5297875", "0.52973425", "0.52965313", "0.5287579", "0.52802324", "0.5277619", "0.52594084", "0.52564716", "0.5242017", "0.5242", "0.52278525", "0.5224879", "0.52200866", "0.52189404", "0.5214612", "0.5214317", "0.52060443", "0.520261", "0.5199066", "0.519697", "0.5196294", "0.51957023", "0.51744175", "0.5170805", "0.5170472", "0.51658916", "0.516232", "0.51545554", "0.513876", "0.5126768", "0.5118621", "0.51179814", "0.51049787", "0.51010174", "0.5093355", "0.5090678", "0.5089302", "0.50801355", "0.50691086", "0.5068934", "0.5067739", "0.5066635", "0.50659776", "0.5060273", "0.5057163", "0.50531805", "0.505189", "0.50483996", "0.50270677", "0.50222784", "0.5020413", "0.5010928", "0.50070894", "0.5002291", "0.500008", "0.49890864", "0.49879086", "0.49878967", "0.49878967", "0.49850655", "0.4980199", "0.4978762", "0.49758673", "0.49722865", "0.49708405", "0.49708405", "0.4970027", "0.4969421", "0.49673814", "0.49666494", "0.49652606" ]
0.49931994
84
Creates a Contact for the organization with contact_type 'address' The information mirrors the organizational entity.
def process_after_create # Note: Both contacts and addresses fields are same so when organization create then address info will store in Address table so commented the code for contact :- Vishal # contact = contacts.build(contact_address_1: organization_address_1, contact_address_2: organization_address_2, # contact_city: organization_city, contact_country: organization_country, contact_description: organization_description, # contact_email: organization_email, contact_fax: organization_fax, contact_notes: organization_notes, # contact_state: organization_state, contact_telephone: organization_telephone, contact_title: organization_name, # contact_website: organization_website, contact_zipcode: organization_zipcode, contact_type: 'address') # contact.save address = addresses.build(address_address_1: organization_address_1, address_address_2: organization_address_2, address_city: organization_city, address_country: organization_country, address_description: organization_description, address_email: organization_email, address_fax: organization_fax, address_notes: organization_notes, address_state: organization_state, address_telephone: organization_telephone, address_title: organization_name, address_website: organization_website, address_zipcode: organization_zipcode, address_type: 'address') address.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end", "def create(contact)\n validate_type!(contact)\n\n attributes = sanitize(contact)\n _, _, root = @client.post(\"/contacts\", attributes)\n\n Contact.new(root[:data])\n end", "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end", "def new_contact\n @contact = Spree::Address.new\n end", "def build_contact(element, type)\n Record::Contact.new(\n :type => type,\n :id => node(\"#{element} ID\"),\n :name => node(\"#{element} Name\"),\n :organization => node(\"#{element} Organization\"),\n :address => node(\"#{element} Address\"),\n :city => node(\"#{element} City\"),\n :zip => node(\"#{element} Postal Code\"),\n :state => node(\"#{element} State/Province\"),\n :country_code => node(\"#{element} Country\"),\n :phone => node(\"#{element} Phone Number\"),\n :fax => node(\"#{element} Fax Number\"),\n :email => node(\"#{element} Email\")\n )\n end", "def build_contact(element, type)\n # lines = match.split(\"\\n\")\n # p lines[0].to_s.scan(/^Organisation Name\\.+\\s+(.+)\\n/)\n\n address = (1..3).\n map { |i| node(\"#{element} Address\")[i] }.\n delete_if { |i| i.nil? || i.empty? }.\n join(\", \")\n\n Record::Contact.new(\n :type => type,\n # :id => node(\"#{element} ID\"),\n :name => node(\"#{element} Name\"),\n :organization => node(\"#{element} Organization\"),\n :address => address, # node(\"#{element} Address\")[0].to_s + \", \" + node(\"#{element} Address\")[1].to_s,\n :city => node(\"#{element} Address\")[3],\n :zip => node(\"#{element} Address\")[4],\n :state => node(\"#{element} Address\")[5],\n :country => node(\"#{element} Address\")[6],\n # :country_code => node(\"#{element} Country\"),\n :phone => node(\"#{element} Phone\"),\n :fax => node(\"#{element} Fax\"),\n :email => node(\"#{element} Email\")\n )\n end", "def create_contact(params={})\n @obj.post('create-contact', @auth.merge(params))\n end", "def create\n @address = Address.create!(params[:address])\n @organization = Organization.new(params[:organization])\n @organization.address = @address\n \n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contact(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/contacts'\n\t\targs[:query]['Action'] = 'CreateContact'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :contact\n\t\t\targs[:body]['Contact'] = optional[:contact]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_contact(create_contact_input_object, opts = {})\n data, _status_code, _headers = create_contact_with_http_info(create_contact_input_object, opts)\n data\n end", "def create_address\n create_resource :address, {}\n end", "def build_contact(params = {})\n self.contact = gateway ? gateway.build_contact(params) : Contact.new(params)\n end", "def create_contact()\n Contact.new(id: rand(2000)).tap do |c|\n contacts << c\n end\n end", "def build_and_create_address\n\t\tbegin\n\t\t\t@address = Address.new(\n\t\t\t\tstreet_address: params[:address][:street_address],\n\t\t\t\textended_address: params[:address][:extended_address],\n\t\t\t\tlocality: params[:address][:locality],\n\t\t\t\tregion: params[:address][:region],\n\t\t\t\tpostal_code: params[:address][:postal_code],\n\t\t\t\tphone: params[:address][:phone],\n\t\t\t\temail: params[:address][:email]\n\t\t\t\t)\n\n\t\t\tunless @address.save\n\t\t\t\trender status: 422, json: {\n error: \"Could not create address\"\n }\n end\n rescue ActiveRecord::ActiveRecordError\n render status: 422, json: {\n error: \"Could not create address\"\n }\n end\n end", "def create\n @address = @company.addresses.build(address_params) \n\n respond_to do |format|\n if @address.save\n # If this is first address, set as bill and ship address\n @company.billaddress ||= @address.id\n @company.shipaddress ||= @address.id\n @company.save!\n\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(contact, organization_id)\n path = get_path(organization_id)\n result = handle_response(@client.push(path, contact.attributes))\n return if result.blank?\n\n set_contact_data(contact.attributes, result['name'])\n end", "def create\n\t\t@contact = Contact.new(contact_params)\n\t\tif @contact.save\n\t\t\tflash[:notice] = \"Contact sucessfully saved!\"\n\t\t\tredirect_to contacts_path\n\t \telse\n\t \t\tflash[:error] = \"Contact could not save!\"\n\t \t\t@contact.contact_phone_numbers.build unless @contact.contact_phone_numbers.present?\n\t \t\t@contact.contact_addresses.build unless @contact.contact_addresses.present?\n\t \trender 'new'\n\t \tend\n\tend", "def create\n @address = Address.new(params[:address])\n @address.type = params[:address][:address_type] unless params[:address][:address_type].blank?\n \n respond_to do |format|\n if @address.save\n flash[:notice] = 'Address was successfully created.'\n format.html { redirect_to( address_path(@address.id) ) }\n format.xml { render :xml => @address, :status => :created, :location => @address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/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 @response.status == 201\n end", "def create_a_new_contact(opts = {})\n create_a_new_contact_with_http_info(opts)\n nil\n end", "def address_model\n a = CIVICRM::Address.new(\n contact_id: self.contact_id,\n location_type_id: self.location_type_id,\n is_primary: self.primary,\n is_billing: false,\n street_address: self.address1,\n street_number: self.street_number,\n supplemental_address_1: self.address2,\n supplemental_address_2: self.address3,\n city: self.city\n\n )\n # Add county, state, country, and zipcode stuff now\n self.set_location(a)\n end", "def address_model\n a = CIVICRM::Address.new(\n contact_id: self.contact_id,\n location_type_id: self.location_type_id,\n is_primary: self.primary,\n is_billing: false,\n street_address: self.address1,\n street_number: self.street_number,\n supplemental_address_1: self.address2,\n supplemental_address_2: self.address3\n\n )\n # Add county, state, country, and zipcode stuff now\n self.set_location(a)\n end", "def contact\n Zapi::Models::Contact.new\n end", "def contact_create(fields)\n query :contact_create, contact_prepare(fields)\n end", "def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contact_if_missing!\n return true unless contact.blank?\n\n # when creating a contact we should assume we're primary\n self.options.primary = true\n build_contact(create_contact_parameters)\n save\n end", "def create_shared_contact(_entity)\n _contact = SharedContact.create(first_name: first_name, last_name: last_name, company: company,\n fiscal_id: fiscal_id, street_type_id: street_type_id, street_name: street_name,\n street_number: street_number, building: building, floor: floor,\n floor_office: floor_office, zipcode_id: zipcode_id, town_id: town_id,\n province_id: province_id, country_id: country_id, phone: phone,\n extension: _entity.extension, fax: fax, cellular: cellular,\n email: email, shared_contact_type_id: 3, region_id: region_id,\n organization_id: organization_id, created_by: created_by, updated_by: updated_by)\n return _contact\n end", "def create_address(address, profile_id)\n @type = Type::CIM_CREATE_ADDRESS\n @fields.merge!(address.to_hash)\n handle_profile_id(profile_id)\n make_request\n end", "def create_spree_address\n @spree_address = Spree::Address.new(address_attributes)\n @spree_address.save(validate: false)\n end", "def create\n \n # Mass assignment of form fields into Contact object.\n @contact = Contact.new(contact_params)\n \n # Save the contact details into the Database.\n if @contact.save\n # If successful, save into local variables to allow\n # further processing, email.\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n # Plug in the data into the mail message and send\n ContactMailer.contact_email(name, email, body).deliver\n \n # Store success message in flash hash and reset\n # new Contact screen.\n flash[:success] = \"Contact saved.\"\n redirect_to new_contact_path\n else\n # else if contact fails to save,\n # Store reported errors in flash hash and reset\n # new contact screen.\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end", "def create\n @ag_address = Ag::Address.new(ag_address_params)\n\n respond_to do |format|\n if @ag_address.save\n format.html { redirect_to @ag_address, notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @ag_address }\n else\n format.html { render :new }\n format.json { render json: @ag_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to root_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@contact = Contact.new\n\t\t@contact.contact_phone_numbers.build\n\t\t@contact.contact_addresses.build\n\tend", "def create_address(order_or_user, expect_success, values, type=nil)\n visit_addresses(order_or_user)\n\n expect(page).to have_css('#new_address_link')\n click_link 'new_address_link'\n expect(current_path).to eq(spree.new_admin_address_path)\n\n fill_in_address(values, type)\n\n click_button Spree.t('actions.create')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_created, resource: Spree::Address.model_name.human))\n else\n expect(path_with_query).to eq(spree.admin_addresses_path(user_id: @user_id, order_id: @order_id))\n expect(page).to have_no_content(Spree.t(:successfully_created, resource: Spree::Address.model_name.human))\n end\n end", "def create\n @organization_contact = OrganizationContact.new(params[:organization_contact])\n if params[:id][:org_id].empty?\n @organization_contact.organization_id = params[:organization_contact][:organization_id]\n else\n @organization_contact.organization_id = params[:id][:org_id]\n end \n\n respond_to do |format|\n if @organization_contact.save && params[:id][:org_id].present?\n format.html { redirect_to organization_contacts_path(:org_id => params[:id][:org_id]), notice: 'Organization contact was successfully created.' }\n format.json { render json: @organization_contact, status: :created, location: @customer_contact }\n elsif @organization_contact.save\n format.html { redirect_to organizations_path, notice: 'Organization contact was successfully created.' }\n format.json { render json: @organization_contact, status: :created, location: @customer_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def call\n begin\n context[:organization_addresses].each do |address|\n address = context.organization.organization_addresses.new(\n city: address[:city],\n street: address[:street],\n house_number: address[:house_number],\n phone: address[:phone])\n address.save\n end\n rescue => e\n context.fail!(message: e)\n end\n end", "def contact_create(contact)\n super # placeholder so that I can add some doc\n end", "def contact_create(contact)\n super # placeholder so that I can add some doc\n end", "def create_address(params)\n EasyPost::Address.create(params)\n end", "def save\n # can put other business rules here to notify other users etc or start background processes\n # to handle new contact saves\n contact.addresses = self.addresses\n # can get rid of bang, depends on how we want to bubble up exceptions\n contact.save!\n contact\n end", "def create\n\t\t@contact = Contact.new(contact_params)\n\n\t\trespond_to do |format|\n\t\t\tif @contact.save\n\t\t\t\tformat.html { redirect_to user_contacts_path, notice: 'Contact was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @contact }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render json: @contact.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n if get_case\n @contact = @case.contacts.create(contact_params)\n path_contacts = case_contacts_path\n else\n @contact = Contact.new(contact_params)\n path_contacts = contacts_path\n end\n\n # TODO: render partials per each type\n\n @contact.user = @user\n @contact.firm = @firm\n\n if @contact.type != 'Attorney'\n @contact.attorney_type = ''\n end\n\n #@case.contacts << @contact\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to path_contacts, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, contact: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n raise 'must call contact.create(params) before save' unless @person\n raise 'must set email address for unique checking before save' unless @email\n if @email\n raise \"#{@email} already exists!\" unless self.by_email(@email).nil?\n end\n self.contact = @nimble.post 'contact', @person\n return nil unless self.contact\n self\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_address\n\t\t@address = Contact.find(params[:contact_id]).address\n\tend", "def create\n @contact = Contacts::Person.new(contacts_person_params.merge(user: current_user))\n company = Contacts::Company.new(contacts_company_params.merge(user: current_user)) if params[:contacts_company]\n @contact.company = company if @contact.company.nil? && !company.nil? && company.valid?\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: t('controllers.contacts.people.create.success') }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_contact\n @contact=Contact.new()\n end", "def org_address=(address)\n company.from_address!(address)\n end", "def hard_code_contact(contact_params)\n country = Spree::Country.find_by(iso: 'JP')\n if Spree::Country.find_by(iso: 'JP').nil?\n hard_code_to_create_country('Japan', 'JP', 'JPN', 'Japan', 1, false, false)\n else\n # The zipcode and states should not be required\n country.update_attribute(:zipcode_required, false)\n country.update_attribute(:states_required, false)\n end\n\n # Default the country to be Japan\n @contact.country_id = country.id\n @contact.state_id = 1\n\n # Update attriubte for the firstname\n @contact.firstname = @seller.name if contact_params[:firstname].blank?\n\n # if last name is built\n @contact.lastname = @seller.name if contact_params[:lastname].blank?\n\n # If zipcode is required\n @contact.zipcode = '70000' if contact_params[:zipcode].blank?\n\n # If city is blank, then default set it to japan\n @contact.city = 'Please fill in contact' if contact_params[:city].blank?\n\n # If phone is blank, then set it to 123456\n @contact.phone = '123456' if contact_params[:phone].blank?\n end", "def build_contact(contact = {})\n case contact\n when Contact then contact.gateway = self\n when Hash then contact = Contact.new(contact.merge({:gateway => self}))\n end\n contact\n end", "def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\t@user.accounts.first.contacts << c\n\t\t\t\t@user.accounts.first.save\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend", "def create\n @contact = @current_affiliate_group.contacts.build(params[:contact])\n @contact.issue_status = IssueStatus[:New]\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = 'Your message was successfully sent.'\n format.html { redirect_to(home_path) }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n CSV.foreach('contacts.csv') do |row|\n end\n id=$.\n new_contact = Contact.new(name, email, id)\n full_contact = new_contact.id, new_contact.name, new_contact.email\n CSV.open('contacts.csv', 'a+') do |csv|\n csv << full_contact\n end\n return new_contact\n end", "def create_easypost_address\n EasyPost::Address.create(\n name: full_name,\n street1: street,\n street2: street2,\n city: city,\n state: state,\n zip: postal_code,\n country: 'US',\n verify_strict: ['delivery']\n )\n end", "def address\n load_step # Need to load the account to make the decision\n if AccountType.other_organisation?(@account.account_type)\n # Uses overrides as the address is at address.company not at company\n wizard_address_step(STEPS, address_attribute: :org_address,\n next_step: :address_next_step)\n elsif AccountType.registered_organisation?(@account.account_type)\n wizard_address_step(STEPS, address_not_required: :reg_company_contact_address_yes_no,\n next_step: :address_next_step)\n else # must be individual\n wizard_address_step(STEPS, next_step: :address_next_step)\n end\n end", "def create(name, email, phone_number)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n unless contact_exists?(email)\n contacts = CSV.read(@csvfile)\n new_contact = Contact.new(contacts.length, name, email, phone_number)\n CSV.open(@csvfile, \"ab\") { |csv| csv << [new_contact.name, new_contact.email, new_contact.phone_number] }\n new_contact\n end\n end", "def create\n # contact_params = mass assignment of form fields into contact object\n @contact = Contact.new(contact_params)\n \n # Saves the Contact object to the database\n if @contact.save\n # We need to retrieve info from contact_params\n # This stores form fields via parameters into variables\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n \n # Send an email to the contact email\n ContactMailer.contact_email(name, email, body).deliver\n \n # Display the success message\n flash[:success] = \"Message sent.\"\n \n # Redirect the user back to the contact page\n redirect_to new_contact_path\n else\n # The error messages comes in as an array. \n # We need to join them together and display them\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end", "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account_address = AccountAddress.new(account_address_params)\n\n respond_to do |format|\n if @account_address.save\n format.html { redirect_to @account_address, notice: 'Account address was successfully created.' }\n format.json { render :show, status: :created, location: @account_address }\n else\n format.html { render :new }\n format.json { render json: @account_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def account_address(address_details)\n self.address = Address.new(\n address_line1: address_details[:address_line1], address_line2: address_details[:address_line2],\n address_line3: address_details[:address_line3], address_line4: address_details[:address_line4],\n town: address_details[:address_town_or_city], county: address_details[:address_county_or_region],\n postcode: address_details[:address_postcode_or_zip], country: address_details[:address_country_code]\n )\n end", "def create\n @contact = CompanyContact.new(params[:company_contact])\n if @contact.save\n respond_with @contact, status: :created, location: @contact\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def create_a_new_address(addressable_entity)\n\n addr = Address.new(addressable: addressable_entity,\n city: FFaker::AddressSE.city,\n street_address: FFaker::AddressSE.street_address,\n post_code: FFaker::AddressSE.zip_code,\n region: @regions[FFaker.rand(0..(num_regions - 1))],\n kommun: @kommuns[FFaker.rand(0..(num_kommuns - 1))],\n visibility: 'street_address')\n tell \" Creating a new address: #{addr.street_address} #{addr.city}. (Will geolocate when saving it)\"\n addr.save\n addr\n end", "def create(id, alas = nil)\n contact = contacts[id]\n unless alas.nil? || alas.empty?\n contact.alias = alas\n end # alas.nil? || alas.empty?\n contact\n end", "def create\n @employee_contact = EmployeeContact.new(employee_contact_params)\n\n respond_to do |format|\n if @employee_contact.save\n format.html { redirect_to @employee_contact, notice: 'Employee contact was successfully created.' }\n format.json { render :show, status: :created, location: @employee_contact }\n else\n format.html { render :new }\n format.json { render json: @employee_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy_address_details(mailout_contact, contactinfo)\n #mailout_contact = MailoutContact.new\n \n # as per db schema, the contact info can be empty\n contactinfo.initialize_contactinfo_associated_with_another_contactinfo( contactinfo.default_contactinfo ) unless contactinfo.default_contactinfo.blank?\n\t\n\tif !contactinfo.blank?\n mailout_contact.building = contactinfo.building\n mailout_contact.street = contactinfo.street\n mailout_contact.po_box = contactinfo.po_box\n mailout_contact.locality = contactinfo.locality\n mailout_contact.suburb = contactinfo.suburb\n mailout_contact.postcode = contactinfo.postcode\n mailout_contact.region = contactinfo.region.region_name unless contactinfo.region.blank?\n mailout_contact.country = contactinfo.country.country_name unless contactinfo.country.blank?\n mailout_contact.fax = contactinfo.phone_fax #FIXME add prefix \n mailout_contact.mobile_sms = contactinfo.phone_mobile\n \n # get existent email address to the model\n if contactinfo.email_1 != nil\n mailout_contact.email = contactinfo.email_1\n else\n if contactinfo.email_2 != nil\n mailout_contact.email = contactinfo.email_2\n else\n mailout_contact.email = contactinfo.email_3\n end\n end\n \n # get existent phone to the model\n if contactinfo.phone != nil\n mailout_contact.phone = contactinfo.phone\n else\n mailout_contact.phone = contactinfo.phone_alt\n end\n \n end\n \n mailout_contact.generate_address_lines\n \n return mailout_contact\n \n end", "def create\n @sales_address = Sales::Address.new(sales_address_params)\n\n respond_to do |format|\n if @sales_address.save\n format.html { redirect_to sales_seller_address_path(@sales_seller, @sales_address), notice: \"Endereço adicionado com sucesso!\" }\n format.json { render :show, status: :created, location: @sales_address }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n @address.user = current_user\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_shared_contact(_entity, _supplier)\n _contact = SharedContact.create(first_name: first_name, last_name: last_name, company: _entity.company,\n fiscal_id: fiscal_id, street_type_id: _supplier.street_type_id, street_name: _supplier.street_name,\n street_number: _supplier.street_number, building: _supplier.building, floor: _supplier.floor,\n floor_office: _supplier.floor_office, zipcode_id: _supplier.zipcode_id, town_id: _supplier.town_id,\n province_id: _supplier.province_id, country_id: _supplier.country_id, phone: phone,\n extension: extension, fax: _supplier.fax, cellular: cellular,\n email: email, shared_contact_type_id: 2, region_id: _supplier.region_id,\n organization_id: organization_id, created_by: created_by, updated_by: updated_by,\n position: position)\n return _contact\n end", "def contact\n \t@contact = Contact.new\n end", "def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.save\n\t\tredirect_to root_path\n\tend", "def contact\n @contact ||= OpenStruct.new(get_attr(:contact))\n end", "def create\n @admin_contact = Admin::Contact.new(admin_contact_params)\n\n respond_to do |format|\n if @admin_contact.save\n format.html { redirect_to admin_contacts_path, notice: mk_notice(@admin_contact, :id, 'Contact', :create) }\n format.json { render json: @admin_contact, status: :created, location: admin_contacts_path }\n else\n format.html { render :new }\n format.json { render json: @admin_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contact = Contact.new(params[:contact])\n\n if @contact.save\n flash[:success] = \"Contact was successfully created.\"\n redirect_to crm_path\n else\n render :action => 'new'# Clear page\n end\n end", "def create \n @address = Address.new(address_params)\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = _('Contact was successfully created.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact added\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "def create\n @address_type = AddressType.new(params[:address_type])\n\n respond_to do |format|\n if @address_type.save\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully created.') }\n format.xml { render :xml => @address_type, :status => :created, :location => @address_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_address\n if @ok\n @mailing_list_address = MailingListAddress.new\n @mailing_list_address.group_id = @mailing_list_group.id\n @mailing_list_address.heading = params[:heading]\n @mailing_list_address.email = params[:email]\n @ok = @mailing_list_address.save\n end\n render 'update_addresses'\n end", "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n results = connection.exec(\"SELECT * FROM contacts ORDER BY id DESC LIMIT 1;\")\n results.each do |row|\n each_info = Contact.new(row['name'], row['email'], row['id'])\n puts \"ID #{row['id']}: #{row['name']} #{row['email']}\".blue\n end\n puts \"The contact was created successfully.\".green\n end", "def call(address)\n go_to_form\n fill_form(address)\n get_all_contacts\n end", "def create_contact(folder_id)\n book = find_addressbook(folder_id)\n if book\n book.create_contact()\n end\n end", "def new\n @company = Company.find_or_create_by(name: 'New Company')\n begin\n @company.save!\n rescue\n flash[:error] = \"Company NOT be found or was not created.\"\n nil\n end\n @address = @company.addresses.find_or_create_by( {addressable_type: 'Company', addressable_id: @company.id} )\n @address.save!\n end", "def create\n Rails.logger.info \"Completed in #{contact_params}\"\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # updating the @contact instance variable with the entered parameters (each user's information) to be saved to the db\n # 'contact_params' is a method that is called (outlined below) that says that we will securely save the entered data into the db\n # AKA: Mass assignment of form fields into Contact object\n @contact = Contact.new(contact_params)\n \n # Save the Contact object to the database\n if @contact.save\n # In order to send the ContactMailer email, we need to lift the parameter values for our instance variables from the params hash\n # From the private function below, we are grabbing :name, :email, and :comments (renamed to body) from the :contact KEY to use in our 'contact_email' method\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n \n # Calls the 'contact_email' method from the contact_mailer.rb file with the above variables, and .deliver it\n ContactMailer.contact_email(name, email, body).deliver\n \n # Setting a specific message (flash) into a hash when the submission was successful\n flash[:success] = [\"Submission Successful\"]\n redirect_to new_contact_path\n else\n # Setting up the flash hash to show any errors that are incurred by concatenating them with a ', '\n # 'errors' method generates raw errors to be displayed when the '@contact.save' method was not successful\n # 'full_messages' method creates nice error messages from the raw 'errors' method that can then be joined\n flash[:danger] = @contact.errors.full_messages\n redirect_to new_contact_path\n end\n end", "def create_contact(name, telephone, email)\n\tcontact_list = {\n\t\tname: name,\n\t\ttelephone: telephone,\n\t\temail: email\n\t}\n\tcontacts = []\n\tcontacts << contact_list\nend", "def create_contact(list_id, contact_base_extra_post, opts = {})\n data, _status_code, _headers = create_contact_with_http_info(list_id, contact_base_extra_post, opts)\n data\n end", "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def blank_contact\n person = ABPerson.new\n person.initWithAddressBook(@ab)\n Macabee::Contact.new(person, :macabee => self)\n end", "def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end", "def create\n # Contact object is re-assigning to the fields\n # Mass assigment of form fields into Contact object\n @contact = Contact.new(contact_params)\n # Save the Contact object to the database\n if @contact.save\n # If the save is successful\n # Grab the name, email, and comments from the parameters\n # and store them in these variables\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n # Plug variables into Contact Mailer email method and send email\n ContactMailer.contact_email(name, email, body).deliver\n # Store success message in flash hash and redirect to new action\n flash[:success] = \"Message sent.\"\n redirect_to new_contact_path\n else\n # If Contact object doesnt save, store errors in flash hash\n # and redirect to new action\n # Errors will be in an array format\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end", "def create\n\t\t@address = current_user.addresses.new(address_params)\n\t\t@earring = Earring.find(@address.detail.earring_id)\n\n\t\trespond_to do |format|\n\t\t\tif @address.save\n\t\t\t\tformat.html { redirect_to \"/confirm\" }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @address }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to \"/addresses/new?d=#{@address.detail.id}\" }\n\t\t\t\tformat.json { render json: @address.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new_address\n scope = current_user && current_user.addresses || Address\n @new_address ||= scope.find_or_create_by(\n address: params[:address],\n city: City.find_or_create_by(name: city)\n )\n end", "def create\n\t\t@contact = Contact.new(contact_params)\n\t\tif @contact.save\n\t\t\tname = params[:contact][:name]\n\t\t\temail = params[:contact][:email]\n\t\t\tcomment = params[:contact][:comments]\n\t\t\tContactMailer.contact_email(name, email, comment).deliver\n\t\t\tflash[:success] = \"Successfully sent message!\"\n\t\t\tredirect_to new_contact_path\n\t\telse\n\t\t\tflash[:danger] = @contact.errors.full_messages.join(\", \")\n\t\t\tredirect_to new_contact_path\n\t\tend\n\tend", "def create\n @customer_address = CustomerAddress.new(customer_address_params)\n\n respond_to do |format|\n if @customer_address.save\n format.html { redirect_to @customer_address, notice: 'Customer address was successfully created.' }\n format.json { render :show, status: :created, location: @customer_address }\n else\n format.html { render :new }\n format.json { render json: @customer_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n CSV.open(FILE, 'a') << [name, email]\n Contact.new(name,email,Contact.all.length + 1)\n end", "def build_address(address)\n {\n receiver: address.full_name,\n email: order.email,\n phoneNumber: address.phone,\n route: address.address1,\n street_number: address.address1.scan(/\\d+/).first,\n internalNumber: address.address2.scan(/\\d+/).first,\n neighborhood: address.address2,\n locality: address.address3,\n postal_code: address.zipcode,\n subLocality: address.city,\n state: address.state.name,\n country: address.country.name,\n }\n end", "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(admin_contacts_url :notice => 'Contact was successfully created.') }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_internet_address (contact_id, params)\n update_internet_address(contact_id, 0, params)\n end", "def create\n @customers_address = CustomersAddress.new(params[:customers_address])\n\n respond_to do |format|\n if @customers_address.save\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully created.' }\n format.json { render json: @customers_address, status: :created, location: @customers_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7105798", "0.69384605", "0.6922415", "0.6889101", "0.6816222", "0.6775892", "0.6737944", "0.6659742", "0.6481586", "0.6474424", "0.64424914", "0.64314663", "0.64115256", "0.6391827", "0.6377442", "0.6361627", "0.63493", "0.6307078", "0.6256583", "0.62469727", "0.6197479", "0.6181648", "0.61763537", "0.6164749", "0.60962003", "0.6052059", "0.6046164", "0.6044785", "0.6044167", "0.60153365", "0.6014501", "0.6010055", "0.59765136", "0.59589595", "0.5940776", "0.5924823", "0.58846015", "0.58846015", "0.5877964", "0.5872519", "0.5872319", "0.58675987", "0.5855786", "0.585289", "0.5836125", "0.5815648", "0.58105", "0.5798181", "0.5785354", "0.5784957", "0.5780441", "0.5773376", "0.5761756", "0.5757706", "0.5757317", "0.5755818", "0.5754825", "0.5746973", "0.5746973", "0.57396144", "0.57293695", "0.5719538", "0.571392", "0.5713288", "0.57111347", "0.57111186", "0.5708538", "0.57059777", "0.570507", "0.568544", "0.5683194", "0.56791925", "0.567898", "0.56763446", "0.56757915", "0.5672139", "0.56567", "0.56482387", "0.5644712", "0.56433773", "0.56385887", "0.56381327", "0.56372064", "0.5631401", "0.56313896", "0.5631068", "0.56289524", "0.5625748", "0.56255025", "0.56230664", "0.5619036", "0.5616864", "0.56133056", "0.56085837", "0.5605134", "0.5605044", "0.55969554", "0.5595285", "0.55945665", "0.5594105" ]
0.6090641
25
Creates a Zipcode Territory if one does not already exist. A zipcode territory is the first 2 digits of the zipcode for the firm. It then assigns the organization to the territory It then checks all the fields, if any are blank, it registers as an incomplete profile.
def process_before_save zipcode = organization_zipcode.split('')[0..1].join('') if organization_zipcode.present? teriitory = Territory.find_by_territory_identifier(zipcode) unless teriitory teriitory = Territory.new(territory_identifier: zipcode) teriitory.save end self.territory = teriitory if CommonActions.nil_or_blank(organization_name) || CommonActions.nil_or_blank(organization_short_name) || CommonActions.nil_or_blank(organization_description) || CommonActions.nil_or_blank(organization_address_1) || CommonActions.nil_or_blank(organization_city) || CommonActions.nil_or_blank(organization_state) || CommonActions.nil_or_blank(organization_zipcode) || CommonActions.nil_or_blank(organization_telephone) || CommonActions.nil_or_blank(organization_website) || (contact_type.type_value == 'fax' ? CommonActions.nil_or_blank(organization_fax) : CommonActions.nil_or_blank(organization_email)) || (organization_type.type_value == 'customer' ? (customer_quality.nil? || min_vendor_quality.nil?) : false) || (organization_type.type_value == 'vendor' ? vendor_quality.nil? : false) self.organization_complete = false else self.organization_complete = true end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_postal_code\n @postal_code = Faker::Address.zip_code(state_abbreviation: @state)\n @postal_code = '' unless @set_blank == false\n end", "def hard_code_to_create_country(iso_name, iso, iso3, name, numcode, states_required, zipcode_required)\n @country = Spree::Country.create(iso_name: iso_name, iso: iso, iso3: iso3, name: name, numcode: numcode, states_required: states_required, zipcode_required: zipcode_required)\n if @country.save\n puts 'Successful!'\n else\n puts @country.errors.full_messages\n end\n end", "def create\n @address = current_customer.addresses.build(\n province: Province.find(params[:province_id].to_i),\n country_code: params[:country_code],\n is_primary_address: address_params[:is_primary_address].to_i == 1,\n address_line_one: address_params[:address_line_one],\n address_line_two: address_params[:address_line_two],\n address_additional: address_params[:address_additional],\n city: address_params[:city],\n postal_code: address_params[:postal_code]\n )\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: \"Address was successfully created.\" }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zip_code_area_code = ZipCodeAreaCode.new(zip_code_area_code_params)\n\n respond_to do |format|\n if @zip_code_area_code.save\n format.html { redirect_to @zip_code_area_code, notice: 'Zip code area code was successfully created.' }\n format.json { render :show, status: :created, location: @zip_code_area_code }\n else\n format.html { render :new }\n format.json { render json: @zip_code_area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def zip_code\n Faker::Address.zip\n end", "def zip_code\n Faker::Address.zip\n end", "def set_location(civicrm_model)\n # Split in case suffix is in postal code\n if self.postal_code.present?\n zip = self.postal_code.split('-')[0]\n alf_zip = ALF::Zipcode.where('ZIP', zip).first\n end\n\n # Set country based on\n country = CIVICRM::Country.where(iso_code: self.country).take\n\n # If zip is found use to populate civicrm model\n if alf_zip.present?\n civicrm_model.city = alf_zip.City\n\n # Get the state from CIVICRM\n state = CIVICRM::StateProvince.where(abbreviation: alf_zip.State).take\n # IF state then add\n if state.present?\n civicrm_model.state_province_id = state.id\n # set country in case it is in F1 wrong\n country = CIVICRM::Country.where(id: state.country_id).take\n # Otherwise try to create a state\n else\n # Cannot create without a country\n if country.present?\n state = CIVICRM::StateProvince.new(name: alf_zip.State, abbreviation: alf_zip.State, country_id: country.id)\n # If this state is saved then set it to MODEL\n if state.valid? && state.save\n civicrm_model.state_province_id = state.id\n end\n end\n end\n\n # Get the county from CIVICRM (after state since we need state)\n county = CIVICRM::County.where('lower(name) = ?', alf_zip.County.downcase).take\n # If county then add\n if county.present?\n civicrm_model.county_id = county.id\n # Otherwise try to create the county\n else\n # Cannot create without a state\n if state.present?\n county = CIVICRM::County.new(name: alf_zip.County, state_province_id: state.id)\n if county.valid? && county.save\n civicrm_model.county_id = county.id\n end\n end\n end\n\n # Set country\n if country.present?\n civicrm_model.country_id = country.id\n end\n\n # IF an ALF zipcode model is not found\n else\n # check for state from f1 address model\n state = CIVICRM::StateProvince.where(abbreviation: self.st_province).take\n if state.present?\n civicrm_model.state_province_id = state.id\n end\n\n # check for county from f1 address model\n county = CIVICRM::StateProvince.where(abbreviation: self.county).take\n if county.present?\n civicrm_model.county_id = county.id\n end\n\n # Add country if found\n if country.present?\n civicrm_model.country_id = country.id\n end\n\n end\n\n # Set zip codes\n if self.postal_code.present?\n civicrm_model.postal_code = self.postal_code.split('-')[0]\n civicrm_model.postal_code_suffix = self.postal_code.split('-')[1]\n end\n\n civicrm_model\n end", "def set_TerritoryID(value)\n set_input(\"TerritoryID\", value)\n end", "def set_TerritoryID(value)\n set_input(\"TerritoryID\", value)\n end", "def set_TerritoryID(value)\n set_input(\"TerritoryID\", value)\n end", "def validate_zip_or_state\n # check format of zip and state\n enough = false\n if zip.present? && ::Geocode::ZipCode.is_valid_usa_zip_code?(zip)\n #\n enough = true\n elsif state.present?\n if ::Geocode::State::USA_STATE_CODES_TO_NAMES_MAP.include?(state.strip.upcase)\n enough = true\n else\n self.errors.add(:state, \"Invalid State\")\n end\n end\n unless enough\n self.errors.add(:zip, \"Required to set either State or Zip Code\")\n end\n end", "def create\n @branch = Branch.new(\n branch_params.merge(\n head_office_id: (Branch.find_by_username(params[:branch2]).id rescue nil),\n code: (\"#{('%03d' % ((Branch.last.code.gsub('M', '').to_i rescue 0)+1))}\")\n )\n )\n @head_offices = HeadOffice.all\n @users = User.joins(:role).limit(7).map{|user|[user.username, user.id]}\n if @branch.save\n flash[:notice] = 'Store successfully created'\n redirect_to branches_path\n else\n @head_offices = HeadOffice.all\n @regionals = Regional.all\n @users = User.joins(:role).limit(7).map{|user|[user.username, user.id]}\n load_departments\n flash[:error] = @branch.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end", "def create\n\t\t@bank_account = BankAccount.new(bank_account_params)\n\t\t@bank_account.last4 = @bank_account.account_number.to_s.split(//).last(4).join(\"\").to_s\n\t\t#Check if the user has entered a correct US postal code\n\t\tcheck_us_postal_code_and_create_bank_account\n\trescue\n\t \tflash[:error] = t('errors.messages.not_saved')\n\t \tredirect_to(:back)\t\t\n\tend", "def assign_areas(options={})\n options = {\n }.merge(options)\n\n # assign zip codes to areas\n @area_zips = {\n # Part of Austin\n :south => 0, # south of the river\n :central => 0, # near church, downtown\n :north => 0, # north 183N not quite out of town yet\n :northwest => 0, # cedar park, lake travis\n\n # Austin Outskirts\n :waynorth => 0, # pflugerville, round rock, georgetown\n :east => 0, # manor, elgin, hutto\n\n # Outside Austin\n :texas => 0, # outside austin area but still in Texas\n :outside_texas => 0, # outside Texas\n\n # Debug / Error checking\n :austin => 0, # for error checking / debug\n :other => 0, # for error checking / debug\n }\n\n @final_data.each_index do |i|\n record = @final_data[i]\n\n if record[:state] == 'TX'\n @final_data[i][:area] = :texas # Folks outside any of the cities below but still in Texas\n \n if record[:city] == 'Austin' # Folks in Austin\n @final_data[i][:area] = :austin # Don't want any left in Austin :area, all should here be assigned to a zip code below!\n case @final_data[i][:zip]\n when '78749','78739','78735','78736','78737','78745','78748','78704','78744','78747','78742','78746','78738','78733'\n @final_data[i][:area] = :south\n when '78703','78705','78751','78701','78712','78751','78756','78702','78731','78752','78767'\n @final_data[i][:area] = :central\n when '78758','78757','78759','78753','78729','78708','78727'\n @final_data[i][:area] = :north\n when '78717','78726','78730','78732','78750'\n @final_data[i][:area] = :northwest\n when '78725','78724','78754','78723','78741'\n @final_data[i][:area] = :east\n when '78728'\n @final_data[i][:area] = :waynorth\n end\n # cities near to Austin\n elsif record[:city] == 'Del valle'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Manchaca'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Buda'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Lockhart'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Kyle'\n @final_data[i][:area] = :south\n elsif record[:city] == 'San marcos'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Pflugerville'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Granger'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Round rock'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Georgetown'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Manor'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Webberville'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Elgin'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Bastrop'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Cedar park'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Hutto'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Lake travis'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lago vista'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lakeway'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Leander'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Spicewood'\n @final_data[i][:area] = :northwest\n end\n\n else # Folks outside of Texas (poor souls!)\n @final_data[i][:area] = :outside_texas\n end\n end\n \n \nend", "def create\n check_privileges(:superadmin?, organisations_path); return if performed?\n @organisation = Organisation.new(organisation_params)\n @organisation.check_geocode\n rendering('Organisation was successfully created.', 'new')\n end", "def make_municipalities\n Municipality.delete_all\n\n # STATES hash constant from environment.rb\n Constants::STATES.each do |state|\n make_municipalities_for_state(state)\n end\n\n #\n # Correct municipality slug names\n #\n\n # Vermont:\n # http://www.vt251.com/vt/town_links.php\n # http://www.census.gov/geo/www/maps/DC10_GUBlkMap/cousub/dc10blk_st50_cousub.html\n municipality = Municipality.find_by_slug('alburg-vt')\n municipality.name = 'Alburgh'\n municipality.slug = 'alburgh-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001161675')\n municipality.name = 'St. Albans City'\n municipality.slug = 'st-albans-city-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001161750')\n municipality.name = 'St. Albans Town'\n municipality.slug = 'st-albans-town-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001948850')\n municipality.name = 'Newport City'\n municipality.slug = 'newport-city-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001948925')\n municipality.name = 'Newport Town'\n municipality.slug = 'newport-town-vt'\n municipality.save!\n end", "def zip_code(restrictions={state: [], zip_code: []})\n zip_code = nil\n state = restrictions[:state].is_a?(Array) and !restrictions[:state].blank? ? restrictions[:state] : []\n zip_codes = restrictions[:zip_code].is_a?(Array) and !restrictions[:zip_code].blank? ? restrictions[:zip_code] : []\n\n unless @config[:location_db][:adapter].eql?(:none)\n zip_code = find_location(state, zip_codes)[\"#{@config[:location_db][:column_mapping][:zip_code]}\"]\n end\n\n zip_code = Faker::Address.zip_code if zip_code.blank?\n\n zip_code\n end", "def set_zip_code_area_code\n @zip_code_area_code = ZipCodeAreaCode.find(params[:id])\n end", "def set_postal_address\n\n\tpostal_address = PostalAddress.find_by_postal_address_type_code_and_city_and_address1_and_address2(self.postal_address_type_code,self.city,self.address1,self.address2)\n\t if postal_address != nil \n\t\t self.postal_address = postal_address\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'postal_address_type_code' and 'city' and 'address1' and 'address2' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def create\n @params = profile_params\n if @params[\"country\"]\n @params[\"country\"] = CS.get[profile_params[:country].to_sym]\n end\n if @params[\"state\"].size==2\n @states = CS.get profile_params[:country].to_sym\n @params[\"state\"] = @states[profile_params[:state].to_sym]\n end\n\n if current_user.profile #if Profile already exists\n @profile = current_user.profile\n @projects = @profile.projects\n if !params[\"edit-profile-languages\"].empty?\n @lan_array = JSON.parse(params[\"edit-profile-languages\"])\n @params[\"languages\"] = @lan_array\n end\n if !@profile.profile_photo.nil? & params[\"profile_photo\"].empty?\n @params[\"profile_photo\"] = @profile.profile_photo\n else\n @params[\"profile_photo\"] = params[\"profile_photo\"].empty? ? nil : params[\"profile_photo\"]\n end\n if !@profile.banner_photo.nil? & params[\"banner_photo\"].empty?\n @params[\"banner_photo\"] = @profile.banner_photo\n else\n @params[\"banner_photo\"] = params[\"banner_photo\"].empty? ? nil : params[\"banner_photo\"]\n end\n\n respond_to do |format|\n if @profile.update(@params)\n format.html { redirect_to profiles_path, 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 else\n if(params[:first_signup] == \"true\")\n @user = current_user\n @profile = Profile.new() #create new Profile\n @user.profile = @profile\n @lan_array = JSON.parse(params[\"languages\"])\n @params[\"languages\"] = @lan_array\n coordinates = Geocoder.search(profile_params[:city]).first.coordinates\n latitude = coordinates[0]\n longitude = coordinates[1]\n @params[\"time_zone\"] = Timezone.lookup(latitude,longitude).name\n\n respond_to do |format|\n if @profile.update(@params)\n format.html { redirect_to '/profile/explores', 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\n end\nend", "def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end", "def zipcode\n return poi.zip unless poi.nil?\n return place.zip unless place.nil?\n return get_zipcode\n end", "def create\n\t\tapi_response = FaxNumber.provision(provision_number_params[:area_code])\n\t\tif api_response.phone_number\n\t\t\tFaxNumber.create!(fax_number: api_response.phone_number, has_webhook_url: false, org_switched_at: Time.now)\n\t\t\tflash[:notice] = \"Fax number provisioned successfully. Your new number is #{FaxNumber.format_pretty_fax_number(api_response.phone_number)}.\"\n\n\t\t\t# Adds fax number to the organization immediately \n\t\t\tif provision_number_params[:organization_id]\n\t\t\t\tnumber = FaxNumber.find_by(fax_number: api_response.phone_number)\n\t\t\t\tnumber.update_attributes(organization_id: provision_number_params[:organization_id])\n\t\t\t\tredirect_to organization_path(provision_number_params[:organization_id])\n\t\t\telse\n\t\t\t\tredirect_to fax_numbers_path\n\t\t\tend\n\t\telse\n\t\t\tflash[:alert] = \"Something went wrong\"\n\t\t\trender :new\n\t\tend\n\tend", "def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end", "def update_address\n address_zip = ZipCodes.identify(zip_code) || {}\n self.city = address_zip[:city]\n self.state = address_zip[:state_name]\n self.state_code = address_zip[:state_code]\n end", "def set_Zipcode(value)\n set_input(\"Zipcode\", value)\n end", "def new_input_set()\n return GetTerritoryIDFromZipcodeInputSet.new()\n end", "def zip_postal_code_field\n $tracer.trace(__method__)\n #unit_test_no_generate: zip_postal_code_field, input.id(\"PostalCode\")\n return ToolTag.new(input.id(\"PostalCode\"), __method__, self)\n end", "def create\n @taddress = Taddress.new(params[:taddress])\n \n respond_to do |format|\n if @taddress.save\n format.html { redirect_to @taddress, notice: 'Taddress was successfully created.' }\n format.json { render json: @taddress, status: :created, location: @taddress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taddress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n @current_address = CurrentAddress.new(params[:current_address]) \n @countries = CmtGeo.all_countries\n @states = CmtGeo.all_states\n\n respond_to do |format|\n # If we don't have a valid person and valid address, get out now\n if @person.valid? && @current_address.valid?\n @person, @current_address = add_person(@person, @current_address, params)\n # if we don't have a good username, Raise an error\n # Since we require a unique email address, we should never get here. \n unless @person.user \n raise \"Duplicate email address error. Couldn't create a user for:\" + @person.inspect\n end\n \n if @ministry\n ministry_role = MinistryRole.find params[:ministry_involvement][:ministry_role_id]\n @staff_role = ministry_role.is_a?(StaffRole)\n @student_role = ministry_role.is_a?(StudentRole)\n\n # add the person to this ministry if they aren't already\n if @student_role\n @ci = @person.add_or_update_campus params[:campus_involvement][:campus_id], \n params[:campus_involvement][:school_year_id],\n @ministry.id,\n @me\n\n # If this is an Involved Student record that has plain_password value, \n # this is a new user who should be notified of the account creation\n if @person.user.plain_password.present? && is_involved_somewhere(@person)\n UserMailer.deliver_created_student(@person, @ministry, @me, @person.user.plain_password)\n end\n end\n\n # create ministry involvement if it doesn't already exist\n @mi = @person.add_or_update_ministry(@ministry.id, params[:ministry_involvement][:ministry_role_id])\n end\n \n # The person MUST have a user record\n if @person.user && @person.user.save && (@staff_role || (@ci && @ci.valid?)) && @mi.valid?\n @success = true\n format.html { redirect_to person_path(@person) }\n format.js\n format.xml { head :created, :location => person_path(@person) }\n else\n @user = @person.user\n render_new_from_create(format)\n end\n else\n render_new_from_create(format)\n end\n end\n end", "def create\n @tax_code = TaxCode.new(tax_code_params)\n @tax_code.organization = current_organization\n respond_to do |format|\n if @tax_code.save\n format.html { redirect_to tax_codes_url, notice: 'tax code period was successfully created.' }\n else\n @accounting_periods = current_organization.accounting_periods.where('active = ?', true)\n flash.now[:danger] = \"#{t(:failed_to_create)} #{t(:tax_code)}\"\n format.html { render action: 'new' }\n end\n end\n end", "def city_id_by_zipcode(zipcode)\n zipcode = canonical_zipcode(zipcode)\n return unless valid_zipcode?(zipcode)\n\n @city_id_by_zipcode[zipcode] ||= begin\n hash = info_by_zipcode(zipcode)\n city = canonical_city(hash[\"city\"])\n pref = canonical_pref(hash[\"state\"])\n city_id_by_area(city, pref).to_i\n end\n end", "def create_account(account_number)\n begin\n #if account does not exist, a NotFound Error will be thrown\n accountNumber = account_number\n\n puts \"Creating new account with account number: #{accountNumber}\"\n\n account = Recurly::Account.create(\n :account_code => accountNumber,\n :email => 'verena@example.com',\n :first_name => 'Verena',\n :last_name => 'Example',\n :shipping_addresses => [\n {\n :nickname => 'Work',\n :first_name => 'Verena',\n :last_name => 'Example',\n :company => 'Recurly Inc',\n :phone => '555-222-1212',\n :email => 'verena@example.com',\n :address1 => '123 Main St.',\n :address2 => 'Suite 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n },\n {\n :nickname => 'Home',\n :first_name => 'Verena',\n :last_name => 'Example',\n :phone => '555-867-5309',\n :email => 'verena@example.com',\n :address1 => '123 Fourth St.',\n :address2 => 'Apt. 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n }\n ]\n )\n\n account = Recurly::Account.find(accountNumber)\n account.billing_info = {\n :first_name => 'Verena',\n :last_name => 'Example',\n :number => '4111-1111-1111-1111',\n :verification_value => '123',\n :month => 11,\n :year => 2019,\n :address1 => '1234 fake st',\n :city => 'Omaha',\n :state => 'NE',\n :zip => '68135',\n :country => 'US'\n\n }\n account.billing_info.save!\n\n #output account to make sure it saved with billing_info\n #account = Recurly::Account.find accountNumber\n #puts \"Account: #{account.inspect}\"\n\n rescue Recurly::Resource::NotFound => e\n puts e.message\n rescue Recurly::API::UnprocessableEntity => e\n puts e.message\n end\n\n end", "def build_and_create_address\n\t\tbegin\n\t\t\t@address = Address.new(\n\t\t\t\tstreet_address: params[:address][:street_address],\n\t\t\t\textended_address: params[:address][:extended_address],\n\t\t\t\tlocality: params[:address][:locality],\n\t\t\t\tregion: params[:address][:region],\n\t\t\t\tpostal_code: params[:address][:postal_code],\n\t\t\t\tphone: params[:address][:phone],\n\t\t\t\temail: params[:address][:email]\n\t\t\t\t)\n\n\t\t\tunless @address.save\n\t\t\t\trender status: 422, json: {\n error: \"Could not create address\"\n }\n end\n rescue ActiveRecord::ActiveRecordError\n render status: 422, json: {\n error: \"Could not create address\"\n }\n end\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_zip_code\n @zip_code = ZipCode.find(params[:id])\n end", "def store_pickup_zipcode_field\n $tracer.trace(__method__)\n #unit_test_no_generate: store_pickup_zipcode_field, input.className(create_ats_regex_string(\"ats-InStorePickupZipcode\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-InStorePickupZipcode\")), __method__, self)\n end", "def check_aoa_zip\n @counseling = update_counseling(counseling_params)\n\n @states = CounselAssistance.states\n @ask_aoa = [\n EMP_TYPE[:company],\n EMP_TYPE[:railroad],\n EMP_TYPE[:religious],\n EMP_TYPE[:federal],\n EMP_TYPE[:military],\n EMP_TYPE[:unknown],\n EMP_TYPE[:farm_credit]\n ].include?(@counseling.employer_type_id)\n\n if !@counseling.valid?\n @show_aoa_expansion = false\n elsif @counseling.aoa_coverage.empty? && @ask_aoa &&\n (@counseling.hq_state_abbrev.blank? || @counseling.pension_state_abbrev.blank? || @counseling.work_state_abbrev.blank?)\n @aoa_states = @counseling.aoa_covered_states\n @show_aoa_expansion = true\n\n if @counseling.step == \"2a\"\n @counseling.errors.add(:work_state_abbrev, \"is required\") if @counseling.work_state_abbrev.blank?\n @counseling.errors.add(:hq_state_abbrev, \"is required\") if @counseling.hq_state_abbrev.blank?\n @counseling.errors.add(:pension_state_abbrev, \"is required\") if @counseling.pension_state_abbrev.blank?\n end\n\n @counseling.step = \"2a\"\n else # good zip with AoA coverage, or good zip but no need to ask AoA questions\n if @counseling.aoa_coverage.empty?\n # clear out extra state dropdowns, as we won't consider them in this case\n @counseling.hq_state_abbrev = @counseling.pension_state_abbrev = nil\n\n # but preserve work_state if user is state/county/local employee\n unless [EMP_TYPE[:state], EMP_TYPE[:county], EMP_TYPE[:city]].include?(@counseling.employer_type_id)\n @counseling.work_state_abbrev = nil\n end\n end\n @show_aoa_expansion = false\n update_session\n redirect_to(:action => :step_3) and return\n end\n\n @previous_to = \"/help/step_2\"\n update_session\n render :action => :step_2\n end", "def create\n @address = Address.create!(params[:address])\n @organization = Organization.new(params[:organization])\n @organization.address = @address\n \n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_code = PostCode.new(params[:post_code])\n @towns = Town.find :all \n @geo_positions = GeoPosition.find :all\n \n respond_to do |format|\n if @post_code.save\n flash[:notice] = 'PostCode was successfully created.'\n format.html { redirect_to(@post_code) }\n format.xml { render :xml => @post_code, :status => :created, :location => @post_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def set_ZipCode(value)\n set_input(\"ZipCode\", value)\n end", "def create_org_member\n @organization = Organization.find(params[:organization_id].to_i)\n @email = params[:email]\n\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @pw = params[:password]\n @pw_confirmation = params[:password_confirmation]\n\n # TODO check if authtoken is in sess variable\n # If so, only update user password\n \n # Allocate User account, dashboard, and profile \n @user = User.create(\n email: @email,\n password: @pw,\n password_confirmation: @pw_confirmation,\n organization: @organization\n )\n if @user\n Dashboard.create(\n lead_email: @email, \n lead_name: \"#{@first_name} #{@last_name}\",\n user: @user\n )\n\n profile = Profile.find_or_create_by!(email: @email) do |profile|\n profile.first_name = @first_name\n profile.last_name = @last_name\n profile.dashboard_registered = true\n end\n\n profile.update(user: @user)\n\n # Create zoho lead record\n if !@orgnization.nil? && @organization.name != 'test'\n ZohoService.save_to_zoho(profile)\n end\n\n #sign in newly created user\n sign_in(@user, scope: :user)\n # Setting up alias to map user id to mixapanel unique id. So we can use userid moving forward\n mixpanel_distinct_id = params[:distinct_id]\n @tracker.alias(@user.id,mixpanel_distinct_id)\n @tracker.people.set(@user.id,{\n '$first_name' => @user.profile.first_name,\n '$last_name' => @user.profile.last_name,\n '$email' => @user.email,\n '$phone' => @user.profile.phone\n },@user.current_sign_in_ip.to_s)\n @tracker.track(@user.id,'User account created for org. member')\n\n # flash[:notice] = 'Welcome to MyDomino!'\n \n render json: {\n message: 'User added',\n status: 200\n }, status: 200\n else\n render json: {\n message: 'Error adding user',\n status: 400\n }, status: 400\n end\n end", "def test_create_user_personality_profile\n @user.personality_profile = PersonalityProfile.new\n end", "def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n Hyrax::Workflow::WorkflowImporter.load_workflows\n end\n end", "def adopt_fund_tier_assignment\n return true if fund_tier_assignment || ( self.fund_tier_assignment =\n fund_source.fund_tier_assignments.\n where( organization_id: organization_id ).first ) ||\n fund_source.fund_tiers.empty?\n create_fund_tier_assignment do |assignment|\n assignment.fund_source = fund_source\n assignment.organization = organization\n assignment.fund_tier = fund_source.fund_tiers.first\n end\n end", "def set_OriginZipCode(value)\n set_input(\"OriginZipCode\", value)\n end", "def create\n @admin_allowed_zip_code = AllowedZipCode.new(admin_allowed_zip_code_params)\n\n respond_to do |format|\n if @admin_allowed_zip_code.save\n format.html { redirect_to new_admin_allowed_zip_code_path, notice: 'Allowed zip code was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_allowed_zip_code] }\n else\n format.html { render :new }\n format.json { render json: @admin_allowed_zip_code.errors, status: :unprocessable_entity }\n end\n end\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 create_org(orgname)\n payload = {\n \"name\" => orgname,\n \"full_name\" => orgname,\n \"org_type\" => \"Business\"\n }\n puts \"Creating org #{orgname}\"\n\n MAX_ATTEMPTS.times do |attempt|\n r = post(\"#{@server}/organizations\", superuser, :payload => payload)\n\n case r.code\n when 201, 200\n parsed = parse(r)\n validator_name = parsed[\"clientname\"]\n validator_key = parsed[\"private_key\"]\n\n validator = Pedant::Client.new(validator_name, validator_key)\n return Pedant::Organization.new(orgname, validator)\n when 503\n # Continue attempting by allowing the loop to continue\n puts \"Failed attempting to contact #{@server} (#{attempt}/#{MAX_ATTEMPTS})\"\n else\n raise \"Bad error code #{r.code} from create org: #{r}\"\n end\n\n end\n raise \"Failed attempting to contact #{@server} #{MAX_ATTEMPTS} times\"\n end", "def create_organisation(attributes = {})\n if attributes.empty?\n y = YAML.load_file(\"#{Rails.root}/config/defaults/organisations.yml\")\n attributes = y.first\n end\n @user = create_user\n create_countries\n create_currencies\n OrganisationSession.set = {:id => 1, :name => 'ecuanime'}\n org = Organisation.create!(attributes)\n org.currency_ids = [1]\n end", "def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trip = Trip.new(trip_params)\n @trip.user = current_user\n # If :trip :country is blank then a country was selected from the countries already present. Otherwise it is a new country being added to the database\n if params[:trip][:country] != \"\"\n @trip.country = Country.find_by(name: params[:trip][:country])\n saving_trip\n else\n saving_trip\n end\n end", "def create_office_for_profile\n office = Office.find_or_create_by_owner_id id\n office.save\n end", "def set_zipcode\n @zipcode = Zipcode.find(params[:zipcode])\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def create\n @department = Department.find(params[:department_id])\n @town = @department.towns.new(town_params)\n respond_to do |format|\n if @town.save\n format.json { render json: @town, status: :ok }\n else\n format.json { render json: @town.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @organization = current_user.organizations.build(params[:organization])\n if @organization.save\n redirect_to @organization, :flash => { :success => \"Profile created!\" }\n else\n render 'pages/home'\n end\n end", "def initialize_account\n if employer_profile_account.blank?\n self.build_employer_profile_account\n employer_profile_account.next_premium_due_on = (published_plan_year.start_on.last_month) + (Settings.aca.shop_market.binder_payment_due_on).days\n employer_profile_account.next_premium_amount = 100\n # census_employees.covered\n save\n end\n end", "def create\n @organization_profile = OrganizationProfile.new(params[:organization_profile])\n\n respond_to do |format|\n if @organization_profile.save\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully created.' }\n format.json { render json: @organization_profile, status: :created, location: @organization_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def zip_code(state_abbreviation: T.unsafe(nil)); end", "def validate_territory(country, territory)\n return false if country.to_s.length == 0 or territory.to_s.length == 0\n return false if !validate_residency(territory)\n if(PRgovCAPWebApp::App.settings.country_codes.has_key? country)\n if(country == \"PR\" and\n PRgovCAPWebApp::App.settings.pr_municipalities.has_key? territory)\n return true\n elsif(country == \"US\" and\n PRgovCAPWebApp::App.settings.usa_states.has_key? territory)\n return true\n end\n end\n return false\n end", "def zipcode_params\n params.require(:zipcode).permit(:zip_code, :latitude, :longitude, :county, :country, :state, :city, :zipcode_type)\n end", "def create_custom_org_unit(org_unit_data)\n # Requires the type to have the correct parent. This will work fine in this\n # sample, as the department (101) can have the parent Organiation (6606)\n payload = {\n 'Type' => 101, # Number:D2LID\n 'Name' => 'custom_ou_name', # String\n 'Code' => 'custom_ou_code', # String\n 'Parents' => [6606], # Number:D2LID\n }.merge!(org_unit_data)\n check_org_unit_data_validity(payload)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/\"\n # Requires: OrgUnitCreateData JSON block\n _post(path, payload)\n # returns: OrgUnit JSON data block\nend", "def create_profile\n build_emp_perfil\n end", "def call\n begin\n context[:organization_addresses].each do |address|\n address = context.organization.organization_addresses.new(\n city: address[:city],\n street: address[:street],\n house_number: address[:house_number],\n phone: address[:phone])\n address.save\n end\n rescue => e\n context.fail!(message: e)\n end\n end", "def create\n @zip = Zip.find(params[:id])\n\n respond_to do |format|\n if current_user.vendor.zips << @zip\n format.html { redirect_to @zip, notice: 'Zip was successfully created.' }\n format.json { render json: @zip, status: :created, location: @zip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zip.errors, status: :unprocessable_entity }\n end\n end\n end", "def createAddress\n value = posting_address_params\n @posting=Posting.find(params[:id])\n\n if(value[:id].nil? && @posting[params[:id]].nil?)\n @address = Address.new\n if @posting[:enable_sharing]==1\n value[:hiacode]=Loolcode.create('AF','SN',20) #af for afrikelist sn for senegal... how to pull the country code?\n end\n @address.update_attributes(value)\n\n @address.save\n else\n @address = Address.find(params[:id])\n @address.update_attributes(value )\n end\n @posting.update(address_id: @address.id)\n end", "def create_tenant!\n Apartment::Tenant.create(tenant_name) unless tenant_name.blank?\n end", "def create\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new(params[:shipping_address])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address.save\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully created.' }\n format.json { render json: @shipping_address, status: :created, location: @shipping_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def geocode_postal_code\n return unless self.postal_code\n if self.postal_code && (!!self.geo_coded? || !!self.changes.symbolize_keys[:postal_code])\n res = GeoKit::Geocoders::MultiGeocoder.geocode(\"#{self.postal_code}, DE\")\n if res.success\n self.lat = res.lat\n self.lng = res.lng\n self.province_code = Project.province_name_to_code(res.state)\n end\n end\n rescue GeoKit::Geocoders::GeocodeError => ex\n logger.error \"Exception #{ex.message} caught when geocoding #{self.postal_code}, DE\"\n return\n end", "def fill_up(race)\n race.max_teams.times do |x|\n team = FactoryGirl.create :team, :name => \"team#{x}\"\n race.registrations.create name: \"team#{x}\", team: team\n end\n end", "def create\n if !current_user.super_admin?\n head :forbidden\n else\n # Create an organisation, an administrator organisation_unit and an admin user\n contact = Contact.find(organisation_params[:contact_id])\n if contact.present?\n ActiveRecord::Base.transaction do\n @organisation = Organisation.new\n @organisation.name = contact.company\n @organisation.contact = contact\n if @organisation.save\n organisation_unit = OrganisationUnit.new\n organisation_unit.name = 'Administration'\n organisation_unit.administration = true\n organisation_unit.organisation = @organisation\n if organisation_unit.save\n user = User.new\n user.name = \"#{contact.first_name} #{contact.last_name}\"\n user.email = contact.email\n pw = SecureRandom.urlsafe_base64(6)\n user.password = pw\n user.password_confirmation = pw\n user.role = Role.find_by(name: 'Admin')\n user.organisation_unit = organisation_unit\n if user.save\n UserMailer.with(user: user, pw: pw).welcome_email.deliver_later\n render json: @organisation.as_json(\n only: [:id, :name],\n include: {\n organisation_units: {\n only: [:id, :name],\n include: {\n users: {\n only: [:id, :name, :email],\n include: {\n role: { only: [:name] }\n }\n }\n }\n },\n }\n ), status: :created\n else\n puts '=> user.save failed!'\n raise user.errors\n end\n else\n puts '=> organisation_unit.save failed!'\n raise organisation_unit.errors\n end\n else\n puts '=> organisation.save failed!'\n raise @organisation.errors\n end\n rescue => errors\n raise json: errors, status: :unprocessable_entity\n return\n end\n end\n end\n end", "def make_reservation_address(first_name, last_name, street_address, zip, city, country_code, house_number = nil)\n # {\n # :fname => first_name,\n # :lname => last_name,\n # :street => street_address,\n # :zip => zip,\n # :city => city,\n # :country => ::Klarna::API.id_for(:country, country_code),\n # :house_number => house_number\n # }.with_indifferent_access\n raise NotImplementedError\n end", "def process_countyzip_file(input_path)\n @import_timestamp = DateTime.now\n return Success(input_path) if @tenant.geographic_rating_area_model == 'single'\n\n params = { file: @county_zip_files.first, tenant: @tenant, year: @year, import_timestamp: @import_timestamp }\n cz_process_result = Transactions::CountyZipFile.new.call(params)\n if cz_process_result.success?\n Success(input_path)\n else\n destroy_countyzips(@tenant, @import_timestamp)\n Failure({errors: [\"Unable to create CountyZips/RatingArea for given counties per #{params[:file]}\"]})\n end\n end", "def set_zip_code_save\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:zip_code, @customer.zip_code)\n end", "def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = current_user.setting.build_profile(speciality_name: params[:speciality_name],sub_speciality_name:params[:sub_speciality_name],:medical_school=>params[:medical_school],:residency=>params[:residency],:spe_training=>params[:spe_training],:my_favourite=>params[:my_favourite],:my_hobby=>params[:my_hobby],:more_about=>params[:more_about],:cover_image=>params[:cover_image],:profile_image=>params[:profile_image]) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Profile Successfully Created.\", response: surgeon_profile.as_json },:status=>200\n\t else\n\t render :json=> { success: false, message: surgeon_profile.errors },:status=> 203\n\t end\n\tend", "def chkout_zip_code_field\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_zip_code_field, input.className(create_ats_regex_string(\"ats-postalcodefield\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-postalcodefield\")), __method__, self)\n end", "def test_assign_town\n map = create_towns\n p1 = Prospector::new map[0]\n n_town = map[1] # pick the next town to set\n p1.assign_town n_town\n s_town = p1.return_town\n t = Town::new 'Duck Type Beach', ['Enumerable Canyon', 'Matzburg'], 2, 2\n assert_equal s_town.return_name, t.return_name\n end", "def create\n @accounting_office = AccountingOffice.new(params[:accounting_office])\n\n #@accounting_office.regional_directorate_id = RegionalDirectorate.find_by_code(params[:accounting_office][:regional_directorate_id]).id\n\n respond_to do |format|\n if @accounting_office.save\n format.html { redirect_to @accounting_office, notice: 'Accounting office was successfully created.' }\n format.json { render json: @accounting_office, status: :created, location: @accounting_office }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accounting_office.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @address = Address.new()\n @address.addressable_type = params[:address][:addressable_type]\n @address.addressable_id = params[:address][:addressable_id]\n @address.number = params[:address][:number]\n @address.street = params[:address][:street]\n @address.suburb = params[:address][:city]\n @address.state = params[:address][:state]\n @address.country = params[:address][:country]\n @address.postcode = params[:address][:postcode]\n if @address.save\n redirect_to home_path\n else\n flash[:alert] = \"Opps, something went wrong when creating your review\"\n redirect_to items_path \n end \n end", "def update_province_textfield_from_zipcode\n @zipcode = Zipcode.find(params[:id])\n @town = Town.find(@zipcode.town)\n @province = Province.find(@town.province)\n @region = Region.find(@province.region)\n @country = Country.find(@region.country)\n @json_data = { \"town_id\" => @town.id, \"province_id\" => @province.id, \"region_id\" => @region.id, \"country_id\" => @country.id }\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "def update_province_textfield_from_zipcode\n @zipcode = Zipcode.find(params[:id])\n @town = Town.find(@zipcode.town)\n @province = Province.find(@town.province)\n @region = Region.find(@province.region)\n @country = Country.find(@region.country)\n @json_data = { \"town_id\" => @town.id, \"province_id\" => @province.id, \"region_id\" => @region.id, \"country_id\" => @country.id }\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "def set_DestinationZipCode(value)\n set_input(\"DestinationZipCode\", value)\n end", "def set_OriginZip(value)\n set_input(\"OriginZip\", value)\n end", "def set_OriginZip(value)\n set_input(\"OriginZip\", value)\n end", "def set_OriginZip(value)\n set_input(\"OriginZip\", value)\n end", "def create_empty_payment_profile(user) \n options = {\n :customer_profile_id => user.authnet_customer_profile_id.to_i, \n :payment_profile => {\n :bill_to => { :first_name => user.first_name, :last_name => user.last_name, :address => '', :city => '', :state => '', :zip => '', :phone_number => '', :email => user.email }, \n :payment => { :credit_card => Caboose::StdClass.new({ :number => '4111111111111111', :month => 1, :year => 2020, :first_name => user.first_name, :last_name => user.last_name }) }\n }\n #, :validation_mode => :live\n } \n resp = self.gateway.create_customer_payment_profile(options) \n if resp.success? \n user.authnet_payment_profile_id = resp.params['customer_payment_profile_id'] \n user.save\n else\n puts \"==================================================================\" \n puts resp.message\n puts \"\"\n puts resp.inspect\n puts \"==================================================================\"\n end\n end", "def make_municipalities_for_state(state_pair)\n state = state_pair[0]\n url = \"http://api.usatoday.com/open/census/loc?keypat=#{state}&sumlevid=4,6&api_key=#{Constants::USA_TODAY_API_KEY}\"\n\n puts \"Retrieving municipalities for #{state_pair[1]}...\"\n\n municipalities = []\n for i in 1..10\n begin\n data = RestClient.get(url)\n json = JSON.parse(data)\n\n json['response'].each do |p|\n name = p['Placename']\n\n housing_units = p['HousingUnits']\n housing_vacancies = (p['PctVacant'].to_f * housing_units.to_i).ceil\n\n # populate the new Municipality\n municipality = Municipality.new\n municipality.name = name\n municipality.state = state\n municipality.slug = Municipality.create_slug(name, state)\n municipality.code_fips = p['FIPS']\n municipality.code_gnis = p['GNIS']\n municipality.population = p['Pop']\n municipality.population_density = p['PopSqMi']\n municipality.race_american_indian = p['PctAmInd']\n municipality.race_asian = p['PctAsian']\n municipality.race_black = p['PctBlack']\n municipality.race_hispanic = p['PctHisp']\n municipality.race_multiple = p['PctTwoOrMore']\n municipality.race_non_hispanic = p['PctNonHisp']\n municipality.race_non_hispanic_white = p['PctNonHispWhite']\n municipality.race_other = p['PctOther']\n municipality.race_pacific_islander = p['PctNatHawOth']\n municipality.race_white = p['PctWhite']\n municipality.diversity = p['USATDiversityIndex']\n municipality.area_land = p['LandSqMi']\n municipality.area_water = p['WaterSqMi']\n municipality.latitude = p['Lat']\n municipality.longitude = p['Long']\n municipality.housing_units = housing_units\n municipality.housing_vacancies = housing_vacancies\n\n municipalities << municipality\n end\n break # for i in 1..10\n rescue => e\n puts \"Caught exception: #{e.message} (Attempt #{i})\"\n municipalities = []\n sleep(5)\n end\n end\n\n Municipality.import(municipalities)\n end", "def test_a_user_can_create_company_billing_profile_witout_vat_code\n visit new_billing_profile_path\n fill_in_address\n\n fill_in('billing_profile[name]', with: 'ACME corporation')\n\n assert_changes('BillingProfile.count') do\n click_link_or_button('Submit')\n end\n\n assert(@user.billing_profiles\n .where(name: 'ACME corporation')\n .where('vat_code IS NULL'))\n\n assert(page.has_css?('div.notice', text: 'Created successfully.'))\n end", "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n OrganizationQuarter.create :organization_id => @organization.id, :quarter_id => @quarter.id, :unit_id => @unit.id\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(service_learning_organization_path(@unit, @quarter, @organization)) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_wepay_account\n # if we don't have an access_token for this user, then we cannot make this call\n if self.has_wepay_account? then return false end\n # make the /account/create call\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, {\n name: self.campaign.name,\n description: self.campaign.description,\n type: self.campaign.account_type,\n country: self.country,\n currencies: [ self.currency ],\n })\n if response['error'].present?\n raise response['error_description']\n end\n self.wepay_account_id = response['account_id']\n self.save\n end", "def format_town_county_postcode(output, prefix)\n output[\"#{prefix}:AddressTownOrCity\"] = town\n xml_element_if_present(output, \"#{prefix}:AddressCountyOrRegion\", county)\n xml_element_if_present(output, \"#{prefix}:AddressPostcodeOrZip\", postcode)\n xml_element_if_present(output, \"#{prefix}:AddressCountryCode\", country)\n xml_element_if_present(output, \"#{prefix}:QASMoniker\", address_identifier)\n end", "def assure_created_zip\n FileCreator::createNewZip(self)\n raise \"No file created\" unless File.exists? zip_path\n end" ]
[ "0.5473488", "0.52503294", "0.5184183", "0.5136867", "0.5084143", "0.5084143", "0.50389785", "0.5036017", "0.5036017", "0.5036017", "0.50329506", "0.502724", "0.5026956", "0.4999854", "0.4992033", "0.49822778", "0.49487337", "0.4945391", "0.4931078", "0.48771018", "0.48741287", "0.48200944", "0.4811084", "0.48015815", "0.47859254", "0.4773472", "0.47703308", "0.4765342", "0.47454202", "0.47436303", "0.4737114", "0.47359654", "0.4733394", "0.47314274", "0.4727917", "0.4727917", "0.4727917", "0.4727917", "0.47084513", "0.46975678", "0.4677663", "0.4673747", "0.46734315", "0.46638426", "0.46638426", "0.46638426", "0.46638426", "0.46638426", "0.46624386", "0.46549186", "0.46496516", "0.46387303", "0.46363848", "0.4628371", "0.46263975", "0.46237946", "0.4619463", "0.46179256", "0.46050966", "0.45989496", "0.45976228", "0.45876107", "0.45836556", "0.45827994", "0.4575946", "0.45753592", "0.4574276", "0.45730007", "0.4545837", "0.45255324", "0.45244458", "0.4522305", "0.45141023", "0.4509116", "0.45046073", "0.45023826", "0.4492822", "0.44873607", "0.4486492", "0.4476803", "0.44762948", "0.44739088", "0.44674015", "0.44631374", "0.44614032", "0.44611153", "0.4460636", "0.44577023", "0.44577023", "0.44502774", "0.4448098", "0.4448098", "0.4448098", "0.44383556", "0.44378197", "0.44331467", "0.4431102", "0.44302925", "0.4419794", "0.44126377" ]
0.64824766
0
TODO: this can be done using the controller respond_with
def redirect_path organization_path(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_with []\n end", "def show\n respond_with @content\n end", "def respond\n end", "def respond\n respond_to do |format|\n format.html\n format.xml { render :xml => @response.to_xml }\n format.json { render :json => @response.to_json }\n end\n end", "def respond_with_resource\n respond_to do |format|\n yield(format) if block_given?\n format.html do\n set_single_instance\n render\n end\n format.json do\n render :json => @resource.as_json(root: include_root?)\n end\n end\n end", "def index\n respond_with(@people)\n end", "def try_respond_with(obj)\n name = obj.class.to_s.underscore\n params = if obj.save\n { template: \"api/#{name.pluralize}/show.json\",\n status: 200 }\n else\n { template: 'api/shared/errors.json',\n status: 422,\n locals: { errors: obj.errors } }\n end\n render params\n end", "def index\n respond_with(deals)\n end", "def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end", "def render_put\n respond_to do |wants| \n wants.html {render :to_xml => 'PUT.xml.builder', :layout => false, :status => 200}\n wants.json {render :to_json => 'PUT.xml.builder', :status => 200}\n wants.xml {render :to_xml => 'PUT.xml.builder', :layout => false, :status => 200}\n wants.yaml {render :to_yaml => 'PUT.xml.builder', :status => 200}\n end \n end", "def respond_for usecase, &block\n resp = {\n object: usecase.build_object,\n errors: usecase.errors,\n message: usecase.errors? ? \"Error\" : \"Success\"\n }\n if block_given?\n pp yield(resp)\n end\n Response.new( resp )\n end", "def render(*)\n respond_to do |format|\n format.jsonapi { super }\n format.json { super }\n end\n end", "def show\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batch\"] = @batch\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end", "def index\r\n #respond_with\r\n if current_user_from_api_access\r\n respond_to do |format|\r\n format.json { render json: current_user_from_api_access.measurements.all.to_json }\r\n\tformat.html { render text: current_user_from_api_access.measurements.all.to_json }\r\n end\r\n else\r\n respond_to do |format|\r\n format.json { render json: { \"result\" => \"Fail\", \"message\" => \"Invalid user\" }.to_json }\r\n end\r\n end\r\n end", "def list \n respond_to do |wants|\n wants.html {}\n end\n end", "def show\n respond_with(failures)\n end", "def show\n respond_with do |format|\n format.html {render status_code.to_s, status: status_code}\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def show\n respond_with(@post)\n end", "def show\n respond_with(@post)\n end", "def show\n respond_with article\n end", "def show\n respond_to do |wants|\n wants.html\n wants.json\n wants.jsonld { render body: export_as_jsonld, content_type: 'application/ld+json' }\n wants.nt { render body: export_as_nt, content_type: 'application/n-triples' }\n wants.ttl { render body: export_as_ttl, content_type: 'text/turtle' }\n end\n end", "def show\n respond_to do |wants|\n wants.html\n wants.json\n wants.jsonld { render body: export_as_jsonld, content_type: 'application/ld+json' }\n wants.nt { render body: export_as_nt, content_type: 'application/n-triples' }\n wants.ttl { render body: export_as_ttl, content_type: 'text/turtle' }\n end\n end", "def index\n respond_with(pages)\n end", "def index\n @shows = Show.all\n respond_with Show.all\n end", "def index\n @todos = Todo.all\n respond_with @todos\n end", "def generate_html_and_build_response!\n controller = self.class_to_model_name\n response_body = Poseidon::View.new.render(controller, meth, self)\n response.merge!(body: response_body)\n return response\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "def respond(); end", "def show\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend", "def show\n respond_with @post\n end", "def index\n respond_with Post.all\n end", "def index\n respond_with Post.all\n end", "def index\n respond_with Post.all\n end", "def index\n build_resource({})\n respond_with self.resource\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def show\n\n \t\t\trespond_with @sequence\n\n \t\tend", "def show\n respond_with @bracket_golfer\n end", "def responder\r\n self.class.respond_to :html, :json\r\n end", "def show\n respond_with @inproceedings\n end", "def show\n respond_with(@person)\n end", "def show\n respond_with(@task = Task.find(params[:id]))\nend", "def index\n\n sites = Site.all\n @sites = current_user.sites\n @needs_attention_reports = Report.needs_attention\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @sites }\n # end\n\n respond_with(sites) do |format|\n format.html # { redirect_to site_user_sites_path }\n format.json { render :json => @sites.as_json }\n end\n end", "def index\n respond_with(accounts)\n end", "def update\n respond_with []\n end", "def show\n respond_with resource\n end", "def index\n respond_with(features)\n end", "def index\n respond_with(features)\n end", "def show\n respond_to do |format|\n format.any { head :no_content }\n end\n end", "def index\n @people = Person.all\n respond_with(@people)\n end", "def interface\n respond_to do |format|\n format.json {}\n end\n end", "def render_response status: 200, obj: {}, notice: nil, url: root_path\n obj[:notice] = notice if obj.empty? && notice\n respond_to do |format|\n format.json { render json: obj.to_json, status: status }\n format.html { redirect_to url, notice: notice }\n end\n end", "def bar\n respond_to(:json)\n erase_render_results\n end", "def raw_response; end", "def respond_with(content, *resources)\n options = resources.size == 0 ? {} : resources.extract_options!\n options[:status] = {} if options[:status].nil?\n\n # Format status\n status = {\n :code => options[:status][:code] ||= 200,\n :msg => options[:status][:msg] ||= \"OK\"\n }\n options[:status] = status[:code]\n\n if options[:json_header] != false\n # Format return\n content = {\n :header => {\n :version => current_version.to_s,\n :status => status,\n :request => request.original_fullpath, # escape or stripslahes or sanitize\n },\n :response => content\n }\n\n # If env is not production, return current env\n content[:header].merge!({:env => Rails.env}) unless Rails.env.production?\n end\n\n # Bug fix\n if request.method != 'GET'\n options[:location] ||= nil\n end\n\n super(content, options)\n end", "def formatted_response\n self.response\n end", "def respond\n DEFAULT_RESPONSE\n end", "def show\n respond_with @articles, status: get_status\n end", "def show\n @resp = Response.find(params[:id])\n\n respond_to do |format|\n format.html\n format.js do\n content = render_to_string(:layout => false)\n render :update do |page|\n page.replace_html 'responsebody', content\n page.replace_html 'responsetitle', @resp.title\n page.call 'showResponseViewer', @resp.id\n page << \"$$('#responsebody > form input[type=submit]').each(function(elt) { elt.hide(); });\"\n end\n end\n end\n end", "def show\n \n render status: 200, :json => @item\n\n end", "def show\n respond_to do |format|\n format.html { render layout: false }\n format.json\n end\n end", "def index\n render 'post'\n respond_to :json\n end", "def respond_with_action(action)\n respond_with do |f|\n f.json { render action: action }\n f.xml { render action: action }\n end\n end", "def respond_to_empty\n respond_to do |f|\n f.json { render nothing: true, layout: \"axel\", status: header_status }\n f.xml { render nothing: true, layout: \"axel\", status: header_status }\n end\n end", "def create\n respond_with []\n end", "def show\n @content = Content.find(params[:id])\n\n respond_with @content\n\n # @contents = Content.all\n\n # respond_with @content\n end", "def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end", "def index\n respond_with(invoices)\n end", "def show\n #render json: @subject\n respond_with @subject\n end", "def show\n respond_to do |format|\n format.html\n format.xml\n format.json\n end\n end", "def show\n \trespond_with @rubro\n end", "def index\n respond_with(Response.collection_as_unity_JSON(:all))\n end", "def index\n render status: :ok, json: { status: 'done' }.to_json\n\tend", "def response\n\t\t@response\n\tend", "def show\n @post = Post.find(params[:id])\n \n respond_with @post\n end", "def index\n respond_with Ad.all \n end", "def response_body; end", "def response_body; end", "def show\n respond_with client, resource\n end", "def show\n @response = Response.find(params[:id])\n\n respond_with(@response)\n end", "def show\n # respond_with @incident\n end", "def show\n respond_with( @answer )\n end", "def show\n respond_with(deal)\n end", "def update\n\n respond_to do |format|\n format.all { render_501 }\n end\n end", "def index\n respond_with(@tickets)\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @export }\n end\n end", "def respond_according_to_formats\n respond_to do |format|\n if @buy_request.save\n format.html { redirect_back(users_dashboard_path) }\n format.json { render json: { report: @buy_request, success: true } }\n else\n set_flash_messages_from_errors(@buy_request)\n logger.info \"** BuyRequest errors: #{flash[:error]}\"\n format.html { redirect_back(newest_items_path) }\n format.json { render json: { error: @buy_request.errors.first.join(' ') } }\n end\n end\n end", "def json_respond(list) \n respond_to do |format|\n format.json{ render :json => list }\n end\n end" ]
[ "0.68284357", "0.68187296", "0.67677724", "0.66069794", "0.65196997", "0.65096873", "0.6473891", "0.64258885", "0.6401827", "0.6388692", "0.63752514", "0.6368158", "0.6366435", "0.63490534", "0.6314463", "0.6270811", "0.62662494", "0.6260377", "0.62602746", "0.62494355", "0.62494355", "0.6244685", "0.6237483", "0.6237483", "0.62363315", "0.62346554", "0.6229612", "0.6221215", "0.6210998", "0.61929685", "0.6190349", "0.61845344", "0.6184482", "0.6184482", "0.6184482", "0.6176039", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.6174838", "0.61695814", "0.6168968", "0.6168256", "0.6163285", "0.6163243", "0.6163221", "0.6159986", "0.61534435", "0.6148889", "0.6147826", "0.61472124", "0.6146343", "0.61413", "0.613973", "0.61378807", "0.613513", "0.6126655", "0.6124456", "0.61235476", "0.61212623", "0.6120419", "0.6114109", "0.61019206", "0.61019105", "0.6097637", "0.6097117", "0.60956544", "0.60954034", "0.60919726", "0.6089882", "0.6085477", "0.6084439", "0.6080103", "0.60792536", "0.60779274", "0.60769725", "0.6074656", "0.60705894", "0.6070057", "0.6063887", "0.605776", "0.605776", "0.6053679", "0.60501516", "0.6049194", "0.6048338", "0.60459936", "0.60449255", "0.6044107", "0.6043888", "0.60414284", "0.6040828" ]
0.0
-1
If the organization is a customer, it gives us all Chess POs where po_lines have the customer as the organization called on. When a vendor, it shows all PO headers that were made to that vendor
def purchase_orders case organization_type.type_value when 'customer' PoHeader.joins(:po_lines).where('po_lines.organization_id = ?', id).order('created_at desc') when 'vendor' PoHeader.where('organization_id = ?', id).order('created_at desc') else PoHeader.where('organization_id = ?', 0).order('created_at desc') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sales_orders\n case organization_type.type_value\n when 'customer'\n SoHeader.where('organization_id = ?', id).order('created_at desc')\n when 'vendor'\n SoHeader.joins(:so_lines).where('so_lines.organization_id = ?', id).order('created_at desc')\n else\n SoHeader.where('organization_id = ?', 0).order('created_at desc')\n end\n end", "def po_items\n # po_items = self.po_headers.joins(:po_lines).select(\"po_lines.item_id\").where(\"po_headers.organization_id = ?\",self.id).order(\"po_lines.created_at DESC\")\n po_items = PoLine.includes(:po_header).where('po_headers.organization_id = ?', id).order('po_headers.created_at DESC')\n po_items = po_items.collect(& :item_id)\n Item.where(id: po_items)\n end", "def customers; (line_items.map(&:customer).flatten.compact.uniq rescue []); end", "def line_items_for_customer(customer_id)\n ret_line_items = []\n my_line_items = delivery_details.find_all_by_customer_id(customer_id)\n my_line_items.each do |my_line_item|\n my_line_item.order_items.each do |order|\n if order.quantity > 0\n ret_line_items.push(order) unless ret_line_items.include? order\n end\n end\n end\n return ret_line_items\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 order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end", "def cost_splitting\n @shipments = Shipment.all.paginate(page: params[:page], per_page: 1)\n @order = Order.all.paginate(page: params[:page], per_page: 1)\n @file_info = FileInformation.all.paginate(page: params[:page], per_page: 1)\n\n \n@shipments.each do |s|\n unless s.shared != false\n @file_info.each do |f|\n @order.each do |o|\n puts \"o.product\"\n end\n end\n end\nend\n\n\nend", "def build_pdf_header_rpt2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers_rpt.length, invoice_headers_rpt.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers_rpt.length >= row ? client_data_headers_rpt[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers_rpt.length >= row ? invoice_headers_rpt[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n \n pdf \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 customers_with_unpaid_invoices\n unpaid_invoices = find_unpaid_invoices\n unpaid_customers = unpaid_invoices.map do |inv|\n @engine.customers.find_by_id(inv.customer_id)\n end.uniq\n end", "def invoice_lines_from_order(order)\n invoice = self\n order.order_lines.each do |ol|\n # order_lines are static_document_lines, so they can be assigned to an invoice\n # at the same time, ensuring that the invoice always reflects the order 100%.\n ol.invoice = invoice\n ol.save\n end\n return invoice\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 customers\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n plat_id = \"31937637-430C-4E4B-ADAF-CB4FE6CE816D\"\n gold_id = \"A0A1AAC7-FB31-4AFA-B6D6-572F68D5757D\"\n\n # initial plat query\n result = client.customers.search_customers(\n body: {\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n plat_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n # {\"customers\": [\n # {\n # \"id\": \"DDMAZ5X1HX3T719477BRM31WAC\",\n # \"given_name\": \"Amy\",\n # \"family_name\": \"Scott\",\n # \"email_address\": \"ALS98053@hotmail.com\",\n # \"phone_number\": \"(425) 894-4488\",\n # \"preferences\": {\n # \"email_unsubscribed\": false\n # },\n # \"groups\": [\n # {\n # \"id\": \"31937637-430C-4E4B-ADAF-CB4FE6CE816D\",\n # \"name\": \"Wine Club platinum\"\n # },\n # ],\n # },\n # ]\n # \"cursor\": \"long_cursor_string\"\n # }\n # result.cursor returns cursor string if there is one, else returns nil\n\n if result.success?\n filtered = result.data[0].map {|m| {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Platinum\"} }\n # result.cursor implies the api call only retrieved\n # subset of data, need to make subsequent calls\n # with cursor to retrieve the rest\n while result.cursor\n result = client.customers.search_customers(\n body: {\n cursor: result.cursor,\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n plat_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if result.success?\n result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Platinum\"} }\n elsif result.error?\n render result.errors\n end\n end\n # member_groups = result.data[0].filter { |group|\n # group[:name] === \"Wine Club platinum\" || group[:name] === \"Wine Club gold\"\n # }\n # puts member_groups\n # group_data = member_groups.map { |g| {id: g[:id], name: g[:name]} }\n # render json: group_data.to_json\n elsif result.error?\n render result.errors\n end\n\n # Room for improvement!! Call API for both gold\n # and plat members, then have logic to identify which\n # group a member belongs to. This DRYs up the customer search\n # call\n gold_result = client.customers.search_customers(\n body: {\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n gold_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if gold_result.success?\n gold_result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Gold\"} }\n while gold_result.cursor\n gold_result = client.customers.search_customers(\n body: {\n cursor: gold_result.cursor,\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n gold_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if gold_result.success?\n gold_result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Gold\"} }\n elsif gold_result.error?\n render gold_result.errors\n end\n end\n # member_groups = result.data[0].filter { |group|\n # group[:name] === \"Wine Club platinum\" || group[:name] === \"Wine Club gold\"\n # }\n # puts member_groups\n # group_data = member_groups.map { |g| {id: g[:id], name: g[:name]} }\n # render json: group_data.to_json\n elsif gold_result.error?\n render gold_result.errors\n end\n\n results = []\n stop = false\n\n filtered.each do |member|\n currentUser = User.find {|u| u.square_id === member[:square_id]}\n if !currentUser\n p member[:membership_level]\n member[:membership_level] === \"Gold\" ? count = 1 : count = 2\n currentUser = User.create(email: member[:email], password: \"d3vp4ss\", square_id: member[:square_id], commit_count: count)\n Role.create(role_type: \"member\", user_id: currentUser.id)\n end\n\n transactions = client.orders.search_orders(\n body: {\n location_ids: [\n \"EBB8FHQ6NBGA8\"\n ],\n query: {\n filter: {\n customer_filter: {\n customer_ids: [\n member[:square_id]\n ]\n }\n }\n }\n }\n )\n if transactions.success?\n t_data = []\n transactions.data && transactions.data[0].each do |t|\n if t[:line_items] && t[:line_items].any? {|li| li[:name] && li[:name].start_with?(\"20\")}\n items = t[:line_items].reject{|li| li[:name] && !li[:name].start_with?(\"20\")}.map { |li| { uid: li[:uid],\n catalog_object_id: li[:catalog_object_id], quantity: li[:quantity], name: li[:name]} }\n end\n \n t_obj = {\n id: t[:id],\n created_at: t[:created_at],\n line_items: items,\n }\n t_data << t_obj\n end\n elsif transactions.error?\n warn transactions.errors\n end\n\n results << {\n \"square\": member,\n \"db\": {\n \"id\": currentUser.id,\n \"commit_count\": currentUser.commit_count,\n \"commit_adjustments\": currentUser.commit_adjustments\n },\n \"transactions\": t_data\n }\n end\n render json: results.to_json\n end", "def lines\n invoice_lines\n end", "def show\n # set polymorphic\n @contactable = @organization\n @attachable = @organization\n @addressable = @organization\n # default contact type to show is addresses\n @contact_type = 'contact'\n\n @address_type = 'address'\n\n # load comments\n @notes = @organization.comments.where(comment_type: 'note').order('created_at desc') if @organization\n\n # load tags\n @tags = @organization.present? ? @organization.comments.where(comment_type: 'tag').order('created_at desc') : []\n\n # load Purchase Orders\n @po_headers = PoHeader.where(organization: @organization)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n case params[:type]\n when 'min_quality'\n min_vendor_quality = @organization.min_vendor_quality.present? ? @organization.min_vendor_quality.quality_name : ''\n render json: { min_vendor_quality: min_vendor_quality }\n when 'quality_level'\n quality_level = @organization.customer_quality.present? ? @organization.customer_quality : ''\n render json: { quality_level: quality_level }\n else\n render json: @organization\n end\n end\n end\n end", "def show\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.customers.retrieve_customer(\n customer_id: params[:id]\n )\n \n if result.success?\n # determine membership level\n if result.data[0][:groups].any? {|g| g[:name] === \"Wine Club gold\"}\n membership = \"Gold\"\n else\n membership = \"Platinum\"\n end\n # organize desired data from Square response\n square_data = {\n \"square_id\": result.data[0][:id],\n \"created_at\": result.data[0][:created_at],\n \"given_name\": result.data[0][:given_name],\n \"family_name\": result.data[0][:family_name],\n \"email\": result.data[0][:email_address],\n \"phone_number\": result.data[0][:phone_number],\n \"membership_level\": membership\n }\n\n transactions = client.orders.search_orders(\n body: {\n location_ids: [\n \"EBB8FHQ6NBGA8\"\n ],\n query: {\n filter: {\n customer_filter: {\n customer_ids: [\n square_data[:square_id]\n ]\n }\n }\n }\n }\n )\n if transactions.success?\n t_data = []\n transactions.data && transactions.data[0].each do |t|\n # logic to make sure transaction contains bottle purchase\n # bottle line items always start with \"20\", e.g. \"2017 Syrah\"\n if t[:line_items] && t[:line_items].any? {|li| li[:name] && li[:name].start_with?(\"20\")}\n items = t[:line_items].reject{|li| !li[:name].start_with?(\"20\")}.map { |li| { uid: li[:uid],\n catalog_object_id: li[:catalog_object_id], quantity: li[:quantity], name: li[:name]} }\n end\n \n t_obj = {\n id: t[:id],\n created_at: t[:created_at],\n line_items: items,\n }\n t_data << t_obj\n end\n elsif transactions.error?\n warn transactions.errors\n end\n\n # look up user in our DB\n currentUser = User.find {|u| u.square_id === result.data[0][:id]}\n\n member_data = {\n \"square\": square_data,\n \"db\": {\n \"id\": currentUser.id,\n \"commit_count\": currentUser.commit_count,\n \"commit_adjustments\": currentUser.commit_adjustments\n },\n \"transactions\": t_data\n }\n\n render json: member_data.to_json\n elsif result.error?\n warn result.errors\n end\n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 15\n pdf \n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 15\n pdf \n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def test_OH_lines\n data = 'OS Tomato black ring virus (strain E) (TBRV).\nOC Viruses; ssRNA positive-strand viruses, no DNA stage; Comoviridae;\nOC Nepovirus; Subgroup B.\nOX NCBI_TaxID=12277;\nOH NCBI_TaxID=4681; Allium porrum (Leek).\nOH NCBI_TaxID=4045; Apium graveolens (Celery).\nOH NCBI_TaxID=161934; Beta vulgaris (Sugar beet).\nOH NCBI_TaxID=38871; Fraxinus (ash trees).\nOH NCBI_TaxID=4236; Lactuca sativa (Garden lettuce).\nOH NCBI_TaxID=4081; Lycopersicon esculentum (Tomato).\nOH NCBI_TaxID=39639; Narcissus pseudonarcissus (Daffodil).\nOH NCBI_TaxID=3885; Phaseolus vulgaris (Kidney bean) (French bean).\nOH NCBI_TaxID=35938; Robinia pseudoacacia (Black locust).\nOH NCBI_TaxID=23216; Rubus (bramble).\nOH NCBI_TaxID=4113; Solanum tuberosum (Potato).\nOH NCBI_TaxID=13305; Tulipa.\nOH NCBI_TaxID=3603; Vitis.'\n\n res = [{'NCBI_TaxID' => '4681', 'HostName' => 'Allium porrum (Leek)'},\n {'NCBI_TaxID' => '4045', 'HostName' => 'Apium graveolens (Celery)'},\n {'NCBI_TaxID' => '161934', 'HostName' => 'Beta vulgaris (Sugar beet)'},\n {'NCBI_TaxID' => '38871', 'HostName' => 'Fraxinus (ash trees)'},\n {'NCBI_TaxID' => '4236', 'HostName' => 'Lactuca sativa (Garden lettuce)'},\n {'NCBI_TaxID' => '4081', 'HostName' => 'Lycopersicon esculentum (Tomato)'},\n {'NCBI_TaxID' => '39639', 'HostName' => 'Narcissus pseudonarcissus (Daffodil)'},\n {'NCBI_TaxID' => '3885', \n 'HostName' => 'Phaseolus vulgaris (Kidney bean) (French bean)'},\n {'NCBI_TaxID' => '35938', 'HostName' => 'Robinia pseudoacacia (Black locust)'},\n {'NCBI_TaxID' => '23216', 'HostName' => 'Rubus (bramble)'},\n {'NCBI_TaxID' => '4113', 'HostName' => 'Solanum tuberosum (Potato)'},\n {'NCBI_TaxID' => '13305', 'HostName' => 'Tulipa'},\n {'NCBI_TaxID' => '3603', 'HostName' => 'Vitis'}]\n sp = SPTR.new(data)\n assert_equal(res, sp.oh)\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 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 build_pdf_header3(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def order_line_report\n #will have 4 columns from the OrderLine table. This goes through the OrderLine method\n @data = OrderLine.find(:all , :select => \"order_id as oid, product_id as pid, product_price as price, ordered_quantity as quantity\", :group => \"oid\")\n end", "def so_items\n # so_items = self.so_headers.joins(:so_lines).select(\"so_lines.item_id\").where(\"so_headers.organization_id = ?\",self.id).order(\"so_lines.created_at DESC\")\n so_items = SoLine.includes(:so_header).where('so_headers.organization_id = ?', id).order('so_headers.created_at DESC')\n so_items = so_items.collect(& :item_id)\n Item.where(id: so_items)\n end", "def get_customers\n \n # Go to the Customers tool\n goto_tool 'redetrack/bin/manager'\n \n # Extract the table as a RubyExcel::Sheet\n s = RubyExcel::Workbook.new.load( Nokogiri::HTML( agent.page.body ).css( 'tr' ).map { |row| row.css('th,td').map { |cell| cell.nil? ? nil : cell.text.gsub( /\\s+/, ' ' ).strip } } )\n \n # Remove the buttons and blank rows\n s.row(2).delete\n s.compact!\n \n # Store the account details in a Hash by :name and :customer\n h = Hash.new({})\n s.rows(2) do |row|\n name = ( row['D'].empty? ? 'Other' : row['D'] )\n customer = ( row['E'].empty? ? 'Other' : row['E'] )\n h[ row['C'].upcase ] = { name: name, customer: customer }\n end\n h\n end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def fill_header_from_customer(customer,trans_type)\n self.customer_id = customer.id\n self.salesperson_code = customer.salesperson_code\n self.parent_id = customer.billto_id || customer.id\n if customer.billto_id == customer.id\n self.parent_code = customer.code \n else\n self.parent_code = customer.bill_to.code if customer.bill_to\n end\n self.customer_code = customer.code if customer\n self.term_code = customer.memo_term_code if credit_invoice?(trans_type)\n self.term_code = customer.memo_term_code if receipts?(trans_type) \n self.term_code = customer.invoice_term_code if invoice?(trans_type)\n account_period = Setup::AccountPeriod.period_from_date(self.trans_date)\n self.account_period_code = account_period.code if account_period\n end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def credit_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) < 0\")\n .group(\"spina_shop_invoices.id\")\n end", "def customers_with_pending_invoices\n invoices = self.invoices.\n joins(:transactions).\n where(transactions: { result: \"failed\" })\n\n invoices.map do |invoice|\n invoice.customer\n end.uniq\n end", "def show\n @invoice = Invoice.find(params[:id])\n @line_item = LineItem.new\n @customer = Customer.find_by_id(params[:customer_id]) #pre de-nesting - for prawn\n @thiscustomer = Customer.where(\"id = ?\", @invoice.customer_id)\n #2 exampls of searches\n #@open_tickets = Ticket.where(\"status != 'Resolved'\")\n #@resolved_tickets = Ticket.where(\"status = 'Resolved'\")\n @related_ticket = Ticket.where(\"id = ?\", @invoice.ticket_id)\n #@ticket = Ticket.find(params[:customer_id]) #got ticket detail to render, seems to be unnec.\n #@comments = Comment.find_all_by_id(params[:customer_id])\n @comments = Comment.where(\"ticket_id = ? AND hidden != '1'\", @invoice.ticket_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n format.pdf { render :layout => false }\n format.csv do\n @invoicesdump = Invoice.find(:all, :order => \"id DESC\")\n @outfile = \"invoice_dump_\" + Time.now.strftime(\"%m-%d-%Y\") + \".csv\"\n\n csv_data = FasterCSV.generate do |csv|\n csv << [\n \"ID\",\n \"Customer_ID\",\n \"Tech\",\n \"PaymentType\",\n \"Invoice Number\",\n \"Subtotal\",\n \"Tax\",\n \"paid\",\n \"date\",\n \"received_on\",\n \"Location\"\n ]\n @invoicesdump.each do |invoice|\n csv << [\n invoice.id,\n invoice.customer_id,\n invoice.employee,\n invoice.payment_type,\n invoice.number,\n invoice.subtotal,\n invoice.tax,\n invoice.paid,\n invoice.date,\n invoice.date_received,\n invoice.category\n ]\n end\n end\n\n send_data csv_data,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{@outfile}\"\n flash[:notice] = \"Export complete!\"\n end\n\n end\n end", "def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page])\n if params[:search]\n @invoices = Factura.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n else\n errPerms()\n end\n end", "def fetch_data\n xml = AxOrder.httpagent(:body => AxOrder.request_xml(ax_order_number)).body\n doc = Hpricot.XML(xml)\n\n order = {\n :ax_account_id => find_ax_account_id((doc/:CustAccount).inner_text),\n :ax_account_number => (doc/:CustAccount).inner_text,\n :delivery_city => (doc/:DeliveryCity).inner_text,\n :delivery_country_region_id => (doc/:DeliveryCountryRegionId).inner_text,\n :delivery_county => (doc/:DeliveryCounty).inner_text,\n :delivery_date => (doc/:DeliveryDate).inner_text,\n :delivery_state => (doc/:DeliveryState).inner_text,\n :delivery_street => (doc/:DeliveryStreet).inner_text,\n :delivery_zip_code => (doc/:DeliveryZipCode).inner_text,\n :purch_order_form_num => (doc/:PurchOrderFormNum).inner_text,\n :sales_tax => (doc/:SalesTax).inner_text,\n :shipping_charges => (doc/:ShippingCharges).inner_text,\n :discounts => (doc/:Discounts).inner_text,\n :created_date => (doc/:CreatedDate).inner_text,\n :modified_date => (doc/:ModifiedDate).inner_text,\n :sales_status => (doc/:SalesStatus).inner_text,\n :status => \"UPDATE\"\n }\n\n items = []\n (doc/:SalesLine).each do |sales_line|\n items << {\n :ax_order_number => ax_order_number,\n :confirmed_lv => (sales_line/:ConfirmedDlv).inner_text,\n :delivered_in_total => (sales_line/:DeliveredInTotal).inner_text,\n :invoiced_in_total => (sales_line/:InvoicedInTotal).inner_text,\n :item_id => (sales_line/:ItemId).inner_text,\n :remain_sales_physical => (sales_line/:RemainSalesPhysical).inner_text,\n :sales_item_reservation_number => (sales_line/:SalesItemReservationNumber).inner_text,\n :sales_qty => (sales_line/:SalesQty).inner_text,\n :sales_unit => (sales_line/:SalesUnit).inner_text\n }\n end\n\n return order, items\n end", "def invoice_items_report\n detailed = params[:detailed]\n project = params[:project]\n @from = params[:from]\n @to = params[:to]\n supplier = params[:supplier]\n order = params[:order]\n account = params[:account]\n product = params[:product]\n\n if project.blank?\n init_oco if !session[:organization]\n # Initialize select_tags\n @projects = projects_dropdown if @projects.nil?\n # Arrays for search\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n project = current_projects.to_a\n end\n\n # Dates are mandatory\n if @from.blank? || @to.blank?\n return\n end\n\n # Format dates\n from = Time.parse(@from).strftime(\"%Y-%m-%d\")\n to = Time.parse(@to).strftime(\"%Y-%m-%d\")\n\n #SupplierInvoice.joins(:supplier_invoice_approvals,:supplier_invoice_items)\n\n if !project.blank? && !supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,account,from,to).order(:invoice_date)\n end\n\n\n # Setup filename\n title = t(\"activerecord.models.supplier_invoice.few\") + \"_#{from}_#{to}.pdf\"\n\n respond_to do |format|\n # Render PDF\n if !@invoice_items_report.blank?\n format.pdf { send_data render_to_string,\n filename: \"#{title}.pdf\",\n type: 'application/pdf',\n disposition: 'inline' }\n format.csv { send_data SupplierInvoiceItem.to_report_invoices_csv(@invoice_items_report),\n filename: \"#{title}.csv\",\n type: 'application/csv',\n disposition: 'inline' }\n else\n format.csv { redirect_to ag2_purchase_track_url, alert: I18n.t(\"ag2_purchase.ag2_purchase_track.index.error_report\") }\n format.pdf { redirect_to ag2_purchase_track_url, alert: I18n.t(\"ag2_purchase.ag2_purchase_track.index.error_report\") }\n end\n end\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_grid = initialize_grid(@orders,\n :conditions => {:order_type => \"b2c\"}, :include => [:business, :keyclientorder, :user_logs],:order => 'created_at', :order_direction => 'desc')\n @orders_grid.with_resultset do |orders|\n @@orders_query_export = orders.order(created_at: :desc)\n end\n end", "def index\n session[:letter] = nil\n\n if !session[:organization]\n init_oco\n end\n if session[:organization] != '0'\n @corp_contacts = Company.where(organization_id: session[:organization]).includes(:offices, :corp_contacts).order(:name)\n else\n @corp_contacts = Company.includes(:offices, :corp_contacts).order(:name)\n end\n #@corp_contacts = Company.order('name').all(:include => [:offices, :corp_contacts])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @corp_contacts }\n end\n end", "def generateObjectFromOrder_NV(pdfName)\n o={}\n o[:communityType] = 'NVHomes'\n o[:fileName] = pdfName\n o[:FaucetSpread] = 'faucet centered, soap 8\" to R' #Default faucet spread\n o[:changeOrders] = []\n currentChangeOrderDate = nil\n currentChangeOrderNumber = nil\n tmpChangeOrderObj = nil \n\n reader = PDF::Reader.new(pdfName)\n\n reader.pages.each{|x| #Iterate over each of the pages in the reader\n x.text.split(/\\n/).each{|y| #iterate over each line in the page\n\n if y[\"CHANGE ORDER\"] && y[\"Date:\"] #Does \"CHANGE ORDER\" occur in the string y\n if tmpChangeOrderObj.nil? == false && tmpChangeOrderObj.keys.count > 2\n o[:changeOrders] << tmpChangeOrderObj\n end\n\n currentChangeOrderDate = y.split(\"|\")[1] #we'll change this later for dates\n begin\n currentChangeOrderDate = Date.strptime(currentChangeOrderDate[currentChangeOrderDate.index(\"Date:\")+5...-1].strip,'%m/%d/%Y')\n rescue\n currentChangeOrderDate = \"FAILED TO PARSE DATE\"\n end\n\n currentChangeOrderNumber = y.split(\"|\")[0]\n tmpChangeOrderObj = {} \n tmpChangeOrderObj[:ChangeOrderNumber] = currentChangeOrderNumber\n tmpChangeOrderObj[:ChangeOrderDate] = currentChangeOrderDate\n end\n if currentChangeOrderDate.nil? then\n #if currentChangeOrderDate.nil? then\n #Parse the start date to determine sink\n\n begin\n \ty[\"Contract Date\"] \n o[:contractDate] = Date.strptime(y[y.index(\"Contract Date\")+13..-1].split*\"\", '%m/%d/%Y')\n rescue\n \tcontractDate = \"FAILED TO PARSE DATE\"\n end\n\n if y[\"Set/\"] && o[:houseTypeCode].nil?\n o[:houseTypeCode] = y[y.rindex(\"(\")+1..y.rindex(\"-\")-1]\n end\n if y[\"999QK00\"]\n #We’re definately in a color line\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n if y[\"UPDATE\"]\n o[:\"UpdatedColor\"] = y.split[8..-1]*\" \"\n #We’re on a color line *AND* it’s an update\n else\n #We’re on a color line *AND* it’s *NOT* an update\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n end\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] #If the current line contains \"freestanding\"\n o[:CooktopCode] = \"freestanding\"\n end\n if y[\"4CB\"] #If the current line contains \"4CB\"\n o[:CooktopCode] = \"jgp323setss\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"]) #If the current line contains \"4CF,4CH,4CQ\"\n o[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n o[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n o[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n o[:CooktopCode] = \"jgp633setss\"\n end\n\n #Parse the Faucet and Sink fixtures from the doc\n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n else\n #we're in change orders\n if y[\"999QK00\"] \n tmpChangeOrderObj[:ColorCode] = y.split[5..-3]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] \n tmpChangeOrderObj[:CooktopCode] = \"freestanding\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"])\n tmpChangeOrderObj[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CB\"]\n tmpChangeOrderObj[:CooktopCode] = \"jgp333setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n tmpChangeOrderObj[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n tmpChangeOrderObj[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n tmpChangeOrderObj[:CooktopCode] = \"jgp633setss\"\n end\n if y[\"KFK\"]\n tmpChangeOrderObj[:KitchenSink] = \"11409\"\n end\n if (y[\"KFL\"]|| y[\"KFM\"])\n tmpChangeOrderObj[:KitchenSink] = \"k3821-4\"\n end\n \n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n end \n \n }\n }\n return o\nend", "def sales_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) >= 0\")\n .group(\"spina_shop_invoices.id\")\n end", "def build_pdf_header(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def index\n manage_filter_state\n no = params[:No]\n supplier = params[:Supplier]\n project = params[:Project]\n order = params[:Order]\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @supplier = !supplier.blank? ? Supplier.find(supplier).full_name : \" \"\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @work_order = !order.blank? ? WorkOrder.find(order).full_name : \" \"\n @receipt_notes = receipts_dropdown if @receipt_notes.nil?\n @purchase_orders = unbilled_and_undelivered_purchase_orders_dropdown if @purchase_orders.nil?\n\n # Arrays for search\n @projects = projects_dropdown if @projects.nil?\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n\n @search = SupplierInvoice.search do\n with :project_id, current_projects\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !no.blank?\n if no.class == Array\n with :invoice_no, no\n else\n with(:invoice_no).starting_with(no)\n end\n end\n if !supplier.blank?\n with :supplier_id, supplier\n end\n if !project.blank?\n with :project_id, project\n end\n if !order.blank?\n with :work_order_id, order\n end\n data_accessor_for(SupplierInvoice).include = [:supplier_invoice_approvals, :supplier, :project]\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @supplier_invoices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplier_invoices }\n format.js\n end\n end", "def get_commoner_voices\n filtered_stories_ids = (\n get_featured_stories_ids +\n Story.published.commoners_voice\n .first(12)\n .pluck(:id)\n ).uniq.first(12)\n filtered_stories_ids.map { |id| Story.includes(:commoner, :tags, :comments, :images, :translations).find(id) }\n end", "def find_line(programming_grid, to_find, email, single, pg_lines_used)\n found = []\n # TODO: make it so the user inputs the tab so we dont have to do anything with the code\n # 8513-E-Mail Imp Grid -> older younger\n # E-Mail Imp Grid -> HCEA112\n programming_grid.email_sheet.sheet(\"Email\").each_row_streaming do |row|\n row.each do |r|\n unless r.value.nil? || (r.value.class == Integer)\n r.value.gsub!(/<(.*?)>/, \"\")\n r.value.gsub!(/’+/, \"\")\n r.value.gsub!(/\\s{2,20}/, \" \")\n unless single\n\n if (programming_grid.email_sheet.sheet(\"Email\").row(r.coordinate.row).compact.index{|s| s.to_s.downcase.include?(email.version.to_s.downcase) || s.to_s.downcase.include?(\"global\")}) && r.value.include?(to_find)\n found.push(row)\n pg_lines_used.push(r.coordinate.row)\n return found\n end\n else\n if r.value.include?(to_find)\n found.push(row)\n pg_lines_used.push(r.coordinate.row)\n return found\n end\n end\n end\n end\n end\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def build_pdf_header9(pdf)\n pdf.font \"Helvetica\" , :size => 6 \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.zone.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers_rpt.length >= row ? client_data_headers_rpt[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers_rpt.length >= row ? invoice_headers_rpt[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def format_output(orders)\n orders.each do |order_item|\n puts \"#{order_item[:requested_flower]} #{order_item[:flower_code]} $#{order_item[:total_price]}\"\n order_item[:order_bundles].each do |bundle|\n puts \" #{bundle[:number_of_flowers]} X #{bundle[:number_needed]} $#{bundle[:price]}\"\n end\n end\n end", "def index\n if current_user.customer?\n @contracts = Contract.where(customer: current_user)\n else\n @contracts = Contract.where(ninja: current_user).or(Contract.where(ninja: nil))\n end\n end", "def build_pdf_header4(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def commissioners\n find_related_frbr_objects( :is_commissioned_by, :which_roles?) \n end", "def generate_pdf\n\n @company_info = CompanyInfo.first\n @so_header = self.so_header\n content= product1= product2= product_description =''\n in_contact_title = in_contact_address1 = in_contact_address2 = in_contact_state = in_contact_czip = ''\n ship_contact_title = ship_contact_address1 = ship_contact_address2 = ship_contact_state = ship_contact_czip = ''\n\n if self.so_header.present?\n so = CommonActions.address(self.so_header)\n in_contact_title = '<span>'+so['b_c_title'].to_s+'</span>'\n in_contact_address1 = so['b_c_address_1'].to_s+'&nbsp;'\n in_contact_address2 = so['b_c_address_2'].to_s+'&nbsp;'\n in_contact_state = so['b_c_state'].to_s+'&nbsp;'\n so['b_c_country']= so['b_c_country'].present? ? so['b_c_country'] : ''\n so['b_c_zipcode']= so['b_c_zipcode'].present? ? so['b_c_zipcode'] : ''\n in_contact_czip = so['b_c_country'].to_s+'&nbsp;'+so['b_c_zipcode']\n ship_contact_title = '<span>'+so['s_c_title'].to_s+'</span>'\n ship_contact_address1 = so['s_c_address_1'].to_s+'&nbsp;'\n ship_contact_address2 = so['s_c_address_2'].to_s+'&nbsp;'\n ship_contact_state = so['s_c_state'].to_s+'&nbsp;'\n so['s_c_country']= so['s_c_country'].present? ? so['s_c_country'] : ''\n so['s_c_zipcode']= so['s_c_zipcode'].present? ? so['s_c_zipcode'] : ''\n ship_contact_czip = so['s_c_country'].to_s+'&nbsp;'+so['s_c_zipcode']\n end\n\n i = 1\n j = 1\n flag = 1\n flag2 = 1\n sub_total = 0.0\n\n s_sub_total = 0.0\n len = self.so_shipments.includes(:so_line, :receivable_so_shipment).length\n if len > 0\n sub_total+= self.so_shipments.includes(:so_line, :receivable_so_shipment).sum(\"so_shipped_cost\").to_f\n s_sub_total+= sub_total + self.receivable_freight.to_f\n\n self.so_shipments.includes(:so_line, :receivable_so_shipment).each_with_index do |so_shipment, index|\n if so_shipment.so_line.item_revision.present?\n product_description= '<td>'+so_shipment.so_line.item_revision.item_description+'</td>'\n end\n if so_shipment.so_line.item.item_part_no == so_shipment.so_line.item_alt_name.item_alt_identifier\n product1 = '<tr><th scope=\"row\">'+so_shipment.so_line.item.item_part_no+ '</th></tr>'\n else\n product1 = 'tr><th scope=\"row\">'+so_shipment.so_line.item.item_part_no+ '</th></tr>'\n product2 = '<tr><th scope=\"row\">'+so_shipment.so_line.item_alt_name.item_alt_identifier+'</th></tr>'\n end\n\n\n if i== 1\n content += ' <section><article class=\"ff\"><div class=\"ms_image\"><div class=\"ms_image-wrapper\"><img alt=Report_heading src=http://erp.chessgroupinc.com/'+@company_info.logo.joint.url(:original)+' /> </div><div class=\"ms_image-text\"><h3> '+@company_info.company_address1+' <br> '+@company_info.company_address2+' </h3><h5><span> P:</span> '+@company_info.company_phone1+' <br><span> F:&nbsp;</span> '+@company_info.company_fax\n content +=' </h5></div></div><div class=\"ms_image-2\"><h2> Invoice</h2><div class=\"ms_image-5\"><div class=\"ms_image-6\"><h4> Date</h4><h5> '+self.created_at.strftime(\"%m/%d/%Y\")+' </h5><div class=\"space\"></div><h4> Chess S.O.#</h4> <h5> '+@so_header.so_identifier+' </h5> </div><div class=\"ms_image-6 ms_image-7\"><h4> Inv No</h4><h5> '+self.receivable_identifier+' </h5><div class=\"space\"></div><h4> Customer P.O.#</h4> <h5> '+@so_header.so_header_customer_po\n content +=' </h5> </div><div class=\"clear\"></div></div></div></article>'\n if flag ==1\n content += '<article class=\"art-01\"><div class=\"ms_text-wra\"><h2></h2><div class=\"ms_text\"><h1 class=\"ms_heading\">Bill To :</h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+in_contact_title.to_s+''+in_contact_address1.to_s+''+in_contact_address2.to_s+''+in_contact_state.to_s+''+in_contact_czip.to_s+'</h2></div></div></div><div class=\"ms_text-wra-02\"><h2></h2><div class=\"ms_text-2\"><h1 class=\"ms_heading\">Ship To : </h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'\n content += ship_contact_title.to_s+''+ship_contact_address1.to_s+''+ship_contact_address2.to_s+''+ship_contact_state.to_s+''+ship_contact_czip.to_s+'</div></div></div></article>'\n flag =0;\n end\n\n if flag2 ==1\n content += '<article class=\"art-01 art-04 \"><table width=\"640\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr>'\n flag2=0;\n else\n content += '<article class=\"art-01 hei \"><table width=\"640\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr>'\n end\n end\n\n content += ' <tr class=\"h-pad\" valign=\"top\" align=\"left\"><td>'+so_shipment.so_line.so_line_quantity.to_s+'</td><td> '+so_shipment.so_shipped_count.to_s+'</td><td><table width=\"100%\" border=\"0\">'+product1+''+product2+'</table></td>'+product_description+'<td> '+so_shipment.so_line.so_line_sell.to_s+'</td><td>'+so_shipment.so_shipped_cost.to_s+'</td></tr>'\n\n if i==10\n content += '</table></article>'\n content += '<article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>'+j.to_s+' </span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>'\n content += ' <div style=\"page-break-after: always; \"> &nbsp; </div>'\n end\n\n if len == index+1 && i != 10\n # j = 1\n # j+=1\n content += '</table></article>'\n content += '<article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>'+j.to_s+'</span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>'\n content += '<div style=\"page-break-after: always;\"> &nbsp; </div>'\n end\n\n i +=1\n\n if i==11\n j+=1\n i= 1\n content\n end\n\n end\n content\n else\n content = '<section>\n <article class=\"ff\"><div class=\"ms_image\"><div class=\"ms_image-wrapper\"><img alt=Report_heading src=http://erp.chessgroupinc.com/'+@company_info.logo.joint.url(:original)+' /> </div><div class=\"ms_image-text\"><h3> '+@company_info.company_address1+' <br> '+@company_info.company_address2+' </h3><h5><span> P:</span> '+@company_info.company_phone1+' <br><span> F:&nbsp;</span> '+@company_info.company_fax+' </h5></div></div><div class=\"ms_image-2\"><h2> Invoice</h2><div class=\"ms_image-5\"><div class=\"ms_image-6\"><h4> Date</h4><h5> '+self.created_at.strftime(\"%m/%d/%Y\")+' </h5><div class=\"space\"></div><h4> Chess S.O.#</h4> <h5> </h5> </div><div class=\"ms_image-6 ms_image-7\"><h4> Inv No</h4><h5> '+self.receivable_identifier+' </h5><div class=\"space\"></div><h4> Customer P.O.#</h4> <h5> </h5> </div><div class=\"clear\"></div></div></div></article>\n <article class=\"art-01\"><div class=\"ms_text-wra\"><h2></h2><div class=\"ms_text\"><h1 class=\"ms_heading\">Bill To :</h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+in_contact_title.to_s+''+in_contact_address1.to_s+''+in_contact_address2.to_s+''+in_contact_state.to_s+''+in_contact_czip.to_s+'</h2></div></div></div><div class=\"ms_text-wra-02\"><h2></h2><div class=\"ms_text-2\"><h1 class=\"ms_heading\">Ship To : </h1> <div class=\"ms_text-6\"><h2 class=\"ms_sub-heading\">'+ship_contact_title.to_s+''+ship_contact_address1.to_s+''+ship_contact_address2.to_s+''+ship_contact_state.to_s+''+ship_contact_czip.to_s+'</div></div></div></article>\n <article class=\"art-01 art-04 \"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"640\"><tbody><tr align=\"center\" class=\"hea\"><td width=\"72\">ORDERED</td><td width=\"75\">SHIPPED</td><td width=\"67\">P/N</td><td width=\"224\">DESCRIPTION</td><td width=\"95\">PRICE/E</td><td width=\"107\">TOTAL</td></tr> <tr valign=\"top\" align=\"left\" class=\"h-pad\"><td></td><td></td><td><table border=\"0\" width=\"100%\"><tbody><tr><th scope=\"row\"></th></tr></tbody></table></td><td></td><td></td><td></td></tr></tbody></table></article>\n <article ><div class=\"footer\"><div class=\"page\"><h3>Page</h3><span>1 </span></div><div class=\"original\"><table width=\"250\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><th width=\"169\" align=\"right\" scope=\"row\">SUB TOTAL :</th><td width=\"131\" align=\"right\">'+sub_total.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">FREIGHT :</th><td align=\"right\">'+self.receivable_freight.to_s+'</td></tr><tr><th align=\"right\" scope=\"row\">TOTAL :</th><td align=\"right\">'+s_sub_total.to_s+' </td></tr></table></div></div></article> </section>\n </section><div style=\\\"page-break-after: always;\\\"> &nbsp; </div>'.html_safe\n end\n html = %'<!DOCTYPE html><html><head><title>Member Spotlight</title><style>@charset \"utf-8\";body{font-family:Arial,Helvetica,sans-serif;font-size:14px}*{margin:0;padding:0}.clear{clear:both}.ms_wrapper{height:auto; width:640px; margin: 0 0 0 40px;}.ms_wrapper section{height:auto;width:640px}.ms_wrapper .ms_heading{font-size:14px;margin:7px 0 0;padding:0 0 10px;text-decoration:underline}.ms_wrapper .ms_image{float:left;font-size:22px;height:93px;margin:21px 0 0;text-align:center;width:310px}.ms_wrapper .ms_heading-3{text-decoration:underline;font-size:14px;margin:0 0 4px;padding:0 0 10px;float:left}article.art-01{margin:0;padding:3px 0 0}.ms_image-6 h5{font-size:14px!important}.ms_image-6 h4{font-size:13px;margin:0;text-decoration:underline}.ms_text-wra{float:left}.ms_text-wra-02{float:right}.space{margin:5px 0}.ms_image-5{ height: 69px;border:1px solid maroon;border-radius:12px;padding:4px 34px}.ms_wrapper .ms_image-2{float:right;font-size:22px;height:119px;text-align:center;width:310px}.ms_wrapper article{float:left;width:100%;min-height:121px}.ms_text-6>h2{font-size:14px}.h-pad2{float:left;margin:29px 0 0!important}.h-pad>td{border-bottom:1px dashed #444;font-size:13px;margin:0;padding:10px 0;text-align:center}.h-pad2 strong{float:left;font-size:11px;font-weight:400;margin:0;width:100%}.art-08 td{border:1px solid #444;font-size:12px;padding:5px 0}.ms_wrapper .ms_text{ height: 104px !important;float:left;font-size:15px;min-height:104px;line-height:23px;width:300px;margin:0}.ms_wrapper .ms_offers{float:left;margin:12px 0 0;padding:10px 0 0;text-align:center}.ms_wrapper .ms_sub-heading{color:#000;font-size:11px;line-height:16px;margin:10px 0 0}.ms_sub-heading>span{float:left;font-size:13px;margin:0 0 5px;width:100%}.ms_text strong,.ms_text-2 strong{float:left;font-size:13px;font-weight:400;line-height:19px;width:100%}.ms_text1 strong{float:left;font-size:14px;line-height:19px;width:100%;margin:1px 0;text-align:center;font-weight:700}.ms_text-6.ms-33 .ms_sub-heading{font-size:17px}.ms_text-6.ms-33{text-align:center}.ms_image-2 h3{color:navy;font-size:21px;font-weight:400;margin:17px 0 0;text-decoration:underline}.ms_text-6>h3{float:left;margin:0;padding:18px 0 0;font-size:14px}.ms_text-6{float:left;margin:0;width:212px}.hea td{border:1px solid #444;font-size:14px;font-weight:700;padding:9px 0}.ms_image-2 h2{color:#111;font-size:20px;font-weight:700;margin:2px 0}.ms_image-6{float:left}.ms_image-7{float:right}.ms_image-2 h5{color:maroon;font-size:16px;font-weight:700;margin:0}.ms_text-3-wrapper{float:left}.ms_text-3-wrapper .ms_text-3{width:126px;float:left}.ms_text-3-wrapper .ms_text-5{width:204px;float:left;text-align:center}.ms_text-3-wrapper .ms_text-4{float:left;width:91px}article.art-02{margin:18px 0 0;padding:7px 0 0;border:1px solid #555;border-radius:15px}.ms_text-5>strong{font-weight:400}.ms_text-3-wrapper .ms_text-3 strong,.ms_text-3-wrapper .ms_text-4 strong{float:left;font-size:14px;font-weight:400;line-height:19px;width:100%;margin:6px 0;text-align:center}.ms_text-3-wrapper .ms_sub-heading{border-bottom:1px solid #555;font-size:13px;margin:21px 0 12px;padding:0 0 12px;text-align:center}.ms_sub{font-size:15px;text-align:center;text-decoration:underline;margin:2px 0 10px}.ms_text{border-bottom:1px solid #555;border-top:1px solid #555;float:left;padding:0 0 10px;width:310px}.ms_text-wra h2,.ms_text-wra-02 h2{font-size:16px}.ms_text-2{border-bottom:1px solid #555;border-top:1px solid #555;float:right;min-height:104px;height: 104px !important;padding:0 0 10px;width:300px}.ms_text-7>strong{float:none}.ms_text-7.ms_text-8{border-bottom:1px solid #555;padding:0 0 9px}.ms-1{float:left!important;text-align:right;width:95px!important}.ms_text-7.ms_text-9 strong{font-size:14px;font-weight:700}.ms_text-7{float:left;margin:4px 0;width:90%}.ms_text1{float:left;margin:12px 28px 0;width:42%}.ms-5{color:maroon}.ms-2{margin:0 0 0 38px}.ms_text-55{float:left;padding:0 3px 11px;width:310px}.ms_wrapper .ms_image2{margin:0 20px 0 0;border:1px solid #ccc;padding:20px 0;text-align:center;font-size:22px}.ms_image2 h2{font-size:17px;margin:0}.ms_image2 strong{color:maroon;float:left;font-size:22px;margin:0 0 8px;width:100%}.original td{font-size:14px;font-weight:700;color:maroon}.ms_image2 p{font-size:18px;margin:0;color:navy}.footer{float:left;margin:10px 0 0;width:640px}.page{float:left;margin:0 0 0 20px}.page h3{float:left;font-size:14px;font-weight:700;margin:0 21px 0 0}.page h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.original th{color:maroon}.original{border:2px solid maroon;border-radius:12px;float:right;padding:10px}.original h3{font-size:14px;font-weight:700;margin:12px 0 0}.original h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.ms_image-wrapper{float:left;height:69px;margin:20px 0 0 3px;width:150px}.ms_image-wrapper img{width:128px}.ms_image-text span{font-weight:700}.ms_image-text{float:right;margin:6px 10px 0 0;width:120px}.ms_image-text h2{font-size:13px;margin:19px 0 8px;text-decoration:underline}.ms_image-text h3{border-bottom:1px solid #555;font-size:9px;font-weight:400;margin:12px 0 6px;padding:0 0 7px}.ms_image-text h5{border-bottom:1px solid #555;font-size:9px;font-weight:400;margin:0;padding:0 0 7px}.page-center{float:left;margin:8px 36px;width:394px}.page-center h3{font-size:14px;font-weight:700;margin:12px 0 0}.page-center h4{font-size:12px;font-weight:400;margin:5px 0 12px;text-align:center}.h-pad th{font-weight:400}.foot{background-color:#fff}.top-003{position:fixed;top:0;background-color:#fff}.art-01.to-003{padding:130px 0 0}.art-01.art-04{height:444px;padding:0 0 20px}.art-01.hei{height:575px}</style></head><body><div class=\"ms_wrapper\" >#{content}</div><div style=\"page-break-after: always;\"> </div> </body></html>'\n\n\n # if Rails.env == \"production\"\n # # html = \"http://erp.chessgroupinc.com/po_headers/#{self.po_header.id}/purchase_report\"\n # end\n kit = PDFKit.new(html, :page_size => 'A4' )\n # Get an inline PDF\n pdf = kit.to_pdf\n p pdf\n # Save the PDF to a file\n path = Rails.root.to_s+\"/public/invoice_report\"\n if File.directory? path\n path = path+\"/\"+self.so_header.so_identifier.to_s+\".pdf\"\n kit.to_file(path)\n else\n Dir.mkdir path\n path = path+\"/\"+self.so_header.so_identifier.to_s+\".pdf\"\n kit.to_file(path)\n end\n\n\n end", "def billing_info\n left_col 0 do\n move_down(120) if @invoice.project.account.account_setting.logo_file_name\n if @invoice.address.present?\n with_font :h3, &->{ \"Bill to:\" }\n with_font :default, &->{ @invoice.address }\n end\n if @invoice.email.present?\n move_down(10) if @invoice.address.present?\n with_font :default, &->{ @invoice.email }\n end\n end\n end", "def generateObjectFromOrder_RYAN(pdfName)\n o={}\n o[:communityType] = 'RyanHomes'\n o[:fileName] = pdfName\n o[:changeOrders] = []\n currentChangeOrderDate = nil\n currentChangeOrderNumber = nil\n tmpChangeOrderObj = nil \n\n reader = PDF::Reader.new(pdfName)\n\n reader.pages.each{|x| #Iterate over each of the pages in the reader\n x.text.split(/\\n/).each{|y| #iterate over each line in the page\n\n if y[\"CHANGE ORDER\"] && y[\"Date:\"] #Does \"CHANGE ORDER\" occur in the string y\n if tmpChangeOrderObj.nil? == false && tmpChangeOrderObj.keys.count > 2\n o[:changeOrders] << tmpChangeOrderObj\n end\n\n currentChangeOrderDate = y.split(\"|\")[1] #we'll change this later for dates\n begin\n currentChangeOrderDate = Date.strptime(currentChangeOrderDate[currentChangeOrderDate.index(\"Date:\")+5...-1].strip,'%m/%d/%Y')\n rescue\n currentChangeOrderDate = \"FAILED TO PARSE DATE\"\n end\n\n currentChangeOrderNumber = y.split(\"|\")[0]\n tmpChangeOrderObj = {} \n tmpChangeOrderObj[:ChangeOrderNumber] = currentChangeOrderNumber\n tmpChangeOrderObj[:ChangeOrderDate] = currentChangeOrderDate\n end\n\n if currentChangeOrderDate.nil? then\n if y[\"KFK\"] #If the current line contains \"KFK\"\n o[:KitchenSink] = \"11444\"\n end\n\n if y[\"KFL\"] #If the current line contains \"KFL\"\n o[:KitchenSink] = \"11600\"\n end\n if y[\"999QK00\"]\n #We’re definately in a color line\n o[:ColorCode] = y.split[8..-1]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] #If the current line contains \"freestanding\"\n o[:CooktopCode] = \"freestanding\"\n end\n if y[\"4CB\"] #If the current line contains \"4CB\"\n o[:CooktopCode] = \"jgp329setss\"\n end\n if (y[\"4CC\"]|| y[\"4CF\"]) #If the current line contains \"4CC,4CF\"\n o[:CooktopCode] = \"jgp940sekss\"\n end\n if y[\"4CT\"] #If the current line contains \"4CT\"\n o[:CooktopCode] = \"pgp953setss\"\n end\n\n\n if y[\"FAUCET FIXTURES KITCHEN\"]\n if y[\"UPGRADE\"]\n #Faucet Fixtures Kitchen AND Upgrade\n o[:FaucetSpread] = 'faucet centered, handle 4\" to R, soap 4\" to R of handle' #faucet upgrade\n else\n #Faucet Fixtures Kitchen AND NOT Upgrade\n o[:FaucetSpread] = 'centered' #faucet standard\n end\n end\n else\n #we're in change orders\n if y[\"999QK00\"] \n tmpChangeOrderObj[:ColorCode] = y.split[5...-2]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] \n tmpChangeOrderObj[:CooktopCode] = \"freestanding\"\n end\n if (y[\"4CC\"]|| y[\"4CF\"])\n tmpChangeOrderObj[:CooktopCode] = \"jgp940sekss\"\n end\n if y[\"4CB\"]\n tmpChangeOrderObj[:CooktopCode] = \"jgp329setss\"\n end\n if y[\"4CT\"]\n tmpChangeOrderObj[:CooktopCode] = \"pgp953setss\"\n end\n if y[\"KFK\"]\n tmpChangeOrderObj[:KitchenSink] = \"11444\"\n end\n if y[\"KFL\"]\n tmpChangeOrderObj[:KitchenSink] = \"11600\"\n end\n if y[\"9FD\"]\n tmpChangeOrderObj[:FaucetSpread] = \"standard\"\n end\n if y[\"9FE\"]\n tmpChangeOrderObj[:FaucetSpread] = \"upgrade\"\n end\n end\n \n\n }#x.text.split.each\n }#reader.pages.each\n return o\nend", "def orders_from_shipinfo(si_list)\n orders = {}\n si_list.each do |si|\n orders[si.order_id] ||= []\n orders[si.order_id] << si\n end\n\n # return the hash for the template\n orders.keys.sort.map do |order_id|\n sis = orders[order_id]\n res = sis[0].add_to_hash({})\n res[\"check_ship_#{order_id}\"] = false\n res['line_items'] = sis.map do |si|\n si.add_to_hash({})\n end\n res\n end\n end", "def by_organisation_and_host_provider_pre_GST\n query = Query.find_by_sql(\n \"select o.id organisation_id, o.name organisation_name,hp.id host_provider_id, hp.name host_provider_name, o.residential_suburb organisation_suburb, o.not_gst_registered, sum(c.amount) sumamount\\n\"+\n \"from claims c\\n\"+\n \" join organisations o on o.id = c.organisation_id\\n\"+\n \" left join providers hp on hp.id = c.host_provider_id and hp.seperate_payment = 1\\n\"+\n \"where c.payment_run_id = #{self.id}\\n\"+\n \"and c.invoice_date < '#{Settings::GST_CHANGE.to_s(:db)}'\\n\"+\n \"group by o.id, o.name,o.residential_suburb,hp.id,hp.name,o.not_gst_registered\\n\"+\n \"order by 2,5\")\n query\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 sales\n sales_this_vendor_made = []\n sales_to_check = FarMar::Sale.all\n sales_to_check.each do |sale_to_check|\n if self.id == sale_to_check.vendor_id\n sales_this_vendor_made << sale_to_check\n end#of if\n end#of do\n return sales_this_vendor_made\n end", "def create_doc_records(proposal)\n\n #@field_delimiter = ',' # Delimiter for csv.\n EdiHelper.transform_log.write \"Transforming Hansa Carton Sales (HCS) for LoadOrder #{@record_map['id']}..\"\n\n # Get the LoadOrder\n begin\n load_order = LoadOrder.find(@record_map['id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - LoadOrder with id #{@record_map['id']} not found.\"\n end\n\n # Get the Load\n begin\n ld = Load.find(@record_map['load_id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - Load with id #{@record_map['load_id']} not found.\"\n end\n\n # Get the Order\n begin\n order = Order.find(@record_map['order_id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - Order with id #{@record_map['order_id']} not found.\"\n end\n trading_partner = PartiesRole.find(order.consignee_party_role_id).party_name\n\n load_voyage = LoadVoyage.find_by_load_id(@record_map['load_id'])\n# raise EdiOutError, \"#{@err_prefix} - LoadVoyage with load_id #{@record_map['load_id']} not found.\" if load_voyage.nil?\n if load_voyage.nil?\n port_code = nil\n else\n port = VoyagePort.find(:first,\n :select => 'voyage_ports.*',\n :joins => 'join load_voyage_ports on load_voyage_ports.voyage_port_id = voyage_ports.id\n join voyage_port_types on voyage_port_types.id = voyage_ports.voyage_port_type_id',\n :conditions => ['load_voyage_ports.load_voyage_id = ? and UPPER(voyage_port_types.voyage_port_type_code) = ?',\n load_voyage.id, 'ARRIVAL'])\n raise EdiOutError, \"#{@err_prefix} - No VoyagePort for LoadVoyage with load_id #{@record_map['load_id']}.\" if port.nil?\n port_code = port.port_code\n end\n\n # ---------\n # BH record (heading)\n # ---------\n # Headings are provided by the schema's defaults. No need to set values here.\n rec_set = HierarchicalRecordSet.new({}, 'BH')\n\n # ----------\n # HCS record\n # ----------\n\n load_orders = LoadOrder.find(:all,\n\n:select => 'cartons.carton_number, pallets.pallet_number, cartons.target_market_code, cartons.farm_code, pallets.consignment_note_number,\nload_orders.dispatch_consignment_number, cartons.carton_fruit_nett_mass, cartons.track_indicator_code, load_containers.container_code,\nvoyages.vessel_code, voyages.voyage_code, vessels.vessel_registration_number, cartons.season_code, cartons.organization_code,\ncartons.sell_by_code, load_details.id load_detail_id, cartons.grade_code, cartons.commodity_code, farms.farm_group_code,\nproduction_runs.parent_run_code, pallets.is_depot_pallet ,extended_fgs.id, fg_marks.ri_mark_code, fg_marks.ru_mark_code,\nfg_marks.fg_mark_code, fg_marks.tu_mark_code, extended_fgs.units_per_carton, extended_fgs.tu_gross_mass, extended_fgs.tu_nett_mass,\nextended_fgs.ri_diameter_range, unit_pack_products.unit_pack_product_code, carton_pack_products.carton_pack_product_code,\nitem_pack_products.marketing_variety_code, extended_fgs.ri_weight_range, extended_fgs.extended_fg_code,\nextended_fgs.ru_description AS extended_fg_ru_description, extended_fgs.old_fg_code, extended_fgs.marketing_org_code,\nextended_fgs.fg_code, treatments.treatment_type_code, treatments.description AS treatment_description,\ncarton_pack_styles.carton_pack_style_code, carton_pack_styles.description AS carton_pack_style_description,\nbasic_packs.basic_pack_code, basic_packs.short_code, basic_packs.length, basic_packs.width AS basic_pack_width,\nbasic_packs.height AS basic_pack_height, carton_pack_types.type_code AS carton_pack_type_type_code,\ncarton_pack_types.description AS carton_pack_type_description, carton_pack_products.height AS carton_pack_products_height,\ncarton_pack_products.type_code AS carton_pack_product_type_code, unit_pack_product_types.type_code AS unit_pack_product_type_type_code,\nunit_pack_product_types.description AS unit_pack_product_type_description, unit_pack_product_subtypes.subtype_code,\nunit_pack_product_subtypes.description AS unit_pack_product_subtype_description,\nunit_pack_products.nett_mass AS unit_pack_product_nett_mass, commodities.commodity_code, commodities.commodity_description_long,\ncommodities.commodity_description_short, marketing_varieties.marketing_variety_description, item_pack_products.grade_code,\nitem_pack_products.product_class_code, item_pack_products.standard_size_count_value, item_pack_products.size_ref,\nitem_pack_products.cosmetic_code_name, item_pack_products.treatment_code, item_pack_products.actual_count,\nextended_fgs.created_on, extended_fgs.updated_on,rmt_setups.variety_code,incoterms.incoterm_code,currencies.currency_code, order_products.price_per_carton',\n\n:joins => 'INNER JOIN load_details ON (load_orders.load_id = load_details.load_id)\nINNER JOIN pallets ON (load_details.id = pallets.load_detail_id)\nINNER JOIN cartons ON (pallets.id = cartons.pallet_id)\nINNER JOIN production_runs ON cartons.production_run_code = production_runs.production_run_code\nINNER JOIN production_schedules ON production_runs.production_schedule_id = production_schedules.id\nINNER JOIN rmt_setups ON production_schedules.id = rmt_setups.production_schedule_id\nINNER JOIN extended_fgs ON (cartons.extended_fg_code = extended_fgs.extended_fg_code)\nINNER JOIN fg_products ON (extended_fgs.fg_code = fg_products.fg_product_code)\nINNER JOIN item_pack_products ON (fg_products.item_pack_product_code = item_pack_products.item_pack_product_code)\nLEFT JOIN order_products ON (item_pack_products.item_pack_product_code = order_products.item_pack_product_code) and order_products.old_fg_code = extended_fgs.old_fg_code and order_products.order_id=load_details.order_id\nINNER JOIN unit_pack_products ON (fg_products.unit_pack_product_code = unit_pack_products.unit_pack_product_code)\nINNER JOIN carton_pack_products ON (fg_products.carton_pack_product_code = carton_pack_products.carton_pack_product_code)\nINNER JOIN fg_marks ON (extended_fgs.fg_mark_code = fg_marks.fg_mark_code)\nINNER JOIN treatments ON (item_pack_products.treatment_id = treatments.id)\nINNER JOIN carton_pack_styles ON (carton_pack_products.carton_pack_style_code = carton_pack_styles.carton_pack_style_code)\nINNER JOIN basic_packs ON (carton_pack_products.basic_pack_code = basic_packs.basic_pack_code)\nINNER JOIN commodities ON (item_pack_products.commodity_code = commodities.commodity_code)\nINNER JOIN marketing_varieties ON (item_pack_products.marketing_variety_code = marketing_varieties.marketing_variety_code)\nAND (item_pack_products.marketing_variety_id = marketing_varieties.id)\nINNER JOIN carton_pack_types ON (carton_pack_products.type_code = carton_pack_types.type_code)\nAND (carton_pack_products.carton_pack_type_id = carton_pack_types.id)\nINNER JOIN farms ON (cartons.farm_code = farms.farm_code)\nLEFT OUTER JOIN load_containers ON (load_orders.load_id = load_containers.load_id)\nLEFT OUTER JOIN load_voyages ON (load_orders.load_id = load_voyages.load_id)\nINNER JOIN orders ON (load_orders.order_id = orders.id)\nLEFT OUTER JOIN currencies ON (orders.currency_id = currencies.id)\nLEFT OUTER JOIN incoterms ON (orders.incoterm_id = incoterms.id)\nLEFT OUTER JOIN voyages ON (load_voyages.voyage_id = voyages.id)\nLEFT OUTER JOIN vessels ON (vessels.id = voyages.vessel_id)\nINNER JOIN unit_pack_product_types ON (unit_pack_products.type_code = unit_pack_product_types.type_code)\nINNER JOIN unit_pack_product_subtypes ON (unit_pack_products.subtype_code = unit_pack_product_subtypes.subtype_code)',\n\n:conditions => ['load_orders.id = ?', @record_map['id']])\n\n\n load_orders.each do |record|\n ucr = \"#{record.season_code[-1,1]}ZA01507472C#{trading_partner}\"\n\n count_array = LoadDetail.find_by_sql(['select count(cartons.id) FROM load_details join pallets on pallets.load_detail_id = load_details.id join cartons on cartons.pallet_id = pallets.id WHERE (load_details.id = ?)', record.load_detail_id])\n no_cartons = count_array[0].count\n #sell_by = no_cartons == 1 ? 'ndc' : record.sell_by_code\n #sell_by = record.sell_by_code == '-' ? 'ndc' : record.sell_by_code\n sell_by = record.sell_by_code == '-' ? 'ndc' : 'dc'\n\n line_type = record.is_depot_pallet == 't' ? 'Class1' : record.parent_run_code.nil? ? 'Class1': 'Class2'\n\n if record.is_depot_pallet == 't'\n account_code = 'DEPOT'\n # intake_header = IntakeHeadersProduction.find(:first,\n # :conditions => ['consignment_note_number = ?',\n # record.consignment_note_number])\n else\n intake_header = IntakeHeadersProduction.find(:first,\n :conditions => ['consignment_note_number = ?',\n record.consignment_note_number])\n account_code = intake_header.account_code\n end\n\n hcs_rec = HierarchicalRecordSet.new({\n 'carton_id' => record.carton_number,\n 'pallet_id' => record.pallet_number,\n 'tradingpartner' => trading_partner,\n 'extended_fg_code' => record.extended_fg_code,\n 'target_market' => record.target_market_code,\n 'load_no' => ld.load_number,\n 'grower_id' => record.farm_code,\n 'intake_consignment_id' => record.consignment_note_number,\n 'exit_reference' => record.dispatch_consignment_number,\n 'weight' => record.carton_fruit_nett_mass,\n 'raw_material_type' => record.track_indicator_code,\n 'remarks' => order.order_customer_detail.customer_order_number,\n 'container' => record.container_code,\n 'vessel_name' => record.vessel_code,\n 'voyage_no' => record.voyage_code,\n 'customerpono' => order.order_customer_detail.customer_order_number,\n 'ucr' => ucr,\n 'sell_by_code' => sell_by,\n 'fg_code' => record.fg_code,\n 'fg_mark_code' => record.fg_mark_code,\n 'units_per_carton' => record.units_per_carton,\n 'tu_gross_mass' => record.tu_gross_mass,\n 'tu_nett_mass' => record.tu_nett_mass,\n 'ri_diameter_range' => record.ri_diameter_range,\n 'ri_weight_range' => record.ri_weight_range,\n 'ru_description' => record.extended_fg_ru_description,\n 'old_fg_code' => record.old_fg_code,\n 'marketing_org_code' => record.organization_code,\n 'grade_code' => record.grade_code,\n 'standard_size_count_value' => record.standard_size_count_value,\n 'commodity_code' => record.commodity_code,\n 'ri_mark_code' => record.ri_mark_code,\n 'ru_mark_code' => record.ru_mark_code,\n 'tu_mark_code' => record.tu_mark_code,\n 'unit_pack_product_code' => record.unit_pack_product_code,\n 'carton_pack_product_code' => record.carton_pack_product_code,\n 'marketing_variety_code' => record.marketing_variety_code,\n 'extended_fg_ru_description' => record.extended_fg_ru_description,\n 'treatment_type_code' => record.treatment_type_code,\n 'treatment_description' => record.treatment_description,\n 'carton_pack_style_code' => record.carton_pack_style_code,\n 'carton_pack_style_description' => record.carton_pack_style_description,\n 'basic_pack_code' => record.basic_pack_code,\n 'short_code' => record.short_code,\n 'length' => record.length,\n 'basic_pack_width' => record.basic_pack_width,\n 'basic_pack_height' => record.basic_pack_height,\n 'carton_pack_type_type_code' => record.carton_pack_type_type_code,\n 'carton_pack_type_description' => record.carton_pack_type_description,\n 'carton_pack_products_height' => record.carton_pack_products_height,\n 'carton_pack_product_type_code' => record.carton_pack_product_type_code,\n 'unit_pack_product_type_type_code' => record.unit_pack_product_type_type_code,\n 'unit_pack_product_type_description' => record.unit_pack_product_type_description,\n 'subtype_code' => record.subtype_code,\n 'unit_pack_product_subtype_description' => record.unit_pack_product_subtype_description,\n 'unit_pack_product_nett_mass' => record.unit_pack_product_nett_mass,\n 'commodity_description_long' => record.commodity_description_long,\n 'commodity_description_short' => record.commodity_description_short,\n 'marketing_variety_description' => record.marketing_variety_description,\n 'product_class_code' => record.product_class_code,\n 'size_ref' => record.size_ref,\n 'cosmetic_code_name' => record.cosmetic_code_name,\n 'treatment_code' => record.treatment_code,\n 'actual_count' => record.actual_count,\n 'hansaworld' => trading_partner,\n 'account' => account_code,\n 'farmsubgroup' => record.farm_group_code,\n 'farmgroup' => record.farm_group_code,\n 'depot_indicator' => record.is_depot_pallet == 't' ? 'Depot' : 'Packed_at_Kromco',\n 'season' => record.season_code,\n 'linetypedesc' => line_type,\n 'port_of_destination' => port_code,\n 'cultivar' => record.variety_code,\n 'incoterm' => record.incoterm_code,\n 'currency' => record.currency_code,\n 'carton_price' => record.price_per_carton\n\t\t}, 'HCS')\n rec_set.add_child hcs_rec\n end\n\n rec_set\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 paginate_contracts(page, per_page, status, order)\n\n if order.downcase.starts_with?('contractor')\n\n order_by = order.split(' ')[1]\n sql = \"select distinct contracts.* from contracts\n left outer join contractors_contracts on contractors_contracts.contract_id = contracts.id\n left outer join contractors on contractors_contracts.contractor_id = contractors.id\n left outer join users on users.id = contractors.user_id\n where contracts.client_id = \" + id.to_s + \" and contracts.status = '\"+ status + \"' order by users.firstName \" + order_by\n\n data = Contract.find_by_sql(sql)\n data.paginate(:per_page => per_page, :page => (page || 1))\n\n else\n\n if status.nil? or status == 'ALL'\n\n self.contracts.paginate :per_page => per_page, :page => (page || 1), :order => order\n\n else\n\n self.contracts.paginate :per_page => per_page, :page => (page || 1), :conditions => [\"status = ?\", status], :order => order\n\n end\n\n end\n\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\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 list \n req = self.get_tree_request(:company_tree)\n req[:created_by] = current_user.account.id\n \n if (params[\"node\"] == 'source')\n res = []\n res.push({\n :id => 'company',\n :nid => 'company',\n :text => \"Company Orders\"\n })\n res.push({\n :id => 'created_by',\n :nid => 'created_by:' + self.current_user.account.id.to_s,\n :text => 'My Orders'\n })\n res.push({\n :id => 'quotes',\n :nid => 'is_quote:true',\n :text => \"Quotes\"\n })\n res.push({\n :id => 'today_pickup',\n :nid => 'today_pickup',\n :text => \"Today's Pickups\"\n })\n res.push({\n :id => 'today_delivery',\n :nid => 'today_delivery',\n :text => \"Today's Deliveries\"\n })\n else\n res = Order.get_tree_nodes(req)\n end\n render :json => res.to_json, :layout => false \n end", "def index\n \n \n @clients = Client.all\n if current_user.role==\"Wholesaler\" && params[:user]\n if params[:fecha]\n #@orders=Order.where(:commerce => params[:user], 'DATE(created_at) = :se_fech')\n @orders = Order.where(\n 'DATE(created_at) = :fecha and commerce = :comercio_u',\n fecha: params[:fecha], comercio_u: params[:user]\n ).desc\n else\n @orders=Order.where(:commerce => params[:user])\n end\n \n elsif current_user.role==\"Admin\" || current_user.role==\"Transfer\"\n if params[:created_at]==\"true\"\n @orders = Order.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day, status: params[:status]\n \n ).desc\n elsif params[:status]\n @orders = Order.where(\n 'status= :status',\n status: params[:status]\n ).desc\n else \n @orders = Order.all.desc\n #@orders = @orders.paginate(:page => 1, :per_page => 20)\n end\n \n if params[:search] && params[:valor_se]\n if params[:search] == \"Documento\"\n @orders = Order.where(\n 'document = :se_value',\n se_value: params[:valor_se]\n ).desc\n @orders = @orders.paginate(:page => 1, :per_page => 20)\n elsif params[:search] == \"Nombre\"\n @orders = Order.where(\n 'name = :se_value',\n se_value: params[:valor_se]\n ).desc\n #@orders = @orders.paginate(:page => 1, :per_page => 20)\n \n elsif params[:search] == \"Fecha\"\n @orders = Order.where(\n 'DATE(created_at) = :se_value',\n se_value: params[:valor_se]\n ).desc\n #@orders = @orders.paginate(:page => 1, :per_page => 20)\n \n end\n end\n \n elsif current_user.role==\"Commerce\" \n if params[:created_at]\n # @orders = Order.where(\n # 'created_at >= :today and commerce= :commerce',\n # :today => Time.now - 1.days, commerce: current_user.email\n #).desc\n #puts \"fskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaf\"\n @orders = Order.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day, :commerce => current_user.email, :status => params[:status])\n else\n #puts \"fskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaffskadljkjdfsalkjñasdfkñldjasfñldasfjdfaslñjasdflñkdsaf\"\n @orders = Order.where(commerce: current_user.email).desc\n end\n elsif current_user.role==\"Distributor\" \n if params[:fecha] && params[:user]\n #@orders=Order.where(:commerce => params[:user], 'DATE(created_at) = :se_fech')\n @orders = Order.where(\n 'DATE(created_at) = :fecha and commerce = :comercio_u',\n fecha: params[:fecha], comercio_u: params[:user]\n ).desc\n elsif params[:user]\n @orders=Order.where(:commerce => params[:user], :distributor => current_user.email)\n elsif params[:created_at]\n @orders = Order.where(\n 'created_at >= :today and distributor= :distributor',\n :today => Time.now - 1.days, distributor: current_user.email\n ).desc\n @orders = Order.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day, :distributor => current_user.email)\n else\n @orders = Order.where(distributor: current_user.email).desc\n end\n else\n redirect_to home_index_url\n end\n \n @orders = @orders.paginate(:page => 1, :per_page => 20).desc\n end", "def lines_to_tryton\n result = []\n\n order_items.each do |order_item|\n\n \tif tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n \t source_entity: 'product',\n \t\t source_id: \"#{order_item.item_id}-#{order_item.item_price_type}\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => \"#{order_item.item_description} (#{order_item.item_price_description})\",\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % order_item.item_unit_cost\n },\n \"quantity\" => order_item.quantity\n \t }\n end\n\n end\t\n return result\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def index\n @order_lines = current_user.orders.includes(:order_lines).where(closed: false).first.try(:order_lines) || []\n end", "def client_orders\n self.clients.map(&:orders)\n end", "def customers(from=nil, to=nil, sales_channel_code=nil)\n \n conditions = \"(status not in (1,5))\"\n query_parameters = []\n \n if !from.nil? and !to.nil?\n conditions << \"and (bookds_bookings.date_from >= ? and bookds_bookings.date_from <= ?)\"\n query_parameters << from\n query_parameters << to\n end \n\n if sales_channel_code.nil? or sales_channel_code.empty?\n conditions << \"and (sales_channel_code IS NULL or sales_channel_code = '')\" \n elsif sales_channel_code != 'all'\n conditions << \"and (sales_channel_code = ?)\" \n query_parameters << sales_channel_code \n end\n\n conditions.prepend(\"where \") unless conditions.empty?\n\n query = <<-QUERY\n select trim(upper(customer_surname)) as customer_surname, \n trim(upper(customer_name)) as customer_name, \n lower(customer_email) as customer_email, \n customer_phone,\n sales_channel_code,\n locds_address.street as street,\n locds_address.number as number,\n locds_address.complement as complement,\n locds_address.city as city,\n locds_address.state as state,\n locds_address.zip as zip,\n locds_address.country as country \n FROM bookds_bookings \n left join locds_address on locds_address.id = bookds_bookings.driver_address_id\n #{conditions}\n group by trim(upper(customer_surname)), trim(upper(customer_name)), lower(customer_email), customer_phone,\n sales_channel_code, street, number, complement, city, state, zip, country\n order by customer_surname, customer_name\n QUERY\n\n #p \"query: #{query} query_paramaters: #{query_parameters.inspect}\" \n\n if query_parameters.empty?\n repository.adapter.select(query)\n else\n repository.adapter.select(query, *query_parameters)\n end\n\n end", "def list_deliveries\n\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - guias\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n if(params[:search] and params[:search] != \"\")\n @deliveries = Delivery.where([\"company_id = ? AND code like ? \", @company.id, \"%\" + params[:search] + \"%\"]).paginate(:page => params[:page])\n\n else\n @deliveries = Delivery.where(company_id: @company.id).order(\"created_at desc \").paginate(:page => params[:page])\n @filters_display = \"none\"\n end\n else\n errPerms()\n end\n end", "def fulfilled_line_items\n return self.order_line_items.where(:status => 'shipped').all\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def list_my_orders(employee)\n # get undelivered from one employee\n orders = @order_repository.undelivered_orders_from(employee)\n @view.display_orders(orders)\n end", "def build_pdf_header_rpt(pdf)\n pdf.font \"Helvetica\" , :size => 8\n\n $lcFecha1= Time.zone.now.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers_rpt.length, invoice_headers_rpt.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers_rpt.length >= row ? client_data_headers_rpt[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers_rpt.length >= row ? invoice_headers_rpt[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def invoices_report\n @d = ActiveRecord::Base.connection.execute(\"\nselect c.customer_id, c.name, o.order_id, o.order_date,p.description, ol.product_id, sum(ol.ordered_quantity) as quantity, p.standard_price, sum(p.standard_price*ol.ordered_quantity) as total from customers c inner join orders o on c.customer_id = o.customer_id inner join order_lines ol on ol.order_id = o.order_id inner join products p on p.product_id = ol.product_id where p.id <= 8 group by c.name\n\")\n end", "def related_clinics\n _clinics = []\n under_supervision_clinics.each do |c|\n unless _clinics.include?(c)\n _clinics.append(c)\n end\n end\n clinics.each do |c|\n unless _clinics.include?(c)\n _clinics.append(c)\n end\n end\n return _clinics\n end", "def claims_for_organisation_host_provider_programme(organisation_id,host_provider_id,programme_id,order_by_host_provider=false)\n filter = \"\";\n if ( host_provider_id.blank? )\n # all providers who are not paid seperately or no provider specified.\n filter = \"and ( hp.seperate_payment is null OR hp.seperate_payment = 0 OR hp.id is null )\"\n else\n filter = \"and c.host_provider_id = #{host_provider_id}\"\n end\n # MS: 2011-07-22 Change order by for Dodson M/c - Want detailed by provider grouping, Not just summary $'s\n order_by = 'c.invoice_no, c.invoice_date, c.id'\n order_by = 'c.host_provider_id, c.invoice_no, c.invoice_date, c.id' if ( order_by_host_provider )\n \n # MS: 2011-10-17 - Speed up - only need claim_status_description, where payment_run = 0 (i.e.Not paid) \n query = Query.find_by_sql(\n \"select c.id claim_id, c.invoice_date, c.invoice_no, c.payment_run_id,\\n\"+\n \" c.claim_status_id, '' claim_status_description,\\n\"+\n \" c.host_provider_id, hp.name host_provider_name,\\n\"+\n \" c.amount, c.comment, c.date_service,\\n\"+\n \" p.family_name, p.given_names, p.nhi_no,\\n\"+\n \" f.description fee_description \\n\"+\n \"from claims c\\n\"+\n \" join patients p on p.id = c.patient_id\\n\"+\n \" join fee_schedules f on f.id = c.fee_schedule_id\\n\"+\n # \" join claim_statuses cs on cs.id = c.claim_status_id\\n\"+\n \" left join providers hp on hp.id = c.host_provider_id\\n\"+\n \"where c.organisation_id = #{organisation_id} and c.payment_run_id = #{self.id} and c.programme_id = #{programme_id}\\n\"+\n \"#{filter}\\r\\n\"+\n # Added to include, Rejected Claims\n \"UNION\\n\"+\n \"select c.id claim_id, c.invoice_date, c.invoice_no, c.payment_run_id,\\n\"+\n \" c.claim_status_id, cs.description claim_status_description,\\n\"+\n \" c.host_provider_id, hp.name host_provider_name,\\n\"+\n \" c.amount, c.comment, c.date_service,\\n\"+\n \" p.family_name, p.given_names, p.nhi_no,\\n\"+\n \" f.description fee_description \\n\"+\n \"from claims c\\n\"+\n \" join patients p on p.id = c.patient_id\\n\"+\n \" join fee_schedules f on f.id = c.fee_schedule_id\\n\"+\n \" join claim_statuses cs on cs.id = c.claim_status_id\\n\"+\n \" left join providers hp on hp.id = c.host_provider_id\\n\"+\n \"where c.organisation_id = #{organisation_id} and c.payment_run_id = 0 and c.programme_id = #{programme_id}\\n\"+\n \" and c.invoice_date >= #{Query.connection.quote(Query.connection.quoted_date(self.cut_off_date.last_month))}\\n\"+\n \" and c.invoice_date < #{Query.connection.quote(Query.connection.quoted_date(self.cut_off_date))}\\n\"+\n \" and c.claim_status_id = #{ClaimStatus::DECLINED}\\n\"+\n \"#{filter}\\r\\n\"+\n \"order by #{order_by}\")\n query\n end", "def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end", "def check_by_office\n _r = false\n # global_office_breakdown returns multidimensional array containing different office in each line\n # Each line contains 5 elements: Office Id, max_order_total, max_order_price, Net amount sum by project & Item net price\n a = global_office_breakdown(purchase_order_items.joins(:project).order(:office_id))\n d = a.detect { |f| (f[1] > 0 && (f[3] > f[1])) || (f[2] > 0 && (f[4] > f[2])) }\n _r = d.nil? ? false : true\n end", "def list_inviting_agent_and_property\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n #if true\n @current_user = Vendor.find(533)\n vendor_id = @current_user.id\n invited_vendors = InvitedVendor.where(email: @current_user.email, source: Vendor::INVITED_FROM_CONST[:family]).select([:agent_id, :udprn])\n udprns = invited_vendors.map(&:udprn)\n bulk_details = PropertyService.bulk_details(udprns)\n response = []\n\n bulk_details.each_with_index do |detail, index|\n detail[:address] = PropertyDetails.address(detail)\n response_hash = {}\n response_hash[:udprn] = detail[:udprn]\n response_hash[:address] = detail[:address]\n agent_fields = [:agent_id, :assigned_agent_first_name, :assigned_agent_last_name, :assigned_agent_email, :assigned_agent_mobile,\n :assigned_agent_office_number, :assigned_agent_image_url, :assigned_agent_branch_name, :assigned_agent_branch_number,\n :assigned_agent_branch_address, :assigned_agent_branch_website, :assigned_agent_branch_logo]\n property_attrs = [:beds, :baths, :receptions, :property_type, :property_status_type ]\n agent_fields.each {|field| response_hash[field] = detail[field] }\n property_attrs.each {|field| response_hash[field] = detail[field] }\n response.push(response_hash)\n end\n\n render json: response, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end", "def show\n @booth_chairs = @organization.booth_chairs\n @tools = Tool.checked_out_by_organization(@organization).just_tools\n @shifts = @organization.shifts\n @participants = @organization.participants\n @charges = @organization.charges\n end", "def pre_index\n from = params[:From]\n to = params[:To]\n # OCO\n init_oco if !session[:organization]\n if !to.blank? and !from.blank?\n # @pre_bills = PreBill.where(project_id: current_projects_ids).where(\"bill_date >= ? AND bill_date <= ?\",from.to_date, to.to_date).group_by{|p| p.pre_group_no }.to_a.paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n @pre_bills = PreBill.select('pre_group_no, min(bill_date) as billing_date, count(*) as billing_count, min(billing_periods.period) as billing_period, max(bill_id) billed_id, sum(pre_invoices.totals) as billing_total') \\\n .joins('LEFT JOIN (pre_invoices LEFT JOIN billing_periods ON pre_invoices.billing_period_id=billing_periods.id) ON pre_bills.id=pre_invoices.pre_bill_id') \\\n .where(project_id: current_projects_ids) \\\n .where(\"bill_date BETWEEN ? AND ?\", from.to_date, to.to_date) \\\n .group(:pre_group_no) \\\n .paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n elsif !to.blank?\n # @pre_bills = PreBill.where(project_id: current_projects_ids).where(\"bill_date <= ?\", to.to_date).group_by{|p| p.pre_group_no }.to_a.paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n @pre_bills = PreBill.select('pre_group_no, min(bill_date) as billing_date, count(*) as billing_count, min(billing_periods.period) as billing_period, max(bill_id) billed_id, sum(pre_invoices.totals) as billing_total') \\\n .joins('LEFT JOIN (pre_invoices LEFT JOIN billing_periods ON pre_invoices.billing_period_id=billing_periods.id) ON pre_bills.id=pre_invoices.pre_bill_id') \\\n .where(project_id: current_projects_ids) \\\n .where(\"bill_date <= ?\", to.to_date) \\\n .group(:pre_group_no) \\\n .paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n elsif !from.blank?\n # @pre_bills = PreBill.where(project_id: current_projects_ids).where(\"bill_date >= ?\", from.to_date).group_by{|p| p.pre_group_no }.to_a.paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n @pre_bills = PreBill.select('pre_group_no, min(bill_date) as billing_date, count(*) as billing_count, min(billing_periods.period) as billing_period, max(bill_id) billed_id, sum(pre_invoices.totals) as billing_total') \\\n .joins('LEFT JOIN (pre_invoices LEFT JOIN billing_periods ON pre_invoices.billing_period_id=billing_periods.id) ON pre_bills.id=pre_invoices.pre_bill_id') \\\n .where(project_id: current_projects_ids) \\\n .where(\"bill_date >= ?\", from.to_date) \\\n .group(:pre_group_no) \\\n .paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n else\n # @pre_bills = PreBill.where(project_id: current_projects_ids).group_by{|p| p.pre_group_no }.to_a.paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n @pre_bills = PreBill.select('pre_group_no, min(bill_date) as billing_date, count(*) as billing_count, min(billing_periods.period) as billing_period, max(bill_id) billed_id, sum(pre_invoices.totals) as billing_total') \\\n .joins('LEFT JOIN (pre_invoices LEFT JOIN billing_periods ON pre_invoices.billing_period_id=billing_periods.id) ON pre_bills.id=pre_invoices.pre_bill_id') \\\n .where(project_id: current_projects_ids) \\\n .group(:pre_group_no) \\\n .paginate(:page => params[:page] || 1, :per_page => per_page || 10)\n end\n # Resume info\n if !params[:pre_bill_no].blank?\n @invoices_by_biller = PreBill.select('companies.name as company,min(invoices.invoice_no) as from_no,max(invoices.invoice_no) as to_no,sum(invoices.totals) as invoiced_total') \\\n .joins('INNER JOIN (bills INNER JOIN (invoices LEFT JOIN companies ON invoices.biller_id=companies.id) ON bills.id=invoices.bill_id) ON pre_bills.bill_id=bills.id') \\\n .where('pre_bills.pre_group_no = ? AND pre_bills.bill_id IS NOT NULL', params[:pre_bill_no]) \\\n .group('invoices.biller_id')\n # @invoices_by_biller = PreBill.where(\"pre_group_no = ? AND bill_id IS NOT NULL\", params[:pre_bill_no]).map(&:bill).map(&:invoices).flatten.group_by(&:biller_id)\n end\n\n respond_to do |format|\n format.html # pre_index.html.erb\n format.json { render json: @pre_bills }\n format.js\n end\n end", "def tracking_orders\n return [] if !is_employee?\n employee.orders\n end", "def orders\n Order.find_all_by_origin_code(\"smnl#{id}\")\n end", "def split_order\n # Lineas de productos identificadas por taxonomias\n @taxonomias = Spree::Taxon.where(parent_id: [1])\n # Creamos el hash de array donde almacenaremos las lineas de productos por taxonomias.\n @productos_por_taxonomias = Hash.new\n # LLenamos el hash\n @taxonomias.each do |taxonomia|\n @productos_por_taxonomias[taxonomia.name] = []\n end\n @order.line_items.each do |item|\n item.variant.product.taxons.each do |taxon|\n if @productos_por_taxonomias[taxon.parent.name]\n @productos_por_taxonomias[taxon.parent.name].append(item)\n end\n end\n end\n end", "def index\n @order_lines = OrderLine.all\n end", "def get_order_information_from_csc\n {\n id: csc_order_number_txt.text,\n prod_detail: csc_prod_detail_tbl.text,\n shipping_detail: csc_shipping_detail_tbl.text,\n billing_detail: csc_billing_detail_tbl.text,\n subject: csc_subject_order_txt.text\n }\n end", "def show\n\n @client = Client.find(@invoice.client_id)\n @total_items = Item.where(invoice_id: @invoice.id).sum(:total_value_sale)\n @lucro_total = Item.where(invoice_id: @invoice.id).sum(:profit_sale)\n @products = Product.order(:name)\n\n end", "def invoices\n return Xero.get_invoices(self)\n end", "def customers_with_outstanding_payment\n @objects = Customer.all_with_outstanding_payments\n \n add_breadcrumb \"Monitor Hutang\", 'customers_with_outstanding_payment_url' \n end", "def getHeaderDependencesAbsOrRel(builder, srcfile, print)\n\t\tif print\n\t\t\tputs \"running gcc dependence printer on #{srcfile}\"\n\t\tend\n\t\t\n\t\t#don't need to src2build() the output dir because the builder's dir is already under the build tree\n\t\toutfilename = @tmpdir.join('includes.list') #write to file in case stdout gets muddied by preprocessor errors\n\t\t\n\t\t#gcc -M flag lists included headers; with -M, -MG means assume missing files are generated, and -MF specifies outfilename for header list\n\t\tcmd = \"#{compileCmd(srcfile)} #{@INCDIRS.map {|dirpath| \"-I#{dirpath}\"}.join(' ')} -MF #{outfilename} -M -MG #{srcfile.to_s}\"\n\t\t\n#\t\tputs cmd\n\t\t`#{cmd}`\n\t\tif $?.to_i != 0\n\t\t\traise \"gcc dependence printer found errors; killing rake\"\n\t\telse\n\t\t\tfid = File.open(outfilename)\n\t\t\toutput = fid.map {|line| line.to_s}.join('')\n\t\t\tfid.close()\n\t\t\t`#{$RM} #{outfilename}`\n\t\t\tfilenames = output.gsub(/\\\\\\n/, ' ').gsub(/:\\s+/, ' ').gsub(/([^\\\\])\\s+/, \"\\\\1 \").split(/\\s+/) #regexes specific to gcc-like output\n\t\t\tfilenames.shift; filenames.shift #remove object filename and source filename; rest are headers\n\t\t\treturn filenames\n\t\tend\n\tend", "def all\n list_embedded Organization.exists(carrier_profile: true).order_by([:legal_name]).to_a\n end", "def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def initialize(project_ids, companies_ids, iterations,tags_ids, options = {})\r\n #Rails.logger.debug \"\\n===== only_holidays: #{options[:only_holidays]}\"\r\n #Rails.logger.debug \"\\n===== group_by_person: #{options[:group_by_person]}\"\r\n #Rails.logger.debug \"\\n===== group_by_person: #{options[:group_by_person]}\\n\\n\"\r\n \r\n return if project_ids.size==0 or companies_ids.size==0\r\n @projects = Project.find(:all, :conditions=>[\"id in (#{project_ids.join(',')})\"])\r\n # calculate lines\r\n cond = \"\"\r\n cond += \" and wl_type=300\" if options[:only_holidays] == true\r\n\r\n if iterations.size == 0\r\n @names = project_ids.map{ |id| Project.find(id).name}.join(', ')\r\n else\r\n @names = \"\"\r\n cpt = 0\r\n project_ids.each do |id|\r\n cpt = cpt+1\r\n @names << Project.find(id).name\r\n @names << \" [#{iterations.map{|i| i.name}.join(', ')}]\"\r\n end\r\n end\r\n if Company.find(:all).size == companies_ids.size\r\n @companies = \"All\"\r\n else\r\n @companies = companies_ids.map{ |id| Company.find(id).name}.join(', ')\r\n end\r\n \r\n persons_companies = Person.find(:all, :conditions=>[\"company_id in (#{companies_ids.join(',')})\"]).map{|p| p.id}\r\n # Case: no iteration selected\r\n if iterations.size==0\r\n if persons_companies.size==0\r\n @wl_lines =[]\r\n else\r\n @wl_lines = WlLine.find(:all, :conditions=>[\"project_id in (#{project_ids.join(',')})\"+cond+\" and person_id in (#{persons_companies.join(',')})\"], :include=>[\"request\",\"wl_line_task\",\"project\"])\r\n end\r\n else\r\n # Case: iteration(s) selected\r\n if persons_companies.size==0\r\n @wl_lines =[]\r\n else\r\n project_ids_without_iterations =[] # Array which contains ids of projects we don't want to filter with iterations\r\n project_ids_with_iterations =[] # Array which contains ids of projects we want to filter with iterations \r\n project_ids.each do |p|\r\n project_ids_without_iterations << p\r\n end\r\n iterations.each do |i|\r\n if project_ids_without_iterations.include? i[:project_id].to_s\r\n project_ids_without_iterations.delete(i[:project_id].to_s) \r\n project_ids_with_iterations << i[:project_id].to_s\r\n end\r\n end\r\n # Generate lines without iterations\r\n if project_ids_without_iterations.size>0\r\n @wl_lines = WlLine.find(:all, :conditions=>[\"project_id in (#{project_ids_without_iterations.join(',')})\"+cond+\" and person_id in (#{persons_companies.join(',')})\"], :include=>[\"request\",\"wl_line_task\",\"project\"])\r\n else\r\n @wl_lines = []\r\n end\r\n\r\n # Generate lines with iterations\r\n if project_ids_with_iterations.size>0\r\n wl_lines_with_iteration = WlLine.find(:all, :conditions=>[\"project_id in (#{project_ids_with_iterations.join(',')})\"+cond+\" and person_id in (#{persons_companies.join(',')})\"], :include=>[\"request\",\"wl_line_task\",\"project\"])\r\n wl_lines_with_iteration.each do |l|\r\n add_line_condition = false\r\n if l.sdp_tasks\r\n line_iterations = []\r\n iterations.each do |i|\r\n if i[:project_id]==l.project_id\r\n line_iterations << [i[:name],i[:project_code]]\r\n end\r\n end\r\n\r\n l.sdp_tasks.each do |s|\r\n add_line_condition = true if line_iterations.include? [s.iteration,s.project_code] \r\n end\r\n end\r\n # Line respecting conditions added to the workload lines\r\n @wl_lines << l if add_line_condition\r\n end\r\n end \r\n end\r\n end\r\n # Case: tags selected\r\n @wl_lines = @wl_lines.select{|l|l.tag_in(tags_ids) == true} if tags_ids.size > 0\r\n\r\n uniq_person_number = @wl_lines.map{|l| l.person_id}.uniq.size\r\n\r\n if options[:group_by_person]\r\n persons_id = []\r\n groupBy_lines = []\r\n person_task = Hash.new \r\n @wl_lines.each_with_index do |l, index|\r\n if not persons_id.include?(l.person_id)\r\n persons_id.push(l.person_id)\r\n # Create a line for each person\r\n if person_is_uniq?(l.person_id, @wl_lines)\r\n # person appears only once in all the lines\r\n groupBy_lines << l\r\n else\r\n # person appears several times in all the lines\r\n line = VirtualWlLine.new\r\n init_line(line, l)\r\n groupBy_lines << line\r\n end\r\n person_task[l.person_id] = Hash.new\r\n if l.sdp_tasks.size == 0\r\n person_task[l.person_id][:sdp] = false\r\n else\r\n person_task[l.person_id][:sdp] = true\r\n end\r\n if l.sdp_tasks\r\n person_task[l.person_id][:initial] = l.sdp_tasks_initial.to_f #if l.sdp_task.initial\r\n person_task[l.person_id][:balancei] = l.sdp_tasks_balancei.to_f #if l.sdp_task.balancei\r\n person_task[l.person_id][:remaining] = l.sdp_tasks_remaining.to_f #if l.sdp_task.remaining\r\n person_task[l.person_id][:consumed] = l.sdp_tasks_consumed\r\n else\r\n person_task[l.person_id][:initial] = 0.0\r\n person_task[l.person_id][:balancei] = 0.0\r\n person_task[l.person_id][:remaining] = 0.0\r\n person_task[l.person_id][:consumed] = 0.0\r\n end\r\n else\r\n # Update each line for each person with multiple lines\r\n selected_line = groupBy_lines.find{|t| t.person_id == l.person_id}\r\n selected_line.projects << l.project if not selected_line.projects.include?(l.project)\r\n selected_line.sdp_tasks += l.sdp_tasks\r\n selected_line.alert_sdp_task = true if l.sdp_tasks.size == 0\r\n selected_line.number += 1\r\n selected_line.wl_type = ApplicationController::WL_LINE_CONSOLIDATED\r\n selected_line.wl_loads += l.wl_loads\r\n #Rails.logger.info \"===== adding #{l.wl_loads.map{|load| load.wlload}.inject(:+)}\"\r\n if l.sdp_tasks.size > 0\r\n person_task[l.person_id][:initial] += l.sdp_tasks_initial.to_f\r\n person_task[l.person_id][:balancei] += l.sdp_tasks_balancei.to_f\r\n person_task[l.person_id][:remaining] += l.sdp_tasks_remaining.to_f\r\n person_task[l.person_id][:consumed] += l.sdp_tasks_consumed\r\n person_task[l.person_id][:sdp] = true\r\n end\r\n l.tags.each do |t|\r\n selected_line.tags << t if !selected_line.tags.include?(t)\r\n end\r\n end\r\n end\r\n\r\n max = (groupBy_lines.select { |l| l.wl_type != 500}.map{ |l| l.id}.max || 0) + 1\r\n groupBy_lines.select { |l| l.wl_type == 500}.each_with_index { |l, index| \r\n l.id = max + index \r\n #Rails.logger.info \"===== ID: #{l.id}\"\r\n #Rails.logger.info \"====== loads: #{l.wl_loads.select{|l| l.week <= 201330}.map{|l| l.wlload }.inject(:+)}\"\r\n }\r\n @wl_lines = groupBy_lines\r\n end \r\n\r\n # no need to add a holidays line in DB for a projet. It will be consolidated at running time\r\n #if options[:only_holidays] != true\r\n # @wl_lines << WlLine.create(:name=>\"Holidays\", :request_id=>nil, :project_id=>project_id, :wl_type=>WorkloadsController::WL_LINE_HOLIDAYS) if @wl_lines.size == 0\r\n #end\r\n @nb_total_lines = @wl_lines.size # must be after the preceding test as we suppress line and if wl_lines.size is 0 then we create a new Holidays line\r\n if options[:hide_lines_with_no_workload]\r\n @displayed_lines = @wl_lines.select{|l| l.near_workload > 0}\r\n else\r\n @displayed_lines = @wl_lines\r\n end\r\n @displayed_lines = @displayed_lines.sort_by { |l| l.display_name(:with_project_name=>false, :with_person_name=>true, :with_person_url=>false).upcase }\r\n @nb_current_lines = @displayed_lines.size\r\n @nb_hidden_lines = @nb_total_lines - @nb_current_lines\r\n from_day = Date.today - (Date.today.cwday-1).days\r\n farest_week = wlweek(from_day+APP_CONFIG['workloads_months'].to_i.months)\r\n @wl_weeks = []\r\n @weeks = []\r\n @opens = []\r\n @ctotals = []\r\n @cprodtotals= []\r\n @availability = []\r\n @percents = []\r\n @months = []\r\n @days = []\r\n month = Date::ABBR_MONTHNAMES[(from_day+4.days).month]\r\n month_displayed = false\r\n week_counter = 0\r\n iteration = from_day\r\n # raise \"test = #{wlweek(Date.today+1)}\"\r\n @next_month_percents = 0.0\r\n @three_next_months_percents = 0.0\r\n @sum_availability = 0\r\n while true\r\n w = wlweek(iteration) # output: year + week (201143)\r\n break if w > farest_week or week_counter > 36*4\r\n # months\r\n current_month = Date::ABBR_MONTHNAMES[(iteration+4.days).month]\r\n if current_month != month\r\n month = current_month\r\n month_displayed = false\r\n end\r\n if not month_displayed\r\n @months << month\r\n month_displayed = true\r\n else\r\n @months << ''\r\n end\r\n @days << filled_number(iteration.day,2) + \"-\" + filled_number((iteration+4.days).day,2)\r\n @wl_weeks << w\r\n @weeks << iteration.cweek\r\n open = 5*uniq_person_number\r\n @wl_lines.map{|l| l.person_id}.uniq.each do |person_id|\r\n company = Company.find_by_id(Person.find_by_id(person_id).company_id)\r\n open = open - WlHoliday.get_from_week_and_company(w,company)\r\n end \r\n\r\n #@opens << 5*uniq_person_number - WlHoliday.get_from_week(w)*uniq_person_number\r\n opens << open\r\n if @wl_lines.size > 0\r\n col_sum = col_sum(w, @wl_lines)\r\n @ctotals << {:name=>'ctotal', :id=>w, :value=>col_sum}\r\n @cprodtotals << {:id=>w, :value=>col_prod_sum(w, @wl_lines)}\r\n if @opens and @opens.last > 0\r\n percent = (@ctotals.last[:value] / @opens.last)*100\r\n else\r\n percent = 100\r\n end\r\n open = @opens.last\r\n avail = [0,(open-col_sum)].max\r\n if open > 0\r\n avail_percent = (avail/open).round\r\n else\r\n avail_percent = 0\r\n end\r\n @availability << {:name=>'avail',:id=>w, :avail=>avail, :value=>(avail==0 ? '' : avail), :percent=>avail_percent}\r\n @sum_availability += (avail==0 ? '' : avail).to_f if week_counter<=8\r\n @next_month_percents += percent if week_counter < 5\r\n @three_next_months_percents += percent if week_counter >= 0 and week_counter < 0+12 # if week_counter >= 5 and week_counter < 5+12 # 28-Mar-2012: changed\r\n @percents << {:name=>'cpercent', :id=>w, :value=>percent.round.to_s+\"%\", :precise=>percent}\r\n end\r\n iteration += 7.days\r\n week_counter += 1\r\n end\r\n @next_month_percents = (@next_month_percents / 5).round\r\n @three_next_months_percents = (@three_next_months_percents / 12).round\r\n\r\n # sum the lines\r\n @line_sums = Hash.new\r\n today_week = wlweek(Date.today)\r\n @total = 0\r\n @planned_total = 0\r\n @sdp_remaining_total = 0\r\n @sdp_consumed_total = 0\r\n @other_lines_count = 0\r\n @other_days_count = 0\r\n @to_be_validated_in_wl_remaining_total = 0\r\n for l in @wl_lines\r\n @line_sums[l.id] = Hash.new\r\n #@line_sums[l.id][:sums] = l.wl_loads.map{|load| (load.week < today_week ? 0 : load.wlload)}.inject(:+)\r\n \r\n @line_sums[l.id][:sums] = l.planned_sum\r\n #Rails.logger.info \"===== adding #{l.planned_sum} to #{l.id}\"\r\n \r\n if l.wl_type <= 200 or l.wl_type == 500\r\n @total += l.sum.to_f\r\n @planned_total += @line_sums[l.id][:sums]\r\n else\r\n @other_lines_count += 1\r\n @other_days_count += l.sum.to_f\r\n end\r\n\r\n if (options[:group_by_person])\r\n @sdp_remaining_total += person_task[l.person_id][:remaining]\r\n @line_sums[l.id][:init] = person_task[l.person_id][:initial]\r\n @line_sums[l.id][:balance] = person_task[l.person_id][:balancei]\r\n @line_sums[l.id][:remaining] = person_task[l.person_id][:remaining]\r\n @line_sums[l.id][:consumed] = person_task[l.person_id][:consumed]\r\n @line_sums[l.id][:sdp] = person_task[l.person_id][:sdp]\r\n @sdp_consumed_total += person_task[l.person_id][:consumed]\r\n\r\n elsif l.sdp_tasks\r\n @sdp_remaining_total += l.sdp_tasks_remaining.to_f\r\n @line_sums[l.id][:init] = l.sdp_tasks_initial \r\n @line_sums[l.id][:balance] = l.sdp_tasks_balancei\r\n @line_sums[l.id][:remaining] = l.sdp_tasks_remaining\r\n @line_sums[l.id][:consumed] = l.sdp_tasks_consumed\r\n @sdp_consumed_total += @line_sums[l.id][:consumed]\r\n\r\n elsif l.request\r\n s = round_to_hour(l.request.workload2)\r\n if l.request.sdp == \"No\"\r\n @line_sums[l.id][:init] = 'no sdp'\r\n @line_sums[l.id][:balance] = 'N/A'\r\n @line_sums[l.id][:remaining] = s\r\n @sdp_remaining_total += s\r\n @to_be_validated_in_wl_remaining_total += s\r\n else\r\n r = l.request.sdp_tasks_remaining_sum()#{:trigram=>@project.trigram})\r\n #r = s if r == 0.0\r\n @line_sums[l.id][:init] = l.request.sdp_tasks_initial_sum()#{:trigram=>l.project.trigram})\r\n @line_sums[l.id][:balance] = l.request.sdp_tasks_balancei_sum()#{:trigram=>l.project.trigram})\r\n @line_sums[l.id][:remaining] = r\r\n @sdp_remaining_total += r\r\n @line_sums[l.id][:consumed] = l.request.sdp_tasks_consumed_sum()\r\n @sdp_consumed_total += @line_sums[l.id][:consumed]\r\n end\r\n else\r\n @line_sums[l.id][:init] = 0.0\r\n @line_sums[l.id][:remaining] = 0.0\r\n @line_sums[l.id][:balancei] = 0.0\r\n @line_sums[l.id][:consumed] = 0.0\r\n end\r\n end\r\n @planning_tasks = get_plannings(@projects, wl_weeks)\r\n end", "def internal_customer\n customers.find(:first, :conditions => [\"(name = ? OR name = 'Internal') AND company_id = ? \", self.name, self.id], :order => 'id')\n end" ]
[ "0.61493427", "0.5473448", "0.53962165", "0.5296063", "0.5255456", "0.51558846", "0.5130783", "0.5066964", "0.5057077", "0.5034083", "0.5027433", "0.5022828", "0.50064874", "0.49958438", "0.49936822", "0.49876022", "0.49786782", "0.49786782", "0.49744272", "0.49582633", "0.49201295", "0.48988846", "0.48765406", "0.48616317", "0.48616284", "0.48443976", "0.48436898", "0.48436898", "0.48387596", "0.48373327", "0.4835272", "0.48287043", "0.48073933", "0.48025143", "0.479568", "0.4785353", "0.47820967", "0.4778435", "0.47685045", "0.475025", "0.47430217", "0.4739266", "0.47331154", "0.47109434", "0.47065166", "0.46989936", "0.46921813", "0.46805823", "0.46719044", "0.46703", "0.46561825", "0.46486783", "0.46467057", "0.4646321", "0.4642037", "0.46334597", "0.4627544", "0.46241996", "0.46180317", "0.46147346", "0.45953456", "0.45912793", "0.45912793", "0.45821145", "0.4574236", "0.45618972", "0.45585248", "0.45576096", "0.45576096", "0.45576096", "0.45558128", "0.4549809", "0.45496157", "0.45483285", "0.45454618", "0.45449483", "0.45408183", "0.45398912", "0.45376456", "0.4531164", "0.45285162", "0.45269027", "0.45241198", "0.4521807", "0.45207924", "0.45186263", "0.45161232", "0.45130536", "0.451069", "0.4506333", "0.4503248", "0.45030436", "0.45006055", "0.449644", "0.44942895", "0.44938865", "0.44847158", "0.44815195", "0.44809288", "0.44764006" ]
0.6666557
0
If the organization is a customer, it gives us all Chess SO to the customer If the organization is a vendor, it shows all SO_lines where the vendor was added as the supplier. TODO: have this backfilled after the lot is chosen. Once a lot is shipped, we know the supplier. By filling this in, we can find all so_line item vendors, not just the ones that are entered manually.
def sales_orders case organization_type.type_value when 'customer' SoHeader.where('organization_id = ?', id).order('created_at desc') when 'vendor' SoHeader.joins(:so_lines).where('so_lines.organization_id = ?', id).order('created_at desc') else SoHeader.where('organization_id = ?', 0).order('created_at desc') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customers; (line_items.map(&:customer).flatten.compact.uniq rescue []); end", "def sales\n sales_this_vendor_made = []\n sales_to_check = FarMar::Sale.all\n sales_to_check.each do |sale_to_check|\n if self.id == sale_to_check.vendor_id\n sales_this_vendor_made << sale_to_check\n end#of if\n end#of do\n return sales_this_vendor_made\n end", "def vendor\n vendor_that_made_this_sale = nil\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.id == self.vendor_id\n vendor_that_made_this_sale = vendor\n return vendor_that_made_this_sale\n end#of if\n end#of do\n end", "def purchase_orders\n case organization_type.type_value\n when 'customer'\n PoHeader.joins(:po_lines).where('po_lines.organization_id = ?', id).order('created_at desc')\n when 'vendor'\n PoHeader.where('organization_id = ?', id).order('created_at desc')\n else\n PoHeader.where('organization_id = ?', 0).order('created_at desc')\n end\n end", "def so_items\n # so_items = self.so_headers.joins(:so_lines).select(\"so_lines.item_id\").where(\"so_headers.organization_id = ?\",self.id).order(\"so_lines.created_at DESC\")\n so_items = SoLine.includes(:so_header).where('so_headers.organization_id = ?', id).order('so_headers.created_at DESC')\n so_items = so_items.collect(& :item_id)\n Item.where(id: so_items)\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\n end", "def line_items_for_customer(customer_id)\n ret_line_items = []\n my_line_items = delivery_details.find_all_by_customer_id(customer_id)\n my_line_items.each do |my_line_item|\n my_line_item.order_items.each do |order|\n if order.quantity > 0\n ret_line_items.push(order) unless ret_line_items.include? order\n end\n end\n end\n return ret_line_items\n end", "def show\n @booth_chairs = @organization.booth_chairs\n @tools = Tool.checked_out_by_organization(@organization).just_tools\n @shifts = @organization.shifts\n @participants = @organization.participants\n @charges = @organization.charges\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def sellers\n find_related_frbr_objects( :is_sold_by, :which_roles?) \n end", "def sellers\n line_items.map { |lineitem| lineitem.item.user.id }.uniq\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def electricity_usages(style=:solo)\n each_with_object([]) do |bill,memo|\n bill.electricity_usage.each do |usage|\n if style==:solo\n memo << [bill.invoice_month.to_s,usage[:kwh],usage[:rate],usage[:amount]]\n else\n memo << [bill.invoice_month.to_s,'electricity',usage[:kwh],nil,usage[:rate],usage[:amount]]\n end\n end\n end\n end", "def invoice_items_report\n detailed = params[:detailed]\n project = params[:project]\n @from = params[:from]\n @to = params[:to]\n supplier = params[:supplier]\n order = params[:order]\n account = params[:account]\n product = params[:product]\n\n if project.blank?\n init_oco if !session[:organization]\n # Initialize select_tags\n @projects = projects_dropdown if @projects.nil?\n # Arrays for search\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n project = current_projects.to_a\n end\n\n # Dates are mandatory\n if @from.blank? || @to.blank?\n return\n end\n\n # Format dates\n from = Time.parse(@from).strftime(\"%Y-%m-%d\")\n to = Time.parse(@to).strftime(\"%Y-%m-%d\")\n\n #SupplierInvoice.joins(:supplier_invoice_approvals,:supplier_invoice_items)\n\n if !project.blank? && !supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,order,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,account,from,to).order(:invoice_date)\n elsif !project.blank? && !supplier.blank? && order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.supplier_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,supplier,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,account,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && !order.blank? && account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.work_order_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,order,from,to).order(:invoice_date)\n elsif !project.blank? && supplier.blank? && order.blank? && !account.blank?\n @invoice_items_report = SupplierInvoiceItem.joins(:supplier_invoice).where(\"supplier_invoices.project_id in (?) AND supplier_invoices.charge_account_id = ? AND supplier_invoices.invoice_date >= ? AND supplier_invoices.invoice_date <= ?\",project,account,from,to).order(:invoice_date)\n end\n\n\n # Setup filename\n title = t(\"activerecord.models.supplier_invoice.few\") + \"_#{from}_#{to}.pdf\"\n\n respond_to do |format|\n # Render PDF\n if !@invoice_items_report.blank?\n format.pdf { send_data render_to_string,\n filename: \"#{title}.pdf\",\n type: 'application/pdf',\n disposition: 'inline' }\n format.csv { send_data SupplierInvoiceItem.to_report_invoices_csv(@invoice_items_report),\n filename: \"#{title}.csv\",\n type: 'application/csv',\n disposition: 'inline' }\n else\n format.csv { redirect_to ag2_purchase_track_url, alert: I18n.t(\"ag2_purchase.ag2_purchase_track.index.error_report\") }\n format.pdf { redirect_to ag2_purchase_track_url, alert: I18n.t(\"ag2_purchase.ag2_purchase_track.index.error_report\") }\n end\n end\n end", "def show\n # set polymorphic\n @contactable = @organization\n @attachable = @organization\n @addressable = @organization\n # default contact type to show is addresses\n @contact_type = 'contact'\n\n @address_type = 'address'\n\n # load comments\n @notes = @organization.comments.where(comment_type: 'note').order('created_at desc') if @organization\n\n # load tags\n @tags = @organization.present? ? @organization.comments.where(comment_type: 'tag').order('created_at desc') : []\n\n # load Purchase Orders\n @po_headers = PoHeader.where(organization: @organization)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n case params[:type]\n when 'min_quality'\n min_vendor_quality = @organization.min_vendor_quality.present? ? @organization.min_vendor_quality.quality_name : ''\n render json: { min_vendor_quality: min_vendor_quality }\n when 'quality_level'\n quality_level = @organization.customer_quality.present? ? @organization.customer_quality : ''\n render json: { quality_level: quality_level }\n else\n render json: @organization\n end\n end\n end\n end", "def show\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.customers.retrieve_customer(\n customer_id: params[:id]\n )\n \n if result.success?\n # determine membership level\n if result.data[0][:groups].any? {|g| g[:name] === \"Wine Club gold\"}\n membership = \"Gold\"\n else\n membership = \"Platinum\"\n end\n # organize desired data from Square response\n square_data = {\n \"square_id\": result.data[0][:id],\n \"created_at\": result.data[0][:created_at],\n \"given_name\": result.data[0][:given_name],\n \"family_name\": result.data[0][:family_name],\n \"email\": result.data[0][:email_address],\n \"phone_number\": result.data[0][:phone_number],\n \"membership_level\": membership\n }\n\n transactions = client.orders.search_orders(\n body: {\n location_ids: [\n \"EBB8FHQ6NBGA8\"\n ],\n query: {\n filter: {\n customer_filter: {\n customer_ids: [\n square_data[:square_id]\n ]\n }\n }\n }\n }\n )\n if transactions.success?\n t_data = []\n transactions.data && transactions.data[0].each do |t|\n # logic to make sure transaction contains bottle purchase\n # bottle line items always start with \"20\", e.g. \"2017 Syrah\"\n if t[:line_items] && t[:line_items].any? {|li| li[:name] && li[:name].start_with?(\"20\")}\n items = t[:line_items].reject{|li| !li[:name].start_with?(\"20\")}.map { |li| { uid: li[:uid],\n catalog_object_id: li[:catalog_object_id], quantity: li[:quantity], name: li[:name]} }\n end\n \n t_obj = {\n id: t[:id],\n created_at: t[:created_at],\n line_items: items,\n }\n t_data << t_obj\n end\n elsif transactions.error?\n warn transactions.errors\n end\n\n # look up user in our DB\n currentUser = User.find {|u| u.square_id === result.data[0][:id]}\n\n member_data = {\n \"square\": square_data,\n \"db\": {\n \"id\": currentUser.id,\n \"commit_count\": currentUser.commit_count,\n \"commit_adjustments\": currentUser.commit_adjustments\n },\n \"transactions\": t_data\n }\n\n render json: member_data.to_json\n elsif result.error?\n warn result.errors\n end\n end", "def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_sells << product_to_check\n end#of if\n end#of do\n return products_this_vendor_sells\n end", "def vendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def sales\n Sale.find_all_by_vendor_id(@id)\n end", "def add_booking_line(item_id, quantity)\n\n # Check if the booking includes the item_id\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if product_lines.empty?\n if product = ::Yito::Model::Booking::BookingCategory.get(item_id)\n product_customer_translation = product.translate(customer_language)\n product_unit_cost = product_item_cost_base = product.unit_price(self.date_from, self.days, nil, self.sales_channel_code).round(0)\n product_deposit_cost = product.deposit\n ## Apply promotion code and offers\n rates_promotion_code = if !self.promotion_code.nil? and !self.promotion.code.empty?\n ::Yito::Model::Rates::PromotionCode.first(promotion_code: self.promotion_code)\n else\n nil\n end\n discount = ::Yito::Model::Booking::BookingCategory.discount(product_unit_cost, item_id, self.date_from, self.date_to, rates_promotion_code) || 0\n product_unit_cost = (product_unit_cost - discount).round(0) if discount > 0\n ## End apply offers\n ## Category supplements\n product_supplement_1_unit_cost = product.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = product.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = product.category_supplement_3_cost || 0 \n if sales_channel_code\n if bcsc = Yito::Model::Booking::BookingCategoriesSalesChannel.first(conditions: {'sales_channel.code': sales_channel_code, booking_category_code: product.code })\n product_supplement_1_unit_cost = bcsc.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = bcsc.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = bcsc.category_supplement_3_cost || 0\n end \n end \n ## End of category supplements\n\n transaction do\n # Create booking line\n booking_line = BookingDataSystem::BookingLine.new\n booking_line.booking = self\n booking_line.item_id = item_id\n booking_line.item_description = product.name\n booking_line.item_description_customer_translation = (product_customer_translation.nil? ? product.name : product_customer_translation.name)\n booking_line.item_unit_cost_base = product_item_cost_base\n booking_line.item_unit_cost = product_unit_cost\n booking_line.item_cost = product_unit_cost * quantity\n booking_line.quantity = quantity\n booking_line.product_deposit_unit_cost = product_deposit_cost\n booking_line.product_deposit_cost = product_deposit_cost * quantity\n booking_line.category_supplement_1_unit_cost = product_supplement_1_unit_cost\n booking_line.category_supplement_1_cost = product_supplement_1_unit_cost * quantity\n booking_line.category_supplement_2_unit_cost = product_supplement_2_unit_cost\n booking_line.category_supplement_2_cost = product_supplement_2_unit_cost * quantity\n booking_line.category_supplement_3_unit_cost = product_supplement_3_unit_cost\n booking_line.category_supplement_3_cost = product_supplement_3_unit_cost * quantity\n booking_line.save\n # Create booking line resources\n (1..quantity).each do |resource_number|\n booking_line_resource = BookingDataSystem::BookingLineResource.new\n booking_line_resource.booking_line = booking_line\n booking_line_resource.save\n end\n # Update booking cost\n self.item_cost += (product_unit_cost * quantity)\n self.product_deposit_cost += (product_deposit_cost * quantity)\n self.category_supplement_1_cost += (product_supplement_1_unit_cost * quantity)\n self.category_supplement_2_cost += (product_supplement_2_unit_cost * quantity)\n self.category_supplement_3_cost += (product_supplement_3_unit_cost * quantity) \n self.calculate_cost(false, false)\n self.save\n # Assign available stock\n if status == :pending_confirmation \n if created_by_manager \n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_backoffice_request').to_bool\n else\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_web_request').to_bool\n end\n elsif status == :confirmed \n if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n assign_available_stock\n end\n end \n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'add_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_line(item_id, quantity),\n attributes_updated: {item_id: item_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n end\n\n end", "def wholesale_order_list\n @orders = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: params[\"place_order_on\"])\n @list_of_event_ids = @orders.uniq.pluck(:event_id)\n list_of_product_ids = []\n list_of_product_types = []\n for each_id in @list_of_event_ids \n for designed_product in DesignedProduct.where(event_id: each_id)\n list_of_product_ids << designed_product.product_id\n list_of_product_types << designed_product.product.product_type\n end\n end\n @list_of_product_ids = list_of_product_ids.uniq\n @list_of_product_types = list_of_product_types.uniq.sort\n render(:wholesale_order_list) and return\n end", "def index\n manage_filter_state\n no = params[:No]\n supplier = params[:Supplier]\n project = params[:Project]\n order = params[:Order]\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @supplier = !supplier.blank? ? Supplier.find(supplier).full_name : \" \"\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @work_order = !order.blank? ? WorkOrder.find(order).full_name : \" \"\n @receipt_notes = receipts_dropdown if @receipt_notes.nil?\n @purchase_orders = unbilled_and_undelivered_purchase_orders_dropdown if @purchase_orders.nil?\n\n # Arrays for search\n @projects = projects_dropdown if @projects.nil?\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n\n @search = SupplierInvoice.search do\n with :project_id, current_projects\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !no.blank?\n if no.class == Array\n with :invoice_no, no\n else\n with(:invoice_no).starting_with(no)\n end\n end\n if !supplier.blank?\n with :supplier_id, supplier\n end\n if !project.blank?\n with :project_id, project\n end\n if !order.blank?\n with :work_order_id, order\n end\n data_accessor_for(SupplierInvoice).include = [:supplier_invoice_approvals, :supplier, :project]\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @supplier_invoices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplier_invoices }\n format.js\n end\n end", "def lines_to_tryton\n result = []\n\n order_items.each do |order_item|\n\n \tif tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n \t source_entity: 'product',\n \t\t source_id: \"#{order_item.item_id}-#{order_item.item_price_type}\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => \"#{order_item.item_description} (#{order_item.item_price_description})\",\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % order_item.item_unit_cost\n },\n \"quantity\" => order_item.quantity\n \t }\n end\n\n end\t\n return result\n end", "def actual_specs\n as = supplier_orders.map(&:actual_specs)\n as = as.uniq.compact\n as\n end", "def show\n\n @client = Client.find(@invoice.client_id)\n @total_items = Item.where(invoice_id: @invoice.id).sum(:total_value_sale)\n @lucro_total = Item.where(invoice_id: @invoice.id).sum(:profit_sale)\n @products = Product.order(:name)\n\n end", "def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end", "def add_supplier_rates_to_rate_card(sheet)\n all_units_of_measurement = UnitsOfMeasurement.all\n standard_column_style = sheet.styles.add_style sz: 12, alignment: { horizontal: :left, vertical: :center }, border: { style: :thin, color: '00000000' }\n price_style = sheet.styles.add_style sz: 12, format_code: '£#,##0.00', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n percentage_style = sheet.styles.add_style sz: 12, format_code: '#,##0.00 %', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n\n rate_card_prices = @rate_card_data[:Prices][@supplier_id]\n\n @data_no_cafmhelp_removed.keys.collect { |k| @data_no_cafmhelp_removed[k].keys }\n .flatten.uniq\n .sort_by { |code| [code[0..code.index('.') - 1], code[code.index('.') + 1..].to_i] }.each do |s|\n # for each building type, I need to see if the actual building name (which can contain several building id's if the same service\n # is contained in several building) has the service. for example two buildings may have the type warehouse and contain the same same C.1 service\n\n new_row = @building_types_with_service_codes.map do |building_type_with_service_codes|\n @rate_card_data[:Prices][@supplier_id][s.to_sym][building_type_with_service_codes[:building_type].to_sym] if building_type_with_service_codes[:service_codes].include? s\n end\n\n unit_of_measurement_row = all_units_of_measurement.where(\"array_to_string(service_usage, '||') LIKE :code\", code: \"%#{s}%\").first\n unit_of_measurement_value = begin\n unit_of_measurement_row['unit_measure_label']\n rescue NameError\n nil\n end\n new_row = ([s, rate_card_prices[s.to_sym][:'Service Name'], unit_of_measurement_value] << new_row).flatten\n\n styles = [standard_column_style, standard_column_style, standard_column_style]\n\n styles += RateCard.building_types.count.times.map do\n if ['M.1', 'N.1'].include? s\n percentage_style\n else\n price_style\n end\n end\n\n sheet.add_row new_row, style: styles\n end\n\n add_table_headings_for_pricing_variables(sheet)\n add_pricing_variables_to_rate_card_sheet(sheet)\n end", "def given_organization_has_catalog\n inventory = create(:inventory, :elements, organization: @user.organization)\n InventoryXLSXParserWorker.new.perform(inventory.id)\n\n org = @user.organization\n generate_new_opening_plan\n\n CatalogDatasetsGenerator.new(org).execute\n @user.organization.reload\n end", "def fulfilled_line_items\n return self.order_line_items.where(:status => 'shipped').all\n end", "def getVendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def by_organisation_and_host_provider_pre_GST\n query = Query.find_by_sql(\n \"select o.id organisation_id, o.name organisation_name,hp.id host_provider_id, hp.name host_provider_name, o.residential_suburb organisation_suburb, o.not_gst_registered, sum(c.amount) sumamount\\n\"+\n \"from claims c\\n\"+\n \" join organisations o on o.id = c.organisation_id\\n\"+\n \" left join providers hp on hp.id = c.host_provider_id and hp.seperate_payment = 1\\n\"+\n \"where c.payment_run_id = #{self.id}\\n\"+\n \"and c.invoice_date < '#{Settings::GST_CHANGE.to_s(:db)}'\\n\"+\n \"group by o.id, o.name,o.residential_suburb,hp.id,hp.name,o.not_gst_registered\\n\"+\n \"order by 2,5\")\n query\n end", "def sales(ven_id)\n FarMar::Sale.all.find_all { |sale_item| sale_item.vendor_id == ven_id }\n end", "def vendors\n FarMar::Vendor.by_market(self.id)\n end", "def show\n @opportunity = Opportunity.find(params[:id])\n add_breadcrumb @opportunity.title, @opportunity\n #HH -> Esto hay que hacerlo porque existen productos y servicios que pueden estar relacionados a un proveedor\n #Es un error legado de Redvel\n @object = @opportunity.supplier_account.products.first\n\n @title_content = @opportunity.title\n \t@meta_description_content = @opportunity.description\n\n if @object.nil?\n @object = @opportunity.supplier_account.services.first\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opportunity }\n end\n end", "def show\n @order.update_attribute(:seen, true) unless @order.seen\n @line_items = @order.line_items.includes(:product)\n end", "def sales_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) >= 0\")\n .group(\"spina_shop_invoices.id\")\n end", "def service_provider_line_items(service_provider, items)\n service_provider_items = []\n items.map(&:sub_service_request_id).each do |ssr|\n if service_provider.identity.is_service_provider?(SubServiceRequest.find(ssr))\n service_provider_items << SubServiceRequest.find(ssr).line_items\n end\n end\n service_provider_items.flatten.uniq\n end", "def vendor\n sale_vendor = Vendor.new(:id, :name, :number_of_employees, :market_id)\n Vendor.all.each do |ven_id, ven|\n if ven_id == vendor_id\n sale_vendor = ven\n end\n end\n return sale_vendor\n end", "def vendors\n vendors_at_market = []\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.market_id == self.id # Since this is an instance method I am looking at the ID of the FarMar::Market object I am calling .vendors on (i.e. the \"self\")\n vendors_at_market << vendor\n end\n end\n return vendors_at_market\n end", "def items_to_tryton\n\n result = []\n\n booking_lines.each do |booking_line|\n\n product = ::Yito::Model::Booking::BookingCategory.get(booking_line.item_id)\n product_price_definition = product.price_definition\n\n if product_price_definition.units_management == :unitary\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: booking_line.item_id,\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => booking_line.item_description,\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % booking_line.item_unit_cost\n },\n \"quantity\" => booking_line.quantity\n }\n else\n # Tryton product not found\n end \n elsif product_price_definition.units_management == :detailed\n if self.days < product_price_definition.units_management_value #do not apply extra days\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_line.item_id}-#{self.days}\",\n destination_system: 'tryton',\n destination_entity: 'product.template') \n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_product_with_days_description(booking_line.item_description, self.days),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % booking_line.item_unit_cost\n },\n \"quantity\" => booking_line.quantity\n } \n else\n # Tryton product not found\n end \n else # apply extra days\n max_days = product_price_definition.units_management_value\n max_days_price = product_price_definition.prices.select {|item| max_days == item.units}.first.price\n\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_line.item_id}-#{max_days}\",\n destination_system: 'tryton',\n destination_entity: 'product.template') \n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_product_with_days_description(booking_line.item_description, max_days),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % max_days_price\n },\n \"quantity\" => booking_line.quantity\n } \n else\n # Tryton product not found \n end \n extra_days = self.days - max_days\n extra_day_price = product_price_definition.prices.select {|item| 0 == item.units}.first.price\n if tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n source_entity: 'product',\n source_id: \"#{booking_line.item_id}-EXTRA\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => build_product_with_extra_days_description(booking_line.item_description),\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % extra_day_price\n },\n \"quantity\" => booking_line.quantity * extra_days\n } \n\n else\n # Tryton product not found\n end\n end \n end \n\n end\n\n return result\n\n end", "def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end", "def si_update_order_select_from_supplier\n supplier = params[:supplier]\n if supplier != '0'\n @supplier = Supplier.find(supplier)\n @purchase_orders = @supplier.blank? ? unbilled_and_undelivered_purchase_orders_dropdown : unbilled_and_undelivered_purchase_orders_dropdown_by_supplier(@supplier)\n else\n @purchase_orders = unbilled_and_undelivered_purchase_orders_dropdown\n end\n # Orders array\n @purchase_orders_dropdown = purchase_orders_array(@purchase_orders)\n # Setup JSON\n @json_data = { \"order\" => @purchase_orders_dropdown }\n render json: @json_data\n end", "def change_supplier(supp_id=nil)\n return if supp_id.nil?\n self.update_attribute(:supplier_id, supp_id)\n\n #if having combis\n combis = OrderProcessing.where(\"combi_id = ?\", self.id)\n unless combis.empty?\n combis.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n \n #if having splits\n splitted = OrderProcessing.where(\"parent_order_id = ?\", self.order_id)\n unless splitted.empty?\n splitted.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n end", "def especies_filtros\n return unless tiene_filtros?\n self.taxones = Especie.select(:id).select(\"#{Scat.attribute_alias(:catalogo_id)} AS catalogo_id\").joins(:scat).distinct\n por_especie_id\n por_nombre\n #estatus\n #solo_publicos\n estado_conservacion\n tipo_distribucion\n uso\n formas_crecimiento\n ambiente\n\n #return unless por_id_o_nombre\n #categoria_por_nivel\n end", "def sales\n FarMar::Sale.get_by(\"vendor\", id)\n end", "def vendors_that_sell(query_item)\n @vendors.find_all do |vendor|\n vendor.inventory.keys.include?(query_item)\n end\n end", "def supplier_collection\n show_only_supplier_products = try_spree_current_user &&\n !try_spree_current_user.admin? &&\n try_spree_current_user.supplier?\n if show_only_supplier_products\n @collection = \n @collection.where(supplier_id: try_spree_current_user.supplier_id)\n end\n end", "def service_contract_of(buyer)\n service_contracts.find_by(user_account_id: buyer.id)\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 create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end", "def sold_list usr=nil\n result = select_fields('invoices.updated_at').include_list_without_job_type.joins(:invoices)\n if usr\n result.where(\"invoices.seller_id = ? AND invoices.status = ?\", usr.id, 'paid')\n else\n result.where(\"invoices.seller_id IS NOT NULL AND invoices.status = ?\", 'paid') \n end\n end", "def display_franchises(company)\n puts \"#{company.name} owns these franchises:\"\n company.franchises.select { |franchise| puts \"Franchise #{franchise.id} in #{franchise.location}\" }\n end", "def food_trucks_that_sell(desired_item)\n food_truck_list = []\n @food_trucks.each do |food_truck|\n food_truck.inventory.each do |item|\n if item.first.name == desired_item.name\n food_truck_list << food_truck\n end\n end\n end\n food_truck_list\n end", "def vendor\n @shipments = Spree::Shipment.where(stock_location_id: current_spree_user.stock_locations.first.id, state: \"pending\").joins(:order).where(spree_orders: {state: 'complete'}).order(created_at: :asc)\n end", "def investors #YAS\n arr = FundingRound.all.select do |f|\n f.startup == self\n # binding.pry\n end\n arr.collect do |f|\n f.venture_capitalist.name\n end.uniq\n end", "def cost_splitting\n @shipments = Shipment.all.paginate(page: params[:page], per_page: 1)\n @order = Order.all.paginate(page: params[:page], per_page: 1)\n @file_info = FileInformation.all.paginate(page: params[:page], per_page: 1)\n\n \n@shipments.each do |s|\n unless s.shared != false\n @file_info.each do |f|\n @order.each do |o|\n puts \"o.product\"\n end\n end\n end\nend\n\n\nend", "def water_usages(style=:solo)\n each_with_object([]) do |bill,memo|\n bill.water_usage.each do |usage|\n if style==:solo\n memo << [bill.invoice_month.to_s,usage[:cubic_m],usage[:rate],usage[:amount]]\n else\n memo << [bill.invoice_month.to_s,'water',nil,usage[:cubic_m],usage[:rate],usage[:amount]]\n end\n end\n end\n end", "def vendors\n FarMar::Vendor.by_market(id)\n end", "def get_shops_list\n\n\t\tbegin\n\t\t\tres = []\n\t\t\tcost = 0\n\t\t\toffer_cost = 0\n\n\t\t\tService.where(:shop_service_type_id => params[:shop_service_type_id]).each do |s|\n\t\t\t\tputs s.inspect\n\t\t\t\tputs params.inspect\n\t\t\t\tif s.shop.location_id == params[:location_id].to_i\n\t\t\t\t\t\n\n\t\t\t\t\tif s.offers.blank?\n\t\t\t\t\t\tputs \"no offers\"\n\t\t\t\t\t\tputs s.inspect\n\t\t\t\t\t\tcase params[:membership_type].to_s\n\t\t\t\t\t\twhen 'y'\n\t\t\t\t\t\t\tcost = s.cost_yearly\n\t\t\t\t\t\twhen 'h'\n\t\t\t\t\t\t\tcost = s.cost_halfyearly\n\n\t\t\t\t\t\twhen 'q'\n\t\t\t\t\t\t\tcost = s.cost_quartly\n\n\t\t\t\t\t\twhen 'm'\n\t\t\t\t\t\t\tcost = s.cost_monthly\n\n\t\t\t\t\t\twhen 'd'\n\t\t\t\t\t\t\tcost = s.cost_daily\n\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tcost = 0\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"has offer\"\n\t\t\t\t\t\tputs s.offers.inspect\n\t\t\t\t\t\tcase params[:membership_type].to_s\n\t\t\t\t\t\twhen 'y'\n\t\t\t\t\t\t\tcost = s.cost_yearly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_yearly\n\t\t\t\t\t\twhen 'h'\n\t\t\t\t\t\t\tcost = s.cost_halfyearly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_halfyearly\n\t\t\t\t\t\twhen 'q'\n\t\t\t\t\t\t\tcost = s.cost_quartly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_quartly\n\t\t\t\t\t\twhen 'm'\n\t\t\t\t\t\t\tcost = s.cost_monthly\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_monthly\n\t\t\t\t\t\twhen 'd'\n\t\t\t\t\t\t\tcost = s.cost_daily\n\t\t\t\t\t\t\toffer_cost = s.offers.last.cost_daily\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tcost = 0\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\n\t\t\t\t\tjson_obj = { \"shop_id\" => s.shop_id,\n\t\t\t\t\t\t\"shop_name\" => s.shop.name,\n\t\t\t\t\t\t\"icon\" => s.shop.icon,\n\t\t\t\t\t\t\"time_slot_ids\" => s.shop.time_slot_ids,\n\t\t\t\t\t\t\"day_slot_ids\" => s.shop.day_slot_ids,\n\t\t\t\t\t\t\"service_name\" => s.shop_service_type.name,\n\t\t\t\t\t\t\"cost\" => cost,\n\t\t\t\t\t\t\"offer_cost\" => offer_cost\n\t\t\t\t\t}\n\t\t\t\t\tputs \"json obj \"+json_obj.to_s\n\t\t\t\t\tres << json_obj\n\t\t\t\t\tputs res\n\n\t\t\t\tend\n\n\t\t\t\t\n\t\t\tend\n\n\n\n\n\n\t\t\trender :json => {:data => res.as_json,:success => true, :message => \"App Data found\"}\n\n\t\trescue Exception => e\n\t\t\tputs e.inspect\n\t\t\trender :json => {:data => \"\", :success => false, :message => \"Unable to retrive data\"}\n\t\tend\t\n\tend", "def make_brands_section\n\tbrands = $products_hash[\"items\"].map {|toy| toy[\"brand\"]}.uniq\n\tbrands.each do |brand|\n\t\t$same_brand = $products_hash[\"items\"].select {|toy| toy[\"brand\"] == brand}\n\t print_brand_name brand\n\t brand_toy_stock brand\n\t\tprint_brand_toy_stock\n\t average_price_brand brand\n\t\tprint_average_price_brand\n\t total_sales_brand brand\n\t\tprint_total_sales_brand\n\tend\nend", "def buyer_orders \n if current_user && current_user.seller\n @items_info = find_buyers_orders.sort_by { |k| item_is_shipped(k[3],k[0].id) ? 1 : 0 }\n else\n redirect_to signin_path\n end\n end", "def prepare_soe_rxns(groupby_out_collection)\n groupby_out_collection.each {|coll, ops|\n\n stripwell_mat = calc_input_vol(ops)\n h2o_arr = stripwell_mat.each_with_index.map {|well, w_idx| TOTAL_VOL - KAPA_VOL - DMSO_VOL - well.reduce(0, :+)}\n if debug\n show do\n title \"Debuggin\"\n note \"stripwell_mat #{stripwell_mat}\"\n note \"h2o arr #{h2o_arr}\"\n end\n end\n # Fill collection with water\n show do\n title \"Filling #{coll.object_type.name} #{coll}\"\n separator\n note \"Gather a clean, new #{coll.object_type.name} and label it: <b>#{coll}</b>\"\n note \"Follow the table below to fill the new #{coll.object_type.name} with <b>MG H2O</b>\"\n table highlight_non_empty(coll) {|r, c| \"#{h2o_arr[c]}#{MICROLITERS}\"}\n end\n # Fill collection with DMSO\n show do\n title \"Adding DMSO to #{coll.object_type.name} #{coll}\"\n separator\n note \"Follow the table below to fill the #{coll.object_type.name} with <b>100% DMSO</b>\"\n table highlight_non_empty(coll) {|r, c| \"#{DMSO_VOL}#{MICROLITERS}\"}\n end\n\n # Build Display table\n tab = [['Stripwell', 'Well', 'Input Item', \"Volume (#{MICROLITERS})\"]]\n ops.each_with_index {|op, o_idx|\n well_vols = stripwell_mat[o_idx]\n op.input_array(INPUT).items.each_with_index {|i, i_idx|\n input_vol = well_vols[i_idx]\n tab.push([op.output(OUTPUT_SW).collection.id, \"#{op.output(OUTPUT_SW).column+1}\", i.id, {content: input_vol, check: true}])\n }\n }\n # Load Fragments\n show do\n title \"Filling #{coll.object_type.name} #{coll}\"\n separator\n note \"Follow the table below to fill the appropriate well with the correct fragment stock:\"\n table tab\n end\n \n # Fill collection with MM\n show do\n title \"Filling #{coll.object_type.name} #{coll}\"\n separator\n note \"Follow the table below to fill #{coll} with <b>KAPA Master Mix</b>\"\n bullet \"Mix throughly by pipetting\"\n table highlight_non_empty(coll) {|r, c| \"#{KAPA_VOL}#{MICROLITERS}\"}\n end\n }\n end", "def get_lowest_sale_per_vendor\n\n \tresults = []\n\n\n \tsteam_sales = game_sales.where([\"store = ?\", \"Steam\"])\n \tmin_steam_sale = nil\n\n \tsteam_sales.each do |sale|\n \t\tsaleamt = sale.saleamt.to_f\n\n\n \t\tif min_steam_sale == nil or min_steam_sale.saleamt.to_f > saleamt.to_f\n \t\t\tmin_steam_sale = sale\n \t\tend\n\n \tend\n\n\n \tamazon_sales = game_sales.where([\"store = ?\", \"Amazon\"])\n \tmin_amazon_sale = nil\n\n \tamazon_sales.each do |sale|\n \t\tsaleamt = sale.saleamt.to_f\n\n\n \t\tif min_amazon_sale == nil or min_amazon_sale.saleamt.to_f > saleamt.to_f\n \t\t\tmin_amazon_sale = sale\n \t\tend\n \t\t\n \tend\n\n \tgmg_sales = game_sales.where([\"store = ?\", \"GMG\"])\n \tmin_gmg_sale = nil\n\n \tgmg_sales.each do |sale|\n \t\tsaleamt = sale.saleamt.to_f\n\n\n \t\tif min_gmg_sale == nil or min_gmg_sale.saleamt.to_f > saleamt.to_f\n \t\t\tmin_gmg_sale = sale\n \t\tend\n \t\t\n \tend\n\n\n \tgamersgate_sales = game_sales.where([\"store = ?\", \"GamersGate\"])\n \tmin_gamersgate_sale = nil\n\n \tgamersgate_sales.each do |sale|\n \t\tsaleamt = sale.saleamt.to_f\n\n\n \t\tif min_gamersgate_sale == nil or min_gamersgate_sale.saleamt.to_f > saleamt.to_f\n \t\t\tmin_gamersgate_sale = sale\n \t\tend\n\n \tend\n\n\n \tif min_steam_sale != nil\n \t\tresults.push(min_steam_sale)\n \tend\n\n \tif min_amazon_sale != nil\n \t\tresults.push(min_amazon_sale)\n \tend\n\n \tif min_gmg_sale != nil\n \t\tresults.push(min_gmg_sale)\n \tend\n\n \tif min_gamersgate_sale != nil\n \t\tresults.push(min_gamersgate_sale)\n \tend\n\n \treturn results\n\n\n end", "def index\n # Authorize only if current user can read Supplier\n authorize! :read, Supplier\n # OCO\n init_oco if !session[:organization]\n @export = formats_array\n # @projects = projects_dropdown\n # @periods = projects_periods(@projects)\n @billers = billers_dropdown\n end", "def find_station_lines(station) #calling the relationship between the station and the station line\n station.station_lines\n end", "def find_seller_payment_sections(as_of:, seller_id: nil, order_id: nil)\n seller_orders = find_payable_seller_orders(as_of: as_of, seller_id: seller_id, order_id: order_id)\n \n # Group by seller_id,market_id # .... market_id really? is important?\n seller_sections = seller_orders.group_by(&:seller_id).map do |_, sos| \n ::Financials::SellerPayments::Builder.build_seller_section( \n seller_organization: sos.first.seller,\n seller_orders: sos\n )\n end.sort_by do |section|\n section[:seller_name]\n end\n\n return SchemaValidation.validate!([SellerSection], seller_sections)\n end", "def supporters(business)\n # Returns object of all unique companies Supporting this business\n\n companies = []\n business.listed_by_business.each {|company| companies << company.company}\n\n companies.uniq # Note this is still not completely unique as it counts when part of multiple networks\n\n end", "def get_commoner_voices\n filtered_stories_ids = (\n get_featured_stories_ids +\n Story.published.commoners_voice\n .first(12)\n .pluck(:id)\n ).uniq.first(12)\n filtered_stories_ids.map { |id| Story.includes(:commoner, :tags, :comments, :images, :translations).find(id) }\n end", "def set_oxygen_supplier\n @oxygen_supplier = OxygenSupplier.find(params[:id])\n end", "def gas_usages(style=:solo)\n each_with_object([]) do |bill,memo|\n bill.gas_usage.each do |usage|\n if style==:solo\n memo << [bill.invoice_month.to_s,usage[:kwh],usage[:rate],usage[:amount]]\n else\n memo << [bill.invoice_month.to_s,'gas',usage[:kwh],nil,usage[:rate],usage[:amount]]\n end\n end\n end\n end", "def show_items\n puts \"-------------------------------------------------\"\n puts \"Category | Item | Price \"\n puts \"-------------------------------------------------\"\n billing_items.each do |billing_item_category, billing_items_with_price|\n billing_items_with_price.each do |billing_item, price|\n puts \"#{billing_item_category} | #{billing_item} | $ #{price}\"\n end\n end\n puts \"-------------------------------------------------\"\n end", "def line_items_for_compute(order, options={})\n if calculable.is_a?(Spree::Promotion)\n line_items = if calculable.product\n order.line_items.joins(:variant).where(:variants => {product_id: calculable.product})\n elsif calculable.store\n order.line_items.where(:store_id => calculable.store)\n else\n order.line_items\n end\n \n if self.is_a?(Spree::Calculator::FreeShipping)\n puts \"free shipping\"\n line_items\n else\n puts \"not free shipping\"\n line_items.order('spree_line_items.price DESC').not_on_sale\n end\n else\n puts \"all line items\"\n order.line_items\n end\n end", "def init_companies(_players)\n mine_comps = game_minors.map do |gm|\n description = \"Mine in #{gm[:coordinates]}. Machine revenue: \"\\\n \"#{gm[:extended][:machine_revenue].join('/')}. Switcher revenue: \"\\\n \"#{gm[:extended][:switcher_revenue].join('/')}\"\n revenue = \"#{format_currency(gm[:extended][:machine_revenue].first)} - \"\\\n \"#{format_currency(gm[:extended][:machine_revenue].last + gm[:extended][:switcher_revenue].last)}\"\n\n Company.new(sym: gm[:sym], name: \"#{gm[:sym]} #{gm[:name]}\", value: gm[:extended][:value],\n revenue: revenue, desc: description)\n end\n corp_comps = game_corporations.map do |gc|\n next if gc[:sym] == 'MHE'\n\n if gc[:extended][:type] == :railway\n description = \"Concession for Railway #{gc[:name]} in #{gc[:coordinates].join(', ')}. \"\\\n \"Total concession tile cost: #{format_currency(gc[:extended][:concession_cost])}\"\n name = \"#{gc[:sym]} Concession\"\n else\n description = \"Purchase Option for Public Mining Company #{gc[:name]}\"\n name = \"#{gc[:sym]} Purchase Option\"\n end\n Company.new(sym: gc[:sym], name: name, value: RAILWAY_MIN_BID, revenue: 'NA', desc: description)\n end.compact\n mine_comps + corp_comps\n end", "def find(what, stuff, options={})\n if stuff.is_a?(MerchantSidekick::ShoppingCart::LineItem)\n self.find_line_items(what, stuff, options)\n else\n self.find_line_items_by_product(what, stuff, options)\n end\n end", "def best_supplier\n self.suppliers.joins(:stock_locations => :stock_items).\n where('spree_stock_items.variant_id = spree_supplier_variants.variant_id').\n where('spree_stock_items.count_on_hand > 0').\n order('spree_supplier_variants.cost').first\n end", "def get_linked_sf_endorsers\n supporters = sf.client.query(<<-QUERY)\n SELECT Id, Form_Assembly_Reference_Id__c, City__c, Date__c, Endorser_Type__c, Org_Ind_Name__c, State_Province__r.Name,\n State_Province__r.Abbreviation__c, Zip_Postal_Code__c, EndorsementOrg__r.Congressional_District__c,\n EndorsementOrg__r.Congressional_District__r.Name, EndorsementOrg__r.Population__c, EndorsementOrg__r.Employees__c,\n EndorsementOrg__r.Email__c, EndorsementOrg__r.Primary_Contact_Title__c, EndorsementOrg__r.Phone__c,\n Comments__c, Address__c, Contact_Email__c, Contact_Name__c, Contact_Phone__c, Contact_Title__c, EndorsementOrg__r.Website__c,\n EndorsementOrg__r.Mailing_Zip_Postal_Code__c, EndorsementOrg__r.Mailing_City__c, EndorsementOrg__r.Primary_Contact_Name__c,\n EndorsementOrg__r.Approval_Status__c, EndorsementOrg__r.Id, EndorsementOrg__r.Mailing_Street__c,\n EndorsementOrg__r.Endorser_Type__c, EndorsementOrg__r.Name__c, Verification_Status__c, Endorsement_Campaign__c,\n EndorsementOrg__r.Endorsement_Campaign__c\n FROM Endorsement__c\n WHERE Endorsement_Type__c INCLUDES ('Energy Innovation and Carbon Dividend Act') AND Private_From_Endorser__c = 'Public'\n AND Country__c = 'United States' AND Endorsement_Status__c = 'Signed'\n AND (State_Province__r.Abbreviation__c <> null OR EndorsementOrg__r.Congressional_District__r.Name <> null)\n AND Form_Assembly_Reference_Id__c <> null\n QUERY\n end", "def display_source_ce # :yields: String\n if specimen_id\n return Specimen.find(specimen_id).display_name(:type => :ce_for_list)\n end\n l = Lot.find(lot_id) # it has to have a lot if no specimen\n if l.ce\n return(l.ce.display_for_list)\n else\n return ''\n end\n end", "def listing_products_qoo10(product, sellers_market_places_product)\n @error_message = \"\"\n begin\n @sellers_market_places_product = sellers_market_places_product\n @market_place_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @sellers_market_places_product.seller_id, @sellers_market_places_product.market_place_id, product.id)\n @taxon_market_plcaes = Spree::TaxonsMarketPlace.where(\"taxon_id=? AND market_place_id=?\", product.taxons.first.id, @sellers_market_places_product.market_place_id) if product.taxons.present?\n if @taxon_market_plcaes && !@taxon_market_plcaes.blank?\n if !@market_place_product.blank? && !@market_place_product.first.market_place_product_code.present? && !@taxon_market_plcaes.blank?\n adult = product.is_adult ? 'Y' : 'N'\n item_title = product.name\n image_url = \"\"\n if !product.variant_images.nil? && !product.variant_images.blank?\n size = 0\n product.variant_images.each do |mg|\n if mg.attachment_file_name.split(\"_\").first.capitalize == \"qoo10\".capitalize && size < mg.attachment_file_size\n image_url = mg.attachment.url(:original)\n size = mg.attachment_file_size\n end\n end\n end\n image_url = image_url.present? ? image_url : (request.host.to_s+\":\"+request.port.to_s+\"/assets/noimage/large.png\")\n item_description = product.description\n @item_type = \"\"\n product.variants.each do |v|\n @item_type = @item_type + v.option_values.first.option_type.name + \"||*\"\n @item_type = @item_type + v.option_values.first.name + \"||*\" + (v.cost_price.nil? ? v.prices.first.amount : v.cost_price).to_s + \"||*\"\n @item_type = @item_type + v.count_on_hand.to_s + \"||*\"+(v.sku.present? ? v.sku.to_s : \"0\")\n @item_type = @item_type + ((v == product.variants.last) ? \"\" : \"$$\") #@object <= product\n end if product.variants.present?\n item_type = @item_type #'Color/Size||*White/100||*1000||*10||*0$$Color/Size||*Black/100||*1000||*10||*0'\n retail_price = product.price.to_f\n item_price = product.selling_price.present? ? product.selling_price.to_f : product.price.to_f\n item_quantity = !product.stock_products.blank? ? product.stock_products.where(:sellers_market_places_product_id=>@sellers_market_places_product.id).sum(&:count_on_hand) : 0\n expiry_date = (Time.now + 1.year).strftime(\"%Y-%m-%d\")\n user_market_place = Spree::SellerMarketPlace.where(\"seller_id=? AND market_place_id=?\", @sellers_market_places_product.seller_id, @sellers_market_places_product.market_place_id)\n seller_code = sellers_market_places_product.product.sku.present? ? sellers_market_places_product.product.sku : \"\" rescue \"\"\n if !user_market_place.blank? && !user_market_place.first.api_secret_key.nil?\n shipping_no = user_market_place.first.shipping_code.to_s #\"418422\" # '0' :=> 'Free Shiping', '400896' :=> 'Free on condition' where '400896' is SR code of Qoo10 backend for Others, '418422' :=> 'Free on condition' where '418422' is SR code of Qoo10 backend for Qxpress.\n uri = URI('http://api.qoo10.sg/GMKT.INC.Front.OpenApiService/GoodsBasicService.api/SetNewGoods')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>user_market_place.first.api_secret_key.to_s,'SecondSubCat'=>@taxon_market_plcaes.first.market_place_category_id.to_s,'ManufactureNo'=>'','BrandNo'=>'','ItemTitle'=>item_title.to_s,'SellerCode'=>seller_code.to_s,'IndustrialCode'=>'','ProductionPlace'=>'','AudultYN'=>adult.to_s,'ContactTel'=>'','StandardImage'=>image_url.to_s,'ItemDescription'=>item_description.to_s,'AdditionalOption'=>'','ItemType'=>item_type.to_s,'RetailPrice'=>retail_price.to_s,'ItemPrice'=>item_price.to_s,'ItemQty'=>item_quantity.to_s,'ExpireDate'=>expiry_date.to_s,'ShippingNo'=>shipping_no.to_s,'AvailableDateType'=>'','AvailableDateValue'=>''})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n if res.code == \"200\"\n res_body = Hash.from_xml(res.body).to_json\n res_body = JSON.parse(res_body, :symbolize_names=>true)\n mp_product_code = res_body[:StdCustomResultOfGoodsResultModel][:ResultObject][:GdNo]\n if mp_product_code.nil?\n @error_message = res_body[:StdCustomResultOfGoodsResultModel][:ResultMsg]\n else\n @market_place_product.first.update_attributes(:market_place_product_code=>mp_product_code) if !@market_place_product.blank?\n end\n else\n @error_message = res.message\n end\n else\n @error_message = \"Api key or Secret key is missing\"\n end\n end\n else\n @error_message = \"Please map market place category to list product.\"\n end\n rescue Exception => e\n @error_message << e.message\n end\n return @error_message && @error_message.length > 0 ? @error_message : true\n end", "def related_clinics\n _clinics = []\n under_supervision_clinics.each do |c|\n unless _clinics.include?(c)\n _clinics.append(c)\n end\n end\n clinics.each do |c|\n unless _clinics.include?(c)\n _clinics.append(c)\n end\n end\n return _clinics\n end", "def sales\n FarMar::Sale.all.select { |sale| sale.product_info == product_id }\n end", "def show\n @location = Consumable.all\n @line_item = LineItem.new\n @order_select = Order.where.not(finalized: true)\n logger.info @order_select\n @user = User.all\n end", "def split_order\n # Lineas de productos identificadas por taxonomias\n @taxonomias = Spree::Taxon.where(parent_id: [1])\n # Creamos el hash de array donde almacenaremos las lineas de productos por taxonomias.\n @productos_por_taxonomias = Hash.new\n # LLenamos el hash\n @taxonomias.each do |taxonomia|\n @productos_por_taxonomias[taxonomia.name] = []\n end\n @order.line_items.each do |item|\n item.variant.product.taxons.each do |taxon|\n if @productos_por_taxonomias[taxon.parent.name]\n @productos_por_taxonomias[taxon.parent.name].append(item)\n end\n end\n end\n end", "def apply_to!(sale, line_item = nil)\n coupon = self\n \n return \"coupon_usage_limit_exceeded\" if coupon.used_up?\n return \"no_sale_found_for_user\" if sale.nil?\n \n if coupon.applies_to?(:sale)\n sale.coupons << coupon\n elsif coupon.applies_to?(:product)\n li = sale.line_items.find_by_product_sku(coupon.product.sku)\n return \"no_eligible_line_items\" if li.nil?\n li.coupons << coupon\n \n li.calculate_and_attach_discount_items\n end\n \n \"true\"\n end", "def customers\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n plat_id = \"31937637-430C-4E4B-ADAF-CB4FE6CE816D\"\n gold_id = \"A0A1AAC7-FB31-4AFA-B6D6-572F68D5757D\"\n\n # initial plat query\n result = client.customers.search_customers(\n body: {\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n plat_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n # {\"customers\": [\n # {\n # \"id\": \"DDMAZ5X1HX3T719477BRM31WAC\",\n # \"given_name\": \"Amy\",\n # \"family_name\": \"Scott\",\n # \"email_address\": \"ALS98053@hotmail.com\",\n # \"phone_number\": \"(425) 894-4488\",\n # \"preferences\": {\n # \"email_unsubscribed\": false\n # },\n # \"groups\": [\n # {\n # \"id\": \"31937637-430C-4E4B-ADAF-CB4FE6CE816D\",\n # \"name\": \"Wine Club platinum\"\n # },\n # ],\n # },\n # ]\n # \"cursor\": \"long_cursor_string\"\n # }\n # result.cursor returns cursor string if there is one, else returns nil\n\n if result.success?\n filtered = result.data[0].map {|m| {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Platinum\"} }\n # result.cursor implies the api call only retrieved\n # subset of data, need to make subsequent calls\n # with cursor to retrieve the rest\n while result.cursor\n result = client.customers.search_customers(\n body: {\n cursor: result.cursor,\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n plat_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if result.success?\n result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Platinum\"} }\n elsif result.error?\n render result.errors\n end\n end\n # member_groups = result.data[0].filter { |group|\n # group[:name] === \"Wine Club platinum\" || group[:name] === \"Wine Club gold\"\n # }\n # puts member_groups\n # group_data = member_groups.map { |g| {id: g[:id], name: g[:name]} }\n # render json: group_data.to_json\n elsif result.error?\n render result.errors\n end\n\n # Room for improvement!! Call API for both gold\n # and plat members, then have logic to identify which\n # group a member belongs to. This DRYs up the customer search\n # call\n gold_result = client.customers.search_customers(\n body: {\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n gold_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if gold_result.success?\n gold_result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Gold\"} }\n while gold_result.cursor\n gold_result = client.customers.search_customers(\n body: {\n cursor: gold_result.cursor,\n limit: 20,\n query: {\n filter: {\n group_ids: {\n any: [\n gold_id\n ]\n }\n },\n sort: {}\n }\n }\n )\n\n if gold_result.success?\n gold_result.data[0].each {|m| filtered << {\"square_id\": m[:id], \"created_at\": m[:created_at], \"given_name\": m[:given_name],\n \"family_name\": m[:family_name], \"email\": m[:email_address], \"phone_number\": m[:phone_number],\n \"membership_level\": \"Gold\"} }\n elsif gold_result.error?\n render gold_result.errors\n end\n end\n # member_groups = result.data[0].filter { |group|\n # group[:name] === \"Wine Club platinum\" || group[:name] === \"Wine Club gold\"\n # }\n # puts member_groups\n # group_data = member_groups.map { |g| {id: g[:id], name: g[:name]} }\n # render json: group_data.to_json\n elsif gold_result.error?\n render gold_result.errors\n end\n\n results = []\n stop = false\n\n filtered.each do |member|\n currentUser = User.find {|u| u.square_id === member[:square_id]}\n if !currentUser\n p member[:membership_level]\n member[:membership_level] === \"Gold\" ? count = 1 : count = 2\n currentUser = User.create(email: member[:email], password: \"d3vp4ss\", square_id: member[:square_id], commit_count: count)\n Role.create(role_type: \"member\", user_id: currentUser.id)\n end\n\n transactions = client.orders.search_orders(\n body: {\n location_ids: [\n \"EBB8FHQ6NBGA8\"\n ],\n query: {\n filter: {\n customer_filter: {\n customer_ids: [\n member[:square_id]\n ]\n }\n }\n }\n }\n )\n if transactions.success?\n t_data = []\n transactions.data && transactions.data[0].each do |t|\n if t[:line_items] && t[:line_items].any? {|li| li[:name] && li[:name].start_with?(\"20\")}\n items = t[:line_items].reject{|li| li[:name] && !li[:name].start_with?(\"20\")}.map { |li| { uid: li[:uid],\n catalog_object_id: li[:catalog_object_id], quantity: li[:quantity], name: li[:name]} }\n end\n \n t_obj = {\n id: t[:id],\n created_at: t[:created_at],\n line_items: items,\n }\n t_data << t_obj\n end\n elsif transactions.error?\n warn transactions.errors\n end\n\n results << {\n \"square\": member,\n \"db\": {\n \"id\": currentUser.id,\n \"commit_count\": currentUser.commit_count,\n \"commit_adjustments\": currentUser.commit_adjustments\n },\n \"transactions\": t_data\n }\n end\n render json: results.to_json\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 show\n @manufacturer_partner = ManufacturerPartner.find(params[:id])\n @logos = SiteElement.where(\"name LIKE '%logo_inconcert_%'\").order(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @manufacturer_partner }\n format.json { render json: @manufacturer_partner }\n end\n end", "def edit_supplier_service\n redirect_unless_privilege('Proveedores')\n \t@not_deliverable_services_ids = IndustryCategory.joins(:countries).where(\"countries.id = ?\", session[:country].id).where(industry_category_type_id:2).map(&:id) \n \t@service = Service.find params[:service_id]\n \t@service.videos.build if @service.videos.blank?\n \t@supplier_account = @service.supplier_account\n \t@supplier = @service.supplier_account.supplier\n @color_types = ColorType.all\n\t\t@industry_categories = @industry_categories = @supplier_account.industry_categories.where(\"industry_category_type_id = 3 OR industry_category_type_id = 2\")\n\t\t#DZF here I make the dynamic grouped_options_for_select options\n\t\t@industry_cat_types = @industry_categories.inject({}) do |options, industry_category|\n\t\t (options[industry_category.industry_category_type.name] ||= []) << [industry_category.get_name, industry_category.id]\n \t\toptions\n\t\tend\n end", "def investors\n array = FundingRound.all.select do |element|\n element.startup == self\n end\n array2 = array.map do |element|\n element.venture_capitalist\n end\n array2.uniq\n end", "def credit_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) < 0\")\n .group(\"spina_shop_invoices.id\")\n end", "def discount_sources\n s = ['CustomerNo']\n s << 'PriceListNo' if list?\n s << 'DiscountGrpCustNo' if group?\n s\n end", "def show\n @product = Product.find(params[:id])\n\n @store_cust_group = CustomerGroup.find_by_name(\"Bakul/Toko\")\n @workshop_cust_group = CustomerGroup.find_by_name(\"Bengkel/Montir\")\n\n @sale_histories = SaleDetail.where(:product_id => @product.id).order(:updated_at).reverse_order.limit(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n if @search.industry_id.nil?\n @results = Supplier.near(@search.location)\n else\n @results = Supplier.where(\"industry_id = ?\", @search.industry_id).near(@search.location)\n end\n ids = []\n @results.each do |r|\n ids.push r.id\n end\n @offers = Offer.where(supplier_id: ids).all\n end", "def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end", "def commodity_account\n customer_or_supplier \\\n proc { customer.sales_account },\n proc { supplier.purchases_account }\n end", "def print_lunch_orders\n @restaurants_used.collect{ |restaurant| restaurant.filled_orders_sentence }.join(', ')\n end", "def index\n manage_filter_state\n no = params[:No]\n client = params[:Client]\n project = params[:Project]\n status = params[:Status]\n order = params[:Order]\n request = params[:Request]\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @client = !client.blank? ? Client.find(client).to_label : \" \"\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @work_order = !order.blank? ? WorkOrder.find(order).full_name : \" \"\n @contracting_request = !request.blank? ? ContractingRequest.find(request).full_no_and_client : \" \"\n @status = sale_offer_statuses_dropdown if @status.nil?\n\n # Arrays for search\n @projects = projects_dropdown if @projects.nil?\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n\n @search = SaleOffer.search do\n with :project_id, current_projects\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !no.blank?\n if no.class == Array\n with :offer_no, no\n else\n with(:offer_no).starting_with(no)\n end\n end\n if !client.blank?\n with :client_id, client\n end\n if !project.blank?\n with :project_id, project\n end\n if !status.blank?\n with :sale_offer_status_id, status\n end\n if !order.blank?\n with :work_order_id, order\n end\n if !request.blank?\n with :contracting_request_id, request\n end\n data_accessor_for(SaleOffer).include = [:client, :contracting_request]\n order_by :sort_no, :desc\n paginate :page => params[:page] || 1, :per_page => per_page || 10\n end\n @sale_offers = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sale_offers }\n format.js\n end\n end", "def cash_services \n services.select{|i| i[:btype] && i[:btype] == CASH_BILLING} rescue []\n end", "def show_supplier_name\n @suppliers = Supplier.order(:name)\n end", "def list_suppliers\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Suppliers\"\n \n if(@company.can_view(current_user))\n if(params[:search] and params[:search] != \"\") \n \n @suppliers = Supplier.where([\"company_id = ? and (ruc LIKE ? OR name LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('name').paginate(:page => params[:page]) \n else\n @suppliers = Supplier.where(company_id: @company.id).order('name').paginate(:page => params[:page])\n end\n else\n errPerms()\n end\n end" ]
[ "0.5410528", "0.5398075", "0.5268887", "0.5240552", "0.5187056", "0.5175252", "0.5175252", "0.5089801", "0.5068672", "0.50150645", "0.49938476", "0.4980419", "0.49351025", "0.4890124", "0.4882353", "0.4875101", "0.4873243", "0.4858815", "0.48545456", "0.4836993", "0.48176032", "0.48044857", "0.4801972", "0.47998098", "0.47829467", "0.47828275", "0.47658488", "0.47214872", "0.47129914", "0.4711682", "0.4708963", "0.46950307", "0.46943995", "0.46931884", "0.46929866", "0.46807536", "0.46804446", "0.46643642", "0.46597362", "0.46582407", "0.46555904", "0.465445", "0.46508685", "0.46507236", "0.4645428", "0.46438637", "0.46354282", "0.4633104", "0.46315306", "0.46286932", "0.46262246", "0.46260992", "0.46130112", "0.46105662", "0.45990905", "0.4583676", "0.45723376", "0.45714405", "0.45623213", "0.45614642", "0.45605886", "0.4557732", "0.4551018", "0.45495072", "0.4541529", "0.45335358", "0.45220417", "0.45218676", "0.45181653", "0.45174783", "0.45158973", "0.45155895", "0.4514656", "0.4513558", "0.45124874", "0.4491571", "0.44894186", "0.44817176", "0.448019", "0.44801843", "0.44793755", "0.44746387", "0.44735447", "0.44731736", "0.44704273", "0.44700027", "0.44693056", "0.44673187", "0.44644502", "0.44578728", "0.445662", "0.44516686", "0.44514367", "0.4451348", "0.44505185", "0.44480732", "0.44417956", "0.44416237", "0.44413814", "0.44383413" ]
0.5707799
0
Text transformation for Table headings
def organization_type_title if organization_name ' Associated With ' + organization_name else '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semanticize_table_headers!\n @document.tree.search('table tr:first td').each { |node| node.node_name = 'th' }\n end", "def latex_table(data, top_headings, left_headings)\n matrix = [[''] + top_headings] +\n left_headings.zip(data).map { |heading, line| [heading] + line }\n latex_matrix matrix\nend", "def to_headings!(line, pattern, unmatch)\n convertibles = Scrapbox2markdown::Tokenizer.new(line, unmatch).convertible_tokens\n convertibles.each do |convertible|\n line.gsub!(convertible) { |match| match.sub(pattern[0]) { |_| pattern[1] + $1 }}\n end\n end", "def normalise_headings(doc)\n logger.info(\"Normalising headings\")\n\n nodes = doc.xpath('//a:body//a:heading/text()', a: NS) +\n doc.xpath('//a:component/a:doc[@name=\"schedules\"]//a:heading/text()', a: NS)\n\n nodes.each do |heading|\n heading.content = heading.content.downcase.gsub(/^\\w/) { $&.upcase }\n end\n end", "def compute_header_text_latex(header_text, header_footer_rules_present, language_code_3_chars)\n if header_footer_rules_present\n # italic, small caps and large font\n t = emulate_small_caps(\n escape_latex_text(header_text),\n @options[:font_name],\n %w[bold italic]\n )\n \"\\\\textscale{#{ 0.909091 }}{\\\\textbf{\\\\textit{#{ t }}}}\"\n else\n # regular, all caps and small font\n r = \"\\\\textscale{#{ 0.7 }}{#{ escape_latex_text(header_text).unicode_upcase }}\"\n if 'chn' == language_code_3_chars\n r = \"\\\\textbf{#{ r }}\"\n end\n r\n end\n end", "def table_heading(value)\n # Set the default proc to look up undefined values\n headings = Hash.new do |hash,key|\n items = key.to_s.split('_')\n # Look up each piece individually\n hash[key] = items.length > 1 ?\n # Recusively look up the heading for the parts\n items.map{|x| headings[x.to_sym]}.join(' ') :\n # Capitalize if this part isn't defined\n items.first.capitalize\n end\n\n # Predefined headings (or parts of headings)\n headings.merge!({\n :creation_time => \"Created\",\n :expires_in_seconds => \"Expires In\",\n :uuid => \"UUID\",\n :current_scale => \"Current\",\n :scales_from => \"Minimum\",\n :scales_to => \"Maximum\",\n :gear_sizes => \"Allowed Gear Sizes\",\n :consumed_gears => \"Gears Used\",\n :max_gears => \"Gears Allowed\",\n :gear_info => \"Gears\",\n :plan_id => \"Plan\",\n :url => \"URL\",\n :ssh_string => \"SSH\",\n :connection_info => \"Connection URL\",\n :gear_profile => \"Gear Size\",\n :visible_to_ssh? => 'Available',\n })\n\n headings[value]\n end", "def make_header_row(column_elements)\n\t\"<tr style=\\\"background-color: #808080;\\\"><td style=\\\"#{CENTER};\\\"><span style=\\\"#{WHITE};\\\"><strong>\n\t\t#{column_elements.join(\"</strong></span></td><td style=\\\"#{CENTER};\\\"><span style=\\\"#{WHITE};\\\"><strong>\")}\n\t\t</strong></span></td></tr>\"\nend", "def summary_table_headers(args={})\n\t\t'''\n\t\t\t<thead>\n\t <tr>\n\t <th>Created At</th>\n\t <th>Payable To Organization Id</th>\n\t <th>Payable From Organization Id</th>\n\t <th>Payable From Patient Id</th>\n\t <th>Total</th>\n\t <th>Paid</th>\n\t <th>Pending</th>\n\t <th>Options</th>\n\t </tr>\n\t </thead>\n\t\t'''\n\tend", "def summary_table_headers(args={})\n\n\t\tif args[\"root\"] =~ /order/\n\t\t\t'\n\t\t\t\t<thead>\n\t\t <tr>\n\t\t <th>Name</th>\n\t\t <th>Result</th>\n\t\t <th>Units</th>\n\t\t <th>Range</th>\n\t\t <th>Inference</th>\n\t\t <th>Verified</th>\n\t\t <th>Options</th>\n\t\t </tr>\n\t\t </thead>\n\t\t\t'\n\t\telse\n\t\t\t'\n\t\t\t\t<thead>\n\t\t <tr>\n\t\t <th>Name</th>\n\t\t <th>LIS CODE</th>\n\t\t <th>Description</th>\n\t\t <th>Total Ranges</th>\n\t\t <th>Options</th>\n\t\t </tr>\n\t\t </thead>\n\t\t\t'\n\t\tend\n\tend", "def build_table_header\n names = column_names(data)\n build_md_row(output, names)\n build_md_row(output, alignment_strings(names))\n end", "def generate_header_row\n '<tr>' + '<th>' + \"#{(@header.map {|x| generate_header_item(x)}).join('</th><th>')}\" + '</th></tr>' + \"\\n\"\n end", "def render_thead\n if @header_line\n return Tools::html_safe(content_tag(:thead, @header_line.render_line))\n end\n ''\n end", "def add_heading(heading)\n table.heading = heading\n end", "def render_table_header(table)\n table = self.record_tables[table]\n cells = []\n\n table.header.each do |_k, v|\n cells << @context.content_tag(:th, v[:label], v[:html])\n end\n\n cells.join.html_safe\n end", "def transform_headers( str, rs )\n\t\t\t@log.debug \" Transforming headers\"\n\n\t\t\t# Setext-style headers:\n\t\t\t#\t Header 1\n\t\t\t#\t ========\n\t\t\t#\n\t\t\t#\t Header 2\n\t\t\t#\t --------\n\t\t\t#\n\n\t\t\tsection_numbers = [nil, nil, nil, nil, nil]\n\n\t\t\tstr.\n\t\t\t\tgsub( HeaderRegexp ) {|m|\n\t\t\t\t\tif $1 then\n\t\t\t\t\t\t@log.debug \"Found setext-style header\"\n\t\t\t\t\t\ttitle, id, hdrchar = $1, $2, $3\n\n\t\t\t\t\t\tcase hdrchar\n\t\t\t\t\t\twhen '='\n\t\t\t\t\t\t\tlevel = 1\n\t\t\t\t\t\twhen '-'\n\t\t\t\t\t\t\tlevel = 2\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@log.debug \"Found ATX-style header\"\n\t\t\t\t\t\thdrchars, title, id = $4, $5, $6\n\t\t\t\t\t\tlevel = hdrchars.length\n\n\t\t\t\t\t\tif level >= 7 then\n\t\t\t\t\t\t\trs.warnings << \"illegal header level - h#{level} ('#' symbols are too many)\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tprefix = ''\n\t\t\t\t\tif rs.numbering? then\n\t\t\t\t\t\tif level >= rs.numbering_start_level and level <= 6 then\n\t\t\t\t\t\t\tdepth = level - rs.numbering_start_level\n\n\t\t\t\t\t\t\tsection_numbers.each_index do |i|\n\t\t\t\t\t\t\t\tif i == depth and section_numbers[depth] then\n\t\t\t\t\t\t\t\t\t# increment a deepest number if current header's level equals last header's\n\t\t\t\t\t\t\t\t\tsection_numbers[i] += 1\n\t\t\t\t\t\t\t\telsif i <= depth then\n\t\t\t\t\t\t\t\t\t# set default number if nil\n\t\t\t\t\t\t\t\t\tsection_numbers[i] ||= 1\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t# clear discardeds\n\t\t\t\t\t\t\t\t\tsection_numbers[i] = nil\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tno = ''\n\t\t\t\t\t\t\t(0..depth).each do |i|\n\t\t\t\t\t\t\t\tno << \"#{section_numbers[i]}.\"\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tprefix = \"#{no} \"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle_html = apply_span_transforms( title, rs )\n\n\t\t\t\t\tunless id then\n\t\t\t\t\t\tcase rs.header_id_type\n\t\t\t\t\t\twhen HeaderIDType::ESCAPE\n\t\t\t\t\t\t\tid = escape_to_header_id(title_html)\n\t\t\t\t\t\t\tif rs.headers.find{|h| h.id == id} then\n\t\t\t\t\t\t\t\trs.warnings << \"header id collision - #{id}\"\n\t\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle = \"#{prefix}#{title}\"\n\t\t\t\t\ttitle_html = \"#{prefix}#{title_html}\"\n\n\n\t\t\t\t\tunless id =~ IdRegexp then\n\t\t\t\t\t\trs.warnings << \"illegal header id - #{id} (legal chars: [a-zA-Z0-9_-.] | 1st: [a-zA-Z])\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif rs.block_transform_depth == 1 then\n\t\t\t\t\t\trs.headers << RenderState::Header.new(id, level, title, title_html)\n\t\t\t\t\tend\n\n\t\t\t\t\tif @use_header_id then\n\t\t\t\t\t\t%{<h%d id=\"%s\">%s</h%d>\\n\\n} % [ level, id, title_html, level ]\n\t\t\t\t\telse\n\t\t\t\t\t\t%{<h%d>%s</h%d>\\n\\n} % [ level, title_html, level ]\n\t\t\t\t\tend\n\t\t\t\t}\n\t\tend", "def down_level_headings(content)\n content.gsub(/^#/, \"##\")\n end", "def heading_name\n if @pluralize\n ix(@name.pluralize).to_sym\n else\n ix(@name).to_sym\n end\n end", "def ar_index_table_headers \n label_header= content_tag(:th, controller.ardata.labels[:label])\n \n # This will be used when adding the table rows.\n # it will contain, in the order in wich they are retrieved,\n # a true of false value depending on the presence of the label\n # for the table header. This means that a column can be disabled\n # simply by labeling it with an empty string (most usefull when the\n # label of the column comes from a method or a Proc that can enable/disable\n # the output given a set of conditions\n @display_current_ar_index_table_column= []\n \n headers= []\n \n controller.ardata.fields.for_index.each do |column, title|\n label= ar_get_index_label(title)\n \n if label && !label.strip.empty?\n headers << content_tag(:th, label) \n @display_current_ar_index_table_column << true\n else\n @display_current_ar_index_table_column << false\n end\n end\n \n colspan= ar_index_colspan\n \n \"<tr>\\n #{label_header}\" \\\n \"\\n #{headers.join(\"\\n \")}\" \\\n \"\\n #{colspan}\" \\\n \"\\n </tr>\"\n end", "def header(text, header_level)\n\t\t\"h#{header_level}. #{text}\\n\"\n\tend", "def to_markdown_heading\n heading = to_heading\n to_markdown heading\n end", "def column_headings\n {\n :line_count => \"Lines\",\n :loc_count => \"LOC\",\n :file_count => \"Classes\",\n :method_count => \"Methods\",\n :average_methods => \"M/C\",\n :method_length => \"LOC/M\",\n :class_length => \"LOC/C\"\n }\n end", "def to_table\n headers = fields.map { |field| field.label.downcase }\n body = fields.map { |field| field.to_s.downcase }\n\n [headers, body]\n end", "def generate_header\n \"<table class='bodyTable'><thead><th>Testing element</th><th>Pass</th><th>Result</th><th>Time</th></thead><tbody>\"\n end", "def header(text, header_level)\n # clean string from html\n stringHeader = Sanitize.clean(text)\n\n # replace all unwanted characters to space\n stringHeader = stringHeader.downcase.gsub(/[^a-z0-9_-]+/i, \" \")\n\n # strip whitespaces from the beginning and end of a string\n stringHeader = stringHeader.strip\n\n # replace all unwanted characters to -\n stringHeader = stringHeader.downcase.gsub(/[^a-z0-9_-]+/i, \"-\")\n\n # convert number to string\n stringHeaderNum = header_level.to_s\n\n # create header\n result = '<h' + stringHeaderNum + ' id=\"' + stringHeader + '\">' + text + '</h' + stringHeaderNum + '>'\n\n return result\n end", "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end", "def semanticize_headings!\n implicit_headings.each do |element|\n heading = guess_heading element\n element.node_name = heading unless heading.nil?\n end\n end", "def add_headers(columns, header, worksheet)\r\n \r\n # print a numeric format\r\n f5 = Format.new(:num_format => 0x0f)\r\n worksheet.format_row(0..2, 15, @formats[:title] )\r\n # add headers\r\n worksheet.write(FIRST_ROW, FIRST_COLUMN, \"Title: #{header.title.camelize}\")\r\n worksheet.write(FIRST_ROW + 1, 0, \"Description: #{header.description.camelize}\")\r\n worksheet.write(FIRST_ROW + 2, 0, \"Query: #{header.sql}\")\r\n \r\n columns.each_with_index do |col, cindex|\r\n worksheet.format_column(cindex, 15, @formats[:number_column]) # set width of column (15 fixed)\r\n worksheet.write(STARTING_COLUMN_ROW, cindex, col.camelize, @formats[:column_header])\r\n end\r\n end", "def table_headings\n tableheadings = []\n print_layout.each do |section|\n row_cells = section[:row_cells]\n raise Error::AppError.new('table_headings', 'No Row Cells defined') if row_cells.nil?\n\n tableheadings += table_cell_headers(row_cells)\n end\n [tableheadings, tableheadings.count]\n end", "def generate_header_row\n (@header.map {|x| generate_header_item(x)}).join\n end", "def build_formatted_headers(_widths = {})\n # Don't decorate if this Formatter calls for alignment. It will be done\n # in the second pass.\n decorate = !aligned?\n map = {}\n table.headers.each do |h|\n istruct = format_at[:header][h]\n map[h] = [h, format_cell(h.as_string, istruct, decorate: decorate)]\n end\n map\n end", "def build_formatted_headers(_widths = {})\n # Don't decorate if this Formatter calls for alignment. It will be done\n # in the second pass.\n decorate = !aligned?\n map = {}\n table.headers.each do |h|\n istruct = format_at[:header][h]\n map[h] = [h, format_cell(h.as_string, istruct, decorate: decorate)]\n end\n map\n end", "def table_headers\n [\"Description\", \"Qty\", \"VAT\", \"Amount\"]\n end", "def search_results_table_headers\n search_results_table.headers_text\n end", "def transaction_summary_table_main_headers\n transaction_summary_table.headers_text\n end", "def to_prawn_header(header)\n size = { 1 => 16, 2 => 12 }[header.level]\n @pdf.text header.children.join(\"\\n\"), :size => size, :style => :bold\n @pdf.text ' '\n end", "def row_cells_to_text_columns(table_row)\n table_row.cells.map do |cell|\n # Join paragraphs into a String using a space delimiter.\n cell_paragraphs(cell).join(' ')\n end\n end", "def header_format; self.underline end", "def headings_with_rows\n @headings + rows\n end", "def headings_with_rows\n [headings] + rows\n end", "def textfileHeader\n raw_header = labels.inject(\"\") { |header, l| header + \" \" + l.text}\n header = \"Classes: \" + raw_header\n end", "def table_cell_headers(row_cells)\n list = []\n\n row_cells.each do |cell|\n list << if cell[:list_items].count == 1\n item = cell[:list_items][0]\n this_label(item[:code], item[:action_name], item[:label]) unless item[:label] == false\n else\n ''\n end\n end\n list\n end", "def library_heading_row\n content_tag(:tr) do\n column_tags(:th, *LIBRARY_COLUMNS, class: 'heading')\n end\n end", "def table_header\n line = \"File|Total\".dup\n line << \"|Line\" if header_line_rate?\n line << \"|Branch\" if header_branch_rate?\n line << \"\\n\"\n end", "def thead(*args)\n content_tag :thead, content_tag(:tr, args.map { |arg| content_tag :th, arg.to_s.humanize }.join.html_safe)\n end", "def thead(*args)\n content_tag :thead, content_tag(:tr, args.map { |arg| content_tag :th, arg.to_s.humanize }.join.html_safe)\n end", "def typus_table_header(model, fields)\n returning(String.new) do |html|\n headers = []\n fields.each do |key, value|\n order_by = model.reflect_on_association(key.to_sym).primary_key_name rescue key\n sort_order = (params[:sort_order] == 'asc') ? 'desc' : 'asc'\n if (model.model_fields.map(&:first).collect { |i| i.to_s }.include?(key) || model.reflect_on_all_associations(:belongs_to).map(&:name).include?(key.to_sym)) && params[:action] == 'index'\n headers << \"<th>#{link_to \"<div class=\\\"#{sort_order}\\\">#{t(key.humanize)}</div>\", { :params => params.merge(:order_by => order_by, :sort_order => sort_order) }}</th>\"\n else\n headers << \"<th>#{t(key.humanize)}</th>\"\n end\n end\n headers << \"<th>&nbsp;</th>\"\n html << <<-HTML\n<tr>\n#{headers.join(\"\\n\")}\n</tr>\n HTML\n end\n end", "def line_headings\n {\n :controller_files => \"Controllers\",\n :model_files => \"Models\",\n :view_files => \"Views\",\n :lib_files => \"Libraries\",\n :plugin_files => \"Plugins\",\n :controller_specs => \"Controller Specs\",\n :model_specs => \"Model Specs\",\n :view_specs => \"View Specs\"\n }\n end", "def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @header=@header.flatten\n end", "def header_text\n @attributes[:header_text]\n end", "def tableify node\n if node.xpath('title').length > 0\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'table', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n else\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'informaltable', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n end\n\n # Convert title to caption (see\n # http://www.sagehill.net/docbookxsl/Tables.html ) and re-order things\n newchildren = []\n node.children.each { |child| child.name == 'title' and convert 'title', child, 'caption' }\n node.children.each { |child| child.name == 'caption' and newchildren << child }\n node.children.each { |child| child.name == 'colgroup' and newchildren << child }\n node.children.each { |child| child.name != 'caption' and child.name != 'colgroup' and newchildren << child }\n node.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n\n return node\nend", "def prepare_header_cells(table_header)\n cells = @parser.find(table_header).find_children('tr').find_children(\n 'th'\n ).list_results\n cells.each do |cell|\n next unless Hatemile::Util::CommonFunctions.is_valid_element?(cell)\n\n @id_generator.generate_id(cell)\n cell.set_attribute('scope', 'col')\n end\n end", "def header(text, level)\n if text =~ /^\\^([a-zA-Z0-9-]+) /\n anchor_prefix = $1\n text = text.sub(\"^#{anchor_prefix} \", \"\")\n end\n anchor = FormatHelpersWrapper.strip_tags(text).parameterize\n anchor = \"#{anchor_prefix}-#{anchor}\" if anchor_prefix\n %(<h%s><span class=\"anchor\" id=\"%s\"></span><a href=\"#%s\">%s</a></h%s>) % [level, anchor, anchor, text, level]\n end", "def accept_table header, body, aligns\n widths = header.zip(body) do |h, b|\n [h.size, b.size].max\n end\n aligns = aligns.map do |a|\n case a\n when nil\n :center\n when :left\n :ljust\n when :right\n :rjust\n end\n end\n @res << header.zip(widths, aligns) do |h, w, a|\n h.__send__(a, w)\n end.join(\"|\").rstrip << \"\\n\"\n @res << widths.map {|w| \"-\" * w }.join(\"|\") << \"\\n\"\n body.each do |row|\n @res << row.zip(widths, aligns) do |t, w, a|\n t.__send__(a, w)\n end.join(\"|\").rstrip << \"\\n\"\n end\n end", "def print_headings\n puts\n print_separator\n \n columns = [\"Name\"];\n column_order.each {|heading| columns.push(column_headings[heading])}\n print_line(columns)\n \n print_separator\n end", "def table title\r\n @xml.table do\r\n @xml.tr do @xml.th(title, :colspan => 3) end\r\n yield self\r\n end\r\n end", "def h(text); end", "def h(text); end", "def thead(*args)\n headers = args.flatten.map {|a| content_tag :th, a.is_a?(Symbol) ? t(a, default: a.to_s.titleize) : a }.join\n content_tag(:thead, content_tag(:tr, raw(headers)))\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def header\n temp = \"\"\n result = \"SpecId\\tLabel\\tCharge\\t\"\n \n nokogiriDoc(@target).xpath(\"//#{@xmlns}search_hit\").each do |hit|\n temp = hit.xpath(\".//#{@xmlns}search_score\")\n break\n end\n \n temp.each do |score|\n result += score.xpath(\"./@name\").to_s + \"\\t\"\n end\n \n result += \"Peptide\\t\" + \"Proteins\"\n end", "def add_language_support_for_headings(content)\n content.gsub(%r{^(h[1-6])(\\(#[^\\)]+\\))?(\\([^(\\)|#)]+\\))?\\.\\s*\\n.+?\\n\\s*\\n}m) do |match|\n h_tag, anchor, option = $1, $2, $3\n lang_definitions = match.scan(/\\s*(.+?)\\s*:\\s*(.+?)\\s*[\\n|^]/)\n lang_spans = lang_definitions.map { |lang, definition| \"<span lang='#{lang}'>#{definition}</span>\" }.join('')\n \"#{h_tag}#{anchor}. #{lang_spans}\\n\\n\"\n end\n end", "def compute_header_title_latex(document_title_plain_text, document_title_latex, header_footer_rules_present, language_code_3_chars, title_length_override)\n if header_footer_rules_present # this means we're in primary repo\n # bold, italic, small caps and large font\n # NOTE: All titles are wrapped in <em> and .smcaps, so that will\n # take care of the italics and smallcaps.\n truncated = compute_truncated_title(\n document_title_plain_text,\n document_title_latex,\n title_length_override || 58,\n title_length_override ? 0 : 3,\n )\n # Replace title superscript params with header ones\n truncated.gsub!(\n [\n \"{\\\\raisebox{#{ @options[:title_superscript_raise] }ex}\",\n \"{\\\\textscale{#{ @options[:title_superscript_scale] }}{\",\n ].join,\n [\n \"{\\\\raisebox{#{ @options[:header_superscript_raise] }ex}\",\n \"{\\\\textscale{#{ @options[:header_superscript_scale] }}{\",\n ].join\n )\n \"\\\\textscale{#{ 0.909091 }}{\\\\textbf{#{ truncated }}}\"\n else\n # regular, all caps and small font\n # We use same method as for primary (with header_footer_rules_present),\n # except we pass plain text as document_title_latex.\n # This is so that we get newline removal and warnings on titles\n # that get truncated without a length override.\n truncated = compute_truncated_title(\n document_title_plain_text,\n document_title_plain_text, # Pass plain text as latex\n title_length_override || 54,\n title_length_override ? 0 : 3\n )\n r = \"\\\\textscale{#{ 0.7 }}{#{ truncated.unicode_upcase }}\"\n # re-apply superscript to any trailing digits\n if r =~ /\\d+\\}\\z/\n r.gsub!(\n /\\d+\\}\\z/,\n [\n \"{\\\\raisebox{#{ @options[:header_superscript_raise] }ex}\",\n \"{\\\\textscale{#{ @options[:header_superscript_scale] }}{\",\n '\\0',\n \"}}}\",\n ].join\n )\n elsif r =~ /(?<=\\d)[[:alpha:]]{1,2}(?=(\\s|\\z))/\n # re-apply superscript to letters after ordinal numbers, e.g., \"3e partie\"\n r.gsub!(\n /(?<=\\d)[[:alpha:]]{1,2}(?=(\\s|\\z))/,\n [\n \"{\\\\raisebox{#{ @options[:header_superscript_raise] }ex}\",\n \"{\\\\textscale{#{ @options[:header_superscript_scale] }}{\",\n '\\0',\n \"}}}\",\n ].join\n )\n end\n if 'chn' == language_code_3_chars\n r = \"\\\\textbf{#{ r }}\"\n end\n r\n end\n end", "def build_heading level\n type, text, = get\n\n text = case type\n when :TEXT then\n skip :NEWLINE\n text\n else\n unget\n ''\n end\n\n RDoc::Markup::Heading.new level, text\n end", "def header\n self.mult_table.header_line.to_s + \"\\n\"\n end", "def transform_hrules( str, rs )\n\t\t\t@log.debug \" Transforming horizontal rules\"\n\t\t\tstr.gsub( /^( ?[\\-\\*_] ?){3,}$/, \"\\n<hr#{EmptyElementSuffix}\\n\" )\n\t\tend", "def replace_tables_text(v)\n t = sanitize_sql(v)\n (table_extended_with.collect(&:table) | [table_name]).each do |cur_tab|\n t.gsub!(/(\\W|\\A)#{cur_tab}(\\W)/i) {\"#{$1}#{extended_table_name}#{$2}\"}\n end\n t\n end", "def block_textile_table( text ) \n text.gsub!( TABLE_RE ) do |matches|\n\n caption, id, tatts, fullrow = $~[1..4]\n tatts = pba( tatts, 'table' )\n tatts = shelve( tatts ) if tatts\n rows = []\n\n fullrow.\n split( /\\|$/m ).\n delete_if {|row|row.empty?}.\n each do |row|\n\n ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\\. )(.*)/m\n row << \" \"\n \n cells = []\n row.split( '|' ).each_with_index do |cell, i|\n next if i == 0\n \n ctyp = 'd'\n ctyp = 'h' if cell =~ /^_/\n\n catts = ''\n catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\\. ?)(.*)/\n\n catts = shelve( catts ) if catts\n cells << \"\\t\\t\\t<t#{ ctyp }#{ catts }>#{ cell.strip.empty? ? \"&nbsp;\" : row.split( '|' ).size-1 != i ? cell : cell[0...cell.length-1] }</t#{ ctyp }>\"\n end\n ratts = shelve( ratts ) if ratts\n rows << \"\\t\\t<tr#{ ratts }>\\n#{ cells.join( \"\\n\" ) }\\n\\t\\t</tr>\"\n end\n caption = \"\\t<p class=\\\"caption\\\">#{caption}</p>\\n\" if caption\n \"#{caption}\\t<table#{ tatts }>\\n#{ rows.join( \"\\n\" ) }\\n\\t</table>\\n\\n\"\n end\n end", "def format_rows descriptions\n formatted = descriptions.map do |description|\n @column_descriptions.map do |field, _, format,|\n format % description[field]\n end\n end\n\n [@headers].concat formatted\n end", "def pp_table(headers, rows)\n if headers.empty? || rows.empty?\n return\n end\n puts headers.map { |h| \"%20s\" % h.upcase }.join\n rows.map { |cols| puts cols.map { |c| \"%20s\" % c }.join }\n #puts \"=\" * 80\nend", "def accept_heading heading\n level = [6, heading.level].min\n\n label = heading.label @code_object\n\n @res << if @options.output_decoration\n \"\\n<h#{level} id=\\\"#{label}\\\">\"\n else\n \"\\n<h#{level}>\"\n end\n @res << to_html(heading.text)\n unless @options.pipe then\n @res << \"<span><a href=\\\"##{label}\\\">&para;</a>\"\n @res << \" <a href=\\\"#top\\\">&uarr;</a></span>\"\n end\n @res << \"</h#{level}>\\n\"\n end", "def header(level = 1, txt)\n enclose(\"h#{level}\", txt)\n end", "def table_header_for_week( curr_date = Date.today )\n sOut = \"\\r\\n\" # (Add CR+LF for each table row to improve generated source readibility)\n dt_start = Schedule.get_week_start( curr_date )\n\n dt_start.step(dt_start+5, 1) { |d|\n header_text = \"\" << d.day.to_s << \"/\" << d.month.to_s << \"<br/>\" << h(Schedule.long_day_name( d.cwday ))\n sOut << \" #{content_tag( :th, header_text, :class => get_schedule_cell_style( d ) )}\\r\\n\"\n }\n sOut << \" #{content_tag( :th, h(Schedule.long_day_name(7)), :class => 'schedule-notes' )}\\r\\n\"\n\n return content_tag( :tr, sOut, :class => 'schedule-header' )\n end", "def headings\n [ \n '',\n 'Service',\n 'Stars',\n {:value => 'The Hotness', :alignment => :center } \n ]\n end", "def display_cell_header(table_cell)\n # Interface method\n end", "def to_table\n mortadella = Mortadella::Horizontal.new headers: %w[NAME LOCATION]\n @tags.keys.sort.each do |tag_name|\n mortadella << [tag_name, @tags[tag_name].to_sentence]\n end\n mortadella.table\n end", "def row_headers\n use_row_headers ? rows.map(&:heading) : true\n end", "def header_tag_adder(incoming_text)\n tagged_text = incoming_text.map do |line|\n if line.include?('#')\n line = \"<h#{line.count('#')}>\" + line + \"</h#{line.count('#')}>\"\n line.sub(\"#\"*(\"#{line.count('#')}\".to_i) + \" \", \"\")\n else\n line\n end\n end\n end", "def accept_table header, body, aligns\n @res << \"\\n<table role=\\\"table\\\">\\n<thead>\\n<tr>\\n\"\n header.zip(aligns) do |text, align|\n @res << '<th'\n @res << ' align=\"' << align << '\"' if align\n @res << '>' << CGI.escapeHTML(text) << \"</th>\\n\"\n end\n @res << \"</tr>\\n</thead>\\n<tbody>\\n\"\n body.each do |row|\n @res << \"<tr>\\n\"\n row.zip(aligns) do |text, align|\n @res << '<td'\n @res << ' align=\"' << align << '\"' if align\n @res << '>' << CGI.escapeHTML(text) << \"</td>\\n\"\n end\n @res << \"</tr>\\n\"\n end\n @res << \"</tbody>\\n</table>\\n\"\n end", "def heading_info( elem )\n m = @h_rgxp.match(elem.name)\n level = Integer(m[1])\n\n self.current_level = level\n text = elem.inner_text\n\n lbl = label\n if numbering?\n elem.children.first.before %Q{<span class=\"heading-num\">#{lbl}</span>}\n end\n elem['id'] = \"h#{lbl.tr('.','_')}\" if elem['id'].nil?\n\n return [text, elem['id']]\n end", "def output\n # If there are neither headers nor any rows in the table, return an\n # empty string.\n return '' if table.empty? && table.headers.empty?\n\n # This results in a hash of two-element arrays. The key\n # is the header and the value is an array of the header and formatted\n # header. We do the latter so the structure parallels the structure for\n # rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n if loc_row.nil?\n result += hline(widths)\n next\n end\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end", "def content\n number_to_skip = 0 # Keeps track of the # of columns to skip\n \n html = ''\n table.header.column_names.each do |column|\n number_to_skip -= 1 and next if number_to_skip > 0\n \n if cell = @cells[column]\n number_to_skip = (cell[:colspan] || 1) - 1\n else\n cell = Cell.new(column, nil)\n end\n \n html << cell.html\n end\n \n html\n end", "def prepare_related_identifiers_for_csv(csv, _headings, hash)\n csv << [_('Related Works: ')]\n csv << hash[:related_works].first.keys.map { |key| key.to_s.capitalize.tr('_', ' ') }\n hash[:related_works].each do |related_work|\n csv << related_work.values\n end\n csv << []\n csv << []\n end", "def substituteTitles(post, toc_title)\n items = Array.new\n\n post.content.gsub!(/h(\\d)\\. (\\S+[ \\S]*)/) do |r|\n level = $1\n title = $2\n link_text = title.gsub(/[_*]/, \"\") # title: bla *bla* => bla_bla\n id = link_text.gsub(/\\W+/, \"_\").gsub(/[\\W_]+$/, '') # title Bla?_bla*blbla => Bla_bla_blbla\n items << { :link_text => link_text, :level => level.to_i, :id => id }\n \"h#{level}(##{id}). #{title}\"\n end\n self.process_toc(post, items, toc_title)\n end", "def section_heading(label)\n \n \"#{label}\\n\"\n \n end", "def section_heading(label)\n \n \"#{label}\\n\"\n \n end", "def generate(pdf, heading)\n pdf.move_down(heading[:top_padding])\n pdf.formatted_text([text_properties(heading)])\n end", "def build_heading level\n heading = RDoc::Markup::Heading.new level, text\n skip :NEWLINE\n\n heading\n end", "def plan_header_cell(plan, index, plan_size)\n classes = []\n classes << 'plan_name' << 'thhead'\n classes << 'thead_first' if index == 0\n classes << 'thead_last' if (index + 1) == plan_size\n classes << 'selected' if plan.bought_by?(current_account)\n\n content_tag('td', :class => classes.join(' ')) do\n content_tag('h3', h(plan.name))\n end\n end", "def raw_table_to_hash tbl\n fixd_hsh = tbl.reject{|arr| arr.blank?}.inject({}) do |h,arr|\n title = arr.first.downcase.gsub(/[-\\s]/, '_').to_sym\n val = arr.last.gsub(\",\",\"\")\n h[title] = val\n h\n end\n fixd_hsh\n end", "def to_tab_heading\n heading = to_heading\n to_tab heading\n end", "def header_association(relation, name, opts={}, &block)\n raise \"Not in header mode!\" if @row_mode != :header\n opts = normalize_column_options(name, opts)\n if opts[:sortable] and @table_options[:sortable]\n # change classes accordingly\n end\n make_tag(:th, opts[:th_html]) do\n concat(t(opts[:header] || \"#{relation.to_s.humanize.titlecase} #{name.to_s.humanize.titlecase}\"), :escape_html)\n end # </th>\n end", "def header(height, *columns)\n columns = columns.to_a.map{ |v| preprocess_table_data(v) }\n layout column: 1, row: 1, fill_width: true, height: height do\n table [\n # row 1\n columns\n ],\n width_ratio: 1.0,\n cell_style: {\n borders: [ :bottom ],\n border_width: 1.5,\n padding: [ 0, 0, 0, 0 ],\n font_style: :bold,\n size: 20\n }\n end\n end", "def write_headers\n @sheet.row(0).replace [header]\n @sheet.row(3).replace name_header_row(@player.longs.first.ticker_name, @player.shorts.first.ticker_name, @player.calls.first.ticker_name)\n @sheet.row(4).replace data_header_row(long_short_headers, long_short_headers, call_put_headers)\n\n @sheet.row(17).replace name_header_row(@player.futures.first.ticker_name, 'Total P&L', @player.puts.first.ticker_name)\n @sheet.row(18).replace data_header_row(long_short_headers, overall_headers, call_put_headers)\n end", "def ascii_heading(title_text)\n title = Artii::Base.new :font => 'doom'\n print title.asciify(title_text).colorize(:green) # colours the ascii art.\n space\nend", "def title\n [self.table[:title], subtitle].compact.join(': ')\n end", "def output_section(heading, body)\n return '' if body.compact.empty?\n fancy_heading = Pry::Helpers::Text.bold(color(:heading, heading))\n Pry::Helpers.tablify_or_one_line(fancy_heading, body)\n end", "def personalize_heading_text(heading_text)\n if (heading_text.include? '<family-member-name-placeholder>')\n heading_text.sub! '<family-member-name-placeholder>', (@model.class.to_s == \"FinancialAssistance::Applicant\" ? @model.family_member.person.first_name : (@model.class.to_s == \"FinancialAssistance::Application\" ? @model.primary_applicant.family_member.person.first_name : @applicant.family_member.person.first_name))\n else\n heading_text\n end\n end", "def table(header, values, io = $stdout)\n self.puts(io, MiGA.tabulate(header, values, self[:tabular]))\n end", "def column_headers(data)\n data.find { |line| line.split(' ').first.downcase == HEADER_INDICATOR }.split(' ')\n end", "def output\n # This results in a hash of two-element arrays. The key is the header and\n # the value is an array of the header and formatted header. We do the\n # latter so the structure parallels the structure for rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n result += hline(widths) if loc_row.nil?\n next if loc_row.nil?\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end", "def admin_table_heading(name, order_name, html_options = {})\n class_names = []\n if order_name == params[:order]\n class_names << 'sorted'\n class_names << (params[:direction].downcase == 'desc' ? 'descending' : 'ascending')\n\n new_order = (params[:direction].downcase == 'desc' ? 'asc' : 'desc')\n else\n new_order = 'asc'\n end\n class_names << html_options[:class]\n class_names.compact!\n html_options[:class] = class_names.length > 0 ? class_names.join(' ') : nil\n\n return content_tag(:th, content_tag(:a, name, :href => url_for(params.merge(:order => order_name, :direction => new_order))), html_options)\n end" ]
[ "0.6840461", "0.673363", "0.66941625", "0.66568744", "0.6486267", "0.645218", "0.63499457", "0.62495327", "0.6234798", "0.62046164", "0.6203615", "0.616092", "0.61553544", "0.61206615", "0.6093966", "0.6070091", "0.6069904", "0.6054214", "0.5988411", "0.59874576", "0.5982909", "0.5981717", "0.5975344", "0.5963454", "0.59530705", "0.59301716", "0.59256464", "0.5915268", "0.58999455", "0.58770615", "0.58770615", "0.5843667", "0.5834707", "0.5823561", "0.5823085", "0.58154196", "0.5813884", "0.5813608", "0.5803789", "0.58006215", "0.5779485", "0.5764007", "0.57613456", "0.57489824", "0.57489824", "0.57444435", "0.57442683", "0.5741847", "0.5727778", "0.5704431", "0.5699232", "0.5688855", "0.5677596", "0.56657785", "0.5658452", "0.56559724", "0.56559724", "0.56366044", "0.5618595", "0.56083393", "0.5598461", "0.5594873", "0.5593927", "0.5591969", "0.5588441", "0.55829984", "0.55701077", "0.55687934", "0.55565196", "0.5555101", "0.5540282", "0.5535215", "0.5534329", "0.552584", "0.55167896", "0.55167216", "0.5514101", "0.55135775", "0.5505272", "0.5503768", "0.5480692", "0.54797095", "0.54667795", "0.54573226", "0.54573226", "0.5454921", "0.5453057", "0.5448711", "0.5443109", "0.5441355", "0.54189235", "0.5418086", "0.54158807", "0.5414686", "0.54003704", "0.5395897", "0.53950894", "0.539309", "0.53904676", "0.5388792", "0.5385959" ]
0.0
-1
All po line items which have a PO header to them (vendor only) used for listing vendor items
def po_items # po_items = self.po_headers.joins(:po_lines).select("po_lines.item_id").where("po_headers.organization_id = ?",self.id).order("po_lines.created_at DESC") po_items = PoLine.includes(:po_header).where('po_headers.organization_id = ?', id).order('po_headers.created_at DESC') po_items = po_items.collect(& :item_id) Item.where(id: po_items) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fulfilled_line_items\n return self.order_line_items.where(:status => 'shipped').all\n end", "def line_items_for_customer(customer_id)\n ret_line_items = []\n my_line_items = delivery_details.find_all_by_customer_id(customer_id)\n my_line_items.each do |my_line_item|\n my_line_item.order_items.each do |order|\n if order.quantity > 0\n ret_line_items.push(order) unless ret_line_items.include? order\n end\n end\n end\n return ret_line_items\n end", "def partial_short_items\n lines = @doc.xpath('ql:SOResult/ql:Line', 'ql' => NAMESPACE)\n lines = lines.select { |l| Integer(l['Quantity']) == 0 }\n lines.map do |line|\n {\n ql_item_number: line['ItemNumber'],\n }\n end\n end", "def items\n lineitems.each_with_object([]) {|lineitem,arr| arr << lineitem.item}\n end", "def customers; (line_items.map(&:customer).flatten.compact.uniq rescue []); end", "def unfulfilled_line_items\n return self.order_line_items.where('status != ?', 'shipped').all\n end", "def line_items\n LineItem.where(description: self.descriptions.select(:value))\n end", "def line_items_strict\n\t\tline_items.select do |x| \n\t\t\tinventory_units\n\t\t\t\t.uniq { |y| y.variant_id }\n\t\t\t\t.map { |z| z.variant_id }\n\t\t\t\t.include?(x.variant_id)\n\t\tend\n\tend", "def invoice_items\n invoice_items = engine.invoice_item_repository.parse\n invoice_items.select {|invoice_item| invoice_item.item_id == id}\n end", "def line_item_data\n items = @invoice.invoice_items.collect do |item|\n [item.name, item.quantity, vat_to_string(item.vat), format_item_amount(item)]\n end\n items.unshift(table_headers)\n end", "def so_items\n # so_items = self.so_headers.joins(:so_lines).select(\"so_lines.item_id\").where(\"so_headers.organization_id = ?\",self.id).order(\"so_lines.created_at DESC\")\n so_items = SoLine.includes(:so_header).where('so_headers.organization_id = ?', id).order('so_headers.created_at DESC')\n so_items = so_items.collect(& :item_id)\n Item.where(id: so_items)\n end", "def unpaid_line_items\n @unpaid_line_items ||= line_items.find_all_by_paid(false)\n end", "def preview_order_items\n [\n {title: 'Item One', quantity: 2, price: 999, tax_exempt: false},\n {title: 'Item Two', quantity: 1, price: 25000, tax_exempt: false},\n {title: 'Item Three', quantity: 1, price: 8999, tax_exempt: false},\n {title: 'Item Four', quantity: 1, price: 100000, tax_exempt: false}\n ]\n end", "def service_provider_line_items(service_provider, items)\n service_provider_items = []\n items.map(&:sub_service_request_id).each do |ssr|\n if service_provider.identity.is_service_provider?(SubServiceRequest.find(ssr))\n service_provider_items << SubServiceRequest.find(ssr).line_items\n end\n end\n service_provider_items.flatten.uniq\n end", "def purchase_orders\n case organization_type.type_value\n when 'customer'\n PoHeader.joins(:po_lines).where('po_lines.organization_id = ?', id).order('created_at desc')\n when 'vendor'\n PoHeader.where('organization_id = ?', id).order('created_at desc')\n else\n PoHeader.where('organization_id = ?', 0).order('created_at desc')\n end\n end", "def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend", "def filter_order_items(merchant)\n self.orderitems.to_a.select { |orderitem| orderitem.product.merchant == merchant}\n end", "def line_item_products\n self.line_items.map(&:sellable).map {|s| s.respond_to?(:product) ? s.product : s}.compact.reject {|p| !p.is_a?(Product)}\n end", "def print_layout_header_list_items\n [{ code: :tare_reference },\n { code: :case_reference, placeholder: '<%CASE_REFERENCE%>' },\n { code: :version },\n { code: :reason, lookup: true, when: :pre_claim?, is: [false] },\n { code: :claim_desc, when: :reason, is: ['OTHER'] }]\n end", "def line_items\n Spree::LineItem\n .joins(order: [:order_cycle, :customer])\n .for_order_cycle(order_cycle)\n .where(\"spree_orders.state = 'complete'\")\n .group(\n 'customers.id, ' \\\n 'spree_line_items.variant_id, ' \\\n 'spree_line_items.order_id, ' \\\n 'spree_line_items.quantity'\n )\n .select([:variant_id, :order_id, :quantity])\n end", "def add_line_items_from_cart(cart)\n companies = []\n cart.line_items.each do |item|\n if !companies.include?(item.product.company.name)\n companies << item.product.company.name\n end\n end\n puts \"INSPECIONANDO ARRAY DE COMPANIES\"\n puts companies.inspect\n companies.each do |company|\n cart.line_items.each do |item|\n if item.product.company.name == company\n \n line_items << item\n end\n end\n end\n puts \"INspecionando o line_items\"\n puts line_items.inspect\n line_items\n end", "def sorted_line_items\n line_items.includes(:item).order(\"items.name\")\n end", "def ebay_products items\n\titems.select do |item|\n\t\titem['product']['author']['name'].downcase == 'ebay'\n\tend\nend", "def filtered_items\n @filtered_items ||= coverage_items.select do |item|\n (include_item_prefix?(item) || include_target_prefix?(item)) && !item.name.include?(\"$\")\n end\n end", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def lines_to_tryton\n result = []\n\n order_items.each do |order_item|\n\n \tif tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n \t source_entity: 'product',\n \t\t source_id: \"#{order_item.item_id}-#{order_item.item_price_type}\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => \"#{order_item.item_description} (#{order_item.item_price_description})\",\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % order_item.item_unit_cost\n },\n \"quantity\" => order_item.quantity\n \t }\n end\n\n end\t\n return result\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def create_line_items_from_menu_template event_vendor\n if !event_vendor.menu_template.nil?\n\n # If menu-level pricing, create the \"per-person\" line item, based on the initial participation\n if (event_vendor.menu_template.pricing_type == MenuPricingType.menu_level)\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end\n\n # Create line items for each inventory item, but only if there is no grouping configured\n if !event_vendor.menu_template.menu_template_grouped\n event_vendor.menu_template.inventory_items.each do |item|\n line_items.push(create_line_item_from_inventory_item(item, 0, event_vendor.vendor, account, false, false, \"\"))\n end\n end\n end\n end", "def show\n @order.update_attribute(:seen, true) unless @order.seen\n @line_items = @order.line_items.includes(:product)\n end", "def show\n @line_item = LineItem.new\n AssetTag.reindex\n @order_select = Order.where.not(finalized: true)\n end", "def remove_all_menu_type_line_items vendor_id\n # Remove all menu items where we are dealing with this vendor\n destroy_line_items(line_items.where(:payable_party_id => vendor_id, :line_item_sub_type => \"Menu-Item\", :payable_party_type => 'Vendor'))\n destroy_line_items(line_items.where(:billable_party_id => vendor_id, :line_item_sub_type => \"Menu-Item\", :billable_party_type => 'Vendor'))\n destroy_line_items(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id)})\n \n destroy_line_items(line_items.where(:payable_party_id => vendor_id, :line_item_sub_type => \"Menu-Fee\", :payable_party_type => 'Vendor'))\n destroy_line_items(line_items.where(:billable_party_id => vendor_id, :line_item_sub_type => \"Menu-Fee\", :billable_party_type => 'Vendor'))\n destroy_line_items(line_items.select{|li| (!li.menu_template.nil? && li.menu_template.vendor_id == vendor_id)})\n end", "def list_inviting_agent_and_property\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n #if true\n @current_user = Vendor.find(533)\n vendor_id = @current_user.id\n invited_vendors = InvitedVendor.where(email: @current_user.email, source: Vendor::INVITED_FROM_CONST[:family]).select([:agent_id, :udprn])\n udprns = invited_vendors.map(&:udprn)\n bulk_details = PropertyService.bulk_details(udprns)\n response = []\n\n bulk_details.each_with_index do |detail, index|\n detail[:address] = PropertyDetails.address(detail)\n response_hash = {}\n response_hash[:udprn] = detail[:udprn]\n response_hash[:address] = detail[:address]\n agent_fields = [:agent_id, :assigned_agent_first_name, :assigned_agent_last_name, :assigned_agent_email, :assigned_agent_mobile,\n :assigned_agent_office_number, :assigned_agent_image_url, :assigned_agent_branch_name, :assigned_agent_branch_number,\n :assigned_agent_branch_address, :assigned_agent_branch_website, :assigned_agent_branch_logo]\n property_attrs = [:beds, :baths, :receptions, :property_type, :property_status_type ]\n agent_fields.each {|field| response_hash[field] = detail[field] }\n property_attrs.each {|field| response_hash[field] = detail[field] }\n response.push(response_hash)\n end\n\n render json: response, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end", "def create_line_items_from_menu_template event_vendor\n if !event_vendor.menu_template.nil?\n\n # If menu-level pricing, create the \"per-person\" line item, based on the initial participation\n if (event_vendor.menu_template.pricing_type == MenuPricingType.menu_level)\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end\n\n # Create line items for each inventory item, but only if there is no grouping configured\n if !event_vendor.menu_template.menu_template_grouped && !event_vendor.menu_template.all_items\n event_vendor.menu_template.inventory_items.each do |item|\n line_items.push(create_line_item_from_inventory_item(item, 0, event_vendor.vendor, account, false, false, \"\"))\n end\n end\n end\n end", "def get_unshipped_orders\n @orders = Order.by_state('paid').find(:all, :conditions => ['downloaded_at IS NULL'], :include => [:line_items])\n \n respond_to do |format| \n #format.html\n format.xml\n end\n \n end", "def index\n @line_items = current_member.line_items.where(\"order_id IS NULL\")\n end", "def lines\n invoice_lines\n end", "def process_event_vendor event_vendor\n # Copy the menu-discount-levels from the menu template to the event vendor container\n event_vendor.copy_menu_level_discounts_from_menu_template\n\n # Create line items for the menu items. A La Carte menus should not get line items here.\n if event_vendor.pricing_type == MenuPricingType.menu_level\n create_line_items_from_menu_template(event_vendor)\n end\n end", "def vendors_that_sell(query_item)\n @vendors.find_all do |vendor|\n vendor.inventory.keys.include?(query_item)\n end\n end", "def has_line_item?\n true\n end", "def show\n @line_items = @order.line_items\n end", "def print_item_header\n return keys\n end", "def test_OH_lines\n data = 'OS Tomato black ring virus (strain E) (TBRV).\nOC Viruses; ssRNA positive-strand viruses, no DNA stage; Comoviridae;\nOC Nepovirus; Subgroup B.\nOX NCBI_TaxID=12277;\nOH NCBI_TaxID=4681; Allium porrum (Leek).\nOH NCBI_TaxID=4045; Apium graveolens (Celery).\nOH NCBI_TaxID=161934; Beta vulgaris (Sugar beet).\nOH NCBI_TaxID=38871; Fraxinus (ash trees).\nOH NCBI_TaxID=4236; Lactuca sativa (Garden lettuce).\nOH NCBI_TaxID=4081; Lycopersicon esculentum (Tomato).\nOH NCBI_TaxID=39639; Narcissus pseudonarcissus (Daffodil).\nOH NCBI_TaxID=3885; Phaseolus vulgaris (Kidney bean) (French bean).\nOH NCBI_TaxID=35938; Robinia pseudoacacia (Black locust).\nOH NCBI_TaxID=23216; Rubus (bramble).\nOH NCBI_TaxID=4113; Solanum tuberosum (Potato).\nOH NCBI_TaxID=13305; Tulipa.\nOH NCBI_TaxID=3603; Vitis.'\n\n res = [{'NCBI_TaxID' => '4681', 'HostName' => 'Allium porrum (Leek)'},\n {'NCBI_TaxID' => '4045', 'HostName' => 'Apium graveolens (Celery)'},\n {'NCBI_TaxID' => '161934', 'HostName' => 'Beta vulgaris (Sugar beet)'},\n {'NCBI_TaxID' => '38871', 'HostName' => 'Fraxinus (ash trees)'},\n {'NCBI_TaxID' => '4236', 'HostName' => 'Lactuca sativa (Garden lettuce)'},\n {'NCBI_TaxID' => '4081', 'HostName' => 'Lycopersicon esculentum (Tomato)'},\n {'NCBI_TaxID' => '39639', 'HostName' => 'Narcissus pseudonarcissus (Daffodil)'},\n {'NCBI_TaxID' => '3885', \n 'HostName' => 'Phaseolus vulgaris (Kidney bean) (French bean)'},\n {'NCBI_TaxID' => '35938', 'HostName' => 'Robinia pseudoacacia (Black locust)'},\n {'NCBI_TaxID' => '23216', 'HostName' => 'Rubus (bramble)'},\n {'NCBI_TaxID' => '4113', 'HostName' => 'Solanum tuberosum (Potato)'},\n {'NCBI_TaxID' => '13305', 'HostName' => 'Tulipa'},\n {'NCBI_TaxID' => '3603', 'HostName' => 'Vitis'}]\n sp = SPTR.new(data)\n assert_equal(res, sp.oh)\n end", "def candidate_items\n sku_items.select {|i| i.paid_quantity > 0}\n end", "def show\n @line_items = @list.line_items.includes(:item)\n\n my_items = current_user.items.order(name: :asc)\n other_items = Item.where(\"user_id <> ? OR user_id IS NULL\", current_user.id).order(name: :asc)\n @items = my_items | other_items\n end", "def order_receipt(items)\r\n for item in items\r\n item.receipt\r\n end\r\n end", "def remove_all_menu_type_line_items vendor_id\n # Remove all menu items where we are dealing with this vendor\n line_items.destroy(line_items.where(:payable_party_id => vendor_id, :line_item_sub_type => \"Menu-Item\", :payable_party_type => 'Vendor'))\n line_items.destroy(line_items.where(:billable_party_id => vendor_id, :line_item_sub_type => \"Menu-Item\", :billable_party_type => 'Vendor'))\n line_items.destroy(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id)})\n \n line_items.destroy(line_items.where(:payable_party_id => vendor_id, :line_item_sub_type => \"Menu-Fee\", :payable_party_type => 'Vendor'))\n line_items.destroy(line_items.where(:billable_party_id => vendor_id, :line_item_sub_type => \"Menu-Fee\", :billable_party_type => 'Vendor'))\n line_items.destroy(line_items.select{|li| (!li.menu_template.nil? && li.menu_template.vendor_id == vendor_id)})\n end", "def sellers\n line_items.map { |lineitem| lineitem.item.user.id }.uniq\n end", "def index\n \t@orders = Order.order('id desc')\n \t#since line items belong to orders, we don't have to do anything to specify line items\n end", "def items\n @items ||= line_items.to_a\n end", "def list_items(list_items, object_index: nil)\n list = []\n list_items.each do |item|\n next unless include_item_or_section?(item[:when], item[:is], item[:is_not], object_index: object_index)\n\n list << ItemData.new(self, item)\n end\n list\n end", "def getAssociatedObjects\n Item_objects = ObjectSpace.each_object(Item).to_a\n puts Item_objects\n item_ordered = Array.new\n Item_objects.each do |x| \n # if arr[x].order_id == @order_id\n # item_ordered = arr[x]\n # end\n # item_ordered\n puts Item_objects[x]\n end\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 @invoice_addon_line_items = InvoiceAddonLineItem.all\n end", "def object_to_line_items(object)\n return object.line_items if object.is_a?(Spree::Order)\n return object.send(:order).line_items if object.respond_to?(:order)\n nil\n end", "def check_promotions\n line_items.each do |item|\n Spree::ItemAdjustments.new(item).calculate_promo_total\n end\n end", "def proper_items\n items.where.not(sort: ['self', 'pdf_destination'])\n .where.not(start_time: nil)\n end", "def fetch_produce_items\r\n all_items = read_table('SRCFILE')\r\n included_ids = File.readlines(File.join('data', 'included.txt')).map(&:chomp)\r\n\r\n @items = all_items.select do |i|\r\n included_ids.include?(i.id)\r\n end\r\nend", "def index\n @sub1_line_items = Sub1LineItem.all\n end", "def products\n vendor_ids = vendors.collect { |vendor| vendor.vendor_id}\n CSV.read(PRODUCT_CSV).collect do |line|\n FarMar::Product.new(line) if vendor_ids.include? line[2].to_i\n end\n end", "def products\n collection = []\n\n all_products = FarMar::Product.all\n all_products.each do |product|\n if product.vendor_id == self.id\n collection.push(product)\n end\n end\n\n return collection\n end", "def line_items_by_variant_id\n @line_items_by_variant_id ||= line_items.group_by(&:variant_id)\n end", "def items\n return [] if self[:item_display].blank? && self[:item_display_struct].blank?\n\n @items ||= self[:item_display_struct]&.map do |item_display|\n Holdings::Item.new(item_display, document: self)\n end&.sort_by(&:full_shelfkey)\n\n # legacy implementation until everything that needs it has a item_display_struct\n @items ||= self[:item_display]&.map do |item_display|\n Holdings::Item.from_item_display_string(item_display, document: self)\n end&.sort_by(&:full_shelfkey)\n\n @items ||= []\n end", "def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_sells << product_to_check\n end#of if\n end#of do\n return products_this_vendor_sells\n end", "def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end", "def find_matching_line_item(other_order_line_item)\n order.line_items.detect do |my_li|\n my_li.variant == other_order_line_item.variant &&\n order.line_item_comparison_hooks.all? do |hook|\n order.send(hook, my_li, other_order_line_item.serializable_hash)\n end\n end\n end", "def vendor\n @header.vendor\n end", "def invoice_items_grouped_by_item(invoice_items)\n FinderClass.group_by(invoice_items, :item_id)\n end", "def info_for_csv_lines\n # FIXME: Decode from XML; encode for CSV\n\n # FIXME: Note this condition in the XML file doco\n if ITEM_STATUS_OK.any?{|k,v| @item[k]!=v}\t# Omit\n STDERR.puts \"INFO: Item is withdrawn, hidden or incomplete; not writing to CSV\"\n return []\n end\n\n if DEBUG\n STDERR.puts \"@attrs[:bitstream]=#{@attrs[:bitstream].inspect}\"\n STDERR.puts \"licence: #{@misc[:itemlicence]}\"\n STDERR.puts \"publisher_elsevier: #{@misc[:publisher_elsevier]}\"\n STDERR.puts \"grant_info: #{@misc[:grant_info].inspect}\"\n STDERR.puts \"num_total=#{@misc[:num_total]}; num_deleted=#{@misc[:num_deleted]}; num_undeleted=#{@misc[:num_undeleted]}\"\n end\n\n csv_lines = []\n if @misc[:num_undeleted] == 0\t# No (undeleted) bitstreams for this item\n csv_lines << (csv_line_part1 + [\n @misc[:num_undeleted],\n @misc[:num_deleted],\n\n \"\",\n \"\",\n \"\",\n \"\",\n ] + csv_line_part3)\n\n else\t\t\t# One or more (undeleted) bitstreams for this item\n @attrs[:bitstream].each{|bs|\n next unless bs[:deleted] == \"false\"\n csv_lines << csv_line_part1 + [\n @misc[:num_undeleted],\n @misc[:num_deleted],\n\n bs[:fname],\n bs[:docversion],\n bs[:doclicence_draft],\n bs[:doclicence],\n bs[:deleted],\n ] + csv_line_part3\n }\n end\n STDERR.puts \"csv_lines:#{csv_lines.inspect}\" if DEBUG\n csv_lines\n end", "def include_line_items?\n scope && scope[:include_line_items]\n end", "def _line_items(order)\n params.require(:orders).each do |variant_id, info|\n count = info.require(:count)\n price = info.require(:price)\n variant = Variant.find variant_id\n LineItem.create(variant_id: variant_id, order: order, quantity: count,\n price: price).ready_to_pay!\n end\n end", "def supplies_including_tax\n self.supplies.select{|p| p[:including_tax]}\n end", "def cpes_affected\n vendor_data = @entry.dig('cve', 'affects', 'vendor', 'vendor_data') || []\n vendor_data.map do |vendor_data_entry|\n vendor_name = vendor_data_entry['vendor_name']\n vendor_data_entry\n .fetch('product', {})\n .fetch('product_data', [])\n .map {|product_data_entry| \"#{vendor_name}:#{product_data_entry['product_name']}\"}\n end.flatten.uniq\n end", "def has_line_items?\n line_items.any?\n end", "def has_batch_products_included?\n result=false\n invoice_line_items.each do |line_item|\n result=true if !line_item.product.blank? && line_item.product.batch_enable? && !line_item.marked_for_destruction?\n end\n result\n end", "def canon_products items\n\titems.select do |item|\n\t\titem['product']['brand'].downcase == 'canon'\n\tend\nend", "def render_items(items)\n @list.items = case @footer.filters.selected.value\n when :active\n items.reject { |item| item[:done] }\n when :completed\n items.select { |item| item[:done] }\n else\n items\n end.sort_by { |item| item[:text] }\n end", "def create_xero_line_items(lines)\n lines.map do |(account, country, tax_rate), amounts|\n xero_tax_rate = find_or_create_tax_rate(country, tax_rate)\n\n if xero_tax_rate.nil?\n raise Error, \"Could not determine tax rate for #{country} (#{tax_rate})\"\n end\n\n {\n 'Description' => @proposal.invoice_line_description(account, country, tax_rate),\n 'Quantity' => 1,\n 'AccountCode' => account,\n 'TaxAmount' => amounts[:tax],\n 'LineAmount' => amounts[:amount],\n 'TaxType' => xero_tax_rate,\n 'Tracking' => tracking_options\n }\n end\n end", "def index\n @line_property_items = LinePropertyItem.all\n end", "def report_print_items\n $report_file.puts print_line\n $report_file.puts print_date\n $report_file.puts print_title\n $report_file.puts print_line\n $report_file.puts print_header\n $report_file.puts print_line\n items.each_with_index do |item, index_no|\n $report_file.puts item.print_item_details(index_no)\n end\n $report_file.puts print_line\n end", "def get_items\n @fdata.scan(SUB_ITEM_REGEXP)\n end", "def line_item(item)\n {\n Name: item.product.name,\n Number: item.variant.sku,\n Quantity: item.quantity,\n Amount: {\n currencyID: item.order.currency,\n value: item.price\n },\n ItemCategory: 'Physical'\n }\n end", "def _products_header\n\n\t$report_file.puts \" _ _ \"\n\t$report_file.puts \" | | | | \"\n\t$report_file.puts \" _ __ _ __ ___ __| |_ _ ___| |_ ___ \"\n\t$report_file.puts \"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\"\n\t$report_file.puts \"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\"\n\t$report_file.puts \"| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\"\n\t$report_file.puts \"| | \"\n\t$report_file.puts \"|_| \"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend", "def process_event_vendor event_vendor\n\n # Copy the menu-discount-levels from the menu template to the event vendor container\n event_vendor.copy_menu_level_discounts_from_menu_template\n\n # Create line items for the menu items\n create_line_items_from_menu_template(event_vendor)\n end", "def other_products_purchased(purchased_item, other_line_items)\n similar_products = []\n other_products = []\n\n # extract an array of all the other purchase order ids minus this purchase order\n # that had a line item for the same purchased_item\n other_purchase_order_ids = other_line_items.collect{|line_item| line_item.purchase_order_id if line_item.purchase_order_id != self.id}.flatten.compact.uniq\n if other_purchase_order_ids.present?\n other_purchase_orders = PurchaseOrder.find other_purchase_order_ids\n\n # now extract all the other products purchased\n other_purchase_orders.each do |po|\n other_line_item_products = po.line_items.collect{|line_item| line_item.stuffed_animal_id.present? ? ((line_item.stuffed_animal_id != purchased_item.id) ? line_item.stuffed_animal : nil) : ((line_item.accessory_id != purchased_item.id) ? line_item.accessory : nil)}.flatten.compact\n other_products += other_line_item_products\n end\n end\n\n return other_products\n end", "def delivered_products\n @delivered_products ||= begin\n products = order['OrderDetails']['OrderRows']\n products.each do |ol|\n if ol['OrderRowId'].to_s == line_id.to_s\n ol['QuantityToDeliver'] = quantity\n ol['PackageId'] = track_and_trace_reference\n end\n\n if ol['ProductId'] == 'Postage'\n ol['QuantityToDeliver'] = 1\n ol['PackageId'] = track_and_trace_reference\n end\n end\n products.collect do |pr|\n pr.slice 'OrderRowId', 'QuantityToDeliver', 'PackageId'\n end\n end\n end", "def products\n FarMar::Product.all.select { |product| product.vendor_id == id }\n end", "def index\n @invoice_items = @invoice.invoice_items\n end", "def generate_header_item(item)\n item\n end", "def index\n @vendor_item_types = VendorItemType.all\n end", "def parse_item_info(condensed,items,notes_by_mid,sumh_by_mid,grouped,bibid,response,over_locs,orders_by_mid)\n\t items_by_mid = {}\n\t if false\n\t # needed this when condensed was organized by library name.\n\t # now it is keyed by holding id.\n\t # condensed by holding id (mid ), to find which condensed entry contains a particular mid\n\t # value at the index is a library 'displayname'.\n\t condn_by_mid = {}\n\t condensed.each_key do |lk|\n\t ##Rails.logger.debug \"\\nes287_debug condensed key lk = #{lk}\"\n\t condensed[lk][\"holding_id\"].each do |hk|\n\t\tcondn_by_mid[hk] = lk\n\t end\n\t end\n\t end\n\t #condn_by_mid = create_dn_by_mid(bibid,response)\n\t ###Rails.logger.debug \"\\nes287_debug line:(#{__LINE__})items this condn by mid = \"+ condn_by_mid.inspect\n\t # TODO -- there may be notes on a holding record,\n\t # but no items attached to that holding. if that is true, this does not work.\n\t # need to detect this condition, and correct for that.\n\t # example bound withs, like 531286, or RMC things with no item records\n\t items.each do |iinfo|\n\t hk = iinfo['mfhd_id']\n\t curi = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"current_issues\"].nil?)\n\t curi = condensed[hk][\"current_issues\"]\n\t end\n\t indx = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"indexes\"].blank?)\n\t indx = condensed[hk][\"indexes\"]\n\t end\n\t supl = \"\"\n\t supl1 = \"\"\n\t supl2 = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"supplements\"].blank?)\n\t supl1 = condensed[hk][\"supplements\"]\n\t end\n\t if (!condensed[hk].nil? && !condensed[hk][\"supplemental_holdings_desc\"].blank?)\n\t supl2 = condensed[hk][\"supplemental_holdings_desc\"]\n\t end\n\t if (!supl1.blank? || !supl2.blank?)\n\t supl = \"Supplements: \" +supl1+supl2\n\t end\n\t items_by_mid[hk] = {\"items\"=> {}, \"notes\"=>notes_by_mid[hk], \"summary_holdings\"=>sumh_by_mid[hk],\n\t\t\"current_issues\"=>curi,\"supplements\" => supl , \"indexes\"=> indx }\n\t end\n\t # insert item info into correct place into condensed array\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:#{__LINE__} items_by_mid = #{items_by_mid.inspect}\"\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:#{__LINE__} condensed = #{condensed.inspect}\"\n\t items_by_mid.each_key do |hk|\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:(#{__LINE__}) hk = #{hk}\"\n\t next if hk.nil?\n\t next if items_by_mid[hk].nil?\n\t next if condensed[hk].nil?\n\t #condensed[condn_by_mid[hk]][\"copies\"] << items_by_mid[hk]\n\t condensed[hk][\"copies\"] << items_by_mid[hk]\n\t if !over_locs[hk].blank?\n\t\t##Rails.logger.debug \"\\nes287_debug line:(#{__LINE__}) over_locs[hk] = #{over_locs[hk]}\"\n\t\t#condensed[condn_by_mid[hk]][\"copies\"][0][\"temp_locations\"] = over_locs[hk]\n\t\tcondensed[hk][\"copies\"][0][\"temp_locations\"] = over_locs[hk]\n\t end\n\t condensed[hk][\"copies\"][0][\"items\"] = grouped[hk][\"items\"] unless grouped[hk].nil?\n\t end\n\t condensed.each_key do |hk|\n\t ##Rails.logger.debug \"\\nes287_debug line:(#{__LINE__}) hk = #{hk}\"\n\t if condensed[hk.to_s][\"copies\"].blank?\n\t\t#condensed[hk.to_s][\"copies\"] = [{\"items\" =>{} ,\"orders\" => [] } ]\n\t\tcondensed[hk.to_s][\"copies\"] =\n\t\t [{\"items\"=>{\"Not Available\"=>{\"status\"=>\"none\", \"count\"=>0}}, \"notes\"=>nil, \"summary_holdings\"=>nil,\"orders\" => nil}]\n\t end\n\t condensed[hk.to_s][\"copies\"][0][\"orders\"] = orders_by_mid[hk.to_s] unless orders_by_mid[hk.to_s].blank?\n\t end\n\t condensed\n\t end", "def order_items_for_status(status)\n self.sold_items.select { |item| item.order.status == status.downcase }\n end", "def cost_splitting\n @shipments = Shipment.all.paginate(page: params[:page], per_page: 1)\n @order = Order.all.paginate(page: params[:page], per_page: 1)\n @file_info = FileInformation.all.paginate(page: params[:page], per_page: 1)\n\n \n@shipments.each do |s|\n unless s.shared != false\n @file_info.each do |f|\n @order.each do |o|\n puts \"o.product\"\n end\n end\n end\nend\n\n\nend", "def line_items\n @line_items ||= self.send(self.class.line_items_table_name)\n end", "def products\n FarMar::Product.by_vendor(self.id)\n end", "def show\n\n @client = Client.find(@invoice.client_id)\n @total_items = Item.where(invoice_id: @invoice.id).sum(:total_value_sale)\n @lucro_total = Item.where(invoice_id: @invoice.id).sum(:profit_sale)\n @products = Product.order(:name)\n\n end", "def get_items_with dish\n @menu_items.select {|item| item.has? dish}\n end", "def index\n @vendor_fulfillments = @order.vendor_fulfillments\n end", "def line_items\n @line_items ||= self.send(self.class.line_items_table_name)\n end", "def line_items\n @line_items ||= self.send(self.class.line_items_table_name)\n end", "def lines_to_tryton\n result = []\n \n # Build lines\n result.concat(items_to_tryton) if booking_lines.size > 0\n\n # Build extras\n result.concat(extras_to_tryton) if booking_extras.size > 0\n\n return result\n end" ]
[ "0.6084435", "0.5931355", "0.58267266", "0.56693834", "0.5661872", "0.56595933", "0.5624584", "0.5621584", "0.5589917", "0.5576402", "0.5571669", "0.55144733", "0.54868376", "0.5481903", "0.5469212", "0.5452932", "0.54120755", "0.5409425", "0.5391925", "0.53228915", "0.5265905", "0.52548397", "0.524045", "0.5235294", "0.52199787", "0.5217854", "0.5175772", "0.51688594", "0.5168626", "0.51605964", "0.5159077", "0.5155147", "0.5153702", "0.5150444", "0.51462346", "0.51435024", "0.5136131", "0.51352173", "0.51297796", "0.5122768", "0.51163155", "0.5114558", "0.510317", "0.50988156", "0.50796026", "0.5067427", "0.5067242", "0.50662667", "0.50629824", "0.5052716", "0.50500685", "0.503007", "0.50260055", "0.5015491", "0.50148755", "0.5012414", "0.50099945", "0.49996784", "0.49934718", "0.49927258", "0.4991046", "0.49889782", "0.49860525", "0.4949785", "0.4936369", "0.49356094", "0.49269336", "0.49254054", "0.4919961", "0.49175075", "0.49088985", "0.49064574", "0.49056476", "0.49028292", "0.4901691", "0.48999974", "0.48874107", "0.48872104", "0.48857808", "0.48838535", "0.48780647", "0.48696238", "0.48691836", "0.48670778", "0.4859377", "0.48511013", "0.48503876", "0.48488268", "0.4848611", "0.48428342", "0.48411486", "0.4836337", "0.4831528", "0.48314038", "0.48277193", "0.48237076", "0.48194975", "0.48179537", "0.48179537", "0.48151708" ]
0.6458787
0
All so line items which have a sales order written to them (customer only) used for listing all customer items.
def so_items # so_items = self.so_headers.joins(:so_lines).select("so_lines.item_id").where("so_headers.organization_id = ?",self.id).order("so_lines.created_at DESC") so_items = SoLine.includes(:so_header).where('so_headers.organization_id = ?', id).order('so_headers.created_at DESC') so_items = so_items.collect(& :item_id) Item.where(id: so_items) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_items_for_customer(customer_id)\n ret_line_items = []\n my_line_items = delivery_details.find_all_by_customer_id(customer_id)\n my_line_items.each do |my_line_item|\n my_line_item.order_items.each do |order|\n if order.quantity > 0\n ret_line_items.push(order) unless ret_line_items.include? order\n end\n end\n end\n return ret_line_items\n end", "def customers; (line_items.map(&:customer).flatten.compact.uniq rescue []); end", "def index\n @customer_order_items = CustomerOrderItem.all\n end", "def my_sales\n @order_items = Effective::OrderItem.deep.sold_by(current_user)\n EffectiveOrders.authorized?(self, :index, Effective::Order.new(user: current_user))\n end", "def index\n if current_customer.admin?\n @ordered_items = OrderedItem.all\n else\n @ordered_items = OrderedItem.all.where(:customer_id => current_customer.id)\n end\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 index\r\n @sales_orders = @customer.sales_orders\r\n end", "def filter_order_items(merchant)\n self.orderitems.to_a.select { |orderitem| orderitem.product.merchant == merchant}\n end", "def sales\n sales_this_vendor_made = []\n sales_to_check = FarMar::Sale.all\n sales_to_check.each do |sale_to_check|\n if self.id == sale_to_check.vendor_id\n sales_this_vendor_made << sale_to_check\n end#of if\n end#of do\n return sales_this_vendor_made\n end", "def all\n @customer_objects\n end", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def index\n @line_items = current_member.line_items.where(\"order_id IS NULL\")\n end", "def buyer_orders \n if current_user && current_user.seller\n @items_info = find_buyers_orders.sort_by { |k| item_is_shipped(k[3],k[0].id) ? 1 : 0 }\n else\n redirect_to signin_path\n end\n end", "def fulfilled_line_items\n return self.order_line_items.where(:status => 'shipped').all\n end", "def items_on_sale\r\n sale = Array.new\r\n\r\n if(self.items.size > 0)\r\n self.items.each {|val|\r\n if (val.is_active )\r\n sale.push(val)\r\n end\r\n }\r\n end\r\n\r\n return sale\r\n end", "def index\n @quote_items = QuoteItem.where(order_id: current_customer.order_id)\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\n end", "def sales\n collection = []\n\n all_sales = FarMar::Sale.all\n all_sales.each do |sale|\n if sale.vendor_id == self.id\n collection.push(sale)\n end\n end\n\n return collection\n end", "def sellers\n line_items.map { |lineitem| lineitem.item.user.id }.uniq\n end", "def unfulfilled_line_items\n return self.order_line_items.where('status != ?', 'shipped').all\n end", "def sold_orders\n @orders = current_user.sold_orders\n end", "def sold_orders\n @orders = current_user.sold_orders\n end", "def line_items\n Spree::LineItem\n .joins(order: [:order_cycle, :customer])\n .for_order_cycle(order_cycle)\n .where(\"spree_orders.state = 'complete'\")\n .group(\n 'customers.id, ' \\\n 'spree_line_items.variant_id, ' \\\n 'spree_line_items.order_id, ' \\\n 'spree_line_items.quantity'\n )\n .select([:variant_id, :order_id, :quantity])\n end", "def service_provider_line_items(service_provider, items)\n service_provider_items = []\n items.map(&:sub_service_request_id).each do |ssr|\n if service_provider.identity.is_service_provider?(SubServiceRequest.find(ssr))\n service_provider_items << SubServiceRequest.find(ssr).line_items\n end\n end\n service_provider_items.flatten.uniq\n end", "def show\n @purchased_items = @sales_order.purchased_items\n end", "def meals\n Meal.all.select {|m| m.customer == self}\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def sales\n FarMar::Sale.all.find_all { |sale| sale.product_id == @id }\n end", "def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end", "def my_purchases\n @orders = Effective::Order.deep.purchased_by(current_user)\n EffectiveOrders.authorized?(self, :index, Effective::Order.new(user: current_user))\n end", "def index\n @sales_items = SalesItem.all\n end", "def show\n @order.update_attribute(:seen, true) unless @order.seen\n @line_items = @order.line_items.includes(:product)\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def meals\r\n Meal.all.select do |meal|\r\n meal.customer == self\r\n end\r\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 wholesale_order_list\n @orders = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: params[\"place_order_on\"])\n @list_of_event_ids = @orders.uniq.pluck(:event_id)\n list_of_product_ids = []\n list_of_product_types = []\n for each_id in @list_of_event_ids \n for designed_product in DesignedProduct.where(event_id: each_id)\n list_of_product_ids << designed_product.product_id\n list_of_product_types << designed_product.product.product_type\n end\n end\n @list_of_product_ids = list_of_product_ids.uniq\n @list_of_product_types = list_of_product_types.uniq.sort\n render(:wholesale_order_list) and return\n end", "def index\n @items = @sale.items\n end", "def index\n @order_lines = current_user.orders.includes(:order_lines).where(closed: false).first.try(:order_lines) || []\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 meals\n Meal.all.select do |meal|\n meal.customer == self\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 sales\n sales = []\n FarMar::Sale.all.each do |i|\n if i.product_id == self.id\n sales << i\n end\n end\n return sales\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 customers_with_unpaid_invoices\n unpaid_invoices = find_unpaid_invoices\n unpaid_customers = unpaid_invoices.map do |inv|\n @engine.customers.find_by_id(inv.customer_id)\n end.uniq\n end", "def sales\n @orders = Order.where(seller: current_user.id).order(\"created_at DESC\")\n end", "def customer\n @@all.select {|review| self.restaurant.customers}\n end", "def show\n @line_items = @list.line_items.includes(:item)\n\n my_items = current_user.items.order(name: :asc)\n other_items = Item.where(\"user_id <> ? OR user_id IS NULL\", current_user.id).order(name: :asc)\n @items = my_items | other_items\n end", "def existing_clients\n @sales.where(new_client: false)\n end", "def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end", "def show\n @location = Consumable.all\n @line_item = LineItem.new\n @order_select = Order.where.not(finalized: true)\n logger.info @order_select\n @user = User.all\n end", "def sales\n @orders = Order.all.where(seller: current_user).order(\"created_at DESC\")\n end", "def detail_products\n @sale_id = params[:id]\n customer_id = Sale.where(id: @sale_id)\n customer_id = customer_id.pluck(:customer_id)\n customers = Customer.where(id: customer_id[0].to_i)\n customers.each do |c|\n @customer = c.name\n @document = c.document\n end\n @products_sale = Item.where(sale_id: @sale_id)\n\n end", "def add_line_items_from_cart(cart)\n companies = []\n cart.line_items.each do |item|\n if !companies.include?(item.product.company.name)\n companies << item.product.company.name\n end\n end\n puts \"INSPECIONANDO ARRAY DE COMPANIES\"\n puts companies.inspect\n companies.each do |company|\n cart.line_items.each do |item|\n if item.product.company.name == company\n \n line_items << item\n end\n end\n end\n puts \"INspecionando o line_items\"\n puts line_items.inspect\n line_items\n end", "def sales_invoices\n invoices.joins(:invoice_lines)\n .having(\"SUM(spina_shop_invoice_lines.quantity * spina_shop_invoice_lines.unit_price - spina_shop_invoice_lines.discount) >= 0\")\n .group(\"spina_shop_invoices.id\")\n end", "def sales\n Sale.find_all_by_vendor_id(@id)\n end", "def checkout \n \t@order_items = current_order.order_items\n end", "def index\n @shop_customers = ShopCustomer.all\n end", "def index\n \t@orders = Order.order('id desc')\n \t#since line items belong to orders, we don't have to do anything to specify line items\n end", "def meals\n Meal.all.select do |meal|\n meal.customer == self\n end\n end", "def index\n @sales_orders = SalesOrder.all\n end", "def sales\n FarMar::Sale.all.find_all { |sale| sale.product_id == id }\n end", "def index\n @productsonsales = Productsonsale.all\n @line_item_products = LineItemProduct.all\n end", "def show\n @line_items = @order.line_items\n end", "def index\n @store_order_items = StoreOrderItem.all\n end", "def my_orders\n @orders = current_user.orders.all\n end", "def line_items_strict\n\t\tline_items.select do |x| \n\t\t\tinventory_units\n\t\t\t\t.uniq { |y| y.variant_id }\n\t\t\t\t.map { |z| z.variant_id }\n\t\t\t\t.include?(x.variant_id)\n\t\tend\n\tend", "def show\n @customer_set = CustomerSet.find(params[:id])\n @customers = @customer_set.get_customers(current_user)\n @other_sets = @customer_set.get_all_but_existing\n end", "def sales\n FarMar::Sale.all.select { |sale| sale.product_info == product_id }\n end", "def index\n @customers = Customer.where(:warehouse_id=>current_user.parent_id)\n end", "def index\n @order_items = @purchasable.order_items.where(channel_id: current_user.profile.selected_channel_id).where(order_id: nil)\n end", "def index\n @orders = Order.where(buyer: current_user)\n end", "def sales\n FarMar::Sale.all.find_all {|instance| instance.product_id == id}\n end", "def receipt_items\n returning = []\n sales_tax = 0.0\n total = 0.0\n @shopping_cart.each do |line_item|\n sales_tax = sales_tax + line_item.tax\n total = total + line_item.price_with_tax\n returning << \"#{line_item.count} #{line_item.description}: %.2f\" % line_item.price_with_tax\n end\n returning << \"Sales Taxes: %.2f\" % sales_tax\n returning << \"Total: %.2f\" % total\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 index\n @orders = @restaurant.orders.where(state: Order::PRE_DELIVERED_STATES).includes(:order_items, :items)\n end", "def show\n\n @client = Client.find(@invoice.client_id)\n @total_items = Item.where(invoice_id: @invoice.id).sum(:total_value_sale)\n @lucro_total = Item.where(invoice_id: @invoice.id).sum(:profit_sale)\n @products = Product.order(:name)\n\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 customer_filter\n customers = current_user.company.resources.map { |r| r.customer }\n customers = customers.compact.uniq.sort_by { |c| c.name.downcase }\n\n return filter_for(:customer_id, objects_to_names_and_ids(customers),\n session[:resource_filters], _(\"Customer\"))\n end", "def items\n self.purchases.map { |purchase| purchase.item }\n\n # items = []\n # purchases.each do |purchase|\n # items << purchase.item\n # end\n # items\n end", "def index\n search_order_per_customer()\n end", "def my_account\n @orders = current_customer.orders.includes(:product).in_order || []\n end", "def scan_serials_for_item( item_id )\r\n self.sales_lines.each do |line|\r\n \r\n # Skip to next unless the item id is matched and serial number is not blank\r\n # TODO:\r\n # Recognize changes of this serial number (RETURNED / CANCELED / BACKORDER / NONE)\r\n next unless (line.item_id == item_id) && (line.sales_item_reservation_number?)\r\n \r\n ERP::SerialNumber.find_or_create(\r\n :account_num => self.customer.account_num,\r\n :item_id => item_id,\r\n :sales_id => self.sales_id,\r\n :serial => line.sales_item_reservation_number\r\n )\r\n end\r\n end", "def index\n storeid = User.find(current_user).stores\n @orders = Order.all.where(store: storeid, svis: true)\n end", "def line_items_for_compute(order, options={})\n if calculable.is_a?(Spree::Promotion)\n line_items = if calculable.product\n order.line_items.joins(:variant).where(:variants => {product_id: calculable.product})\n elsif calculable.store\n order.line_items.where(:store_id => calculable.store)\n else\n order.line_items\n end\n \n if self.is_a?(Spree::Calculator::FreeShipping)\n puts \"free shipping\"\n line_items\n else\n puts \"not free shipping\"\n line_items.order('spree_line_items.price DESC').not_on_sale\n end\n else\n puts \"all line items\"\n order.line_items\n end\n end", "def meals\n Meal.all.select {|meal| meal.customer == self}\n end", "def meals\n Meal.all.select {|meal| meal.customer == self}\n end", "def unpaid_line_items\n @unpaid_line_items ||= line_items.find_all_by_paid(false)\n end", "def purchases\n # Our .select method on the line below does all the work of the 6 lines with the .each method\n # But remember that either way works just fine\n Purchase.all.select { |purchase| purchase.user == self }\n\n # purchases = []\n # Purchase.all.each do |purchase|\n # if purchase.user == self\n # purchases << purchase\n # end\n # end\n end", "def index\n @sub_accounts = Customer.where(:invited_by_id => current_customer.id)\n end", "def get_sku_sales(sku_item)\n total_sales = []\n sku_values = @rows.values_at(\"sku\").flatten\n amount_values = @rows.values_at(\"amount\").flatten\n sku_values.each_with_index do |item, index|\n if item == sku_item\n # dumbest mistake\n #total_sales << @rows.values_at(\"amount\").flatten[index]\n total_sales << amount_values[index]\n end\n end\n total_sales\n end", "def checkout\n line_items = LineItem.all\n\n @order = Order.create(user_id: current_user.id, subtotal: 0)\n\n line_items.each do |l_item|\n l_item.product.update(quantity: (l_item.product.quantity - l_item.quantity))\n @order.order_items[l_item.product_id] = l_item.quantity\n @order.subtotal += l_item.line_item_total\n end\n @order.save\n\n @order.update(sales_tax: (@order.subtotal * 0.08))\n @order.update(grand_total: (@order.sales_tax + @order.subtotal))\n\n line_items.destroy_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 index\n @customer_invoices = CustomerInvoice.all\n end", "def list\n # 1. Ask the repo to bring all customers #all\n customers = @customer_repo.all\n # 2. Pass the customers to the view to display them\n @customer_view.display_all(customers)\n end", "def build_customer_list\n @customer = []\n customer = []\n tempcustomer = []\n calllist = Calllist.all\n calllist.each do |c|\n if c.custcode && !tempcustomer.include?(c.custcode)\n tempcustomer.push(c.custcode)\n end\n end\n\n customer = tempcustomer.sort\n if !session[:called_customer] || session[:called_customer == '']\n # session customer not set\n session[:called_customer] = customer[0]\n end\n\n i = 1\n @selected_customer = 0\n customer.each do |c|\n select_item = []\n select_item.push(c)\n select_item.push(i)\n @customer.push(select_item)\n if c == session[:called_customer]\n @selected_customer = i\n end\n i += 1\n end\n $calllist_customers = @customer\n\n @customer_calllists = []\n calllist.each do |c|\n if c.custcode\n if c.custcode == session[:called_customer]\n # include call list records that are a direct match for customer\n @customer_calllists.push(c)\n end\n end\n end\n end", "def show\n @usr = current_user\n @count = @order.count_line_items\n @line_items = @order.line_items\n @total_price = @order.total_price\n end", "def items_seller(limit = 5)\n customer.items.all(conditions: \"id <> #{id}\", limit: limit)\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def index\n\t\t@line_items = LineItem.where(user_id: current_user)\n\n\t\t@user_items = @line_items\n\t\t\t.map { |x| p [Product.find(x.product_id), x.quantity, x] }.group_by { |x| x[0] }\n\t\t\t.reduce( {} ) { |h, x| h.merge!({ x[0] => [ x[1].map { |y| y[1] }.sum, x[1].map(&:last) ] }) }\n\tend", "def payment_items\n\t\t\t\t\treturn self.order_items\n\t\t\t\tend" ]
[ "0.7205433", "0.6967645", "0.6655303", "0.665461", "0.6585721", "0.6155085", "0.61244994", "0.6099178", "0.60833853", "0.6036001", "0.6015484", "0.59267426", "0.58904976", "0.5876737", "0.58697903", "0.5864558", "0.5862323", "0.5862323", "0.5818309", "0.57806844", "0.5765275", "0.5765275", "0.5758304", "0.5736821", "0.57263803", "0.56908095", "0.5678895", "0.5678479", "0.56588924", "0.5658547", "0.5646253", "0.56435776", "0.563375", "0.56315774", "0.5628716", "0.5617262", "0.5614747", "0.5603161", "0.5583589", "0.55788225", "0.55656034", "0.55634856", "0.55629766", "0.5557679", "0.55542535", "0.55479753", "0.5544554", "0.55309325", "0.55149853", "0.55121416", "0.549328", "0.5485586", "0.5485256", "0.54818016", "0.54726696", "0.5471759", "0.5458743", "0.5455621", "0.54541177", "0.54521537", "0.5451632", "0.5450864", "0.5448868", "0.5448599", "0.5444251", "0.5439224", "0.54240435", "0.54218256", "0.5420743", "0.5410636", "0.5405623", "0.54043436", "0.5392014", "0.53866225", "0.5384502", "0.5381509", "0.53795254", "0.5379352", "0.5375573", "0.5366812", "0.5360736", "0.53578043", "0.535421", "0.53533757", "0.5351313", "0.5351313", "0.53469133", "0.5322877", "0.53201", "0.5319608", "0.53180915", "0.531476", "0.53144413", "0.5314334", "0.53137493", "0.531154", "0.53106904", "0.53086567", "0.53006583", "0.5299239" ]
0.5643551
32