query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions.
|
def set_rest
@rest = Rest.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 rest_params
params.require(:rest).permit(:name, :address, :description, :owner, :phone)
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
|
Unescape character escapes such as "\n" to their character equivalents.
|
def unescape(value)
return nil if value.nil?
regex = /\\(?:([nevfbart\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
value.gsub(regex) do
if Regexp.last_match(3)
[Regexp.last_match(3).to_s.hex].pack('U*')
elsif Regexp.last_match(2)
[Regexp.last_match(2)].pack('H2')
else
UNESCAPES[Regexp.last_match(1)]
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unescape(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\,/, \",\").gsub(/\\\\[Nn]/, \"\\n\").\n tr(\"\\u007f\", \"\\\\\")\n end",
"def unescape( value )\n return value unless @escape\n\n value = value.to_s\n value.gsub!(%r/\\\\[0nrt\\\\]/) { |char|\n case char\n when '\\0'; \"\\0\"\n when '\\n'; \"\\n\"\n when '\\r'; \"\\r\"\n when '\\t'; \"\\t\"\n when '\\\\\\\\'; \"\\\\\"\n end\n }\n value\n end",
"def unescape_component(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\;/, \";\").gsub(/\\\\,/, \",\").\n gsub(/\\\\[Nn]/, \"\\n\").tr(\"\\u007f\", \"\\\\\")\n end",
"def unescape(string)\n string.is_a?(String) ? string.gsub(/\\n|\\r/, \"\") : string\n end",
"def unescape(escaped_string)\n escaped_string.\n gsub(/\\$\\$|\\$'|\\$L|\\$P|\\$R|\\$P|\\$T/i) do |match|\n case match\n when \"$$\"\n \"$\"\n when \"$'\"\n \"'\"\n when \"$L\", \"$l\"\n \"\\n\"\n when \"$R\", \"$r\"\n \"\\r\"\n when \"$T\", \"$t\"\n \"\\t\"\n when \"$P\", \"$p\"\n \"\\f\"\n end\n end\n end",
"def unescape(str)\n # Escape all the things\n str.gsub(/\\\\(?:([#{UNESCAPES.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\' then '\\\\' else UNESCAPES[$1] end\n elsif $2 # escape \\u0000 unicode\n [\"#$2\".hex].pack('U*')\n elsif $3 # escape \\0xff or \\xff\n [$3].pack('H2')\n end\n }\n end",
"def unescape_value(value)\n value = value.to_s\n value.gsub!(%r{\\\\[0nrt\\\\]}) do |char|\n case char\n when '\\0' then \"\\0\"\n when '\\n' then \"\\n\"\n when '\\r' then \"\\r\"\n when '\\t' then \"\\t\"\n when '\\\\\\\\' then '\\\\'\n end\n end\n value\n end",
"def unescape(string)\n \"\\\"#{string}\\\"\".undump\n end",
"def strip_and_unescape(value)\n value.strip\n .gsub(/^\\^\"(.*)\\^\"$/, '\\1')\n .gsub(/^\"(.*)\"$/, '\\1')\n .gsub(/\\^([\\\\\"&%^<>|])/, '\\1')\n .gsub(/\\\\\\\\/, '\\\\')\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n enc = str.encoding\n enc = Encoding::UTF_8 if enc == Encoding::US_ASCII\n str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }\n end",
"def unescape_newlines(content)\n content.gsub('\\n', \"\\n\")\n end",
"def unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def parse_escaped_chars; end",
"def unescape(val)\n\tval.gsub!(/(\\\\x[\\da-f]{2}|\\\\u[\\da-f]{4})/) { [$1[2..-1].hex].pack('U') }\n\tval\nend",
"def strip_except_escapes(string)\n rstrip_except_escapes(string.lstrip)\n end",
"def sanitize_escape_sequences(msg)\n msg = msg.gsub(\"\\r\", \"[CR]\")\n msg = msg.gsub(\"\\n\", \"[LF]\")\n msg = msg.gsub(/\\e\\[A/, '[CUU]')\n msg = msg.gsub(/\\e\\[B/, '[CUD]')\n msg = msg.gsub(/\\e\\[2K/, '[CLEAR]')\n msg = msg.gsub(/#{3.chr}/, '[ETX]')\n msg = msg.gsub(/#{4.chr}/, '[EOT]')\n msg = msg.gsub(/#{7.chr}/, '[BELL]')\n msg = msg.gsub(/#{8.chr}/, '[BS]')\n msg = msg.gsub(/#{9.chr}/, '[TAB]')\n msg = msg.gsub(/#{24.chr}/, '[CAN]')\n msg = msg.gsub(/#{27.chr}/, '[ESC]')\n msg = msg.gsub(/#{127.chr}/, '[DEL]')\n msg\n end",
"def purify\n #self.gsub!(\"\\u0000\", '').delete!('\\\\0').squeeze!('\\\\').tr!('\\\\','/').delete_at(length-1)\n self.gsub!(/(?:\\u0000)(.+)/,'')\n self.gsub!('\\\\n', 10.chr)\n self\n end",
"def rstrip_except_escapes(string)\n string.sub(/(?<!\\\\)\\s+$/, '')\n end",
"def normalize(data)\n data.gsub(/\\r/, '')\n end",
"def normalize(data)\n data.gsub(/\\r/, '')\n end",
"def unescape_special_chars( str )\n\t\t\tEscapeTable.each {|char, hash|\n\t\t\t\t@log.debug \"Unescaping escaped %p with %p\" % [ char, hash[:md5re] ]\n\t\t\t\tstr.gsub!( hash[:md5re], hash[:unescape] )\n\t\t\t}\n\n\t\t\treturn str\n\t\tend",
"def unescape(s)\n s.to_s.gsub(/%2[Bb]/, \"+\")\n end",
"def unescape(input)\n CGI.unescapeHTML(input) rescue input\n end",
"def clean_input(text)\n text.gsub(/\\r/, '') rescue text\n end",
"def strip_bad_chars(text)\n text.gsub!(/\"/, \"'\");\n text.gsub!(/\\u2018/, \"'\");\n text.gsub!(/[”“]/, '\"');\n text.gsub!(/’/, \"'\");\n return text\nend",
"def clean(str)\n str = str[1...(str.length - 1)] if literal\n escaped = false\n cleaned = ''\n (0...str.length).each do |i|\n c = str[i]\n if escaped\n cleaned += c\n escaped = false\n elsif c == '\\\\'\n escaped = true\n else\n cleaned += c\n end\n end\n cleaned\n end",
"def decode_escape(input)\n c = input.look_ahead(1)\n case c\n when \"a\" : result = \"\\a\"\n when \"b\" : result = \"\\b\"\n when \"f\" : result = \"\\f\"\n when \"n\" : result = \"\\n\"\n when \"r\" : result = \"\\r\"\n when \"t\" : result = \"\\t\"\n when \"v\" : result = \"\\v\"\n when \"\\\\\" : result = \"\\\\\"\n when /[01234567]/ : raise \"Escaped octal Unicode not supported\"\n when \"x\" : raise \"Escaped hex Unicode not supported\"\n when \"u\" : raise \"Escaped Unicode not supported\"\n else\n result = c\n end\n input.consume 2\n return result\n end",
"def dequote(in_string)\n in_string.gsub(/[$,\"\\\\\\n]/) {|x| \"\\\\\"+x}\n end",
"def strip_unprintable_characters(s)\n s.tr(8204.chr, \"\")\nend",
"def unescape( src )\n String.class_eval(%Q(\"#{src}\"))\nend",
"def unescape_all(value)\n return nil if value.nil?\n value = unescape(value).gsub(/\\\\(.)/) { Regexp.last_match(1) }\n value\n end",
"def unescape(str)\n str.to_s.gsub(/%(..)/) { Regexp.last_match(1).hex.chr }\n end",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def unescape_js(js_string)\n # js encodes double quotes and line breaks.\n unescaped= js_string.gsub('\\\"', '\"')\n unescaped.gsub!('\\\\\\'', \"'\")\n unescaped.gsub!(/\\\\\\//, '/')\n unescaped.gsub!('\\n', \"\\n\")\n unescaped.gsub!('\\076', '>')\n unescaped.gsub!('\\074', '<')\n # js encodes non-ascii characters.\n unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}\n unescaped\n end",
"def unescape_string_if_needed(str)\n\t# unsafe characters - see above for complete list\n\tunsafeCharacters = [0x200c, 0x200d]\n\t# let's convert our string into array (to preserve proper unicode numbers)\n\tstr_array=str.unpack(\"U*\")\n\t# set this to false until the first replacement takes place\n\treplacement_done = false\n\n\t# loop over all unsafe character and try to replace all occurencies\n\tunsafeCharacters.each do |c|\n\t\t# find the first occurence of that character\n\t\ti = str_array.index(c)\n\t\twhile i != nil\n\t\t\t# replaces a single character with '%uXXXX', where XXXX is hex code of character\n\t\t\t# this only works with non-math characters, but it should not happen that any bigger number would occur\n\t\t\tstr_array[i,1] = sprintf(\"%%u%4X\", c).unpack(\"U*\")\n\t\t\ti = str_array.index(c)\n\t\t\treplacement_done = true\n\t\tend\n\tend\n\n\t# convert the array back to string\n\tstr = str_array.pack(\"U*\")\n\n\tif replacement_done\n\t\treturn \"unescape('#{str}')\"\n\telse\n\t\treturn \"'#{str}'\"\n\tend\nend",
"def unescape\n bytes = escaped_path_to_bytes(path)\n str = bytes.pack('C*')\n str.force_encoding(Encoding::UTF_8)\n end",
"def unescape(str)\n str = str.force_encoding(\"UTF-8\") if str.respond_to?(:force_encoding)\n str = str.gsub(/&#(\\d{3});/) { [$1.to_i].pack(\"U\") }\n CGI.unescapeHTML(str)\n end",
"def unnormalize(code)\n code = code.gsub(/<text:line-break\\/>/, \"\\n\")\n code = code.gsub(/<text:tab\\/>/, \"\\t\")\n return REXML::Text.unnormalize(code)\n end",
"def uninspect(str)\n return nil unless str\n str.gsub(%r!\\\\([\\\\#\"abefnrstvx]|u\\d{4}|u\\{[^\\}]+\\}|\\d{1,3}|x\\d{1,2}|cx|C-[a-zA-Z]|M-[a-zA-Z]| |=|:)!) do |m|\n repl = \"\"\n if ['\\\\', '#', '\"'].include?($1)\n repl = $1\n else\n repl = eval(\"\\\"\\\\#{$1}\\\"\")\n end\n repl\n end\n end",
"def decode_json_scrp\n self\n .gsub('\\u0022', '\"')\n .gsub('\\u00E0', \"à\")\n .gsub('\\u00E2', \"â\")\n .gsub('\\u00E8', \"è\")\n .gsub('\\u00E9', \"é\")\n .gsub('\\u00E7', \"ç\")\n .gsub('\\u00F9', \"ù\")\n .gsub('\\u0026', \"&\")\n .gsub('\\u20AC', \"€\")\n .gsub('\\u0027', \"'\")\n .gsub('\\u00A0', \"\")\n .gsub('\\u00C8', \"È\")\n .gsub('\\u00B2', \"²\")\n .gsub('\\u00C9', \"É\")\n .gsub('\\\\\"', '\"')\n end",
"def unquote(string)\n if string =~ /^\"/\n string.gsub!(/^\"|\"$/, '').gsub(/\\\\\"/, '\"')\n else\n string\n end\n end",
"def unfold(string)\n string.gsub(\"\\n \", \"\")\n end",
"def remove_unwanted_chars(data)\n\n data = data.gsub(\"\\r\\n\", ' ')\n data = data.gsub(\"\\t\", ' ')\n data = data.gsub(\"\\n\", ' ')\n\n data.strip\n end",
"def unescape(string,encoding=@@accept_charset)\n str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|\n [m.delete('%')].pack('H*')\n end.force_encoding(encoding)\n str.valid_encoding? ? str : str.force_encoding(string.encoding)\n end",
"def unnormalize(code)\n code = code.gsub(/<text:line-break\\/>/, \"\\n\")\n code = code.gsub(/<text:tab\\/>/, \"\\t\")\n code = code.gsub(/<text:s(\\/|(\\s[^>]*))>/, \" \")\n return REXML::Text.unnormalize(code)\n end",
"def unescape(html)\n CGI.unescapeHTML(html)\n end",
"def clean_text(text)\n text.gsub!(/\\r\\n/, '')\n text.gsub!(/\\r/, '')\n text\n end",
"def deslash( str )\n str.gsub( '\\\\\"', '\"' ).gsub( \"\\\\\\\\\", \"\\\\\" )\n end",
"def unescapeHTML(string)\n str = string.dup\n str.gsub!(/&(.*?);/n) {\n match = $1.dup\n case match\n when /\\Aamp\\z/ni then '&'\n when /\\Aquot\\z/ni then '\"'\n when /\\Agt\\z/ni then '>'\n when /\\Alt\\z/ni then '<'\n when /\\A#(\\d+)\\z/n then Integer($1).chr\n when /\\A#x([0-9a-f]+)\\z/ni then $1.hex.chr\n end\n }\n str\nend",
"def strip_control_characters_and_excesses(string)\n last = string.split(\"\\033[2;0f\").last#.gsub(/(\\e\\[\\d+\\w)|(\\e\\[\\w)/,\"\")\n if last.empty?\n \"\"\n else\n last.gsub(/(\\e\\[\\d+\\w)|(\\e\\[\\w)/,\"\").gsub(\" +\",\"\")\n end\nend",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end",
"def consume_escaped; end",
"def preprocess(input)\n input = input.to_s.encode('UTF-8',\n :invalid => :replace,\n :undef => :replace)\n\n input.gsub!(/(?:\\r\\n|[\\r\\f])/, \"\\n\")\n input.gsub!(\"\\u0000\", \"\\ufffd\")\n input\n end",
"def preprocess(input)\n input = input.to_s.encode('UTF-8',\n :invalid => :replace,\n :undef => :replace)\n\n input.gsub!(/(?:\\r\\n|[\\r\\f])/, \"\\n\")\n input.gsub!(\"\\u0000\", \"\\ufffd\")\n input\n end",
"def remove_characters\n @data = @data.gsub(/\\n/, ' ').gsub(/\\f/, ' ').gsub(/\\s+/, ' ')\n @data = @data.split(' ')\n end",
"def convert_escape_characters(*args, &block)\n maatsf_convert_escape_characters(super(*args, &block))\n end",
"def decode_slash(string)\n string.gsub('_slash_', '/')\n end",
"def decode_slash(string)\n string.gsub('_slash_', '/')\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def convert_escape_characters(text)\n result = rm_extender_convert_escape_characters(text).to_s.clone\n result.gsub!(/\\eL\\[\\:(\\w+)\\]/i) { L[$1.to_sym] }\n result.gsub!(/\\eSL\\[\\:(\\w+)\\]/i) { SL[$game_message.call_event, $1.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_i, $3.to_sym] }\n result.gsub!(/\\eSV\\[([^\\]]+)\\]/i) do\n numbers = $1.extract_numbers\n array = [*numbers]\n if numbers.length == 1\n array = [$game_message.call_event] + array\n end\n SV[*array]\n end\n return result\n end",
"def do_encoding_terminal(string)\n string = string.to_s\n string.gsub!(\"\\r\\r\", \"\\r\")\n string.gsub!(\"\\r\\n\", \"\\n\")\n string.gsub!(\"\\r\\$\\s\", \"\")\n\n string.gsub!(/.\\r/, \"\")\n string.gsub!(/\\x1B\\[\\d*?[ABCDsuKJ]/, '')\n string\n end",
"def unescapeHTML(string)\n\tstr = string.dup\n\tstr.gsub!(/&(.*?);/n) {\n\t\tmatch = $1.dup\n\t\tcase match\n\t\t\twhen /\\Aamp\\z/ni then '&'\n\t\t\twhen /\\Aquot\\z/ni then '\"'\n\t\t\twhen /\\Agt\\z/ni then '>'\n\t\t\twhen /\\Alt\\z/ni then '<'\n\t\t\twhen /\\A#(\\d+)\\z/n then Integer($1).chr\n\t\t\twhen /\\A#x([09af]+)\\\n\t\t\tz/ni then $1.hex.chr\n\t\tend\n\t\t}\n\tstr\nend",
"def unescape_rjs(rjs_string)\n # RJS encodes double quotes and line breaks.\n unescaped= rjs_string.gsub('\\\"', '\"')\n unescaped.gsub!(/\\\\\\//, '/')\n unescaped.gsub!('\\n', \"\\n\")\n unescaped.gsub!('\\076', '>')\n unescaped.gsub!('\\074', '<')\n # RJS encodes non-ascii characters.\n unescaped.gsub!(RJS_PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}\n unescaped\n end",
"def unicode_esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 309:9: '\\\\\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT\n match( 0x5c )\n match( 0x75 )\n hex_digit!\n hex_digit!\n hex_digit!\n hex_digit!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end",
"def unescapeJson(jsonObj)\n temp = JSON.generate(jsonObj)\n temp.gsub! '\\\\\\\\', '\\\\'\n return temp\n end",
"def remove_weird_characters(content)\n content.force_encoding('utf-8').gsub //, ''\n end",
"def unescape_hash( hash )\n hash.each_pair {\n |k, v|\n hash[k] = unescape( hash[k] ) if hash[k].is_a?( String )\n hash[k] = unescape_hash( v ) if v.is_a? Hash\n }\n\n return hash\n end",
"def fix_bad_characters(text)\n return \"\" if text.nil?\n \n # get the text into UTF-8 and get rid of invalid characters\n text = text.encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :replace => \"\")\n \n text.gsub! \"<3\", \"<3\"\n\n # convert carriage returns to newlines\n text.gsub!(/\\r\\n?/, \"\\n\")\n \n # replace curlyquotes\n # note: turns out not to be necessary?\n # text.gsub! \"\\xE2\\x80\\x98\", \"'\"\n # text.gsub! \"\\xE2\\x80\\x99\", \"'\"\n # text.gsub! \"\\xE2\\x80\\x9C\", '\"'\n # text.gsub! \"\\xE2\\x80\\x9D\", '\"'\n \n # argh, get rid of ____spacer____ inserts\n text.gsub! \"____spacer____\", \"\"\n \n # trash a whole bunch of crappy non-printing format characters stuck \n # in most commonly by MS Word\n text.gsub!(/\\p{Cf}/u, '')\n\n return text\n end",
"def decode(str)\n str.gsub(/\\\\\\(/, '(').gsub(/\\\\\\)/, ')')\n end",
"def fix_double_escape(escaped)\n escaped.gsub(/&([a-z]+|(#\\d+));/i) { \"&#{$1};\" }\n end",
"def unescape(str)\n # URI.unescape is obsolete\n DEFAULT_PARSER.unescape(str)\n end",
"def clean_string(string)\n string = string.gsub(/\\r|\\n/,'').sub(/^ */,'').sub(/\\s*$/,'').gsub(/ +/,' ')\n coder = HTMLEntities.new()\n string = coder.decode(string) # Remove html entities\n return string\n end",
"def parse_escaped_chars\n @src.pos += @src.matched_size\n add_text(@src[1])\n end",
"def untrailingslashit(string)\n string.gsub(/[\\/\\\\]+$/, '')\n end",
"def unescape_raw_response\n Addressable::URI.form_unencode(@raw_response)\n end",
"def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of the characters in the list of characters to be escaped\n $eChars.each do |thisChar|\n #Replace every instance of thisChar with thisChar appended to an\n #escape character. We have to escape the escape to use it\n inString = inString.gsub(thisChar, \"\\\\\"+thisChar)\n end\n return inString\nend",
"def unformat(line)\n return line.gsub(/.\\010/, '')\nend",
"def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end",
"def decode_quoted_printable!\n self.replace(self.decode_quoted_printable)\n end",
"def unansi(string = T.unsafe(nil)); end",
"def unansi(string = T.unsafe(nil)); end",
"def extract_text(text)\n text\n .gsub(/(?:\\e|\\033)\\[\\d+(?>(;\\d+)*)m/, \"\")\n .gsub(/\\\\\\[|\\\\\\]/, \"\")\n .gsub(/\\007|\\016|\\017/, \"\")\n end",
"def convert_slashes(path)\n path.gsub('/', '\\\\').gsub('\\\\', '\\\\\\\\\\\\\\\\') #eek\n end",
"def e_sh(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').gsub(/\\n/, \"'\\n'\").sub(/^$/, \"''\")\nend",
"def unescape(string)\n result = CGI.unescapeHTML(string)\n result.gsub!(/!-(.*?)-!/, '\\1')\n return result\n end",
"def unwrap_text(text)\n text.gsub(/([^\\n])\\n([^\\n])/, '\\1 \\2')\n end",
"def unix2dos(string)\n string.gsub(\"\\r\", \"\").gsub(\"\\n\", \"\\r\\n\")\n end",
"def url_unescape(s)\n #Added this to make cadaver work\n s = s.gsub(\"%28\", \"(\").gsub(\"%29\", \")\")\n URI.unescape(s)\n end",
"def unescape_html(str)\n str.gsub(/&(.*?);/n) do\n match = $1.dup\n case match\n when /\\Aamp\\z/ni then '&'\n when /\\Aquot\\z/ni then '\"'\n when /\\Agt\\z/ni then '>'\n when /\\Alt\\z/ni then '<'\n when /\\A#0*(\\d+)\\z/n then\n if Integer($1) < 256\n Integer($1).chr\n else\n if Integer($1) < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)\n [Integer($1)].pack(\"U\")\n else\n \"&##{$1};\"\n end\n end\n when /\\A#x([0-9a-f]+)\\z/ni then\n if $1.hex < 256\n $1.hex.chr\n else\n if $1.hex < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)\n [$1.hex].pack(\"U\")\n else\n \"&#x#{$1};\"\n end\n end\n else\n \"&#{match};\"\n end\n end\n end",
"def escape_str(str)\n str.gsub!(/[`\\\\]/, '\\\\\\\\\\&')\n str.gsub!(/\\r\\n/, \"\\\\r\\r\\n\") if @newline == \"\\r\\n\"\n return str\n end",
"def unansi(string)\n string.gsub(PATTERN, '')\n end",
"def unescape(s)\n YAML.load(%Q(---\\n\"#{s}\"\\n))\nend",
"def clear_utf_symbols(string)\n string.gsub(/[»«]/, '')\n end",
"def remove_control_chars(src, dest)\n inpath = File.expand_path(src)\n outpath = File.expand_path(dest)\n `cat #{inpath} | tr -d \"\\\\000-\\\\010\\\\013\\\\014\\\\016-\\\\037\" > #{outpath}`\n end",
"def unescape(s)\n s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) {\n [$1.delete('%')].pack('H*')\n }\n end",
"def escape_shell_special_chars(string)\n string.gsub(/([ ()])/, '\\\\\\\\\\1')\n end"
] |
[
"0.7542144",
"0.74841934",
"0.73203593",
"0.7089947",
"0.6895988",
"0.68688786",
"0.68088126",
"0.67174447",
"0.67139125",
"0.6576543",
"0.65458935",
"0.64962906",
"0.64219904",
"0.63760304",
"0.6365335",
"0.6240339",
"0.62335473",
"0.62074596",
"0.61736524",
"0.61627674",
"0.61627674",
"0.61589766",
"0.6140955",
"0.6046081",
"0.6013829",
"0.5983748",
"0.59646153",
"0.59505576",
"0.5935436",
"0.5933986",
"0.59199613",
"0.5912544",
"0.58989716",
"0.5885502",
"0.5885502",
"0.5885502",
"0.5876618",
"0.5796258",
"0.57946",
"0.57711506",
"0.57497936",
"0.57245076",
"0.57099295",
"0.56923115",
"0.5660911",
"0.5656915",
"0.5654035",
"0.56493396",
"0.56378454",
"0.5626113",
"0.5623843",
"0.5618621",
"0.5611563",
"0.5593978",
"0.5593501",
"0.5584074",
"0.5584074",
"0.5581413",
"0.557356",
"0.5568492",
"0.5568492",
"0.556714",
"0.55628085",
"0.5554576",
"0.55503356",
"0.55352896",
"0.5534386",
"0.5505327",
"0.54927015",
"0.54844874",
"0.5481642",
"0.54789853",
"0.54759264",
"0.5459527",
"0.5431202",
"0.5411254",
"0.540304",
"0.5396401",
"0.53960997",
"0.5386968",
"0.53706455",
"0.53348285",
"0.5330034",
"0.5322769",
"0.5322769",
"0.5314314",
"0.53091884",
"0.5308144",
"0.5301386",
"0.529643",
"0.5292087",
"0.5291208",
"0.52814376",
"0.5273335",
"0.52724314",
"0.5270971",
"0.5255517",
"0.5254241",
"0.524745",
"0.5247308"
] |
0.5966075
|
26
|
Unescape as above, and also convert all occurrences of \$char to $char
|
def unescape_all(value)
return nil if value.nil?
value = unescape(value).gsub(/\\(.)/) { Regexp.last_match(1) }
value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_escaped_chars; end",
"def unescape(escaped_string)\n escaped_string.\n gsub(/\\$\\$|\\$'|\\$L|\\$P|\\$R|\\$P|\\$T/i) do |match|\n case match\n when \"$$\"\n \"$\"\n when \"$'\"\n \"'\"\n when \"$L\", \"$l\"\n \"\\n\"\n when \"$R\", \"$r\"\n \"\\r\"\n when \"$T\", \"$t\"\n \"\\t\"\n when \"$P\", \"$p\"\n \"\\f\"\n end\n end\n end",
"def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of the characters in the list of characters to be escaped\n $eChars.each do |thisChar|\n #Replace every instance of thisChar with thisChar appended to an\n #escape character. We have to escape the escape to use it\n inString = inString.gsub(thisChar, \"\\\\\"+thisChar)\n end\n return inString\nend",
"def unescape( value )\n return value unless @escape\n\n value = value.to_s\n value.gsub!(%r/\\\\[0nrt\\\\]/) { |char|\n case char\n when '\\0'; \"\\0\"\n when '\\n'; \"\\n\"\n when '\\r'; \"\\r\"\n when '\\t'; \"\\t\"\n when '\\\\\\\\'; \"\\\\\"\n end\n }\n value\n end",
"def convert_escape_characters(*args, &block)\n maatsf_convert_escape_characters(super(*args, &block))\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)\n end",
"def character_escape(string)\n string.gsub(/^'/, '').gsub(/'$/, '').gsub(/\\\\'/, \"'\")\n end",
"def unescape_component(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\;/, \";\").gsub(/\\\\,/, \",\").\n gsub(/\\\\[Nn]/, \"\\n\").tr(\"\\u007f\", \"\\\\\")\n end",
"def decode_escape(input)\n c = input.look_ahead(1)\n case c\n when \"a\" : result = \"\\a\"\n when \"b\" : result = \"\\b\"\n when \"f\" : result = \"\\f\"\n when \"n\" : result = \"\\n\"\n when \"r\" : result = \"\\r\"\n when \"t\" : result = \"\\t\"\n when \"v\" : result = \"\\v\"\n when \"\\\\\" : result = \"\\\\\"\n when /[01234567]/ : raise \"Escaped octal Unicode not supported\"\n when \"x\" : raise \"Escaped hex Unicode not supported\"\n when \"u\" : raise \"Escaped Unicode not supported\"\n else\n result = c\n end\n input.consume 2\n return result\n end",
"def parse_escaped_chars\n @src.pos += @src.matched_size\n add_text(@src[1])\n end",
"def escaped_char(escape)\n if escape =~ /^\\\\([0-9a-fA-F]{1,6})[ \\t\\r\\n\\f]?/\n $1.to_i(16).chr(Encoding::UTF_8)\n else\n escape[1]\n end\n end",
"def unescape(str)\n # Escape all the things\n str.gsub(/\\\\(?:([#{UNESCAPES.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\' then '\\\\' else UNESCAPES[$1] end\n elsif $2 # escape \\u0000 unicode\n [\"#$2\".hex].pack('U*')\n elsif $3 # escape \\0xff or \\xff\n [$3].pack('H2')\n end\n }\n end",
"def consume_escaped; end",
"def unescape(string)\n \"\\\"#{string}\\\"\".undump\n end",
"def escape(str); end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n enc = str.encoding\n enc = Encoding::UTF_8 if enc == Encoding::US_ASCII\n str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }\n end",
"def escape_characters(string)\n ['&','-','?','|','!',\"'\",'+'].each do |syn_char|\n string = string.gsub(syn_char,'\\\\\\\\' + \"#{syn_char}\")\n end\n return string\n end",
"def unescape(s)\n s.to_s.gsub(/%2[Bb]/, \"+\")\n end",
"def unescape(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\,/, \",\").gsub(/\\\\[Nn]/, \"\\n\").\n tr(\"\\u007f\", \"\\\\\")\n end",
"def unescape_special_chars( str )\n\t\t\tEscapeTable.each {|char, hash|\n\t\t\t\t@log.debug \"Unescaping escaped %p with %p\" % [ char, hash[:md5re] ]\n\t\t\t\tstr.gsub!( hash[:md5re], hash[:unescape] )\n\t\t\t}\n\n\t\t\treturn str\n\t\tend",
"def fix_double_escape(escaped)\n escaped.gsub(/&([a-z]+|(#\\d+));/i) { \"&#{$1};\" }\n end",
"def escape(input); input.to_s.gsub('\"', '\\\\\"'); end",
"def escape(string); end",
"def escape_shell_special_chars(string)\n string.gsub(/([ ()])/, '\\\\\\\\\\1')\n end",
"def shell_escape(string)\n return string.gsub(/\\\\/, \"\\\\\\\\\\\\\").gsub(/\\\"/, \"\\\\\\\"\").gsub(/\\$/, \"\\\\\\$\").gsub(/\\`/, \"\\\\\\\\\\`\")\n end",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end",
"def unescape_value(value)\n value = value.to_s\n value.gsub!(%r{\\\\[0nrt\\\\]}) do |char|\n case char\n when '\\0' then \"\\0\"\n when '\\n' then \"\\n\"\n when '\\r' then \"\\r\"\n when '\\t' then \"\\t\"\n when '\\\\\\\\' then '\\\\'\n end\n end\n value\n end",
"def unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def handle_escape_character(key)\n return @@escape_characters[key]\n end",
"def clean(str)\n str = str[1...(str.length - 1)] if literal\n escaped = false\n cleaned = ''\n (0...str.length).each do |i|\n c = str[i]\n if escaped\n cleaned += c\n escaped = false\n elsif c == '\\\\'\n escaped = true\n else\n cleaned += c\n end\n end\n cleaned\n end",
"def unicode_esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 309:9: '\\\\\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT\n match( 0x5c )\n match( 0x75 )\n hex_digit!\n hex_digit!\n hex_digit!\n hex_digit!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end",
"def escape_special_chars(data)\n data = data.dup\n data.gsub! /&/n , \"&\"\n data.gsub! /\\\"/n , \""\"\n data.gsub! />/n , \">\"\n data.gsub! /</n , \"<\"\n data.gsub! /'/ , \"'\"\n return data\n end",
"def decode_char(input)\n input.mark\n first = input.next\n # check first char\n if first.nil?\n input.reset\n return nil\n end\n # if it isnt escape return nil\n if first != @escape_char\n input.reset\n return nil\n end\n # get teh escape value\n return input.next\n end",
"def unescape_string_if_needed(str)\n\t# unsafe characters - see above for complete list\n\tunsafeCharacters = [0x200c, 0x200d]\n\t# let's convert our string into array (to preserve proper unicode numbers)\n\tstr_array=str.unpack(\"U*\")\n\t# set this to false until the first replacement takes place\n\treplacement_done = false\n\n\t# loop over all unsafe character and try to replace all occurencies\n\tunsafeCharacters.each do |c|\n\t\t# find the first occurence of that character\n\t\ti = str_array.index(c)\n\t\twhile i != nil\n\t\t\t# replaces a single character with '%uXXXX', where XXXX is hex code of character\n\t\t\t# this only works with non-math characters, but it should not happen that any bigger number would occur\n\t\t\tstr_array[i,1] = sprintf(\"%%u%4X\", c).unpack(\"U*\")\n\t\t\ti = str_array.index(c)\n\t\t\treplacement_done = true\n\t\tend\n\tend\n\n\t# convert the array back to string\n\tstr = str_array.pack(\"U*\")\n\n\tif replacement_done\n\t\treturn \"unescape('#{str}')\"\n\telse\n\t\treturn \"'#{str}'\"\n\tend\nend",
"def escape_single_quotes(str_to_escape)\n # Hash containing the required conversion\n conversions = {\n %r{'}=>'%26apos;'\n } \n escaped_str = str_to_escape\n conversions.each do |x,y|\n escaped_str = escaped_str.gsub(x,y)\n end \n return escaped_str\n end",
"def unescape( src )\n String.class_eval(%Q(\"#{src}\"))\nend",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def shell_escape\n inspect.gsub(/\\\\(\\d{3})/) { $1.to_i(8).chr }\n end",
"def deslash( str )\n str.gsub( '\\\\\"', '\"' ).gsub( \"\\\\\\\\\", \"\\\\\" )\n end",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def cleanup(str)\n return str.gsub(/([ &])/, '\\\\\\\\\\1')\nend",
"def escape_double_quotes(str_to_escape)\n # Hash containing the required conversion\n conversions = {\n %r{\"}=>'"'\n } \n escaped_str = str_to_escape\n conversions.each do |x,y|\n escaped_str = escaped_str.gsub(x,y)\n end \n return escaped_str\n end",
"def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end",
"def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def escape_shell_string(str)\n str = str.gsub(/\\\\/, \"\\\\\\\\\\\\\")\n str = str.gsub(/\"/, \"\\\\\\\"\")\n str = str.gsub(/`/, \"\\\\`\")\n str = str.gsub(/;/, \"\\\\;\")\n str = str.gsub(/&/, \"\\\\&\")\n str = str.gsub(/\\|/, \"\\\\|\")\n str = str.gsub(/\\$/, \"\\\\$\")\n str = str.gsub(/ /, \"\\\\ \")\n str\n end",
"def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end",
"def escape input, regexp, map\n input.gsub(regexp) { | char | map[char] || char }\n end",
"def escape(str)\n str.dump[1..-2]\nend",
"def lex_en_interp_backslash_delimited; end",
"def lex_en_interp_backslash_delimited; end",
"def lex_en_interp_backslash_delimited; end",
"def escape_for_double_quotes(str)\n str.gsub(/[\\\\\"`$]/) { |c| \"\\\\#{c}\" }\nend",
"def escape(s)\n s.gsub('\"', '\\\"')\nend",
"def latex_escape(s)\n quote_count = 0\n s.to_s.\n gsub(/([{}_$&%#])/, \"__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__/, BS).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/\"/) do\n quote_count += 1\n quote_count.odd? ? %{\"`} : %{\"'}\n end\n end",
"def sanitize_char(str)\n str = str.to_s\n src = Sanscript.detect(str) || :iast\n str = Sanscript.transliterate(str, src, :kh)\n str.gsub!(/\\s/, \"_\")\n str.tr!(\"'\", \"`\")\n str.strip!\n str\n end",
"def escape_latex string\n string.to_s.gsub(/[$\\\\{}_%#&~^\"]/) do |s|\n case s\n when '$'\n '\\$'\n when '\\\\'\n '\\synbs{}'\n when /[{}_%#&]/\n \"\\\\#{s}\"\n when /[~^]/\n \"\\\\#{s}{}\"\n when '\"'\n '\"{}'\n end\n end\n end",
"def unescape(str)\n str.to_s.gsub(/%(..)/) { Regexp.last_match(1).hex.chr }\n end",
"def set_escaped(options={})\n self.split(//).map do |ch|\n res = ch.escaped\n res = \"\\\\x#{'%02X' % ch.ord}\" if options[:no_ctrl] && res=~/^\\\\\\w$/\n res.gsub(\"-\",'\\\\-')\n end.join\n end",
"def latex_escape(source)\n source.chars.inject('') do |s, b|\n s << if b == '\\\\'\n '~'\n elsif SAFE_CHARS.include? b\n b\n else\n \"\\\\char%d\" % b[0].ord\n end\n end\n end",
"def sanitize_like(string, escape_character = \"\\\\\")\n pattern = Regexp.union(escape_character, \"%\", \"_\")\n string.gsub(pattern) { |x| [escape_character, x].join }\nend",
"def unescape(val)\n\tval.gsub!(/(\\\\x[\\da-f]{2}|\\\\u[\\da-f]{4})/) { [$1[2..-1].hex].pack('U') }\n\tval\nend",
"def escape_hack(string)\n string.gsub('\\\\', '\\\\\\\\\\\\')\n end",
"def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end",
"def dequote(in_string)\n in_string.gsub(/[$,\"\\\\\\n]/) {|x| \"\\\\\"+x}\n end",
"def escape(x)\n x = x.to_s\n x.gsub! @delimiter, @edelim if @delimiter\n x.gsub! @internal_delimiter, @eidelim\n x\n end",
"def convert_escape_characters(text)\n result = rm_extender_convert_escape_characters(text).to_s.clone\n result.gsub!(/\\eL\\[\\:(\\w+)\\]/i) { L[$1.to_sym] }\n result.gsub!(/\\eSL\\[\\:(\\w+)\\]/i) { SL[$game_message.call_event, $1.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_i, $3.to_sym] }\n result.gsub!(/\\eSV\\[([^\\]]+)\\]/i) do\n numbers = $1.extract_numbers\n array = [*numbers]\n if numbers.length == 1\n array = [$game_message.call_event] + array\n end\n SV[*array]\n end\n return result\n end",
"def escape_string(str)\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\n end",
"def escape_string(str)\n return if str.nil?\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\nend",
"def strip_and_unescape(value)\n value.strip\n .gsub(/^\\^\"(.*)\\^\"$/, '\\1')\n .gsub(/^\"(.*)\"$/, '\\1')\n .gsub(/\\^([\\\\\"&%^<>|])/, '\\1')\n .gsub(/\\\\\\\\/, '\\\\')\n end",
"def ShellEscape(s)\n i = 0\n res = \"\"\n\n while Ops.less_than(i, Builtins.size(s))\n c = Builtins.substring(s, i, 1)\n c = Ops.add(\"\\\\\", c) if c == \"\\\"\" || c == \"$\" || c == \"\\\\\" || c == \"`\"\n res = Ops.add(res, c)\n i = Ops.add(i, 1)\n end\n res\n end",
"def escape_special_char(str)\n str.gsub('[', '\\[').gsub(']', '\\]').gsub('(', '\\(').gsub(')', '\\)') if str\n end",
"def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end",
"def singleq2utf\n self.gsub(\"'\", '%EF%BC%87')\n end",
"def escape_string(str)\n str.gsub(/[\\0\\n\\r\\\\\\'\\\"\\x1a]/) do |s|\n case s\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\x1a\" then \"\\\\Z\"\n else \"\\\\#{s}\"\n end\n end\n end",
"def normalize_ident_escapes(ident, start: true)\n ident.gsub(/(^)?(#{Sass::SCSS::RX::ESCAPE})/) do |s|\n at_start = start && $1\n char = escaped_char(s)\n next char if char =~ (at_start ? Sass::SCSS::RX::NMSTART : Sass::SCSS::RX::NMCHAR)\n if char =~ (at_start ? /[\\x0-\\x1F\\x7F0-9]/ : /[\\x0-\\x1F\\x7F]/)\n \"\\\\#{char.ord.to_s(16)} \"\n else\n \"\\\\#{char}\"\n end\n end\n end",
"def requote(value) return restore_ends(value, '\"') end",
"def escape(str, unsafe = @regexp[:UNSAFE])\n unless unsafe.kind_of?(Regexp)\n # perhaps unsafe is String object\n unsafe = Regexp.new(\"[#{Regexp.quote(unsafe)}]\", false)\n end\n str.gsub(unsafe) do\n us = $&\n tmp = ''\n us.each_byte do |uc|\n tmp << sprintf('%%%02X', uc)\n end\n tmp\n end.force_encoding(Encoding::US_ASCII)\n end",
"def escape(str, unsafe = @regexp[:UNSAFE])\n unless unsafe.kind_of?(Regexp)\n # perhaps unsafe is String object\n unsafe = Regexp.new(\"[#{Regexp.quote(unsafe)}]\", false)\n end\n str.gsub(unsafe) do\n us = $&\n tmp = ''\n us.each_byte do |uc|\n tmp << sprintf('%%%02X', uc)\n end\n tmp\n end.force_encoding(Encoding::US_ASCII)\n end",
"def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end",
"def decode_char(input)\n # check first *char*\n input.mark\n first = input.next\n if first.nil?\n input.reset\n return nil\n end\n # if it isnt an encoded string return nil\n unless first == \"\\'\"\n input.reset\n return nil\n end\n # if second isnt an encoded marker return nil\n second = input.next\n unless second == \"\\'\"\n input.reset\n return nil\n end\n return \"\\'\"\n end",
"def cgi_escape(input); end",
"def lex_en_interp_backslash_delimited=(_arg0); end",
"def lex_en_interp_backslash_delimited=(_arg0); end",
"def lex_en_interp_backslash_delimited=(_arg0); end",
"def unescape(s); s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){[$1.delete('%')].pack('H*')} end",
"def quote_string(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") # ' (for ruby-mode)\n end",
"def escape_string(str)\n replacement = {\n ':)' => \"\\n\", ':>' => \"\\t\", ':o' => \"\\a\", ':\"' => '\"', '::' => ':'\n }\n str\n .gsub(/:[\\)>o\":]/, replacement)\n .gsub(/:\\(([0-9a-fA-F]+)\\)/) do |match|\n $1.to_i(16).chr(Encoding::UTF_8)\n end\n .gsub(/:\\[(.+?)\\]/) do |match|\n code = Unicode::DATA[$1]\n if code\n code.chr(Encoding::UTF_8)\n else\n $stderr.puts(\"Unknown Unicode normative name: #{$1}\")\n match\n end\n end\n end",
"def entity_gsub!(chars)\n mapping = {\n '&' => '&',\n '<' => '<',\n '>' => '>',\n '\"' => '"',\n \"'\" => '''\n }\n re = /&(?!amp;)|[<>'\"]/\n chars.gsub!(re, mapping)\n chars\n end",
"def escape_re(str)\n str.gsub(@re_chars) {|c| @re_esc + c}\n end",
"def qesc(s)\n s.gsub(\"'\", \"''\")\nend",
"def escape(string)\n string.gsub(/([\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '_')\n end",
"def escape_string(s)\n retval = StringBuffer.new\n i = 0\n while i < s.length\n retval.append(escape_char(s.char_at(i)))\n i += 1\n end\n return retval.to_s\n end",
"def shellescape(str)\n # An empty argument will be skipped, so return empty quotes.\n return \"''\" if str.empty?\n\n str = str.dup\n\n # Treat multibyte characters as is. It is caller's responsibility\n # to encode the string in the right encoding for the shell\n # environment.\n str.gsub!(/([^A-Za-z0-9_\\-.,:\\/@\\n])/, \"\\\\\\\\\\\\1\")\n\n # A LF cannot be escaped with a backslash because a backslash + LF\n # combo is regarded as line continuation and simply ignored.\n str.gsub!(/\\n/, \"'\\n'\")\n\n return str\nend",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def uninspect(str)\n return nil unless str\n str.gsub(%r!\\\\([\\\\#\"abefnrstvx]|u\\d{4}|u\\{[^\\}]+\\}|\\d{1,3}|x\\d{1,2}|cx|C-[a-zA-Z]|M-[a-zA-Z]| |=|:)!) do |m|\n repl = \"\"\n if ['\\\\', '#', '\"'].include?($1)\n repl = $1\n else\n repl = eval(\"\\\"\\\\#{$1}\\\"\")\n end\n repl\n end\n end",
"def esc(str)\n str = str.to_s.gsub(\"&\", \"&\")\n str = str.gsub(\"\\\"\", \"'\")\n str = str.gsub(\"\\\"\", \""\")\n str = str.gsub(\"<\", \"<\")\n str.gsub(\">\", \">\")\nend",
"def escape_string(str)\n str.gsub(/([\\0\\n\\r\\032\\'\\\"\\\\])/) do\n case $1\n when \"\\0\" then \"\\\\0\"\n when \"\\n\" then \"\\\\n\"\n when \"\\r\" then \"\\\\r\"\n when \"\\032\" then \"\\\\Z\"\n else \"\\\\\"+$1\n end\n end\n end",
"def escape_special_chars( str )\n\t\t\t@log.debug \" Escaping special characters\"\n\t\t\ttext = ''\n\n\t\t\t# The original Markdown source has something called '$tags_to_skip'\n\t\t\t# declared here, but it's never used, so I don't define it.\n\n\t\t\ttokenize_html( str ) {|token, str|\n\t\t\t\t@log.debug \" Adding %p token %p\" % [ token, str ]\n\t\t\t\tcase token\n\n\t\t\t\t# Within tags, encode * and _\n\t\t\t\twhen :tag\n\t\t\t\t\ttext += str.\n\t\t\t\t\t\tgsub( /\\*/, EscapeTable['*'][:md5] ).\n\t\t\t\t\t\tgsub( /_/, EscapeTable['_'][:md5] )\n\n\t\t\t\t# Encode backslashed stuff in regular text\n\t\t\t\twhen :text\n\t\t\t\t\ttext += encode_backslash_escapes( str )\n\t\t\t\telse\n\t\t\t\t\traise TypeError, \"Unknown token type %p\" % token\n\t\t\t\tend\n\t\t\t}\n\n\t\t\t@log.debug \" Text with escapes is now: %p\" % text\n\t\t\treturn text\n\t\tend"
] |
[
"0.7082615",
"0.6705295",
"0.66962826",
"0.66601837",
"0.6593927",
"0.65566796",
"0.6539947",
"0.65179634",
"0.64973336",
"0.6444463",
"0.6427003",
"0.6376859",
"0.6364292",
"0.63418543",
"0.6294365",
"0.6279314",
"0.62752324",
"0.62519145",
"0.6248706",
"0.6212955",
"0.6192359",
"0.6158872",
"0.6158269",
"0.6125988",
"0.61019564",
"0.6097886",
"0.6074783",
"0.6065666",
"0.6039091",
"0.6014433",
"0.60009104",
"0.59936696",
"0.5986907",
"0.5969777",
"0.59673554",
"0.594749",
"0.5930751",
"0.5923192",
"0.59225744",
"0.5906836",
"0.5906836",
"0.5906836",
"0.59060484",
"0.5903569",
"0.5891615",
"0.5869662",
"0.58670044",
"0.5859107",
"0.584891",
"0.58485734",
"0.58485734",
"0.58485734",
"0.5844258",
"0.5843639",
"0.5838127",
"0.583681",
"0.5826836",
"0.5826507",
"0.5826017",
"0.5823127",
"0.58096945",
"0.5804045",
"0.580173",
"0.5792188",
"0.57905924",
"0.5786174",
"0.5778986",
"0.5778281",
"0.5769933",
"0.5758529",
"0.5754411",
"0.5749048",
"0.57430637",
"0.57285017",
"0.5720879",
"0.57195574",
"0.5715495",
"0.5714773",
"0.5714773",
"0.5709496",
"0.56966853",
"0.56883943",
"0.56809074",
"0.56809074",
"0.56809074",
"0.56518376",
"0.56461024",
"0.56402946",
"0.5639352",
"0.5639069",
"0.56376153",
"0.5632723",
"0.5631811",
"0.5631641",
"0.5627566",
"0.5627566",
"0.5627566",
"0.5615825",
"0.56142455",
"0.5610686",
"0.55996466"
] |
0.0
|
-1
|
Create a new key object
|
def initialize(args={})
ATTRIBUTES.each do |attr|
instance_variable_set("@#{attr}", args.has_key?( attr ) ? args[attr] : nil )
end
self.raw_line = args[:raw_pubkey] || args[:raw_line]
if args.has_key? :raw_pubkey
self.load_pubkey
return
end
unless self.raw_line.nil?
self.load_raw_line
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_key(start)\n start = start.to_i\n key = Key.new(start)\n @keys[key.keyid] = key\n key.keyid\n end",
"def create_key(arg = nil)\n set_or_return(\n :create_key,\n arg,\n kind_of: [ TrueClass, FalseClass ]\n )\n end",
"def create_key(key_name, create_opts={})\n create_resource :key, create_opts.merge(:name => key_name)\n end",
"def generate_key; end",
"def new_key(school,key,value)\n school[key.to_sym] = value\nend",
"def generate_new_key(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n generate_new_keys(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ).first\n end",
"def create_key(params)\n ::M2X::Client::Key.create!(@client, params.merge(device: self[\"id\"]))\n end",
"def newkey(key, value, schoolvar)\n\tschoolvar[key] = value \nend",
"def create(pvt)\n key = Bitcoin::Key.new\n key.priv = pvt\n key.addr\n end",
"def reserve_key(key); end",
"def initialize(key)\n @key = key\n end",
"def initialize(key)\n @key = key\n end",
"def object(key)\n Object.send(:new, self, :key => key)\n end",
"def create_key(value = nil)\n db_key = storage_key(:keys)\n invalidate_cache([:smembers, :scard], db_key)\n value ||= SecureRandom.hex(16)\n storage.sadd(db_key, value)\n value\n end",
"def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"def generate_new_keys(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n\n generated =\n Rnp.new.generate_key(\n default_key_params(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ),\n )\n\n %i[primary sub].map do |key_type|\n raw = generated[key_type]\n creation_hash = creation_params(\n raw: raw, activation_date: creation_date, metadata: raw.json,\n )\n\n RK::Key::PGP.create(creation_hash)\n end\n end",
"def create(*args)\n returning super(*args) do |response|\n @key = response['Key'] if response['Key']\n end\n end",
"def key(name_or_factory = :uuid, *options)\n @key_factory = case name_or_factory\n when :uuid\n UUIDKeyFactory.new(*options)\n when :natural\n NaturalKeyFactory.new(*options)\n when :custom\n CustomKeyFactory.new(*options)\n else\n name_or_factory\n end\n end",
"def add_key(options={},user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.new({:account_id => user.id, :project_id => self.id}.merge(options))\n\tend",
"def create\n @key = Key.new(key_params)\n\n if @key.save\n render json: @key, status: :created, location: api_key_url(@key)\n else\n render json: @key.errors, status: :unprocessable_entity\n end\n end",
"def initialize(key)\n\t\t@key = key\n\tend",
"def create\n @key = Key.new(params[:key])\n\n respond_to do |format|\n if @key.save\n format.html { redirect_to @key, notice: 'Key was successfully created.' }\n format.json { render json: @key, status: :created, location: @key }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_element(key)\n Element.new('Key' => key)\n end",
"def initialize(id, key='')\n @_id = id\n @_key = key\n end",
"def new_by_key(key)\n args = RedisModelExtension::Database.redis {|r| r.hgetall(key) }\n return nil unless args && args.any?\n args.symbolize_keys!\n\n new_instance = new(args)\n new_instance.store_keys\n\n return new_instance\n end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def keypair; end",
"def new_key(old_key)\n key_store[old_key] || old_key\n end",
"def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end",
"def test_initialize_of_class_key\n name = 'name'\n column_names = %w(colA colB colC)\n is_unique = true\n\n key = Key.new(name, column_names, is_unique)\n assert_equal(name , key.name , \"names\")\n assert_equal(column_names, key.column_names, \"column_names\")\n assert_equal(is_unique , key.unique? , \"is_unique\")\n end",
"def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end",
"def from_simple_key(key)\n key\n end",
"def create(pvt)\n key(pvt).addr\n end",
"def generate_key(key_size = T.unsafe(nil)); end",
"def add_key(key, value, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#di. create method to add keys & values\n\tschool[key] = value\nend",
"def _build_object_key( obj )\n index = self.__pack[:keys].length\n self.__pack[:keys] << _pack_object( obj )\n index # return key\n end",
"def create_default_key_reader\n @key_reader = DefaultKeyReader.new self\n end",
"def create\n @public_key = PublicKey.new\n\n new_key_pair = KeyDistributorHelper::generate_key_pair\n @public_key.key = new_key_pair.public_key\n\n # Get a non-matching public_key for the lulz!\n rand_public_key = begin PublicKey.offset(rand(PublicKey.count)).first.key rescue nil end\n\n # Put em together\n new_private_key = new_key_pair.private_key\n @key_pair = KeyDistributorHelper::KeyPair.new new_private_key, rand_public_key\n \n respond_to do |format|\n if @public_key.save\n format.html { render }\n format.json { render json: key_pair, status: :created }\n else\n format.html { render :new }\n format.json { render json: @public_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def key_id=(_arg0); end",
"def key_generator; end",
"def key_generator; end",
"def initialize(key)\n @id = case key\n when Kademlia::DataKey then key.to_bin\n when String\n case key.size\n # If it's in the right format\n when Size then key\n # If it's hex\n when Size * 2 then [key].pack('H*')\n end\n when Integer\n @int_val = key\n [\"%0#{Size}d\" % key.to_s(16)].pack('H*')\n end\n\n raise ArgumentError, \"#{key} is not a valid key.\" if @id.nil?\n end",
"def make_keys!\n root_dir = SAFE_KEYS_DIR\n object_id = self.id\n pass = self.password \n raise Safe::KeygenError if object_id.nil? || pass.nil?\n dir_class = root_dir + \"/#{self.class.to_s.tableize}/\"\n dir = dir_class + \"#{object_id}/\"\n if File.exists?(root_dir) && File.directory?(root_dir)\n Dir.mkdir(dir_class) unless File.exists?(dir_class)\n Dir.mkdir(dir) unless File.exists?(dir)\n gen_keypair(dir, pass)\n else\n Dir.mkdir(root_dir)\n Dir.mkdir(dir_class)\n Dir.mkdir(dir)\n gen_keypair(dir, pass)\n end \n end",
"def build_key(public_key, private_key)\n group = OpenSSL::PKey::EC::Group.new('prime256v1')\n key = OpenSSL::PKey::EC.new(group)\n\n public_bn = OpenSSL::BN.new(public_key, 16)\n private_bn = OpenSSL::BN.new(private_key, 16)\n public_key = OpenSSL::PKey::EC::Point.new(group, public_bn)\n\n key.tap do\n key.public_key = public_key\n key.private_key = private_bn\n end\n end",
"def build_key(instance)\n @key_processor.call(instance)\n end",
"def initialize(key,value)\n @key = key\n @value = value\n self.put(key,value)\n end",
"def create_key_a\n @key_chars[0..1].join.to_i\n end",
"def initialize(key, value)\n @key = key\n @value = value\n end",
"def +(other)\n Key.new( [to_s, other.to_s].join(SEPARATOR) )\n end",
"def make_key(length, key)\n i = 0\n length.times do\n i = 0 if i == key.length\n break if key.length == length\n \n key << key[i]\n i += 1\n end\n \n key\n end",
"def key(*args)\n key = super \n if converter_name = key.options[:as_string]\n key_name = key.name.to_sym \n available_as_string key_name, converter_name\n attr_protected \"#{key_name}_as_string\".to_sym if key.options[:protected] \n end\n key\n end",
"def initialize(key_value)\n @key_value = key_value\n end",
"def set_key\n @key = Key.find(params[:id])\n end",
"def initialize(key, attrs = {})\n self.key = key\n self.attributes = attrs\n end",
"def initialize(key, attrs = {})\n self.key = key\n self.attributes = attrs\n end",
"def assign_key(attrs)\n case attrs.class.name\n when 'Fixnum'\n new_var 'key', attrs\n @item ||= Item.find_by_id(attrs)\n when 'Item'\n @item ||= attrs\n new_var 'key', @item.id\n when 'List'\n @list ||= attrs\n @item ||= @list.items.new\n when 'String'\n if /^[-+]?[0-9]+$/ === attrs\n @item ||= Item.find_by_id(attrs.to_i)\n new_var 'key', attrs.to_i\n else\n @list = List.find_by_name(attrs)\n @item = @list.items.new\n end\n end\n if @item.nil?\n return { :success => false, :errors => ['could not find key']}\n end\n @list ||= @item.list\n new_var 'list', @list.name\n new_var 'created_at', @item.created_at\n new_var 'updated_at', @item.updated_at\n end",
"def create_family(f)\n @ks[:family][f] = KeyFamily.new(f)\n end",
"def new_key(list, key, value)\n\tlist[key] = value\nend",
"def initialize( key_string = nil )\n self.key_string = key_string\n end",
"def make_guest_key(lock, guest_email, user)\n key = Key.create_new_key(lock.id, guest_email, user)\n\n # permission error\n return key if (key.class == Hash)\n start = 60*60\n tc = TimeConstraint.create!(:key_id => key.id,\n :start_offset=> start.to_s,\n :end_offset => (start*2).to_s,\n :monday => true,\n :tuesday => true,\n :wednesday => true,\n :thursday => true,\n :friday => false,\n :saturday => true)\n # update seq_no\n key.reload\n return key\n end",
"def coerce_key(*attrs); end",
"def create_public_key(path, key, options = {})\n create_or_update_key(path, key, 'public', 'post', options)\n end",
"def key=(new_key)\n @key = new_key\n end",
"def shell_registry_createkey(key, view)\n key = normalize_key(key)\n # REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]\n shell_registry_cmd_result(\"add /f \\\"#{key}\\\"\", view)\n end",
"def to_simple_key(key)\n key\n end",
"def initialize(key)\n @key = key\n @k1, @k2 = CMAC.gen_subkeys(@key)\n end",
"def new_entry(key, key_hash, value)\n if key.kind_of?(String) and !key.frozen?\n key = key.dup\n key.freeze\n end\n\n @size += 1\n Entry.new key, key_hash, value\n end",
"def key(name)\n @unique_key = name\n end",
"def initialize(key, value)\n @key = key\n @value = value\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 key type\n make_key get_class(type)\n end",
"def make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'RSA',\n\t\t :key_length => 4096,\n\t\t :subkey_type => 'RSA',\n\t\t :subkey_length => 4096,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend",
"def create_ssh_key(title, key, options = {})\n user_id = options.delete :user_id\n if user_id.to_i.zero?\n post('/user/keys', body: { title: title, key: key })\n else\n post(\"/users/#{user_id}/keys\", body: { title: title, key: key })\n end\n end",
"def key(name, default_value=:undefined)\n key_attrs[name] = Attr.new(name, default_value, @_current_desc)\n @_current_desc = nil\n _define_attr(name)\n end",
"def convert_key(key); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def create key_name\n params = {\n \"KeyName\" => key_name\n }\n\n response = @client.action \"CreateKeyPair\", params\n\n Response::Credential.new response.body['CreateKeyPairResponse']\n end",
"def to_key; end",
"def assign_key!\n key = \"\"\n #in case wasnt stripped before\n name = self.name.strip\n if name.length > 2\n key += name[0..2]\n else\n key += name\n end\n key += (self.team_id % 10).to_s\n key += rand(10).to_s\n\n #avoid duplicates\n while Player.exists?(key: key)\n key += rand(10).to_s\n end\n\n self.update_attribute(:key ,key)\n end",
"def key_coercions=(_arg0); end",
"def key=(key); end",
"def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end",
"def make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'DSA',\n\t\t :key_length => 1024,\n\t\t :subkey_type => 'ELG-E',\n\t\t :subkey_length => 1024,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend",
"def generate_keys\n key = OpenSSL::PKey::RSA.new 2048\n self.pubkey = key.public_key.to_s\n self.privkey = key.to_s\n self.save\n end",
"def generate_access_key\n access_keys.generate_new\n end",
"def write_key(*key); end",
"def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end",
"def record_key(key)\n decoded_key = decode_key(key)\n\n if decoded_key.nil?\n {}\n elsif decoded_key.is_a?(Hash)\n @key_converter.convert(decoded_key)\n else\n { @klass.primary_key => decoded_key }\n end\n end",
"def create_key_pair(name, sshkey)\n payload = {\"name\" => name, \"sshkey\" => sshkey}\n post(\"tenants/#{tenant}/sshkeys\", payload.to_json)\n end",
"def addkey(key, value, school)\n school[key] = value\nend",
"def hash_key(name); end",
"def create_key\n if @house.find_room(:garden).inventory.include?(\"shovel\") && (@level == 0)\n @house.create_item(\"key\", \"It's a key, but what's it for?\", 10)\n @house.find_room(:garden).inventory << \"key\"\n @house.last_move_message = \"You dug up a key in the garden! What's it for?\"\n @level+=1\n end\n end",
"def initialize(key = \"12345\", date = DateTime.now.strftime('%d%m%y').to_s)\n @key = key\n @date = date\n end",
"def initialize(key=nil)\n super\n end",
"def create_or_get(*key, **attrs)\n begin\n object = create(*key, **attrs)\n object\n rescue const_get(:Conflict) => error\n object = new(*key, **attrs)\n object.get!\n object\n end\n rescue Etcd::KeyNotFound => error\n raise const_get(:Conflict), \"Create-and-Delete conflict with #{error.cause}@#{error.index}: #{error.message}\"\n end",
"def create(id, key, length: 16)\n pem, keygap = Keygap.new.extract(key.to_s, length)\n @aws.put_item(\n table_name: 'zold-wallets',\n item: {\n 'login' => @login,\n 'id' => id.to_s,\n 'pem' => pem,\n 'keygap' => keygap\n }\n )\n @log.info(\"New user @#{@login} created, wallet ID is #{id}, \\\nkeygap is '#{keygap[0, 2]}#{'.' * (keygap.length - 2)}'\")\n keygap\n end",
"def create_key request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_key_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end"
] |
[
"0.78871727",
"0.7613876",
"0.74968225",
"0.7046661",
"0.7009361",
"0.69653755",
"0.69453937",
"0.6865855",
"0.683629",
"0.6819702",
"0.6802487",
"0.6802487",
"0.6763601",
"0.6730844",
"0.67207867",
"0.6664415",
"0.66316795",
"0.662651",
"0.6624066",
"0.6603754",
"0.6571355",
"0.65591115",
"0.654012",
"0.65289605",
"0.6519838",
"0.651976",
"0.651976",
"0.651976",
"0.651976",
"0.651976",
"0.6514202",
"0.65099734",
"0.6501748",
"0.6494997",
"0.64943385",
"0.64816785",
"0.64732575",
"0.64693516",
"0.6435507",
"0.64324474",
"0.6421781",
"0.64166063",
"0.6414978",
"0.6414978",
"0.64028716",
"0.63854724",
"0.6383701",
"0.6380766",
"0.6374041",
"0.637176",
"0.6364275",
"0.63586795",
"0.6354924",
"0.635036",
"0.6343119",
"0.63388485",
"0.63182896",
"0.63182896",
"0.6309869",
"0.6301171",
"0.6299264",
"0.62926126",
"0.62825435",
"0.62674254",
"0.6256574",
"0.6256135",
"0.6255313",
"0.6254335",
"0.6249443",
"0.62099594",
"0.6205234",
"0.6203347",
"0.620163",
"0.61961675",
"0.61943144",
"0.6185356",
"0.6181514",
"0.6177996",
"0.6177996",
"0.6177996",
"0.61749876",
"0.6171154",
"0.61702764",
"0.6146222",
"0.6144566",
"0.613951",
"0.6138806",
"0.61339533",
"0.6126621",
"0.6114145",
"0.61110425",
"0.61079186",
"0.6095522",
"0.60945773",
"0.60849315",
"0.60771865",
"0.606754",
"0.60627604",
"0.60627013",
"0.60491294",
"0.604392"
] |
0.0
|
-1
|
Instantiate key based on pubkey file only set key_data,key_type and note attributes
|
def load_pubkey
#filter line data
load_raw_line([:key_data,:key_type,:note])
# sanitize old raw line
self.raw_line = self.gen_raw_line
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_public_key(filename); end",
"def load_data_public_key(data, filename = T.unsafe(nil)); end",
"def create(pvt)\n key = Bitcoin::Key.new\n key.priv = pvt\n key.addr\n end",
"def keyload(key_file_path=\"rsa_private_key.rb\")\n #require key_file_path\n require_relative key_file_path\n @n, @e= publickey\n @privatekey=privatekey\n #puts $n, $e, $privatekey\n end",
"def generate_keys\n key = OpenSSL::PKey::RSA.new 2048\n self.pubkey = key.public_key.to_s\n self.privkey = key.to_s\n self.save\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n key = SelfSignedCertificate.new(hostname)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n |io| io.write key.pub end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write key.crt end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write key.priv end\n 'OK'\nend",
"def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder, subject, ca_key_file,\nca_crt_file, passphrase)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n ca_key = OpenSSL::PKey::RSA.new File.read(ca_key_file), passphrase\n ca_cert = OpenSSL::X509::Certificate.new File.read ca_crt_file\n c=SignedCertificate.new(ca_key, ca_cert, subject)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n #|io| io.write c.key.public_key.to_pem end\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.csr.pem\", 'w' do\n #|io| io.write c.csr.to_pem end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write c.cert.to_pem end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write c.key.to_pem end\n 'OK'\nend",
"def initialize\n key_pair = ECDSA.generate_key_pair\n self.private_key, self.public_key = key_pair.values_at(:private_key, :public_key)\n end",
"def add(key_file); end",
"def build_key(public_key, private_key)\n group = OpenSSL::PKey::EC::Group.new('prime256v1')\n key = OpenSSL::PKey::EC.new(group)\n\n public_bn = OpenSSL::BN.new(public_key, 16)\n private_bn = OpenSSL::BN.new(private_key, 16)\n public_key = OpenSSL::PKey::EC::Point.new(group, public_bn)\n\n key.tap do\n key.public_key = public_key\n key.private_key = private_bn\n end\n end",
"def create\n @public_key = PublicKey.new\n\n new_key_pair = KeyDistributorHelper::generate_key_pair\n @public_key.key = new_key_pair.public_key\n\n # Get a non-matching public_key for the lulz!\n rand_public_key = begin PublicKey.offset(rand(PublicKey.count)).first.key rescue nil end\n\n # Put em together\n new_private_key = new_key_pair.private_key\n @key_pair = KeyDistributorHelper::KeyPair.new new_private_key, rand_public_key\n \n respond_to do |format|\n if @public_key.save\n format.html { render }\n format.json { render json: key_pair, status: :created }\n else\n format.html { render :new }\n format.json { render json: @public_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(data, public_key = nil, encoding = :none, opts = {})\n @encoding = encoding\n\n if !public_key && !opts[:public_key_file]\n # If no public key was provided the data should already be encrypted\n @data = data\n elsif File.exists?(opts[:public_key_file].to_s)\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n elsif public_key\n public_key = OpenSSL::PKey::RSA.new(public_key)\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n end\n end",
"def load_data_private_key(data, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), filename = T.unsafe(nil), prompt = T.unsafe(nil)); end",
"def key_file\n super\n end",
"def key_pem; end",
"def initialize(key, filename, content)\n @key = key\n @filename = filename\n @content = content\n end",
"def load_private_key(filename, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), prompt = T.unsafe(nil)); end",
"def load_key(key_file)\n OpenSSL::PKey::RSA.new(File.read(key_file), @password)\n end",
"def load_public_key(filename)\n data = File.read(File.expand_path(filename))\n load_data_public_key(data, filename)\n end",
"def initialize(otrkey_file, email, password)\n @email = email\n @password = Base64.decode64 password\n\n @file_in_path = otrkey_file\n @file_out_path = File.expand_path(@file_in_path + '/..') + '/my_' + File.basename(@file_in_path, '.otrkey')\n end",
"def create_key(params)\n ::M2X::Client::Key.create!(@client, params.merge(device: self[\"id\"]))\n end",
"def initialize(options = {})\n invalid_options = options.keys - [:private_key_file, :public_key_file, :algorithm, :password]\n raise ArgumentError, \"Unknown key(s): #{invalid_options.join(\", \")}\" unless invalid_options.empty?\n \n options = {\n :private_key_file => AsymmetricCipher.default_private_key_file,\n :public_key_file => AsymmetricCipher.default_public_key_file\n }.merge(options)\n \n @public_key = @private_key = nil\n \n self.private_key_file = options[:private_key_file]\n self.public_key_file = options[:public_key_file]\n raise ArgumentError, 'At least one key file must be specified (:private_key_file or :public_key_file)' unless private_key_file || public_key_file\n \n self.algorithm = options[:algorithm]\n self.password = options[:password]\n \n super()\n end",
"def read_key(type, key=nil, passphrase=nil)\n return key if key.nil?\n\n raise \"Could not find key #{key}\" unless File.exist?(key)\n\n if type == :public\n return OpenSSL::PKey::RSA.new(File.read(key))\n elsif type == :private\n return OpenSSL::PKey::RSA.new(File.read(key), passphrase)\n else\n raise \"Can only load :public or :private keys\"\n end\n end",
"def initialize(pvt_key_string)\n @pvt_key_string = pvt_key_string\n @pvt_key = PrivateKey.new pvt_key_string\n log 'pvt key', @pvt_key\n @address = @pvt_key.address_str\n log 'address', @address\n end",
"def initialize(key, encoding = :raw)\n key = Encoder[encoding].decode(key)\n Util.check_length(key, NaCl::PUBLICKEYBYTES, \"key\")\n\n @key = key\n end",
"def builder_keypair\n if File.exists?(\"#{cluster_data_dir}/builder_key\")\n OpenSSL::PKey::RSA.new(File.read(\"#{cluster_data_dir}/builder_key\"))\n else\n OpenSSL::PKey::RSA.generate(2048)\n end\n end",
"def initialize(password, config = {})\n self.config = config\n @secret_key = @secret_iv = @clear_data = @encrypted_data = ''\n\n begin\n @public_key = OpenSSL::PKey::RSA.new(File.open(self.config[:public_key]))\n @private_key =\n OpenSSL::PKey::RSA.new(File.open(self.config[:private_key]), password)\n @keystore = Nachos::KeyStore.new\n\n keypair\n rescue Errno::ENOENT\n raise Nachos::EncryptorException, \"Public or private key missing! \" +\n \"(maybe both!)\"\n rescue Nachos::KeyStoreException => e\n raise\n rescue => e\n raise Nachos::EncryptorException, \"There was a problem loading or \" +\n \"decrypting the keypair and/or keystore! (#{e})\" \n end\n end",
"def generate\n Puppet.info \"Creating a new SSL key for #{name}\"\n @content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i)\n end",
"def initialize(key_base64)\n @key = key_base64\n end",
"def gen_ec_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::EC.new key_content, priv_key_password\n\n # Get curve type (prime256v1...)\n group = ::OpenSSL::PKey::EC::Group.new(key.group.curve_name)\n # Get Generator point & public point (priv * generator)\n generator = group.generator\n pub_point = generator.mul(key.private_key)\n key.public_key = pub_point\n\n # Public Key in pem\n public_key = ::OpenSSL::PKey::EC.new\n public_key.group = group\n public_key.public_key = pub_point\n public_key.to_pem\n end",
"def create_public_key(path, key, options = {})\n create_or_update_key(path, key, 'public', 'post', options)\n end",
"def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end",
"def create_keys_files(config_data,external_private_key_path,internal_private_key_path,internal_public_key_path)\n if !File.exist?(external_private_key_path) and !File.exist?(internal_private_key_path)\n File.open(external_private_key_path, \"w\") do |f|\n config_data['keys']['external_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,external_private_key_path)\n File.open(internal_private_key_path, \"w\") do |f|\n config_data['keys']['internal_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,internal_private_key_path)\n end\n if !File.exist?(internal_public_key_path)\n shell_cmd = \"ssh-keygen -y -f #{internal_private_key_path}\"\n generated_key = %x[ #{shell_cmd} ]\n File.open(internal_public_key_path, \"w\") do |f|\n f.puts(generated_key)\n end\n end\nend",
"def initialize(private_key: nil,\n public_key: nil,\n public_key_compressed: true,\n wif: nil,\n network: nil)\n\n @public_key_compressed = public_key_compressed\n @network = network || BTC::Network.default\n\n if private_key\n if !Key.validate_private_key_range(private_key)\n raise FormatError, \"Private key is outside the valid range\"\n end\n @private_key = private_key\n elsif public_key\n if !Key.valid_pubkey?(public_key)\n raise FormatError, \"Invalid public key: #{public_key.inspect}\"\n end\n @public_key_compressed = (self.class.length_for_pubkey(public_key) == COMPRESSED_PUBKEY_LENGTH)\n @public_key = public_key\n elsif wif\n wif = wif.is_a?(WIF) ? wif : Address.parse(wif)\n if !wif.is_a?(WIF)\n raise FormatError, \"Invalid WIF string\"\n end\n key = wif.key\n @private_key = key.private_key\n @public_key = key.public_key\n @public_key_compressed = key.public_key_compressed\n @network = wif.network\n else\n raise ArgumentError, \"Must specify either private_key or public_key\"\n end\n end",
"def init_keystore\n @ks = Hash.new\n @ks[:serial] = 0\n @ks[:family] = Hash.new\n save\n end",
"def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end",
"def initialize(key)\n @id = case key\n when Kademlia::DataKey then key.to_bin\n when String\n case key.size\n # If it's in the right format\n when Size then key\n # If it's hex\n when Size * 2 then [key].pack('H*')\n end\n when Integer\n @int_val = key\n [\"%0#{Size}d\" % key.to_s(16)].pack('H*')\n end\n\n raise ArgumentError, \"#{key} is not a valid key.\" if @id.nil?\n end",
"def key_params\n params.require(:key).permit(:key, :note, :data_type)\n end",
"def initialize(private_key, opts = { public_key: nil, passphrase: nil })\n if private_key.is_a? OpenSSL::PKey::RSA\n @private_key = private_key\n elsif !private_key.to_s.eql?('')\n @private_key = OpenSSL::PKey::RSA.new(\n if File.exists?(File.expand_path(private_key))\n File.read(File.expand_path(private_key))\n else\n private_key\n end,\n opts[:passphrase]\n )\n unless @private_key.private?\n raise(\n Cryptic::InvalidKey,\n \"Public key '#{private_key}' provided as a private key.\"\n )\n end\n end\n\n if public_key.is_a? OpenSSL::PKey::RSA\n @public_key = public_key\n else\n @public_key = OpenSSL::PKey::RSA.new(\n if opts[:public_key] && File.exists?(File.expand_path(opts[:public_key].to_s))\n File.read(File.expand_path(opts[:public_key].to_s))\n elsif opts[:public_key]\n opts[:public_key]\n else\n @private_key or raise(Cryptic::KeyNotFound)\n end,\n opts[:passphrase]\n ).public_key\n end\n rescue OpenSSL::PKey::RSAError => e\n if e.message.eql? 'Neither PUB key nor PRIV key:: not enough data'\n if @private_key.nil?\n raise Cryptic::InvalidKey, \"Invalid private key: #{private_key}\"\n elsif @public_key.nil?\n raise Cryptic::InvalidKey, \"Invalid public key: #{public_key}\"\n end\n elsif e.message.eql? 'Neither PUB key nor PRIV key:: nested asn1 error'\n raise Cryptic::IncorrectPassphrase, \"Unable to open private key:\n '#{private_key}'. was the passphrase valid?\"\n else\n raise e\n end\n end",
"def keyfile(key)\n keyfile = Tempfile.new(\"ec2_private.key\")\n key_material = \"\"\n key.split(\"\\n\").each { |line| key_material+=\"#{line.strip}\\n\" if line.strip.size>0 }\n keyfile.write(key_material) && keyfile.close\n puts \"[*] Using #{keyfile.path} as private key\"\n keyfile.path\n end",
"def key_pair_params\n params.require(:key_pair).permit(:file, :key_string)\n end",
"def load(key_store_file, password)\n\n end",
"def add_key(key)\n if File.exist?(key)\n data = File.open(key).read\n key_import = GPGME::Key.import(data, armor: true)\n key = GPGME::Key.get(key_import.imports[0].fpr).uids[0].email\n else\n data = GPGME::Key.export(key, armor: true).read\n end\n\n raise I18n.t('error.export_key') if data.to_s.empty?\n\n @keys[key] = data\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end",
"def new_key(start)\n start = start.to_i\n key = Key.new(start)\n @keys[key.keyid] = key\n key.keyid\n end",
"def initialize(key)\n @key = key\n @k1, @k2 = CMAC.gen_subkeys(@key)\n end",
"def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end",
"def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end",
"def generate_keypair\n key = OpenSSL::PKey::RSA.new 2048\n load_keypair(key.to_pem, key.public_key.to_pem)\n return [@private_key, @public_key]\n end",
"def key=(key)\n @key = OpenSSL::PKey::RSA.new(key)\n end",
"def initialize key, code, owner, active=false\n\t\t\t@key = key\n\t\t\t@code = code\n\t\t\t@owner = owner\n\t\t\t@active = active\n\t\tend",
"def create(name, write_private)\n new_key = OpenSSL::PKey::RSA.generate(1024)\n new_public = new_key.public_key.to_pem\n new_private = new_key.to_pem\n File.open(File.join(@keystore, \"#{name}.pub\"), 'w') { |f| f.puts new_public }\n File.open(File.join(@keystore, \"#{name}.key\"), 'w') { |f| f.puts new_key } if write_private\n new_key\n end",
"def 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 make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'RSA',\n\t\t :key_length => 4096,\n\t\t :subkey_type => 'RSA',\n\t\t :subkey_length => 4096,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend",
"def initialize(key, data_file_name)\n # Get a handle on the file.\n data_file = Pathname.new(__FILE__).dirname + 'data' + data_file_name.to_s\n raise ArgumentError, \"No such file #{data_file.to_s}\" unless data_file.exist?\n\n # Parse\n @data = case data_file.extname\n when '.json'\n JSON.parse( data_file.read, :symbolize_names => true )\n else\n raise ArgumentError \"Cannot parse files of type #{data_file.extname}\"\n end\n\n # Set key and freeze\n @key = key.freeze\n @data.freeze\n end",
"def initialize(options = {})\n options = options.symbolize_keys\n options.assert_valid_keys(\n :private_key_file,\n :public_key_file,\n :key,\n :algorithm\n )\n options.reverse_merge!(\n :private_key_file => @@default_private_key_file,\n :public_key_file => @@default_public_key_file,\n :algorithm => @@default_algorithm\n )\n \n @public_key = @private_key = nil\n @key = options[:key]\n @algorithm = options[:algorithm]\n \n self.private_key_file = options[:private_key_file]\n self.public_key_file = options[:public_key_file]\n \n super()\n end",
"def public_key_file=(file)\n @public_key_file = file and load_public_key\n end",
"def generate_key!\n unless priv_key\n tmp = OpenSSL::PKey.generate_key(self)\n set_key(tmp.pub_key, tmp.priv_key)\n end\n self\n end",
"def create\n # get the ca\n @authority = Certify::Authority.find(params[:certify_authority_id])\n\n @keypair = Certify::KeyPair.new(params[:keypair])\n @keypair.authority = @authority\n\n respond_to do |format|\n if @keypair.save\n format.html { redirect_to certify_authority_path(@authority), notice: 'Private key was successfully created.' }\n format.json { render json: @keypair, status: :created, location: @keypair }\n else\n format.html { render action: \"new\" }\n format.json { render json: @keypair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_key_entry(aliaz, key, certificate_chain, password = nil)\n\n end",
"def initialize(private_key, options = {})\n @passphrase = options[:passphrase]\n @comment = options[:comment] || \"\"\n self.directives = options[:directives] || []\n\n begin\n @key_object = OpenSSL::PKey::RSA.new(private_key, passphrase)\n @type = \"rsa\"\n @typestr = \"ssh-rsa\"\n rescue OpenSSL::PKey::RSAError\n @type = nil\n end\n\n return if @type\n\n begin\n @key_object = OpenSSL::PKey::DSA.new(private_key, passphrase)\n @type = \"dsa\"\n @typestr = \"ssh-dss\"\n rescue OpenSSL::PKey::DSAError\n @type = nil\n end\n\n return if @type\n\n @key_object = OpenSSL::PKey::EC.new(private_key, passphrase)\n @type = \"ecdsa\"\n bits = ECDSA_CURVES.invert[@key_object.group.curve_name]\n @typestr = \"ecdsa-sha2-nistp#{bits}\"\n end",
"def load_data_public_key(data, filename = \"\")\n fields = data.split(/ /)\n\n blob = nil\n begin\n blob = fields.shift\n end while !blob.nil? && !/^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp\\d+)(-cert-v01@openssh\\.com)?$/.match(blob)\n blob = fields.shift\n\n raise Net::SSH::Exception, \"public key at #{filename} is not valid\" if blob.nil?\n\n blob = blob.unpack(\"m*\").first\n reader = Net::SSH::Buffer.new(blob)\n reader.read_key or raise OpenSSL::PKey::PKeyError, \"not a public key #{filename.inspect}\"\n end",
"def gen_key(info = {})\n stdin, stdout, stderr = exec3(:gen_key) do |stdin, stdout, stderr|\n stdin.puts \"Key-Type: #{info[:key_type]}\" if info[:key_type]\n stdin.puts \"Key-Length: #{info[:key_length]}\" if info[:key_length]\n stdin.puts \"Subkey-Type: #{info[:subkey_type]}\" if info[:subkey_type]\n stdin.puts \"Subkey-Length: #{info[:subkey_length]}\" if info[:subkey_length]\n stdin.puts \"Name-Real: #{info[:name]}\" if info[:name]\n stdin.puts \"Name-Comment: #{info[:comment]}\" if info[:comment]\n stdin.puts \"Name-Email: #{info[:email]}\" if info[:email]\n stdin.puts \"Expire-Date: #{info[:expire_date]}\" if info[:expire_date]\n stdin.puts \"Passphrase: #{info[:passphrase]}\" if info[:passphrase]\n stdin.puts \"%commit\"\n end\n stderr.each_line do |line|\n if (line = line.chomp) =~ /^gpg: key ([0-9A-F]+) marked as ultimately trusted/\n return $1.to_i(16) # the key ID\n end\n end\n return nil\n end",
"def initialize_keys\n super\n\n # Create and encrypt a 12 byte header to protect the encrypted file data\n # from attack. The first 10 bytes are random, and the last 2 bytes are\n # the low order word in little endian byte order of the last modified\n # time of the entry in DOS format.\n header = ''\n 10.times do\n header << rand(256).chr\n end\n header << mtime.to_dos_time.pack[0, 2]\n\n # Take care to ensure that all bytes in the header are written.\n while header.size > 0 do\n begin\n header.slice!(0, unbuffered_write(header))\n rescue Errno::EAGAIN, Errno::EINTR\n sleep(1)\n end\n end\n\n # Reset the total bytes written in order to disregard the header.\n @total_bytes_in = 0\n\n nil\n end",
"def set_key(exponent_hex_string, modulus_hex_string)\n @key = RsaKey.new exponent_hex_string, modulus_hex_string\n end",
"def import_public_key key_name, pubkey, fprint=nil\n params = { \n 'KeyName' => key_name,\n 'PublicKey' => pubkey\n }\n params.merge!( 'Fingerprint' => fprint ) unless fprint.nil?\n\n response = @client.action \"ImportPublicKey\", params\n\n Response::Credential.new response.body[\"ImportPublicKeyResponse\"]['return']\n end",
"def set_key_file(opts)\n opts = check_params(opts,[:keys])\n super(opts)\n end",
"def key_path=(path)\n raise ArgumentError.new(\"The signing key could not be found at #{path}\") unless File.exists?(path)\n @key_path = path\n self.key=(File.readlines(path).join(\"\"))\n end",
"def create\n @public_key.user = current_user\n respond_to do |format|\n if @public_key.save\n # PublicKey.regenerate_authorized_keys\n GitWit.add_authorized_key(current_user.username, @public_key.raw_content)\n\n format.html { redirect_to @public_key, notice: 'Public key was successfully created.' }\n format.json { render json: @public_key, status: :created, location: @public_key }\n else\n format.html { render action: \"new\" }\n format.json { render json: @public_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end",
"def initialize(data, cert, key)\n @p7 = OpenSSL::PKCS7.sign(cert.raw_cert, key.raw_key, data, [], FLAGS)\n @store = OpenSSL::X509::Store.new\n end",
"def public_key=(_); end",
"def public_key=(_); end",
"def set_public_key\n @public_key = PublicKey.first || PublicKey.create(body: 'public key body', algorithm: PublicKey::ALGORITHMS.first)\n end",
"def key_file\n write_file(\"request-#{domain}.key\", key.to_pem)\n end",
"def add_key_data(key_data_); end",
"def add_public_key_file(path)\n @keys << Net::SSH::KeyFactory.load_public_key(path)\n end",
"def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end",
"def openssl_generate_key(*args,&block)\n keypair = OpenSSL::PKey::RSA.new CaHelper.ca_config['key_size']\n end",
"def load\n # read the keystore file and extract the parts\n file = File.read(@config[:filename])\n encrypted_key = file[0,128]\n iv = file[128,16]\n ciphertext = file[144, file.length - 144]\n \n # decrypt the KEK\n kek = @config[:SSLPrivateKey].private_decrypt(encrypted_key)\n \n # decrypt the keystore with the KEK and IV\n cipher = get_cipher\n cipher.decrypt(kek)\n cipher.iv = iv\n ksdata = cipher.update(ciphertext)\n ksdata << cipher.final\n \n # remove the random offset and reanimate the keystore\n offset = ksdata.slice!(0,2).unpack(\"n\").first\n ksdata.slice!(0,offset)\n @ks = Marshal.restore(ksdata)\n end",
"def load_key_string(key_string)\n Rnp.new.tap do |rnp|\n rnp.load_keys(\n format: \"GPG\",\n input: Rnp::Input.from_string(key_string),\n public_keys: true,\n secret_keys: true,\n )\n end\n end",
"def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end",
"def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end",
"def create\n @public_key = PublicKey.new(public_key_params)\n\n respond_to do |format|\n if @public_key.save\n format.html { redirect_to @public_key, notice: 'Public key was successfully created.' }\n format.json { render :show, status: :created, location: @public_key }\n else\n format.html { render :new }\n format.json { render json: @public_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(key)\n\t\t@key = key\n\tend",
"def initialize(key)\n @key = key\n end",
"def initialize(key)\n @key = key\n end",
"def key_data; end",
"def key_data; end",
"def a_pi_key_new(opts = {})\n data, _status_code, _headers = a_pi_key_new_with_http_info(opts)\n return data\n end",
"def initialize(file_or_path, options = {})\n data = file_or_path.read if file_or_path.respond_to?(:read)\n data ||= File.read file_or_path\n\n @keystore = options[:keystore]\n\n init(data)\n end",
"def public_key\n return @public_key if File.exist?(@agent_file) && File.exist?(@key_file)\n # create the agent and key if at least one file does not exist (anymore)\n create_agent_key_combo\n @public_key\n end",
"def write_new_key\n File.open(full_key_path, 'w') do |f|\n f.write OpenSSL::PKey::RSA.generate(1024).export()\n end\n end",
"def create_key(key_name, create_opts={})\n create_resource :key, create_opts.merge(:name => key_name)\n end",
"def public_key_file=(file)\n @public_key_file = file and load_public_key\n end",
"def public_key\n require_key\n\n @private_key.public_key.to_pem\n end",
"def create_client\n client_public, client_private = ZMQ::Util.curve_keypair\n store_known_client(client_public)\n\n {\n server_public_key: @public_key,\n public_key: client_public,\n private_key: client_private\n }\n end",
"def make_keypair\n\t gpg = OpenPGP::Engine::GnuPG.new(:homedir => '~/.gnupg')\n\t key_id = gpg.gen_key({\n\t\t :key_type => 'DSA',\n\t\t :key_length => 1024,\n\t\t :subkey_type => 'ELG-E',\n\t\t :subkey_length => 1024,\n\t\t :name => @dname,\n\t\t :comment => nil,\n\t\t #:email => '',\n\t\t #:passphrase => '',\n\t\t})\n\tend",
"def new_key(key)\n property = Atom::XML::Node.new('apps:property')\n property['name'] = 'publicKey'\n property['value'] = Base64.encode64 key\n\n @doc.root << property\n end",
"def initialize\n @name = \"\"\n @public_key = nil\n @private_key = nil\n @admin = false\n @validator = false\n @create_key = nil\n end"
] |
[
"0.6864566",
"0.6860883",
"0.672304",
"0.6701389",
"0.6594955",
"0.65768236",
"0.6557497",
"0.64921284",
"0.6472643",
"0.64307",
"0.63999546",
"0.63033646",
"0.6252607",
"0.625141",
"0.62506586",
"0.6228636",
"0.62246054",
"0.6214617",
"0.62067485",
"0.6183494",
"0.6139712",
"0.6135826",
"0.6133698",
"0.6131695",
"0.6120922",
"0.6119528",
"0.60957193",
"0.6069117",
"0.60614777",
"0.60512763",
"0.6046204",
"0.6045635",
"0.60444754",
"0.6041237",
"0.6028566",
"0.6028501",
"0.60066247",
"0.6006169",
"0.5978178",
"0.5977319",
"0.59327686",
"0.59202266",
"0.59198934",
"0.5917031",
"0.58932406",
"0.58786273",
"0.58769506",
"0.58769506",
"0.5874033",
"0.58634216",
"0.5862695",
"0.585618",
"0.5848331",
"0.58462554",
"0.58228487",
"0.5808242",
"0.5802721",
"0.5792119",
"0.5791239",
"0.57911706",
"0.57883483",
"0.5786262",
"0.5780699",
"0.57734406",
"0.5773421",
"0.5772245",
"0.57681763",
"0.57667255",
"0.5766514",
"0.57639617",
"0.57622075",
"0.576093",
"0.576093",
"0.57425094",
"0.57404083",
"0.5731016",
"0.572491",
"0.57211584",
"0.57170486",
"0.5714093",
"0.57120675",
"0.57119346",
"0.57119346",
"0.5706655",
"0.57062936",
"0.56973374",
"0.56973374",
"0.56904656",
"0.56904656",
"0.5689543",
"0.56882215",
"0.56691504",
"0.5665432",
"0.5664653",
"0.5654683",
"0.5652564",
"0.5650582",
"0.5641791",
"0.5638354",
"0.5627583"
] |
0.60494775
|
30
|
Instantiate key object based on contents of raw_line
|
def load_raw_line opts = OPTS_REGEX.keys
self.raw_line.chomp!
opts.each do |xfield|
pattern = OPTS_REGEX[xfield]
did_set = raw_setter xfield, pattern
#puts did_set
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize( body, line=nil, column=nil )\n\t\tsuper\n\n\t\tkey = self.body[ /^([a-z]\\w+)$/ ] or\n\t\t\traise Inversion::ParseError,\n\t\t\t\t\"malformed key: expected simple identifier, got %p\" % [ self.body ]\n\t\t@key = key.to_sym\n\tend",
"def parse_key(string)\n @key_factory.parse(string)\n end",
"def load_pubkey\n #filter line data\n load_raw_line([:key_data,:key_type,:note]) \n \n # sanitize old raw line\n self.raw_line = self.gen_raw_line\n end",
"def initialize(args={}) \n ATTRIBUTES.each do |attr|\n instance_variable_set(\"@#{attr}\", args.has_key?( attr ) ? args[attr] : nil )\n end\n\n self.raw_line = args[:raw_pubkey] || args[:raw_line]\n\n if args.has_key? :raw_pubkey\n self.load_pubkey\n return\n end\n\n unless self.raw_line.nil? \n self.load_raw_line\n end\n end",
"def initialize(io)\n @keys = {}\n io.each do |line|\n next if /^\\s*#/ =~ line\n tokens = line.chomp.split(',').map(&:strip)\n next if tokens.length < 1\n if tokens[0].length > 1\n params = tokens.map do |t|\n kvp = t.split('=').map(&:strip)\n [kvp[0].to_sym, kvp[1].to_f]\n end\n @params = Hash[params]\n elsif tokens.length == 5\n bounds = tokens[1..-1].map do |t|\n kvp = t.split('=').map(&:strip)\n [kvp[0].to_sym, kvp[1].to_f]\n end\n key = tokens[0].empty? ? ' ' : tokens[0]\n @keys[key] = Hash[bounds]\n end\n end\n raise 'Not enough keys.' if @keys.length < 27\n end",
"def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end",
"def initialize(order_line_key)\n self.order_line_key = order_line_key\n end",
"def construct_hash(path, line)\n host = Socket.gethostname\n \n {\n :source_path => path,\n :line => line,\n :source_host => host,\n :timestamp => Time.now.utc.iso8601(6),\n :source => Addressable::URI.new(:scheme => 'file', :host => host, :path => path),\n :type => '',\n :fields => {},\n :tags => []\n }\n end",
"def initialize(line)\n @line = line\n end",
"def initialize line\n\n attributes = [:icao, :latitude, :longitude]\n\n line_split = line.strip.split(\":\")\n\n attributes.each_with_index.map { |attribute, index|\n instance_variable_set(\"@#{attribute}\", line_split[index]) if self.respond_to?(attribute)\n }\n end",
"def initialize(key, text)\n super()\n @key = key\n @text = text\n end",
"def initializing_reader(key); end",
"def parse_key(key)\n end",
"def initialize(line)\n cols = line.chomp.split \"\\t\"\n name = [ cols[0], cols[2,4] ]\n @readName = name.flatten.join(':') + '#' + cols[6] + '/' + cols[ 7 ] \n @seq = cols[ 8 ]\n @qvList = cols[ 9 ].each_byte.map {|i| i - 64 }\n @chrom = cols[ 10 ]\n @offset = cols[ 12 ].to_i\n @strand = cols[ 13 ]\n @filter = cols[ 21 ]\n end",
"def initialize key , valor, linea, columna\n @key = key \n @valor = valor\n @linea = linea\n @columna = columna\n end",
"def initialize line\n attributes = [:hostname_or_IP, :location, :name, :clients_connection_allowed, :type_of_voice_server]\n\n line_split = line.split(\":\")\n\n attributes.each_with_index.map { |attribute, index|\n instance_variable_set(\"@#{attribute}\", line_split[index]) if self.respond_to?(attribute)\n }\n end",
"def import_line(line)\n line_array = line.split(\"\\t\") #? name\n\n # destructuring\n @name, @cuisine, @price = line_array\n\n return self # returns the OBJECT\n end",
"def initialize(key)\n @key = key\n end",
"def initialize(key)\n @key = key\n end",
"def from_h!(value)\n value = {} if value.nil?\n self.line = value['line']\n self.character = value['character']\n self\n end",
"def create_record(line, line_number = -1) #:nodoc:\n h = Hash.new\n\n pack_format = self.class.get_subclass_variable 'pack_format'\n fields = self.class.get_subclass_variable 'fields'\n\n f = line.unpack(pack_format)\n (0..(fields.size-1)).map do |index|\n unless fields[index].is_padding?\n h.store fields[index].name, fields[index].pass_through_filters(f[index])\n end\n end\n Record.new(self.class, h, line_number)\n end",
"def load_attributes(path, key)\n Atlas::Parser::TextToHash::Base.new(path.read).to_hash\n rescue Atlas::ParserError => ex\n ex.path = path\n fail ex\n end",
"def parse!\n if /^(?<key>.*?):(?<value>.*)/m =~ @raw\n @key = key.strip\n @value = value.strip\n else\n raise \"Unable to parse Header: #{@raw}\"\n end\n end",
"def initialize(line)\n @argtype = line.split(\" \")[0].to_sym\n end",
"def custom_reader(key); end",
"def initialize(file_string)\n @data = file_string\n @keywords = Hash.new\n end",
"def initialize(line)\n split = line.split(\" \")\n self.command=split[0]\n self.user_name=split[1]\n\n case split.length\n when 3\n self.amount = split[2]\n when 4\n self.account_number = split[2]\n self.limit = split[3] \n end\n\n self.standardize\n @@all << self\n end",
"def initialize(key)\n\t\t@key = key\n\tend",
"def retrieve_key_string_from_stream(stream)\n return stream.read if stream.respond_to?(:read)\n return File.read(stream) if stream.to_s !~ /^-+BEGIN .* KEY-+$/\n stream\n end",
"def initialize(line)\n splits = line.split(\" \")\n @function = splits[1].to_sym\n @arg = splits[3].to_sym\n @return = splits[5].to_sym\n end",
"def initialize(handle, record_type)\n\t\t\t@prefix = read_string(handle)\n\t\t\t@name = read_dictstring(handle)\n\t\t\t@value = Record.MakeRecord(handle)\n\t\tend",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def process(line)\n parts = line.chomp.split(/\\t/)\n keys = line_key(parts)\n keys.each do |k|\n yield [k, *parts]\n end\n end",
"def initialize(path_or_key)\n if path_or_key.respond_to?(:head) && path_or_key.respond_to?(:tail)\n @head = path_or_key.head\n @tail = path_or_key.tail\n else\n path = path_or_key.to_s\n segments = path.nil? ? [] : path.split(SEPARATOR)\n\n unless segments.empty?\n @head = segments.shift\n @tail = segments.empty? ? nil : Key.new(segments.join(SEPARATOR))\n end\n end\n end",
"def get_key(line)\n line.match(/-k ([^ ]+)/)[1]\n end",
"def load_string(str, str_info=nil)\n exprs = str.split(/^keycode/)\n inst = self.new()\n inst.parse_keymap_expressions(exprs[0], *exprs[1..-1].map {|exp| \"keycode#{exp}\" })\n inst.info(KeyMapInfo.load_string(str_info)) if str_info\n inst\n end",
"def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = {}\n \n File.open(file, \"r:UTF-8\").each do |line| \n if line.include? \":\"\n splited_line = line.encode!('UTF-8').strip.split(':')\n @properties[splited_line[0]] = splited_line[1] \n end \n end\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def initialize\n self.lines = { \n \n :victoria => [:kings_cross, :euston, :warren_street, :oxford_circus, :green_park, :victoria, :pimlico], \n \n :bakerloo => [:elephant_castle, :lambeth_north, :waterloo, :embankment, :charing_cross, :picadilly_circus, :oxford_circus, :regents_park, :baker_street], \n \n :central => [:notting_hill_gate, :queensway, :lancaster_gate, :marble_arch, :bond_street, :oxford_circus, :tottenham_court_road, :holborn, :chancery_lane] \n }\n\n end",
"def initialize(line)\n fields = line.split\n @ip = fields[0]\n @event = nil\n @status = fields[8]\n @method = fields[5].sub('\"', '')\n @path = fields[6].sub(/\\?.*/, '')\n @event_time = parse_time(fields[3] + fields[4])\n @pid = nil\n @agent = line.split('\"')[5]\n end",
"def initialize(key, filename, content)\n @key = key\n @filename = filename\n @content = content\n end",
"def initialize(raw_ls_line,\n basename: nil,\n type: nil,\n mtime: nil,\n filesize: nil,\n server_type: nil,\n symlink_destination: nil) #:nodoc:\n @raw = raw_ls_line.respond_to?(:force_encoding) ? raw_ls_line.force_encoding('utf-8') : raw_ls_line\n @basename = basename || ''\n @type = type\n @mtime = mtime || Time.now\n @filesize = filesize || 0\n @server_type = server_type || 'Unknown'\n @symlink_destination = symlink_destination\n end",
"def initialize( key_string = nil )\n self.key_string = key_string\n end",
"def initialize(key_base64)\n @key = key_base64\n end",
"def import_key_string(key_string, activation_date: Time.now)\n rnp = load_key_string(key_string)\n all_keys(rnp).map do |raw|\n metadata = raw.json\n creation_hash = creation_params(\n raw: raw, activation_date: activation_date, metadata: metadata,\n )\n create(creation_hash)\n end\n end",
"def make_entry()\n\n seq_id = @filehandler.readline.chomp\n puts seq_id\n sequence = @filehandler.readline.chomp\n identifier = @filehandler.readline.chomp\n quality = @filehandler.readline.chomp\n\n Entry.new(seq_id, sequence, identifier, quality)\n end",
"def initialize(key, data_file_name)\n # Get a handle on the file.\n data_file = Pathname.new(__FILE__).dirname + 'data' + data_file_name.to_s\n raise ArgumentError, \"No such file #{data_file.to_s}\" unless data_file.exist?\n\n # Parse\n @data = case data_file.extname\n when '.json'\n JSON.parse( data_file.read, :symbolize_names => true )\n else\n raise ArgumentError \"Cannot parse files of type #{data_file.extname}\"\n end\n\n # Set key and freeze\n @key = key.freeze\n @data.freeze\n end",
"def initialize(key_value)\n @key_value = key_value\n end",
"def fill_hash_record_from_line(column_names, headers, line)\n hash_record = {}\n fields = line.split(@sep)\n\n fields.each_with_index do |field, field_id|\n hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])\n end\n\n hash_record\n end",
"def initialize(lines, options = {})\n if lines.is_a?(String)\n lines = lines.split(\"\\n\")\n end\n self.meta = {}\n in_meta = true\n while in_meta and line = lines.shift do\n line.strip!\n matches = line.match /^([^:]+):\\s+(.+)/\n if matches\n if matches[1] =~ /(Chapter|Number|Position)/i and matches[2] =~ /\\d+/ and number.nil?\n self.number = matches[2].strip.to_i\n end\n self.meta[matches[1].downcase.to_sym] = matches[2]\n else\n lines = [line] + lines if line\n in_meta = false \n end\n end\n self.meta.merge!(options)\n self.file_name = self.meta[:file_name]\n self.content = lines.join\n end",
"def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end",
"def key\n Key.new(text: @head.fetch[3])\n end",
"def initialize(key, encoding = :raw)\n @key = Encoder[encoding].decode(key)\n Util.check_length(@key, self.class::KEYBYTES, \"#{self.class} key\")\n end",
"def read_key; end",
"def from_simple_key(key)\n key\n end",
"def initialize(*args)\n # Don't allow an object to be created unless key values are provided and a list of keys has been defined at the class level\n raise ArgumentError unless args[0].has_keys?(self.class.keys) and !(self.class.keys.empty?)\n args.each do |arg|\n raise ArgumentError, 'Creating a Record expects a hash as an argument' unless arg.is_a?(Hash)\n arg.each do |k, v|\n self.send(\"#{k.to_s}=\".to_sym, v)\n end\n end\n # create the primary key for this record then\n # store the pk and the record in the records class instance variable\n # Use a non-printable character as the delimiter \\x01 to avoid code/data conflicts\n self.class.records[self.class.build_key(self)] = self\n end",
"def initialize\n @original_line = \"\"\n @id = -1\n @pos = []\n @grade = \"\"\n @classifier = false\n @headword_trad = \"\"\n @headword_simp = \"\"\n @headword_en = \"\"\n @pinyin = \"\"\n @pinyin_diacritic = \"\"\n @meanings = []\n @is_erhua_variant = false\n @is_archaic_variant = false\n @variant_of = false\n @priority_word = false\n \n # There can be more than one of these\n @references = []\n end",
"def parse_entry(raw_entry)\n match_data = /#{@entry_regexp}/.match(raw_entry)\n return nil unless match_data\n values = match_data.captures\n values.shift if @multiline\n entry_hash([raw_entry, values].flatten)\n end",
"def initialize(file_line, pid_dictionary)\n line_elements = file_line.split(\" \")\n \n @t0 = line_elements.shift.to_i\n @process_name = line_elements.shift\n @tf = line_elements.shift.to_i\n @number_of_bytes = line_elements.shift.to_i\n @pid = assign_pid(pid_dictionary)\n\n @memory_accesses = []\n until line_elements.empty?\n @memory_accesses << [line_elements.shift.to_i, line_elements.shift.to_i]\n end\n end",
"def initialize(line: nil)\n @line = line\n @current_command_type = EXPORT_COMMAND if export?\n @current_command_type = ALIAS_COMMAND if alias?\n process_attributes! unless line?\n end",
"def initialize(string, start_line_number = 1)\n super(string)\n @start_line_number = start_line_number || 1\n @previous_pos = 0\n @previous_line_number = @start_line_number\n end",
"def parse_key_value_line(line)\n (key, value) = line.strip.split('=')\n key.strip! if key\n value.strip! if value\n [key, value]\n end",
"def from_file line\n\t\tvals = line.split(\"-\")\n\t\t@type = vals[0].to_i\n\t\t@obj = vals[1]\n\t\tif vals[2] != nil\n\t\t\t@sensor = vals[2]\n\t\tend\n\t\tif vals[3] != nil\n\t\t\t@value = vals[3].to_f\n\t\tend\n\tend",
"def initialize(entry, tagsize)\n @tagsize = tagsize\n @orig = entry2hash(entry.strip)\t# Hash of the original entry\n @data = {}\t\t\t\t# Hash of the parsed entry\n end",
"def from_hash(data)\n @group = data[\"group\"]\n @file = data[\"source\"]\n\n self\n end",
"def initialize(entry, tagsize)\n @tagsize = tagsize\n @orig = entry2hash(entry.strip)\t# Hash of the original entry\n @data = {}\t\t\t# Hash of the parsed entry\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 parse!(raw)\n\n return false if raw.size != ID3::ID3v1tagSize\n\n if (raw[ID3v1versionbyte] == 0) \n @version = \"1.0\"\n else\n @version = \"1.1\"\n end\n\n self.clear # remove all entries from Hash, we don't want left-overs..\n\n ID3::SUPPORTED_SYMBOLS[@version].each{ |key,val|\n if val.class == Range\n # self[key] = raw[val].squeeze(\" \\000\").chomp(\" \").chomp(\"\\000\")\n self[key] = raw[val].strip\n elsif val.class == Fixnum\n self[key] = raw[val].to_s\n else \n # this can't happen the way we defined the hash..\n # printf \"unknown key/val : #{key} / #{val} ; val-type: %s\\n\", val.class\n end \n }\n @raw = raw\n return true\n end",
"def initialize(key, encoding = :raw)\n key = Encoder[encoding].decode(key)\n Util.check_length(key, NaCl::PUBLICKEYBYTES, \"key\")\n\n @key = key\n end",
"def underbang_reader(key); end",
"def new_key(start)\n start = start.to_i\n key = Key.new(start)\n @keys[key.keyid] = key\n key.keyid\n end",
"def parse_simple_snippet(file)\n @cur_snippet = {}\n\n file.each_line do |line|\n if line =~ KEY_RE\n cur_key = $1\n\n elsif line =~ VALUE_RE\n @cur_snippet[cur_key] = $1\n end\n end\n end",
"def construct str, filename\n found = match str.to_s\n raise ArgumentError, str.to_s unless found\n if found[:name] == 'func_'\n placeholders = @@placeholders[@@func_index += 1]\n if placeholders.nil? or placeholders.empty?\n raise ArgumentError, \"expected placeholders for line: #{str}\"\n end\n placeholders.collect do |placeholder|\n new placeholder.dup, found[:s4_class], found[:args], filename\n end\n else\n new found[:name], found[:s4_class], found[:args], filename\n end\n end",
"def kv_decode(s); Hash[*s.split(10.chr).map {|l| l.split(\":\", 2) }.flatten] end",
"def initialize(key, value)\n @key = key\n @value = value\n end",
"def initialize(key)\n @key = key.to_s\n @downcase_key = @key.downcase\n @hashed = @downcase_key.hash\n end",
"def parse(use_line)\n load_properties(use_line.split(\",\"))\n self\n end",
"def initialize(str)\n fail \"Error, expectin a String in input.\" unless str.is_a? String\n @line = str\n end",
"def initialize(id, key='')\n @_id = id\n @_key = key\n end",
"def read(_ = nil)\n as_hash(read_lines)[base_name]\n end",
"def initialize(key)\n @id = case key\n when Kademlia::DataKey then key.to_bin\n when String\n case key.size\n # If it's in the right format\n when Size then key\n # If it's hex\n when Size * 2 then [key].pack('H*')\n end\n when Integer\n @int_val = key\n [\"%0#{Size}d\" % key.to_s(16)].pack('H*')\n end\n\n raise ArgumentError, \"#{key} is not a valid key.\" if @id.nil?\n end",
"def initialize(line)\n splits = line.split(\" \")\n @function = splits[0].to_sym\n words = splits.length\n rol = splits[1..(words-1)]\n @args = findargs(rol)\n @returns = findrets(rol)\n end",
"def from_s(header)\n reset\n\n # ghettoooooo!\n # If we don't have any newlines..., put one there.\n if (header.size > 0 && header !~ /\\r\\n/)\n header << \"\\r\\n\"\n end\n\n # put the non-standard line terminations back to normal\n # gah. not having look behinds suck,\n header.gsub!(/([^\\r])\\n/n,'\\1' + \"\\r\\n\")\n\n # undo folding, kinda ugly but works for now.\n header.gsub!(/:\\s*\\r\\n\\s+/smni,': ')\n\n # Extract the command string\n self.cmd_string = header.slice!(/.+\\r\\n/)\n\n # Extract each header value pair\n header.split(/\\r\\n/mn).each { |str|\n if (md = str.match(/^(.+?)\\s*:\\s*(.+?)\\s*$/))\n if (self[md[1]])\n self[md[1]] << \", \" + md[2]\n else\n self[md[1]] = md[2]\n end\n end\n }\n end",
"def store(line)\n line_list = (line.strip).split(YakvdConstants.delimiter)\n k = line_list[0]\n v = line_list[1]\n @store_[k] = v\n end",
"def initialize(line = nil)\n @line = line || ''\n end",
"def parse(source, separator)\n source.map { |pair|\n raw_key, key = pair.split(separator, 2)\n key = raw_key if key.nil? || key == ''\n\n [raw_key, key]\n }\n end",
"def initialize( key )\n @key = Kernel.Array(key)\n end",
"def initialize(raw, prefix, command, params)\n @raw = raw\n @prefix = prefix\n @command = command\n @params = params\n @text = params.last unless params.empty?\n\n @symbol = command.downcase.to_sym\n @data = {}\n @args = {}\n @irc = nil\n end",
"def parse(line)\n\t\titems = line.split(' ')\n\t\trecord = {}\n\t\t# debugger\n\t\trecord[:event] = items[0]\n\t\trecord[:time] = items[1]\n\t\trecord[:fnode] = items[2]\n\t\trecord[:tnode] = items[3]\n\t\trecord[:pktype] = items[4]\n\t\trecord[:pktsize] = items[5]\n\t\trecord[:fid] = items[7]\n\t\trecord[:srcadd] = items[8]\n\t\trecord[:desadd] = items[9]\n\t\trecord[:seqnum] = items[10]\n\t\trecord[:pktid] = items[11]\n\t\trecord\n\tend",
"def initialize filename\n\t\tFile.open(filename) do |f|\n\t\t\ts = f.gets\n\t\t\tputs \"first line of the vineRecord file (should be the entire json string): #{string}\"\n\t\tend\n\n\t\t@record = JSON.parse(s)\n\tend",
"def initialize(string, file, line_index = nil)\n @string = string.freeze\n @file = file.freeze\n @prev_offset = nil\n @prev_line = nil\n @line_index = line_index.nil? ? Locator.compute_line_index(@string) : line_index\n end",
"def initialize\n @separator = \":\"\n @prefix = \"\"\n @suffix = \"\"\n @keys = {}\n end",
"def initialize(key, value, token_type, options)\n raise 'key is not a symbol' unless key.is_a?(Symbol)\n\n self.key = key\n self.value = value\n self.token_type = token_type\n self.options = options\n end",
"def parse_line(line)\n ln, fn, mi, sex, fav_color, dob = line.split(' | ')\n LineParser.to_h(fn, ln, mi, sex, fav_color, parse_dob(dob))\n end",
"def initialize(line, cookbook, options = {})\n Strainer.ui.debug \"Created new command from '#{line}'\"\n @label, @command = line.split(':', 2).map(&:strip)\n Strainer.ui.debug \" Label: #{@label.inspect}\"\n Strainer.ui.debug \" Command: #{@command.inspect}\"\n @cookbook = cookbook\n end",
"def initialize_input_hash(filename)\n input = {}\n File.open(filename, 'r') do |file|\n while line = file.gets\n input[line.to_i] = true\n end\n end\n input\nend",
"def load_node(line)\n name, klass, parent = line.split(field_sep)\n [klass.constantize.new(name, nil), parent]\n end",
"def initialize(line, qfasta_file, tfasta_file)\n a = line.split\n @qid = a[0]\n @qstart = a[1].to_i\n @qend = a[2].to_i\n @qstrand = a[3]\n @tid = a[4]\n @tstart = a[5].to_i\n @tend = a[6].to_i\n @tstrand = a[7]\n @score = a[8]\n @cigar = a[9..-1].each_slice(2).to_a.map{|a, b| [a, b.to_i]}\n\n @qfasta_file = qfasta_file\n @tfasta_file = tfasta_file\n end",
"def instantiate(raw_record)\n record = self.allocate\n record.deserialize(raw_record)\n record.preinitialize(raw_record)\n record.instance_variable_set(:@new_record, false)\n record.send(\"safe_attributes=\", raw_record, false)\n record\n end"
] |
[
"0.71902066",
"0.63361585",
"0.6314107",
"0.621172",
"0.61955464",
"0.59886926",
"0.5984003",
"0.5974245",
"0.59481716",
"0.58967143",
"0.58763695",
"0.5792431",
"0.57266515",
"0.5715586",
"0.57128125",
"0.5689253",
"0.56768274",
"0.5663554",
"0.5663554",
"0.56400365",
"0.56344",
"0.56230175",
"0.55822253",
"0.5576218",
"0.5560636",
"0.5555914",
"0.55500025",
"0.5531119",
"0.5521307",
"0.54993206",
"0.5471675",
"0.5450716",
"0.54506826",
"0.54383266",
"0.5437464",
"0.5437105",
"0.5421436",
"0.54134774",
"0.5395886",
"0.53856456",
"0.5384292",
"0.53780854",
"0.5376798",
"0.53751826",
"0.53721786",
"0.535674",
"0.53519756",
"0.53475547",
"0.5342135",
"0.5338547",
"0.533595",
"0.5328928",
"0.5319421",
"0.5306107",
"0.5303038",
"0.52975136",
"0.5291078",
"0.52902323",
"0.52883166",
"0.5285866",
"0.5281401",
"0.5281249",
"0.5262734",
"0.52547157",
"0.52531946",
"0.5249144",
"0.5246568",
"0.5246484",
"0.52427447",
"0.5239659",
"0.52364457",
"0.5227454",
"0.5225738",
"0.52251035",
"0.52249473",
"0.52247375",
"0.5205664",
"0.52043724",
"0.52041554",
"0.52010816",
"0.51989555",
"0.51966494",
"0.51932335",
"0.5192057",
"0.518652",
"0.5181659",
"0.5179029",
"0.51786935",
"0.5171696",
"0.5160993",
"0.5158765",
"0.51553804",
"0.5152456",
"0.51503056",
"0.5149738",
"0.51492864",
"0.51356196",
"0.51351255",
"0.5133607",
"0.51324797"
] |
0.5154162
|
92
|
set attribute (field) obtained from matching pattern in raw_line
|
def raw_setter xfield,pattern
field = "@#{xfield}"
m = self.raw_line.match pattern
return false if m.nil?
#p "#{field} => #{m.inspect}"
if BOOL_ATTRIBUTES.include? xfield
self.instance_variable_set(field, true)
return true
end
if STR_ATTRIBUTES.include? xfield
self.instance_variable_set(field, m[1])
return true
end
if ARR_STR_ATTRIBUTES.include? xfield
self.instance_variable_set(field, m.to_a)
return true
end
if SUB_STR_ATTRIBUTES.include? xfield
self.instance_variable_set(field, m[1])
return true
end
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_raw_line opts = OPTS_REGEX.keys\n self.raw_line.chomp!\n opts.each do |xfield|\n pattern = OPTS_REGEX[xfield]\n did_set = raw_setter xfield, pattern\n #puts did_set\n end\n end",
"def initialize line\n\n attributes = [:icao, :latitude, :longitude]\n\n line_split = line.strip.split(\":\")\n\n attributes.each_with_index.map { |attribute, index|\n instance_variable_set(\"@#{attribute}\", line_split[index]) if self.respond_to?(attribute)\n }\n end",
"def initialize line\n attributes = [:hostname_or_IP, :location, :name, :clients_connection_allowed, :type_of_voice_server]\n\n line_split = line.split(\":\")\n\n attributes.each_with_index.map { |attribute, index|\n instance_variable_set(\"@#{attribute}\", line_split[index]) if self.respond_to?(attribute)\n }\n end",
"def line=(line)\n @parsed_rules.line = line if @parsed_rules\n super\n end",
"def parse\n @lines.each do |line|\n if m = line.match(R_ATTRIBUTE)\n @attrs << {:name => m[1].strip, :type => m[2].strip, :desc => m[4].strip}\n elsif m = line.match(R_ATTRIBUTE_NEXT_LINE)\n @attrs[-1][:desc] += \" #{m[1].strip}\"\n end\n end\n end",
"def line=(line)\r\n members.each {|m| m.line = line}\r\n @line = line\r\n end",
"def parse_line(line)\n is = new\n line =~ /(.+)\\s+<-\\s+(.+?)\\s+\\((\\d+\\.\\d)(?:\\/(\\d+))?,\\s+(\\d+\\.\\d)\\)/\n consequent, antecedent, support, transactions, confidence = $1, $2, $3, $4, $5\n is.consequent = consequent \n is.antecedent = antecedent.split(/\\s+/)\n is.support = support.to_f\n is.num_antecedent_transactions = transactions ? transactions.to_i : nil\n is.confidence = confidence.to_f\n is\n end",
"def parse(line)\n @pattern, *@owners = line.split(/\\s+/)\n @whitespace = line.split('@').first.count(' ') - 1\n @spec = parse_spec(@pattern)\n end",
"def parse(line)\n row = line.to_s\n row.chomp!\n row.strip!\n return unless match = regexp.match(row)\n\n data = {}\n names.each_with_index { |field, index| data[field] = match[index + 1] } # [0] == line\n data\n end",
"def parse_line(line)\n ln, fn, mi, sex, fav_color, dob = line.split(' | ')\n LineParser.to_h(fn, ln, mi, sex, fav_color, parse_dob(dob))\n end",
"def parse(line)\n row = line.to_s\n row.chomp!\n row.strip!\n return unless match = regexp.match(row)\n\n data = {}\n names.each_with_index { |field, index| data[field] = match[index + 1] } # [0] == line\n data\n end",
"def extract_id_line model_attributes, line,item,dtypes\n #look if id is mapped to another field\n id_keys = model_attributes.to_hash.keys\n #hotfix..bad performance\n id_keys.map!{|k| k.to_s }\n id_key= id_keys.select{|k| k =~/^(ID|id|iD|Id)$/ }\n if id_key.empty?\n line[:id] = item.id\n else\n line[:id] = eval(\"item.#{model_attributes[id_key[0].to_sym]}\")\n #set the correct datatype for it\n dtypes[\"id\"]= dtypes[id_key[0]]\n #remove the id line\n line.delete id_key[0]\n end\n end",
"def parse_line_data(line)\n line.strip.gsub('\"', '').split ' = '\n end",
"def parse_attribute_row(f)\n\ta = Attribute.new\n\ta.nome = f.readline.chomp.strip\n\tif a.nome.empty? then return nil end\n\ta.tipo = f.readline.chomp.strip\n\ta.nullable = f.readline.upcase['NO'] != nil\n\ta.key = f.readline.chomp.strip\n\tif a.key.empty? then a.key = false end\n\ta.default = f.readline.chomp.strip\n\tif a.default.empty? then a.default = nil end\n\treturn a\nend",
"def parse(use_line)\n load_properties(use_line.split(\",\"))\n self\n end",
"def transform_line(line, index)\n return enum_for(:transform_line, line, index) unless block_given?\n\n identifier = case @row_identifier.to_s\n when 'index'\n index\n when 'uuid'\n SecureRandom.uuid\n end\n\n masked_mappings.each do |klass, klass_mappings|\n fields = mapped_line(line, klass_mappings)\n fields['row_identifier'] = identifier unless identifier.nil?\n next if fields[:skip].to_s == 'true'\n yield(klass, fields, index)\n end\n end",
"def []= field, value\n @attributes[field] = value\n end",
"def process_line(line)\n @line = line\n if line =~ /^=/ then\n process_heading_line(line)\n elsif (listtype = special_list_line_type(line)) then\n special_list_line(listtype, line)\n elsif line =~ /^\\s*:/ then\n special_list_continuation_line(line)\n else\n @interp.normal_line(line)\n end\n end",
"def parse_attr(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg 1\n if args.size > 0 then\n name = args[0]\n rw = \"R\"\n skip_tkspace_without_nl\n tk = get_tk\n\n if :on_comma == tk[:kind] then\n rw = \"RW\" if get_bool\n else\n unget_tk tk\n end\n\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n\n read_documentation_modifiers att, RDoc::ATTR_MODIFIERS\n else\n warn \"'attr' ignored - looks like a variable\"\n end\n end",
"def import_line(line)\n line_array = line.split(\"\\t\") #? name\n\n # destructuring\n @name, @cuisine, @price = line_array\n\n return self # returns the OBJECT\n end",
"def process(line)\n # parse values\n article_id, attribute_key, attribute_value = parse_line(line)\n\n article_id = parse_article_id(article_id)\n attribute_value = parse_attribute_value(attribute_value)\n attribute_key = parse_attribute_key(attribute_key)\n\n # check if is a new article\n if @article.id_specific != article_id\n @article = Entity.new\n @article.id = ID::parse(article_id)\n @article.id_specific = article_id\n @changed = true\n else\n @changed = false\n end\n\n # add attributes to article\n if not @article.attributes.has_key? attribute_key\n @article.attributes[attribute_key] = []\n end\n\n @article.attributes[attribute_key] << attribute_value\n return @article\n end",
"def handle_text_line(line, record)\n line =~ record.match ? {:record_type => record.name, :line => line} : nil\n end",
"def parse_line(line)\n results = LineRegexp.match(line)\n if results \n @elements[:line] = results[-1]\n results[-1] # remaining line \n else\n @elements[:line] = line\n line \n end\n end",
"def scan_line(line)\n e = { orig: line }\n entry_pattern.match(line) do |m|\n e.update(extract_groups(m))\n end\n e\n end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def do_attrs\n @content.scan(/rb_attr\\s*\\(\n \\s*(\\w+),\n \\s*([\\w\"()]+),\n \\s*([01]),\n \\s*([01]),\n \\s*\\w+\\);/xm) do |var_name, attr_name, read, write|\n handle_attr var_name, attr_name, read, write\n end\n\n @content.scan(%r%rb_define_attr\\(\n \\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(\\d+),\n \\s*(\\d+)\\s*\\);\n %xm) do |var_name, attr_name, read, write|\n handle_attr var_name, attr_name, read, write\n end\n end",
"def from_file line\n\t\tvals = line.split(\"-\")\n\t\t@type = vals[0].to_i\n\t\t@obj = vals[1]\n\t\tif vals[2] != nil\n\t\t\t@sensor = vals[2]\n\t\tend\n\t\tif vals[3] != nil\n\t\t\t@value = vals[3].to_f\n\t\tend\n\tend",
"def initialize(line)\n @line = line\n end",
"def set_attribute(name, value); end",
"def parse_bx_line(line)\n @current_train.update_from_cif line\n end",
"def method_missing(method, *params)\n raw_line.send method, *params\n end",
"def setLine (line)\n @line = line\n end",
"def parse(src)\n recAttrParse(src)\n updateKey\n self\n end",
"def apply_attributes(string)\n string.gsub ATTRIBUTE_REGEXP do |match|\n key, value = match.match(ATTRIBUTE_REGEXP).to_a[1..2]\n self[key] = value\n ''\n end\n end",
"def populate(line, msg)\n @line = line\n @sequence = msg['sequence']\n @depth = msg['depth']\n @cmd = msg['cmd']\n @kind = msg['kind']\n @msg = msg['msg']\n @key = msg['key']\n end",
"def process_attributes!\n if !@current_command_type.nil?\n @expression = Confinicky::Parsers::Expression.new(statement: @line.gsub(/\\A#{@current_command_type} /,\"\"))\n @name = @expression.name\n @value = @expression.value\n end\n end",
"def initialize(line)\n cols = line.chomp.split \"\\t\"\n name = [ cols[0], cols[2,4] ]\n @readName = name.flatten.join(':') + '#' + cols[6] + '/' + cols[ 7 ] \n @seq = cols[ 8 ]\n @qvList = cols[ 9 ].each_byte.map {|i| i - 64 }\n @chrom = cols[ 10 ]\n @offset = cols[ 12 ].to_i\n @strand = cols[ 13 ]\n @filter = cols[ 21 ]\n end",
"def process_attributes(rest_of_line)\n @tag_attributes = []\n while rest_of_line != \"\" do\n # If '=' doesn't exist, empty attribute string and break from loop\n if rest_of_line.index('=') == nil\n break\n elsif rest_of_line.index('=') != nil and rest_of_line.index('<') != nil and rest_of_line.index('<') < rest_of_line.index('=')\n break\n end\n \n first_equals_index = rest_of_line.index '='\n embedded_attribute = false\n \n if rest_of_line[first_equals_index+1..first_equals_index+2] == '{{'\n embedded_attribute = true\n close_index = rest_of_line.index '}}'\n if close_index == nil\n raise CompilerException, \"Unmatched '{{' found in line #{@line_number}\"\n end\n elsif rest_of_line[first_equals_index+1..first_equals_index+2] == '<%'\n embedded_attribute = true\n close_index = rest_of_line.index '%>'\n if close_index == nil\n raise CompilerException, \"Unmatched '<%' found in line #{@line_number}\"\n end\n end\n \n if embedded_attribute\n current_attribute = rest_of_line[0..close_index+1]\n if rest_of_line.length == close_index + 2\n rest_of_line = \"\"\n else\n rest_of_line = rest_of_line[close_index+2..-1]\n end\n \n elsif rest_of_line.length == first_equals_index\n current_attribute = rest_of_line.strip\n rest_of_line = \"\"\n \n elsif rest_of_line[first_equals_index + 1..-1].index('=') == nil\n open_inner_text_index = rest_of_line.index('<')\n if open_inner_text_index != nil\n current_attribute = rest_of_line[0..open_inner_text_index-1].strip\n rest_of_line = rest_of_line[open_inner_text_index..-1]\n else\n current_attribute = rest_of_line * 1\n rest_of_line = \"\"\n end\n \n else\n second_equals_index = rest_of_line[first_equals_index + 1..-1].index '='\n reversed_letters_between_equals = rest_of_line[first_equals_index+1..first_equals_index + 1 + second_equals_index - 1].split(\"\").reverse\n \n whitespace_index = nil\n i = 0\n for char in reversed_letters_between_equals do\n if \" \\t\".index(char) != nil\n whitespace_index = first_equals_index + 1 + second_equals_index - i\n break\n end\n i += 1\n end\n \n if whitespace_index == nil\n # TODO: Do some error reporting here\n break\n end\n \n current_attribute = rest_of_line[0..whitespace_index-1].strip\n rest_of_line = rest_of_line[whitespace_index..-1]\n end\n \n if current_attribute != nil\n equals_index = current_attribute.index '='\n @tag_attributes << ' ' + current_attribute[0..equals_index-1] + '=\"' + current_attribute[equals_index+1..-1] + '\"'\n end\n end\n \n rest_of_line.strip\n end",
"def match_general(line, lineno, file)\n rec = nil\n if (md = match_general_regex(file).match(line))\n label = md[1]\n text = md[2]\n rec = Note.new(self, file, label, lineno, text, remark(file))\n end\n rec\n end",
"def process_raw(raw, line_number)\n raw\n end",
"def line=(_); end",
"def line=(_); end",
"def parse_line(line)\n ln, fn, sex, fav_color, dob = line.split(', ')\n LineParser.to_h(fn, ln, nil, sex, fav_color, parse_dob(dob))\n end",
"def add_parsed_line (parsed_line)\n value_hash = parsed_line[:line_definition].convert_captured_values(parsed_line[:captures], self)\n value_hash[:line_type] = parsed_line[:line_definition].name\n value_hash[:lineno] = parsed_line[:lineno]\n add_line_hash(value_hash)\n end",
"def match(line)\n regex = self.to_regexp\n regex.match(line.value)\n end",
"def line_postprocess(line)\n # Forces the values to be ASCII strings\n asciify(line)\n\n line[:quotation_time] = ::Nordea.parse_time(line[:quotation_time])\n line[:reserved].strip! if line[:reserved].respond_to? :strip!\n fill_proper_rate_type(line)\n\n line[:euro_area] = (line[:euro_area] == '1')\n\n line[:euro_adoption_date] = if line[:euro_area]\n Nordea.parse_date(line[:euro_adoption_date])\n else\n nil\n end\n\n line[:currency_expiry] = (line[:currency_expiry] == 'K')\n line[:currency_convertability] = (line[:currency_convertability] == 'K')\n floatify(line)\n\n line\n end",
"def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end",
"def parse_bsr_line(line)\n finish_current_train\n @current_train = TrainSchedule.new\n @current_train.update_from_cif line\n @current_train_action = :update\n end",
"def handle_record_line(line, record)\n ret = nil\n if record.respond_to?(:process)\n if ret = record.send(:process, line.dup)\n unless ret.is_a?(Hash)\n raise Puppet::DevError,\n \"Process record type #{record.name} returned non-hash\"\n end\n else\n return nil\n end\n elsif regex = record.match\n # In this case, we try to match the whole line and then use the\n # match captures to get our fields.\n if match = regex.match(line)\n fields = []\n ret = {}\n record.fields.zip(match.captures).each do |field, value|\n if value == record.absent\n ret[field] = :absent\n else\n ret[field] = value\n end\n end\n else\n nil\n end\n else\n ret = {}\n sep = record.separator\n\n # String \"helpfully\" replaces ' ' with /\\s+/ in splitting, so we\n # have to work around it.\n if sep == \" \"\n sep = / /\n end\n line_fields = line.split(sep)\n record.fields.each do |param|\n value = line_fields.shift\n if value and value != record.absent\n ret[param] = value\n else\n ret[param] = :absent\n end\n end\n\n if record.rollup and ! line_fields.empty?\n last_field = record.fields[-1]\n val = ([ret[last_field]] + line_fields).join(record.joiner)\n ret[last_field] = val\n end\n end\n\n if ret\n ret[:record_type] = record.name\n return ret\n else\n return nil\n end\n end",
"def process_line(line)\n return true if line.empty?\n\n chunks = line.split(SPLIT_PATTERN, fmt.length)\n enough_fields?(line) # can raise exception\n\n point = { path: extract_path(chunks),\n value: extract_value(chunks) }\n\n tags = line_tags(chunks)\n\n point.tap do |p|\n p[:tags] = tags unless tags.empty?\n p[:ts] = extract_ts(chunks) if fmt.include?('t')\n p[:source] = extract_source(chunks) if fmt.include?('s')\n p[:interval] = options[:interval] || 'm' if fmt.include?('d')\n end\n end",
"def extract_data_by_pattern(regexp, message_pattern)\n if match = regexp.match(raw_message) then\n # Creates a hash maching :field_x => data\n new_data = Hash[match.names.zip(match.captures)].symbolize_keys\n\n new_data[:timestamp] = DateTime.strptime new_data[:timestamp], \n message_pattern.source.timestamp_definition\n new_data[:timestamp] += log.time_bias.seconds\n\n self.attributes = new_data\n self.message_pattern = message_pattern\n self.save\n end\n end",
"def line_one=(line_one)\n @line_one = line_one\n end",
"def extract_attrs(line, attrs)\n attrs.each do |key,value|\n if value.class == Array\n if key =~ /^belongs_to/ # belongs_to: [arg1, arg2]\n value.each do |thing|\n line << \" #{thing}_id:integer\"\n end\n end\n else\n line << \" #{key}:#{value}\"\n end \n end\n line\nend",
"def read_row(obj, res, res_row, row)\n res.fields.each_with_index do |field, idx|\n anno = obj.class.ann(field.to_sym)\n obj.instance_variable_set \"@#{field}\", read_attr(anno, res_row, idx)\n end\n end",
"def parse_header(line)\n case line\n when /^#%checkm/\n match = /^#%checkm_(\\d+)\\.(\\d+)/.match line\n @version = \"#{match[1]}.#{match[2]}\" if match\n when /^#%eof/\n @eof = true\n when /^#%fields/\n list = line.split('|')\n list.shift\n @fields = list.map { |v| v.strip.downcase }\n when /^#%prefix/, /^#%profile/\n # do nothing\n end\n end",
"def parse!\n set :line => @line\n @context.run_with_current(&self.class.get_parsable)\n self\n end",
"def handle_element(line)\r\n pair = line.split(':', 2) # avoid problems when summary contains ':'\r\n name = pair[0]\r\n value = pair[1]\r\n handler_method = @method_prefix + name.split(';')[0].tr('-', '_').downcase\r\n if self.respond_to? handler_method\r\n self.send(handler_method, value.chomp)\r\n end\r\n end",
"def initialize(s)\n s.gsub(/Line (\\d*) of \"(.*)\" starts at address (0x[0-9a-f]*) <(.*)> and ends at (0x[0-9a-f]*)/).to_a\n @line = $1\n @filename = $2\n @startaddress = $3.hex if $3\n @symbol = $4\n @endaddress = $5.hex if $3\n end",
"def initialize(line)\n fields = line.split\n @ip = fields[0]\n @event = nil\n @status = fields[8]\n @method = fields[5].sub('\"', '')\n @path = fields[6].sub(/\\?.*/, '')\n @event_time = parse_time(fields[3] + fields[4])\n @pid = nil\n @agent = line.split('\"')[5]\n end",
"def transform_attr(key, value); end",
"def parse(line)\n line.strip!\n\n match = line.match(@@full_match)\n return unless match\n\n source_ip, destination_ip, source_port, destination_port = match[1..4]\n\n OpenStruct.new(\n :source_ip => source_ip,\n :destination_ip => destination_ip,\n :source_port => source_port.to_i,\n :destination_port => destination_port.to_i\n )\n end",
"def process_readable(source, attributes); end",
"def carma_facs_parse_header(line, id_map)\n m = line.match(/=(\\d+)/) \n if m.nil?\n STDERR.puts \"No id found\"\n exit 1\n end \n id = m[1]\n m = line.match (/SOURCE_1=\\\"(.*)\\\"/) \n if m.nil?\n STDERR.puts \"No name found\"\n exit 1\n end \n name=m[1]\n identifier_map(id, name, id_map)\nend",
"def [](field)\n @attributes[field]\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def update_convenience_accessors\n return if self.content.blank? || ACCESSIBLE_SOA_FIELDS.select{ |field| send(field).blank? }.empty?\n\n soa_fields = self.content.split(/\\s+/)\n raise Exception.new(\"Invalid SOA Record content attribute: #{self.content}\") unless soa_fields.size == SOA_FIELDS.size\n\n soa_fields.each_with_index do |field_value, index|\n field_name = SOA_FIELDS[index]\n field_value = field_value.try(:to_i) if field_name == 'serial'\n instance_variable_set(\"@#{field_name}\", field_value)\n instance_variable_set(\"@#{field_name}_was\", field_value)\n end\n # update_serial if @serial.nil? || @serial.zero?\n end",
"def raw_getter field\n val = self.instance_variable_get(\"@#{field}\")\n return nil if val.nil? == true || val == false\n\n if BOOL_ATTRIBUTES.include? field\n return field.to_s.gsub '_', '-' \n end\n\n if STR_ATTRIBUTES.include? field \n return val \n end\n\n if ARR_STR_ATTRIBUTES.include? field && val.empty? == false \n return val.join ' '\n end\n\n if SUB_STR_ATTRIBUTES.include? field \n return SUB_STR_ATTRIBUTES[field].sub '%sub%', val \n end \n end",
"def set_attrs(rowHash)\n self.english = rowHash[\"english\"]\n self.russian = rowHash[\"russian\"]\n self.sound = rowHash[\"sound\"]\n self.picture = rowHash[\"picture\"]\n self.example = rowHash[\"example\"]\n self.regex1 = rowHash[\"regex1\"]\n self.added_at = rowHash[\"date\"] \n true\n end",
"def update_attribute(klass, field)\n require 'csv'\n abort_if_already_running\n @klass = klass\n # NOTE: Minus one for the id, which is NEVER in the file but is ALWAYS the first column in the table:\n pos = @klass.column_names.index(field.to_s) - 1\n new_log\n begin\n plural = @klass.table_name\n unless @repo.exists?(\"#{plural}.tsv\")\n raise(\"#{@repo.file_url(\"#{plural}.tsv\")} does not exist! Are you sure the resource has successfully finished harvesting?\")\n end\n log_start(\"Updating attribute #{field} (#{pos}) for #{plural}\")\n @data_file = Rails.root.join('tmp', \"#{@resource.path}_#{plural}.tsv\")\n if grab_file(\"#{plural}.tsv\")\n all_data = CSV.read(@data_file, col_sep: \"\\t\")\n pk_pos = @klass.column_names.index('resource_pk') - 1\n all_data.in_groups_of(2000, false) do |lines|\n pks = lines.map { |l| l[pk_pos] }\n instances = @klass.where(resource_id: @resource.id, resource_pk: pks)\n keyed_instances = instances.group_by(&:resource_pk)\n changes = []\n lines.each do |line|\n pk = line[pk_pos]\n val = line[pos]\n keyed_instances[pk].each do |instance|\n next if instance[field] == val\n instance[field] = val\n changes << instance\n end\n end\n @klass.import(changes, on_duplicate_key_update: [field])\n end\n @files << @data_file\n end\n rescue => e\n @log.fail(e)\n raise e\n ensure\n log_end(\"TOTAL TIME: #{Time.delta_str(@start_at)}\")\n log_close\n ImportLog.all_clear!\n end\n end",
"def process_line(_line)\n raise NotImplementedError\n end",
"def process_line line\n\tcase line\n\n\twhen /^([a-z]+) is ([I|V|X|L|C|D|M])$/\n\t\tset_space_unit($1, $2)\n\n\twhen /^([a-z ]+)([A-Z]\\w+) is (\\d+) Credits$/\n\t\tget_metals_value($1.split, $2, $3)\n\n\twhen /^how much is ((\\w+ )+)\\?$/ # Get space_units and convert to numeral\n\t\tres = get_numeral_from_space_unit($1.split)\n\t\tputs \"#{$1}is #{res}\"\n\n\twhen /^how many Credits is ([a-z ]+)([A-Z]\\w+) \\?$/\n\t\tres = (get_numeral_from_space_unit($1.split) * @metals_values[$2]).to_i\n\t\tputs \"#{$1}#{$2} is #{res} Credits\"\n\n\telse\n\t\tputs \"I have no idea what you are talking about\"\n\tend\nend",
"def set_attrs(rowHash)\n self.english = rowHash[\"english\"] \n self.russian = rowHash[\"russian\"]\n self.sound = rowHash[\"sound\"]\n self.picture = rowHash[\"picture\"]\n self.example = rowHash[\"example\"]\n self.regex1 = rowHash[\"regex1\"]\n self.added_at = rowHash[\"date\"] \n true\n end",
"def parse(source)\n @sourceRef = source.snapshot\n line = source.line\n recAttrMatch = line.scan(/^\\s*(\\w*)\\s*(\\([^\\)]+\\))?\\s+(.+)$/)\n raise \"Invalid record attribute spec '#{line}'\" unless recAttrMatch\n keyw, hintList, argList = recAttrMatch[0]\n raise \"Wrong keyword '#{keyw}', '#@keyword' expected instead\" unless keyw && keyw.to_sym == @keyword\n @args = argList.split(/[\\(\\)\\s\\,]+/).map { |a| a.to_sym }\n if hintList\n @hints = Set.new hintList.split(/[\\(\\)\\s\\,]+/).select { |h| !h.strip.empty? }.map { |h| h.strip.to_sym }\n else\n @hints = Set.new\n end\n end",
"def transform_in_line(linha_strans)\n line_hash = {}\n linha_strans.instance_variables.each do |var|\n attr_name = var.to_s.delete('@')\n attr_name = @@line_attrs[attr_name]\n line_hash[attr_name] = linha_strans.instance_variable_get(var) if attr_name\n end\n line_hash = line_hash.except('veiculos')\n line_hash = line_hash.except('paradas')\n Line.new(line_hash)\n end",
"def parse_attr_accessor(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg\n rw = \"?\"\n\n tmp = RDoc::CodeObject.new\n read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS\n # TODO In most other places we let the context keep track of document_self\n # and add found items appropriately but here we do not. I'm not sure why.\n return if @track_visibility and not tmp.document_self\n\n case tk[:text]\n when \"attr_reader\" then rw = \"R\"\n when \"attr_writer\" then rw = \"W\"\n when \"attr_accessor\" then rw = \"RW\"\n else\n rw = '?'\n end\n\n for name in args\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n end\n end",
"def initialize(line)\n split = line.split(\" \")\n self.command=split[0]\n self.user_name=split[1]\n\n case split.length\n when 3\n self.amount = split[2]\n when 4\n self.account_number = split[2]\n self.limit = split[3] \n end\n\n self.standardize\n @@all << self\n end",
"def method_missing *args\n # if the first entry of the parameter-array is a known attribute\n # proceed with the assignment\n if args.size == 1\n attributes[args.first.to_sym] # return the attribute-value\n elsif args[0][-1] == \"=\" \n if args.size == 2\n#\tif rid.rid? \n#\t update set:{ args[0][0..-2] => args.last }\n#\telse\n\t self.attributes[ args[0][0..-2] ] = args.last\n#\tend\n else\n\t self.attributes[ args[0][0..-2] ] = args[1 .. -1]\n#\tupdate set: {args[0][0..-2] => args[1 .. -1] } if rid.rid?\n end\n else\n raise NameError, \"Unknown method call #{args.first.to_s}\", caller\n end\n end",
"def convert_line_to_event(line, es)\n\t\t\tbegin\n\t\t\t\tline.chomp! # remove \\n\n\t\t\t\t@parser.parse(line) { |time, record|\n\t\t\t\t\tif time && record\n\t\t\t\t\t\tes.add(time, record)\n identifier = record[@identifier].gsub(/\\s+/, '')\n if !@redis.get identifier\n @redis.set identifier, true\n @redis.expire identifier, 60*60*24*45\n get_additional_data(identifier)\n end\n else\n\t\t\t\t\t\tlog.warn \"pattern not match\"\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue => e\n\t\t\t\tlog.warn line.dump, :error => e.to_s\n\t\t\t\tlog.debug_backtrace(e.backtrace)\n\t\t\tend\n\t\tend",
"def line(name = nil, attr = {}, &block)\n linemap = FFMap.new parent: self, looping: attr[:looping]\n @fields << linemap\n linemap.fields << [:begin, name]\n block.call(linemap)\n linemap.fields << [:end, name]\n end",
"def attr_set_sb4(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def parse_property( line )\n p = v = nil\n split = line =~ @rgxp_param\n\n if split\n p = line.slice(0, split+1).strip\n v = line.slice(split+2, line.length).strip\n else\n v = line\n end\n\n if p.nil? and @_current_param.nil?\n raise Error, \"could not parse line '#{line}'\"\n end\n\n @_current_param = p unless p.nil?\n\n if @_current_value then @_current_value << v\n else @_current_value = v end\n\n finish_property unless @_current_value.sub!(%r/\\\\\\z/, \"\\n\")\n end",
"def attr(name); end",
"def process_line(line)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_line))\n @custom_processor.process_line line\n else\n line.split ' '\n end\n end",
"def set(name, value)\n @fields[name.lexeme] = value\n end",
"def initialize(line)\n # ensure any HTML tag characters are escaped\n @strscan = StringScanner.new(ERB::Util.h line)\n end",
"def set(index,x)\n if index.is_a? Symbol\n index = get_by_sym(index)\n end\n unless x.nil? or x == ''\n if fields_desc[index][1] # we're a repeating field\n x = [x] unless x.is_a? Array\n @fields[index] = x.map { |y| fields_desc[index][2].from_ruby(y)}\n else\n @fields[index] = fields_desc[index][2].from_ruby(x)\n end\n if @fields[index].respond_to?(:separator) && @separator == '^' # we're a field, so it's a subfield\n @fields[index].separator = '&'\n end\n end\n end",
"def original_line; end",
"def parse_header(line)\n if (match = line.match(/^(.+?):\\s*(.+)#{@nl}$/))\n key = match[1].downcase\n set_header_special_values(key, match[2])\n parse_normal_header(line, key, match[1], match[2])\n elsif (match = line.match(/^HTTP\\/([\\d\\.]+)\\s+(\\d+)\\s+(.+)$/))\n @response.code = match[2]\n @response.http_version = match[1]\n @http2.on_content_call(@args, line)\n else\n raise \"Could not understand header string: '#{line}'.\"\n end\n end",
"def attr_parse attr_line, attr\n if attr_line[0] == 'Facebook Group Page' || attr_line[0] == 'Website'\n link = attr_line[1...attr_line.length]\n return link.reduce { |whole, seg| whole.strip + ':' + seg.strip }\n end\n\n attr_line[1].strip if attr.include? attr_line[0].strip\nend",
"def update!(**args)\n @header_name = args[:header_name] if args.key?(:header_name)\n @regex_match = args[:regex_match] if args.key?(:regex_match)\n end",
"def process_match(match,number)\n\t\tline = Hash[match.names.zip(match.captures)]\n\t\tline = Hash[line.map{|(k,v)| [k.to_sym,v]}]\n\t\tline[:type] = @line[:type]\n\t\tline[:index] = match[0].match(/^\\t{0,}/).to_s.length\n\t\tline[:number] = number\n\t\tline[:name] = 'div' and line[:type] = :tag if line[:type] == :tag_shorthand\n\t\t# attribute value to Hash\n\t\tline[:attribute] = recursive_string_to_hash(line[:attribute]) if line.key? :attribute\n\t\t# key values to String\n\t\t%w[bundle class name text value id_first id_last reset].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].to_s if line.key? key.to_sym\n\t\tend\n\t\t# key values to String.Strip!\n\t\t%w[text].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].strip! if line.key? key.to_sym\n\t\tend\n\t\t# bundle\n\t\tline[:bundle] = @line[:bundle] if line.key? :bundle and line[:bundle].to_s.length == 0\n\t\tif line[:type] == :mixin\n\t\t\tline[:bundle] = 'core' and line[:name] = line[:name][1..-1] if line[:name][0] == '.'\n\t\telsif line[:type] == :method\n\t\t\tline[:bundle] = 'core' if line[:bundle] == false\n\t\tend\n\t\t# class\n\t\tif line.key? :class and line[:class].length > 0\n\t\t\tline[:class] = '.' + line[:class]\n\t\t\tline[:attribute][:class] = line[:class].split('.').join(' ').strip!\n\t\t\tline.delete(:class)\n\t\tend\n\t\t\n\t\t# close \n\t\tline[:close] = %w(tag self none)[line[:close].to_s.length].to_sym if line.key? :close\n\t\t# id\n\t\tif line.key? :id_first and line[:id_first].length > 0\n\t\t\tline[:attribute][:id] = line[:id_first]\n\t\telsif line.key? :id_last and line[:id_last].length > 0\n\t\t\tline[:attribute][:id] = line[:id_last]\n\t\tend\n\t\tline.delete(:id_first) if line.key? :id_first\n\t\tline.delete(:id_last) if line.key? :id_last\n\t\t# reset\n\t\tline[:reset] = line[:reset].to_s.length == 0 ? false : true if line.key? :reset\n\t\t# return sorted Hash\n\t\tHash[line.sort]\n\tend",
"def unify(field, pattern, value = nil)\n pattern = Regexp.new(pattern) unless pattern.is_a?(Regexp)\n\n block = if block_given?\n Proc.new\n else\n Proc.new { |e| e[field] = value }\n end\n\n each_entry do |entry|\n if entry.field?(field) && entry[field].to_s =~ pattern\n block.call(entry)\n end\n end\n\n self\n end",
"def method_missing field, *args, &block\n set field, *args, &block\n end",
"def parse_field(field_name)\n element_spec = @@spec.values.\n select {|v| (v['name']) =~ /^#{field_name}$/i}.\n first\n self.send(element_spec['node'])\n end",
"def initialize(raw)\n super(raw)\n match = REGEXP.match(raw.strip) or raise ParserError\n\n if match[1] == 'd'\n @dir = true\n else\n @file = true\n end\n\n # TODO: Permissions, users, groups, date/time.\n\n @basename = match[9]\n end",
"def valid_line_for line, regexp\n @has_id_col = nil\n @line_id = nil\n return nil unless line_match = line.match(regexp)\n return nil if @options[:id] &&\n has_id_col?(line_match) &&\n @options[:id] != line_id(line_match)\n line_match\n end",
"def process_line(line)\n command_match, arg_string, captures, args = tokenize(line)\n\n check_for_command_collision(command_match, arg_string) if Pry.config.collision_warning\n\n self.arg_string = arg_string\n self.captures = captures\n\n call_safely(*(captures + args))\n end",
"def update_fields(fields)\n\n # Also consider extracting this common code between vendor and item to basic_data\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def field(name)\n attr_accessor name\n end"
] |
[
"0.6869467",
"0.64021534",
"0.61670434",
"0.5938252",
"0.59255666",
"0.5875563",
"0.58038706",
"0.571091",
"0.56636614",
"0.5631684",
"0.55693185",
"0.55450433",
"0.5472618",
"0.5461977",
"0.5458264",
"0.5452722",
"0.54318404",
"0.54274374",
"0.5390945",
"0.5384219",
"0.53838265",
"0.53760403",
"0.53730035",
"0.5364285",
"0.53551304",
"0.5336169",
"0.5317522",
"0.53144056",
"0.53143525",
"0.53072006",
"0.53009385",
"0.529493",
"0.5291827",
"0.5262051",
"0.52528673",
"0.5244182",
"0.52377295",
"0.5234325",
"0.52293617",
"0.5228094",
"0.5223541",
"0.5223541",
"0.5221184",
"0.52118194",
"0.5210007",
"0.5207163",
"0.52024007",
"0.5186541",
"0.51864654",
"0.51843214",
"0.518177",
"0.5174511",
"0.5129946",
"0.5127612",
"0.51189595",
"0.51172763",
"0.51130193",
"0.5112639",
"0.51102287",
"0.5096356",
"0.50935394",
"0.5093216",
"0.50854725",
"0.5083683",
"0.5078567",
"0.5078567",
"0.50738835",
"0.50727344",
"0.50606537",
"0.50603205",
"0.5059688",
"0.5058421",
"0.5056555",
"0.50440526",
"0.5035428",
"0.50276655",
"0.5027301",
"0.50171715",
"0.5016056",
"0.50110674",
"0.50110507",
"0.5005778",
"0.50051993",
"0.5003926",
"0.49951398",
"0.4990382",
"0.49825835",
"0.49794757",
"0.4969995",
"0.49647933",
"0.4953501",
"0.4946206",
"0.49440816",
"0.49424803",
"0.4937331",
"0.493674",
"0.49285576",
"0.49285498",
"0.49224067",
"0.49203444"
] |
0.72973573
|
0
|
Set all boolean attributes at the same time +val+ > (boolean)
|
def all_no=(val)
BOOL_ATTRIBUTES.each do |attr|
self.instance_variable_set("@#{attr}",val)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attr_set_boolean(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def set_boolean_value\n @values = [Value.new(@context, true)]\n end",
"def set_boolean!(value)\n @objects = nil\n @memory = nil\n\n self[:type] = :boolean\n self[:values][:boolean] = if value\n 1\n else\n 0\n end\n end",
"def attr_bool_writer *symbols\n attr_writer *symbols\n end",
"def set(value)\n super(value == :true)\n end",
"def has_booleans(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options) \n define_method(\"#{attr.to_s}=\") do |val|\n instance_variable_set(\"@#{attr}\", val.to_s.to_b)\n attributes[attr] = val\n val\n\n end\n\n define_method (\"#{attr.to_s}?\") do\n send(\"#{attr.to_s}\".to_sym).to_s.to_b\n end\n end\n end",
"def boolify(val)\n\nend",
"def value_if_true=(value)\n @value_if_true = value\n end",
"def bool(val)\n raise ArgumentError, \"bool() requires a boolean argument\" \\\n unless val == true || val == false\n\n self.int32(val ? 1 : 0)\n end",
"def assign_boolean_param_if_used(attr_name, value)\n\t\tsend \"#{attr_name}=\", value.present? if value\n\tend",
"def value_if_false=(value)\n @value_if_false = value\n end",
"def define_value_methods!\n self.accepted_values.each do |(name, bit)|\n self.meta_class.class_eval <<-FLAG_METHODS\n\n def #{name}\n ((@value || 0) & #{bit}) != 0\n end\n alias :#{name}? :#{name}\n\n def #{name}=(new_value)\n boolean = self.to_boolean(new_value)\n current = self.#{name}\n if boolean ^ current\n self.value = ((@value || 0) ^ #{bit})\n end\n self.#{name}\n end\n\n FLAG_METHODS\n end\n end",
"def booleans(*values)\n @optional_params.concat(values)\n @boolean_params = values\n end",
"def copy_boolean_options_to_attributes(keys)\n keys.each do |k|\n if @opts[k] && !@attr.has_key?(k)\n @attr[k] = k\n end\n end\n end",
"def boolean_attributes\n @boolean_attributes\n end",
"def v=(new_val)\n old_v = @v\n # map new_val => boolean by Ruby's idiom\n if new_val\n @v = true\n data_change @v unless old_v\n else\n @v = false\n data_change @v if old_v\n end\n end",
"def value=(value)\n @model.generic_set(@name, value ? @true_value : @false_value)\n end",
"def booleans!\n @boolean_params.each do |param|\n key = (param.is_a?(Array) ? param.first : param)\n verify_boolean_param(key)\n end\n end",
"def bool_attr_accessor(*args)\n options = (args.pop if args.last.is_a?(Hash)) || {}\n\n (args + options.keys).each {|n| class_eval \"def #{n}=(x); @#{n} = x; end\" }\n\n args.each {|n| class_eval \"def #{n}?; @#{n}; end\" }\n\n options.keys.each do |n|\n class_eval %(def #{n}?\n if !defined? @#{n}\n @#{n} = #{options[n] ? 'true' : 'false'}\n else\n @#{n}\n end\n end)\n set_field_type(n => TrueClass) if respond_to?(:set_field_type)\n end\n end",
"def immutable=(bool)\n nil\n end",
"def flags=(val)\n @val = val\n end",
"def value=(value)\n value = (value == \"false\" || value == false) ? false : true\n super value\n end",
"def typecast_value_boolean(opts={});true;end",
"def set_data_true\n self.update_attribute(:is_active, true)\n end",
"def set(attr, value)\n raise ArgumentError, \"unknown attribute: #{attr}\" unless @masks[attr]\n case value\n when true\n @data |= @masks[attr]\n when false\n @data &= ~@masks[attr]\n end\n self\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def attr_with_writable_flag?\n method_name == :attr && args.any? && args.last.type == :true\n end",
"def boolean(value)\n value ? true : false\n end",
"def add_bool(tag, value)\n write_tag(tag, value ? Type::BOOL_TRUE : Type::BOOL_FALSE)\n\n self\n end",
"def exercise_1111 (bool_values)\n end",
"def post_process_boolean( val )\n\t\t\treturn TRUE_VALUES.include?( val.to_s.downcase )\n\t\tend",
"def set_present\n set_value( true )\n end",
"def attr_bool_accessor *symbols\n attr_accessor *symbols\n symbols.each { |sym| alias_method \"#{sym}?\", sym }\n remove_method *symbols\n end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def attr_get_boolean(attr_type, strict = true)\n #This is a stub, used for indexing\n end",
"def register_boolean_fields(*names)\n names.each do |name|\n boolean_fields[name.to_s] = {}\n boolean_fields[name.to_s][\"label\"] = name.to_s\n boolean_fields[name.to_s][\"value\"] = BOOLEAN_VALUE_FOR_ALL\n end\n end",
"def scaffold_set_attributes(object, attributes)\n attributes.each do |k,v|\n v = nil if v.empty? and scaffold_table_column_type(k) == :boolean\n object.send(\"#{k}=\", v)\n end \n end",
"def boolval \n\n\t$cst.add_branch(\"boolval\")\n\n\tmatch_token(\"T_BOOLEAN\", $tokens[$index])\n\t\n\t$cst.ascend\n\nend",
"def coerce_booleans(val)\n return 1 if [true, \"TRUE\", \"1\", \"true\", \"YES\", \"yes\"].include?(val)\n return 0 if [false, \"FALSE\", \"0\", \"false\", \"NO\", \"no\"].include?(val)\n\n val\n end",
"def build_boolean( sym, val )\n #puts \"build: #{sym} - value: #{val}\"\n class_eval(<<-EOS, __FILE__, __LINE__)\n def self.#{sym}?\n return #{sym} == true\n end\n\n def #{sym}?\n self.class.#{sym}?\n end\n EOS\n end",
"def pre_execute_boolean_attribute\n\n return unless children.size == 1\n\n t = @node['tree'] = Flor.dup(tree)\n t[1] << [ '_boo', true, @node['tree'][2] ]\n end",
"def boolean(sym, options={})\n element(sym, {:type => BooleanConverter, :single => true, :reader => false}.merge(options))\n end",
"def write_bool(*b); end",
"def _boolinze(val)\n return true if ['true', '1'].include?(val)\n return false if ['false', '0'].include?(val)\n val\n end",
"def get_boolean_value\n\t\tend",
"def set_attrs(start, length, bits)\n updated = false\n for i in start ... (start+length)\n if (@exclusive & @attrs[i]) == 0 || (@exclusive & bits) != 0\n @attrs[i] |= bits\n updated = true\n end\n end\n updated\n end",
"def value?\n return !self.flag?\n end",
"def munge_boolean(value)\n case value\n when true, 'true', :true\n 'true'\n when false, 'false', :false\n 'false'\n else\n raise \"Invalid value for munge_boolean #{value}\"\n end\n end",
"def create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::Formtastic::I18n.t(:yes)\n options[:false] ||= ::Formtastic::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end",
"def rec_frozen=( set_rec )\n if [ '1', 'true', true ].include? set_rec\n write_attribute( :freeze_date, DateTime.now ) if freeze_date.nil?\n elsif [ '0', 'false', false ].include? set_rec\n # no change\n else\n raise ArgumentError, \"Argument is not true/'1' or false/'0': >#{ set_rec.inspect }<\"\n end \n end",
"def boolean_attribute(attribute_name, _value)\n\t\t\t%(#{ATTRIBUTES_SEPARATOR}#{attribute_name}='#{attribute_name}')\n\t\tend",
"def value\n return @value unless @value.nil?\n @value = value_dec == :bool_value_true\n @value\n end",
"def boolean(**props)\n transform(type: :boolean, **props) do |value|\n !!value\n end\n end",
"def bool_sheet(bool)\n \nend",
"def set_default_values\n self.is_paid = false\n self.is_served = false\n self.is_preparation_started = false\n self.is_preparation_done = false\n return true\n end",
"def raw=(bool)\n @raw = (bool ? true : false)\n end",
"def apply_validations_for_boolean\n value_set = [ true, false ]\n value_set << nil unless not_nullable?\n flex_column_class.validates field_name, :inclusion => { :in => value_set }\n end",
"def attributes=(val)\n set_attributes(val)\n val\n end",
"def with_convert_smallint_to_bool(v)\n clone(:convert_smallint_to_bool=>v)\n end",
"def get_boolean value #:nodoc:\n # some exceptions\n value = false if value == :low or value == 0 or value == nil or value == :off or value == :ground or value == :gnd\n !! value # double invert value in to boolean form\n end",
"def set\n false\n end",
"def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end",
"def run_set_bool(args, default=true)\n set_val = args.size < 2 ? 'on' : args[1]\n setting = @name.gsub(/^(set|show)/,'')\n begin\n settings[setting.to_sym] = @proc.get_onoff(set_val)\n run_show_bool(string_in_show)\n rescue NameError, TypeError\n end\n end",
"def auto=(v) Axlsx.validate_boolean(v); @auto = v; end",
"def initialize(value = nil)\n value.freeze unless value.nil? || value == true || value == false\n @value = value\n @options = nil\n end",
"def boolean cols\n decode_values :boolean, cols\n end",
"def logical_test=(value)\n @logical_test = value\n end",
"def expect_boolean name, v\n v = true if v == \"true\"\n v = false if v == \"false\"\n expect_type name,\n v,\n \"boolean\",\n lambda{ [ true, false ].member?(v) }\n end",
"def special=(isSpecial)\n if isSpecial == true or isSpecial == \"true\" or isSpecial == 1\n self.override = true\n elsif isSpecial == false or isSpecial == \"false\" or isSpecial == 0\n self.override = false\n end\n end",
"def fix_booleans\n Post.where.not(published: 't').update_all(\"published = 'f'\")\n end",
"def collectible_private= newval\n # Boolean may be coming in as string or integer\n cached_ref(true).private =\n case newval\n when Fixnum\n newval == 1\n when String\n newval == \"1\"\n when nil\n false\n else\n newval\n end\n end",
"def param_check_bool(param, value)\n if value != 'true' && value != 'false'\n write_output 'Error'.red + \" : argument must be 'true' or 'false' when setting param #{param[:string]}\\n\"\n return false\n end\n param_exec_value_change(param, value)\n end",
"def infer_boolean bool_property, indicator_properties, atts, default=nil\n atts[bool_property] = default unless (atts[bool_property] or default.nil?)\n indicator_properties.each do |x|\n atts[bool_property] = true unless atts[x].nil?\n end\n return atts\n end",
"def convert_boolean(key)\n @params[key] = _boolinze(@params[key]) if _is_bool?(get_default(key))\n end",
"def boolean(*args, &block)\n args = [{ :using => Option, :default => false, :arity => 0}, *args]\n da = option(*args, &block)\n da.instance_eval do\n kind FalseClass, TrueClass\n from NilClass do\n false\n end\n from Numeric do |n|\n n == 0 ? false : true\n end\n from String do |s|\n case s\n when \"on\", \"true\", \"yes\", \"1\"\n true\n when \"off\", \"false\", \"no\", \"0\"\n false\n else\n raise Doodle::ValidationError, \"unknown value for boolean: #{s}\"\n end\n end\n end\n end",
"def clean_up_boolean(_, q_val)\n %w(t true).include? q_val\n end",
"def ac= val\n @ac_on? = val",
"def update!(**args)\n @bool_value = args[:bool_value] if args.key?(:bool_value)\n @int_value = args[:int_value] if args.key?(:int_value)\n @string_value = args[:string_value] if args.key?(:string_value)\n end",
"def create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::I18n.t(:yes)\n options[:false] ||= ::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end",
"def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end",
"def set_property(attribute, value)\n `var el=this.__native__,attr=attribute.__value__,bool=c$Element.__boolean_attributes__[attr],key=c$Element.__boolean_attributes__[attr]||bool`\n `key ? el[key]=bool?$T(value):value : el.setAttribute(attr,''+value)`\n return self\n end",
"def boolean_attr name, options = {}\n\n attr = add_attribute(BooleanAttribute.new(name, options))\n\n # add the boolean question mark method\n define_method(\"#{attr.name}?\") do\n !!__send__(attr.name)\n end\n\n end",
"def defensive\n return (@attributes & 0x10 == 0x10)\n end",
"def enable=(value); self.is_enable = value end",
"def flags=(flags)\n self.flag_attr = flags.map{|flag| flag.to_s}.join(\", \");\n end",
"def attr_set_binary(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def update_flag!(flag, value, update_instance = false)\n truthy = FlagShihTzu::TRUE_VALUES.include?(value)\n sql = self.class.set_flag_sql(flag.to_sym, truthy)\n if update_instance\n if truthy\n enable_flag(flag)\n else\n disable_flag(flag)\n end\n end\n if (ActiveRecord::VERSION::MAJOR <= 3)\n self.class.\n update_all(sql, self.class.primary_key => id) == 1\n else\n self.class.\n where(\"#{self.class.primary_key} = ?\", id).\n update_all(sql) == 1\n end\n end",
"def enabled_all?; end",
"def initialize(attributes = {})\n super(attributes)\n parse_booleans\n end",
"def boolean_attribute?(name) \n BOOLEAN_ATTRIBUTES.include?(name.to_s)\n end",
"def enable_exam=(state)\n @enable_exam = ActiveRecord::Type::Boolean.new.cast(state)\n end",
"def visible=(bool)\n make_visible !!bool\n end",
"def boolean\n map ->(primitive) { primitive.to_bool }\n end",
"def update!(**args)\n @bool_value = args[:bool_value] if args.key?(:bool_value)\n @int_value = args[:int_value] if args.key?(:int_value)\n @multi_bool_value = args[:multi_bool_value] if args.key?(:multi_bool_value)\n @multi_int_value = args[:multi_int_value] if args.key?(:multi_int_value)\n @multi_value = args[:multi_value] if args.key?(:multi_value)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def enable=(arg)\n # We implement our own setter to handle values being passed in as strings\n # rather than booleans\n parsed = arg.to_s.downcase\n\n @enable = parsed == \"true\"\n end",
"def update!(**args)\n @boolean_value = args[:boolean_value] if args.key?(:boolean_value)\n @double_value = args[:double_value] if args.key?(:double_value)\n @float_value = args[:float_value] if args.key?(:float_value)\n @int64_value = args[:int64_value] if args.key?(:int64_value)\n @string_value = args[:string_value] if args.key?(:string_value)\n end",
"def all=(val)\n self.red = val\n self.green = val\n self.blue = val\n end",
"def coerce_str_to_bool(*keys)\n coerce(*keys){ |str_bool| (str_bool == 'on' || str_bool == 'true')}\n end",
"def boolean name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :boolean, description: description, mode: mode, policy_tags: policy_tags\n end"
] |
[
"0.76002645",
"0.71737343",
"0.70988846",
"0.701398",
"0.6834494",
"0.6761246",
"0.6756316",
"0.6746947",
"0.67047894",
"0.665515",
"0.65954226",
"0.65404296",
"0.6525709",
"0.6408451",
"0.6260781",
"0.62437904",
"0.6240183",
"0.6235671",
"0.62188125",
"0.6209311",
"0.62080103",
"0.6200477",
"0.6172654",
"0.61542636",
"0.61271787",
"0.60698944",
"0.60698944",
"0.60659814",
"0.6065144",
"0.6039421",
"0.6038536",
"0.6035806",
"0.6012925",
"0.6001087",
"0.59698576",
"0.59410536",
"0.59307367",
"0.5926863",
"0.59257185",
"0.5910867",
"0.59050745",
"0.5896421",
"0.5895807",
"0.5890168",
"0.58795154",
"0.58794135",
"0.5879016",
"0.58711565",
"0.5870613",
"0.58689505",
"0.5848322",
"0.58376193",
"0.58372545",
"0.5819331",
"0.5793645",
"0.5785898",
"0.57799447",
"0.5765793",
"0.57608974",
"0.57486355",
"0.574716",
"0.57405937",
"0.5729176",
"0.5710999",
"0.5710615",
"0.5680006",
"0.56776804",
"0.56768453",
"0.5673059",
"0.56650263",
"0.5664293",
"0.56603837",
"0.5660359",
"0.56100506",
"0.56079584",
"0.560301",
"0.5585886",
"0.558201",
"0.55817413",
"0.5570834",
"0.55693936",
"0.55667776",
"0.55574274",
"0.5550269",
"0.5545753",
"0.5539742",
"0.55377966",
"0.5537591",
"0.55314946",
"0.5529533",
"0.55289817",
"0.5528342",
"0.5527886",
"0.5516411",
"0.55097467",
"0.55077875",
"0.55050737",
"0.5499262",
"0.5489688",
"0.54895276"
] |
0.71389675
|
2
|
Return the string representation of what the attribute will look like in the authorized_keys file Args : +field+ > Attribute name Returns : +string+ > A string representation of the attribute
|
def raw_getter field
val = self.instance_variable_get("@#{field}")
return nil if val.nil? == true || val == false
if BOOL_ATTRIBUTES.include? field
return field.to_s.gsub '_', '-'
end
if STR_ATTRIBUTES.include? field
return val
end
if ARR_STR_ATTRIBUTES.include? field && val.empty? == false
return val.join ' '
end
if SUB_STR_ATTRIBUTES.include? field
return SUB_STR_ATTRIBUTES[field].sub '%sub%', val
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def key_format(field)\n @formatted_key[field] ||= JSONAPI.configuration\n .key_formatter\n .format(resource_key_for(field))\n .to_sym\n end",
"def format_field key\n key.downcase.gsub(%r{[^A-Z0-9]+}xoi,' ').strip.gsub(' ','_')\n end",
"def key_field\n 'key'\n end",
"def aws_access_key_attribute\n\t\t\"provider_account_#{Digest::MD5.hexdigest(name || 'unknown')}_aws_access_key\"\n\tend",
"def get_string(attr); end",
"def resource_attribute_name(field, direction = :from)\n (transforms(direction)[field] || field).to_sym\n end",
"def attribute_field_name(attr)\n attr.to_s.camelize(:lower)\n end",
"def key_file_name\n self.email.tr('^A-Za-z', '')[0..10] + self.id.to_s\n end",
"def get_field(field)\n mp = nil\n mp_ptr = FFI::MemoryPointer.new(:pointer)\n Botan.call_ffi(:botan_mp_init, mp_ptr)\n mp = mp_ptr.read_pointer\n Botan.call_ffi(:botan_privkey_get_field, mp, @ptr, field)\n hex_str = Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_mp_to_str(mp, 16, b, bl)\n }, string: true)\n hex_str.hex\n ensure\n LibBotan.botan_mp_destroy(mp) if mp && !mp.null?\n end",
"def format_key(key)\n key.tr(\"_\", \"-\")\n .gsub(\"enabled\", \"enable\")\n .gsub(\"user-name\", \"username\")\n .gsub(/^registry-jwt-expiration-time-value$/, \"jwt-expiration-time\")\n .gsub(/^registry-catalog-page-value$/, \"catalog-page\")\n .gsub(/^check-ssl-usage-enable$/, \"secure\")\n .gsub(/^user-permission-change-visibility-enable$/, \"change-visibility-enable\")\n .gsub(/^user-permission-manage-namespace-enable$/, \"manage-namespace-enable\")\n .gsub(/^user-permission-create-namespace-enable$/, \"create-namespace-enable\")\n .gsub(/^user-permission-manage-team-enable$/, \"manage-team-enable\")\n .gsub(/^user-permission-create-team-enable$/, \"create-team-enable\")\nend",
"def get_string(field)\n field['stringValue']\n end",
"def get_string_field(field_name)\n\t\tend",
"def to_s\n user_key\n end",
"def to_s\n user_key\n end",
"def human_attribute_name(field_name, options={})\n \"\"\n end",
"def encrypt_field(field_name)\n encrypted_val = self.encrypt(self.send(field_name))\n self.send(\"#{field_name}_#{self.encryption_fu_options[:encrypted_field_append]}=\".to_sym, encrypted_val)\n end",
"def field_attribute(attr)\n return 'id' if attr == :_id\n # default, simply return name\n return attr unless attr.is_a? Hash\n # else, Hash\n return attr[:object] if attr.has_key? :object\n return attr[:array] if attr.has_key? :array\n return attr[:value] if attr.has_key? :value\n return attr[:link] if attr.has_key? :link\n\n attr.keys[0]\n end",
"def field_name\n @gapi.field_name\n end",
"def encode_attr(name)\n \"a$\" + @attribute_name_generator.get(name.to_s)\n end",
"def key\n to_a[0..(num_key_fields-1)].join(\"-\")\n end",
"def field_name(field=nil)\n result = field_name_fragment\n result << \"[#{field}]\" if field\n result\n end",
"def primary_key_string\n key_attributes.join(' ').parameterize\n end",
"def human_attribute_name(attribute_key_name) #:nodoc:\n attribute_key_name.humanize\n end",
"def format_name(attribute_name)\n attribute_name.to_s\n end",
"def [](field)\n a = @headers[downcased(field)] || return\n a.join(\", \")\n end",
"def key\n return \"#{user}\"\n end",
"def get_tag_for(contact_attribute)\n Digest::SHA1.hexdigest(contact_attribute)[0..9].upcase\n end",
"def to_s\n key.to_s\n end",
"def sf_field(key)\n self.attributes[translate_rails_key(key)] || self.attributes[translate_rails_key(key) + \"__c\"]\n end",
"def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end",
"def field\n @field ||= quoted_field(field_name)\n end",
"def get_string_value(field_name)\n\t\tend",
"def attributes_string\n\t\t\t#note that underscores are converted to hyphens. Quotes are entity encoded\n\t\t\tattrs = @attributes.reject{|k,v| v.nil?}.map do |k,v|\n\t\t\t\tvv = escape_quote v.to_s\n\t\t\t\tkk = k.to_s.gsub('_', '-')\n\t\t\t\t%Q[#{kk}=\"#{vv}\"]\n\t\t\tend\n\t\t\t\n\t\t\treturn attrs.join(' ')\n\t\tend",
"def encode_globalattr(name)\n \"a$\" + @global_attribute_name_generator.get(name.to_s)\n end",
"def combined_key_field\n BlacklightBrowseNearby::Engine.config.combined_key_field\n end",
"def to_snakecase(field)\n field.split(/\\.|\\-|\\ /).reject(&:empty?).join.snakecase\n end",
"def field_attribute(attribute)\n attribute.to_s.sub(/\\?$/,\"\")\n end",
"def to_s\n @real_key\n end",
"def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end",
"def translation_for(field)\n object.class.human_attribute_name(field)\n end",
"def full_key\n [name, key].join(\"/\")\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def field_human_name(field)\n I18n.translate(\"#{model_name}.attributes.#{field}\", :count => 1, :default => Inflections.humanize(field), :scope => :models)\n end",
"def access_by_key(access_by)\n \"#{access_by.id}--#{access_by.app_type_id}\"\n end",
"def [](field)\n @attributes[field]\n end",
"def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end",
"def authorized_by_to_s\n unless authorized_by.nil?\n r = authorized_by.name\n r = \"#{r} via #{api_key.name}\" unless api_key.nil?\n else\n r = ' - '\n r = \"Unknown via #{api_key.name}\" unless api_key.nil?\n end\n r\n end",
"def orcid_field\n generate 'sufia:orcid_field'\n end",
"def key\n attributes[:key]\n end",
"def stringified_keys; end",
"def javaize_key(key)\n key = key.to_s\n case key\n when 'acquirer_transaction_request'\n 'AcquirerTrxReq'\n when 'acquirer_status_request'\n 'AcquirerStatusReq'\n when 'directory_request'\n 'DirectoryReq'\n when 'issuer', 'merchant', 'transaction'\n key.capitalize\n when 'created_at'\n 'createDateTimeStamp'\n when 'merchant_return_url'\n 'merchantReturnURL'\n when 'token_code', 'expiration_period', 'entrance_code'\n key[0,1] + key.camelize[1..-1]\n when /^(\\w+)_id$/\n \"#{$1}ID\"\n else\n key\n end\n end",
"def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end",
"def odata_field(field, options)\n @odata_property_key ||= {}\n @odata_property_key[field] = options[:crm_key]\n end",
"def human_attribute_name(attribute, options={})\n attribute = Ldaptic.encode(attribute)\n if at = namespace.attribute_type(attribute)\n attribute = at.verbose_name\n end\n attribute = attribute[0..0].upcase + attribute[1..-1]\n attribute.gsub!(/([A-Z])([A-Z][a-z])/) { \"#$1 #{$2.downcase}\" }\n attribute.gsub!(/([a-z\\d])([A-Z])/) { \"#$1 #{$2.downcase}\" }\n attribute.gsub!(/\\b[a-z][A-Z]/) { $&.upcase }\n attribute.gsub!('_', '-')\n attribute\n end",
"def format_audited_field(field)\n return auditable.additional_question.name if auditable_type.eql?('AdditionalAnswer') && field.eql?('answer')\n\n field\n end",
"def local_field_to_ad field_name\n @local_to_ad_map ||= ::Devise.ad_attr_mapping[devise_model_name.to_sym]\n return (@local_to_ad_map.has_key? field_name) ? @local_to_ad_map[field_name] : field_name\n end",
"def ssdb_attr_key(name)\n \"#{self.class.name.tableize}:#{ssdb_attr_id}:#{name}\"\n end",
"def to_s\n self.key\n end",
"def key_name(key)\n key.to_s.index(SPACE_RE) ? \"\\\"#{key}\\\"\" : key\n end",
"def default_api_name(attribute)\n String(attribute).split('_').map(&:capitalize).join('_') << '__c'\n end",
"def item_name_for_resource(resource)\n sdb_type = simpledb_type(resource.model)\n \n item_name = \"#{sdb_type}+\"\n keys = keys_for_model(resource.model)\n item_name += keys.map do |property|\n resource.instance_variable_get(property.instance_variable_name)\n end.join('-')\n \n Digest::SHA1.hexdigest(item_name)\n end",
"def ldap_name(attribute)\n @puppet2ldap[attribute].to_s\n end",
"def namespaced_keyed_filename\n full_path_to_credential_file\n end",
"def api_key_field(value = nil)\n rw_config(:api_key_field, value, first_column_to_exist(nil, :api_key, :application_key))\n end",
"def get_char_field(field_name)\n\t\tend",
"def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end",
"def field key\n @fields.get key\n end",
"def human_attribute_name(attribute_key_name)\n attribute_key_name.gsub(/_/, \" \").capitalize unless attribute_key_name.nil?\n end",
"def custom_attribute_field_id\n @ca_field_id ||= 0\n @ca_field_id += 1\n\n return \"custom_attribute_#{ @ca_field_id }\"\n end",
"def format_key(key)\n key.to_s.gsub(\"-\",\"_\")\n end",
"def name\n \"#{self[:afi]} #{self[:acl_name]}\"\n end",
"def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end",
"def namespaced_id(field)\n \"#{namespaces.join('_')}#{'_' unless namespaces.empty?}#{field}\"\n end",
"def to_field_name(name)\n # camelize strips leading underscores, which is undesirable.\n if name.to_s.starts_with?('_')\n \"_#{to_field_name(name.to_s[1..-1])}\"\n elsif Rails.config.camel_case\n name.to_s.camelize(:lower)\n else\n name.to_s\n end\n end",
"def attribute_string(attributes)\n attributes.map { |name, value| \"#{name}=\\\"#{value}\\\"\" }\n end",
"def field_name\r\n @field_name ||= begin\r\n %r/(\\w+)Field$/.match(name)[1]\r\n rescue\r\n %r/(\\w+)$/.match(name)[1]\r\n end\r\n end",
"def contact_field_name(contact_field)\n contact_field_translations[contact_field]\n end",
"def ldap_username_field\n @attributes[:ldap_username_field]\n end",
"def to_str\n @passwd.name\n end",
"def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end",
"def ad_field_to_local field_name\n @ad_to_local_map ||= ::Devise.ad_attr_mapping[devise_model_name.to_sym].invert\n return (@ad_to_local_map.has_key? field_name) ? @ad_to_local_map[field_name] : field_name\n end",
"def complete_key(name, field, val)\n return [\"#{name}.\"] if !val || !val.is_a?(String) || !(val.include?('.'))\n val = val.sub(/.*\\./,'')\n\n connection = definition.klass.connection\n quoted_table = field.key_klass.connection.quote_table_name(field.key_klass.table_name)\n quoted_field = field.key_klass.connection.quote_column_name(field.key_field)\n field_name = \"#{quoted_table}.#{quoted_field}\"\n\n field.key_klass\n .where(value_conditions(field_name, val))\n .select(field_name)\n .limit(20)\n .distinct\n .map(&field.key_field)\n .compact\n .map { |f| \"#{name}.#{f} \" }\n end",
"def to_s\n send( self.class.unique_string_field )\n end",
"def tag_attributes_string\n tag_attributes.map{|k, v| \"#{k}=\\\"#{v}\\\"\"}.join(' ')\n end",
"def cache_key\r\n attributes.to_s\r\n end",
"def define_field_name(field)\n (field.to_s + '_field').to_sym.tap do |field_method_name|\n field_method_names << field_method_name\n end\n end",
"def field(key)\n pdf_field(key).getValueAsString\n rescue NoMethodError\n raise \"unknown key name `#{key}'\"\n end",
"def stringify_keys; end",
"def stringify_keys; end",
"def stringify_keys; end",
"def get_field(key)\n @form_fields.getField key.to_s\n end",
"def nice_name(node)\n name = attr(node)\n defect_fields[name] || name\n end",
"def field_name\n @field.name\n end",
"def to_string(key)\n const_get(key) if key\n end",
"def field (key)\n\n return self.yattributes[key.to_s] if self.yattributes\n\n fields.find_by_fkey(key.to_s)\n end",
"def format_string(record, attribute, val)\n val\n end",
"def putfield(format,key,value)\n format = 'a' if format.nil?\n field = \"#{key} : #{format =~ /^a.*$/ ? hexstring(value) : value}\"\n field = field[0..40] + '...'+ field[-40..-1] if field.size > 80 # centre-truncate long strings\n puts field\nend",
"def platform_authorized_key(type)\n \"#{type.graphql_name}.authorized\"\n end",
"def get_minimal_key(line)\n compute_minimal_keys if not @minimal_keys\n \n str = \"\"\n minimal_keys.each{|k, size|\n str += line.field(k).to_s[0..size]\n }\n return str\n end",
"def key_name\n data[:key_name]\n end"
] |
[
"0.66736597",
"0.6583204",
"0.6251942",
"0.62163043",
"0.6191146",
"0.61861753",
"0.6184396",
"0.6127492",
"0.60428834",
"0.6031008",
"0.5991968",
"0.59852815",
"0.596714",
"0.596714",
"0.58966017",
"0.5867508",
"0.5829209",
"0.5814166",
"0.58020544",
"0.57961106",
"0.57481176",
"0.5703035",
"0.5697186",
"0.56871057",
"0.5679989",
"0.5664022",
"0.5652913",
"0.5647875",
"0.5637104",
"0.56157756",
"0.5613256",
"0.56001645",
"0.559322",
"0.5590508",
"0.5589706",
"0.5581283",
"0.55809605",
"0.5575397",
"0.55626607",
"0.5556516",
"0.5550816",
"0.5541045",
"0.55384433",
"0.5530506",
"0.55293244",
"0.5523669",
"0.5512472",
"0.55039227",
"0.55003434",
"0.5490592",
"0.5487744",
"0.54808545",
"0.54716533",
"0.54698986",
"0.546926",
"0.54675525",
"0.5467307",
"0.54672897",
"0.54664004",
"0.54548943",
"0.54390466",
"0.5435902",
"0.54323685",
"0.54153425",
"0.5411676",
"0.5402992",
"0.5390529",
"0.5387526",
"0.5365016",
"0.53589386",
"0.535586",
"0.53547376",
"0.53454286",
"0.53451645",
"0.5340288",
"0.5331295",
"0.53311616",
"0.5329506",
"0.5327627",
"0.53220284",
"0.5304486",
"0.52931654",
"0.52918845",
"0.52906084",
"0.528826",
"0.52854925",
"0.5280964",
"0.5264783",
"0.5264783",
"0.5264783",
"0.525785",
"0.52538764",
"0.5250552",
"0.5249805",
"0.5248923",
"0.52487254",
"0.52479255",
"0.5247459",
"0.52434325",
"0.52270687"
] |
0.62356
|
3
|
Add a key to authorized keys file if it passes validation. If the validations fail the reason for the failure will be
|
def save
return false if not self.valid?
return self.class.write(self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n post \"/setup/api/settings/authorized-keys\", queries\n end",
"def add(key_file); end",
"def add_key(key)\n if File.exist?(key)\n data = File.open(key).read\n key_import = GPGME::Key.import(data, armor: true)\n key = GPGME::Key.get(key_import.imports[0].fpr).uids[0].email\n else\n data = GPGME::Key.export(key, armor: true).read\n end\n\n raise I18n.t('error.export_key') if data.to_s.empty?\n\n @keys[key] = data\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end",
"def add_keycert(keycert_file); end",
"def key_file\n write_file(\"request-#{domain}.key\", key.to_pem)\n end",
"def add_key(key)\n begin\n file = Tempfile.new('key')\n file.puts(key)\n file.close\n\n add_keyfile(file.path)\n ensure\n file.close(true) unless file.nil?\n end\n end",
"def add_key(ssh)\n output = ssh.exec!('cat ~/.ssh/authorized_keys')\n key_file_content = File.read(@keyfile)\n ssh.exec!('mkdir ~/.ssh')\n ssh.exec!(\"echo '#{key_file_content}' >> ~/.ssh/authorized_keys\") unless output.include? key_file_content\n end",
"def verify_key; end",
"def verify_key; end",
"def enroll(key = nil, path: nil)\n fail 'Must specify key OR path, not both' unless (!!key ^ !!path) || !(key || path)\n\n if path\n fail 'Bad key path' unless File.exist? File.expand_path(path)\n data = File.read(File.expand_path path)\n key = Net::SSH::KeyFactory.load_data_public_key(data).to_pem\n elsif key\n key = Net::SSH::KeyFactory.load_data_public_key(key).to_pem\n else\n key = security.public_key\n end\n\n if user_exists? key\n puts 'Key already enrolled'\n else\n User.create(public_key: key)\n puts 'Key was successfully enrolled'\n end\n end",
"def require_key\n fail 'No private key loaded' unless @private_key\n end",
"def set_key_file(opts)\n opts = check_params(opts,[:keys])\n super(opts)\n end",
"def add\n keyfile = args.first || find_key\n key = File.read(keyfile)\n\n display \"Uploading ssh public key #{keyfile}\"\n heroku.add_key(key)\n end",
"def add_key(key)\n\t\tpost(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' })\n\tend",
"def add_key(key)\n\t\tpost(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' })\n\tend",
"def save_verification_key\n self.verification_key = KeyGenerator.create\n end",
"def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end",
"def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end",
"def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end",
"def add_host_key( key_file )\n @host_key_files.push( key_file ).uniq!\n self\n end",
"def add( key_file )\n @key_files.push( key_file ).uniq!\n self\n end",
"def verify_keyfile! keyfile\n if keyfile.nil?\n fail \"You must provide a keyfile to connect with.\"\n elsif !::File.file?(keyfile)\n fail \"The keyfile '#{keyfile}' is not a valid file.\"\n end\n end",
"def modify\n authorized_keys_file = @filename\n keys = Hash.new\n\n @@mutex.synchronize do\n PathUtils.flock(@lockfile) do\n File.open(authorized_keys_file, File::RDWR|File::CREAT, @mode) do |file|\n file.each_line do |line|\n begin\n keys[line.split[-1].chomp] = line.chomp\n rescue\n end\n end\n\n if block_given?\n old_keys = keys.clone\n\n yield keys\n\n if old_keys != keys\n file.seek(0, IO::SEEK_SET)\n file.write(keys.values.join(\"\\n\")+\"\\n\")\n file.truncate(file.tell)\n end\n end\n file.close\n end\n PathUtils.oo_chown(0, @container.gid, authorized_keys_file)\n @container.chcon(authorized_keys_file,\n ::OpenShift::Runtime::Utils::SelinuxContext.instance.get_mcs_label(@container.uid))\n end\n end\n keys\n end",
"def checkKeys()\r\n\r\n data = nil\r\n if (@cafile.nil? || @cafile.empty? || !File.exists?(@cafile) || OpenSSL::X509::Certificate.new(File.read(@cafile)).nil?)\r\n raise SecurityError, \"CA Public key NOT OK!\"\r\n else\r\n _dprint(\"CA Public Key OK\")\r\n end\r\n\r\n if (@keyfile.nil? || @keyfile.empty? || !File.exists?(@keyfile) || OpenSSL::X509::Certificate.new(File.read(@keyfile)).nil?)\r\n raise SecurityError, \"Public key NOT OK!\"\r\n else\r\n _dprint(\"Public Key OK\")\r\n end\r\n\r\n if (!File.exists?(@keyfile) || OpenSSL::PKey::RSA.new(File.read(@keyfile), @keypass).nil?)\r\n raise SecurityError, \"Private key NOT OK!\"\r\n else\r\n _dprint(\"Private Key OK\")\r\n end\r\n\r\n end",
"def add_trusted_key(k)\n @trusted_keys.add(k)\n end",
"def process_key_auth(options)\n if options[:google_json_key_location]\n json_key = File.read(File.expand_path(options[:google_json_key_location]))\n elsif options[:google_json_key_string]\n json_key = options[:google_json_key_string]\n end\n\n validate_json_credentials(json_key)\n\n ::Google::Auth::ServiceAccountCredentials.make_creds(\n :json_key_io => StringIO.new(json_key),\n :scope => options[:google_api_scope_url]\n )\n end",
"def key_file\n super\n end",
"def add_key(key)\n deprecate # 07/31/2012\n post(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s\n end",
"def authorize_key_for_user(config, *key_paths)\n [*key_paths, nil].each do |key_path|\n if key_path.nil?\n fail \"Public key not found at following paths: #{key_paths.join(', ')}\"\n end\n\n full_key_path = File.expand_path(key_path)\n\n if File.exists?(full_key_path)\n config.vm.provision 'file',\n run: 'once',\n source: full_key_path,\n destination: '/home/vagrant/user_pubkey'\n\n config.vm.provision 'shell',\n privileged: true,\n run: 'once',\n inline: [\n 'echo \"Adding user pubkey\"',\n 'cat /home/vagrant/user_pubkey >> /home/vagrant/.ssh/authorized_keys',\n 'rm -f /home/vagrant/user_pubkey',\n 'echo \"Done!\"'].join(\" && \")\n break\n end\n end\nend",
"def ensure_keys_file_exists(google_cloud_keys_file, google_cloud_project_id)\n if google_cloud_keys_file && File.exist?(google_cloud_keys_file)\n return google_cloud_keys_file\n end\n\n return DEFAULT_KEYS_FILE_NAME if File.exist?(DEFAULT_KEYS_FILE_NAME)\n\n fastlane_folder_gc_keys_path = File.join(FastlaneCore::FastlaneFolder.path, DEFAULT_KEYS_FILE_NAME)\n return fastlane_folder_gc_keys_path if File.exist?(fastlane_folder_gc_keys_path)\n\n if google_cloud_project_id.to_s.length > 0\n # Check to see if this system has application default keys installed.\n # These are the default keys that the Google Cloud APIs use when no other keys are specified.\n # Users with the Google Cloud SDK installed can generate them by running...\n # `gcloud auth application-default login`\n # ...and then they'll be automatically available.\n # The nice thing about these keys is they can be associated with the user's login in GCP\n # (e.g. my_account@gmail.com), so teams can control access to the certificate bucket\n # using a mailing list of developer logins instead of generating service accounts\n # and keys.\n application_default_keys = nil\n begin\n application_default_keys = Google::Auth.get_application_default\n rescue\n # This means no application default keys have been installed. That's perfectly OK,\n # we can continue and ask the user if they want to use a keys file.\n end\n\n if application_default_keys && UI.confirm(\"Do you want to use this system's Google Cloud application default keys?\")\n return nil\n end\n end\n\n # User doesn't seem to have provided a keys file\n UI.message(\"Looks like you don't have a Google Cloud #{DEFAULT_KEYS_FILE_NAME.cyan} file yet.\")\n UI.message(\"If you have one, make sure to put it into the '#{Dir.pwd}' directory and call it '#{DEFAULT_KEYS_FILE_NAME.cyan}'.\")\n unless UI.confirm(\"Do you want fastlane to help you to create a #{DEFAULT_KEYS_FILE_NAME} file?\")\n UI.user_error!(\"Process stopped, run fastlane again to start things up again\")\n end\n\n UI.message(\"fastlane will help you create a keys file. Start by opening the following website:\")\n UI.message(\"\")\n UI.message(\"\\t\\thttps://console.cloud.google.com\".cyan)\n UI.message(\"\")\n UI.input(\"Press [Enter] once you're logged in\")\n\n UI.message(\"First, switch to the Google Cloud project you want to use.\")\n UI.message(\"If you don't have one yet, create a new one and switch to it.\")\n UI.message(\"\")\n UI.message(\"\\t\\thttps://console.cloud.google.com/projectcreate\".cyan)\n UI.message(\"\")\n UI.input(\"Press [Enter] once you selected the right project\")\n\n UI.message(\"Next fastlane will show you the steps to create a keys file.\")\n UI.message(\"For this it might be useful to switch the Google Cloud interface to English.\")\n UI.message(\"Append \" + \"&hl=en\".cyan + \" to the URL and the interface should be in English.\")\n UI.input(\"Press [Enter] to continue\")\n\n UI.message(\"Now it's time to generate a new JSON auth file for fastlane to access Google Cloud Storage:\")\n UI.message(\"\")\n UI.message(\"\\t\\t 1. From the side menu choose 'APIs & Services' and then 'Credentials'\".cyan)\n UI.message(\"\\t\\t 2. Click 'Create credentials'\".cyan)\n UI.message(\"\\t\\t 3. Choose 'Service account key'\".cyan)\n UI.message(\"\\t\\t 4. Select 'New service account'\".cyan)\n UI.message(\"\\t\\t 5. Enter a name and ID for the service account\".cyan)\n UI.message(\"\\t\\t 6. Don't give the service account a role just yet!\".cyan)\n UI.message(\"\\t\\t 7. Make sure the key type is set to 'JSON'\".cyan)\n UI.message(\"\\t\\t 8. Click 'Create'\".cyan)\n UI.message(\"\")\n UI.input(\"Confirm with [Enter] once you created and downloaded the JSON file\")\n\n UI.message(\"Copy the file to the current directory (#{Dir.pwd})\")\n UI.message(\"and rename it to `#{DEFAULT_KEYS_FILE_NAME.cyan}`\")\n UI.message(\"\")\n UI.input(\"Confirm with [Enter]\")\n\n until File.exist?(DEFAULT_KEYS_FILE_NAME)\n UI.message(\"Make sure to place the file in '#{Dir.pwd.cyan}' and name it '#{DEFAULT_KEYS_FILE_NAME.cyan}'\")\n UI.message(\"\")\n UI.input(\"Confirm with [Enter]\")\n end\n\n UI.important(\"Please never add the #{DEFAULT_KEYS_FILE_NAME.cyan} file in version control.\")\n UI.important(\"Instead please add the file to your `.gitignore` file\")\n UI.message(\"\")\n UI.input(\"Confirm with [Enter]\")\n\n return DEFAULT_KEYS_FILE_NAME\n end",
"def update_API_key(new_key)\n \n #get the old key\n old_key = $drugbank_api_key\n\n # update key\n $drugbank_api_key = new_key\n\n # update the local config\n $config[\"auth-key\"] = new_key\n\n # try to write back to config file\n begin\n File.write($config_file, JSON.pretty_generate($config)) \n $drugbank_headers[\"Authorization\"] = new_key\n return 200 \n rescue StandardError => msg \n # in case anything goes wrong, revert changes\n puts msg\n $config[\"auth-key\"] = old_key\n $drugbank_api_key = old_key\n $drugbank_headers[\"Authorization\"] = old_key\n return 400\n end \n\nend",
"def add_keyfile(file)\n ProcessWatcher.watch(\"ssh-add\", [file], nil, -1, 10)\n end",
"def generate_validkey(from_string = nil)\n\t\tfrom_string ||= User.sha1(AuthHelper::Utils::random_string(30))\n write_attribute \"validkey\", from_string\n end",
"def add\n keyfile = shift_argument\n validate_arguments!\n\n if keyfile\n Heroku::Auth.associate_key(keyfile)\n else\n # make sure we have credentials\n Heroku::Auth.get_credentials\n Heroku::Auth.associate_or_generate_ssh_key\n end\n end",
"def add_key(user_name, key)\n\tabort \"Cannot add key, user not found!\" unless users(:return => :array).include?(user_name)\n\t@ssh_keys << {:user_name => user_name, :key => key}\n end",
"def add_public_key_file(path)\n @keys << Net::SSH::KeyFactory.load_public_key(path)\n end",
"def regenerate_key\n self.private_key = true\n self.save\n end",
"def regen_key\n @user = current_user\n @user.regen_private_key\n send_data @user.private_key, :type => \"application/pem-keys\", :disposition => \"attachment\", :filename => \"#{@user.username}.pem\"\n end",
"def key_path=(path)\n raise ArgumentError.new(\"The signing key could not be found at #{path}\") unless File.exists?(path)\n @key_path = path\n self.key=(File.readlines(path).join(\"\"))\n end",
"def raise_key_file_error(key_file)\n is_abs = ::File.absolute_path(key_file) == key_file\n raise \"json_key_file must be an absolute path: #{key_file}\" unless is_abs\n\n exists = ::File.exist? key_file\n raise \"json_key_file does not exist: #{key_file}\" unless exists\n end",
"def process_key(key)\n if ::File.exists?(key)\n key\n else\n tempfile = ::Tempfile.new('key')\n tempfile.write(key)\n tempfile.flush\n\n tempfile.path\n end\n end",
"def apply_key_to_remote key, remote, source=nil\n authorized_keys = get_remote_auth_file(remote)\n\n # add key if it hasn't already been added (to local copy of authorized_keys)\n if !authorized_keys.readlines.grep(/#{key}/)\n authorized_keys.write(\"\\n\" + key + \"\\n\")\n authorized_keys.close\n\n Net::SFTP.start(remote.hostname, \n remote.username, \n :auth_methods => ['publickey', 'password'], \n :password => remote.password) do |sftp|\n sftp.upload!(authorized_keys.path, '.ssh/authorized_keys')\n end\n else\n puts \"#{ source }'s key already exists on #{ remote.id }\"\n end\n end",
"def check_api_key(key_value)\n\n if Key.find_by_key_value(key_value).nil?\n\n redirect_to unauthorized_key_path\n\n return false\n\n end\n\n return true\n\n end",
"def verify_key\n Chef::Log.info('Check for RSA key and download key ')\n\n if ::File.exist?('/opt/IBM/SCM_id_rsa')\n Chef::Log.info('Key already exist..........')\n else\n Chef::Log.info('Downloading the key.........')\n # copy the ssh key for TSCM to /opt/IBM/\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n mode '400'\n action :create_if_missing\n end\n Chef::Log.info('Finished downloading RSA key...............')\n end\nend",
"def create\n @public_key.user = current_user\n respond_to do |format|\n if @public_key.save\n # PublicKey.regenerate_authorized_keys\n GitWit.add_authorized_key(current_user.username, @public_key.raw_content)\n\n format.html { redirect_to @public_key, notice: 'Public key was successfully created.' }\n format.json { render json: @public_key, status: :created, location: @public_key }\n else\n format.html { render action: \"new\" }\n format.json { render json: @public_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def keyfile(key)\n keyfile = Tempfile.new(\"ec2_private.key\")\n key_material = \"\"\n key.split(\"\\n\").each { |line| key_material+=\"#{line.strip}\\n\" if line.strip.size>0 }\n keyfile.write(key_material) && keyfile.close\n puts \"[*] Using #{keyfile.path} as private key\"\n keyfile.path\n end",
"def create_keys_files(config_data,external_private_key_path,internal_private_key_path,internal_public_key_path)\n if !File.exist?(external_private_key_path) and !File.exist?(internal_private_key_path)\n File.open(external_private_key_path, \"w\") do |f|\n config_data['keys']['external_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,external_private_key_path)\n File.open(internal_private_key_path, \"w\") do |f|\n config_data['keys']['internal_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,internal_private_key_path)\n end\n if !File.exist?(internal_public_key_path)\n shell_cmd = \"ssh-keygen -y -f #{internal_private_key_path}\"\n generated_key = %x[ #{shell_cmd} ]\n File.open(internal_public_key_path, \"w\") do |f|\n f.puts(generated_key)\n end\n end\nend",
"def add\n if keyfile = args.first\n display \"Uploading ssh public key #{keyfile}\"\n heroku.add_key(File.read(keyfile))\n else\n # make sure we have credentials\n Heroku::Auth.get_credentials\n Heroku::Auth.associate_or_generate_ssh_key\n end\n end",
"def addkey\n key = \"#{ENV['HOME']}/.ssh/id_rsa.pub\"\n run \"ssh-keygen -t rsa -N \\\"#{named_options[\"passphrase\"]}\\\" -f #{key}\" unless File.exists?(key)\n\n key_contents = File.read(key)\n run_remote_command \"mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo \\\"#{key_contents}\\\" >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys\"\n end",
"def verify_root_key\r\n root_key_file = File.expand_path(File.join(File.dirname(__FILE__), \"..\", \"..\", \"root_key.rsa\"))\r\n if File.exist?(root_key_file)\r\n raise ApplicationSetupError, \"\\n\\n**Error: The file #{root_key_file} must be moved out of the root folder. Keep it in a secure location for emergency password recovery.**\\n\\n\\n\"\r\n end \r\n end",
"def assert_key(key)\n return if key.is_a?(String) && !SSH_KEY_REGEX.match(key).nil?\n raise Chef::Exceptions::ValidationFailed,\n 'ssh_authorize_key: key parameter must be a valid SSH public key! '\\\n \"You passed #{key.inspect}.\"\n end",
"def key_files; end",
"def load_public_key(filename); end",
"def add_key(key)\n post(\"/users/ssh_keys\", {:key => key}, :accept => 'json').to_s\n end",
"def accept(host, key)\n @public_keys[host] = key\n File.open(@public_keys_file, 'w') do |f|\n YAML::dump(@public_keys, f)\n end \n end",
"def add_ssh_key(public_key_filename = nil)\n public_key_filename ||= File.expand_path(File.join(ENV['HOME'], '.ssh', 'id_rsa.pub'))\n title = \"#{ENV['USER']}@#{ENV['HOST']}\"\n raise InvalidSshkey.new(\"Ssh key does not exist #{public_key_filename}\") unless File.exist?(public_key_filename)\n begin\n client.create_ssh_key(title, File.read(public_key_filename))\n logger.info(\"Adding ssh key #{public_key_filename} to gitlab\")\n rescue Gitlab::Error::BadRequest => e\n # if the key is already added no need to do anything else\n return unless e.response_status == 400\n end\n end",
"def valid\n if self.key\n key_pieces = self.key.split(\" \")\n small_key = key_pieces[0] + \" \" + key_pieces[1]\n #if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+]+==?).*$/\n if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+].*)$/\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end",
"def test_modifyingfile\n keys = []\n names = []\n 3.times {\n k = mkkey\n #h[:ensure] = :present\n #h.retrieve\n keys << k\n names << k.name\n }\n assert_apply(*keys)\n keys.clear\n\n @catalog.clear(true)\n @catalog = nil\n\n newkey = mkkey\n #newkey[:ensure] = :present\n names << newkey.name\n assert_apply(newkey)\n\n # Verify we can retrieve that info\n assert_nothing_raised(\"Could not retrieve after second write\") {\n newkey.provider.prefetch\n }\n\n assert(newkey.provider.exists?, \"Did not see key in file\")\n end",
"def write_new_key\n File.open(full_key_path, 'w') do |f|\n f.write OpenSSL::PKey::RSA.generate(1024).export()\n end\n end",
"def verify_server_key(key); end",
"def verify_api_key\n return :false if invalid_options?\n value = http_post http_instance, 'verify-key', :key => options[:api_key], :blog => options[:blog]\n self.verified_key = (value == \"valid\") ? true : :false\n end",
"def add_key(key_id, key_content)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys add-key #{key_id} \\\"#{key_content}\\\"\")\n end",
"def add(key, password = nil)\n if @pw_data[key]\n pa %[There is already a password stored for #{key}. You need to remove it before creating a new one!], :red\n return false\n else\n @pw_data[key] = password || ask_for_password(%[please enter a password for #{key}], :yellow)\n if @pw_data[key].empty?\n pa %[Cannot add an empty password!], :red\n return false\n else\n write_safe\n pa %[The password for #{key} has been added], :green\n return true\n end\n end\n end",
"def validate(file)\n Kernel::load file\n ENDPOINT.each_key do |k|\n auth = ENDPOINT[k][:oneauth]\n name = auth.split(\":\",2).first\n if name != ENV[\"USER\"]\n $Logger.error \"User attempting to upload invalid config.rb with user name of #{name} instead of #{ENV[\"USER\"]} for this service\"\n return false\n end\n end\n\n return true\n end",
"def enable_cert_auth(public_key = '~/.ssh/id_rsa.pub')\r\n cert_regex = /^ssh-[rd]sa (?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)? \\S*$/m\r\n\r\n # get our cert unless the user provided a full cert for us.\r\n unless public_key =~ cert_regex\r\n public_key = File.expand_path(public_key)\r\n if File.exist?(public_key)\r\n public_key = File.read(public_key).to_s.strip\r\n else\r\n raise Shells::PfSenseCommon::PublicKeyNotFound\r\n end\r\n raise Shells::PfSenseCommon::PublicKeyInvalid unless public_key =~ cert_regex\r\n end\r\n\r\n cfg = get_config_section 'system'\r\n user_id = nil\r\n user_name = options[:user].downcase\r\n cfg['user'].each_with_index do |user,index|\r\n if user['name'].downcase == user_name\r\n user_id = index\r\n\r\n authkeys = Base64.decode64(user['authorizedkeys'].to_s).gsub(\"\\r\\n\", \"\\n\").strip\r\n unless authkeys == '' || authkeys =~ cert_regex\r\n warn \"Existing authorized keys for user #{options[:user]} are invalid and are being reset.\"\r\n authkeys = ''\r\n end\r\n\r\n if authkeys == ''\r\n user['authorizedkeys'] = Base64.strict_encode64(public_key)\r\n else\r\n authkeys = authkeys.split(\"\\n\")\r\n unless authkeys.include?(public_key)\r\n authkeys << public_key unless authkeys.include?(public_key)\r\n user['authorizedkeys'] = Base64.strict_encode64(authkeys.join(\"\\n\"))\r\n end\r\n end\r\n\r\n break\r\n end\r\n end\r\n\r\n\r\n raise Shells::PfSenseCommon::UserNotFound unless user_id\r\n\r\n set_config_section 'system', cfg, \"Enable certificate authentication for #{options[:user]}.\"\r\n\r\n apply_user_config user_id\r\n end",
"def add_api_key\n @user = current_user\n if @user.present?\n @user.api_key = generate_api_key(16, 'user')\n @user.save\n end\n end",
"def save_public_key(pub_key_file_data, dev_id) \n pub_key_save_path = File.join(@@gitolite_keydir_path, \"#{dev_id}.pub\")\n if !File.exists?(pub_key_save_path)\n File.open(pub_key_save_path, \"wb\") { |f| f.write pub_key_file_data}\n else\n LOGGER.debug \"Public key file already exists at #{pub_key_save_path}; this will not be overwritten\"\n end\n return pub_key_save_path\n end",
"def add_ssh_key(key)\n if persisted?\n pending_op = PendingUserOps.new(op_type: :add_ssh_key, arguments: key.attributes.dup, state: :init, on_domain_ids: self.domains.map{|d|d._id.to_s}, created_at: Time.new)\n CloudUser.where(_id: self.id).update_all({ \"$push\" => { pending_ops: pending_op.serializable_hash_with_timestamp , ssh_keys: key.serializable_hash }})\n reload.run_jobs\n else\n ssh_keys << key\n end\n end",
"def check_key_valid\n @key_warning = false unless defined?(@key_warning)\n if !configuration.valid_api_key? && !@key_warning\n configuration.warn(\"No valid API key has been set, notifications will not be sent\")\n @key_warning = true\n end\n end",
"def add_key(key)\n keys.add(key)\n end",
"def key_check\n logger.debug \"checking authorization key \"\n unauthorized \"No authorization key provided. Please pass the API token as GET parameter named 'key'. Example: ?key=abcdef\" if params[:key].nil?\n logger.debug \"token is \" + params[:key] unless params[:key].nil?\n end",
"def add(key, password = nil)\n if @data[key]\n pa %[There is already a password stored for #{key}. You need to remove it before creating a new one!], :red\n return false\n else\n @data[key] = {}\n @data[key][:password] = password || ask_for_password(%[please enter a password for #{key}], :yellow)\n if @data[key][:password].empty?\n raise ArgumentError, %[Cannot set an empty password!]\n else\n @data[key][:timestamp] = Time.now.to_i\n write_safe\n pa %[The password for #{key} has been added], :green\n return true\n end\n end\n end",
"def remove_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n delete \"/setup/api/settings/authorized-keys\", queries\n end",
"def check_keys\n return if %i(\n create_certificate\n get_bank_certificate\n get_certificate\n get_service_certificates\n ).include? command\n\n begin\n rsa_key signing_private_key\n rescue\n errors.add(:signing_private_key, \"Invalid signing private key\")\n end\n\n x509_certificate own_signing_certificate\n rescue\n errors.add(:own_signing_certificate, \"Invalid signing certificate\")\n end",
"def check_write_key!\n fail ArgumentError, 'Write key must be initialized' if @write_key.nil?\n end",
"def add(key)\n @internal_hash[key] = true\n end",
"def ensure_valid_key( key )\n key.to_s.index( /\\./ ) ? key.to_s.gsub( /\\./, '_' ) : key\n end",
"def edit\n @user = User.find(current_user.id)\n if @user.api.key.nil?\n @user.api.key = SecureRandom.hex\n if@user.api.save\n redirect_to @user\n flash[:success] = 'New api key' +@user.api.key + ' was created'\n else\n render @user\n flash.now[:danger] = 'Api key could not be saved'\n end\n else\n @user.api.key = nil\n @user.api.save\n redirect_to user_path\n flash[:success] = 'Api key was removed'\n end\n end",
"def key_valid?\n token_valid? and @key\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n key = SelfSignedCertificate.new(hostname)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n |io| io.write key.pub end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write key.crt end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write key.priv end\n 'OK'\nend",
"def priv_key_file_valid?(key_file, key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(key_file) ? File.read(key_file) : key_file\n\n begin\n key = ::OpenSSL::PKey::RSA.new key_content, key_password\n rescue ::OpenSSL::PKey::RSAError\n return false\n end\n key.private?\n end",
"def public_private_rsa_key_pair_files_created?(\r\n public_key_string,\r\n public_key_file_name,\r\n private_key_string,\r\n private_key_file_name\r\n)\r\n public_key_file = File.new(public_key_file_name, 'w')\r\n public_key_file.write(public_key_string)\r\n public_key_file.close\r\n private_key_file = File.new(private_key_file_name, 'w')\r\n private_key_file.write(private_key_string)\r\n private_key_file.close\r\n return true\r\nrescue StandardError => e\r\n puts \"Could not create public/private key pair files: #{e.message}\"\r\n return false\r\nend",
"def authorize_api_key\n # If it's blank, send a 403\n if params[:api_key].blank?\n head :forbidden\n return\n end\n\n # Search for the key\n key = ApiKey.where(key: params[:api_key])\n\n # If there's no key, it's not authorized, 403 it\n if key.blank?\n head :forbidden\n return\n end\n\n # Update the key with the current time so we know it's being used\n key.first.update last_used: DateTime.now\n session[:current_key_id] = key.first.id\n end",
"def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder, subject, ca_key_file,\nca_crt_file, passphrase)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n ca_key = OpenSSL::PKey::RSA.new File.read(ca_key_file), passphrase\n ca_cert = OpenSSL::X509::Certificate.new File.read ca_crt_file\n c=SignedCertificate.new(ca_key, ca_cert, subject)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n #|io| io.write c.key.public_key.to_pem end\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.csr.pem\", 'w' do\n #|io| io.write c.csr.to_pem end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write c.cert.to_pem end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write c.key.to_pem end\n 'OK'\nend",
"def generate_validation_key\n self.validation_key = SecureRandom.base64(8)\n end",
"def write_keys_file(keys, keys_file, chown_params = nil)\n dir = File.dirname(keys_file)\n FileUtils.mkdir_p(dir)\n FileUtils.chmod(0700, dir)\n\n File.open(keys_file, 'w') do |f|\n f.puts \"#\" * 78\n f.puts \"# USE CAUTION WHEN EDITING THIS FILE BY HAND\"\n f.puts \"# This file is generated based on the RightScale dashboard permission\"\n f.puts \"# 'server_login'. You can add trusted public keys to the file, but\"\n f.puts \"# it is regenerated every 24 hours and keys may be added or removed\"\n f.puts \"# without notice if they correspond to a dashboard user.\"\n f.puts \"#\"\n f.puts \"# Instead of editing this file, you probably want to do one of the\"\n f.puts \"# following:\"\n f.puts \"# - Edit dashboard permissions (Settings > Account > Users)\"\n f.puts \"# - Change your personal public key (Settings > User > SSH)\"\n f.puts \"#\"\n\n keys.each { |k| f.puts k }\n end\n\n FileUtils.chmod(0600, keys_file)\n FileUtils.chown_R(chown_params[:user], chown_params[:group], File.dirname(keys_file)) if chown_params\n return true\n end",
"def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end",
"def private_key=(private_key); end",
"def add_key(key)\n post(\"/api/v1/ssh_keys\", :key => key).to_s\n end",
"def add_key_data(key_data_); end",
"def assert_keytype(keytype)\n return if allowed_keytypes.include?(keytype)\n raise Chef::Exceptions::ValidationFailed,\n 'ssh_authorize_key: keytype parameter must be equal to one of: '\\\n \"#{allowed_keytypes.join(', ')}! You passed #{keytype.inspect}.\"\n end",
"def is_pending_recovery!\n self.update_attribute(:verification_key, KeyGenerator.create)\n end",
"def allow(key)\n @status[key] = :allowed\n end",
"def create_auth_key\n auth_key = OpenID::Util.random_string(@@AUTH_KEY_LEN)\n f, tmp = mktemp\n begin\n begin\n f.write(auth_key)\n f.fsync\n ensure\n f.close\n end\n begin\n begin\n File.link(tmp, @auth_key_name)\n rescue NotImplementedError # no link under windows\n File.rename(tmp, @auth_key_name)\n end\n rescue Errno::EEXIST\n raise if read_auth_key.nil?\n end \n ensure\n self.remove_if_present(tmp)\n end\n\n auth_key\n end",
"def private_key_file=(file)\n @private_key_file = file and load_private_key\n end",
"def build_and_copy_heartbeat_authkeys_file\n write_to_file_for(\"authkeys\") do\n open(Application.heartbeat_authkeys_config_file).read\n end\n end",
"def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end",
"def add_api_key!(acl, opts = {})\n response = add_api_key(acl, opts)\n\n response.wait(opts)\n end",
"def validate_key_bytes(key_bytes); end"
] |
[
"0.70383155",
"0.6780277",
"0.6525555",
"0.643588",
"0.6186489",
"0.6170219",
"0.6158968",
"0.6038772",
"0.6038772",
"0.6023439",
"0.5982191",
"0.5939054",
"0.5922996",
"0.5909971",
"0.5909971",
"0.5886401",
"0.58801097",
"0.5876721",
"0.5876721",
"0.5846328",
"0.58423823",
"0.5789469",
"0.5748949",
"0.57453215",
"0.5743372",
"0.5730529",
"0.570286",
"0.570057",
"0.5654702",
"0.56406283",
"0.5633986",
"0.56263006",
"0.56140155",
"0.56061274",
"0.5596508",
"0.5585885",
"0.5583907",
"0.55666196",
"0.5557442",
"0.55382454",
"0.5536341",
"0.5528283",
"0.5522019",
"0.5511996",
"0.5501774",
"0.55010134",
"0.5499556",
"0.54904443",
"0.5485056",
"0.5484769",
"0.5479671",
"0.54595006",
"0.5450707",
"0.5404369",
"0.5397341",
"0.53932077",
"0.53903425",
"0.5390099",
"0.5383561",
"0.5378984",
"0.5372972",
"0.5371304",
"0.53703535",
"0.5358149",
"0.53541034",
"0.53382343",
"0.5333318",
"0.5311629",
"0.5307617",
"0.5303747",
"0.53030485",
"0.5297499",
"0.52834326",
"0.5267955",
"0.52578557",
"0.5246996",
"0.5246761",
"0.52426136",
"0.5236986",
"0.52348244",
"0.5230572",
"0.52190304",
"0.52146804",
"0.5208213",
"0.5197833",
"0.51952523",
"0.5189979",
"0.51892275",
"0.5183766",
"0.5180371",
"0.5177525",
"0.51773274",
"0.5168377",
"0.5158822",
"0.5148288",
"0.51449376",
"0.51418155",
"0.51392615",
"0.51388747",
"0.512855",
"0.5127259"
] |
0.0
|
-1
|
Remove a key from the file Returns : +Boolean+ > Destroy success status
|
def destroy
return false if not self.saved?
return self.class.destroy self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove(key)\n Lib.remove @path, @no_follow, key.to_s\n end",
"def delete key\n File.delete( cache_file(key) ) if File.exists?( cache_file(key) )\n end",
"def remove filename\n return false unless source_hash.key?(filename)\n source_hash.delete filename\n true\n end",
"def delete_key(key)\n end",
"def remove(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end",
"def remove(key); end",
"def remove(key)\n\n end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end",
"def delete(key)\n\n end",
"def delete(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end",
"def remove_key(key)\n\t\tdelete(\"/user/keys/#{escape(key)}\")\n\tend",
"def remove_key(key)\n\t\tdelete(\"/user/keys/#{escape(key)}\")\n\tend",
"def remove_key!(rsa)\n refresh_keys\n\n # loop through arrays checking against 'key'\n @keys.each do |key|\n if key[\"key\"] == rsa\n return remove_key_by_id!(key[\"id\"])\n end\n end\n\n return false # key not found\n end",
"def remove_key(key)\n delete(\"/users/ssh_keys/#{escape(key)}\").to_s\n end",
"def remove(filename); end",
"def remove_key(key_id, key_content)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys rm-key #{key_id} \\\"#{key_content}\\\"\")\n end",
"def delete(key)\n pop if change_key(key, nil, true)\n end",
"def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end",
"def destroy\n @key.destroy\n end",
"def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end",
"def del\n File.delete(@file)\n end",
"def remove_key(key_id)\n delete(\"/api/v1/ssh_keys/#{key_id}\").to_s\n end",
"def destroy\n self.class.remove(key)\n end",
"def destroy\n self.class.remove(key)\n end",
"def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end",
"def delete(key)\n timeout_retry(3, 3){\n write \"DEL #{key}\\r\\n\"\n integer_reply == 1\n }\n end",
"def unset key\n storage.delete key\n end",
"def remove(key)\n if @data.delete key\n write_safe\n pa %[The password for #{key} has been removed], :green\n return true\n else\n pa %[No password found for #{key}!], :red\n return false\n end\n end",
"def delete(filename); end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def remove(filename)\n not_implemented('remove')\n end",
"def remove\n key = shift_argument\n if key.nil? || key.empty?\n error(\"Usage: heroku keys:remove KEY\\nMust specify KEY to remove.\")\n end\n validate_arguments!\n\n action(\"Removing #{key} SSH key\") do\n api.delete_key(key)\n end\n end",
"def delete key\n @internal_hash[key].clear\n end",
"def destroy_image(key)\n return unless key.is_a?(String) && !key.empty?\n name, ext = key.split('.')\n self.transaction do\n record = find_by_name name\n # do nothing if not found\n return unless record\n if record.refcount > 1\n record.refcount -= 1\n record.save\n else\n if record.keep_till && record.keep_till > Time.now\n record.refcount = 0\n record.save\n else\n record.purge_image_data\n record.delete\n end\n end\n end\n cleanup_temporary_image\n end",
"def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end",
"def rm(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Removing directory: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.rm_rf(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end",
"def delete_pem(path)\n Puppet::FileSystem.unlink(path)\n true\n rescue Errno::ENOENT\n false\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def getdel(key); end",
"def getdel(key); end",
"def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end",
"def remove_file\n return unless file_exists?\n\n s3_object(false).delete\n rescue => e\n Rails.logger.error \"Unable to delete file #{self.filename}: #{e.message}\"\n end",
"def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end",
"def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end",
"def delete(key_name)\n perform(:delete, key_name)\n true\n end",
"def delete_file(f)\n #return false if !f.kind_of?(Fog::Storage::AWS::File) || !storage_provider.eql?(:aws)\n log \"Deleting: #{f.key}\"\n return f.destroy\n end",
"def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end",
"def delete(key)\n rv = @data.has_key?(key)\n @data.delete(key)\n rv\n end",
"def remove(key)\n a_hash[key] = nil\n end",
"def destroy\n file&.delete\n end",
"def delete\n redis.del key\n end",
"def remove_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n delete \"/setup/api/settings/authorized-keys\", queries\n end",
"def remove\t\n\t\t\tbegin\t\t\t\t\t\t\t\n\t\t\t\tdatatoremove = Datastore.new\t\t\t\n\t\t\t\tdatatoremove.delete(params[:key])\n\t\t\t\trender :status => 200,\n\t \t\t:json => { :response => \"success\",\n\t \t :status => 200,\n\t \t :info => \"Successfully removed\", \n\t \t :data => {} }\n\t\t\trescue Exception => e\n\t\t\t\trender :status => :unprocessable_entity,\n\t \t :json => { :response => \"fail\",\n\t \t :status => 401,\n\t :info => e.message }\n\t\t\tend\n\t\tend",
"def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end",
"def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end",
"def remove!(filename, &callback)\n wait_for(remove(filename, &callback))\n end",
"def del(key)\n @first.del(key)\n end",
"def remove(key, options = {})\n fetch({:method => :delete, :key => key, :body_to_params => true, :body => options}).parsed_response\n end",
"def delete_entry(key, options) # :nodoc:\n @data.remove(key)\n rescue => e\n logger.error(\"KyotoTycoonError (#{e}): #{e.message}\") if logger\n false\n end",
"def remove_key(key)\n deprecate # 07/31/2012\n delete(\"/user/keys/#{escape(key)}\").to_s\n end",
"def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end",
"def remove_content\n File.unlink(filename) if File.exist?(filename)\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def delete_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys.delete(key)\n @available_keys.delete(key)\n end\n @deleted_keys.add key\n puts \"Deleted Key: #{key}\"\n true\n end",
"def remove(key)\n @store.delete_if { |i| i[:key] == build_key(key) }\n end",
"def delete_file\n return false if !@file\n FileUtils.rm @file if File.file? @file\n return true\n end",
"def delete( key )\n fail NotImplementedError\n end",
"def decr(key); end",
"def decr(key); end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def remove(key)\n with_client do |client|\n client.del(build_key(key))\n end\n end",
"def delete(key)\n configuration.hpath_delete.tap do |result|\n save if sync_down\n end\n end",
"def remove(key)\n if @pw_data.delete key\n write_safe\n pa %[The password for #{key} has been removed], :green\n return true\n else\n pa %[No password found for #{key}!], :red\n return false\n end\n end",
"def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end",
"def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def rmFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end",
"def delete_pair(key)\r\n @redis.del key \r\n end",
"def delete(key)\n bucket.objects[key].delete\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end",
"def erase(key)\n if !contains?(key)\n return\n end\n\n erase_internal(key)\n end",
"def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def rmFile(file, logkey='')\n\tMcmlln::Tools.deleteFile(file)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def rmFile(file, logkey='')\n\tMcmlln::Tools.deleteFile(file)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def delete_key_pair\n @os_aws.delete_key_pair\n end",
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend",
"def delete(key)\n storage.transaction {storage.delete(key)}\n end",
"def delete(key)\n @hash.delete key\n @key_hash.delete key\n end",
"def delete_key_value?( key )\n hash = load_hash\n return false if hash.delete(key).nil?\n store_hash hash\n true\n end",
"def remove(key)\n\n if include?(key)\n self[key].delete(key)\n @count -= 1\n end\n\n end",
"def rm path\n end",
"def delete(key)\n @data.delete(key).tap {\n save if autosave?\n }\n end",
"def delete(key)\n @hash.delete(key.to_s)\n end",
"def delete(key)\n unimplemented\n end",
"def remove_file(file)\n File.delete(file) if File.exist?(file)\nend"
] |
[
"0.7630755",
"0.730501",
"0.7292564",
"0.7200753",
"0.717114",
"0.71695024",
"0.7114485",
"0.71117383",
"0.71117383",
"0.71117383",
"0.71117383",
"0.71117383",
"0.70692676",
"0.6953806",
"0.68790305",
"0.6869346",
"0.6869346",
"0.6801761",
"0.678098",
"0.67712253",
"0.6770744",
"0.67663497",
"0.67656946",
"0.6680241",
"0.6679358",
"0.6670974",
"0.6670367",
"0.66483897",
"0.66483897",
"0.6643308",
"0.66343933",
"0.659656",
"0.65942264",
"0.65730786",
"0.65659434",
"0.65659434",
"0.65480316",
"0.6538841",
"0.6526662",
"0.65261453",
"0.65199953",
"0.65179235",
"0.6499801",
"0.6496065",
"0.6489609",
"0.6489609",
"0.6463365",
"0.6451718",
"0.6449646",
"0.6441541",
"0.6430804",
"0.642836",
"0.6420025",
"0.6415162",
"0.641443",
"0.6410557",
"0.63964677",
"0.6393739",
"0.6390076",
"0.6388046",
"0.6382791",
"0.63740087",
"0.6369373",
"0.6360561",
"0.6360395",
"0.63583374",
"0.6350725",
"0.63497114",
"0.6347398",
"0.6344845",
"0.6344628",
"0.6322784",
"0.63191676",
"0.631639",
"0.631639",
"0.6309868",
"0.6309868",
"0.6303627",
"0.63029885",
"0.629612",
"0.6290989",
"0.62908375",
"0.62863815",
"0.62764376",
"0.6273186",
"0.62700826",
"0.62615716",
"0.6260061",
"0.62564",
"0.62564",
"0.62551105",
"0.6253861",
"0.6251949",
"0.62487483",
"0.6238659",
"0.6235914",
"0.62328714",
"0.62284607",
"0.62232184",
"0.6219795",
"0.621145"
] |
0.0
|
-1
|
Construct the line that will be written to file Returns : +String+ > Line that will be written to file
|
def gen_raw_line
return nil unless self.valid?
line = ''
data = []
SUB_STR_ATTRIBUTES.each do |field,field_regex|
val = self.raw_getter field
data.push val if val.nil? == false
end
unless data.empty?
line = "#{data.join ' ,'}"
end
data = []
BOOL_ATTRIBUTES.each do |field|
val = self.raw_getter field
data.push val if val.nil? == false
end
unless data.empty?
if line == ''
line += "#{data.join ','} "
else
line += ",#{data.join ','} "
end
end
data = []
ARR_STR_ATTRIBUTES.each do |field|
val = self.raw_getter field
data.push val if val.nil? == false
end
unless data.empty?
if line == ''
line += "#{data.join ','} "
else
line += ", #{data.join ','} "
end
end
data = []
STR_ATTRIBUTES.each do |field|
val = self.raw_getter field
data.push val if val.nil? == false
end
line += data.join ' '
return line
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_line_to_file file_path,line\n return \"echo #{line} >> #{file_path}\"\n end",
"def string\n @line\n end",
"def write_line(data); end",
"def log(line)\n\t\tfile=File.open(@output_file,\"a+\")\n\t\tfile.puts(line)\n\t\tfile.close\n\tend",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def write_line(string, filename)\n Util::FileMutation.write_line(string, filename)\n end",
"def line_after\n line[column..-1].to_s\n end",
"def append_mode(line)\n File.open(\"#{file}\",\"a\") {|file| file.puts line}\n end",
"def append_line\n File.open(path, 'w') do |fh|\n lines.each do |l|\n fh.puts(l)\n end\n fh.puts line\n end\n end",
"def add_location(path, line); end",
"def report_file_puts(line)\n\n\tFile.open(\"./todolist_save.txt\", \"a\") do |file|\n\t\tfile.puts line\n\tend\nend",
"def to_line\n [@location.join(', '), @details.join(': ')].join(' - ')\n end",
"def file_line=(_arg0); end",
"def write_last_measurement(line, filename = '/tmp/currentcost')\n File.open(filename, \"w\") do |file|\n file.puts Time.now,(line)\n end\nend",
"def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end",
"def detail\n \"#{line}\\n#{' ' * line_offset}^\"\n end",
"def in_file_location(out)\n out << \"#{@row = 1} at #{@column = 1} at #{@length}\"\n end",
"def appendline(fn, s)\n File.open(fn, \"a+\").puts s\nend",
"def project_to_line\n end",
"def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend",
"def to_s\n [\n self.line_01,\n self.line_02,\n self.line_03,\n ].join(\"\\n\")\n end",
"def line\n\t\tl = @name\n\t\t(1..25).each do |i|\n\t\t\tl += \" &\"\n\t\t\tif i <= @number then\n\t\t\t\tl += \" \\\\!$\\\\times$\"\n\t\t\tend\n\t\tend\n\t\tl += \" \\\\\\\\\\n\"\n\t\treturn l\n\tend",
"def writeline(dst_path, line)\n FileUtils.mkdir_p(File.dirname(dst_path))\n File.open(dst_path, 'w') do |f|\n f.write line\n end\n end",
"def line\n end",
"def line\n end",
"def append_line_to_file(filename, line)\n FileUtils.touch(filename)\n File.open(filename, 'a') do |f|\n f.puts line\n end\nend",
"def original_line; end",
"def to_s\n \"Row #{@line}\"\n end",
"def <<(line)\n @extra << line\n end",
"def location\n l = line()\n if l == 0\n \"#{file}+#{ip-1}\"\n else\n \"#{file}:#{line}\"\n end\n end",
"def line(number); end",
"def add_line_to_file(file, line)\n File.open(file, \"a\") {|f| f.puts(\"#{line}\")}\n end",
"def line_one\n @line_one\n end",
"def writeToFile(target, aLine)\n target.puts(aLine)\n end",
"def to_cookiestxt_line(linefeed = \"\\n\")\n [\n @domain,\n @for_domain ? True : False,\n @path,\n @secure ? True : False,\n @expires.to_i.to_s,\n @name,\n @value\n ].join(\"\\t\") << linefeed\n end",
"def line\n @line = line_cell.split(' ').last.to_f\n if opponent_cell['@']\n @line *= -1\n end\n @line\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def newline()\n @file.write(\"\\n\")\n end",
"def line\n 1\n end",
"def save_to_text(final_location)\n #open the pre-determined file to write on\n location_save = open('last_saved.txt','w')\n\n #Generate the lines for the file\n\t location_save.puts(\"Lunch Location:\"+final_location.name)\n\t location_save.puts(\"Lunch Address:\"+final_location.address)\n\t location_save.puts(\"Cuisine Type:\"+final_location.cuisine)\n\t location_save.puts(\"Healthy?:\"+final_location.healthy)\n\t location_save.puts(\"Halal or Non-halal:\"+final_location.halal)\n\t location_save.puts(\"Price range:\"+final_location.price)\n\n\n #close the file\n location_save.close\nend",
"def append_line(line)\n @entries.last.line << line\n end",
"def line=(_); end",
"def line=(_); end",
"def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"\n itemdef.close;\n end",
"def line_one\n return @line_one\n end",
"def append_line_to_file(path, line)\n run \"echo '#{line}' | #{sudo} tee -a #{path}\", options\n end",
"def source_line; end",
"def as_line\n [id, legal_name, name, email, form].join(':')\n end",
"def writelinebinary(dst_path, line)\n FileUtils.mkdir_p(File.dirname(dst_path))\n File.open(dst_path, 'wb') do |f|\n f.write line\n end\n end",
"def line_before\n line[0..column - 1].to_s\n end",
"def to_s\n str = \"# #{@path}\\n#\\n# This file is managed by Chef\\n# Local changes may be lost!\\n\"\n\n last_had_comment = true\n @entries.sort.each do |entry|\n str << \"\\n\" if entry.comment || last_had_comment\n str << entry.format(columns)\n str << \"\\n\"\n last_had_comment = !entry.comment.nil?\n end\n\n str << \"\\n# End of file (#{@entries.size} #{@entries.size == 1 ? 'limit' : 'limits'})\\n\"\n str\n end",
"def output_line(line)\n output = line[:mode] + ' '\n output << line[:repl] + ' '\n output << line[:owner].ljust(@alignment[:owner]) + ' '\n output << line[:group].ljust(@alignment[:group]) + ' '\n output << line[:size].rjust(@alignment[:size]) + ' '\n output << line[:time] + ' '\n output << line[:name] + \"\\n\"\n puts output\n end",
"def add_line(line)\n @tip.string_content += line.slice(@offset, line.length) + '\\n'\n end",
"def create_line(num)\n '-' * num\nend",
"def line=(_arg0); end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def to_line_string lr\n str = lr.from.line.to_s.dup\n if lr.from.line != lr.to.line\n str << \",\" << lr.to.line.to_s\n end\n str\n end",
"def SimpleWriter\n def initialize(path)\n\t @file = File.open(path, 'w')\n end\n def write_line(line)\n\t @file.print(line)\n\t @file.print(\"\\n\")\n end\n def pos\n\t @file.pos\n end\n def rewind\n\t @file.rewind\n end\n def close\n\t @file.close\n end\nend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def line_at(filename, line_number)\n source_reload\n\n return \"\\n\" unless File.exist?(filename)\n line = Tracer::Single.get_line(filename, line_number)\n\n return \"#{line.gsub(/^\\s+/, '').chomp}\"\n end",
"def out text\n @fileBuffer << text << \"\\n\"\nend",
"def writeLine( length=75, char=\"-\" )\n\t\t\t$stderr.puts \"\\r\" + (char * length )\n\t\tend",
"def line(the_line)\n if the_line.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n the_line.each_with_index do |customer, index|\n current_line << \" #{index + 1}. #{customer}\"\n end\n puts current_line\n end \nend",
"def line(number)\n end",
"def line_feed\n write_raw \"\\n\"\n end",
"def to_file\n file = \"\"\n @fileContent.each do |line|\n file << line\n file << \"\\n\" unless line == @fileContent.last\n end\n file\n end",
"def line(length)\r\n puts '-'*length\r\n end",
"def compiled_string_at(line_no)\n line_str = \"\"\n\n value_arr.each do |num|\n if dash_lines.keys.include?(line_no)\n line_str << dash_or_blank_fill(line_no, num)\n else\n line_str << bars(line_no, num)\n end\n\n line_str << \" \"\n end\n\n line_str\n end",
"def dp_line(line, options = { filename: '', char: '-' })\n filename = options[:filename].nil? ? '' : options[:filename]\n char = options[:char].nil? ? '-' : options[:char]\n puts \"#{char * 20}|filename=#{filename}|line=#{line}|#{char * 20}\"\n end",
"def to_file\n \"#{@name};#{@id}\"\n end",
"def add_comment_line line\n @strings << line\n end",
"def source_line=(_); end",
"def to_s\n lines.join(\"\\n\")\n end",
"def write\r\nFile.open('calibration.conf', 'w') { |file| file.write(@@leg_string.chop) }\r\n# CSV.open('calibration.conf.csv', 'w') do |csv_conf|\r\n# @@leg_array.each do |row_array|\r\n# csv_conf = row_array\r\n# end\r\n# end\r\n end",
"def from_line\n position.new_line\n end",
"def line\n buffer[line_number]\n end",
"def line_num; end",
"def new_line\n @source_lines << []\n end",
"def line_at(filename, line_number) # :nodoc:\n line = LineCache::getline(filename, line_number, @reload_on_change)\n return \"\\n\" unless line\n return line.gsub(/^\\s+/, '').chomp\n end",
"def line\n lines.first\n end"
] |
[
"0.66613233",
"0.65748626",
"0.65595996",
"0.65298337",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.6502042",
"0.64707774",
"0.6342598",
"0.6233344",
"0.62066567",
"0.617236",
"0.6150837",
"0.61436325",
"0.61431617",
"0.61421543",
"0.6103476",
"0.60711926",
"0.6070184",
"0.60596305",
"0.6042148",
"0.6039299",
"0.6021248",
"0.60142654",
"0.5975264",
"0.59591013",
"0.59591013",
"0.5937528",
"0.59265256",
"0.5887841",
"0.5872354",
"0.5869122",
"0.58579916",
"0.58157456",
"0.5797257",
"0.578089",
"0.57797354",
"0.5779092",
"0.576701",
"0.57430047",
"0.5728037",
"0.57187074",
"0.5710002",
"0.5686261",
"0.5686261",
"0.5680783",
"0.56778157",
"0.5671773",
"0.5666417",
"0.566545",
"0.5664673",
"0.5662547",
"0.5652945",
"0.5624915",
"0.5617969",
"0.5611339",
"0.56010425",
"0.5599551",
"0.5595015",
"0.5585131",
"0.5582556",
"0.5582556",
"0.5582556",
"0.5582556",
"0.5582556",
"0.5582556",
"0.5582556",
"0.5582443",
"0.55781645",
"0.55655605",
"0.5561042",
"0.5560316",
"0.55574745",
"0.5556075",
"0.5534145",
"0.55300534",
"0.5521615",
"0.5518274",
"0.5515453",
"0.5510735",
"0.5509371",
"0.55034983",
"0.5500669",
"0.54994893",
"0.54941297",
"0.5493434",
"0.54829854",
"0.54787356"
] |
0.55080426
|
93
|
Validate the key If the validations fail the reason for the failure will be
|
def valid?
self.errors = []
BOOL_ATTRIBUTES.each do |field|
val = self.raw_getter field
unless val.nil? == true || val == true || val == false
self.errors.push field=>ERRORS[:bool]
end
end
if self.key_data.nil?
self.errors.push ERRORS[:data_nil]
return false
end
if self.key_type.nil?
self.errors.push ERRORS[:type_nil]
return false
end
if not self.key_data.match "^#{B64_REGEX}$"
self.errors.push ERRORS[:data_char]
end
if self.key_data.size < 30
self.errors.push ERRORS[:data_short]
end
if self.key_data.size > 1000
self.errors.push ERRORS[:data_long]
end
if self.key_data.size % 4 != 0
self.errors.push ERRORS[:data_modulus]
end
return self.errors.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_key; end",
"def verify_key; end",
"def validate_only(key)\n validation_name, attribute_name = key.split(\"/\")\n validation_name = validation_name.split(\"_\").collect{|word| word.capitalize}.join\n validation_key = \"#{self.name}/Validatable::Validates#{validation_name}/#{attribute_name}\"\n validation = self.all_validations.find { |validation| validation.key == validation_key }\n raise ArgumentError.new(\"validation with key #{validation_key} could not be found\") if validation.nil?\n errors.clear\n run_validation(validation)\n end",
"def validate!(key, with: nil, message: 'is not valid', **options, &block)\n before_validation do\n if has_key? key\n JSONAPIonify::Continuation.new(**options).check(self, key, self[key]) do\n real_block = get_block_from_options(with, &block)\n errors.add key, message unless real_block.call(self, key, self[key])\n end\n end\n end\n end",
"def key_valid?\n token_valid? and @key\n end",
"def validate(exemplar, hash, message)\n hash.each_key do |k|\n fail NebulousError, \"#{message} key '#{k}'\" unless exemplar.include?(k)\n end\n end",
"def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end",
"def validate_key_bytes(key_bytes); end",
"def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end",
"def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end",
"def validate(hash, errors)\n end",
"def validate!(data)\n keys.each do |key|\n raise InvalidSchemaError.new(\"missing key #{key}\") unless data.key?(key)\n end\n end",
"def validate_key!(key)\n unless key.is_a?(String) or key.is_a?(Symbol)\n raise SketchUpJSON::JSONEncodeError, \"This hash can not generate valid JSON\"\n end\n end",
"def valid_key?(key)\n return false unless key.is_a?(String)\n return false unless key = encoded_key(key)\n key.length >= 2 && key.length <= 255 && (key !~ BAD_KEY_RE rescue false)\n end",
"def validate(composite_object)\n # Get the hash value from the composite object\n return if composite_object.hash.key?(@key)\n\n # Do unless_presence_of check\n if @unless_presence_of\n return if composite_object.hash.key?(@unless_presence_of)\n end\n\n error_messages.push(\"Required Key Missing: #{@key}, at: #{composite_object.location}.\")\n end",
"def validate(widget, key, options)\n with_instance_content(widget, options) do |instance_key|\n valid_keys = begin\n retrieve(instance_key)\n rescue CacheNotAvailable\n return {}\n end\n valid_keys ||= {}\n (valid_keys[:keys] ||= []) << key\n valid_keys[:keys].uniq\n store(instance_key, valid_keys, get_expiration_time(widget, options))\n end\n\n end",
"def check_key_validity(key_info)\n if key_info[:key_name] == :aws\n return 'error', \"can't find this key\" if @keys_data_index[key_info[:key_value].to_sym].nil?\n if (DateTime.now - @days_to_validate) > (@keys_data_index[key_info[:key_value].to_sym][:created_date])\n return 'invalid', nil\n else\n return 'valid', nil\n end\n else\n ['error', 'key unknown']\n end\n end",
"def not_valid?\n tst = @potential_key.split('')\n\n tst.each do |check|\n if @@low_alpha[check].nil? && @@up_alpha[check].nil?\n @result = true\n break\n else \n @result = false\n @valid_key = @potential_key\n end\n end\n\n @result\n end",
"def validate_keys(*valid_keys)\n valid_keys.flatten!\n @hash.each_key do |k|\n unless valid_keys.include?(k)\n raise ArgumentError.new(\"Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}\")\n end\n end\n end",
"def validate(key, &validator)\n vs = (validators[key] || [])\n vs << validator\n validators[key] = vs\n end",
"def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end",
"def validate(key, validation)\n raise MissingRPCData, \"please supply a #{key} argument\" unless @request.include?(key)\n\n Validator.validate(@request[key], validation)\n rescue ValidatorError => e\n raise InvalidRPCData, \"Input %s did not pass validation: %s\" % [key, e.message]\n end",
"def verify_key(key, _context = nil)\n key && String(key)\n end",
"def validate(composite_object)\n # Get the hash from the composite object\n target_hash = composite_object.hash\n\n target_hash.each_key do |key|\n error_messages.push(\"Invalid Key: #{key}, at: #{composite_object.location}. Allowed keys: #{@allowed_keys}.\") unless @allowed_keys.include?(key)\n end\n end",
"def generate_validation_key\n self.validation_key = SecureRandom.base64(8)\n end",
"def verify_key(key, context = nil)\n key && String(key)\n end",
"def valid?(key = nil, name = nil)\n return false unless key\n\n new(key, name).valid?\n end",
"def key_must_be_a_possible_key_from_the_phone_model\n phone_model = self.sip_account.phone.phone_model\n if !phone_model.phone_model_keys.exists?(self.phone_model_key_id)\n errors.add( :phone_model_key_id, \"Is not a valid PhoneModelKey for the PhoneModel #{phone_model.name} (ID #{phone_model.id}).\" )\n end\n end",
"def check_required(validation:, key:, schema:)\n return false unless validation[:required] && schema.nil?\n\n error! key, \"was required\"\n true\n end",
"def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end",
"def validate_key_exists(*args)\n args.each do |key|\n validators << lambda do |message|\n raise Refinery::InvalidMessageError, \"Key does not exist in message: #{key}\" unless message[key]\n end\n end\n end",
"def key_errors\n key(\"errors\")\n end",
"def validate\n encrypt\n end",
"def []( key )\n\t\tself.validate unless self.validated?\n\t\treturn @valid[ key.to_sym ]\n\tend",
"def ensure_valid_key( key )\n key.to_s.index( /\\./ ) ? key.to_s.gsub( /\\./, '_' ) : key\n end",
"def verify_server_key(key); end",
"def phone_key_function_definition_must_be_valid\n if !self.sip_account.phone.phone_model.phone_model_keys.first.phone_key_function_definitions.exists?(self.phone_key_function_definition_id)\n errors.add( :phone_key_function_definition_id, \"Is not a valid phone_key_function_definition for the PhoneModelKey ID #{self.phone_model_key_id}.\" )\n end\n end",
"def validate_option_key(opts, key)\n raise \"opts[:#{key}] or opts['#{key}'] must be given\" unless opts.has_key?(key)\n end",
"def valid_rsa_key(key)\n key['use'] == 'sig' && key['kty'] == 'RSA' && key['kid']\n end",
"def validate_code\n \n # Don't validate in dev mode\n return true if Rails.env==\"development\"\n \n begin\n \n id = params[:key].to_s.split(\"-\")[0]\n code = params[:key].to_s.split(\"-\")[1]\n \n @version = params[:version].to_i\n \n @api_key = ApiKey.find( id )\n if ( @api_key && @api_key.enabled? && @api_key.code==code )\n return true\n else\n reject and return false\n end\n \n rescue\n reject and return false\n end\n \n end",
"def verify_api_key\n return :false if invalid_options?\n value = http_post http_instance, 'verify-key', :key => options[:api_key], :blog => options[:blog]\n self.verified_key = (value == \"valid\") ? true : :false\n end",
"def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end",
"def valid\n if self.key\n key_pieces = self.key.split(\" \")\n small_key = key_pieces[0] + \" \" + key_pieces[1]\n #if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+]+==?).*$/\n if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+].*)$/\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n elsif caption.to_s.empty?\n raise ValidationError.new(\"a change in the image caption is required\")\n else\n true\n end\n end",
"def check_key_valid\n @key_warning = false unless defined?(@key_warning)\n if !configuration.valid_api_key? && !@key_warning\n configuration.warn(\"No valid API key has been set, notifications will not be sent\")\n @key_warning = true\n end\n end",
"def is_error?(key, value)\n case key\n when 'api_token_secret_key' then true if value.empty? ||\n value !~ /\\Askey_[a-zA-Z0-9]+\\z/\n\n when 'account_alias' then true if value.empty? ||\n value.length > 15 ||\n value !~ /\\A[a-z0-9]+\\z/\n\n when 'recipe' then true if value.empty? ||\n value.length > 25 ||\n value !~ /\\A[a-zA-Z0-9_]+\\z/\n\n when 'server' then true if !value.empty? &&\n value !~ /\\A[a-zA-Z0-9_]+\\z/\n\n when 'groups' then true if !value.empty? &&\n value !~ /\\A[a-zA-Z0-9_\\s\\,]+\\z/\n else\n false\n end\n end",
"def generate_validkey(from_string = nil)\n\t\tfrom_string ||= User.sha1(AuthHelper::Utils::random_string(30))\n write_attribute \"validkey\", from_string\n end",
"def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end",
"def validate\n validate_required_all(%w[client_sdk_id])\n validate_required_any(%w[key_file_path key])\n validate_value('api_version', ['v1'])\n end",
"def validate_key_wrap(key_wrap_schema, key)\n if key.is_a? OpenSSL::PKey::RSA\n unless key_wrap_schema == :rsa_oaep_sha1\n raise ArgumentError, ':key_wrap_schema must be set to :rsa_oaep_sha1 for RSA keys.'\n end\n else\n unless key_wrap_schema == :aes_gcm\n raise ArgumentError, ':key_wrap_schema must be set to :aes_gcm for AES keys.'\n end\n end\n\n case key_wrap_schema\n when :rsa_oaep_sha1 then 'RSA-OAEP-SHA1'\n when :aes_gcm then 'AES/GCM'\n when :kms_context\n raise ArgumentError, 'A kms_key_id is required when using :kms_context.'\n else\n raise ArgumentError, \"Unsupported key_wrap_schema: #{key_wrap_schema}\"\n end\n end",
"def validate(keys)\n errors = []\n\n keys.each do |k|\n pretty_key = k.to_s.gsub(/_/, ' ').gsub(/\\w+/){ |w| (w =~ /(ssh)|(aws)/i) ? w.upcase : w.capitalize }\n if Chef::Config[:knife][k].nil? and config[k].nil?\n errors << \"You did not provide a valid '#{pretty_key}' value.\"\n end\n end\n\n if errors.empty?\n return true\n else\n return false\n end\n end",
"def assert_key(key)\n return if key.is_a?(String) && !SSH_KEY_REGEX.match(key).nil?\n raise Chef::Exceptions::ValidationFailed,\n 'ssh_authorize_key: key parameter must be a valid SSH public key! '\\\n \"You passed #{key.inspect}.\"\n end",
"def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def validate(hash)\n @validator.validate(*collect_on_hash(hash)) ? nil : @onfailure\n end",
"def validate\r\n validate! rescue false\r\n end",
"def issueKey_test(key, no_throw = false)\n if key.nil? || !(/^[A-Z]+-[0-9]+$/i =~ key)\n raise Jiralicious::JiraError.new(\"The key #{key} is invalid\") unless no_throw\n return false\n end\n return true\n end",
"def validate_env\n validate_keys :rock_key, :rock_username, :rock_password\n end",
"def rule_error?(key)\n !schema_error?(key) && error?(key)\n end",
"def valid?(key)\n MENUS.keys.map(&:to_sym).include?(key.to_sym)\n end",
"def assert_valid_now(key, value)\n validators[key].each do |validator|\n validator.call(key, value)\n end\n end",
"def require_keys(*p_valid_keys)\n l_missing_keys = []\n p_valid_keys.flatten!\n p_valid_keys.each do |k|\n l_missing_keys << k unless self.has_key?(k)\n end\n\n unless l_missing_keys.empty?\n raise ArgumentError.new(\"Missing required key(s): #{l_missing_keys.map(&:inspect).join(', ')}\")\n end\n\n end",
"def validate_token_hash; end",
"def validate\r\n @invalid=false\r\n end",
"def validate_env\n validate_keys :coinbase_key, :coinbase_address, :coinbase_secret\n end",
"def validate_allowed_keys\n client_kyc_config_details = @client.client_kyc_config_detail\n\n @kyc_fields = @set_allowed_keys & client_kyc_config_details.kyc_fields_array\n\n @extra_kyc_fields = @set_allowed_keys & client_kyc_config_details.extra_kyc_fields.stringify_keys.keys\n\n unallowed_keys = @set_allowed_keys - (@kyc_fields + @extra_kyc_fields)\n return error_with_identifier('invalid_api_params', 'cm_uaf_vak_1', ['invalid_set_allowed_keys'], 'Invalid field selected') if unallowed_keys.present?\n\n success\n end",
"def check(key_value)\n\t\t\tcase key_value.class.to_s\n\t\t\twhen 'Array'\t\n\t\t\t\traise ArgumentError, \"Altering values for numeral 1 and 5 is not allowed\" if key_value[1].to_i == 1 || key_value[1].to_i == 5\n\t\t\t\traise ArgumentError, \"Altering the corresponding values for roman numeral 'I' and 'V' not allowed\" if key_value[0] == 'I' || key_value[0] == 'V'\n\t\t\t\traise ArgumentError, \"An attmept was made to set value that is not among the base values #{RNSUBBASE.values}\" if !RNSUBBASE.values.include?(key_value[1].to_i) \n\t\t\twhen 'Hash'\n\t\t\t\tkey_value.each do |key, value|\n\t\t\t\t\tif RNSUBBASE.key?(key) && RNSUBBASE[key] != key_value[key] && !key_value.value?(RNSUBBASE[key])\n\t\t\t\t\t\traise ArgumentError, \"Roman numeral #{key} to be used as a user defined roman numeral for #{value} provide user defined roman numeral for #{RNSUBBASE[key]}\" \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen 'Fixnum'\n\t\t\t\traise ArgumentError, \"Currently unable to convert values larger than 8999, primarily due to time restrictions \\\"next update maybe\\\"\" unless key_value < 9000\t\n\t\t\telse\n\t\t\t\tputs \"What happened\"\n\t\t\tend\n\t\t\tself\n\t\tend",
"def validate()\n # rung base method to check\n # for alphabet\n super\n # check for sequenz\n # an validate sequenz length\n if (sequenz?)\n # hier check sequenz length \n if(@lenth != @string.length)\n raise \"String length is not correct\\nRequired lenght: #{@lenth}\\nCurrent length: #{@string.length}\\nString:#{@string}\" \n end\n end\n end",
"def validate_input(values)\n return true unless values['api_key'].strip.empty?\n\n CommonDialogs.showWarning(\"Please provide a #{NAME} API Key.\")\n false\n end",
"def validate!\n # pass\n end",
"def validate_redis_key\n valid_fields = redis_fields_config.select{|k,v| v != :array && v != :hash }.keys\n bad_fields = redis_key_config - valid_fields\n raise ArgumentError, \"Sorry, but you cannot use as redis key [nonexisting | array | hash] fields: [#{bad_fields.join(\",\")}], availible are: #{valid_fields.join(\", \")}\" unless bad_fields.size == 0\n end",
"def valid?(rng = nil, thorough = false)\n rng ||= Botan::RNG.new\n flags = thorough ? 1 : 0\n rc = LibBotan.botan_privkey_check_key(@ptr, rng.ptr, flags)\n rc.zero?\n end",
"def validate_hash(the_input, the_array)\n nil_values(the_input)\n incorrect_keys(the_input, the_array)\n end",
"def require_key\n fail 'No private key loaded' unless @private_key\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validate\n @invalid=false\n end",
"def schema_is_valid_key_value?(key, value, trace)\n schema_valid_trace(\"schema_is_valid_key_value?\", value, trace, key)\n ((key.is_a?(String)) ?\n ((key =~ /^\\|OPT.*\\|/) ?\n ((value.is_a?(Hash) && (value.keys.length == 1)) ?\n schema_is_valid_hash?(value, trace) :\n schema_valid_error(value, \"Schema OPT value not 1-keyed Hash\", trace)) :\n ((key =~ /^\\|ALT.*\\|/) ?\n ((value.is_a?(Hash) && (value.keys.length == 2)) ?\n schema_is_valid_hash?(value, trace) :\n schema_valid_error(value, \"Schema ALT Value not 2-keyed Hash\", trace)) :\n schema_is_valid_internal?(value, trace))) :\n schema_valid_error(key, \"Schema key not of type String\", trace))\n end",
"def validate_input_keys\n input_keys = Input.all.map(&:key)\n preset_keys = user_values.keys\n\n if (intersection = preset_keys - input_keys).any?\n errors.add(:user_values,\n \"contains input keys which don't exist: \" \\\n \"#{ intersection.sort.inspect }\")\n end\n end",
"def validate_ctx(ctx)\n logger.debug 'Validating %s' % ctx.keys.inspect\n # any unknown key raises an Exception\n invalid_keys = (ctx.keys | context_keys) - context_keys\n if invalid_keys.any?\n msg = 'Invalid keys: %s' % invalid_keys.inspect\n logger.debug msg\n raise Exception, msg\n end\n return true\n end",
"def validate(*args, **kargs)\n end",
"def validate_config\n %w(api_token_secret_key account_alias recipe server groups).each {|key|\n raise_config_error(\"Invalid or empty #{key}\") if is_error? key, config_value(key)\n }\n end",
"def validation_key(client_id = nil, client_secret = nil)\n hdrs = client_id && client_secret ?\n { \"authorization\" => Http.basic_auth(client_id, client_secret)} : {}\n json_get(target, \"/token_key\", key_style, hdrs)\n end",
"def validate_keys_are_correct\n raise InvalidAttributeError, \"#{EXPECTED_MODELS - json.keys} were not found in the mixtape.json file\" unless (EXPECTED_MODELS - json.keys).empty?\n end",
"def may_not_exist!(key, without: nil, **options)\n return may_not_exist_without! key, without if without\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |k|\n errors.add(k, 'is not permitted')\n end\n end\n end\n end\n end",
"def validate\n self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def invalid_key(system_key)\n fail InvalidSyntax, \"`#{system_key}` must be a String or a Symbol.\"\n end",
"def schema_error?(key)\n schema_result.error?(key)\n end",
"def error?(key)\n errors.any? { |msg| Schema::Path[msg.path].include?(Schema::Path[key]) }\n end",
"def checkKeys()\r\n\r\n data = nil\r\n if (@cafile.nil? || @cafile.empty? || !File.exists?(@cafile) || OpenSSL::X509::Certificate.new(File.read(@cafile)).nil?)\r\n raise SecurityError, \"CA Public key NOT OK!\"\r\n else\r\n _dprint(\"CA Public Key OK\")\r\n end\r\n\r\n if (@keyfile.nil? || @keyfile.empty? || !File.exists?(@keyfile) || OpenSSL::X509::Certificate.new(File.read(@keyfile)).nil?)\r\n raise SecurityError, \"Public key NOT OK!\"\r\n else\r\n _dprint(\"Public Key OK\")\r\n end\r\n\r\n if (!File.exists?(@keyfile) || OpenSSL::PKey::RSA.new(File.read(@keyfile), @keypass).nil?)\r\n raise SecurityError, \"Private key NOT OK!\"\r\n else\r\n _dprint(\"Private Key OK\")\r\n end\r\n\r\n end",
"def validate_length(key)\n if key == 'text'\n instance_variable_get(\"@#{key}\").size.between?(1, 120)\n else\n instance_variable_get(\"@#{key}\").size.between?(6, 16)\n end\n end",
"def fast_assert_valid_keys(valid_keys)\n unknown_keys = keys - valid_keys\n raise(ArgumentError, \"Unknown key(s): #{unknown_keys.join(\", \")}\") unless unknown_keys.empty?\n end",
"def check_api_key(key_value)\n\n if Key.find_by_key_value(key_value).nil?\n\n redirect_to unauthorized_key_path\n\n return false\n\n end\n\n return true\n\n end",
"def key_failures\n key(\"example_failures\")\n end",
"def test_if_valid_api_key_is_accepted\n real_key_value = \"abcdefgh-ijkl-mnop-qrst-uvwxyz012345\"\n\n begin\n Yo.api_key = real_key_value\n api_key = Yo.api_key\n rescue YoException => e\n api_key = \"\"\n end\n\n assert_equal api_key, real_key_value, \"Yo.api_key does not accept a valid Yo API key\"\n end",
"def batch_key\n key = \"validation-\"\n key += \"rt:#{self.route_id}-ep:#{self.endpoint_id}-#{self.endpoint_type}\"\n key\n end",
"def validate(klass, options)\n valid_keys?(options) or raise Errors::InvalidStorageOptions.new(klass, options)\n end",
"def validations_for(key)\n ensure_config_loaded!\n if setting = config[key.to_s]\n setting['validations'] || {}\n else\n {}\n end\n end",
"def valid?\n validate\n (errors.keys.length == 0)\n end",
"def verify_key\n\t\t\tunless (Happyfunrun::app_id==params[:app_id] and Happyfunrun::api_key==params[:api_key])\n\t\t\t\trender :json=>{:status=>'300', :error=>'Access Denied'}\n\t\t\t\treturn\n\t\t\tend\n\t\tend"
] |
[
"0.71260524",
"0.71260524",
"0.6934062",
"0.69119585",
"0.6889627",
"0.67623305",
"0.67425066",
"0.67295855",
"0.67213017",
"0.6706033",
"0.6670275",
"0.6669564",
"0.6598329",
"0.65558654",
"0.6524957",
"0.65197897",
"0.65175945",
"0.65168136",
"0.6516789",
"0.6488474",
"0.6478023",
"0.6473439",
"0.6456996",
"0.64245063",
"0.64074296",
"0.6345236",
"0.63441586",
"0.62363815",
"0.6229522",
"0.6216269",
"0.61981624",
"0.6188082",
"0.6174535",
"0.6163197",
"0.6157102",
"0.6149053",
"0.6148917",
"0.61266255",
"0.61060166",
"0.608835",
"0.60756963",
"0.60595876",
"0.60585296",
"0.6057765",
"0.6045868",
"0.6021549",
"0.6008349",
"0.6003819",
"0.59971946",
"0.59945816",
"0.5993269",
"0.5987393",
"0.5979076",
"0.5958769",
"0.5954599",
"0.59486794",
"0.5925538",
"0.59205925",
"0.591902",
"0.58962464",
"0.5896001",
"0.58888423",
"0.5877665",
"0.58533305",
"0.5851087",
"0.58451605",
"0.58417916",
"0.584081",
"0.583507",
"0.5821808",
"0.5820238",
"0.5806583",
"0.58013815",
"0.57976353",
"0.5793292",
"0.5793292",
"0.57915884",
"0.57915074",
"0.5786837",
"0.5782843",
"0.5777321",
"0.5767638",
"0.57521236",
"0.57482976",
"0.5746427",
"0.57420474",
"0.57350653",
"0.5735015",
"0.5733892",
"0.5729379",
"0.5727993",
"0.57155824",
"0.5714617",
"0.5705272",
"0.57038337",
"0.5701875",
"0.5700955",
"0.5699646",
"0.56990594",
"0.56920314"
] |
0.5703121
|
95
|
Has the key already been saved to file? Returns : +Boolean+ > True if has been saved before, otherwise false
|
def saved?
return false if not self.valid?
return self.saved
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def already_stored?\n !file_uniqueness\n end",
"def can_save?\n @key != '1'\n end",
"def a_save_exists?\n DataManager.save_file_exists?\n end",
"def saved?\n return !@realfile.nil?\n end",
"def saved?\n self.class.exists?(self.hash)\n end",
"def persisted?\n !@key.nil?\n end",
"def has_key? (fei)\n\n File.exist?(compute_file_path(fei))\n end",
"def persisted?\n path.file? || @last_saved_file_path && @last_saved_file_path.file?\n end",
"def saved?\n !!@saved\n end",
"def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end",
"def save_exists?(index)\n File.exists?(DataManager.make_filename(index-1))\n end",
"def save\r\n if valid?\r\n begin\r\n File.open(@filename, 'w') { |f| YAML.dump(@hash, f) }\r\n rescue StandardError => e\r\n Rails.logger.error(e)\r\n end\r\n \r\n # in production environment, there may be several threads of the application that are being cached, which will contain old\r\n # values for these settings; to workaround this, tell Passenger to restart after saving. This will cause the server to restart\r\n # on the next request (there is a separate server process that checks this file).\r\n FileUtils.touch(File.join(Rails.root, 'tmp', 'restart.txt')) if Rails.env.production?\r\n \r\n true\r\n else\r\n false\r\n end\r\n end",
"def save?\n save == true\n end",
"def save_data?\n return safeExists?(RTP.getSaveFileName(\"Game.rxdata\"))\n end",
"def saved?\n return @saved\n end",
"def exist?(key)\n store.key?(key)\n end",
"def previously_existed?\n true\n end",
"def saved?\n @saved\n end",
"def autosaved?\n Threaded.autosaved?(self)\n end",
"def saved?\n !new_record? && attributes == saved_attributes\n end",
"def autosaved?\n Threaded.autosaved?(self)\n end",
"def saved?\n !new? && !@content\n end",
"def save\n create_file\n true\n end",
"def stored?(file)\n ok_file = get_ok_file_for(file)\n fail_file = get_fail_file_for(file) \n if ( File.exists?(ok_file) or File.exists?(fail_file) )\n return true\n end \n return false\n end",
"def key_set?\n !attributes['key'].nil?\n end",
"def sign_file?\n @private_key_path && File.exists?(@private_key_path)\n end",
"def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end",
"def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end",
"def is_new?\n !File.exists? @filename\n end",
"def saved?\n res = uri.nil?\n !res\n end",
"def exists?\n persistent? && (filename && filename.exist?)\n end",
"def persisted?\n db_file && db_file.file?\n end",
"def key?(key, options = {})\n if @backend.exists(key)\n update_expires(key, options, nil)\n true\n else\n false\n end\n end",
"def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end",
"def key?\n return true if @key; false\n end",
"def saved?\n @saved\n end",
"def private_key_exists?\n full_key_path.exist?\n end",
"def previous_signature?\n !stored_signature.empty?\n end",
"def save\n begin\n save!\n true\n rescue\n false\n end\n end",
"def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end",
"def writable?\n transient? || (filename && filename.writable?)\n end",
"def saved_already?\n @id != \"\" && @id != nil\n end",
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end",
"def save_attachment?\n @save_attachment\n end",
"def already_persisted?\n false\n end",
"def new_file?\n @new_file\n end",
"def stored?(file = self.file)\n uploaded?(file, store_key)\n end",
"def save_data\n begin\n File.open(@file, 'w') do |out|\n YAML.dump(@data, out)\n end\n rescue => e\n Lorj.error(format(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\")))\n return false\n end\n true\n end",
"def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exactly\n # midnight and some audio already existed for the next day.\n path = File.join(\n AUDIO_PATH_ROOT,\n self.store_dir,\n self.filename\n )\n\n if File.exist?(path)\n self.errors.add(:mp3, \"A file with that name already exists; \" \\\n \"please rename your local audio file and try again. \" \\\n \"If you are trying to replace the audio file, first delete the \" \\\n \"old audio.\")\n end\n end",
"def signature_changed?\n signature != stored_signature\n end",
"def signature_changed?\n signature != stored_signature\n end",
"def previously_ran?\n File.exist?(previous_runs_filename)\n end",
"def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end",
"def store?\n false\n end",
"def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end",
"def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end",
"def save\n save!\n rescue StandardError\n false\n end",
"def save_without_revision\n save_without_revision!\n true\n rescue\n false\n end",
"def saved?\n saved_at != nil\n end",
"def save\n Cooler::Adapter.set.(_key, serializable_hash)\n !Cooler::Adapter.get.(_key).nil?\n end",
"def key?\n @key\n end",
"def key?\n @key\n end",
"def save\n !update_case.has_key?(\"error\")\n end",
"def has_been_seen\n return false if self.new_record?\n self.seen = true\n self.save\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def store?\n true\n end",
"def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n true\n end",
"def isNew()\n if !File.file?(getConfigFilePath()) || ! File.file?(getMyIDFilePath())\n return true\n end\n return false\n end",
"def save\n ensure_file_open!\n @file.commit\n true\n end",
"def has_key?(key)\n keys.include?(key)\n end",
"def exist?(key)\n File.exist?(cache_path(key))\n end",
"def dictionary_exists?\n unless File.exist?(\"dictionary.txt\")\n scrub_dictionary(@@raw_dictionary)\n create_dictionary_file(scrub_dictionary(@@raw_dictionary))\n end\n\n end",
"def persists_state_via_data_import?\n false\n end",
"def persisting?\n persisting == true\n end",
"def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end",
"def saved_changes?\n mutations_before_last_save.any_changes?\n end",
"def save_backup?\n return Dir.get_files(\"SaveBackup/\").map {\n |file| file.ends_with?(\".rxdata\")\n }.length > 0\n end",
"def updatedb_file_exists?(file)\n @updatedb.key?(file)\n end",
"def has_key? key; key? key; end",
"def stored?\n !@_id.nil?\n end",
"def key?(key)\n raise \"you are not allowed to use double dot '..' notation in paths\" if key.match(/\\.\\.\\//)\n ::File.exists?(full_key(key))\n end",
"def committed?\n @saved\n end",
"def has_key?(name)\n hashed.has_key? name\n end",
"def savable? \n true\n end",
"def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def save!(options={})\n options[:content] = self\n options = @options.merge(options)\n\n return(true) if @key.save(options)\n return(false) # Create and raise Error message for this? Extend \"Failed Request\"?\n end",
"def save(path)\n Pathname.new(path).write(self.to_yaml)\n\n true\n rescue\n # TODO Add a custom exception here to track why it erred. IO? Permissions? etc.\n false\n end",
"def modified_existing?\n false\n end",
"def uploaded?(uploaded_file)\n uploaded_file.storage_key == storage_key.to_s\n end",
"def persisted?\n @saved\n end",
"def dirty?\n result = false\n if @original_movie.nil?\n result = true\n else\n @movie.each do |key, value|\n if @original_movie[key].nil?\n result = true\n break\n end\n if @movie[key].to_s != @original_movie[key].to_s\n result = true\n break\n end\n end\n unless result\n diff_keys = @movie.keys.sort - @original_movie.keys.sort\n unless diff_keys.empty?\n result = true\n end\n end\n end\n result\n end",
"def key?(key, options = {})\n with_expiry_update(key, default: nil, **options) do |pipeline_handle|\n if pipeline_handle.respond_to?(:exists?)\n pipeline_handle.exists?(key)\n else\n pipeline_handle.exists(key)\n end\n end\n end",
"def exist?(key)\n\n end",
"def persisted?( *args )\n\n has_key = false\n no_key = false\n key = nil\n case args.count\n when 1\n key = args[0]\n when 0\n no_key = true\n end\n\n # if we have no args we are asking whether any keys exist\n if no_key\n \n has_key = true unless ( @parent_index || @parent_bucket ).count == 0\n \n else\n \n serialized_key = nil\n if @parent_index\n serialized_key = @parent_bucket.parent_adapter.class::SerializationClass.__send__( @parent_bucket.parent_adapter.class::SerializationMethod, key )\n else\n serialized_key = key\n end\n\n has_key = @cursor_instance.jump( serialized_key )\n\n end\n \n return has_key\n\n end",
"def new_record?\n key_value.nil?\n end",
"def file_backed?\n @tempfile_in\n end",
"def already_uploaded?\n false\n seen_before = Zaphod::PhotoStorage.get(\"seen_id_#{@post_id}\",\"recommendation\")\n if seen_before && seen_before == @post_id\n @log.debug(\"already uploaded ID #{seen_before}... skipping\")\n true\n end\n end"
] |
[
"0.76133144",
"0.7524009",
"0.7171883",
"0.7067247",
"0.6871968",
"0.68089825",
"0.6778028",
"0.66993994",
"0.6640026",
"0.660683",
"0.6599135",
"0.657249",
"0.6565435",
"0.6564998",
"0.6564799",
"0.6524434",
"0.6503525",
"0.6483026",
"0.6461757",
"0.64594525",
"0.6450251",
"0.64452684",
"0.64246476",
"0.64226073",
"0.6380011",
"0.63618684",
"0.6335321",
"0.63316625",
"0.6328713",
"0.6295627",
"0.62714577",
"0.6268072",
"0.6259809",
"0.62590665",
"0.62321705",
"0.6217392",
"0.6214088",
"0.62070405",
"0.61953205",
"0.6190625",
"0.6166132",
"0.6162874",
"0.6157388",
"0.6140401",
"0.61373955",
"0.6120132",
"0.6099261",
"0.6098375",
"0.6078724",
"0.6064135",
"0.6053735",
"0.6053735",
"0.6050079",
"0.6047491",
"0.6043683",
"0.6036062",
"0.5992591",
"0.59853524",
"0.5977043",
"0.59504193",
"0.5948162",
"0.5943719",
"0.5943719",
"0.5929221",
"0.5917763",
"0.59139574",
"0.59139574",
"0.5910871",
"0.5899607",
"0.58869153",
"0.5883243",
"0.58831215",
"0.58797777",
"0.5872655",
"0.5870816",
"0.58509266",
"0.5845143",
"0.5843362",
"0.5823869",
"0.58173656",
"0.5812527",
"0.58118373",
"0.58102137",
"0.5807259",
"0.5804571",
"0.58028823",
"0.5802656",
"0.5797594",
"0.57937425",
"0.5793325",
"0.579101",
"0.57896125",
"0.5769352",
"0.5768968",
"0.5762295",
"0.5753297",
"0.5752591",
"0.5750847",
"0.5744317",
"0.57440233"
] |
0.620393
|
38
|
request_info is a RequestInfo object including the headers and the url, method and http version. Access it through the RequestMixin methods.
|
def initialize(request_info, connection = nil)
@request_info = request_info
@connection = connection
@finished_read = false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request_infos\n req = request\n return {} unless req\n # FIXME: Use frozen string keys\n {\n :rid => request_id,\n :user_agent => client_user_agent,\n :scheme => req.scheme,\n :verb => req.env['REQUEST_METHOD'],\n :host => hostname,\n :port => req.env['SERVER_PORT'],\n :referer => req.env['HTTP_REFERER'],\n :path => request_path,\n :remote_port => req.env['REMOTE_PORT'],\n :remote_ip => remote_addr,\n :client_ip => client_ip,\n }\n end",
"def request_info\n @requests = Request.ordered\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def info(msg, request=nil)\n super(with_extra_request_info(msg, request))\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def request_params\n { user_info: self }\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def to_get_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :GET\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def initialize(request_info)\n @action = request_info[:action]\n @path = request_info[:path]\n @metadata = request_info[:metadata]\n @params = request_info[:params]\n @request = request_info[:request]\n\n # publishing actions\n @users_to_notify = []\n\n @response = nil\n end",
"def request\n @_context[:request]\n end",
"def extract_request_environment(request)\n { :method => request.method }\n end",
"def netnoop_parse_request_details(request)\n protocol = use_ssl? ? \"https\" : \"http\"\n\n path = request.path\n path = URI.parse(request.path).request_uri if request.path =~ /^http/\n\n if request[\"authorization\"] =~ /^Basic /\n userinfo = FakeWeb::Utility.decode_userinfo_from_header(request[\"authorization\"])\n userinfo = FakeWeb::Utility.encode_unsafe_chars_in_userinfo(userinfo) + \"@\"\n else\n userinfo = \"\"\n end\n \n # TODO: optionally store the port\n # uri = \"#{protocol}://#{userinfo}#{self.address}:#{self.port}#{path}\"\n uri = \"#{protocol}://#{userinfo}#{self.address}#{path}\"\n method = request.method.downcase.to_sym\n \n return uri, method\n end",
"def parse_request(request)\n if request.is_a?(Hash)\n [request['PATH_INFO'], request['REQUEST_METHOD'].downcase.to_sym, {}]\n else\n [request.path_info, request.request_method.downcase.to_sym, request.params]\n end\n end",
"def params(request)\n result = decode_params(request.params)\n result.merge(extract_client_info(request))\n end",
"def request\n @_request\n end",
"def request\n @request\n end",
"def set_info_request\n @info_request = InfoRequest.find(params[:id])\n end",
"def request_hash(request)\n {\n host: request.host,\n protocol: (request.respond_to?(:protocol) ? request.protocol : \"#{request.scheme}://\"),\n fullpath: request.fullpath,\n port_string: (request.respond_to?(:port_string) ? request.port_string : \":#{request.port}\"),\n }\n end",
"def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_task')\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend",
"def create_request_with_http_info(request_in, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RequestApi.create_request ...'\n end\n # verify the required parameter 'request_in' is set\n if @api_client.config.client_side_validation && request_in.nil?\n fail ArgumentError, \"Missing the required parameter 'request_in' when calling RequestApi.create_request\"\n end\n # resource path\n local_var_path = '/requests'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request_in)\n auth_names = ['Basic_auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Request')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RequestApi#create_request\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def wrap_request\n outer_most = !request_info\n\n self.request_info = {} if outer_most\n yield\n ensure\n self.request_info = nil if outer_most\n end",
"def to_post_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :POST\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def requestParser(request)\n # Grab the method and path of the request\n method, path = request.lines[0].split;\n \n # Return the path, method and the parsed headers\n { path: path, method: method, headers: parseHeaders(request) }\nend",
"def to_post_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :POST\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def getinfo\n request :getinfo\n 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 request_object\n $REQUEST\n end",
"def info\n request('getinfo')\n end",
"def request_context(request)\n @request_context ||= Request.retriever_for_request(request)&.call\n end",
"def request; return @request end",
"def request_context\n @requester ? @requester.request : \"(unknown)\"\n end",
"def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end",
"def request\n @@request\n end",
"def request\n response.request\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n 'method' => method.to_s,\n 'url' => url,\n }).map { |k, v| [k.to_s, v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end",
"def request\n view_context.request\n end",
"def request_params\n @request.params\n rescue\n {}\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def request\n @request ||= Request.find request_id\n end",
"def to_post_request_information(request_configuration=nil)\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :POST\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n return request_info\n end",
"def request_params; end",
"def initialize(request)\n @request = request\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\n @request.full\n end",
"def request\n @controller.request\n end",
"def request\n @controller.request\n end",
"def request\n @controller.request\n end",
"def request_headers; end",
"def request_headers; end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def request_info3(service_interface, request, parser, options, &block)\n request_info2(request, parser,\n service_interface.params,\n service_interface.class.connection_name,\n service_interface.logger,\n service_interface.class.bench,\n options, &block)\n end",
"def info_request(*args)\n info args.join(' ')\n end",
"def request\n @rest_response.request\n end",
"def serialization_context request\n options[:serialization_context] = OpenStruct.new(\n request_url: request.original_url.split('?')[0], # url without query params\n query_parameters: request.query_parameters\n )\n end",
"def request\n @@request\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def request\n SharedStorage.get(:request)\n end",
"def set_request\n $request = request\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def parse_request\n p request.body.string\n case request.content_type\n when JSON_TYPE then parse_json_request\n else parse_http_request\n end\n end",
"def current_request\n controller.request if has_request?\n end",
"def request_headers\n @attributes[:request_headers]\n end",
"def info\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end",
"def log_http_request(request)\n log :info, \"Starting request: #{request.method} #{request.path}\"\n\n return unless log_debug?\n\n log :debug, \" body : #{request.body}\"\n log :debug, \" headers :\"\n request.each_header do |name, value|\n log :debug, \" #{name}: #{value}\"\n end\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def to_patch_request_information(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = MicrosoftKiotaAbstractions::RequestInformation.new()\n request_info.url_template = @url_template\n request_info.path_parameters = @path_parameters\n request_info.http_method = :PATCH\n request_info.headers.add('Accept', 'application/json')\n unless request_configuration.nil?\n request_info.add_headers_from_raw_object(request_configuration.headers)\n request_info.add_request_options(request_configuration.options)\n end\n request_info.set_content_from_parsable(@request_adapter, \"application/json\", body)\n return request_info\n end",
"def headers\n @request_headers\n end",
"def parse_Request(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\treturn initial,headers,body\n\nend",
"def getinfo\n @api.request 'getinfo'\n end"
] |
[
"0.7221488",
"0.6775616",
"0.6639741",
"0.6639741",
"0.662",
"0.6614333",
"0.6614333",
"0.6613167",
"0.6613167",
"0.6613167",
"0.6613167",
"0.6569238",
"0.6569238",
"0.6569238",
"0.6569238",
"0.6569238",
"0.6569238",
"0.65649974",
"0.65649974",
"0.65649974",
"0.65649974",
"0.65503",
"0.6549225",
"0.6549225",
"0.6549225",
"0.6549225",
"0.6406419",
"0.636933",
"0.62912244",
"0.627935",
"0.6236202",
"0.6197487",
"0.619351",
"0.61606956",
"0.6139151",
"0.60699284",
"0.60279244",
"0.60276365",
"0.60236317",
"0.6021455",
"0.602075",
"0.59932005",
"0.59875375",
"0.5973759",
"0.5970384",
"0.5915416",
"0.5908113",
"0.5892853",
"0.58906466",
"0.58690405",
"0.58623165",
"0.5843198",
"0.5809802",
"0.5800263",
"0.5800263",
"0.5800263",
"0.5800263",
"0.57910097",
"0.57831466",
"0.578148",
"0.57809085",
"0.57733816",
"0.5764765",
"0.5764501",
"0.5748176",
"0.57356966",
"0.57116026",
"0.5706263",
"0.5706263",
"0.5706263",
"0.5691545",
"0.5691545",
"0.56888705",
"0.56888705",
"0.5679551",
"0.56605387",
"0.5658035",
"0.5646551",
"0.5642229",
"0.56233835",
"0.56233835",
"0.56233835",
"0.55868715",
"0.5584397",
"0.5574722",
"0.5574722",
"0.5574722",
"0.55652446",
"0.55618525",
"0.5559073",
"0.5551451",
"0.55502945",
"0.55502945",
"0.5547176",
"0.5545687",
"0.55340385",
"0.55340385",
"0.55295056",
"0.552843",
"0.55095786"
] |
0.62693447
|
30
|
Returns true if request fully finished reading
|
def finished_reading?; @finished_read; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def finished?\n @buffer.size == @size\n end",
"def end_of_stream?\n @next_chunk.nil?\n end",
"def eof?\n\t\t\t\tfill_read_buffer if !@eof && @read_buffer.empty?\n\t\t\t\t\n\t\t\t\treturn @eof && @read_buffer.empty?\n\t\t\tend",
"def finished?\n super && response_received?\n end",
"def finished?\n super && response_received?\n end",
"def finish_reading!\n @finished_read = true\n end",
"def final_chunk?\n ::HttpParser.http_body_is_final(self) > 0\n end",
"def done_request_line?\n [:headers, :body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def multi_response_completed?\n @multi_buffer.nil?\n end",
"def eof?\n @read >= @size\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def input_finished?\n @outputBuffer.empty? && internal_input_finished?\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def input_finished?\n @output_buffer.empty? && internal_input_finished?\n end",
"def empty?\n @buffer.empty? && stream_is_done?\n end",
"def closed_read?() end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def complete?\n buff.length < @maxlen\n end",
"def eof?\n return @stream.eof?\n end",
"def finished?\n self.closed?()\n end",
"def eof?\n @stream.eof?\n end",
"def eof?\n raise IOError, 'not opened for reading' if closed?\n @total == @size && @buffer.empty?\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def complete?\n @bytes == [[0, @length - 1, true]]\n end",
"def has_more?\n !@done || !@row_buffer.empty?\n end",
"def eof?\n not busy?\n end",
"def eof?\n fill_rbuff if !@eof && @rbuffer.empty?\n @eof && @rbuffer.empty?\n end",
"def closed_read?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def read?\n !@read.nil?\n end",
"def has_been_read?\n @data_read\n end",
"def eof?\n io.eof?\n end",
"def complete?\n completed_at && response\n end",
"def eof?\n ready_token\n if @buffer\n @buffer.empty? && @io.eof?\n else\n @io.eof?\n end\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n true unless self.finished_on.nil?\n end",
"def eof?\n @sock.closed?\n end",
"def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def fully_downloaded?\n self.transmission_status == 8 && self.transmission_total_size == self.transmission_downloaded_size\n end",
"def finished?\r\n @finished ||= false\r\n end",
"def finished?\n !!@finished\n end",
"def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end",
"def reading?\n status.received?\n end",
"def in_progress?\n started? && response.nil?\n end",
"def closed?\n io.closed?\n end",
"def read?\n status.read?\n end",
"def response_incomplete?\n content_for_scanner.strip == \"\"\n end",
"def response?\n done? && !error?\n end",
"def closed?\n io.closed?\n end",
"def finished?\n @end_time != nil\n end",
"def finished?\n @finished == true\n end",
"def finished?\n\n end",
"def ready?\n self.result_payload(true).has_key?('finished_at')\n end",
"def eof?\n wait_for_chars(1)\n @cursor == @buffer.length && @eof_found\n end",
"def eof?\n @io.closed? || @io.eof?\n end",
"def closed_read?()\n #This is a stub, used for indexing\n end",
"def finished?()\n #This is a stub, used for indexing\n end",
"def reader_ready?\n @session.reader_ready?\n end",
"def finished?\n\t\t\t@size == @transient_count\n\t\tend",
"def work_pending?\n !buffer.empty?\n end",
"def complete?\n result? || error?\n end",
"def complete?\n true\n end",
"def complete?\n finished? || cancelled? || failed? || job_failed? || timeout?\n end",
"def read_timeout_exceeded?\n @read_timeout_ms && duration_since_received > @read_timeout_ms\n end",
"def is_finished?\n @block.call\n end",
"def finished?\n lock.value != 1 && queued_jobs.size.zero? && indegree.size.zero?\n end",
"def finished?\n failed? or successful? or skipped?\n end",
"def finished?\n !new? && !processing?\n end",
"def completed?\n\t\t\treturn request_status == REQUEST_STATUS['completed']\n\t\tend",
"def is_requesting?\n @lock.synchronize { !@batch.empty? }\n end",
"def is_read\n return @is_read\n end",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def eof?\n stream = @_st_stream\n stream and stream.eof?\n end",
"def ready?\n @batch.size >= @size\n end",
"def finished?\n\t\tif @finished.nil? then\n\t\t\tfalse\n\t\telse\n\t\t\t@finished\n\t\tend\n\tend",
"def finished?\n\t\t\tif @finished.nil? then\n\t\t\t\tfalse\n\t\t\telse\n\t\t\t\t@finished\n\t\t\tend\n\t\tend",
"def complete?\n true\n end",
"def completed?\n return @complete\n end",
"def completed?\n return @complete\n end",
"def track_eof?\n true if track_eof\n end",
"def finished?\n started? and threads.none?(&:status)\n end",
"def complete?\n status_code == 'OK'\n end",
"def completed?\n return true unless @state == PENDING_STATE\n @lock.lock\n begin\n @state != PENDING_STATE\n ensure\n @lock.unlock\n end\n end"
] |
[
"0.78803635",
"0.7597073",
"0.75940007",
"0.74053127",
"0.7373751",
"0.7369345",
"0.7369345",
"0.7309881",
"0.7180534",
"0.7158285",
"0.7150497",
"0.7103735",
"0.70994383",
"0.70994383",
"0.70994383",
"0.70451105",
"0.7036706",
"0.7036706",
"0.7036706",
"0.7036706",
"0.7036706",
"0.6967755",
"0.69527984",
"0.68861794",
"0.6863055",
"0.6863055",
"0.6827632",
"0.6819293",
"0.6789185",
"0.67808574",
"0.6765424",
"0.67621297",
"0.6753486",
"0.67471886",
"0.6729437",
"0.67129904",
"0.66922593",
"0.6686922",
"0.6686922",
"0.66794646",
"0.6641344",
"0.6615146",
"0.66148317",
"0.66144365",
"0.6605545",
"0.6605545",
"0.6605545",
"0.6605545",
"0.66032076",
"0.65973824",
"0.6593779",
"0.65738946",
"0.65738946",
"0.65738946",
"0.65622073",
"0.655665",
"0.6521685",
"0.6508182",
"0.6506187",
"0.648383",
"0.64663297",
"0.6462849",
"0.64485675",
"0.6447783",
"0.6445084",
"0.64387864",
"0.64379567",
"0.6407489",
"0.6393706",
"0.63784915",
"0.6375525",
"0.6363744",
"0.6358492",
"0.6347212",
"0.63440967",
"0.6341066",
"0.63409966",
"0.633874",
"0.63244957",
"0.6320849",
"0.63200116",
"0.6315453",
"0.63084793",
"0.63049436",
"0.6304485",
"0.6302516",
"0.62949944",
"0.62929106",
"0.62929106",
"0.62916565",
"0.62903345",
"0.6271653",
"0.626303",
"0.62536097",
"0.62461054",
"0.62461054",
"0.6239959",
"0.6235456",
"0.62336814",
"0.62287444"
] |
0.765932
|
1
|
When HTTP Parser marks the message parsing as complete, this will be set.
|
def finish_reading!
@finished_read = true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_message_complete\n @finished = true\n end",
"def on_complete(env)\n if respond_to? :parse\n env[:body] = parse(env[:body]) unless [204,304].index env[:status]\n end\n end",
"def completed\n logger.debug \"Beetle: message processing completed\"\n logger.flush if logger.respond_to?(:flush)\n end",
"def on_message_complete\n @currently_reading.finish_reading! if @currently_reading.is_a?(Request)\n\n if @currently_responding\n @pending_responses << @currently_reading\n else\n @currently_responding = @currently_reading\n end\n\n @currently_reading = @pending_reads.shift\n end",
"def done\n # Parse not successful and no reason identified\n # Assuming that parse failed because of a premature end\n premature_end unless success? || failure_reason\n end",
"def finish\n @length = @body.length if @body.is_a?(DelayedBody) && !@headers[RodaResponseHeaders::CONTENT_LENGTH]\n super\n end",
"def finished\n @finished = true\n end",
"def complete!\n return if completed?\n self.status = \"complete\"\n self.stop = Time.now.to_s\n end",
"def parsing_succeeded=(value)\n @parsing_succeeded = value\n end",
"def completed_it\n self.complete = true\n end",
"def on_complete(&block)\n @on_complete = block\n end",
"def on_complete(env)\n env[:body] = case env[:status]\n when 204\n parse('')\n else\n parse(env[:body])\n end\n end",
"def finish_response\n close unless keep_alive?\n\n @parser.reset\n @socket.reset_counter if @socket.respond_to?(:reset_counter)\n reset_timer\n\n @pending_response = false\n end",
"def completed\n @status = 'complete'\n end",
"def complete!\n @completed = true\n @completed_at = Time.now\n end",
"def complete!\n load_attributes_from_response(post(:complete))\n end",
"def complete\n @status = :ok\n do_stop\n log_complete\n end",
"def parsing_succeeded\n return @parsing_succeeded\n end",
"def complete\n end",
"def on_complete(&block)\n @on_complete = block if block_given?\n @on_complete\n end",
"def on_complete(env)\n env[:body] = case env[:status]\n when 204\n parse('{}')\n else\n parse(env[:body], env[:response_headers])\n end\n end",
"def on_complete(&block)\n @handlers[:complete] = Array(@handlers[:complete]).compact + [block]\n self\n end",
"def completed()\n @completed=true\n @tCompleted=Time.now\n end",
"def parsing_completed\n private :alternative_full_names=,\n :alternative_full_names_without_diacritics=,\n :parsing_completed\n end",
"def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend",
"def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend",
"def process(&block)\n @parser.on_headers_complete = block\n end",
"def set_done\n @done = true\n end",
"def action_complete() self.finished = true; end",
"def connection_completed\n end",
"def mark_as_done!\n @status = :finished\n end",
"def mark_state_complete!\n get[state.to_s] = :complete\n end",
"def done\n @closed = true\n send_headers\n ::EM.next_tick { @body.succeed }\n end",
"def complete\n synchronize do\n return if complete?\n\n @is_final_state = true\n @final_time = Time.now\n end\n end",
"def on_complete(&f)\n @on_complete = f\n end",
"def complete?; end",
"def done\r\n @done = true\r\n end",
"def handlers_completed\n end",
"def on_complete(env)\n assert_response_ok(env[:status], env[:body])\n env[:body] = case env[:status]\n when 204\n {\n :data => {},\n :errors => [],\n :metadata => {},\n }\n else\n parse(env[:body])\n end\n end",
"def on_finished\n @flow_lock.synchronize do\n return unless finished?\n return if @on_finished_invoked\n\n @on_finished_invoked = true\n\n yield(@first_message, @last_message)\n end\n end",
"def parser_init\n @http = Http::Parser.new\n @http.on_headers_complete = proc do\n p @http.headers\n end\n @http.on_body = proc do |chunk|\n # One chunk of the body\n p chunk\n end\n\n @http.on_message_complete = proc do |env|\n # Headers and body is all parsed\n puts \"Done!\"\n end\n\n\n end",
"def incomplete!\r\n @is_complete = false\r\n end",
"def on_complete( handler = nil, &block )\n @on_complete_handler_method = handler\n @on_complete_handler_block = block\n end",
"def mark_as_completed!\n mark_state_complete!\n end",
"def handle_headers_complete(headers)\n @code = @parser.status_code.to_i\n if @code != 200\n receive_error(\"invalid status code: #{@code}.\")\n end\n self.headers = headers\n @state = :stream\n end",
"def on_message_complete\n send_response\n close_socket\n write_to_screen\n end",
"def parserDidEndDocument(parser)\n @parsed = true\n puts \"done parsing\"\n if @block\n @items.each{|item| @block.call(item)}\n end\n end",
"def initialize\r\n @done = false\r\n end",
"def finished?; @finished; end",
"def sync_complete()\n LOGGER.debug(\"#{self.name} sync completed\")\n @synced = true\n end",
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def setDone\n @done = Time.now\n end",
"def connection_completed\n# @keepalive = EM::PeriodicTimer.new(60) { send_data ' ' }\n start\n end",
"def state_done\n close_connection_after_writing\n end",
"def post_init\n @current = nil\n @requests = []\n @pending = []\n @parser = Http::Parser.new(self)\n end",
"def after_parse; end",
"def after_parse; end",
"def mark_as_done\n @is_done = true\n end",
"def completed()\n end",
"def complete\n nil\n end",
"def complete\n nil\n end",
"def connection_completed\n @connected = true\n send_request @args\n end",
"def after_parse\n end",
"def set_as_complete\n mark_as_complete_and_save\n end",
"def connection_completed\n connect @conn_headers # call EM supplied CONNECT method\n @log.debug(\"#{self} connection_completed done\")\n end",
"def oncomplete(&block)\n @oncomplete_block = block\n yield if completed?\n end",
"def complete?\n @complete\n end",
"def check_done\n tag = @current_header.tag\n if (tag.tag == 0x00 &&\n tag.tag_class == 0x00 &&\n @state == :process_value)\n @state = :done\n end\n end",
"def complete!\n status \"Success\"\n self\n end",
"def on_complete( &block )\n @on_complete_blocks ||= []\n @on_complete_blocks << block\n end",
"def processing_completed\n completed if @__handler_called__\n rescue Exception\n Beetle::reraise_expectation_errors!\n end",
"def complete?\n @complete\n end",
"def mark_as_done!\n @done = true\n end",
"def completed_text_extraction\n @found_completed_text_extraction = true\n end",
"def done\n @done = true\n end",
"def completed(request, op)\n request.complete!\n end",
"def update_done\n self.done = true if COMPLETE_STATUSES.include? self.detailed_status\n end",
"def finished?\n super && response_received?\n end",
"def finished?\n super && response_received?\n end",
"def finish_response; end",
"def mark_done\n @done = true\n end",
"def complete(message, output)\n end",
"def complete!\n @completed_at = Time.now\n end",
"def complete!\n @completed_at = Time.now\n end",
"def multi_response_completed?\n @multi_buffer.nil?\n end",
"def after_parse_callbacks\n @after_parse_callbacks ||= []\n end",
"def finish\n\t\t\t\t\t@body.finish\n\t\t\t\tend",
"def done\n @status = true\n end",
"def finish\n @finish = true\n end",
"def finished; end",
"def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end",
"def on_complete(env)\n content_type = env[:response_headers]['content-type']\n if content_type && content_type.include?('application/json') \\\n && !env[:body].strip.empty?\n env[:body] = ::JSON.parse(env[:body])\n end\n end",
"def finish\n @Done = true \n end",
"def finish\n verify_not_closed\n wait_all_sent\n end",
"def on_complete( &block )\n fail 'Block is mandatory!' if !block_given?\n @on_complete_blocks << block\n self\n end",
"def complete\n @listeners.each { |p| p.complete if p.respond_to?(:complete) }\n end",
"def complete?\n status_code == 'OK'\n end",
"def finish\n super\n\n if _requires_no_body?\n @_body = nil\n end\n end",
"def mark_complete\n self.complete = true\n self.save\n end",
"def final_chunk?\n ::HttpParser.http_body_is_final(self) > 0\n end",
"def reset\n @finished = false\n @headers = nil\n @chunk = \"\"\n end"
] |
[
"0.71148336",
"0.6686827",
"0.6475304",
"0.64562744",
"0.6345647",
"0.6311137",
"0.62978137",
"0.623555",
"0.6193484",
"0.61669177",
"0.6164126",
"0.6147344",
"0.60477924",
"0.6038384",
"0.60100436",
"0.5998346",
"0.5981586",
"0.59812474",
"0.59300894",
"0.59076726",
"0.5898786",
"0.5885794",
"0.5863012",
"0.5847154",
"0.58414584",
"0.58414584",
"0.5813402",
"0.58043545",
"0.5802197",
"0.5769391",
"0.5762938",
"0.57599336",
"0.5720329",
"0.5713153",
"0.5710824",
"0.56982154",
"0.5671046",
"0.56535566",
"0.56446594",
"0.564412",
"0.56100595",
"0.5604274",
"0.5602664",
"0.55690634",
"0.5566927",
"0.55652916",
"0.5552099",
"0.554953",
"0.5548757",
"0.5537297",
"0.5534694",
"0.5503047",
"0.55019885",
"0.5499361",
"0.54981786",
"0.54891753",
"0.54891753",
"0.54864526",
"0.5479533",
"0.5477162",
"0.5477162",
"0.54712737",
"0.5468824",
"0.54669636",
"0.546538",
"0.5452847",
"0.5448675",
"0.5448027",
"0.54462457",
"0.54440427",
"0.54360723",
"0.54344535",
"0.5432626",
"0.5426208",
"0.54218787",
"0.5409729",
"0.53970605",
"0.53966486",
"0.53966486",
"0.5394554",
"0.5392752",
"0.53927314",
"0.53859425",
"0.53859425",
"0.53853405",
"0.53846234",
"0.53837264",
"0.5376846",
"0.5375983",
"0.5371972",
"0.53715533",
"0.53638995",
"0.53555495",
"0.5347781",
"0.5346212",
"0.53346753",
"0.5326822",
"0.53249806",
"0.53177947",
"0.531545",
"0.530932"
] |
0.0
|
-1
|
Buffer body sent from connection, or send it directly to
|
def add_body(chunk)
if @on_body
@on_body.call(chunk)
else
@body ||= ""
@body << chunk
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_body(socket)\n if @body.respond_to?(:read) then send_body_io(socket)\n elsif @body.respond_to?(:call) then send_body_proc(socket)\n else send_body_string(socket)\n end\n end",
"def send_body(socket)\n if @body.respond_to?(:read) then send_body_io(socket)\n elsif @body.respond_to?(:call) then send_body_proc(socket)\n else send_body_string(socket)\n end\n end",
"def send_body_proc(socket)\n if @request_method == \"HEAD\"\n # do nothing\n elsif chunked?\n @body.call(ChunkedWrapper.new(socket, self))\n _write_data(socket, \"0#{CRLF}#{CRLF}\")\n else\n size = @header['content-length'].to_i\n @body.call(socket) # TODO: StreamWrapper which supports offset, size\n @sent_size = size\n end\n socket.flush\n end",
"def send_body_proc(socket)\n if @request_method == \"HEAD\"\n # do nothing\n elsif chunked?\n @body.call(ChunkedWrapper.new(socket, self))\n _write_data(socket, \"0#{CRLF}#{CRLF}\")\n else\n size = @header['content-length'].to_i\n @body.call(socket) # TODO: StreamWrapper which supports offset, size\n @sent_size = size\n end\n end",
"def encode_body(buffer)\n # Do nothing.\n end",
"def send_body\n\t\t\tif @content\n\t\t\t\tsend_content\n\t\t\telsif @chunks\n\t\t\t\tsend_chunks\n\t\t\telsif @multiparts\n\t\t\t\tsend_multiparts\n\t\t\telse\n\t\t\t\t@content = \"\"\n\t\t\t\tsend_content\n\t\t\tend\n\t\tend",
"def write_body(response)\n body = nil\n begin\n if @body.respond_to?(:call) && ! @body.respond_to?(:each)\n @body.call response.getOutputStream\n elsif @body.respond_to?(:to_path) # send_file\n send_file @body.to_path, response\n elsif @body.respond_to?(:to_channel)\n body = @body.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:to_inputstream)\n body = @body.to_inputstream # so that we close the stream\n body = Channels.newChannel(body) # closing the channel closes the stream\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:body_parts) && @body.body_parts.respond_to?(:to_channel)\n # ActionDispatch::Response \"raw\" body access in case it's a File\n body = @body.body_parts.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n else\n if dechunk?\n write_body_dechunked response.getOutputStream\n else\n output_stream = response.getOutputStream\n # 1.8 has a String#each method but 1.9 does not :\n method = @body.respond_to?(:each_line) ? :each_line : :each\n @body.send(method) do |line|\n output_stream.write(line.to_java_bytes)\n output_stream.flush if flush?\n end\n end\n end\n rescue LocalJumpError\n # HACK: deal with objects that don't comply with Rack specification\n @body = [ @body.to_s ]\n retry\n rescue NativeException => e\n # Don't needlessly raise errors because of client abort exceptions\n raise unless e.cause.toString =~ /(clientabortexception|broken pipe)/i\n ensure\n @body.close if @body.respond_to?(:close)\n body && body.close rescue nil\n end\n end",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def encode_body(buffer)\n buffer << action.to_msgpack\n end",
"def send\n if @accepted then\n # Calculate content length before sending\n \n @headers << \"Content-Length: #{@buffer.length}\\r\\n\"\n \n if !@content_type then\n @headers << \"Content-Type: text/html\\r\\n\"\n end\n\n # Send our data and close the connection\n @server.puts @headers\n @server.puts \"\\r\\n\"\n @server.puts @buffer\n @server.close\n else\n puts \"[Rsws] ERROR: Trying to send response without first accepting it\"\n end\n end",
"def read\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbuffer = @body.join\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn buffer\n\t\t\t\t\tend\n\t\t\t\tend",
"def to_buffer\n validate_binary_operations\n @request.perform(binary: true)\n end",
"def send_raw(data)\n socket.send_raw data\n end",
"def tcp_send(command, body = nil)\n @seq += 1\n header = {\n 'Command' => command.to_s.gsub('_', '-'),\n 'Seq' => seq\n }\n\n buff = MessagePack::Packer.new\n buff.write(header)\n buff.write(body) unless body.nil?\n\n res = socket.write(buff.to_str) unless buff.to_str.empty?\n @requests[seq] = { header: header, ack?: false }\n seq\n end",
"def tcp_send(command, body = nil)\n @seq += 1\n header = {\n 'Command' => command.to_s.gsub('_', '-'),\n 'Seq' => seq\n }\n Log.info(\"#{__method__}|Header: #{header.inspect}\")\n buff = MessagePack::Buffer.new\n buff << header.to_msgpack\n buff << body.to_msgpack unless body.nil?\n res = socket.send(buff.to_str, 0)\n Log.info(\"#{__method__}|Res: #{res.inspect}\")\n @requests[seq] = { header: header, ack?: false }\n seq\n end",
"def send!\n return if @buffer.empty?\n recursive_send(@buffer)\n @buffer.clear\n end",
"def process_client(client, buffer); end",
"def write(buffer)\n if @socket\n @socket.write(buffer)\n end\n end",
"def encode_body(buffer)\n # Encode the message count.\n buffer << {\n :count => messages.length\n }.to_msgpack\n \n # Encode all the messages.\n messages.each do |message|\n message.encode(buffer)\n end\n end",
"def send_raw(data)\n raise ::Pwnlib::Errors::EndOfTubeError if @conn.nil?\n\n data.gsub!(context.newline, \"\\r\\n\") if @convert_newlines\n begin\n @conn.write(data)\n rescue RubySerial::Error\n close\n raise ::Pwnlib::Errors::EndOfTubeError\n end\n end",
"def render(socket)\n socket << render_header\n socket << @body\n end",
"def raw\n @buffer\n end",
"def buffer; end",
"def buffer; end",
"def buffer; end",
"def send(request)\n # clear socket\n puts \"flushing socket\" if @debug\n @socket.flush\n\n puts \"sending request: #{request.inspect}\" if @debug\n response = ''\n @socket.puts request.bencode\n\n while r = @socket.recv(1024)\n response << r\n break if r.length < 1024\n end\n\n puts \"bencoded reply: #{response.inspect}\" if @debug\n response = response.bdecode\n\n puts \"bdecoded reply: #{response.inspect}\" if @debug\n response\n end",
"def write_buffer(buf)\n while not buf.empty?\n count = @sock.write(buf)\n buf = buf[count..-1]\n end\n end",
"def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def write(buf)\n @sendbuf_lock.synchronize {\n @sendbuf += buf\n\n while @sendbuf.size >= @block_size\n send_data(@sendbuf[0..@block_size-1])\n @sendbuf = @sendbuf[@block_size..-1].to_s\n end\n }\n end",
"def message_buffer; end",
"def flush\n body.to_s\n self\n end",
"def send_content(content)\n @socket.write(content) if content && content.length > 0\n end",
"def flush\n @sendbuf_lock.synchronize {\n while @sendbuf.size > 0\n send_data(@sendbuf[0..@block_size-1])\n @sendbuf = @sendbuf[@block_size..-1].to_s\n end\n }\n end",
"def flush\n if !@write\n return @transport.flush\n end\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def flush\n response = perform_request\n raise UnexpectedHTTPCode, response.status if response.status != 200\n body = Bytes.force_binary_encoding(response.body)\n @in_buffer = StringIO.new(body)\n ensure\n flush_out_buffer\n end",
"def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end",
"def on_body(env, data)\n # append data to the write end of the pipe if open, otherwise do nothing\n env[\"tus.input-writer\"].write(data) unless env[\"tus.input-writer\"].closed?\n rescue Errno::EPIPE\n # read end of the pipe has been closed, so we close the write end as well\n env[\"tus.input-writer\"].close\n end",
"def send_body(body, trailer = nil)\n\t\t\t\t\t\t@output = Output.new(self, body, trailer)\n\t\t\t\t\t\t\n\t\t\t\t\t\t@output.start\n\t\t\t\t\tend",
"def on_body(chunk)\n @currently_reading.fill_buffer(chunk)\n end",
"def body\n @output_buffer\n end",
"def flush_buffer; self.input_buffer = \"AAAA\"; end",
"def encode_body(buffer)\n buffer << property.to_msgpack\n end",
"def raw(m)\n @socket << m\n end",
"def send_eof\n msg = @buffers.writer\n msg.write_byte CHANNEL_EOF\n msg.write_long @remote_id\n @connection.send_message msg\n self\n end",
"def raw_body\n unless @raw_body\n @in.rewind\n @raw_body = @in.read(content_length)\n end\n\n @raw_body\n end",
"def sendline(obj)\n s = obj.to_s + context.newline\n write(s)\n end",
"def send_message(name,body,head={})\n message = DripDrop::Message.new(name,:body => body, :head => head).encoded\n if ZMQGEM == :rbzmq\n @socket.send name, ZMQ::SNDMORE\n @socket.send message\n else\n @socket.send_string name, ZMQ::SNDMORE\n @socket.send_string message\n end\n end",
"def get_raw_buffer\n @buffer\n end",
"def send(data)\n @conn.send serialize data\n end",
"def flush\n out = @buffer\n @buffer = ''\n out\n end",
"def write(rawmsg)\r\n @connection.send(rawmsg)\r\n end",
"def send_data(data); nil; end",
"def _transmit(used_socket, command, headers = {}, body = '')\n\n # p [ \"wirewrite\" ]\n # _dump_callstack()\n\n if @protocol >= Stomp::SPL_11 && command != Stomp::CMD_CONNECT\n headers = _encodeHeaders(headers)\n end\n @transmit_semaphore.synchronize do\n # Handle nil body\n body = '' if body.nil?\n # The content-length should be expressed in bytes.\n # Ruby 1.8: String#length => # of bytes; Ruby 1.9: String#length => # of characters\n # With Unicode strings, # of bytes != # of characters. So, use String#bytesize when available.\n body_length_bytes = body.respond_to?(:bytesize) ? body.bytesize : body.length\n\n # ActiveMQ interprets every message as a BinaryMessage\n # if content_length header is included.\n # Using :suppress_content_length => true will suppress this behaviour\n # and ActiveMQ will interpret the message as a TextMessage.\n # For more information refer to http://juretta.com/log/2009/05/24/activemq-jms-stomp/\n # Lets send this header in the message, so it can maintain state when using unreceive\n headers[:'content-length'] = \"#{body_length_bytes}\" unless headers[:suppress_content_length]\n headers[:'content-type'] = \"text/plain; charset=UTF-8\" unless headers[:'content-type'] || headers[:suppress_content_type]\n _wire_write(used_socket,command)\n headers.each do |k,v|\n if v.is_a?(Array)\n v.each do |e|\n _wire_write(used_socket,\"#{k}:#{e}\")\n end\n else\n _wire_write(used_socket,\"#{k}:#{v}\")\n end\n end\n _wire_write(used_socket,\"\")\n if body != ''\n if headers[:suppress_content_length]\n if tz = body.index(\"\\00\")\n used_socket.write body[0..tz-1]\n else\n used_socket.write body\n end\n else\n used_socket.write body\n end\n end\n used_socket.write \"\\0\"\n used_socket.flush if autoflush\n\n if @protocol >= Stomp::SPL_11\n @ls = Time.now.to_f if @hbs\n end\n\n end\n end",
"def send_raw_line(line)\n @logger.debug \"<< #{line}\" if @logger\n @socket.puts(line)\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def send\n bytes_sent = 0\n update_header\n\n Logger.info \"head: #{header.inspect}\"\n Logger.info \"body: #{message.inspect}\"\n\n for i in 0..(chunk_count-1)\n self.header.header_length = header_length_for_chunk(i)\n bytes_sent += send_chunk chunks[i]\n end\n\n PendingRequest.create self, @connection\n\n bytes_sent\n end",
"def stream(socket); end",
"def on_body(chunk)\n @has_request_body = true\n\n backend.client_chunk chunk\n end",
"def write bytes\n r = response_object\n r.body \"\" if r.body_io.nil?\n r.body_io.write bytes\n end",
"def send_data( data )\n\t\tjson = data.to_json\n\t\tbytes = json.bytesize\n\t\tputs \"SEND %3i bytes to %s: %s\" % [bytes,name,json] if $DEBUG\n\t\tunless @socket.closed?\n\t\t\t@socket.write [bytes].pack('n')\n\t\t\tunless @socket.closed?\n\t\t\t\t@socket.write(json) == bytes\n\t\t\tend\n\t\tend\n\tend",
"def body_io; end",
"def body_io; end",
"def write_berp(obj)\n socket.write(Client.create_berp(obj))\n end",
"def send_data(data, options = T.unsafe(nil)); end",
"def exploit\n\t\tconnect\n\n\t\tprint_status(\"Sending #{payload.encoded.length} byte payload...\")\n\n\t\t# Build the buffer for transmission\n\t\tbuf = \"A\" * 1024\n\t\tbuf += [ target.ret ].pack('V')\n\t\tbuf += payload.encoded\n\n\t\t# Send it off\n\t\tsock.put(buf)\n\t\tsock.get\n\n\t\thandler\n\tend",
"def _send_data(data)\n send_data(data + \"\\r\\n\")\n end",
"def send_response\n\t\t\tsend_headers\n\t\t\tsend_body\n\t\t\tsend_trailer\n\t\t\tclose_connection_after_writing unless (@keep_connection_open and (@status || 200) < 500)\n\t\tend",
"def receive_data(data)\n buffer.concat(data)\n end",
"def << bytes\n @body << bytes\n end",
"def request(command, body = nil)\n tcp_send(command, body)\n read_response(command)\n end",
"def flush\n @socket&.flush\n end",
"def exploit\n connect\n\n # send plain payload\n buf = payload.encoded\n\n #print_status(\"payload space #{payload_space()}...\")\n print_status(\"payload len #{payload.encoded.length}...\")\n print_status(\"total buf len #{buf.length}...\")\n# print_status(\"Trying target #{target.name}...\")\n\n sock.put(buf)\n\n #cleanup\n handler\n disconnect\n end",
"def multipart_body(body, parts, boundary, mtype, filesize)\n lambda do |socket|\n begin\n begin\n first = parts.shift\n last = parts.shift\n socket.write(\n \"--#{boundary}#{CRLF}\" \\\n \"Content-Type: #{mtype}#{CRLF}\" \\\n \"Content-Range: bytes #{first}-#{last}/#{filesize}#{CRLF}\" \\\n \"#{CRLF}\"\n )\n\n begin\n IO.copy_stream(body, socket, last - first + 1, first)\n rescue NotImplementedError\n body.seek(first, IO::SEEK_SET)\n IO.copy_stream(body, socket, last - first + 1)\n end\n socket.write(CRLF)\n end while parts[0]\n socket.write(\"--#{boundary}--#{CRLF}\")\n ensure\n body.close\n end\n end\n end",
"def send_message_buffered(message)\n add_message_to_buffer(message)\n\n if need_flush?\n flush_async\n end\n end",
"def parse_body(line)\n return :break if @length&.zero?\n\n if @transfer_encoding == \"chunked\"\n parse_body_chunked(line)\n else\n puts \"Http2: Adding #{line.to_s.bytesize} to the body.\" if @debug\n @response.body << line\n @http2.on_content_call(@args, line)\n return :break if @response.content_length && @response.body.length >= @response.content_length # rubocop:disable Style/RedundantReturn\n end\n end",
"def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @return_codes << shift_byte(buffer) while buffer.bytesize > 0\n end",
"def _send_request request_payload\n _write request_payload, stream\n end",
"def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end",
"def write(message)\n @out_buffer << message\n n = @socket.send(@out_buffer, 0)\n # Chop what we already sent off the front of the buffer.\n @out_buffer.slice!(0...n)\n # Return whether we are done sending.\n return @out_buffer.size == 0\n end",
"def encode_body(buffer)\n buffer << prior_action_ids.to_msgpack\n end",
"def respond(request, body, headers)\n formatted_headers = format_headers(headers, body, false)\n request.tx_incr(formatted_headers.bytesize + (body ? body.bytesize : 0))\n if body\n @conn.write(formatted_headers, body)\n else\n @conn.write(formatted_headers)\n end\n end",
"def send_raw(message)\n @handler.send_raw message\n end",
"def queue(env, data)\r\n if @error.nil?\r\n data.force_encoding('BINARY')\r\n\r\n @received = @received + data.bytesize\r\n if @received > @expected\r\n @error = \"Invalid Content-Length value\"\r\n clear_buffer\r\n end\r\n\r\n @buffer << data\r\n flush_buffer if @buffer.bytesize > @chunklimit # if multipart\r\n end\r\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def send_request(ref, msg_id, arg, b)\n @msg.send_request(stream, ref, msg_id, arg, b)\n end",
"def send_io(p0) end",
"def send_binary(data)\n if @handler\n @handler.send_frame(:binary, data)\n else\n raise WebSocketError, \"Cannot send binary before onopen callback\"\n end\n end",
"def encoded\n ready_to_send!\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.encoded(content_transfer_encoding)\n buffer\n end",
"def send(socket, type, content)\n idents =\n if socket == :reply && @last_recvd_msg\n @last_recvd_msg[:idents]\n else\n type == :stream ? \"stream.#{content[:name]}\" : type\n end\n header = {\n msg_type: type,\n msg_id: SecureRandom.uuid,\n username: 'kernel',\n session: @session,\n version: '5.0'\n }\n socket = @sockets[socket]\n list = serialize(idents, header, content)\n list.each_with_index do |part, i|\n socket.send_string(part, i == list.size - 1 ? 0 : ZMQ::SNDMORE)\n end\n end",
"def set_body\n self.body = \"\" unless self.body\n end",
"def send_data_with_http_tunnel(data)\n #msg_data = Base64::encode64(data)\n #@socket_srv.print \"GET /office_send_msg?#{msg_data} HTTP/1.1\\r\\n\"\n # Zip deflate avoid to have special character in the encoded argument\n msg_data = Zlib::Deflate.deflate( data, 1 ).unpack('H*').first \n @socket_srv.print \"GET /office_send_msg?#{msg_data} HTTP/1.1\\r\\n\"\n #@socket_srv.print \"GET /office_send_msg HTTP/1.1\\r\\n\"\n @socket_srv.print \"Host: #{@host_server}:#{@port_server}\\r\\n\"\n @socket_srv.print \"X-Cup-Session-Id: #{@id_http_session}\\r\\n\" if @id_http_session\n @socket_srv.print \"User-Agent: Mozilla/5.0\\r\\n\"\n @socket_srv.print \"Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\"\n @socket_srv.print \"Keep-Alive: 300\\r\\n\"\n @socket_srv.print \"Connection: keep-alive\\r\\n\"\n @socket_srv.print \"\\r\\n\" #end message\n #http_packet = \n #@socket_srv.write(http_packet)\n end",
"def send!\n @_sended = true\n self\n end",
"def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end",
"def passthrough(task)\n\t\t\t\t\t\ttask.annotate(\"Writing #{@body} to #{@stream}.\")\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile chunk = @body&.read\n\t\t\t\t\t\t\tself.write(chunk)\n\t\t\t\t\t\t\t# TODO this reduces memory usage?\n\t\t\t\t\t\t\t# chunk.clear unless chunk.frozen?\n\t\t\t\t\t\t\t# GC.start\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tself.close\n\t\t\t\t\tensure\n\t\t\t\t\t\t@body&.close($!)\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\tend",
"def _send_message data\n response << data\n end",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def send(cmd, &block)\n cmd = cmd.to_h\n logger.debug(self.class) { \"CMD: #{cmd}\" }\n\n str = cmd.bencode\n logger.debug(self.class) { \"Encoded CMD: #{str}\" }\n\n @io.write(cmd.bencode)\n\n collect_responses(&block)\n end",
"def test_full_hijack_body_close\n @body_closed = false\n server_run do |env|\n io = env['rack.hijack'].call\n io.syswrite 'Server listening'\n io.wait_readable 2\n io.syswrite io.sysread(256)\n body = ::Rack::BodyProxy.new([]) { @body_closed = true }\n [200, {}, body]\n end\n\n sock = send_http \"GET / HTTP/1.1\\r\\n\\r\\n\"\n\n sock.wait_readable 2\n assert_equal \"Server listening\", sock.sysread(256)\n\n sock.syswrite \"this should echo\"\n assert_equal \"this should echo\", sock.sysread(256)\n Thread.pass\n sleep 0.001 # intermittent failure, may need to increase in CI\n assert @body_closed, \"Reponse body must be closed\"\n end"
] |
[
"0.7272115",
"0.7272115",
"0.7107106",
"0.70534074",
"0.6878147",
"0.66320014",
"0.64327496",
"0.63975847",
"0.6383661",
"0.636277",
"0.63241136",
"0.6262457",
"0.62429",
"0.6237987",
"0.62368023",
"0.6229892",
"0.6176763",
"0.6170459",
"0.6125176",
"0.60986483",
"0.60740703",
"0.6063174",
"0.60544664",
"0.60544664",
"0.60544664",
"0.59892976",
"0.59817195",
"0.5966404",
"0.5966404",
"0.5956713",
"0.59518135",
"0.59330124",
"0.588279",
"0.5867796",
"0.5853323",
"0.58434284",
"0.58353543",
"0.5811274",
"0.57948893",
"0.57822466",
"0.5778711",
"0.5776714",
"0.5767908",
"0.5767314",
"0.576351",
"0.5757184",
"0.57549864",
"0.574836",
"0.57449836",
"0.574428",
"0.5710307",
"0.5707849",
"0.569807",
"0.56718373",
"0.5663204",
"0.5659842",
"0.5655939",
"0.5654207",
"0.5648134",
"0.5647003",
"0.5645863",
"0.5640871",
"0.5640871",
"0.56402576",
"0.563642",
"0.563015",
"0.5628964",
"0.56162465",
"0.5612536",
"0.56039834",
"0.5600146",
"0.5599048",
"0.55981714",
"0.5596892",
"0.5590188",
"0.5587103",
"0.558364",
"0.55816376",
"0.55732906",
"0.5556077",
"0.5552103",
"0.55381745",
"0.5537736",
"0.5536876",
"0.5531434",
"0.552881",
"0.5528214",
"0.5524416",
"0.5521756",
"0.5517503",
"0.5513546",
"0.55119485",
"0.5509554",
"0.5505884",
"0.5505812",
"0.5503493",
"0.55013436",
"0.55013436",
"0.55013436",
"0.54928726",
"0.54872847"
] |
0.0
|
-1
|
Returns the body, if a block is given, the body is streamed to the block as the chunks become available, until the body has been read. If no block is given, the entire body will be read from the connection into the body buffer and then returned.
|
def body
raise "no connection given" unless @connection
if block_given?
# Callback from the http_parser will be calling add_body directly
@on_body = Proc.new
# clear out body buffered so far
yield read_from_body(nil) if @body
until finished_reading?
@connection.readpartial
end
@on_body = nil
else
until finished_reading?
@connection.readpartial
end
@body
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_body(socket, block)\n return unless socket\n if tc = self['transfer-encoding']\n case tc\n when /chunked/io then read_chunked(socket, block)\n else raise ::WEBrick::HTTPStatus::NotImplemented, \"Transfer-Encoding: #{tc}.\"\n end\n elsif self['content-length'] || @remaining_size\n @remaining_size ||= self['content-length'].to_i\n while @remaining_size > 0\n sz = [@buffer_size, @remaining_size].min\n break unless buf = read_data(socket, sz)\n @remaining_size -= buf.bytesize\n block.call(buf)\n end\n if @remaining_size > 0 && @socket.eof?\n raise ::WEBrick::HTTPStatus::BadRequest, \"invalid body size.\"\n end\n elsif BODY_CONTAINABLE_METHODS.member?(@request_method)\n raise ::WEBrick::HTTPStatus::LengthRequired\n end\n return @body\n end",
"def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end",
"def body(&block)\n call_once\n @body ||= begin\n if entity = @response.get_entity\n EntityConverter.new.read_entity(entity, &block)\n end\n rescue Java::JavaIo::IOException, Java::JavaNet::SocketException, IOError => e\n raise StreamClosedException.new(\"Could not read from stream: #{e.message}\")\n # ensure\n # @request.release_connection\n end\n end",
"def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end",
"def raw_body\n unless @raw_body\n @in.rewind\n @raw_body = @in.read(content_length)\n end\n\n @raw_body\n end",
"def read\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbuffer = @body.join\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn buffer\n\t\t\t\t\tend\n\t\t\t\tend",
"def get_body_chunk(request, buffered_only = false)\n @parser.read_body_chunk(buffered_only)\n end",
"def getBody\n body = \"\"\n @body.each { |part| body << part }\n body\n ensure\n @body.close if @body.respond_to?(:close)\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end",
"def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end",
"def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end",
"def body\n process_message_body if !@body\n @body\n end",
"def body\n @body ||= process_text(@raw_body)\n end",
"def body\n @chunk\n end",
"def body\n if !block_given?\n if @cached_body != nil\n return @cached_body\n end\n return @cached_body = ::Vertx::Util::Utils.from_object(@j_del.java_method(:body, []).call())\n end\n raise ArgumentError, \"Invalid arguments when calling body()\"\n end",
"def body\n self.read_body\n self.get_body\n end",
"def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end",
"def getBody\n @body\n end",
"def body\n @body ||= @request.body.read\n end",
"def read_block_raw\n header_raw = read_block_header_raw\n header = BlockHeader.parse(header_raw)\n payload = read(header.payload_size)\n if !payload || payload.size != header.payload_size\n raise NotEnoughData,\n \"expected to read #{header.payload_size} payload bytes but got \"\\\n \"#{payload ? payload.size : 'EOF'}\"\n end\n\n [header, header_raw, payload]\n end",
"def body\n @body ||= reader_doc.content(true).strip\n end",
"def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end",
"def body\n return @body\n end",
"def body\n fetch\n @body\n end",
"def body\n if defined? @body\n @body\n else\n Null\n end\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def body\n return @body\n end",
"def read(length = nil, buffer = nil)\n raise ArgumentError, \"negative length #{length} given\" if length && length < 0\n\n return '' if length == 0\n res = buffer.nil? ? '' : buffer.clear\n\n chunk_size = length.nil? ? @connection.buffer_size : length\n begin\n while chunk_size > 0\n chunk = read_from_body(chunk_size)\n break unless chunk\n res << chunk\n chunk_size = length - res.length unless length.nil?\n end\n rescue EOFError\n end\n return length && res.length == 0 ? nil : res\n end",
"def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end",
"def body\n @body ||= begin\n begin\n io = Java.java_to_ruby(\n org.jruby.RubyIO.new(JRuby.runtime, entity.content).java_object\n )\n io.read\n rescue Exception => e\n puts \"Error in Response#body: #{e.message}\"\n end\n end\n end",
"def close\n return if @closed\n read_body\n end",
"def read\n\t\t\t\t\t@body.read\n\t\t\t\tend",
"def body\n connection.get(@url.path).body\n end",
"def response_body(reload = false)\n if reload or @body.nil?\n @body = open(url) { |f| f.read }\n else\n @body\n end\n end",
"def parsed_body\n @body\n end",
"def body\n remote[:body] || reload.remote[:body]\n end",
"def send_body\n\t\t\tif @content\n\t\t\t\tsend_content\n\t\t\telsif @chunks\n\t\t\t\tsend_chunks\n\t\t\telsif @multiparts\n\t\t\t\tsend_multiparts\n\t\t\telse\n\t\t\t\t@content = \"\"\n\t\t\t\tsend_content\n\t\t\tend\n\t\tend",
"def read_stream_block\n StreamBlock.parse(read_payload)\n end",
"def body\n if @http_response != nil \n @body = @http_response.body\n end\n @body\n end",
"def http_get_body(uri, credentials=nil, headers={})\n response = http_request(:get, uri, credentials, headers)\n\n ### filter body\n if response\n return response.body_utf8\n end\n\n nil\n end",
"def body\n @body ||= (\n JSON.parse(response.body) if response.body.length > 0\n )\n end",
"def body\n data[:body]\n end",
"def finish\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbody = @body.finish\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn body\n\t\t\t\t\tend\n\t\t\t\tend",
"def body\n @body || \"\"\n end",
"def getBody()\n return @req.body\n end",
"def read_body(env)\n env[:body] = env[:body].read if env[:body].respond_to? :read\n end",
"def body\n @message.body\n end",
"def body\n self[:body]\n end",
"def body_content\n call_block\n end",
"def body\n read_attribute(:body) || ''\n end",
"def raw_body\n @raw_body ||= @raw[(raw_command.length + 1)..-1] || \"\"\n end",
"def html_body\n @html_body ||= reader_doc.content.strip\n end",
"def each_body\n return enum_for(__method__) unless block_given?\n\n unless @message.body.parts.empty?\n @message.body.parts.each do |part|\n yield part.content_type, part.body.decoded\n end\n else\n yield @message.content_type, @message.body.decoded\n end\n end",
"def raw_body\n @response.body\n end",
"def body_raw\n @response.body\n end",
"def write_body(response)\n body = nil\n begin\n if @body.respond_to?(:call) && ! @body.respond_to?(:each)\n @body.call response.getOutputStream\n elsif @body.respond_to?(:to_path) # send_file\n send_file @body.to_path, response\n elsif @body.respond_to?(:to_channel)\n body = @body.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:to_inputstream)\n body = @body.to_inputstream # so that we close the stream\n body = Channels.newChannel(body) # closing the channel closes the stream\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:body_parts) && @body.body_parts.respond_to?(:to_channel)\n # ActionDispatch::Response \"raw\" body access in case it's a File\n body = @body.body_parts.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n else\n if dechunk?\n write_body_dechunked response.getOutputStream\n else\n output_stream = response.getOutputStream\n # 1.8 has a String#each method but 1.9 does not :\n method = @body.respond_to?(:each_line) ? :each_line : :each\n @body.send(method) do |line|\n output_stream.write(line.to_java_bytes)\n output_stream.flush if flush?\n end\n end\n end\n rescue LocalJumpError\n # HACK: deal with objects that don't comply with Rack specification\n @body = [ @body.to_s ]\n retry\n rescue NativeException => e\n # Don't needlessly raise errors because of client abort exceptions\n raise unless e.cause.toString =~ /(clientabortexception|broken pipe)/i\n ensure\n @body.close if @body.respond_to?(:close)\n body && body.close rescue nil\n end\n end",
"def http_get_body(uri)\n response = http_get(uri)\n\n ### filter body\n if response\n return response.body.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})\n end\n\n nil\n end",
"def raw_body\n if @rev\n @raw_body ||= blob.contents\n else\n @raw_body ||= File.exists?(@filename) ? File.read(@filename) : ''\n end\n end",
"def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def body\n part('body')\n end",
"def chunk(*chunks)\n @body.chunk(*chunks)\n end",
"def get_body\n request_object.body\n end",
"def each(&block)\n response.read_body(&block)\n ensure\n session.end_request_hacked\n session.finish\n end",
"def body\n response.body || ''\n end",
"def body\n @output_buffer\n end",
"def body body=nil\n @response.body = body if body\n @response.body\n end",
"def raw_body\n @attributes[:raw_body]\n end",
"def read_content\n # read content if content is being sent\n if @content_length && @content_length > 0\n @content = @socket.read(@content_length)\n end\n end",
"def body(request)\n request.body.read\n end",
"def read(timeout = nil)\n wait_for_data(timeout) if timeout\n MsgVersion.new{ @socket.read msg_version.bytesize }.validate!\n size = MsgSize.new{ @socket.decode msg_size, msg_size.bytes }.validate!.value\n return MsgBody.new{ @socket.decode msg_body, size }.validate!.value\n end",
"def init_body(&block)\n if block_given?\n @body = to_node(yield)\n else\n @body = Null\n end\n end",
"def read_response(req, body = nil, &block) # :yield: +response+\n begin\n res = HTTPResponse.read_new(@socket)\n end while res.kind_of?(HTTPContinue)\n res.reading_body(@socket, req.response_body_permitted?) {\n yield res if block_given?\n }\n end_transport req, res\n\n res\n end",
"def message_body(format=nil)\n case format\n when :text\n msg['text']\n when :html\n msg['html']\n when :raw\n msg['raw_msg']\n else\n msg['text'] || msg['html'] || msg['raw_msg']\n end\n end",
"def body(value = (return @body unless defined?(yield); nil), &block)\n if block\n @body = DelayedBody.new(&block)\n else\n self.body = value\n end\n end",
"def body(value = nil)\n if value\n self.body = value\n# add_encoding_to_body\n else\n process_body_raw if @body_raw\n @body\n end\n end",
"def body\n @parsed_page.body\n end",
"def body\n @raw\n end",
"def get(timeout = nil, ltimeout = def_read_loop_timeout, opts = {})\n # For those people who are used to being able to use a negative timeout!\n if (timeout and timeout.to_i < 0)\n timeout = nil\n end\n\n # No data in the first place? bust.\n if (has_read_data?(timeout) == false)\n return nil\n end\n\n buf = \"\"\n lps = 0\n eof = false\n\n # Keep looping until there is no more data to be gotten..\n while (has_read_data?(ltimeout) == true)\n # Catch EOF errors so that we can handle them properly.\n begin\n temp = read(def_block_size)\n rescue EOFError\n eof = true\n end\n\n # If we read zero bytes and we had data, then we've hit EOF\n if (temp and temp.length == 0)\n eof = true\n end\n\n # If we reached EOF and there are no bytes in the buffer we've been\n # reading into, then throw an EOF error.\n if (eof)\n # If we've already read at least some data, then it's time to\n # break out and let it be processed before throwing an EOFError.\n if (buf.length > 0)\n break\n else\n raise EOFError\n end\n end\n\n break if (temp == nil or temp.empty? == true)\n\n buf += temp\n lps += 1\n\n break if (lps >= def_max_loops)\n end\n\n # Return the entire buffer we read in\n return buf\n end",
"def get_body(addr)\n http = Curl.get(addr, timeout: 2)\n http.body_str\nend",
"def seperate_body()\n\t\t@stream.split(\"\\n\\n\", 2)[1]\n\tend",
"def http_fetch_body(url)\n res = http_fetch(url)\n case res\n when Net::HTTPSuccess\n res.body\n else res.error!\n end\n end",
"def body(*args)\n return @body if args.empty?\n @body = args.first\n end",
"def loaded_body\n @loaded_body ||= case ctype = request.content_type\n when /json/\n json_body\n when /x-www-form-urlencoded/\n request.params.dup\n when /multipart\\/form-data/\n file = params[:file]\n file_body file, Path(file[:filename]).extname\n else\n unsupported_media_type_error!(ctype)\n end\n end",
"def body\n ret = read_attribute(:body)\n if ret.nil?\n return ret\n end\n ret = ret.strip\n ret = ret.gsub(/(?:\\n\\s*){2,}/, \"\\n\\n\") # remove excess linebreaks that unnecessarily space it out\n ret\n end",
"def body(new = nil)\n if new.nil?\n @body\n else\n with(body: body.merge(new))\n end\n end",
"def body\n source\n end",
"def block_body?\n @value.is_a?(Liquid::BlockBody)\n end",
"def read(n=nil)\n if @response == nil\n raise IOError, \"No response available.\"\n end\n return @remaining_body.read(n)\n end",
"def get_html_body(db, locale, version, name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::GET, :field => 'body_content'}, ttl)\n end",
"def body\n @attributes[:body]\n end",
"def data(&block)\n if not @data.nil?\n return @data\n end\n \n self.prepare! # seeks to block position\n \n if not block.nil?\n loop do\n size = @io.getbyte\n break if size <= 0\n block.call(@io.read(size))\n end\n else\n data = \"\"\n self.data do |chunk|\n data << chunk\n end\n @data = data\n \n return @data\n end\n end",
"def body\n response.body\n end",
"def each_request_target_with_body(&block)\n\t\ttarget_requests('AND requests.body IS NOT NULL').each do |req|\n\t\t\tblock.call(req)\n\t\tend\n\tend",
"def body(value = nil)\n if value\n @body = value\n else\n @body\n end\n end",
"def body(path)\n get(path).body\n end",
"def response_body\n @response[:body]\n end",
"def body\n @http_response.body\n end"
] |
[
"0.73344934",
"0.7266433",
"0.72579336",
"0.6999749",
"0.69008255",
"0.68755084",
"0.6628932",
"0.6619886",
"0.6606487",
"0.65947163",
"0.6581602",
"0.6529572",
"0.64907265",
"0.64597875",
"0.6440008",
"0.6425902",
"0.63898945",
"0.6268007",
"0.622951",
"0.6202733",
"0.6175017",
"0.6141691",
"0.613923",
"0.6058792",
"0.6046481",
"0.60024047",
"0.5983609",
"0.5983609",
"0.5983609",
"0.5983609",
"0.59798",
"0.5956549",
"0.5953949",
"0.5944972",
"0.59367055",
"0.5924856",
"0.5920636",
"0.5917186",
"0.59085834",
"0.58408344",
"0.5836665",
"0.5828083",
"0.5782671",
"0.57455224",
"0.5744815",
"0.57320887",
"0.5730794",
"0.5678289",
"0.5660819",
"0.565569",
"0.56168574",
"0.5614408",
"0.55887175",
"0.5585312",
"0.55848026",
"0.5580465",
"0.55638856",
"0.5560568",
"0.55496085",
"0.5522805",
"0.5517637",
"0.55132025",
"0.55019265",
"0.5495736",
"0.54935044",
"0.54909784",
"0.5471002",
"0.54687834",
"0.5467817",
"0.545857",
"0.54556453",
"0.5436146",
"0.54156876",
"0.5394399",
"0.53880584",
"0.53869",
"0.53853786",
"0.5384749",
"0.5384216",
"0.53829527",
"0.5373277",
"0.53689444",
"0.5367267",
"0.53575313",
"0.53535116",
"0.5347688",
"0.53458935",
"0.53386396",
"0.5336671",
"0.5326",
"0.52940875",
"0.52748454",
"0.5268924",
"0.5266641",
"0.5235917",
"0.5234657",
"0.5232169",
"0.52235395",
"0.52083457",
"0.52053016"
] |
0.78568524
|
0
|
Read a number of bytes, looping until they are available or until read_from_body returns nil, indicating there are no more bytes to read Note that bytes read from the body buffer will be cleared as they are read.
|
def read(length = nil, buffer = nil)
raise ArgumentError, "negative length #{length} given" if length && length < 0
return '' if length == 0
res = buffer.nil? ? '' : buffer.clear
chunk_size = length.nil? ? @connection.buffer_size : length
begin
while chunk_size > 0
chunk = read_from_body(chunk_size)
break unless chunk
res << chunk
chunk_size = length - res.length unless length.nil?
end
rescue EOFError
end
return length && res.length == 0 ? nil : res
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end",
"def read(n=nil)\n if @response == nil\n raise IOError, \"No response available.\"\n end\n return @remaining_body.read(n)\n end",
"def read_body(socket, block)\n return unless socket\n if tc = self['transfer-encoding']\n case tc\n when /chunked/io then read_chunked(socket, block)\n else raise ::WEBrick::HTTPStatus::NotImplemented, \"Transfer-Encoding: #{tc}.\"\n end\n elsif self['content-length'] || @remaining_size\n @remaining_size ||= self['content-length'].to_i\n while @remaining_size > 0\n sz = [@buffer_size, @remaining_size].min\n break unless buf = read_data(socket, sz)\n @remaining_size -= buf.bytesize\n block.call(buf)\n end\n if @remaining_size > 0 && @socket.eof?\n raise ::WEBrick::HTTPStatus::BadRequest, \"invalid body size.\"\n end\n elsif BODY_CONTAINABLE_METHODS.member?(@request_method)\n raise ::WEBrick::HTTPStatus::LengthRequired\n end\n return @body\n end",
"def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def read\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbuffer = @body.join\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn buffer\n\t\t\t\t\tend\n\t\t\t\tend",
"def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end",
"def read_all(into_buffer)\n while (read_bytes(4096, into_buffer))\n # work is in the loop condition.\n end\n return into_buffer\n end",
"def read(n_bytes = nil)\n @remote_size ||= request_object_size\n\n # If the resource is empty there is nothing to read\n return nil if @remote_size.zero?\n\n maximum_avaialable = @remote_size - @pos\n n_bytes ||= maximum_avaialable # nil == read to the end of file\n return '' if n_bytes.zero?\n raise ArgumentError, \"No negative reads(#{n_bytes})\" if n_bytes < 0\n\n n_bytes = clamp(0, n_bytes, maximum_avaialable)\n\n read_n_bytes_from_remote(@pos, n_bytes).tap do |data|\n if data.bytesize != n_bytes\n raise \"Remote read returned #{data.bytesize} bytes instead of #{n_bytes} as requested\"\n end\n @pos = clamp(0, @pos + data.bytesize, @remote_size)\n end\n end",
"def set_read_callback(body)\n @request_body_read = 0\n readfunction do |stream, size, num, object|\n size = size * num\n body_size = if body.respond_to?(:bytesize)\n body.bytesize\n elsif body.respond_to?(:size)\n body.size\n elsif body.is_a?(File)\n File.size(body.path)\n end\n\n left = body_size - @request_body_read\n size = left if size > left\n\n if size > 0\n chunk = if body.respond_to?(:byteslice)\n body.byteslice(@request_body_read, size)\n elsif body.respond_to?(:read)\n body.read(size)\n else\n body[@request_body_read, size]\n end\n\n stream.write_string(\n chunk, size\n )\n @request_body_read += size\n end\n size\n end\n end",
"def read n = nil\n buf = nil\n if n\n until rbuf.size >= n\n rbuf << recv\n end\n buf = rbuf[0, n]\n self.rbuf = rbuf[n, rbuf.size - n]\n else\n begin\n loop{ rbuf << recv }\n rescue EOFError\n end\n buf = rbuf.dup\n self.rbuf = ''\n end\n return buf\n end",
"def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end",
"def read(num_bytes)\n buffer = String.new\n\n until buffer.length >= num_bytes\n begin\n # Unlike plain TCP sockets, SSL sockets don't support IO.select\n # properly.\n # Instead, timeouts happen on a per read basis, and we have to\n # catch exceptions from read_nonblock and gradually build up\n # our read buffer.\n buffer << @ssl_socket.read_nonblock(num_bytes - buffer.length)\n rescue IO::WaitReadable\n if select_with_timeout(@ssl_socket, :read)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n rescue IO::WaitWritable\n if select_with_timeout(@ssl_socket, :write)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n end\n end\n\n buffer\n end",
"def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def perform_get(uri, request_headers: {}, chunk_size: 1024 * 1024 * 5)\n status_code, header_hash, socket = get_status_headers_and_body_socket(uri, request_headers: request_headers)\n body_bytes_received = 0\n \n # Yield the status and headers once with an empty response\n # so that the client can bail out of the request even before the body\n # starts to arrive\n return body_bytes_received unless yield(status_code, header_hash, '')\n \n # We are using read_nonblock, and it allows a buffer to be passed in.\n # The advantage of passing a buffer is that the same Ruby string is\n # reused for all the reads, and only the string contents gets reallocated.\n # We can reduce GC pressure this way.\n body_buf = ''\n \n # ...and then just read the body, without any buffering, using a non-blocking read\n while !socket.eof?\n begin\n data = socket.read_nonblock(chunk_size, body_buf)\n body_bytes_received += data.bytesize\n continue_reading = yield(status_code, header_hash, body_buf)\n return body_bytes_received unless continue_reading \n rescue IO::WaitReadable\n IO.select([socket], [], SOCKET_TIMEOUT)\n retry\n end\n end\n \n body_bytes_received\n ensure\n socket.close if socket && !socket.closed?\n end",
"def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end",
"def read(length=99, buf=\"buffer\") end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read(length=nil, buffer=nil)\n nil\n end",
"def read_n_bytes_from_remote(start_at, n_bytes)\n range = (start_at..(start_at + n_bytes - 1))\n request_range(range)\n end",
"def read\n\t\t\t\t\t@body.read\n\t\t\t\tend",
"def read(count = nil, buffer = \"\")\n if (count.nil?)\n read_all(buffer)\n else\n buffer = read_bytes(count, buffer)\n end\n return buffer\n end",
"def read(length=nil, buffer=nil)\n nil\n end",
"def read(length = nil, offset = 0)\n if (length == nil)\n data = ''\n fptr = offset\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n while (ok and ok['Payload'].v['DataLenLow'] > 0)\n buff = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n data << buff\n if ok['Payload'].v['Remaining'] == 0\n break\n end\n fptr += ok['Payload'].v['DataLenLow']\n\n begin\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n rescue XCEPT::ErrorCode => e\n case e.error_code\n when 0x00050001\n # Novell fires off an access denied error on EOF\n ok = nil\n else\n raise e\n end\n end\n end\n\n return data\n else\n ok = self.client.read(self.file_id, offset, length)\n data = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n return data\n end\n end",
"def fill(n = 8192)\n input.consume!\n data = recv(n)\n debug { \"read #{data.length} bytes\" }\n input.append(data)\n return data.length\n rescue EOFError => e\n @input_errors << e\n return 0\n end",
"def readpartial(size = BUFFER_SIZE)\n return unless @pending_response\n\n chunk = @parser.read(size)\n return chunk if chunk\n\n finished = (read_more(size) == :eof) || @parser.finished?\n chunk = @parser.read(size)\n finish_response if finished\n\n chunk || \"\".b\n end",
"def body\n raise \"no connection given\" unless @connection\n\n if block_given?\n # Callback from the http_parser will be calling add_body directly\n @on_body = Proc.new\n\n # clear out body buffered so far\n yield read_from_body(nil) if @body\n\n until finished_reading?\n @connection.readpartial\n end\n @on_body = nil\n else\n until finished_reading?\n @connection.readpartial\n end\n @body\n end\n end",
"def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end",
"def read(maxlen = nil, buf = nil, buffer_pos = 0)\n return readpartial(maxlen, buf, buffer_pos) if buf\n\n buf = +''\n return readpartial(maxlen, buf) if maxlen\n\n readpartial(4096, buf, -1) while true\n rescue EOFError\n buf\n end",
"def read_bytes_full\n @_io.read\n end",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end",
"def fill_read_buffer\n\t\t\t\tif buffer = @io.read(@block_size)\n\t\t\t\t\t@read_buffer << buffer\n\t\t\t\telse\n\t\t\t\t\t@eof = true\n\t\t\t\tend\n\t\t\tend",
"def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end",
"def on_body(chunk)\n @currently_reading.fill_buffer(chunk)\n end",
"def read_body(env)\n env[:body] = env[:body].read if env[:body].respond_to? :read\n end",
"def readpartial(maxlen, outbuf=nil)\n read_nonblock(maxlen, outbuf)\n rescue IO::WaitReadable\n block_until_readable\n retry\n end",
"def raw_body\n unless @raw_body\n @in.rewind\n @raw_body = @in.read(content_length)\n end\n\n @raw_body\n end",
"def read_partial(length = nil)\n if @buffer\n buffer = @buffer\n @buffer = nil\n else\n buffer = read_next\n end\n\n if buffer and length\n if buffer.bytesize > length\n # This ensures the subsequent `slice!` works correctly.\n buffer.force_encoding(Encoding::BINARY)\n\n @buffer = buffer.byteslice(length, buffer.bytesize)\n buffer.slice!(length, buffer.bytesize)\n end\n end\n\n return buffer\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def read(count = T.unsafe(nil), _buffer = T.unsafe(nil)); end",
"def read_fully(count, timeout = nil)\n value = ''\n\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError\n # JRuby specific fix via https://github.com/jruby/jruby/issues/1694#issuecomment-54873532\n IO.select([self], nil, nil, timeout)\n retry\n rescue *READ_RETRY_EXCEPTION_CLASSES\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n\n value\n end",
"def body(&block)\n call_once\n @body ||= begin\n if entity = @response.get_entity\n EntityConverter.new.read_entity(entity, &block)\n end\n rescue Java::JavaIo::IOException, Java::JavaNet::SocketException, IOError => e\n raise StreamClosedException.new(\"Could not read from stream: #{e.message}\")\n # ensure\n # @request.release_connection\n end\n end",
"def read(length)\n return nil if (@offset + length) > @buffer.bytesize\n\n chunk = @buffer.byteslice(@offset, length)\n @offset += chunk.bytesize\n\n prune if @offset > MINIMUM_AUTOMATIC_PRUNE_OFFSET\n\n return chunk\n end",
"def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def readpartial(size, buffer = T.unsafe(nil)); end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def read_until(bytes)\n out = \"\"\n size = bytes.size\n\n if @buffer && !@buffer.empty?\n if @buffer.include?(bytes)\n offset = @buffer.index(bytes) + size\n return head(offset)\n else\n out << head(@buffer.size)\n end\n end\n\n loop do\n out << @io.read(1)\n if out[-1 * size,size].eql?(bytes)\n out = out[0, out.size - size]\n seek(pos - size)\n break\n end\n end\n out\n end",
"def body\n @body_io.read.tap { @body_io.rewind }\n end",
"def read_nonblock(maxlen=99, buf=\"buffer\") end",
"def read\n until message = @reader.read_message!(@unread, @state)\n bytes = @ios.read\n if bytes and not bytes.empty?\n @unread << bytes\n else\n return nil \n end\n if @unread.size > MAX_RECEIVE_SIZE \n raise \"Maximum message size (#{MAX_RECEIVE_SIZE}) exceeded\"\n end\n end\n\n return message\n end",
"def readpartial(maxlen=99, buf=\"buffer\") end",
"def read_loop(maxlen = 8192)\n while (data = sysread(maxlen))\n yield data\n end\n end",
"def read_response(req, body = nil, &block) # :yield: +response+\n begin\n res = HTTPResponse.read_new(@socket)\n end while res.kind_of?(HTTPContinue)\n res.reading_body(@socket, req.response_body_permitted?) {\n yield res if block_given?\n }\n end_transport req, res\n\n res\n end",
"def read_loop\n loop do\n begin\n should_bail = synchronize do\n # FIXME: In case of reconnect as well?\n @status == CLOSED or @status == RECONNECTING\n end\n if !@io or @io.closed? or should_bail\n return\n end\n\n # TODO: Remove timeout and just wait to be ready\n data = @io.read(MAX_SOCKET_READ_BYTES)\n @parser.parse(data) if data\n rescue Errno::ETIMEDOUT\n # FIXME: We do not really need a timeout here...\n retry\n rescue => e\n # In case of reading/parser errors, trigger\n # reconnection logic in case desired.\n process_op_error(e)\n end\n end\n end",
"def get(timeout = nil, ltimeout = def_read_loop_timeout, opts = {})\n # For those people who are used to being able to use a negative timeout!\n if (timeout and timeout.to_i < 0)\n timeout = nil\n end\n\n # No data in the first place? bust.\n if (has_read_data?(timeout) == false)\n return nil\n end\n\n buf = \"\"\n lps = 0\n eof = false\n\n # Keep looping until there is no more data to be gotten..\n while (has_read_data?(ltimeout) == true)\n # Catch EOF errors so that we can handle them properly.\n begin\n temp = read(def_block_size)\n rescue EOFError\n eof = true\n end\n\n # If we read zero bytes and we had data, then we've hit EOF\n if (temp and temp.length == 0)\n eof = true\n end\n\n # If we reached EOF and there are no bytes in the buffer we've been\n # reading into, then throw an EOF error.\n if (eof)\n # If we've already read at least some data, then it's time to\n # break out and let it be processed before throwing an EOFError.\n if (buf.length > 0)\n break\n else\n raise EOFError\n end\n end\n\n break if (temp == nil or temp.empty? == true)\n\n buf += temp\n lps += 1\n\n break if (lps >= def_max_loops)\n end\n\n # Return the entire buffer we read in\n return buf\n end",
"def read_until(timeout=@session.timeout)\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def read_bytes(count)\n result = @content.byteslice(@cursor, count)\n @cursor += count\n result\n end",
"def handle_request\n request = \"\"\n loop do\n begin\n request << @client.readpartial(1024*2)\n msg_request\n break if request.end_with?(\"\\r\\n\\r\\n\")\n rescue Errno::EAGAIN\n # buffer not empty, wait availability\n IO.select([@client], nil, nil)\n retry\n rescue EOFError\n break # all data read\n end\n end\n request\n end",
"def read\n chunk = @client.get(@next_chunk)\n if chunk.headers[:location].nil? && chunk.code != 204\n # no more chunks\n @next_chunk = nil\n chunk.to_s\n elsif chunk.to_s == ''\n # assume no content and back off\n @interval = 2\n ''\n elsif location = chunk.headers[:location]\n # some data read and next chunk available\n @next_chunk = location\n @interval = 0\n chunk.to_s\n end\n end",
"def read(size = @chunk_size)\n case size\n when nil\n chunk = nil\n while temp = read(@chunk_size)\n if chunk\n chunk << temp\n else\n chunk = temp\n end\n end\n chunk\n when Integer\n read_chunk(size)\n else\n raise ArgumentError,\n \"Read size (#{size.inspect}) must be an Integer or nil.\"\n end\n end",
"def recvn(num_bytes, timeout: nil)\n @timer.countdown(timeout) do\n fillbuffer while @timer.active? && @buffer.size < num_bytes\n @buffer.size >= num_bytes ? @buffer.get(num_bytes) : ''\n end\n end",
"def read_bytes(count)\n result = new_buffer\n result << read_outstanding(0, count)\n @outstanding = read_outstanding(count..-1)\n result << read_bytes!(count - result.size) until result.size == count\n result\n ensure\n @recent << result\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def read_content\n # read content if content is being sent\n if @content_length && @content_length > 0\n @content = @socket.read(@content_length)\n end\n end",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def read(timeout = nil)\n wait_for_data(timeout) if timeout\n MsgVersion.new{ @socket.read msg_version.bytesize }.validate!\n size = MsgSize.new{ @socket.decode msg_size, msg_size.bytes }.validate!.value\n return MsgBody.new{ @socket.decode msg_body, size }.validate!.value\n end",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def read(len = nil)\n return nil if @read >= @size\n len ||= @size - @read\n max_read = [len, @size - @read].min\n ret = @io.read(max_read)\n @read += bytesize(ret)\n ret\n end",
"def parse_body(buffer)\n return if buffer.bytesize == body_length\n\n raise ProtocolException, \"Failed to parse packet - input buffer (#{buffer.bytesize}) is not the same as the body length header (#{body_length})\"\n end",
"def read(length=16384, timeout=nil)\n data = \"\"\n data.force_encoding(\"BINARY\") if data.respond_to?(:force_encoding)\n have_pushback = !@pushback_buffer.empty?\n if have_pushback\n data << @pushback_buffer\n @pushback_buffer = \"\"\n # We have data 'now' so don't wait.\n timeout = 0\n end\n\n if readable?(timeout)\n begin\n # Read at most 'length' data, so read less from the socket\n # We'll read less than 'length' if the pushback buffer has\n # data in it already.\n @socket.sysread(length - data.length, @read_buffer)\n data << @read_buffer\n return data\n rescue EOFError => e\n @socket.close\n @connected = false\n raise e\n end\n else\n if have_pushback\n return data\n else\n raise ReadTimeout.new\n end\n end\n end",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def read(template, bytes_count = nil)\n return if @cursor > @content.bytesize\n result = unpack_byteslice(template, bytes_count)\n @cursor += bytes_count\n result\n end",
"def recv(number_of_bytes, flags = nil)\n @in.read(number_of_bytes.to_i) || \"\"\n end",
"def each_remote_read\n return enum_for(:each_remote_read) unless block_given?\n begin\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n ensure\n set_input_stream_done\n end\n end",
"def read(bytes)\n raise \"read(bytes) must be overridden\"\n end",
"def read_all(socket)\n total_bytes = socket.recv(4).unpack(\"V\")[0]\n if total_bytes and total_bytes > 0\n socket.recv(total_bytes)\n else\n ''\n end\n end",
"def read_more(size)\n return if @parser.finished?\n\n value = @socket.readpartial(size, @buffer)\n if value == :eof\n @parser << \"\"\n :eof\n elsif value\n @parser << value\n end\n rescue IOError, SocketError, SystemCallError => e\n raise ConnectionError, \"error reading from socket: #{e}\", e.backtrace\n end",
"def read(size)\n ret = @io.read(size)\n raise EOFError if ret.nil? || size && ret.bytesize < size\n\n ret\n end",
"def get_body_chunk(request, buffered_only = false)\n @parser.read_body_chunk(buffered_only)\n end",
"def send_body_proc(socket)\n if @request_method == \"HEAD\"\n # do nothing\n elsif chunked?\n @body.call(ChunkedWrapper.new(socket, self))\n _write_data(socket, \"0#{CRLF}#{CRLF}\")\n else\n size = @header['content-length'].to_i\n @body.call(socket) # TODO: StreamWrapper which supports offset, size\n @sent_size = size\n end\n end",
"def read(n)\n Buffer.new(slice!(0, n))\n end",
"def readpartial(len, buf = +'', buffer_pos = 0, raise_on_eof = true)\n result = Polyphony.backend_read(self, buf, len, false, buffer_pos)\n raise EOFError if !result && raise_on_eof\n\n result\n end",
"def each_remote_read_then_finish\n return enum_for(:each_remote_read_then_finish) unless block_given?\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n\n receive_and_check_status\n ensure\n set_input_stream_done\n end",
"def read_boxes!(max_read_bytes = nil)\n end_pos = max_read_bytes.nil? ? nil : @stream.pos + max_read_bytes\n index = 0\n\n loop do\n return if end_pos && @stream.pos >= end_pos\n\n box_type, box_size = read_box_header!\n\n case box_type\n when \"meta\"\n handle_meta_box(box_size)\n when \"pitm\"\n handle_pitm_box(box_size)\n when \"ipma\"\n handle_ipma_box(box_size)\n when \"hdlr\"\n handle_hdlr_box(box_size)\n when \"iprp\", \"ipco\"\n read_boxes!(box_size)\n when \"irot\"\n handle_irot_box\n when \"ispe\"\n handle_ispe_box(box_size, index)\n when \"mdat\"\n throw :finish\n else\n @stream.read(box_size)\n end\n\n index += 1\n end\n end",
"def msg_read(n_bytes)\n\t@msg_buf += get_bytes(n_bytes)\n\t@msg_buf.flatten!\n\treturn @msg_buf[-1]\n end",
"def read_all\n return enum_for :read_all unless block_given?\n\n loop do\n yield read\n rescue EOFError\n break\n end\n self\n end",
"def each\n while (s = read_bytes(4096, \"\"))\n yield s\n end\n end",
"def recvExactNBytes(n)\n buffer = \"\" ;\n while(buffer.size < n)\n IO::select([@socket]) ;\n buf = @socket.recv(n-buffer.size) ;\n if(buf == \"\") # in the case of EOF\n raise SumoException.new(\"TCP socket return EOF\",\n { :n => n }) ;\n end\n buffer << buf ;\n end\n return buffer ;\n end",
"def read(length=4096,buffer='')\n @socket.read(length,buffer)\n end",
"def read( bytes_to_read )\n begin\n client = TCPSocket.new( @ip_address, @port )\n read_bytes = client.read( bytes_to_read )\n puts \"Read #{read_bytes.length}:\"\n print_bytes( read_bytes )\n return read_bytes\n rescue Errno::ETIMEDOUT\n return -1\n end\n end",
"def read(maxlen = nil, outbuf = nil)\n raise ::EOFError.new('socket closed') if @closed\n @read_defer = @reactor.defer\n\n if @read_buffer.nil?\n start_read\n @read_buffer = String.new\n self.finally do\n @read_defer.reject(::EOFError.new('socket closed'))\n end\n end\n\n if check_read_buffer(maxlen, outbuf, @read_defer)\n progress do |data|\n @read_buffer << data\n check_read_buffer(maxlen, outbuf, @read_defer)\n end\n end\n\n @read_defer.promise.value\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def receive_n_bytes(sizemax,looping=false,&b)\n s=sizemax\n if self.data_readed.size>=sizemax\n buff,self.data_readed=self.data_readed[0..sizemax-1],self.data_readed[sizemax..-1]\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n s=sizemax-self.data_readed.size\n loop do\n #p [\"waiting \",s,data_readed]\n sd=s>1024 ? 1024 : s\n data=(self.recv(sd) rescue (p $!;nil))\n #p \"nrec: w#{sizemax}/ rec:#{(data||'').size} / #{sd} old=#{data_readed.size} /// #{(data||'').size<70 ? data : \".\"}\"\n if data && data.size>0\n self.data_readed=self.data_readed+data\n s=sizemax-self.data_readed.size\n if s<=0\n buff,self.data_readed=self.data_readed,\"\"\n s=sizemax\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n else\n close rescue nil\n break # socket close\n end\n end #loop\n end",
"def close\n return if @closed\n read_body\n end"
] |
[
"0.7231826",
"0.7176725",
"0.67183006",
"0.6443749",
"0.6263354",
"0.62528884",
"0.62527543",
"0.61863875",
"0.6178254",
"0.6168622",
"0.61381185",
"0.61309606",
"0.61187243",
"0.61122686",
"0.60646546",
"0.60331625",
"0.59812707",
"0.59784293",
"0.5964736",
"0.5951795",
"0.5948561",
"0.59204423",
"0.59166336",
"0.59142554",
"0.5884267",
"0.58804697",
"0.586223",
"0.58403647",
"0.5822951",
"0.57978123",
"0.57829773",
"0.574135",
"0.5741008",
"0.5740793",
"0.57291275",
"0.57215035",
"0.5714484",
"0.5704642",
"0.5700915",
"0.5698864",
"0.56850433",
"0.56709915",
"0.56668705",
"0.56566477",
"0.56458426",
"0.56412804",
"0.56332785",
"0.56332785",
"0.56332785",
"0.5630745",
"0.56266755",
"0.56234694",
"0.56225926",
"0.5618533",
"0.56128556",
"0.56103486",
"0.56027484",
"0.559612",
"0.5593796",
"0.55866957",
"0.5571568",
"0.5566533",
"0.55642",
"0.55500925",
"0.5548502",
"0.5545566",
"0.55448246",
"0.55373436",
"0.5502829",
"0.54951906",
"0.54950666",
"0.54950666",
"0.5494091",
"0.54909986",
"0.548884",
"0.5477308",
"0.5474293",
"0.54525113",
"0.5437906",
"0.54341793",
"0.54294866",
"0.54171324",
"0.5416644",
"0.541433",
"0.54115814",
"0.54050046",
"0.54040176",
"0.5394374",
"0.53867155",
"0.5373566",
"0.5369876",
"0.5361155",
"0.5360348",
"0.5348275",
"0.5345518",
"0.5340344",
"0.5339279",
"0.53359205",
"0.53199226",
"0.5317907"
] |
0.6740672
|
2
|
Return a new instance with the given URL === Parameters url URL of the video
|
def initialize(url)
@url = url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_video\n \t @video=UnvlogIt.new(url)\n \t self.embed_url=@video.embed_html(300, 169)\n \t self.thumb_url=@video.thumbnail\n end",
"def video_url\n \"http://video.ted.com/#{videoID}\"\n end",
"def new\n @video = Video.new\n @title = \"Video Submission\"\n \n @url = params[:url]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @url = Url.new\n end",
"def video_by_status_url(status_url)\n parser = YouTubeG::Parser::VideoFeedParser.new(status_url)\n video = parser.parse \n return video \n end",
"def new\n @url = Url.new\n end",
"def new\n @url = Url.new\n end",
"def video_url(source, options = T.unsafe(nil)); end",
"def new\n \t@url = Url.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def initialize(url)\n self.url = url\n self\n end",
"def url_to_video(source, options = T.unsafe(nil)); end",
"def initialize(url)\n self.url = url\n end",
"def create\n @video = current_user.videos.build(params[:video])\n\n @url = params[:video][:url]\n\n\n require 'uri'\n\n\n if(@url.downcase.include? 'youtube.com')\n ##create ways to catch if user is using \n query_string = URI.parse(params[:video][:url]).query\n parameters = Hash[URI.decode_www_form(query_string)]\n puts parameters['v'] # => aNdMiIAlK0g\n video_id = parameters['v']\n elsif (@url.downcase.include? 'y2u.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n @video.url = @url \n elsif (@url.downcase.include? 'youtu.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n @video.url = @url\n end\n \n \n\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video.youtube_id = video_id # => aNdMiIAlK0g\n\n this_video = @yt_client.video_by(video_id)\n\n\n @video.duration = this_video.duration \n\n\n\n respond_to do |format|\n if @video.save ##and video is over 60 seconds in duration \n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @video = Video.new(params[:video])\n \n if signed_in?\n @video.user_id = current_user.id\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n existing = Video.with_url(params[:video][:url])\n if existing.nil?\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to existing, notice: 'Video has already been submitted.' }\n format.json { render json: existing, location: @video }\n end\n end\n end\n end",
"def create_and_save_video_asset_from_params\n if params.has_key?(:video_url)\n video_asset = create_asset_from_video_url(params[:video_url])\n video_asset.save\n return video_asset\n else\n render :text => \"400 Bad Request\", :status => 400\n end\n end",
"def initialize(url)\n @url = url\n end",
"def initialize(url)\n @url = url\n end",
"def from(url)\n @url = url\n self\n end",
"def parse_video_url(url)\n url_video = case url.downcase\n when /^http:\\/\\/(www\\.)?youtube\\.com/\n parse_youtube(url)\n # when /tudou/\n # parse_tudou(url)\n when /^http:\\/\\/(www\\.)?dailymotion\\.com/\n parse_dailymotion(url)\n # when /metacafe/\n # parse_metacafe(url)\n else\n url\n end\n url_video\n end",
"def create_video\n Yt::Video.new(id:(@video_id))\n end",
"def new_video_track(width, height)\n track = new_track(width, height)\n track.new_video_media\n track\n end",
"def new_video_track(width, height)\n track = new_track(width, height)\n track.new_video_media\n track\n end",
"def photo \n YoutubePhoto.new(self.url)\n end",
"def get(url, options = {})\n uri = URI.parse(auto_complete_url(url)) rescue nil\n video_site = get_video_site(uri)\n video_site && video_site.new(uri).get(options)\n end",
"def new\n @session = Session.find(params[:session_id])\n @video = Video.new(:session => @session)\n end",
"def initialize(url, datetime, presenter, audition, valid)\n @datetime = datetime\n @presenter = presenter\n @audition = audition\n @streamurl = url\n @valid = valid\n end",
"def create\n @song = @mix.songs.build(song_params)\n @song.link = @song.parse_video_url(@song.link)\n\n if @song.save\n redirect_to(mix_path(@mix), notice: 'Song was successfully created.')\n else\n render action: 'new'\n end\n end",
"def set_video\n @video = params[:id] ? Video.find(params[:id]) : Video.new(video_params)\n end",
"def url_for_video_player\n if VIDEOS_ON_S3\n \"http://wickedstartbucket.s3.amazonaws.com#{self.multimedia.url(:original, false)}\"\n else\n self.multimedia.url(:original, false)\n end\n end",
"def create\r\n @video = Video.new(params[:video])\r\n\r\n if !@video.image_url and @video.url =~ /youtube/\r\n @video.image_url = \"http://img.youtube.com/vi/\" + @video.url.split(\"/embed/\").last + \"/default.jpg\"\r\n end\r\n\r\n respond_to do |format|\r\n if @video.save\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { render json: @video, status: :created, location: @video }\r\n else\r\n format.html { render action: \"new\", :layout => false }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def initialize(url, secret = nil)\n self.url = URI.parse(url.to_s)\n self.secret = secret\n end",
"def initialize(url)\n @url = url\n freeze\n end",
"def new\n @video = Video.new\n p params\n @video.title = params[:title] if params[:title]\n @video.url = params[:url] if params[:url]\n @video.image_url = params[:image_url] if params[:image_url]\n @video.active = params[:active] if params[:active]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def call\n if url.valid? and video.present?\n context.playlist.add_video!(\n title: video.title,\n url: url.to_s,\n user: context.user\n )\n context.dj.new_video_added!\n context.message = \"Success! Your video was added to the playlist.\"\n else\n context.fail!\n context.errors = \"That doesn't look like a valid youtube url. \"\n end\n end",
"def create_media_url(assignment_id, url, user_id, submitted_at)\n # Generate a thumbnail for the URL\n thumbnail_url = nil\n site_and_slug = nil\n if url\n site_and_slug = url.extract_site_and_slug\n thumbnail_url = Video::Metadata.thumbnail_url(site_and_slug[:site_tag], site_and_slug[:site_id])\n end\n\n options = {\n canvas_assignment_id: assignment_id,\n url: url,\n canvas_user_id: user_id,\n thumbnail_url: thumbnail_url,\n submitted_at: submitted_at\n }\n if !site_and_slug.nil?\n options = options.merge({\n site_tag: site_and_slug[:site_tag],\n site_id: site_and_slug[:site_id]\n })\n end\n MediaUrl.create(options)\n end",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def cdn_video_tag(url, opts = {})\n if opts[:size]\n width, height = opts[:size].split('x')\n else\n width, height = opts[:width], opts[:height]\n end\n\n return video_tag(url, opts) # if Rails.env.development?\n\n # url = \"http:#{url}\" if url.present? && url[0..1] == \"//\"\n # cloudfront backed vide\n # video_tag(\"http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}\", opts)\n end",
"def parse_video\n # standard\n unless /\\A\\s*(?<width>\\d+)x(?<height>\\d+)\\s+(?<url>.+)\\z/ =~ content\n env.warn 'can not parse \\video content, should be \"#{WIDTH}x#{HEIGHT} #{URL}\"'\n return\n end\n\n case url\n when /youtu\\.?be/\n # NOTE merging them into one regexp fails (because longest match?)\n unless id = url[/(?<=watch\\?v=)\\w+/] || url[/(?<=embed\\/)\\w+/] || url[/(?<=youtu\\.be\\/)\\w+/]\n env.warn 'can not parse youtube id'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://www.youtube-nocookie.com/embed/#{id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>|\n when /vimeo/\n unless id = url[/(?<=vimeo\\.com\\/)\\w+/]\n env.warn 'can not parse vimeo id, should use link like this \"http://vimeo.com/#{DIGITS}\"'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://player.vimeo.com/video/#{id}\" frameborder=\"0\" allowFullScreen></iframe>|\n when /sm/\n unless id = url[/\\bsm\\d+/]\n env.warn 'can not find \"sm#{DIGITS}\" from link'\n return\n end\n %Q|<script src=\"https://ext.nicovideo.jp/thumb_watch/#{id}?w=#{width}&h=#{height}\"></script>\"|\n else\n env.warn 'failed to parse video link, currently only youtube, vimeo and niconico are supported'\n return\n end\n end",
"def with_url\n @url_match = UrlMatchBuilder.new(self)\n end",
"def grab_url_embeddable(url)\n video_info = get_video_info(url)\n video_params = extract_video_parameters(video_info)\n\n unless video_params[:embeddable]\n Youtube.notify(\"VIDEO IS NOT EMBEDDABLE\")\n return false\n end\n\n urls_formats = extract_urls_formats(video_info)\n selected_format = choose_format(urls_formats)\n title = video_params[:title]\n file_name = PluginBase.make_filename_safe(title) + \".\" + VIDEO_FORMATS[selected_format][:extension]\n\n {:url => urls_formats[selected_format], :name => file_name}\n end",
"def service_url\n begin\n return video.url\n rescue\n nil\n end\n end",
"def initialize(url)\n @url = URI.parse(url)\n end",
"def perform(url = nil)\n # 以此影片為範例,出處: Videvo\n url = 'https://cdn.videvo.net/videvo_files/video/free/2013-05/originalContent/DigitalCountdownTimerVidevo.mov'\n video_name = parse_video_name(url)\n video_file_path(video_name)\n download_video(url)\n converter\n rescue StandardError => e\n logger.error \"[Video::HandleVideoWorker] ERROR:\\n #{e.inspect}\\n #{e.backtrace}\"\n end",
"def video_params\n params.require(:video).permit(:url, :client_id)\n end",
"def create\n @video = Video.new(video_params)\n @video.board_id = @board.id\n\n urlVideo = VideoInfo.new(@video.source)\n\n\n @video.iFrame_Source = urlVideo.embed_code\n @video.title = urlVideo.title\n @video.date = urlVideo.date\n @video.provider = urlVideo.provider\n @video.description = urlVideo.description\n @video.smaller_thumbnail = urlVideo.thumbnail_small\n @video.larger_thumbnail = urlVideo.thumbnail_large\n\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to board_video_path(@board, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shortened_url = Url.new\n \n end",
"def streaming_video_url\n # TODO figure out how to remove the need for this stupid hack\n # paperclip adds the cache buster to the URL automatically, I need\n # it to go away, probably a really easy paperclip option, but not\n # finding it at the moment.\n unless streaming_video.nil?\n streaming_video.data.url.split(\"?\")[0]\n else\n nil\n end\n end",
"def initialize(url)\n @url = url\n @uri = URI.parse(url)\n end",
"def initialize(id, movie_id)\n @id = id\n @movie_id = movie_id\n @url = \"http://www.kinopoisk.ru/film/#{movie_id}/video/#{id}/\"\n @title = title\n end",
"def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def youtube_embed_url\n VideoInfo.new(self.video_url).embed_url if self.video_url?\n end",
"def create_processed_video(clazz)\n set_url\n processed_video = clazz.find(:first, :conditions => {:lesson_id => self.lesson})\n unless processed_video\n processed_video = clazz.create!(:lesson_id => self.lesson.id,\n :video_file_name => self.video_file_name,\n :s3_key => self.s3_key,\n :processed_video_cost => 0,\n :input_video_cost => 0,\n :converted_from_video => self,\n :s3_root_dir => self.s3_root_dir)\n end\n begin\n grant_s3_permissions_to_flix\n rescue Exception => e\n # rethrow the exception so we see the error in the periodic jobs log\n processed_video.change_status(VIDEO_STATUS_FAILED, e.message)\n raise e\n end\n processed_video\n end",
"def youtube_video(url)\n render :partial => 'shared/video', :locals => { :url => url }\n end",
"def video id, xml=nil\n vid = Video.new(id, self, xml)\n return nil if vid.id == -1\n return vid\n end",
"def new\n @resource = Resource.new \n @video = Video.new\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def new\n @video = Video.new\n respond_with(@video)\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def url(key)\n %(http://#{Panda::Config[:videos_domain]}/#{key})\n end",
"def initialize(param)\n case param\n when Viva::Database::Track\n @track = param\n @url = param.url\n when String\n @url = param\n else\n fail \"Invalid argument of class #{param.class} given\"\n end\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end"
] |
[
"0.69987714",
"0.6820071",
"0.6700001",
"0.66479534",
"0.6625496",
"0.6623953",
"0.6623953",
"0.6623643",
"0.64801764",
"0.6450117",
"0.6450117",
"0.6450117",
"0.6450117",
"0.64365286",
"0.64296365",
"0.64028686",
"0.6401158",
"0.63858604",
"0.6352883",
"0.6330124",
"0.62866676",
"0.6246747",
"0.6245131",
"0.62153196",
"0.6207968",
"0.6207968",
"0.6166444",
"0.6152075",
"0.61500174",
"0.6121426",
"0.6082014",
"0.608118",
"0.6071502",
"0.60697454",
"0.6059847",
"0.60590434",
"0.60349256",
"0.6024711",
"0.6023474",
"0.6021534",
"0.60125965",
"0.6004935",
"0.5994649",
"0.5983737",
"0.5981251",
"0.59726226",
"0.597061",
"0.59166104",
"0.59122485",
"0.5897429",
"0.5885656",
"0.58624977",
"0.58615625",
"0.58486867",
"0.5837626",
"0.58227295",
"0.58140016",
"0.5808788",
"0.58014923",
"0.57911074",
"0.5788001",
"0.5788001",
"0.5788001",
"0.5786928",
"0.57679117",
"0.5763362",
"0.5762696",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676",
"0.5760676"
] |
0.6238091
|
23
|
Set the own media type.
|
def service
case self.url
when YOUTUBE_REGEXP then :youtube
when VIMEO_REGEXP then :vimeo
else nil
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_media_type\n @media_type = MediaType.find(params[:id])\n end",
"def set_default_media_type\n self.media_type = ::MIME::Types[self.content_type].first.try(:media_type) || 'file'\n end",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end",
"def SetMediaType(new_media_type)\n Builtins.y2warning(\n \"PackageSlideShow::SetMediaType() is obsoled, do not use!\"\n )\n\n nil\n end",
"def set_media(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def set_admin_media_type\n @admin_media_type = Admin::MediaType.find(params[:id])\n end",
"def mime_type=(value)\n @mime_type = value\n end",
"def media_types=(value)\n @media_types = value\n end",
"def media_type\n @media_type || parse_and_return(:@media_type)\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end",
"def default_mime_type=(value); end",
"def media_type; end",
"def media_type; end",
"def set_type\n if self.mp3.present?\n self.type = \"Audio::UploadedAudio\"\n\n elsif self.enco_number.present? && self.enco_date.present?\n self.type = \"Audio::EncoAudio\"\n\n elsif self.external_url.present?\n self.type = \"Audio::DirectAudio\"\n\n end\n end",
"def type=(val)\n @type = val.to_sym if %w(UNSPECIFIED MEDIA MASTER).include? val.to_s\n end",
"def set_type\n end",
"def media_type(name)\n name = normalize(name)\n raise Restfulie::UnsupportedContentType.new(\"unsupported content type '#{name}'\") if media_types[name].nil?\n media_types[name].type\n end",
"def mediatype\n media_type\n end",
"def content_type=(identifier)\n @content_type = nil\n headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s\n end",
"def mime_type=(_); end",
"def attachment_content_type=(value)\n self.content_type=value\n end",
"def set_media_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def mime_type(mt=nil)\n @_mime_type = mt unless mt.nil?\n @_mime_type\n end",
"def set_content_type raw_type\n response_object.mime_raw raw_type\n end",
"def content_type=(value)\n @content_type = value\n end",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=(content_type); end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def set_Media(value)\n set_input(\"Media\", value)\n end",
"def mime_type(value = nil)\n value ? @mime_type = value : @mime_type\n end",
"def assign_type(content_type)\n self.type = MimeMapping.class_type_from(content_type).name\n end",
"def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end",
"def content_type=(type)\n @content_type = type\n end",
"def media=(value)\n @media = value\n end",
"def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend",
"def type\n return unless media_type\n\n media_type.split('/').first\n end",
"def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend",
"def mime_type(media_type: T.unsafe(nil)); end",
"def media_type(default = nil)\n if value = content_type\n value.split('/')[0]\n else\n if block_given?\n yield\n else\n default\n end\n end\n end",
"def set_type(v)\n self.type = v\n self\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def content_type=(new_content_type)\n write_attribute(:content_type, new_content_type)\n end",
"def set_content_type(content_type)\n set_header 'Content-Type', content_type\n end",
"def content_type=(new_content_type)\n @content_type = new_content_type\n end",
"def set_media_fixed_or_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end",
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def media_option\n super\n end",
"def to_media_type(field, val)\n @models[:medium] ||= {}\n if @models[:medium].key?(:subclass) # We've already got one.\n @process.debug(\"Skipping media type {#{val}}; already specified.\") if field.debugging\n return\n end\n @media_type_mappings ||= {\n 'image' => :image,\n 'video' => :video,\n 'sound' => :sound,\n 'map' => :map_image,\n 'map_image' => :map_image,\n 'map_js' => :map_js,\n 'http://purl.org/dc/dcmitype/stillimage' => :image,\n 'http://purl.org/dc/dcmitype/movingimage' => :video,\n 'http://purl.org/dc/dcmitype/text' => :article,\n 'http://purl.org/dc/dcmitype/sound' => :sound\n }\n norm_val = val.downcase\n type =\n if @media_type_mappings.key?(norm_val)\n @media_type_mappings[norm_val]\n else\n @process.warn(%Q{Could not find a media type (subclass) of \"#{norm_val}\"}) unless\n @missing_media_types.key?(norm_val)\n @missing_media_types[norm_val] = true\n nil\n end\n @models[:medium][:original_type] = norm_val\n @process.debug(\"Set original_type to #{norm_val}\") if field.debugging\n @models[:medium][:subclass] = type\n @process.debug(\"Set subclass to #{type}\") if field.debugging\n return unless type == :article\n\n @models[:medium][:is_article] = true\n @process.debug('Set is_article to true') if field.debugging\n end",
"def set_content_type\n @content_type = ContentType.find(params[:id])\n end",
"def []=(content_type, klass); end",
"def media_types\n Restfulie::MediaType.default_types + MediaType.medias_for(self)\n end",
"def type=(type)\n Munson.register_type(type, self)\n munson.type = type\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def content_type=(mime_type)\n self.headers[\"Content-Type\"] =\n if mime_type =~ /charset/ || (c = charset).nil?\n mime_type.to_s\n else\n \"#{mime_type}; charset=#{c}\"\n end\n end",
"def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end",
"def set_type(val)\n self.type = val\n self\n end",
"def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end",
"def mediatype\n\t\treturn \"%s/%s\" % [ self.type || '*', self.subtype || '*' ]\n\tend",
"def format=(format)\n self[\"Content-Type\"] = Rack::Mime.mime_type(\".#{format}\")\n end",
"def content_type(value = nil)\n value ? @content_type = value : @content_type\n end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def content_type=(content_type); @message_impl.setContentType content_type; end",
"def singular_linked_media_type\n \"#{polymorphic_klass_name}_#{params[:media_name]}\".singularize\n end",
"def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end",
"def set_type_sound\n @type_sound = TypeSound.find(params[:id])\n end",
"def mime_type(type, value)\n type = \".#{type}\" unless type.to_s[0] == '.'\n ::Rack::Mime::MIME_TYPES[type] = value\n end",
"def mime_type(type)\n roda_class.mime_type(type)\n end",
"def type\n Medium.find(self.source.medium_id).media\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def type=(type); end",
"def content_type(type, params={})\n type = Rack::File::MIME_TYPES[type.to_s] if type.kind_of?(Symbol)\n fail \"Invalid or undefined media_type: #{type}\" if type.nil?\n if params.any?\n params = params.collect { |kv| \"%s=%s\" % kv }.join(', ')\n type = [ type, params ].join(\";\")\n end\n response.header['Content-Type'] = type\n end",
"def mime_type\n super || Mime::Type.lookup(DEFAULT_CONTENT_TYPE)\n end",
"def set_media\n @media = Media.find(params[:id])\n end",
"def set_type_asset\n @type_asset = TypeAsset.find(params[:id])\n end",
"def content_type(type)\n @headers << \"Content-Type: #{type}\\r\\n\"\n @content_type = true\n end",
"def mime_type\n self.class.mime_type\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def type(val); @type = val; self; end",
"def setContenttype(contenttype)\r\n\t\t\t\t\t@contenttype = contenttype\r\n\t\t\t\tend",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def image_content_type=(value)\n @children['image-content-type'][:value] = value\n end",
"def media_type\n hyper_schema_link.media_type\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def mime_type; end"
] |
[
"0.81984866",
"0.774444",
"0.76506186",
"0.7602322",
"0.7284275",
"0.7251031",
"0.70867276",
"0.70646095",
"0.70615643",
"0.7060255",
"0.69953394",
"0.6954169",
"0.6954169",
"0.689309",
"0.6870712",
"0.68576276",
"0.68046117",
"0.68003726",
"0.6797459",
"0.67919534",
"0.6770316",
"0.67647696",
"0.6706853",
"0.6705124",
"0.6697898",
"0.66547185",
"0.66547185",
"0.6652916",
"0.66354716",
"0.66231036",
"0.66231036",
"0.66231036",
"0.66231036",
"0.66231036",
"0.66231036",
"0.66231036",
"0.66231036",
"0.6606105",
"0.65780413",
"0.6567052",
"0.65512264",
"0.65361845",
"0.6525686",
"0.64926803",
"0.64691895",
"0.6455097",
"0.6444289",
"0.64004076",
"0.6395863",
"0.6395863",
"0.6395863",
"0.6368798",
"0.63661116",
"0.63565654",
"0.6348563",
"0.63430595",
"0.634073",
"0.6333752",
"0.6330946",
"0.63187265",
"0.63145655",
"0.6311445",
"0.62804925",
"0.62689984",
"0.62532246",
"0.62531817",
"0.6242115",
"0.62314516",
"0.6178258",
"0.6177201",
"0.6172474",
"0.6162393",
"0.6157844",
"0.6120049",
"0.6119896",
"0.6104636",
"0.60978705",
"0.60943997",
"0.60906523",
"0.6090456",
"0.6090456",
"0.6090456",
"0.6090456",
"0.6077136",
"0.60710776",
"0.6062101",
"0.6037771",
"0.60112536",
"0.60101336",
"0.60100156",
"0.6009389",
"0.6009389",
"0.59973407",
"0.5989755",
"0.59779054",
"0.59779054",
"0.5977191",
"0.59762275",
"0.5958822",
"0.5958822",
"0.5942362"
] |
0.0
|
-1
|
Returns the own video service id
|
def id
case self.service
when :youtube then parse_video_id_for_youtube
when :vimeo then parse_video_id_for_vimeo
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def video_id_public\n if video\n video.id_public\n end\n end",
"def video_id\n values[:video_id]\n end",
"def service_url\n begin\n return video.url\n rescue\n nil\n end\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def avId\n begin\n /\\/video\\/av(\\d+)/.match(self.link)[1]\n rescue\n ''\n end\n end",
"def game_id\n service.game_id\n end",
"def video_id(url)\n url.scan(/\\?v=(.{11})|youtu.be\\/(.{11})/)[0].find {|e| not e.nil?}\n end",
"def service_id\n return @service_id\n end",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9_=\\-]+)(\\.html)?.*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9]*)(\\.html)*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def get_service_url unique_id\n \"http://gdata.youtube.com/feeds/api/videos/#{unique_id}?v=2&prettyprint=true&alt=json\"\n end",
"def my_video(video_id)\n client.get_my_video(video_id)\n end",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def youtube_video_id\t\t\n\t\tif self.video_url.nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.video_url.rpartition('/').last\n\t\tend\n\n\tend",
"def video_url\n \"http://video.ted.com/#{videoID}\"\n end",
"def video_device_name\n return @video_device_name\n end",
"def get_youtube_video_id(url)\n # find id\n result = url.match /https*\\:\\/\\/.*youtube\\.com\\/watch\\?v=(.*)/\n # return id or nil\n result ? result[1] : nil\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def instance_id\n @grpc.name.split(\"/\")[3]\n end",
"def extract_vimeo_id(vimeo_embed_code)\n extract_vimeo_source(vimeo_embed_code)\n .match(/video\\/(\\d+)$/)[1].to_s\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def video_content_name_id\n\t\traise 'Don\\'t use VideoContent.video_content_name_id'\n\tend",
"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 youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def platform_id\n @banner.dsp_creative_id\n end",
"def get_current_video\n\t\t@current_video ||= if params[:video_id].present?\n\t\t\tVideo.find(params[:video_id])\n\t\tend\n\tend",
"def get_video_status\n Skype.send_ :command => \"get call #{id} video_status\"\n end",
"def video\n\t\tVideo.find(self.video_id)\n\tend",
"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_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def service_id=(value)\n @service_id = value\n end",
"def service_io_id\n service.present? ? service.io_id : nil\n end",
"def youtube_id\n rexp = /v=(.*)/ or /embed\\/(.*)/\n rexp.match(url).captures.first\n end",
"def game_key\n service.game_key\n end",
"def device_id\n apn_device_token\n end",
"def project_id\n service.project_id\n end",
"def provider_id_for_audits\n nil\n end",
"def get_current_pod_id\n config = get_config['pod_file']\n return nil unless config\n apps = admo_account.apps\n p = apps.select{|a| a.pod_name == config}\n first = p.first\n return first.id if first\n return nil\n end",
"def service_id(instance, index)\n \"a-bot-#{ fetch(:stage) }-#{ instance[:id] }-#{ index }\"\nend",
"def get_player_id\n\t\t@player_id\n\tend",
"def vend_id\n config.present? ? config[:vend_id] : ''\n end",
"def current_video\n last_poll = Room.find(id).video_polls.second_to_last\n if last_poll\n if last_poll.played_video\n last_poll.played_video\n else\n last_poll.candidate_videos.first.video\n end\n else\n playlist.videos.first\n end\n end",
"def project_id\n @service.project_id\n end",
"def video_session\n filename.split(\"_\").first\n end",
"def parse_video_id_for_vimeo\n parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)\n end",
"def youtube_id\n\t\tif youtube?\n\t\t\treturn path[\"stoffi:track:youtube:\".length .. -1]\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def uuid\n idme_uuid\n end",
"def get_video_id_from_response_body(response_body)\n doc = Nokogiri::XML(response_body)\n doc.css('vzaar-api video').first.content\n end",
"def appt_id\n @appt_id ||= base_qm.dig(:appointment, 'id')\n end",
"def service_pid\n _pid_file_pid\n end",
"def partner_id\n general_info_hash['ID:']\n end",
"def parse_video_id_for_youtube\n parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)\n end",
"def venmo_business_profile_id\n nil\n end",
"def find_vimeo_id url\n url = sanitize url\n matches = VIMEO_REGEX.match url.to_str\n matches[2] if matches\n end",
"def service_name\n @service_name ||= InchCI::ProjectUID.new(uid).service\n end",
"def get_server_id\n return nil\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def project_id\n service.project\n end",
"def extractYouTubeID(url)\n YoutubeVideoId.extract(url)\n end",
"def current_vm_id\n @metadata_lock.synchronize do\n instance_manager.instance_id\n end\n end",
"def service_plan_id\n return @service_plan_id\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def instance_profile_id\n data.instance_profile_id\n end",
"def server_id\n @host.id\n end",
"def get id\n @services[id]\n end",
"def current_user_id\n @server.current_user_id\n end",
"def target_id\n user_app_token\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 youtube_id(youtube_url)\n regex = %r{(?:youtube(?:-nocookie)?\\.com/(?:[^/\\n\\s]+/\\S+/|(?:v|e(?:mbed)?)/|\\S*?[?&]v=)|youtu\\.be/)([a-zA-Z0-9_-]{11})}\n match = regex.match(youtube_url)\n match[1] if match\n end",
"def unique_id\n playlist_id[/playlists\\/([^<]+)/, 1]\n end",
"def id\n object.external_id\n end",
"def auditor_id\n Settings[:auditor_id]\n end",
"def active_service_token\n service_tokens.first\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def project_id\n @grpc.name.split(\"/\")[1]\n end",
"def media_id\n changes['media_id']\n end",
"def beacon_host\n @vic.vim.serviceContent.about.instanceUuid\n Time.now.to_s\n end",
"def service_principal_id\n return @service_principal_id\n end",
"def external_id\n return @external_id\n end",
"def external_id\n return @external_id\n end",
"def external_id\n return @external_id\n end",
"def external_id\n return @external_id\n end",
"def vimeo_url(video_id)\n\t\t\"https://player.vimeo.com/video/#{video_id}\"\n\tend",
"def api_id\n chip_api.tmp_api_id\n end"
] |
[
"0.6972197",
"0.6930654",
"0.68147475",
"0.6795659",
"0.65848464",
"0.65729535",
"0.6571735",
"0.6541422",
"0.65072626",
"0.64860314",
"0.6455446",
"0.64406645",
"0.6383935",
"0.62886703",
"0.6279221",
"0.6240653",
"0.6212364",
"0.62025154",
"0.60879457",
"0.60879457",
"0.60879457",
"0.60879457",
"0.60879457",
"0.60879457",
"0.60879457",
"0.6053791",
"0.602568",
"0.59731823",
"0.59238213",
"0.59167343",
"0.59020585",
"0.5891886",
"0.58878404",
"0.58502454",
"0.58447343",
"0.5834089",
"0.58260196",
"0.5801279",
"0.5796527",
"0.57895446",
"0.57855564",
"0.57841736",
"0.5783151",
"0.57666916",
"0.5766141",
"0.575858",
"0.5726953",
"0.57065725",
"0.57054096",
"0.56995004",
"0.56943935",
"0.56658375",
"0.5643869",
"0.56240654",
"0.5596033",
"0.559344",
"0.5587461",
"0.5577096",
"0.55663174",
"0.5553603",
"0.5551135",
"0.55472046",
"0.5533123",
"0.5530424",
"0.5530424",
"0.5530424",
"0.55169743",
"0.55163217",
"0.55106014",
"0.55097884",
"0.55097884",
"0.55097884",
"0.55097884",
"0.55039537",
"0.55007386",
"0.5499902",
"0.54914784",
"0.5485994",
"0.5485153",
"0.5479248",
"0.5474202",
"0.5473038",
"0.54695755",
"0.5467389",
"0.5436727",
"0.5436727",
"0.5436727",
"0.5436727",
"0.5436727",
"0.5436727",
"0.5436727",
"0.5432284",
"0.5423992",
"0.5415335",
"0.5409559",
"0.5409559",
"0.5409559",
"0.5409559",
"0.5396029",
"0.53940266"
] |
0.8061878
|
0
|
Returns the URL for this video embedded === Parameters options Configuration for the embedded URL. === Options :autoplay Autoplay on or off (default on)
|
def embedded(options={})
autoplay = options[:autoplay].nil? ? true : options[:autoplay]
autoplay = !!autoplay ? '1' : '0'
embeded_template = case self.service
when :youtube then YOUTUBE_EMBEDDED_TEMPLATE
when :vimeo then VIMEO_EMBEDDED_TEMPLATE
end
return embeded_template % [self.id, autoplay]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def embeddable_url\n\t\turl.sub('watch?v=', 'embed/')\n\tend",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def youtube_embed_url\n VideoInfo.new(self.video_url).embed_url if self.video_url?\n end",
"def video_url(source, options = T.unsafe(nil)); end",
"def oembed_url\n \"https://graph.facebook.com/v9.0/oembed_video?url=#{source_url}\" \\\n \"&access_token=#{access_token}\"\n end",
"def oembed_url\n 'https://www.slideshare.net/api/oembed/2?format=json&url='\\\n \"#{source_url}\"\n end",
"def autoplay_embed\n \"#{video.__autoplay_embed__}#{tracker(true)}\"\n end",
"def url\n options[:url]\n end",
"def embed_code(url, options={})\n begin\n EmbedLinkFactory.get_embed_link(url).embed_code(options)\n rescue\n begin\n DefaultLink.new(url).embed_code(options)\n rescue\n url\n end\n end\n end",
"def youtube_url\n \"https://www.youtube.com/watch?v=#{@data['youtubeID']}\" if @data['youtubeID']\n end",
"def video_url\n \"http://video.ted.com/#{videoID}\"\n end",
"def embed_link\n return nil if self.youtube_link.nil?\n\n id_regex = /(?:http:\\/\\/)?(?:www\\.)?(?:youtube\\.com|youtu\\.be)\\/(?:watch\\?v=)?(.+)/\n youtube_id = self.youtube_link.match(id_regex)\n return nil if youtube_id.nil?\n\n return YOUTUBE_EMBED_PREFIX + youtube_id[1] + \"?rel=0\"\n end",
"def source_url\n \"https://www.facebook.com/facebook/videos/#{@element.embed_id}\"\n end",
"def url_for_video_player\n if VIDEOS_ON_S3\n \"http://wickedstartbucket.s3.amazonaws.com#{self.multimedia.url(:original, false)}\"\n else\n self.multimedia.url(:original, false)\n end\n end",
"def url\n @url ||= File.join(AUDIO_URL_ROOT, self.path) if self.live?\n end",
"def url\n @manifest_options[:url] || \"\"\n end",
"def service_url\n begin\n return video.url\n rescue\n nil\n end\n end",
"def embed_code(options={})\n \"<img src=\\\"#{@url}\\\" width=\\\"#{embed_width}\\\"/>\"\n end",
"def embed_link\n self.embed = detect_host\n end",
"def url_to_video(source, options = T.unsafe(nil)); end",
"def embed\n if youtube_url then youtube_embed\n # Uploads don't get put in the embed field on Kitsu\n elsif upload_url then nil\n elsif image then image_embed\n elsif link then link\n end\n end",
"def convert_to_youtube_embed_link\n self.video_url.gsub!(/(youtube.com\\/)(.)*v=([\\w\\-_]+)(.)*$/, '\\1embed/\\3')\n end",
"def url(**options)\n if uploaded_file = get\n uploaded_file.url(**options)\n else\n default_url(**options)\n end\n end",
"def oembed_options\n { :maxwidth => \"560\", :maxheight => \"315\" }.merge(options[:oembed]||{})\n end",
"def src(options = {})\n protocol = options[:protocol] == \"https://\" ? \"https\" : \"http\"\n \"#{protocol}://#{SRC_BASE_URL}?\" + src_options.to_query\n end",
"def source_url\n handle, slug = @element.embed_id.split('/', 2)\n \"https://www.slideshare.net/#{handle}/#{slug}\"\n end",
"def embed_media( options = {} )\n width = options[:width] || 633\n height = options[:height] || 475\n\n if options[:link] && options[:uploaded_image_url]\n raise ArgumentError, \"embed_media cannot have both \\\"link\\\" and\n \\\"uploaded_image_url\\\" arguments\"\n end\n\n if options[:link]\n return embed_video(link: options[:link], \n width: width, \n height: height,\n class: options[:class])\n\n elsif options[:uploaded_image_url]\n return \"<img src=\\\"#{options[:uploaded_image_url]}\\\" class=\\\"#{options[:class]}\\\">\".html_safe\n\n elsif !options[:uploaded_image_url] && !options[:link]\n return broken_image_tag(height, width, options[:class])\n end\n\n end",
"def source\n\t\tif youtube?\n\t\t\treturn \"http://www.youtube.com/v/\" + youtube_id + \"?fs=1\"\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def onliner_url\n @url ||= (CONSTANT_URL + @options.to_query)\n end",
"def youtube_url\n return \"https://www.youtube.com/results?search_query=#{CGI.escape(self.name)}\"\n end",
"def video_path(source, options = {})\n asset_path source, sprockets_helpers_settings.default_path_options[:video_path].merge(options)\n end",
"def relative_url\n begin\n return Rails.application.routes.url_helpers.rails_blob_path(video, only_path: true)\n # url_for(clip.video) # for redirect links\n # rails_blob_path(clip.video, disposition: \"attachment\") # for downloads links\n rescue\n nil\n end\n end",
"def grab_url_embeddable(url)\n video_info = get_video_info(url)\n video_params = extract_video_parameters(video_info)\n\n unless video_params[:embeddable]\n Youtube.notify(\"VIDEO IS NOT EMBEDDABLE\")\n return false\n end\n\n urls_formats = extract_urls_formats(video_info)\n selected_format = choose_format(urls_formats)\n title = video_params[:title]\n file_name = PluginBase.make_filename_safe(title) + \".\" + VIDEO_FORMATS[selected_format][:extension]\n\n {:url => urls_formats[selected_format], :name => file_name}\n end",
"def youtube_embed_code(size)\n width, height = video_embed_size(size)\n \"<iframe id='embedded_video' width='#{width}' height='#{height}' src='http://www.youtube.com/embed/#{self.params['v'][0]}?autohide=1&hd=1&border=1&showinfo=0' frameborder='0' allowfullscreen></iframe>\".html_safe\n end",
"def video_link\n if video_type? && !body.nil?\n vimeo_video(body) || youtube_video(body)\n end\n end",
"def url(key)\n %(http://#{Panda::Config[:videos_domain]}/#{key})\n end",
"def audio_url(source, options = T.unsafe(nil)); end",
"def video_path(source, options = T.unsafe(nil)); end",
"def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end",
"def embed_url\n params = {\n showChat: false,\n userName: Rack::Utils.escape(h.current_user.username)\n }\n\n \"#{url}?#{params.to_query}\"\n end",
"def youtube_embed(youtube_url)\n VideoPlayer::player(youtube_url,\"640\", \"390\", true)\n end",
"def youtube_url; \"https://youtube.com/user/#{youtube}\" end",
"def embed_video\r\n\tvid_host = self.video_url.sub(/^https?\\:\\/\\//, '').sub(/^www./,'').split('/')[0]\r\n\tif vid_host == 'youtube.com' or vid_host == 'youtu.be'\r\n\t\tyoutube_embed(self.video_url)\r\n\telsif vid_host == 'player.vimeo.com' or vid_host == 'vimeo.com'\r\n\t\tvimeo_embed(self.video_url)\r\n\tend\r\n end",
"def streaming_video_url\n # TODO figure out how to remove the need for this stupid hack\n # paperclip adds the cache buster to the URL automatically, I need\n # it to go away, probably a really easy paperclip option, but not\n # finding it at the moment.\n unless streaming_video.nil?\n streaming_video.data.url.split(\"?\")[0]\n else\n nil\n end\n end",
"def url(**options)\n storage.url(id, **options)\n end",
"def embedded_url\n\t\t\t\"#{self.base_url}/webapps/adaptivepayment/flow/pay?payKey=#{self[:pay_key]}#{\"&preapprovalkey=#{self[:preapproval_key]}\" if command == :preapproval}\" if webscr?\n\t\tend",
"def url(options = {})\n file.path\n end",
"def public_path(options={})\n self.public_url\n end",
"def vimeo_url(video_id)\n\t\t\"https://player.vimeo.com/video/#{video_id}\"\n\tend",
"def src(options = {})\n # o = player_options(options)\n # make_query_options!(o)\n o = {}\n src_with_options(o)\n end",
"def video_embed_tag(youtube_url, width = '500', height = '315')\n embed_url = Youtube.embed_url(youtube_url)\n return '' if embed_url.blank?\n tag(:iframe, {:width => width, :height => height, :src => embed_url, :frameborder => 0, :allowfullscreen => true})\n end",
"def permanent_public_url(options={})\n opts = set_defaults(options)\n ext = opts[:extension]\n # 'id' is slightly obfuscated as hexadecimal string\n url = Routes.root_url + [\"media\",opts[:class],opts[:id].to_i.to_s(16),opts[:name]].join('/')\n url += \".#{ext}\" unless ext.blank?\n url\n end",
"def options\n session.uri\n end",
"def youtube_movie_embed\n str1 = \"http://www.youtube.com/v/\" \n str2 = movie_home_url.split('v=',2).last unless movie_home_url.nil?\n str3 = \"&hl=en_US&fs=1&\"\n return [str1,str2,str3].join \n end",
"def new_embedded_run_url(id_or_model)\n id = workflow_id(id_or_model)\n\n raw(taverna_player.new_run_url(:workflow_id => id, :embedded => true))\n end",
"def url_for(option)\n host = SermepaWebTpv.response_host\n path = SermepaWebTpv.send(option)\n\n if host.present? && path.present?\n URI.join(\"http://#{host}\", path).to_s\n end\n end",
"def external_url\n \"https://play.crayta.com/games/#{external_id}\"\n end",
"def url_for(option)\n host = SermepaWebTpv.response_host\n path = SermepaWebTpv.send(option)\n\n return if !host.present? || !path.present?\n URI.join(host, path).to_s\n end",
"def path_to_video(source, options = T.unsafe(nil)); end",
"def url\n options[:test] ? options[:test_url] : options[:production_url]\n end",
"def url\n options[:test] ? options[:test_url] : options[:production_url]\n end",
"def source_url\n return @source_url if @source_url\n if node_name == 'param'\n # Quick XPath search to find the <param> node that contains the video URL.\n return unless movie_node = node.parent.search('param[@name=\"movie\"]')[0]\n url = movie_node['value']\n else\n url = node['src']\n end\n # strip off optional protocol and www\n protocol_regex = %r{^(?:https?:)?//(?:www\\.)?}i\n @source_url = url&.gsub(protocol_regex, '')\n end",
"def asset_url(source, options = T.unsafe(nil)); end",
"def initialize(options={})\n @query, @max_results, @offset = nil\n @alt = 'atom'\n @strict = 'false'\n @v = 2\n\n @url = base_url\n set_instance_variables(options)\n\n @url << build_query_params(to_youtube_params)\n end",
"def vend_url\n URI(\"https://#{config.vend_id}.vendhq.com/\")\n end",
"def url(**options)\n file&.url(**options)\n end",
"def build_url(product, options = nil)\n \"#{BASE_URL}#{product}#{build_query_string(options)}\"\n end",
"def url\n connection.build_url(url_chunk, params).to_s\n end",
"def download_url(**opt)\n opt[:expires_in] ||= ONE_TIME_USE_EXPIRATION\n attached_file&.url(**opt)\n end",
"def picture_url(options = {})\n return if picture.nil?\n routes.show_picture_path(picture_params(options))\n end",
"def url\n create_episode_url(@slug)\n end",
"def get_poster args, options\n options = options.dup\n response = get_response(args, options)\n filename = create_filename(response)\n FileOps.download_url(filename, response.poster_url)\n options[:embed] ||= []\n options[:embed] << \"#{Settings.config[:paths][:downloads]}/#{filename}\"\n return options\n end",
"def get(url, options = {})\n uri = URI.parse(auto_complete_url(url)) rescue nil\n video_site = get_video_site(uri)\n video_site && video_site.new(uri).get(options)\n end",
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def thumbnail_url\n if video_processing\n \"\"\n else\n video.thumb.url\n end\n end",
"def get_ai_publisherurl(options)\n options['publisherurl'] = \"http://\"+options['publisherhost']+\":\"+options['publisherport']\n return options\nend",
"def play\n\t\treturn \"stoffi:track:youtube:#{youtube_id}\" if youtube?\n\t\treturn \"stoffi:track:soundcloud:#{soundcloud_id}\" if soundcloud?\n\t\treturn url\n\tend",
"def url\n [ Configuration.url, @path ].join\n end",
"def video_xml(video_options)\n SitemapGenerator::Builder::SitemapUrl.new(url_options[:path], {\n :host => url_options[:host],\n :video => video_options\n }).to_xml\n end",
"def get_service_url unique_id\n \"http://gdata.youtube.com/feeds/api/videos/#{unique_id}?v=2&prettyprint=true&alt=json\"\n end",
"def video_tag(options = {})\n options = ActiveRecord::Acts::Cinema::DEFAULT_OPTIONS.merge(options)\n video_url = read_attribute(ActiveRecord::Acts::Cinema::SOURCE_PARAM)\n\n width = options[:width]\n height = options[:height]\n allow_full_screen = options[:allow_full_screen] ? \"true\" : \"false\"\n \n # Check the tag option, if a method is assigned, \n # call it to get the template string\n if options[:tag_template].is_a?(Symbol) \n tag_template = self.send options[:tag_template]\n else\n tag_template = options[:tag_template]\n end\n ERB.new(tag_template).result(binding)\n end",
"def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end",
"def mp3_url\n @mp3_url ||= url_for_format('mp3')\n end",
"def source_url\n settings.source_url\n end",
"def get_ai_alt_publisher_url(options)\n options['publisherport'] = options['publisherport'].to_i+1\n options['publisherport'] = options['publisherport'].to_s\n options['publisherurl'] = \"http://\"+options['publisherhost']+\":\"+options['publisherport']\n return options\nend",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def url_for(options = {})\n url = super options\n if params[:popup] == \"true\"\n if url.include? \"?\"\n url + \"&popup=true\"\n else\n url + \"?popup=true\"\n end\n else\n url\n end\n end",
"def audio_url_chartable\n ENV['CHARTABLE_ID'].nil? ? @audio_url : @audio_url.gsub('https://', \"https://chtbl.com/track/#{ENV['CHARTABLE_ID']}/\")\n end",
"def podcast_url\n @podcast_url ||= File.join(PODCAST_URL_ROOT, self.path) if self.live?\n end",
"def image_url_embedly(link_url)\n response = http_get \"http://api.embed.ly/1/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def url(size_name) \n if @youtube_id\n \"http://img.youtube.com/vi/#{@youtube_id}/0.jpg\"\n else\n \"http://img.youtube.com/vi/0.jpg\"\n end\n end",
"def enable_embed\r\n session[:embed] = params[:embed] if params[:embed]\r\n if session[:embed]\r\n \"embed\"\r\n else\r\n \"application\"\r\n end\r\n end",
"def create\n @embedded_attachment = EmbeddedAttachment.new(embedded_attachment_params)\n\n respond_to do |format|\n if @embedded_attachment.save\n @url = @embedded_attachment.embed_code\n format.html { redirect_to @embedded_attachment, notice: 'Video was successfully created.' }\n format.js\n else\n format.html { render :new }\n format.json { render json: @embedded_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initial_url\n options.fetch(:url) { \"https://#{FaaInfo.domain}/\" }\n end",
"def url(options = {})\n self.class.url_for(key, bucket.name, options)\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def downloaded_video_path\n \"/songs/#{self.id}.mpg\"\n end",
"def preview_url(opts={})\n url(opts)\n end"
] |
[
"0.67662454",
"0.67657304",
"0.6668847",
"0.6600432",
"0.65870035",
"0.6400546",
"0.63416594",
"0.6239008",
"0.6233421",
"0.6227325",
"0.62022215",
"0.617299",
"0.6156925",
"0.6082928",
"0.60553336",
"0.60360926",
"0.6003414",
"0.5906813",
"0.5864534",
"0.5864097",
"0.58395153",
"0.5821409",
"0.5784359",
"0.5725203",
"0.57214266",
"0.5714529",
"0.5702514",
"0.5693095",
"0.5691473",
"0.5667563",
"0.56046164",
"0.55956024",
"0.55942017",
"0.558392",
"0.5570401",
"0.5556423",
"0.5546081",
"0.55367965",
"0.5533903",
"0.5532614",
"0.5507516",
"0.5500639",
"0.5489946",
"0.5477483",
"0.5455781",
"0.54484636",
"0.54476774",
"0.5443375",
"0.54197633",
"0.54064256",
"0.54059446",
"0.5388754",
"0.5387872",
"0.53855187",
"0.5383345",
"0.5371947",
"0.5360042",
"0.53520066",
"0.5348623",
"0.5343163",
"0.5343163",
"0.5318767",
"0.5316114",
"0.53074294",
"0.52970576",
"0.5294375",
"0.52794546",
"0.5273019",
"0.5234078",
"0.5232183",
"0.52215296",
"0.5193794",
"0.5192757",
"0.5191349",
"0.5184423",
"0.5174442",
"0.5171267",
"0.51685303",
"0.5164532",
"0.51632905",
"0.5158719",
"0.5149167",
"0.5133099",
"0.5133044",
"0.51275235",
"0.5126382",
"0.5115433",
"0.5110776",
"0.5104677",
"0.509568",
"0.50898856",
"0.5087438",
"0.50838315",
"0.5080105",
"0.50791866",
"0.50732267",
"0.50732267",
"0.50732267",
"0.50612783",
"0.5047058"
] |
0.7060799
|
0
|
Returns true if the URL is valid
|
def valid?
VideoUrl.valid?(self.url)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_url?\n @url =~ URI::regexp\n end",
"def validate(url)\n begin\n uri = URI.parse(url)\n if uri.class != URI::HTTP\n\t return false\n end\n rescue URI::InvalidURIError\n\t return false\n end\n return true\nend",
"def valid_url?(url)\n return false if url.nil? || url.strip.empty?\n\n URI(url)\n true\n rescue URI::InvalidURIError\n false\n end",
"def is_valid_url?\n (@url =~ URI::DEFAULT_PARSER.make_regexp) != nil\n end",
"def valid_url?(url)\n uri = URI.parse(url)\n uri.kind_of?(URI::HTTP)\n rescue URI::InvalidURIError\n false\n end",
"def valid_url?(url)\n\t\turi = URI.parse(url)\n\t\treturn true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\n\t\tfalse\n\trescue\n\t\tfalse\n\tend",
"def is_valid_url?(url)\n if (url =~ /\\A#{URI::DEFAULT_PARSER.make_regexp}\\z/) == 0\n return true\n else\n return false\n end\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"def assert_url\n begin\n URI.parse(url)\n return true\n rescue URI::InvalidURIError => e\n errors.add(\"url\", \"has invalid format\")\n return false\n end\n end",
"def valid_url?(url)\r\n uri = URI.parse(url)\r\n return true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\r\n false\r\n rescue\r\n false\r\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def valid_url?(url)\n uri = URI.parse(url)\n return true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\n false\n rescue\n false\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def url_valid?\n uri = URI(full_url)\n Net::HTTP.start(uri.host, uri.port, :use_ssl => full_url.start_with?(\"https\")) do |http|\n response = http.request_get(full_url)\n return response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPRedirection)\n end\n end",
"def is_url_valid\n\t\tunless self.long_url.starts_with?(\"http://\", \"https://\")\n\t\t\terrors.add(:long_url, \"invalid format\")\n\t\tend\n\tend",
"def valid?\n Wgit::Url.valid?(self)\n end",
"def validate(url)\n if url && url.is_a?(String) && url.match(/(^$)|(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix)\n return true\n else\n raise InvalidURL\n end\n end",
"def valid?\n (uri.host =~ LINK_REGEX || uri.host =~ LINK_IP_REGEX) ? true : false\n end",
"def valid_url?\n # Not sure if we should make a change in the user initial data, we could just return as invalid.\n my_target_url = target_url.match(/http/) ? target_url : target_url.prepend(\"http://\")\n\n response = HTTParty.get(my_target_url) rescue nil\n\n return if response&.code == 200\n\n errors.add(:short_url)\n end",
"def valid_url?(url)\n uri = URI.parse(url)\n\n uri.absolute?\n rescue\n false\n end",
"def url_must_be_valid\n url.blank? ||\n (url_is_remote? and url_has_suffix? and url_matches?) ||\n errors.add(:url, :invalid)\n end",
"def valid_url?(uri)\n parsed = URI.parse(uri)\n return (parsed.scheme == 'http' || parsed.scheme == 'https')\n rescue URI::InvalidURIError\n false\n end",
"def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\treturn \"http://\" + self.long_url\n\t\telse\n\t\t\treturn self.long_url\n\t\tend\n\tend",
"def value_url_valid?\n begin\n uri = URI.parse(value)\n uri = URI.parse(\"http://#{url}\") if uri.scheme.nil?\n if uri.scheme.downcase != 'http' and uri.scheme.downcase != 'https'\n @errors_data << 'validate_no_http_s_url'\n return false\n end\n value = uri.to_s\n return true\n rescue\n @errors_data << 'validate_invalid_url'\n return false\n end\n end",
"def url_valid?\n ALLOWED_URLS.each do |host, url_allowed|\n if url.include? url_allowed\n @host = host\n return true\n end\n end\n false\n end",
"def validate_url_format\n valid_url = false\n begin\n uri = URI.parse(url)\n valid_url = uri.scheme.present? || uri.host.present?\n rescue URI::InvalidURIError\n valid_url = false\n end\n errors.add(:url, 'format is invalid') unless valid_url\n end",
"def valid_url?(url)\n resp = Curl.get url\n\n if resp.body_str.include? @invalid_text\n return false\n else\n return true\n end\nend",
"def invalid_url?(url)\n url.include? 'hurl.it'\n end",
"def validate_uri(url)\n return validate({:url => url})\n end",
"def url_ok(url)\n return url =~ URI::ABS_URI\n end",
"def proper_url? \n\t\tif !(self.long_url.start_with?('http://') || self.long_url.start_with?('https://'))\n\t\t\terrors.add(:long_url, \"is in invalid format.\")\n\t\tend \n\tend",
"def valid_url\n unless UrlValidator.valid_entry_url? self.url\n errors.add :url, \"URL #{self.url} is not a valid http, https or protocol-relative URL\"\n end\n end",
"def url_is_valid_url\n uri = URI.parse(url)\n if !uri.kind_of?(URI::HTTP)\n errors.add(:url, \"must be a valid HTTP/HTTPS URL\")\n end\n rescue URI::InvalidURIError\n end",
"def valid_url?\n !Sailpoint.config.url.blank?\n end",
"def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend",
"def is_url?(url)\n\t\tputs \"Validate the URL format is valid: #{url}\" if @verbose\n\t\tbegin\n\t\t\tif url =~ /(http|https)\\:\\/\\/((.)+)/i\n\t\t\t\thost=$2.split('/')[0]\n\t\t\t\thost=host.split(':')[0]\n\t\t\t\tif is_ip?(host) or is_fqdn?(host)\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Unknown URL format: #{url}\" if @verbose\n\t\t\t\treturn false\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn false\n\t\tend\n\tend",
"def is_a_real_url?\n begin\n URI.parse(long_url)\n rescue URI::InvalidURIError\n errors.add(:message, \"must be a valid URL\")\n end \n end",
"def validate_url(string)\n schemes = ['http', 'https']\n match = string.match(URI.regexp(schemes))\n return (0 == match.begin(0) and string.size == match.end(0)) if match\n false\n end",
"def fake_url?\n url =~ /^\\d\\d\\d\\d-/\n end",
"def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end",
"def url_is_valid\n errors.add(:url, \"url is not valid\") unless is_http_url? || is_spotify_url?\n end",
"def valid?\n return false if relative?\n return false unless to_origin && to_domain\n return false unless URI::DEFAULT_PARSER.make_regexp.match(normalize)\n\n true\n end",
"def all_valid?\n valid_url?\n end",
"def url_exist?\n\t\tbegin\n\t\t\turi = URI.parse(valid_url?)\n\t\t\tresponse = Net::HTTP.get_response(uri)\n\t\trescue \n\t\t\terrors.add(:long_url,\"is invalid url\")\n\t\t\t# in AR, error is a class by itself already \n\t\t\t# go to static.rb to check the errors\n\t\tend\n\tend",
"def validate_full_url\n if self.full_url.nil?\n return\n end\n\n if((self.full_url =~ URI::regexp(\"http\")) == nil && (self.full_url =~ URI::regexp(\"https\")) == nil)\n self.errors.add(:full_url, \"Full url is not a valid url\")\n end\n end",
"def verify_url!\n fail InvalidUrlException unless uri.to_s =~ URI::regexp\n fail UnsupportedFileException if !valid_readers_format? && !valid_file_format?\n end",
"def valid?(url)\n url =~ %r|^http://www.megaupload.com/\\?d=[a-zA-Z0-9]+$|\nend",
"def original_is_valid?\n valid_host? && valid_length? && valid_scheme?\n end",
"def validate_url(url)\n results = /\\A(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?\\z/.match(url)\n return false if results.nil? || results.length == 0\n response = Typhoeus.get(url)\n return true if response.code == 200\n true\n end",
"def check_if_link_is_valid\n uri = URI.parse(self.url.split(\" \")[0])\n self.url = uri\n if !%w( http https ).include?(uri.scheme)\n self.url = nil\n end\n end",
"def good_resource?(url)\n if rx_url\n !(url.to_s !~ rx_url)\n else\n true\n end\n end",
"def is_url? string\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"def validate_url\n self.url = ExternalWork.format_url(self.url)\n errors.add_to_base(t('invalid_url', :default => \"Not a valid URL\")) unless self.url_active?\n end",
"def valid?(url, *options)\n temp_verifier = UrlSigner::Verifier.new(url, *options)\n temp_verifier.valid?\n end",
"def validate_uri(uri)\n validate_text(Net::HTTP.get(URI.parse(uri)))\n end",
"def is_url?\n path =~ URL_PATHS\n end",
"def validate_url\n url = params[:url] || params[:program][:url]\n begin\n URI.parse(url) if url\n rescue URI::InvalidURIError\n raise ExceptionTypes::BadRequestError.new(\"Invalid characters used in URL: #{url}\")\n end\n end",
"def valid?\n RDF::URI::IRI.match?(to_s) || false\n end",
"def url?(string)\n begin\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def real_url?\n url && url.present? && url != \"#\"\n end",
"def validate_url_attribute(attribute)\n value = self.read_attribute(attribute)\n return true if value.blank?\n begin\n url = self.normalize_url!(value)\n self.write_attribute(attribute, url)\n return true\n rescue URI::InvalidURIError => e\n self.errors.add(attribute, 'is invalid')\n return false\n end\n end",
"def is_url?\n self =~ /^#{URI::regexp}$/\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def is_url?(path)\n path.to_s =~ %r{\\Ahttps?://}\n end",
"def valid_feed_url?\n true if find_feed_locally(@url) || fetch_feed\n rescue StandardError\n false\n end",
"def check_url_validation\n errors.add(:url, I18n.t('url_not_proper')) unless UrlShort.is_valid? (url)\n end",
"def invalid_uri?(uri)\n uri.grep(/^(#{PROTOCOLS.join('|')}):\\/\\/\\w/).empty?\n end",
"def url?(url)\n url = begin\n URI.parse(url)\n rescue StandardError\n false\n end\n url.is_a?(URI::HTTP) || url.is_a?(URI::HTTPS)\n end",
"def url?\n !url.nil?\n end",
"def validate_url\r\n url = @hostname\r\n #puts \"DEBUG: url: \" + url\r\n \r\n url_part = []\r\n url_parts = url.split('.') \r\n #puts \"DEBUG: url_parts[0]: \" + url_parts[0]\r\n \r\n if url_parts[0].is_a? Numeric \r\n validate_sub_url(url_parts[0])\r\n validate_sub_url(url_parts[1])\r\n validate_sub_url(url_parts[2])\r\n validate_sub_url(url_parts[3])\r\n else # letters\r\n #puts \"URL just letters\"\r\n end\r\n ping_url\r\n end",
"def valid_length? \n !invalid_uri_error? && (@source_uri.length <= @valid_length)\n end",
"def url_accessibility(url)\n open(url).status.last == 'OK'\n rescue ::SocketError, Timeout::Error, Errno::ECONNREFUSED, OpenURI::HTTPError\n false\n end",
"def check(url)\n LongURL::URL.check url\n end",
"def is_valid_signed_url?(signed_url)\n uri = URI.parse(signed_url)\n parsed_query = Rack::Utils.parse_query(uri.query)\n # return true if the scheme is https, the hostname matches a known GCS host, and the query string parameters have the correct keys\n uri.scheme == 'https' && ValidationTools::GCS_HOSTNAMES.include?(uri.hostname) && parsed_query.keys == ValidationTools::SIGNED_URL_KEYS\n end",
"def domain_is_allowed?(url)\n true\n end",
"def domain_is_allowed?(url)\n true\n end",
"def validate_link_url(url)\n begin\n url if URI.parse(url).scheme\n rescue URI::InvalidURIError\n nil\n end\n end",
"def verify_uri_acessibility uri\n res = Net::HTTP.get_response URI(uri)\n res.is_a? Net::HTTPSuccess\nend",
"def valid_uri?\n !self.contentable.blank? || !self.uri_path.blank?\n end",
"def is_a_uri?(value)\n uri = URI.parse(value)\n uri.is_a?(URI::HTTP) && !uri.host.nil? && uri.host.split(\".\").size > 1\n rescue URI::InvalidURIError\n false\n end",
"def long_url_is_an_url\n errors.add(:long_url, \"This is not a valid url\") unless is_valid_url?(self.long_url_with_protocol)\n end",
"def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end",
"def absolute_url?(string); end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(SSH_REGEXP).nil?\n return true\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n false\n end",
"def valid?\n value.present? && uri.present?\n end",
"def http_url\n errors[:url] << 'not a valid url' unless URI.parse(url).kind_of?(URI::HTTP)\n rescue URI::InvalidURIError\n errors[:url] << 'not a valid url'\n end",
"def url?(link)\n true if link =~ /\\Ahttps?:\\/\\//\nend",
"def verify_url(url_to_check)\n uri =\n begin\n URI.parse(url_to_check)\n rescue StandardError\n nil\n end\n\n if uri.nil? || uri.host.nil?\n raise AhaService::InvalidUrlError, \"URL is empty or invalid\"\n end\n\n if (verified = @@verified_urls[uri.host]) == false\n raise AhaService::InvalidUrlError, \"Invalid local address #{uri.host}\"\n elsif verified\n return url_to_check\n end\n\n ip_to_check = IPSocket::getaddress(uri.host)\n @@prohibited_addresses.each do |addr|\n if addr === ip_to_check\n @@verified_urls[uri.host] = false\n raise AhaService::InvalidUrlError, \"Invalid local address #{uri.host}\"\n end\n end\n\n @@verified_urls[uri.host] = true\n url_to_check\n end",
"def url?(url)\n assert_type(url, String) # This includes Wgit::Url's.\n hash = { 'url' => url }\n @client[:urls].find(hash).any?\n end",
"def url?\n result = url\n result && \"#{result}?#{File.mtime(path).to_i}\"\n rescue Errno::ENOENT\n result\n end",
"def valid?(uri)\n uri ||= default_uri\n\n uri.host = @default_host if uri.host.nil?\n\n real_domain = domain =~ /^\\./ ? domain[1..-1] : domain\n !!((!secure? || (secure? && uri.scheme == 'https')) &&\n uri.host =~ Regexp.new(\"#{'^' if @exact_domain_match}#{Regexp.escape(real_domain)}$\", Regexp::IGNORECASE))\n end",
"def is_url?( path )\n path =~ URI::ABS_URI\nend",
"def url_filled?\n !url.blank?\n end"
] |
[
"0.86343783",
"0.847988",
"0.84224933",
"0.8402104",
"0.8364294",
"0.8290405",
"0.82689095",
"0.82582146",
"0.82582146",
"0.82582146",
"0.82320714",
"0.82320714",
"0.82320714",
"0.82189757",
"0.8213499",
"0.8208009",
"0.81927603",
"0.8192227",
"0.8188528",
"0.81696975",
"0.8150813",
"0.81369966",
"0.813519",
"0.8128045",
"0.81045604",
"0.81031275",
"0.8071753",
"0.80334955",
"0.80145",
"0.80060995",
"0.79951197",
"0.79259384",
"0.7855345",
"0.7845563",
"0.78316045",
"0.7820367",
"0.7798042",
"0.77666754",
"0.7747315",
"0.7733605",
"0.7702409",
"0.76596034",
"0.764885",
"0.7645928",
"0.7619953",
"0.76016396",
"0.7580038",
"0.7556423",
"0.7550162",
"0.75063616",
"0.7486314",
"0.74658287",
"0.7460157",
"0.74269825",
"0.7399085",
"0.73881674",
"0.73643184",
"0.73579574",
"0.7311234",
"0.73039365",
"0.72858673",
"0.72824323",
"0.72786",
"0.72596705",
"0.7238562",
"0.72293043",
"0.7218154",
"0.7214789",
"0.7205902",
"0.7192657",
"0.71842986",
"0.7182944",
"0.7167363",
"0.71257114",
"0.7124221",
"0.7109045",
"0.7067999",
"0.7041292",
"0.7034938",
"0.70296717",
"0.7004366",
"0.7004366",
"0.70010257",
"0.6986918",
"0.69715625",
"0.69708395",
"0.6945227",
"0.69381416",
"0.6937839",
"0.6937762",
"0.6926816",
"0.6926728",
"0.6911244",
"0.6883404",
"0.6844614",
"0.6843959",
"0.6839403",
"0.68389606",
"0.6834981",
"0.68348885"
] |
0.7334312
|
58
|
Set video_id for a given regexp and index of match result
|
def parse_video_id_for_regexp_and_index(regexp, index)
match_result = self.url.match(regexp)
return match_result[index] if !!match_result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_video_id_for_vimeo\n parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)\n end",
"def parse_video_id_for_youtube\n parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def video_id(url)\n url.scan(/\\?v=(.{11})|youtu.be\\/(.{11})/)[0].find {|e| not e.nil?}\n end",
"def inc_match\n @matchedCount += 1\n end",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9]*)(\\.html)*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9_=\\-]+)(\\.html)?.*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def match_in_id(regex)\n return nil if course_id.blank?\n match = course_id.match(regex)\n match ? match[1] : nil\n end",
"def youtube_id\n rexp = /v=(.*)/ or /embed\\/(.*)/\n rexp.match(url).captures.first\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def avId\n begin\n /\\/video\\/av(\\d+)/.match(self.link)[1]\n rescue\n ''\n end\n end",
"def match=(_); end",
"def update!(**args)\n @id_matcher = args[:id_matcher] if args.key?(:id_matcher)\n end",
"def parse_youtube_id(url)\n url =~ /[v]=([^&]*)/\n id = $1\n \n if id.nil?\n # when there is no match for v=blah, then maybe they just \n # provided us with the ID the way the system used to work... \n # just \"E4Fbk52Mk1w\"\n return url \n else\n # else we got a match for an id and we can return that ID...\n return id\n end\n end",
"def regexp=(_arg0); end",
"def video_regex\n @attributes[:video_regex]\n end",
"def match parser, index\r\n raise \"Must override match\"\r\n end",
"def set_match\n\t\t@matched = true\n\tend",
"def parse_id(li)\n li.at_css('a')['href'].match(%r{fandango\\.com(/|%2f).*_(?<id>\\d+)(/|%2f)movietimes})[:id]\n end",
"def match(p0) end",
"def match(p0) end",
"def update_index_pattern(params, id, space_id = \"\")\n update_saved_object(params, \"index-pattern\", id, space_id)\n end",
"def match(regexp); end",
"def adapter_match(match)\n @log.debug \"ADAPTER! #{match.string}\"\n key = 'id'\n value = match[:value]\n adapter_line!(LSIArray::Adapter.new,key,value)\n end",
"def show_id(input)\n index = /\\d/.match(input)\n index = index.to_s.to_i + 1 - 1\n pp find(index)\nend",
"def set_video\n @video = Video.find_by id: params[:id]\n end",
"def get_youtube_video_id(url)\n # find id\n result = url.match /https*\\:\\/\\/.*youtube\\.com\\/watch\\?v=(.*)/\n # return id or nil\n result ? result[1] : nil\n end",
"def on_match_pattern(node); end",
"def video_id\n values[:video_id]\n end",
"def rewrite(pattern)\r\n if match = pattern.match(result)\r\n start = match.begin(0)\r\n target.pos = start\r\n target.truncate start\r\n end\r\n \r\n block_given? ? yield(match) : match\r\n end",
"def set_match\n @match = Match.find params[:id]\n end",
"def show_youtube\n @youtube = YoutubeMovie.find(params[:id])\n s = @youtube.url.index(\"?v=\")\n e = @youtube.url.index(\"&\")\n @id = @youtube.url[s+3..e-1] rescue 1\n end",
"def next_match_title\n \"Match#{next_match_number}\"\n end",
"def find_vimeo_id url\n url = sanitize url\n matches = VIMEO_REGEX.match url.to_str\n matches[2] if matches\n end",
"def match(pattern); end",
"def set_video\n @video = Video.find_by(id: params[:id], user_id: get_user_id)\n end",
"def post_match() end",
"def youtube_embed(youtube_url)\n\t # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n\t youtube_url.to_s[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n\t youtube_id = $5\n\t youtube_id\n\tend",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def submatcher; end",
"def submatcher; end",
"def set_video\n \n @video = Video.find(params[:id])\n \n end",
"def match_index(lines, regexp)\n index = 0\n lines.each do |line|\n return index if line =~ regexp\n index += 1\n end\n nil\n end",
"def extract_vimeo_id(vimeo_embed_code)\n extract_vimeo_source(vimeo_embed_code)\n .match(/video\\/(\\d+)$/)[1].to_s\n end",
"def parse_first_movie_id(doc)\n link = doc.at_css('#rw3 h4 a')\n link['href'].match(/movie_id=(?<movie_id>\\d+)/)[:movie_id]\n end",
"def set_player_id(output)\n player_id = output[-3].to_i\n @player_id = player_id\n rescue\n @player_id = 1\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end"
] |
[
"0.6204636",
"0.6068198",
"0.59581155",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55665135",
"0.55393314",
"0.5427567",
"0.54152787",
"0.53871983",
"0.5354115",
"0.5343699",
"0.523123",
"0.5214084",
"0.5203008",
"0.5164026",
"0.5155969",
"0.5152062",
"0.5101148",
"0.5090843",
"0.50834656",
"0.5082708",
"0.50472575",
"0.50463927",
"0.5029376",
"0.5029376",
"0.50221545",
"0.5015968",
"0.49751455",
"0.49430925",
"0.49336565",
"0.4931111",
"0.49246836",
"0.4917893",
"0.4915101",
"0.4911559",
"0.489427",
"0.48921847",
"0.48775184",
"0.48563746",
"0.48391625",
"0.48329666",
"0.48116916",
"0.48113927",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.4810271",
"0.48028016",
"0.48028016",
"0.48028016",
"0.48028016",
"0.48028016",
"0.48000145",
"0.48000145",
"0.4786404",
"0.4780294",
"0.4769668",
"0.47645012",
"0.47602844",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144",
"0.47545144"
] |
0.7568799
|
0
|
Parse the youtube video_id and set it in self
|
def parse_video_id_for_youtube
parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def youtube_video_id\t\t\n\t\tif self.video_url.nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.video_url.rpartition('/').last\n\t\tend\n\n\tend",
"def set_youtube_video\n\t\t\t@youtube_video = YoutubeVideo.find(params[:id])\n\t\tend",
"def set_youtube_video_annotation\n\t\t\t@youtube_video_annotation = YoutubeVideoAnnotation.find(params[:id])\n\t\tend",
"def parse_youtube_id(url)\n url =~ /[v]=([^&]*)/\n id = $1\n \n if id.nil?\n # when there is no match for v=blah, then maybe they just \n # provided us with the ID the way the system used to work... \n # just \"E4Fbk52Mk1w\"\n return url \n else\n # else we got a match for an id and we can return that ID...\n return id\n end\n end",
"def youtube_id\n rexp = /v=(.*)/ or /embed\\/(.*)/\n rexp.match(url).captures.first\n end",
"def youtube_embed(youtube_url)\n\t # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n\t youtube_url.to_s[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n\t youtube_id = $5\n\t youtube_id\n\tend",
"def youtube_embed(youtube_url)\n if youtube_url[/youtu\\.be\\/([^\\?]*)/]\n youtube_id = $1\n else\n # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n youtube_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n youtube_id = $5\n end\n end",
"def get_youtube_video_id(url)\n # find id\n result = url.match /https*\\:\\/\\/.*youtube\\.com\\/watch\\?v=(.*)/\n # return id or nil\n result ? result[1] : nil\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def extractYouTubeID(url)\n YoutubeVideoId.extract(url)\n end",
"def update\n\n\n @video = Video.find(params[:id])\n\n\n @url = params[:video][:url]\n\n require 'uri'\n\n\n if(@url.downcase.include? 'youtube.com')\n ##create ways to catch if user is using \n query_string = URI.parse(params[:video][:url]).query\n parameters = Hash[URI.decode_www_form(query_string)]\n puts parameters['v'] # => aNdMiIAlK0g\n video_id = parameters['v']\n elsif (@url.downcase.include? 'y2u.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n puts params[:video][:url] = @url \n elsif (@url.downcase.include? 'youtu.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n puts params[:video][:url] = @url\n end\n \n \n\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video.youtube_id = video_id # => aNdMiIAlK0g\n\n this_video = @yt_client.video_by(video_id)\n\n\n @video.duration = this_video.duration \n\n\n\n\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def video_id\n values[:video_id]\n end",
"def set_youtube_playlist\n @youtube_playlist = YoutubePlaylist.find(params[:id])\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def show_youtube\n @youtube = YoutubeMovie.find(params[:id])\n s = @youtube.url.index(\"?v=\")\n e = @youtube.url.index(\"&\")\n @id = @youtube.url[s+3..e-1] rescue 1\n end",
"def extract_id_from_youtube_url\n if self.youtube_url.present?\n url = self.youtube_url\n self.external_id = Youtube.id_from_url(url) if url.present?\n self.errors.add(:youtube_url, 'is not a valid Youtube URL') unless self.external_id.present?\n else\n true\n end\n end",
"def create\n @video = current_user.videos.build(params[:video])\n\n @url = params[:video][:url]\n\n\n require 'uri'\n\n\n if(@url.downcase.include? 'youtube.com')\n ##create ways to catch if user is using \n query_string = URI.parse(params[:video][:url]).query\n parameters = Hash[URI.decode_www_form(query_string)]\n puts parameters['v'] # => aNdMiIAlK0g\n video_id = parameters['v']\n elsif (@url.downcase.include? 'y2u.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n @video.url = @url \n elsif (@url.downcase.include? 'youtu.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n @video.url = @url\n end\n \n \n\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video.youtube_id = video_id # => aNdMiIAlK0g\n\n this_video = @yt_client.video_by(video_id)\n\n\n @video.duration = this_video.duration \n\n\n\n respond_to do |format|\n if @video.save ##and video is over 60 seconds in duration \n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_youtube_item\n @youtube_item = YoutubeItem.find(params[:id])\n end",
"def set_youtubechannel\n @youtubechannel = Youtubechannel.find(params[:id])\n end",
"def youtube_id\n\t\tif youtube?\n\t\t\treturn path[\"stoffi:track:youtube:\".length .. -1]\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend",
"def youtube\n download = HTTParty.get(\"https://gdata.youtube.com/feeds/api/videos?q=#{URI.escape(@track)}\")\n if !download.body.empty?\n doc = Nokogiri::HTML(download.body)\n vids = doc.xpath('//link[contains(@href, \"https://www.youtube.com/watch\")]').to_a\n video = vids.first\n # Extracting the Video-ID\n if video\n query_string = URI.parse(video['href']).query\n Hash[URI.decode_www_form(query_string)]\n else\n \"Can't find a decent YouTube mirror.\"\n end\n else\n flash[:notice] = 'Error with Youtube! Try again in 30 seconds!'\n end\n end",
"def set_youtube_channel\n @youtube_channel = YoutubeChannel.find(params[:id])\n end",
"def youtube_id(youtube_url)\n regex = %r{(?:youtube(?:-nocookie)?\\.com/(?:[^/\\n\\s]+/\\S+/|(?:v|e(?:mbed)?)/|\\S*?[?&]v=)|youtu\\.be/)([a-zA-Z0-9_-]{11})}\n match = regex.match(youtube_url)\n match[1] if match\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def youtube_embed(youtube_url)\r\n\tif youtube_url[/youtu\\.be\\/([^\\?*)/]\r\n\t\tyoutube_id = $1\r\n\telse \r\n\t# Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\r\n\t\tyoutube_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\r\n\t\tyoutube_id = $5 \r\n\tend\r\n\t#Look into a different method for this \r\n\t%Q{<iframe title=\"YouTube video player\" width=\"600px\" height=450px\" src=\"http://www.youtube.com/embed/#{ youtube_id }\" frameborder=\"0\" allowfullscreen></iframe>}\r\n end",
"def youtube_embed(youtube_url)\n if youtube_url[/youtu\\.be\\/([^\\?]*)/]\n youtube_id = $1\n else\n # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n youtube_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n youtube_id = $5\n end\n %Q{<iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/#{ youtube_id }\" frameborder=\"0\" allowfullscreen></iframe>}\n end",
"def youtube_embed(youtube_url)\n if youtube_url[/youtu\\.be\\/([^\\?]*)/]\n youtube_id = $1\n else\n # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n youtube_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n youtube_id = $5\n end\n %Q{<iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/#{ youtube_id }\" frameborder=\"0\" allowfullscreen></iframe>}\n end",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def youtube_embed(youtube_url)\n if youtube_url[/youtu\\.be\\/([^\\?]*)/]\n youtube_id = $1\n else\n # Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367\n youtube_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v?=?([^\\&\\?]*).*/]\n youtube_id = $5\n end\n\n %Q{<iframe id=\"player\" type=\"text/html\" width=\"640\" height=\"390\"\n src=\"//www.youtube.com/embed/#{youtube_id}?enablejsapi=1&origin=*\" frameborder=\"0\"></iframe>}\n end",
"def youtube_url\n \"https://www.youtube.com/watch?v=#{@data['youtubeID']}\" if @data['youtubeID']\n end",
"def youtube_embed_url\n VideoInfo.new(self.video_url).embed_url if self.video_url?\n end",
"def set_youtube_setup\n\t\t\t@youtube_setup = YoutubeSetup.find(params[:id])\n\t\tend",
"def video_by(video)\n vid = nil\n vid_regex = /(?:youtube.com|youtu.be).*(?:\\/|v=)([\\w-]+)/\n if video =~ vid_regex\n vid = $1\n else\n vid = video\n end\n video_id =\"http://gdata.youtube.com/feeds/api/videos/#{vid}?v=2#{@dev_key ? '&key='+@dev_key : ''}\"\n parser = YouTubeIt::Parser::VideoFeedParser.new(video_id)\n parser.parse\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def youtube_video_params\n\t\t\tparams[:youtube_video][:youtube_video_id] = nil if params[:youtube_video] && params[:youtube_video][:youtube_video_id].try(:strip).blank?\n\t\t\tparams.require(:youtube_video).permit!\n\t\tend",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def video_id(url)\n url.scan(/\\?v=(.{11})|youtu.be\\/(.{11})/)[0].find {|e| not e.nil?}\n end",
"def get_id\n url = \"https://www.youtube.com/results?search_query=#{@artist_name.gsub(\" \",\"+\")}+#{@song_name.gsub(\" \",\"+\")}\"\n#pp url\n web_page = HTTParty.get(url)\n\n @parsed = Nokogiri::HTML(web_page)\n ref = @parsed.css(\"a\").collect{|link| link[\"href\"]}.select{|href| href && href.include?(\"/watch?v=\")}.uniq[0]\n return ref.gsub(\"/watch?v=\", \"\") unless !ref\n end",
"def set_video\n @video = Video.find_by(id: params[:id], user_id: get_user_id)\n end",
"def parse_video_id_for_vimeo\n parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)\n end",
"def video_url\n \"http://video.ted.com/#{videoID}\"\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video_comment\n @video_comment = VideoComment.find(params[:id])\n end",
"def youtube_code\n code = self.link.match(/v=(.*)/)\n code.captures.first\n end",
"def id\n case self.service\n when :youtube then parse_video_id_for_youtube\n when :vimeo then parse_video_id_for_vimeo\n end\n end",
"def set_video\n @video = @user.videos.find(params[:id])\n end",
"def set_video\n\t @video = Video.find(params[:id])\n\tend",
"def video_by(vid)\n video_id = vid =~ /^http/ ? vid : \"http://gdata.youtube.com/feeds/api/videos/#{vid}\"\n parser = YouTubeG::Parser::VideoFeedParser.new(video_id)\n parser.parse \n end",
"def set_video\n @video = Video.find_by id: params[:id]\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end"
] |
[
"0.84349173",
"0.77813375",
"0.77654135",
"0.7209885",
"0.7189224",
"0.7165815",
"0.71282816",
"0.7084522",
"0.7032639",
"0.69501424",
"0.6938494",
"0.6924599",
"0.68363214",
"0.68337727",
"0.6763516",
"0.67557114",
"0.671982",
"0.6702886",
"0.6670562",
"0.66660714",
"0.66604656",
"0.6651831",
"0.66412514",
"0.6640659",
"0.66045743",
"0.6595432",
"0.6558176",
"0.6558176",
"0.6542608",
"0.6528202",
"0.651184",
"0.6494426",
"0.64774376",
"0.6460879",
"0.6458845",
"0.6438755",
"0.63975394",
"0.63975394",
"0.63975394",
"0.63975394",
"0.63975394",
"0.63652885",
"0.6362572",
"0.63144815",
"0.6307823",
"0.62961715",
"0.6270425",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62699085",
"0.62693703",
"0.62341136",
"0.6212424",
"0.6184254",
"0.61744475",
"0.61613774",
"0.61360157",
"0.6134841",
"0.6134841",
"0.6134841"
] |
0.82028997
|
1
|
Parse the vimeo video_id and set it in self
|
def parse_video_id_for_vimeo
parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def initialize id, vimeo\n @thumbs = []\n @comments = []\n @id = id\n @vimeo = vimeo\n\n url = vimeo.generate_url({\"method\" => \"vimeo.videos.getInfo\",\n \"video_id\" => id, \"api_key\" => vimeo.api_key}, \"read\")\n\n xml_doc = @vimeo.get_xml(url)\n\n return @id = -1 if parse_xml(xml_doc).nil?\n end",
"def extract_vimeo_id(vimeo_embed_code)\n extract_vimeo_source(vimeo_embed_code)\n .match(/video\\/(\\d+)$/)[1].to_s\n end",
"def video_id\n values[:video_id]\n end",
"def vimeo_url(video_id)\n\t\t\"https://player.vimeo.com/video/#{video_id}\"\n\tend",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_VideoID(value)\n set_input(\"VideoID\", value)\n end",
"def set_video\n @video = Video.find_by(id: params[:id], user_id: get_user_id)\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def parse_video_id_for_youtube\n parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)\n end",
"def set_video\n @video = @user.videos.find(params[:id])\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def set_video\n @video = Video.find_by id: params[:id]\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9_=\\-]+)(\\.html)?.*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def set_video\n @video = Video.find(params[:id])\n\n end",
"def set_video\n\t @video = Video.find(params[:id])\n\tend",
"def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9]*)(\\.html)*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end",
"def set_video_comment\n @video_comment = VideoComment.find(params[:id])\n end",
"def set_video\n \n @video = Video.find(params[:id])\n \n end",
"def id\n case self.service\n when :youtube then parse_video_id_for_youtube\n when :vimeo then parse_video_id_for_vimeo\n end\n end",
"def find_vimeo_id url\n url = sanitize url\n matches = VIMEO_REGEX.match url.to_str\n matches[2] if matches\n end",
"def set_video\n @video = params[:id] ? Video.find(params[:id]) : Video.new(video_params)\n end",
"def set_video_post\n @video_post = VideoPost.find(params[:id])\n end",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def set_video_clip\n @video_clip = VideoClip.find_by_token(params[:id])\n end",
"def vimeo_details\n return nil if self.vimeo_id.blank?\n response = Video.vimeo_client.get_info(self.vimeo_id)\n return !response['video'].blank? ? response['video'].first : nil\n end",
"def vimeo_embed(vimeo_url)\r\n\tif vimeo_url[/vimeo\\.com\\/([^\\?]*)/]\r\n\t\tvimeo_id = $1\r\n\telse \r\n\t\tvimeo_url[/^.*((v\\/)|(embed\\/)|(watch\\?))\\??v=?([^\\&\\?]*).*/]\r\n\t\tvimeo_id = $5\r\n\tend\r\n\t#Hate using Iframes but might get that kink out in a few drafts of the website\r\n\t%Q{<iframe title=\"Vimeo video player\" width=\"600px\" height=\"450px\" height=\"auto\" src=\"\\/\\/player.vimeo.com\\?#{ vimeo_id }\" frameborder=\"0\" allowfullscreen></iframe>}\r\n end",
"def set_game_video\n @game_video = GameVideo.find(params[:id])\n end",
"def set_video_upload\n @video_upload = VideoUpload.find(params[:id])\n end",
"def update(id, params = {})\n vimeo_video = Vimeo::Advanced::Video.new(@api_key, @api_secret, @token_hash)\n\n return unless id\n puts \"Vimeo: Updating #{id}\"\n\n vimeo_video.set_description(id, params[:description]) if params[:description]\n vimeo_video.set_title(id, params[:title]) if params[:title]\n vimeo_video.clear_tags(id) if params[:tags]\n vimeo_video.add_tags(id, params[:tags]) if params[:tags]\n rescue exception_block\n end",
"def video_id(url)\n url.scan(/\\?v=(.{11})|youtu.be\\/(.{11})/)[0].find {|e| not e.nil?}\n end",
"def set_videogame\n @videogame = Videogame.find(params[:id])\n end",
"def set_videogame\n @videogame = Videogame.find(params[:id])\n end",
"def avId\n begin\n /\\/video\\/av(\\d+)/.match(self.link)[1]\n rescue\n ''\n end\n end",
"def parse_youtube_id(url)\n url =~ /[v]=([^&]*)/\n id = $1\n \n if id.nil?\n # when there is no match for v=blah, then maybe they just \n # provided us with the ID the way the system used to work... \n # just \"E4Fbk52Mk1w\"\n return url \n else\n # else we got a match for an id and we can return that ID...\n return id\n end\n end",
"def set_video_intitucional\n @video_intitucional = VideoIntitucional.find(params[:id])\n end",
"def vimeo_tag(url, opts = {})\n # extract vimeo_id thing\n# m = url.match(/(?<=\\/)\\d{2,}(?=$|\\/)/)\n# vimeo_id = m.present? ? m[0] : url\n vimeo_id = 36820781\n # \"https://player.vimeo.com/video/999999\"\n embed_url = \"//player.vimeo.com/video/#{vimeo_id}\"\n\n content_tag(:iframe, \"\", :src => embed_url,\n :frameborder => opts[:frameborder],\n :allowfullscreen => true,\n :width => opts[:width] || \"600\",\n :height => opts[:height] || \"480\"\n )\nend",
"def set_video_ad\n @video_ad = VideoAd.find(params[:id])\n end",
"def complete\n @video_id = vimeo.complete(id, filename)\n end",
"def set_video_card\n @video_card = VideoCard.find(params[:id])\n end",
"def get_video_id_from_response_body(response_body)\n doc = Nokogiri::XML(response_body)\n doc.css('vzaar-api video').first.content\n end",
"def set_video_adv\n @video_adv = VideoAdv.find(params[:id])\n end",
"def set_banner_video\n @banner_video = BannerVideo.find(params[:id])\n end",
"def video_id_public\n if video\n video.id_public\n end\n end",
"def youtube_video_id\t\t\n\t\tif self.video_url.nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.video_url.rpartition('/').last\n\t\tend\n\n\tend",
"def set_youtube_video\n\t\t\t@youtube_video = YoutubeVideo.find(params[:id])\n\t\tend",
"def set_RelatedToVideoID(value)\n set_input(\"RelatedToVideoID\", value)\n end",
"def new\n \n @pin = current_user.pins.new()\n @pin.description = params[:description]\n @pin.thumb_url = params[:media]\n regExp = /http:\\/\\/(www\\.)?vimeo.com\\/(\\d+)($|\\/)/\n if params[:description] \n if params[:yt_video_id]\n @pin.yt_video_id = params[:yt_video_id]\n else\n youtube_url = params[:url]\n match = youtube_url.match(regExp)\n if !match\n if youtube_url.match(/youtu\\.be\\/([^\\?]*)/)\n @pin.yt_video_id = youtube_url.match(/youtu\\.be\\/([^\\?]*)/)[1]\n else\n if youtube_url.match(/v=([^&]*)/)\n @pin.yt_video_id = youtube_url.match(/v=([^&]*)/)[1]\n @pin.site_id = \"1\"\n else\n \n @pin.yt_video_id = youtube_url.gsub('www','embed')\n @pin.site_id = \"3\"\n \n \n end\n end\n else\n @pin.yt_video_id = match[2]\n \n @pin.site_id = \"2\"\n\n end\n end\n @hidden = 'true'\n end\n \n\n \n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end",
"def video\n\t\tVideo.find(self.video_id)\n\tend"
] |
[
"0.84515035",
"0.72542953",
"0.70958865",
"0.69669414",
"0.67937887",
"0.67703974",
"0.66919595",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6631221",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.65250707",
"0.651426",
"0.6498499",
"0.649433",
"0.6486185",
"0.6462836",
"0.6462836",
"0.6462836",
"0.64487725",
"0.643599",
"0.6435359",
"0.6425059",
"0.6424337",
"0.63841563",
"0.63619816",
"0.63592064",
"0.6357564",
"0.6325672",
"0.6296397",
"0.6290554",
"0.6238507",
"0.6223125",
"0.6187893",
"0.6183926",
"0.61770916",
"0.6176518",
"0.61720324",
"0.61720324",
"0.60855865",
"0.60672176",
"0.60621965",
"0.6047522",
"0.60384196",
"0.60318893",
"0.6021877",
"0.600897",
"0.5992835",
"0.5975132",
"0.59696656",
"0.5938941",
"0.5865475",
"0.58631694",
"0.58223355",
"0.5810733"
] |
0.8058369
|
1
|
used by the task "bagel:db:sync_permissions"
|
def permission_scheme
# Get the permission scheme class variable
class_variables.include?('@@permission_scheme') ? class_variable_get(:@@permission_scheme) : {}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permissions = {}",
"def restore_permissions; end",
"def restore_permissions; end",
"def permissions_policy(&block); end",
"def paranoid_permissions\n true\n end",
"def setup_database_permissions(connection_string, db_name)\n # We tack on a space at the end to help regex matches\n connection_string += \" \"\n\n db_admin_user = connection_string.match db_string_regex('user')\n db_admin_user = db_admin_user[1]\n\n db_admin_password = connection_string.match db_string_regex('password')\n db_admin_password = db_admin_password[1]\n\n grant_sql = <<-SQL\n GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_admin_user}@localhost IDENTIFIED BY '#{db_admin_password}';\n SQL\n\n run \"#{connection_string} --execute=\\\"#{grant_sql}\\\"\"\nend",
"def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end",
"def restore_permissions=(_arg0); end",
"def restore_permissions=(_arg0); end",
"def delete_extinct_permissions\n db_perms = ::Permission.find(:all).dup\n db_perms.each do |dbp|\n unless @permissions.include?(Lockdown.get_symbol(dbp.name))\n Lockdown.logger.info \">> Lockdown: Permission no longer in init.rb: #{dbp.name}, deleting.\"\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if \"permissions\" < ug_table\n join_table = \"permissions_#{ug_table}\"\n else\n join_table = \"#{ug_table}_permissions\"\n end\n Lockdown.database_execute(\"delete from #{join_table} where permission_id = #{dbp.id}\")\n dbp.destroy\n end\n end\n end",
"def set_default_permissions!\n # Always allow to read the id\n let :read, :id\n # These shouldn't change after the first save.\n let :write, [ :id, :created_at ], :if => :new?\n # These can always change.\n let :write, :updated_at\n end",
"def load_permissions\n authorize! :manage, :all\n end",
"def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">> Lockdown: Permission not found in db: #{str}, creating.\"\n ::Permission.create(:name => str)\n end\n end\n end",
"def apply_superuser_permissions(permission_types)\n []\n end",
"def update_permissions\n self.view_permission.update_attribute(:name, name + \" view\")\n self.signup_permission.update_attribute(:name, name + \" signup\")\n self.admin_permission.update_attribute(:name, name + \" admin\")\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def flush_permissions!\n @permissions = load_permissions\n end",
"def assign_permission\n company_admin,*company_admin_all = Role.company_admin.reorder(\"id ASC\")\n functions = company_admin.try(:function_ids) \n if company_admin_all.any?\n company_admin_all.each do |c_admin|\n c_admin.function_ids = functions\n end\n end\n end",
"def set_permissions\n return if @permissions_set\n\n @permissions_set = true\n resource[:configure_permission] ||= configure_permission\n resource[:read_permission] ||= read_permission\n resource[:write_permission] ||= write_permission\n rabbitmqctl(\n 'set_permissions',\n '-p', should_vhost,\n should_user,\n resource[:configure_permission],\n resource[:write_permission],\n resource[:read_permission]\n )\n end",
"def save_permission_keys\n if @permission_keys and Array === @permission_keys\n self.permission_users(true).clear\n\n @permission_keys = @permission_keys.uniq - self.role.permission_keys\n\n @permission_keys.each do |key|\n permission = ::Permission[key]\n\n if permission\n self.permission_users.create({\n :permission_id => permission.id,\n :user_id => self.id\n }, :without_protection => true)\n end\n end\n\n @permission_keys = nil\n @user_permission_keys = nil\n\n self.permissions(true).collect(&:key)\n end\n end",
"def bulk_create \t\n \tauthorize! :manage, :all #checking authorization who are having all permissions\n\n \tif params[\"permissions\"].present?\n \t\tresource_id = params[\"permissions\"][\"resource_id\"]\n \t\tresource_type = params[\"permissions\"][\"resource_type\"]\n \t\tif resource_id.present? && resource_type.present?\n\t \t\t#Checking model permissions and creating model permissions \n\t \t\tif params[\"permissions\"][\"1\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"1\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tvalue.each do |sub|\n\t \t\t\t\t\tsub_values = sub.split('_')\n\t \t\t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>1,:subject_class=>sub_values[0]).first_or_initialize\t\t \t\t\t\n\t\t \t\t\t\tpermission[:status] = sub_values[1]\n\t\t \t\t\t\tpermission[:actions_list] = []\n\t\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\t \t\t\t\t\n\t\t \t\t\t\tpermission.save\n\t \t\t\t\tend\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\t#Checking controller permissions and creating controller permissions\n\t \t\tif params[\"permissions\"][\"0\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"0\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>false).first_or_initialize\t \t\t\t\t\t\t\t\n\t \t\t\t\tpermission[:actions_list] = value.reject(&:empty?).map{|x| x.to_sym }\n\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\n\t \t\t\t\tpermission.save\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\tflash[:notice] = \"Groups permissions successfully saved\"\n\t \t\tredirect_to_back_or_default\n\t \telse\n\t \t\tflash[:error] = \"permissions not saved , Please fill required fields\"\n \t\t\tredirect_to_back_or_default\n\t \tend\n \telse\n \t\tflash[:error] = \"permissions not saved\"\n \t\tredirect_to_back_or_default\n \tend\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def change_permissions(where)\n logger.info \"Changing permissions in #{where} for:\"\n r = execute_query(\n %Q{\n xquery version \"1.0-ml\";\n\n let $new-permissions := (\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"read\"),\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"update\"),\n xdmp:permission(\"#{@properties[\"ml.app-name\"]}-role\", \"execute\")\n )\n\n let $uris :=\n if (fn:contains(xdmp:database-name(xdmp:database()), \"content\")) then\n\n (: This is to make sure all alert files are accessible :)\n cts:uri-match(\"*alert*\")\n\n else\n\n (: This is to make sure all triggers, schemas, modules and REST extensions are accessible :)\n cts:uris()\n\n let $fixes := \n for $uri in $uris\n let $existing-permissions := xdmp:document-get-permissions($uri)\n \n (: Only apply new permissions if really necessary (gives better logging too):)\n where not(ends-with($uri, \"/\"))\n and count($existing-permissions[fn:string(.) = $new-permissions/fn:string(.)]) ne 3\n \n return (\n \" \" || $uri,\n xdmp:document-set-permissions($uri, $new-permissions)\n )\n return\n if ($fixes) then\n $fixes\n else\n \" no changes needed..\"\n },\n { :db_name => where }\n )\n r.body = parse_body r.body\n logger.info r.body\n logger.info \"\"\n end",
"def apply_privileges(app_name=nil)\n return if credentials(app_name).nil?\n if is_postgresql()\n cmd_acl=\"GRANT CREATE ON SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL TABLES IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL FUNCTIONS IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL SEQUENCES IN SCHEMA PUBLIC TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO PUBLIC;\"\n# shell(cmd_acl,true)\n \n # reset the owner of the functions to the current user\n # when there is a 'privileged' app.\n app_name ||= @wrapped['director']['bound_app'] if @wrapped['director']\n if app_name\n cmd_select_fcts=\"SELECT pg_proc.proname FROM pg_catalog.pg_proc WHERE \\\n pg_proc.pronamespace=(SELECT pg_namespace.oid FROM pg_catalog.pg_namespace WHERE pg_namespace.nspname = 'public') \\\n AND pg_proc.proowner!=(SELECT oid FROM pg_roles WHERE rolname = 'postgres')\"\n current_owner=credentials()['username']\n unless current_owner\n STDERR.puts \"The application #{app_name} is not bound to the data-service #{name}; not applying the database privileges.\"\n return\n end\n fcts_name=shell(cmd_select_fcts,true,true)\n if fcts_name.empty?\n puts \"No need to re-assign the ownership of the functions in #{credentials()['name']}; the DB does not define its own functions.\" if VMC::Cli::Config.trace\n else\n fcts = fcts_name.split(\"\\n\").collect do |line|\n line.strip!\n \"'#{line}'\"\n end.join(',')\n cmd_change_fcts_owner=\"UPDATE pg_catalog.pg_proc \\\n SET proowner = (SELECT oid FROM pg_roles WHERE rolname = '#{current_owner}')\\\n WHERE pg_proc.proname IN (#{fcts})\"\n puts `sudo -u postgres psql --dbname #{credentials()['name']} -c \\\"#{cmd_change_fcts_owner}\\\" #{PSQL_RAW_RES_ARGS}`\n end\n end\n end\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_database_permissions \\\n instance_id, database_id, permissions\n grpc.permissions\n end",
"def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = Array(permissions).flatten\n ensure_service!\n grpc = service.test_database_permissions \\\n instance_id, database_id, permissions\n grpc.permissions\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def run_syncdb\n manage_py_execute('syncdb', '--noinput') if new_resource.syncdb\n end",
"def build_permissions!\n #Deployment keys will keep the permissions even with non active projects\n @rewind_deploy = get_deploy_identifier(@rewind_deploy_keys)\n @read_deploy = get_deploy_identifier(@read_deploy_keys)\n\n if @project.active?\n @rewind = get_identifier(@rewind_users)\n @write = get_identifier(@write_users)\n @read = get_identifier(@read_users)\n active_project_gitolite_access\n else\n all_read = @rewind_users + @write_users + @read_users\n @read = get_identifier(all_read)\n @read << 'REDMINE_CLOSED_PROJECT' if @read.empty? && @read_deploy.empty?\n end\n\n convert_to_gitolite_format\n end",
"def migrate_permissions_for(object)\n # Find any access controls for this work. The must be sufia6F style in order to not show up on the Work.\n legacy_access_controls = access_controls_for object\n puts \"#{legacy_access_controls.count} AccessControls for #{object.class}: #{object.id}\"\n puts \"#{object.permissions}\"\n\n # Create equivalent access controls\n self.class.make_equivalent_permissions( object, legacy_access_controls )\n puts \"Created equivalent permissions.\"\n puts \"#{object.permissions}\"\n\n # Destroy legacy_access_controls\n if object.save\n puts \"Able to save #{object.class} with new permissions. Destroying old access controls.\"\n legacy_access_controls.each{ |ac| ac.destroy }\n else\n puts \"Unable to save #{object.class}.\"\n end\n end",
"def grant_permissions( force_reload = false )\n permissions( force_reload ).select( &:is_grant? )\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end",
"def state_permission(permission); end",
"def grant_write_access(db, service)\n name = service.name\n db_connection = postgresql_connect(@postgresql_config[\"host\"],@postgresql_config[\"user\"],@postgresql_config[\"pass\"],@postgresql_config[\"port\"],name)\n service.bindusers.all.each do |binduser|\n user = binduser.user\n sys_user = binduser.sys_user\n sys_password = binduser.sys_password\n db_connection_sys_user = postgresql_connect(@postgresql_config[\"host\"],sys_user,sys_password,@postgresql_config[\"port\"],name)\n db_connection_sys_user.query(\"vacuum full\")\n db_connection_sys_user.close\n do_grant_query(db_connection,user,sys_user)\n end\n db_connection.query(\"grant create on schema public to public\")\n if get_postgres_version(db_connection) == '9'\n db_connection.query(\"grant all on all tables in schema public to public\")\n db_connection.query(\"grant all on all sequences in schema public to public\")\n db_connection.query(\"grant all on all functions in schema public to public\")\n else\n querys = db_connection.query(\"select 'grant all on '||tablename||' to public;' as query_to_do from pg_tables where schemaname = 'public'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n querys = db_connection.query(\"select 'grant all on sequence '||relname||' to public;' as query_to_do from pg_class where relkind = 'S'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n end\n db_connection.close\n service.quota_exceeded = false\n service.save\n rescue => e\n @logger.warn(\"PostgreSQL Node exception: #{e}\\n\" +\n e.backtrace.join(\"\\n\"))\n end",
"def enforce_permissions\n bounce unless is_admin?\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def manager_permissions\n can :manage_collection, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage_collection, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage_collection, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n\n can :manage, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n end",
"def api_perms\n ident = :api\n text = 'API Permissions'\n desc = 'All permissions that have to do with the API.'\n options = [:true, :false, :flow]\n def_option = :flow\n\n api_global = write_permission_group(ident, text, desc, options, def_option)\n\n ActiveRecord::Base.descendants.each do |m|\n next unless m.included_modules.include?(GraphQL::QLModel)\n root = write_permission_group(hashify(m), m.to_s, 'Actions corresponding to ' + m.to_s.pluralize, options, def_option)\n\n see = write_permission_group(:see, 'Viewable Fields', 'Regulate which fields of this model a user can see.', options, def_option)\n\n m.graph_fields.each do |f|\n g = write_permission(\"View #{f}\", \"Allow the user to see #{f}.\", hashify(f), options, def_option)\n g.add_to_group(see)\n end\n\n see.add_to_group(root)\n\n find_by = write_permission_group(:query, 'Query By', 'Regulate which fields of this model a user query by.', options, def_option)\n\n m.graph_finders.each do |f|\n finder = write_permission(\"Query by #{f}\", \"Allow the user to query by #{f}.\", hashify(f), options, def_option)\n finder.add_to_group(find_by)\n end\n\n find_by.add_to_group(root)\n\n root.add_to_group(api_global)\n end\n\n mutations = write_permission_group(:mutations, 'Mutations', 'Regulate which mutations a user can perform.', options, def_option)\n\n AvicusSchema.types.each do |f|\n f.each do |a|\n next unless a.is_a?(GraphQL::ObjectType) && a.name.include?('Payload')\n mut = a.name.gsub('Payload', '')\n write_permission(\"Execute #{mut}\", \"Allow the user to execute the #{mut} mutation.\", hashify(mut), options, def_option).add_to_group(mutations)\n end\n end\n\n mutations.add_to_group(api_global)\n\n global_options = {\n text: text,\n desc: desc,\n options: options,\n def_option: def_option\n }\n\n PermissionsGenerator.new('API', true, global_options, api_global, [])\nend",
"def update_permissions_if_vcs_changed\n return unless saved_change_to_vcs_submit?\n Repository.get_class.update_permissions\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"def project_permissions\n user.project_permissions(rule.project)\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions_cache_key\n \"#{self.cache_key}/permissions\"\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def set_acl_statement\n super\n end",
"def smart?; self.permission_level = 2; end",
"def add_group_permission(g)\n\t\t\n\tend",
"def enforce_delete_permissions\n enforce_edit_permissions\n end",
"def add_perms_to_user (user, perms)\n perms.each { |v|\n exec_sql \"INSERT INTO u_apis_perms(u_api_id, u_perm_id) VALUES('#{user}', '#{v}')\"\n }\nend",
"def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def afterCreate\n Server.all.each do |server|\n UserPermission.create(user:self,server:server)\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:create], Collection\n can [:discover], Hydra::AccessControls::Embargo\n can [:discover], Hydra::AccessControls::Lease\n can [:create], [ CurationConcerns.config.curation_concerns ]\n can [:destroy], ActiveFedora::Base\n can [:permissions], [ CurationConcerns.config.curation_concerns ]\n end\n\n # Limits deleting objects to a the admin user\n #\n #if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n #end\n\n if current_user.has_role?('collection.manager')\n # can [:create, :show, :index, :edit, :update, :destroy], Collection\n can [:create], Collection\n end\n\n if current_user.has_role?('collection.depositor') or current_user.has_group_role?('collection.depositor')\n # can [:create, :show, :index, :edit, :update, :destroy], [ CurationConcerns.configuration.curation_concerns ]\n can [:create], [ CurationConcerns.config.curation_concerns ]\n # can [:show], Collection\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def handle_grant_permission\n return if cbac_permission_exists?\n\n permission = Cbac::Permission.new\n permission.privilege_set = privilege_set\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission.context_role = pristine_role.name\n else\n generic_role = Cbac::GenericRole.where(name: pristine_role.name).first\n permission.generic_role = generic_role || Cbac::GenericRole.where(name: pristine_role.name, remarks: \"Autogenerated by Cbac loading / upgrade system\").create\n end\n\n register_change if permission.save\n permission\n end",
"def index\n @group_repo_permissions = GroupRepoPermission.all\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def prepare_permissions\n if current_ability.admin?\n else\n # Need to add admin group to current_ability\n # or presenter will not be accessible.\n current_ability.user_groups << \"admin\"\n if presenter.tombstone.present? \n else\n current_ability.user_groups.delete(\"admin\")\n end\n end\n end",
"def update?\n @current_user.permission('Bid', :clerk)\n end",
"def create_permissions\n # initial_step is a controller action on some resources for creation...\n if user_groups.include?(HYHULL_USER_GROUPS[:content_creator]) || \n user_groups.include?(HYHULL_USER_GROUPS[:content_access_team]) || \n @current_user.admin?\n can [:initial_step, :create], :all\n end\n\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end",
"def add_user_permission(u)\n\t\t\n\tend",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def set_permissions\n self.permissions ||= \"guest\"\n end",
"def test_database_checks()\n\t\tcurrentmode = File.stat(@databasefile).mode\n\t\tCfruby::FileOps.chmod(@databasefile, 0700)\n\t\tassert_not_equal(currentmode, File.stat(@databasefile).mode)\n\t\tassert_raise(Cfruby::Checksum::ChecksumPermissionError) {\n\t\t\t@checksum.update_all\n\t\t}\n\t\tCfruby::FileOps.chmod(@databasefile, 0600)\n\t\t\n\t\tif(Process.euid() == 0)\n\t\t\tassert_raise(Cfruby::Checksum::ChecksumOwnershipError) {\n\t\t\t\tCfruby::FileOps.chown(@databasefile, 200, 200)\n\t\t\t\t@checksum.update_all\n\t\t\t}\n\t\tend\n\tend",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def permitted?; end",
"def admin_permissions\n can [:manage], :all\n end",
"def admin_permissions\n can [:manage], :all\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def permissions\n User.do_find_permissions session_id: kb_session_id\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def set_perms\n self.perms = Access.for_user(self)\n end",
"def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end",
"def overall_permissions(thing)\n global_permissions.merge!(permissions_for(thing))\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def update_permissions\n self.admin_permission.update_attribute(:name, name + \" dept admin\")\n end",
"def update_board_permissions\n @board = Board.find(params[:board_id])\n @us = User.find_by_login(params[:user][:login]) \n @ac = params[:level]\n #debugger\n @board.allow!( @us, @ac.to_sym )\n end",
"def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end",
"def check_permissions\n require_privilege(Privilege::USE, @environment)\n end",
"def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end",
"def can_modify_guidance?\n perms.include? Perm.modify_guidance\n end",
"def set_permission(name)\n @permission_objects[name] = Lockdown::Permission.new(name)\n end",
"def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end",
"def test_backup_permissions instance_id, cluster_id, backup_id, permissions\n tables.test_iam_permissions resource: backup_path(instance_id, cluster_id, backup_id),\n permissions: permissions\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def deny_all_access\n @permissions = 0\n end"
] |
[
"0.6796348",
"0.6758666",
"0.6758666",
"0.64878273",
"0.6230523",
"0.6175326",
"0.61568564",
"0.6143687",
"0.6143256",
"0.61308044",
"0.61078167",
"0.6088955",
"0.60830015",
"0.6065093",
"0.60535914",
"0.60429484",
"0.5961229",
"0.5929393",
"0.5891205",
"0.58892226",
"0.58635646",
"0.58626753",
"0.58626753",
"0.5857357",
"0.58525795",
"0.5852302",
"0.5851227",
"0.5850154",
"0.58398026",
"0.5832926",
"0.5810441",
"0.57861334",
"0.575778",
"0.57121",
"0.56773615",
"0.5675718",
"0.56721646",
"0.5663751",
"0.5661978",
"0.5661978",
"0.5661978",
"0.56611556",
"0.56440145",
"0.56174845",
"0.56019133",
"0.56012934",
"0.559492",
"0.5590855",
"0.5590855",
"0.55798185",
"0.55790186",
"0.556948",
"0.5557989",
"0.55549276",
"0.55492115",
"0.55439633",
"0.55433965",
"0.5542915",
"0.553809",
"0.5537904",
"0.55359733",
"0.55334204",
"0.5523017",
"0.5522383",
"0.5522298",
"0.5522298",
"0.55215615",
"0.5521105",
"0.5520149",
"0.5502202",
"0.5491943",
"0.5489362",
"0.54821813",
"0.54806834",
"0.5476601",
"0.5472465",
"0.5462209",
"0.5461068",
"0.5461068",
"0.54451805",
"0.5437585",
"0.54313457",
"0.5424734",
"0.54231286",
"0.5414622",
"0.5414622",
"0.5409998",
"0.54069674",
"0.5404627",
"0.54039943",
"0.54025835",
"0.5396505",
"0.5382811",
"0.53680134",
"0.53641844",
"0.53641844",
"0.5361214",
"0.5360606",
"0.53583896",
"0.5350924",
"0.53454983"
] |
0.0
|
-1
|
try to pass method to the data variable
|
def method_missing(method, *args, &block)
if self.data.respond_to?(method)
typecast(self.data.send(method,*args,&block))
elsif self.data.is_a?(Hash) && self.data.key?(method.to_s)
typecast(self.data[method.to_s])
else
super
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def method_missing(method, *args, &block)\n data.send(method, *args, &block)\n end",
"def data_to_method(data)\n raise \"No safe methods defined!\" unless @safe_methods.size > 0\n @safe_methods.each do |method|\n if data['mode'] == method.to_s\n self.send(data['mode'], data)\n end\n end\n end",
"def method_missing(method_name, *args, &block)\n @data.key?(method_name.to_s) ? @data[method_name.to_s] : super\n end",
"def method_missing(meth, *args, &block)\n if data.respond_to?(meth)\n return data.send(meth, *args, &block)\n else\n super\n end\n end",
"def method_missing(meth, *args, &blk) # :nodoc:\n if @data.key?(meth)\n @data[meth]\n else\n nil\n end\n end",
"def method_missing(sym, *args, &block)\n if self.data.respond_to?(sym)\n return self.data.send(sym, *args, &block)\n end\n\n super\n end",
"def call(data)\n object.send(method, data)\n end",
"def method_missing(method, *args)\n return super if args.length > 1 or block_given?\n if args.length == 0\n return super unless data.has_key?(method)\n get method\n else\n set method, args[0]\n end\n end",
"def do_data(data); end",
"def method_missing msg, *args, &block\n if data.respond_to?(msg)\n data.__send__(msg, *args, &block)\n else\n super(msg, *args, &block)\n end\n end",
"def load(data)\n raise NoMethodError, \"#{__method__} not defined for #{self.class.name}\"\n end",
"def callback_method(key) #:nodoc:\r\n data_key = key.gsub('_','-') # data fields translate _ to -\r\n cb = case\r\n when params['data'] && params['data'][data_key] then params['data'][data_key]\r\n# if dc_ + key method is present in model then it will be called automatically \r\n when respond_to?('dc_' + key) then 'dc_' + key\r\n when params[key] then params[key]\r\n else nil\r\n end\r\n# \r\n ret = case\r\n when cb.nil? then cb # otherwise there will be errors in next lines\r\n when cb.match('eval ') then cb.sub('eval ','')\r\n when cb.match('return_to ')\r\n params[:return_to] = cb.sub('return_to ','')\r\n return nil\r\n else cb\r\n end\r\n ret\r\nend",
"def method_missing(method, *args) # {{{\n return @data[method.to_sym] if @data[method.to_sym]\n end",
"def perform_action(data); end",
"def method_missing(name, *args, &block)\n @data.send(name, *args, &block)\n end",
"def method_missing(method_sym, *args, &block)\n super unless value_data.keys.include? method_sym\n\n process_value(value_data[method_sym], *args, &block)\n end",
"def data\n @data ||= @_data.respond_to?(:call) ? @_data.call() : @_data\n end",
"def data_delegator(key)\n define_method(key.to_sym) { @obj.data[key] }\n end",
"def process(data, object)\n data[:function].blank? ? object.to_s : send(data[:function].to_sym, object.to_s)\n end",
"def run_with_data( data )\n fail \"Implement #run_with_data in #{self.class.name}.\"\n end",
"def method_missing m, *a\n @data.send(m, *a)\n end",
"def method_missing(meth, *args, &block)\n if meth.to_s == '[]'\n @data.fetch(args[0])\n else\n @data.fetch(meth.to_s)\n end\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method_missing(name, *args, &block)\n if caller.first !~ /`(method_missing|data')/ && data.keys.include?(name.to_s)\n self.class.class_eval <<-CODE, __FILE__, __LINE__\n def #{name}; data[#{name.inspect}]; end\n CODE\n data[name.to_s]\n else # no key matches or caught infinite loop\n super\n end\n end",
"def run_method\n send_method(method, value)\n end",
"def data(*args); end",
"def execute(data)\n data.respond_to?(option.first) ? data.send(*option) : data\n end",
"def customize_with_data(data: nil)\n not_implemented(__method__)\n end",
"def call\n data\n end",
"def run_method\n send_method(method, @value)\n end",
"def respond_to?(method)\n @data.key?(method.to_s) || super\n end",
"def respond_to?(method)\n @data_source.respond_to?(\"get_#{method}_info\") || super\n end",
"def use_as_method\n @method = true\n end",
"def method_missing( method, *args )\n @data[ method ] || ( @rating ? @rating[ method.to_s ] : nil )\n end",
"def process_data\n raise NotImplementedError\n end",
"def method_missing(method_id, *arguments, &block)\n return data['attributes'][method_id.to_s] if data['attributes'].key?(method_id.to_s) && arguments.none? && block.nil?\n\n super\n end",
"def respond_to?(method)\n @data_source.respond_to? \"get_#{method}_info\" || super\n end",
"def get_card_data method\n get_card.send(method) rescue nil\n end",
"def method_missing(key)\n @data.key?(key.to_s) ? @data[key.to_s] : super\n end",
"def callback_method(key) #:nodoc:\r\n data_key = key.gsub('_', '-') # convert _ to -\r\n callback = case\r\n when params['data'] && params['data'][data_key] then params['data'][data_key]\r\n # dc_ + key method is present then call it automatically\r\n when @form.dig('permissions', key) then @form['permissions'][key]\r\n when respond_to?('dc_' + key) then 'dc_' + key\r\n when respond_to?(key) then key\r\n when params[data_key] then params[data_key]\r\n else nil\r\n end\r\n\r\n ret = case\r\n when callback.nil? then callback # otherwise there will be errors in next lines\r\n when callback.match('eval ') then callback.sub('eval ','')\r\n when callback.match('return_to ')\r\n params[:return_to] = callback.sub('return_to ','')\r\n return nil\r\n else callback\r\n end\r\n ret\r\nend",
"def method_missing(method_sym, *arguments, &block)\n if self[\"#{method_sym.to_s}\"] != nil\n self[\"#{method_sym.to_s}\"]\n else\n super\n end\n end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def method\n\t\t# code code\n\tend",
"def method_missing(method, *args, &block)\n value = \n if information.is_a?(Array)\n information.first[method]\n else\n information[method]\n end\n\n if value.nil?\n super\n else\n value\n end\n end",
"def method_missing(method)\n\t\t self[method]\n\t\tend",
"def GameData2JSON(this, is_not, a_method)\n raise 'Don\\'t call that'\nend",
"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 method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end",
"def processing_instruction(data)\n end",
"def method_missing(method, params={})\n call(method, params)\n end",
"def prepare_data(method_binding, data)\n\n raise NilDataSuppliedError, 'No method_binding supplied for prepare_data' unless method_binding\n\n @original_data = data\n\n begin\n model_method = method_binding.model_method\n\n if(data.is_a?(ActiveRecord::Relation)) # Rails 4 - query no longer returns an array\n @value = data.to_a\n\n elsif(data.class.ancestors.include?(ActiveRecord::Base) || data.is_a?(Array))\n @value = data\n\n elsif(!DataShift::Guards.jruby? &&\n (data.is_a?(Spreadsheet::Formula) || data.class.ancestors.include?(Spreadsheet::Formula)) )\n\n @value = data.value # TOFIX jruby/apache poi equivalent ?\n\n elsif( model_method.can_cast? && model_method.cast_type.is_a?(ActiveRecord::Type::Boolean))\n\n # DEPRECATION WARNING: You attempted to assign a value which is not explicitly `true` or `false` (\"0.00\")\n # to a boolean column. Currently this value casts to `false`.\n # This will change to match Ruby's semantics, and will cast to `true` in Rails 5.\n # If you would like to maintain the current behavior, you should explicitly handle the values you would like cast to `false`.\n\n @value = if(data.in? [true, false])\n data\n else\n data.to_s.casecmp('true').zero? || data.to_s.to_i == 1 ? true : false\n end\n else\n @value = data.to_s.dup\n\n @attribute_hash = @value.slice!( Populator.attribute_hash_const_regexp )\n\n if attribute_hash.present?\n @attribute_hash = Populator.string_to_hash( attribute_hash )\n logger.info \"Populator found attribute hash :[#{attribute_hash.inspect}]\"\n else\n @attribute_hash = {}\n end\n end\n\n run_transforms(method_binding)\n rescue StandardError => e\n logger.error(e.message)\n logger.error(\"Populator stacktrace: #{e.backtrace.first}\")\n raise DataProcessingError, \"Populator failed to prepare data [#{value}] for #{method_binding.pp}\"\n end\n\n [value, attribute_hash]\n end",
"def method_missing(meth, *args) = parameters.has_key?(meth) ? parameters[meth] : meth",
"def perform(action, data = T.unsafe(nil)); end",
"def method_missing(name, *args)\n return @data[name.to_s] if @data.key? name.to_s\n super\n end",
"def call() end",
"def method_missing(meth, *args, &block)\n @value.send meth, *args, &block\n end",
"def instantiate!\n @data.map! { |i| i.respond_to?(:call) ? i.call : i }\n end",
"def method=(value)\n @method = value\n end",
"def method(p0) end",
"def _call_of(method)\n proc{ |*args| send(method, *args) }\n end",
"def method\n @method\n end",
"def method\n @method\n end",
"def bar(data)\n\tend",
"def method_missing(m, *args, &block)\n @data[m]\n end",
"def method_missing(method, *args)\n if self.respond_to?(method)\n super\n else\n method_name = method.to_s\n \n #set a value for a variable\n if method_name =~ /=$/\n var_name = method_name.gsub('=', '')\n value = args.first\n self[var_name] = value\n \n #retrieve a value\n else\n self[method_name]\n end\n end\n end",
"def data= data \n end",
"def method\n @method\n end",
"def to_data value\n if @to_data.nil?\n raise NoMethodError, \"#to_data not defined\"\n end\n \n @to_data.call value\n end",
"def invoke; end",
"def method_missing(input)\n\t\tself.checkMethod(input.to_s)\n\tend",
"def method_missing(method, *args)\n method = method.to_s\n if method.end_with? \"=\"\n @data[method.gsub(/=$/, \"\").to_sym] = args.first\n else\n @data[method.to_sym]\n end\n end",
"def try_helper(method, obj)\n if obj.respond_to?(method)\n obj.send(method)\n end\n end",
"def get_data()\t\n\tend",
"def method_missing(call)\n object.send(call)\n end",
"def methods() end"
] |
[
"0.7222773",
"0.681826",
"0.6801701",
"0.67775375",
"0.6767386",
"0.6766182",
"0.66884875",
"0.668479",
"0.6679737",
"0.66701275",
"0.6492078",
"0.6476859",
"0.63866854",
"0.63578206",
"0.6346368",
"0.6326291",
"0.631829",
"0.6311496",
"0.6288878",
"0.620792",
"0.6206238",
"0.61701876",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60962594",
"0.60909253",
"0.6089319",
"0.6080274",
"0.6070091",
"0.60613394",
"0.6040304",
"0.60367984",
"0.6007129",
"0.6005285",
"0.5995967",
"0.5978639",
"0.5976963",
"0.5976912",
"0.59697855",
"0.5953973",
"0.59460676",
"0.5939697",
"0.59280205",
"0.5920658",
"0.5920658",
"0.5920658",
"0.5920658",
"0.58943653",
"0.5890561",
"0.58812445",
"0.58644253",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5857573",
"0.5837771",
"0.5829733",
"0.58045053",
"0.57943696",
"0.57858396",
"0.5760672",
"0.5745027",
"0.5734634",
"0.57292897",
"0.5721442",
"0.5718411",
"0.5717372",
"0.5709861",
"0.57048905",
"0.57048905",
"0.5704163",
"0.5704123",
"0.5703125",
"0.5700886",
"0.56889015",
"0.56612873",
"0.56610173",
"0.5641345",
"0.5639842",
"0.56223",
"0.56194806",
"0.5612389",
"0.561222"
] |
0.67951
|
3
|
Fetches and scores gems then prints result
|
def call
timer do
fetch_gems_data
GemsBond::Printers::HTML.new(gems).call
GemsBond::Printers::CSV.new(gems).call
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def run\n process_args\n announcements\n results = get_gem_list_info.map {|gem| gem.join(\",\")}.join(\"\\n\")\n IO.write(@output, results)\n end",
"def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def display_results\n @score = 0\n @questions.each do |number, question|\n puts \"\"\n puts \"Question #{number}: #{question}\"\n puts \"\"\n puts \"Your answer: #{@user_answers[number]}\"\n gets\n puts \"Actual answer: #{@actual_answers[number]}\"\n puts \"\"\n score_rescue\n puts \"\"\n end\n end",
"def call\n if gem.exist?\n gem.prepare_data(keys: PRELOAD_KEYS, concurrency: false)\n GemsBond::Printers::Stdout.new(gem).call\n else\n puts \"Sorry, this gem could not be found!\"\n end\n end",
"def read_scores\n end",
"def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end",
"def get_score(user, module_name)\n url = \"https://forgeapi.puppetlabs.com/private/validations/#{user}-#{module_name}\"\n response = Typhoeus.get(url).body\n\n meta_data = JSON.parse response\n\n meta_data[-1]['score'] / 20.0\nend",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def output\n\t\tputs \"Our favorite language is #{@gemlove}. We think #{@gemlove} is better than #{@gemhate}.\"\n\tend",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def sorted_gems\n # sort with putting gems without average_score at the end\n @gems.sort do |a, b|\n if a.average_score && b.average_score\n a.average_score <=> b.average_score\n else\n a.average_score ? -1 : 1\n end\n end\n end",
"def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end",
"def print_scores\n puts \"+--------------+\"\n @players.each do |player|\n puts \"| Player #{player.player_number} : #{player.lives} |\"\n end\n puts \"+--------------+\"\n end",
"def score(prog); @scores[prog]; end",
"def prefetch gems\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def collection_loop(github_num, rubygem_num)\n client = create_client()\n if USE_GOOGLE_DRIVE\n google_session = GoogleDrive::Session.from_config(GOOGLE_DRIVE_API_CONFIG)\n type_folder = ensure_google_type_folder(google_session)\n end\n ensure_data_folder\n ensure_program_log_file\n apps_hash = File.file?(TYPE_DATA_JSON_FILE) ? JSON.parse(File.read(TYPE_DATA_JSON_FILE)): {}\n file_hashes = {}\n app_num = 0\n\n\n File.open(ERROR_LOG, \"w\") { |f| f.puts(\"ERRORS\") }\n \n\n ## get list of github repos to download\n gh_list = get_github_list(client, github_num)\n\n # get list of rubygems repos to download\n rg_list = get_rubygems_list(rubygem_num)\n\n # combine them into a single program list\n prog_list = (gh_list + rg_list).uniq { |r| r[:name] }\n\n ## HACK: RAILS_GEMS are all included in rails already, similar with aws-sdk gems. Drop these from prog_list.\n prog_list.delete_if { |r| RAILS_GEMS.include?(r[:name]) || r[:name].start_with?(\"aws-sdk\") || r[:name].start_with?(\"sys-proctable\") } \n\n prog_list.each { |r|\n puts \"Working on app ##{app_num}...\"\n ## HACK... have to look into these cases separately \n next if [\"libv8\", \"facter\", \"sixarm_ruby_unaccent\"].include?(r[:name])\n \n if File.directory?(\"#{DATA_DIR}/#{r[:name]}\")\n ## if data already exists for this program, then just load that data and update it.\n \n ## below commented out line uses existing json file\n #meths_hash = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{TYPE_DATA_JSON_FILE}\"))\n puts \"Found .yardoc file for app #{r[:name]}. Loading...\"\n load_yard_doc(\"#{DATA_DIR}/#{r[:name]}/.yardoc\")\n #prog_log = load_prog_log(\"#{DATA_DIR}/#{r[:name]}/log.csv\")\n app_file_hashes = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{FILE_MD5_HASHES}\"))\n file_hashes.merge!(app_file_hashes) { |k, v1, v2| v1 | v2 }\n\n ## get all YARD method data\n meths = YARD::Registry.all(:method)\n\n ## extract the data we want\n meths_hash = get_yard_meths(meths)\n\n ## store the method data in the app data (if there is any method data)\n apps_hash[r[:name]] = meths_hash if !meths_hash.empty?\n else\n ## if data doesn't already exist, generate and save it.\n \n #commit_sha = client.commits(r[:full_name], r[:default_branch])[0][:sha]\n #prog_log = [r[:name], r[:name].hash, r[:html_url], r[:default_branch], commit_sha, Time.now.getutc.to_s, \"\", \"\"]\n prog_log = get_prog_log(r)\n \n download_prog(r)\n Dir.chdir(r[:dir_name])\n\n app_file_hashes = {}\n \n ## YARD stuff here\n meth_files = []\n generate_yard_doc\n meths = YARD::Registry.all(:method)\n meths_hash = get_yard_meths(meths, meth_files)\n\n ## save to apps_hash, program log\n if !meths_hash.empty?\n apps_hash[r[:name]] = meths_hash\n CSV.open(\"../#{LOG_FILE}\", \"a+\") { |csv|\n csv << prog_log\n }\n end\n\n ## collect MD5 hashes of all files in program\n meth_files.each do |f|\n next if f.nil? || !File.file?(f)\n key = Digest::MD5.hexdigest(IO.read(f))\n ## add file hash to both this app's hashes, and overall hashes\n if app_file_hashes.has_key?(key) then app_file_hashes[key].push(f) else app_file_hashes[key] = [f] end\n if file_hashes.has_key?(key) then file_hashes[key].push(f) else file_hashes[key] = [f] end\n end\n\n \n ## save app data files, and upload compressed app to google drive\n Dir.chdir(\"..\")\n save_app_data(r[:name], meths_hash, prog_log, app_file_hashes)\n compress_and_upload(type_folder, r[:dir_name]) if USE_GOOGLE_DRIVE\n cleanup(r[:dir_name])\n end\n app_num += 1\n }\n\n ## write type data\n File.open(TYPE_DATA_JSON_FILE,\"w\") do |f|\n f.write(JSON.pretty_generate(apps_hash))\n end\n\n ## write file hashes\n File.open(FILE_MD5_HASHES, \"w\") do |f|\n f.write(JSON.pretty_generate(file_hashes))\n end\n\n return [apps_hash, file_hashes]\nend",
"def run\n welcome\n input = get_input\n url = build_url(input)\n books_array = make_request(url)\n books = get_books(books_array)\n final_book_array = collect_book_info(books)\n display_books(final_book_array)\n binding.pry\nend",
"def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend",
"def upsert_top_100_gems\n page_number = 1\n while page_number <= 10 do\n stats_page_url = @ruby_gems_base_url + \"/stats?page=#{page_number}\"\n doc = Nokogiri::HTML(open(stats_page_url))\n\n # TODO: refactor this is almost identical to pagination of all ruby gems\n doc.css('.stats__graph__gem__name a').each do |gem_link|\n @curr_gem_doc = Nokogiri::HTML(open(@ruby_gems_base_url + gem_link['href'])) # /gems/gem_name\n\n if github_url.length > 0\n if RubyGem.exists?(name: gem_name)\n RubyGem.update(name: gem_name, url: github_url, downloads: gem_downloads)\n puts \"UPDATED Gem #{gem_name}\"\n else\n # binding.pry\n RubyGem.create(name: gem_name, url: github_url, downloads: gem_downloads)\n puts \"CREATED Gem #{gem_name}.\"\n end\n else\n puts \"SKIP Gem with URL #{@ruby_gems_base_url + gem_link['href']}: no Github URL found.\"\n end\n end\n\n page_number += 1\n end\n end",
"def index\n\t\t@scores = @product.scores.all\n\tend",
"def introduction\n puts 'hello welcome to the github scrapper'.light_blue\n puts 'this tool is desgined for fetching data from github quickly and saving it to a csv file'.light_blue\nend",
"def run\n puts @usage if failed?\n puts @help if @opts[:help]\n exit if failed?\n increment\n @opts[:get] = @ghuls.get_random_user if @opts[:get].nil?\n\n user = @ghuls.get_user_and_check(@opts[:get])\n if !user\n puts 'Sorry, something wen\\'t wrong.'\n puts \"We could not find any user named #{@opts[:get]}.\"\n puts 'If you believe this is an error, please report it as a bug.'\n else\n @repos = @ghuls.get_user_repos(@opts[:get])\n @org_repos = @ghuls.get_org_repos(@opts[:get])\n language_data(user[:username])\n puts 'Getting forks, stars, and watchers of user repositories...'\n fork_data(@repos)\n puts 'Getting forks, stars, and watchers of organization repositories...'\n fork_data(@org_repos)\n follower_data(user[:username])\n issue_data(@repos)\n issue_data(@org_repos)\n calendar_data(user[:username])\n end\n exit\n end",
"def display_scores\n puts \"P1: #{@player1.lives}/3 vs P2: #{@player2.lives}/3\"\n end",
"def print_total_score\n calculate_score\n end",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end",
"def print_score\n puts \"Player Score: #{@player_score}\\tComputer Score: #{@computer_score}\"\n end",
"def display_all_scores\n show_wait_cursor(3)\n all_scores = @score_table.score_table\n say '----------------------'.yellow\n all_scores.each { |s| say 'player:' + all_scores.index(s).to_s.blue + ' score: ' + s.to_s.red }\n say '----------------------'.yellow\n end",
"def print_results\n UI.puts results_message\n end",
"def calculate_results\n Logger.info \"Probing finished. Calculating results.\"\n calculate_startup_time\n calculate_results_stalling\n calculate_results_switching\n print_results\n # TODO what to do with the results?\n end",
"def show_gems name, prerelease\n req = Gem::Requirement.default\n # TODO: deprecate for real\n dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }\n dep.prerelease = prerelease\n\n if local? then\n if prerelease and not both? then\n alert_warning \"prereleases are always shown locally\"\n end\n\n display_header 'LOCAL'\n\n specs = Gem::Specification.find_all { |s|\n s.name =~ name and req =~ s.version\n }\n\n spec_tuples = specs.map do |spec|\n [spec.name_tuple, spec]\n end\n\n output_query_results spec_tuples\n end\n\n if remote? then\n display_header 'REMOTE'\n\n fetcher = Gem::SpecFetcher.fetcher\n\n type = if options[:all]\n if options[:prerelease]\n :complete\n else\n :released\n end\n elsif options[:prerelease]\n :prerelease\n else\n :latest\n end\n\n if name.source.empty?\n spec_tuples = fetcher.detect(type) { true }\n else\n spec_tuples = fetcher.detect(type) do |name_tuple|\n name === name_tuple.name\n end\n end\n\n output_query_results spec_tuples\n end\n end",
"def show_score\n puts\n @@score.each do |player, score|\n print \"- #{player.capitalize}: #{score} -\"\n end\n puts\n end",
"def score\n puts \"\\n---PLAYER 1: #{self.players_score} -- DEALER: #{self.dealers_score}---\"\n end",
"def index\n @ruby_gems = RubyGem.all\n end",
"def index\n @scores, @scores_attached = ScoreService.list(current_user.id)\n end",
"def run\n solve(0)\n { price: @best_price, config: @best_config }\n end",
"def results; end",
"def results; end",
"def results; end",
"def update\n\t\tputs self.score_status_modif\n\t\tif self.score_status_modif\n\t\t\tputs 1\n\t\t\tcase score_status\n\t\t\t\n\t\t\t#unregistered\n\t\t\twhen SCORE_STATUS[0]\n\t\t\t\tputs 2\n\t\t\t\tself.score_component=[score_admin=Sigmoid.new,\n\t\t\t\t\t score_response=Sigmoid.new,\n\t\t\t\t\t score_connected=Sigmoid.new]\n\n\t\t\t#beginner\n\t\t\twhen SCORE_STATUS[1]\n\t\t\t\tself.score_component=[]\n\n\t\t\t#casual\n\t\t\twhen SCORE_STATUS[2]\n\t\t\t\tself.score_component=[]\n\n\t\t\t#master\n\t\t\twhen SCORE_STATUS[3]\n\t\t\t\tself.score_component=[]\t\t\t\t\n\t\t\tend\n\t\t\tself.score_status_modif=false\n\t\tend\t\t\t\t\t\n\t\tcompute\n\tend",
"def print_grades\n @learn_grades.each do |grade|\n puts grade.which_course?.foreground(:yellow) + \": \".foreground(:yellow)\n puts grade.summary\n end\n end",
"def rockPaperScissors\n sleep(2)\n puts \"Well that was a bit easy\"\n sleep(1)\n puts \"Let's increase her intelligence just a little\"\n sleep(2)\n puts \"ai.intelligence = 30\"\n bar = TTY::ProgressBar.new(\"Initializing [:bar]\", total: 50)\n 50.times do\n sleep(0.02)\n bar.advance # by default increases by 1\n end\n sleep(1)\n puts \"Intelligence now equals 30\".colorize(:magenta)\n sleep(2)\n puts \"Great, now lets test it with a game of Rock, Paper, Scissors\"\n sleep(2)\n puts \"AI initialize a game of Rock, Paper, Scissors\"\n sleep(1)\n rps = TTY::ProgressBar.new(\"Initializing [:bar]\", total: 50)\n 50.times do\n sleep(0.02)\n rps.advance # by default increases by 1\n end\n end",
"def print_results\n Report::print(@result_set)\n end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def run\n solve\n { price: @best_price, config: @best_config }\n end",
"def obtain_scores\n response = DYNAMODB.scan(table_name: TABLE_NAME)\n parsed_items = parse_items(response.items)\n parsed_items = parsed_items.sort_by{ |item| item['score'] }\n parsed_items.sort_by{ |item| item['date_time'] }\nend",
"def get_pack_data(pack)\n versesNeeded = check_for_verses(pack)\n\n if versesNeeded > 0\n\tputs \"Verses needed for #{pack.get_title}\"\n\turl = get_search_url(pack.verses)\n\tdata = get_search_result(url)\n\t@passages = get_passages(data)\n\n\t# print passages\n\t@passages.each_entry do |passage|\n\t verse = distill(passage)\n\t #puts verse.to_s\n\tend\n else\n\tputs \"Pack #{pack.get_title}: all verses found in MongoDB\"\n end\nend",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def summarize\n print \"# of asks: #{ask_count}\\n# of bids: #{bid_count}\\nAsk volume: #{ask_volume.to_s('F')}\\nBid volume: #{bid_volume.to_s('F')}\\n\"\n $stdout.flush\n end",
"def load_your_scores\n login_as(User.where(role_id: 1).third.name)\n expect(page).to have_content 'User: ' + User.where(role_id: 1).third.name\n\n click_link 'Assignments'\n expect(page).to have_content 'TestAssignment'\n\n click_link 'TestAssignment'\n expect(page).to have_content 'Submit or Review work for TestAssignment'\n expect(page).to have_content 'Your scores'\n expect(page).to have_content 'Alternate View'\n\n click_link 'Your scores'\n expect(page).to have_content 'Summary Report for assignment: TestAssignment'\n end",
"def leaderboard\n update_user_data\n font = font_instance\n prompt = prompt_instance\n system('clear')\n puts font.write(\"LEADERBOARD\")\n puts \"--------------------------------------------------------------------------\"\n scores = []\n $users.each do |x|\n scores << {username: x[0], score: x[2].to_i}\n end\n scores.sort_by! { |hash| hash[:score] }\n scores.reverse!\n scores.each do |x|\n puts \"#{x[:username]} SCORE: $#{x[:score]}\".colorize(:magenta)\n end\n prompt.select(\"\", show_help: :never) do |menu|\n menu.choice \"Back\".colorize(:red), -> {main_menu} \n end\nend",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def score\n raise \"repository hasn't been set!\" unless @my_repository\n\n issues ||= 0\n main_score ||= 0\n\n if @client.repository(@my_repository).has_issues?\n issues = @client.issues(@my_repository).size\n end\n\n # calculate score by adding repository size releases and\n # contributors. If contributors number is \"infinity\" then\n # use the forks number instead (thanks torvalds/linux)\n\n main_score = @repo_info[:size].to_i +\n @repo_info[:releases].to_i +\n (@repo_info[:contribs] == '∞' ?\n @repo_info[:forks].to_i : @repo_info[:contribs].to_i)\n\n if issues < main_score\n main_score -= issues\n end\n\n main_score\n end",
"def get_and_save_scores(rev_batch)\n scores_data = @ores_api.get_revision_data rev_batch.map(&:mw_rev_id)\n scores = scores_data.dig(wiki_key, 'scores') || {}\n save_scores(scores)\n end",
"def print_gamer(gamer)\n puts \"#{gamer.name} has a score of #{gamer.stats[\":score\"]}!\"\n end",
"def print_complexity_scores(filename, scores)\n critical_scores = 0\n unless @options[:dev]\n puts 'Complexity'.rjust(10) + ' | ' + 'Method name'.ljust(50)\n puts '-----------------------------------------------------------------'\n end\n scores[:per_method].each do |res|\n if res[:complexity].to_i > 60\n if (critical_scores == 0) && (@options[:dev])\n puts\n @options[:jenkins] ?\n puts(\"=== #{filename} ===\") :\n puts(\"=== #{filename} ===\".bold)\n puts 'Complexity'.rjust(10) + ' | ' + 'Method name'.ljust(50)\n puts '-------------------------------------------------------------'\n end\n critical_scores += 1\n @options[:jenkins] ?\n puts(\"#{res[:complexity].rjust(10)} | #{res[:method]}\") :\n puts(\"#{res[:complexity].rjust(10).red} | #{res[:method].red}\")\n elsif res[:complexity].to_i > 25\n if (critical_scores) == 0 && (@options[:dev])\n puts\n @options[:jenkins] ?\n puts(\"=== #{filename} ===\") :\n puts(\"=== #{filename} ===\".bold)\n puts 'Complexity'.rjust(10) + ' | ' + 'Method name'.ljust(50)\n puts '--------------------------------------------------------------'\n end\n critical_scores += 1\n @options[:jenkins] ?\n puts(\"#{res[:complexity].rjust(10)} | #{res[:method]}\") :\n puts(\"#{res[:complexity].rjust(10).yellow} | #{res[:method].yellow}\")\n else\n unless @options[:dev]\n puts \"#{res[:complexity].rjust(10)} | #{res[:method]}\"\n end\n end\n end\n unless @options[:dev]\n puts '------------------------------------------------------------------'\n puts \"#{scores[:total]}\".rjust(10) + ' | ' + 'Total'\n end\n end",
"def printscore\n puts \"綠譜平均:#{ @bas_total * 1.0 / @bas_num }\".colorize(:light_green)\n puts \"黃譜平均:#{ @adv_total * 1.0 / @adv_num }\".colorize(:light_yellow)\n puts \"紅譜平均:#{ @ext_total * 1.0 / @ext_num }\".colorize(:light_red)\n puts \"全譜面平均:#{ (@bas_total + @adv_total + @ext_total) * 1.0 / (@bas_num + @adv_num + @ext_num) }\".colorize(:light_white)\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def score\n puts \"---#{player.name.upcase}: #{player.score} -- #{dealer.name.upcase}: #{dealer.score}---\"\n end",
"def display_score\n puts \"-----#{@name}-----\"\n puts \"Score: #{@score} \"\n puts \"Lives left: #{@lives}\"\n puts \"---------------\"\n end",
"def score\n total = 0\n docs = 0\n [@classes, @modules, @methods, @constants, @attrs].each do |collection|\n collection.each do |item|\n total += 1\n docs += 1 if item\n end\n end\n return 100 if total == 0\n return ((docs.to_f / total) * 100).to_i\n end",
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def wrestler_output\n\n\t\tputs \"Name: #{self.values[:name]}\"\n\t\tputs \"Set: #{self.values[:set]}\"\n\t\tputs \"Singles Priority: #{self.values[:prioritys]}\"\n\t\tputs \"Tag Team Priority: #{self.values[:priorityt]}\"\n\t\tputs \"TT Probability: #{self.statistics[:tt_probability]}\"\n\t\tputs \"Card Rating: #{self.statistics[:total_card_rating]}\"\n\t\tputs \"OC Probability: #{self.statistics[:oc_probability]}\"\n\t\tputs \"Total Points-Per-Round: #{self.statistics[:total_card_points_per_round]}\"\n\t\tputs \"DQ Probability-Per-Round: #{self.statistics[:dq_probability_per_round]}\"\n\t\tputs \"P/A Probability-Per-Round: #{self.statistics[:pa_probability_per_round]}\"\n\t\tputs \"Submission Roll Probability-Per-Round: #{self.statistics[:sub_probability_per_round]}\"\n\t\tputs \"XX Roll Probability-Per-Round: #{self.statistics[:xx_probability_per_round]}\"\n\t\tputs \"Submission Loss Probability: #{self.points[:sub_prob]}\"\n\t\tputs \"Tag Team Save Probability: #{self.points[:tag_prob]}\"\n\t\tputs \"\\n\"\n\n\t\ttt_probability = \"%.1f\" % (self.statistics[:tt_probability] * 100) + \"%\"\n\t\tcard_rating = \"%.1f\" % self.statistics[:total_card_rating]\n\t\toc_probability = \"%.1f\" % (self.statistics[:oc_probability] * 100) + \"%\"\n\t\ttotal_card_points_per_round = \"%.3f\" % self.statistics[:total_card_points_per_round]\n\t\tdq_probability_per_round = \"%.1f\" % (self.statistics[:dq_probability_per_round] * 100) + \"%\"\n\t\tpa_probability_per_round = \"%.1f\" % (self.statistics[:pa_probability_per_round] * 100) + \"%\"\n\t\tsub_probability_per_round = \"%.1f\" % (self.statistics[:sub_probability_per_round] * 100) + \"%\"\n\t\txx_probability_per_round = \"%.1f\" % (self.statistics[:xx_probability_per_round] * 100) + \"%\"\n\t\t\n\t\tsub_prob = \"%.1f\" % (self.points[:sub_prob] * 100) + \"%\"\n\t\ttag_prob = \"%.1f\" % (self.points[:tag_prob] * 100) + \"%\"\n\n\t\tf = File.new('files/results.csv', 'a')\n\t\tf.write(\"#{self.values[:name]},#{self.values[:set]}, #{self.values[:prioritys]}, #{self.values[:priorityt]}, #{tt_probability}, #{card_rating}, #{oc_probability}, #{total_card_points_per_round}, #{dq_probability_per_round}, #{pa_probability_per_round}, #{sub_probability_per_round}, #{xx_probability_per_round}, #{sub_prob}, #{tag_prob}, \\n\")\n\t\tf.close\n\tend",
"def show_stat\n \t\tputs \"=============Statistics============\"\n \t\tputs \"Score: #{get_score}\"\n \t\tputs \"Total time: \" + \"%0.2f\" %(@end_time - @start_time + @save_time) + \" seconds\"\n \t\tputs \"Number of sets found: #{@number_of_correct}\"\n \t\tputs \"#{@number_of_hint}/#{@total_hint} hints used\"\n \tend",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end",
"def printUserSimilarity(dataDir=\"project1/src/resources/data\")\n #values = getUserSimilarityByTag(tag)\n puts \"========================================\"\n puts \"Similarity scores for all Users.\"\n puts \"========================================\"\n @docSet.getSetSimilarity(dataDir,true) \n end",
"def stats_for_grader(submissions)\n result = []\n problem_id_to_name = @assessment.problem_id_to_name\n stats = Statistics.new\n\n grader_scores = {}\n submissions.each do |submission|\n next unless submission.special_type == Submission::NORMAL\n\n submission.scores.each do |score|\n next if score.grader_id.nil?\n if grader_scores.has_key? score.grader_id\n grader_scores[score.grader_id] << score\n else\n grader_scores[score.grader_id] = [score]\n end\n end\n end\n\n grader_ids = grader_scores.keys\n print grader_scores\n def find_user(i)\n print \"\\n FIND USER I \\n\"\n print i\n if 0 == i\n return Hash[\"full_name\", \"Autograder\", \n \"id\", 0,\n \"full_name_with_email\", \"Autograder\"]\n else\n return User.find(i)\n end\n end\n graders = grader_ids.map(&method(:find_user))\n graders = graders.compact\n graders.sort! { |g1, g2| g1.full_name <=> g2.full_name }\n\n\n graders.each do |grader|\n scores = grader_scores[grader[\"id\"]]\n print \"\\n SCORES \\n\"\n print grader[:id]\n print \"\\n\"\n print scores\n\n problem_scores = {}\n @assessment.problems.each do |problem|\n problem_scores[problem.id] = []\n end\n\n scores.each do |score|\n problem_scores[score.problem_id] << score.score\n end\n\n problem_stats = []\n @assessment.problems.each do |problem|\n problem_stats << [problem.name, stats.stats(problem_scores[problem.id])]\n end\n\n result << [grader[\"full_name_with_email\"], problem_stats]\n end\n return result\n end",
"def display_scoreboard\n puts \"The score is\"\n puts \"#{@player_1_name}\"+\" #{@player_1_score}\" \n puts \"#{@player_2_name}\"+\" #{@player_2_score}\"\n puts\n end",
"def test_scores(score)\n puts \"Student scored an #{score}\"\n end",
"def main\n \n # make Resuspended Library items\n operations.make\n \n # get quantities before resuspending\n operations.each { |op| op.temporary[:pmole] = op.input(POOL).item.get(:pmole) }\n no_pmole=operations.select { |op| op.temporary[:pmole].nil? }\n if(no_pmole.any?)\n data = show {\n title \"Verify Lyopholized #{OLIGO_POOL} Quantities\"\n note \"The following libraries have no parameters specified. Please enter manually:\"\n table no_pmole.start_table\n .input_item(POOL)\n .get(:pmole, type: 'number', heading: \"Quantity (pmole)\", default: DEFAULT_PMOLE) \n .end_table\n }\n end\n operations.each { |op| \n op.input(POOL).item.associate :pmole, op.temporary[:pmole].to_f \n op.output(OUT_HIGH).item.associate :concentration, TARGET_CONC_NG_PER_UL\n op.output(OUT_LOW).item.associate :concentration, LOW_CONC_NG_PER_UL\n }\n \n # get sublib parameters\n operations.each { |op|\n min_tot=op.input(POOL).item.sample.properties.fetch(MIN_LENGTH).map {|x| x.to_f}.sum\n max_tot=op.input(POOL).item.sample.properties.fetch(MAX_LENGTH).map {|x| x.to_f}.sum\n variants_tot=op.input(POOL).item.sample.properties.fetch(VARIANTS).map {|x| x.to_f}.sum\n num_sublibs=op.input(POOL).item.sample.properties.fetch(MIN_LENGTH).length\n op.temporary[:variants]=variants_tot\n op.temporary[:length]=(0.5*(max_tot+min_tot)/num_sublibs).round\n op.temporary[:sublibs]=num_sublibs\n }\n \n # show user the info for the library BEFORE resuspending\n show {\n title \"Check #{OLIGO_POOL} Parameters before resuspension\"\n table operations.start_table\n .input_item(POOL)\n .custom_column(heading: \"Oligo Pool name\") { |op| op.input(POOL).item.sample.name }\n .custom_column(heading: \"Oligo Library ID\") { |op| op.input(POOL).item.sample.properties.fetch(\"Oligo Library ID\") }\n .custom_column(heading: \"mean length (nt)\") { |op| op.temporary[:length] }\n .custom_column(heading: \"variants\") { |op| op.temporary[:variants] }\n .custom_column(heading: \"number of sublibraries\") { |op| op.temporary[:sublibs] }\n .custom_column(heading: \"quantity (pmole)\") { |op| {content: op.temporary[:pmole], check: true} }\n .end_table\n warning \"Quantity (pmole) determines the resuspension volume!\"\n }\n \n # resuspend\n show {\n title \"Resuspend Lyopholized #{OLIGO_POOL}s\"\n check \"Spin down all lyopholized oligo pools at #{SPIN[:qty]} #{SPIN[:units]} for #{SPIN_TIME[:qty]} #{SPIN_TIME[:units]}\"\n note \"Add #{WATER[:name]} from a <b>NEW</b> aliquot directly to the lyopholized oligo pool, according to the following:\"\n table operations.start_table\n .input_item(POOL)\n .custom_column(heading: \"Oligo Pool name\") { |op| op.input(POOL).item.sample.name }\n .custom_column(heading: \"Oligo Library ID\") { |op| op.input(POOL).item.sample.properties.fetch(\"Oligo Library ID\") }\n .custom_column(heading: \"#{WATER[:name]} (#{WATER[:units]})\") { |op| \n (op.input(POOL).item.get(:pmole).to_f*op.temporary[:length]*DNA_NG_PER_NT_PER_PICOMOLE/TARGET_CONC_NG_PER_UL).round(2) }\n .output_item(OUT_HIGH) \n .end_table\n check \"Vortex well and spin down\"\n check \"Leave on bench for #{WAIT[:qty]} #{WAIT[:units]}\"\n check \"Vortex well and spin down\"\n check \"Relabel original tubes, without covering any manufacturer information, according to the final column of the table (above).\"\n }\n \n # dilute\n fac=(TARGET_CONC_NG_PER_UL.to_f/LOW_CONC_NG_PER_UL)-1\n lib_volume=(DILUTION_VOL[:qty].to_f/fac).round(2)\n show {\n title \"Dilute Resuspended #{OLIGO_POOL}s\"\n check \"Label #{operations.length} #{TUBE}s: #{operations.map{ |op| op.output(OUT_LOW).item}.to_sentence}\"\n note \"Add #{WATER[:name]} and resuspended library volumes according to the following:\"\n table operations.start_table\n .output_item(OUT_LOW)\n .custom_column(heading: \"#{WATER[:name]} (#{WATER[:units]})\") { |op| {content: DILUTION_VOL[:qty], check: true} }\n .custom_column(heading: \"Resuspended Oligo Pool\") { |op| \"#{op.output(OUT_HIGH).item}\" }\n .custom_column(heading: \"Oligo Pool volume (#{DILUTION_VOL[:units]})\") { |op| {content: lib_volume, check: true} }\n .end_table\n check \"Vortex #{TUBE}s #{operations.map{ |op| op.output(OUT_LOW).item}.to_sentence} and spin down\"\n }\n \n # create sublibraries (DNA Library **Samples**)\n tab=[]\n tab[0]=[\"#{OLIGO_POOL}\",\"#{DNA_LIB}\"]\n ind=1\n operations.each { |op| \n props=op.input(POOL).item.sample.properties\n props.fetch(NAMES).each_with_index { |name, i|\n s=Sample.find_by_name(name) # check if already created\n if(s.nil?) # create if needed\n create_DNA_Library(name, \"created #{Time.zone.now.to_date}\", PROJECT, op.plan.user.id)\n check = Sample.find_by_name(name) # check if valid Sample \n if(check.nil?) # no valid Sample created\n show { note \"Problem creating Sample #{name}, please check!\"} \n else\n tab[ind]=[op.input(POOL).item.sample.name, name]\n ind=ind+1\n end\n else\n show { note \"Sample #{name} already exists, please check!\"} \n end\n }\n }\n if(ind > 1) # have new Samples to display \n show {\n title \"DNA Library Samples Created\"\n note \"The following #{DNA_LIB} Samples were created for the #{OLIGO_POOL}s:\"\n table tab\n note \"Please check that no DNA Library Samples are missing!\"\n }\n end\n \n # delete lyopholized stuff\n operations.each { |op| \n op.input(POOL).item.mark_as_deleted\n }\n \n # store resuspended stuff \n operations.store\n \n return {}\n \n end",
"def run\n require File.expand_path(\"../#{config[:check]}\", $PROGRAM_NAME)\n\n threads.each(&:join)\n\n puts status_information unless status_information.empty?\n summarize!\n end",
"def print_allergies(score)\n puts \"Allergic to:\"\n test_by_score(score).each{|allergy| puts \"#{allergy}\"}\nend",
"def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end",
"def suggest\n \t# params[:i] is score\n #gets number of questions\n \tquestionNumber = Question.all.count\n #gets number of packages\n \tpackageNumber = GenPackage.all.count\n\n \t#3 get all package scores in an array or data set up\n \t@packageScore = []\n #gets all of the general package answer values from the datavase and create an array\n \ti = 0\n \tGenPackage.all.order(:id).each do |package|\n \t\t@packageScore << [] \t\t\n \t\tpackage.answer_values.all.order(:id).each do |score|\n \t\t\t@packageScore[i] << score.score\n \t\tend\n \t\ti += 1\n \tend \n\n \t#4 loops through package scores and answer data to create 6 scores\n \ti = 1\n \t@packageRating = []\n \t@packageScore.each do |package|\n \t\t@packageRating << 0\n \t\tk=1\n \t\tpackage.each do |score|\n \t\t\tdata = params[k.to_s.to_sym].to_i \n \t\t\trating = (score - data).abs \t\t\t\n \t\t\t@packageRating[i - 1] += rating\n \t\t\tk += 1\n \t\tend\n \t\ti += 1\n \tend\n\n #sorts through the packages and order them from least to greatest\n \t@sort = @packageRating.sort\n \t@packageOrder = []\n \tfor i in 0..(packageNumber - 1) do \n \t\t@packageOrder << @packageRating.index(@sort[i]) + 1\n #This fixes error when there is two of the same scores\n @packageRating[@packageOrder[i] - 1] = -10\n \tend\n\n #passes the results to the view\n \t@packages = []\n \t@packageOrder.each do |order|\n \t\t@packages << GenPackage.find_by_id(order)\n \tend\n \t#5 list scores from least to greatest, pass them to the view \n\n \t#6 additional view data\n \t# render text: @packageRating.inspect\n \t#render layout: 'planner_layout'\n end",
"def result\n\t\tusername = params[:username]\n\n\t begin\n\t \t@twitter = API::Twitter.tweets username\n\t rescue Exception => e\n\t \t@twitter = []\n\t end\n\n\t begin\n\t \t@github_user = API::GitHub.user username\n\t \t@github_repos = API::GitHub.repos username\n\t rescue Exception => e\n\t \t@github_user = \"\"\n\t\t @github_repos = []\n\t end\n\n\t begin\n\t \t@gems = API::RubyGems.published username\n\t rescue Exception => e\n\t \t@gems = []\n\t end\n\n\t render \"result\"\n\tend",
"def parse_gems_on_current_page(doc)\n doc.css('a.gems__gem').each do |gem_link|\n @curr_gem_doc = Nokogiri::HTML(open(@ruby_gems_base_url + gem_link['href'])) # /gems/gem_name\n\n if github_url.length > 0\n if RubyGem.exists?(name: gem_name)\n RubyGem.update(name: gem_name, url: github_url, downloads: gem_downloads)\n puts \"UPDATED Gem #{gem_name}\"\n else\n RubyGem.create(name: gem_name, url: github_url, downloads: gem_downloads)\n puts \"CREATED Gem #{gem_name}.\"\n end\n else\n puts \"SKIP Gem with URL #{@ruby_gems_base_url + gem_link['href']}: no Github URL found.\"\n end\n\n throw :upsert_limit_reached if upsert_limit_exceeded\n end\n rescue OpenURI::HTTPError => e\n # TODO: Fix logging\n puts e.message\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def score\n @answer = params[:answer]\n\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n file = open(url).read\n p file\n end",
"def load_minimal_gems\r\n end",
"def output_scores (p1, p2) \n puts \"P1: #{p1.remaining_lives} / 3 VS P2: #{p2.remaining_lives} / 3\"\n end",
"def scores\n @scores\n end",
"def testi_display_result\n\t\t\tputs testi_stats\n\t\tend",
"def run_app\n games = []\n @standings = []\n\n # load file from cli arg and parse teams and games\n # NOTE: for this exercise, if CLI argument is omitted, \n # it will load the sample file by default\n load_file.each do |line|\n game = []\n\n # get game's teams, fetch scores, and ensure team is listed in standings\n teams = line.chomp.split(\", \")\n\n teams.each do |team|\n team_stats = parse_game(team)\n add_team_to_standings(team_stats[:name])\n\n game << team_stats\n end\n\n games << game\n end\n\n # determine if tie game\n games.each do |game|\n if game.first[:score] == game.last[:score]\n its_a_tie(game)\n else\n determine_winner(game)\n end\n end\n\n # return and print winners by placement\n output_placements\nend",
"def display_results\n make\n display_best\n display_mutations unless @mutations\n end",
"def score\n @grpc.score\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def score(username)\n user = get(\"/v2/identity.json/twitter\", :screenName => username)\n puts user.inspect\n get(\"/v2/user.json/#{user[\"id\"]}/score\")\n end",
"def csv risks\n\t\t\t\trisks.order(:cvss_base_score).each do |plugin|\n\t\t\t\t\titems = Item.where(:plugin_id => plugin.id)\n\n\t\t\t\t\titems.each do |item|\n\t\t\t\t\t\thost = Host.where(:id => item.host_id).first\n\n\t\t\t\t\t\t@output.text \"#{host.ip}, #{host.fqdn}, #{host.netbios}, #{item.plugin_name}, #{plugin.risk_factor}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def update!(gems)\n Bundler.ui.warn 'Updating gems...'\n Bundler::CLI.start(['update'] + gems)\n end",
"def gem_thread(gem)\n Thread.new do\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end",
"def gems(*args)\n gems.each{|g| gem(g) }\n end",
"def compute_grade_for(reg, comments, checks, qpb)\n if rubric_preset\n preset_ids = rubric_preset.preset_comment_ids\n if comments.dig(*qpb)&.slice(*preset_ids)&.count.to_i.positive?\n rubric_preset.compute_grade_for(reg, out_of, comments, checks, qpb)\n else\n log_debug_info(reg, comments, checks, qpb) if Rails.env.development?\n points\n end\n else\n used_section = subsections.find { |s| s.send(:confirm_complete, reg, comments, checks) }\n if used_section\n used_section.compute_grade_for(reg, comments, checks, qpb)\n else\n points\n end\n end\n end",
"def result\n system(\"clear\")\n puts \"##############################\"\n puts \"# Congratulations #{@@name}! \" \n puts \"# #\"\n puts \"# You got #{@count} answers correct! #\"\n puts \"# #\"\n puts \"# Check the leaderboard #\"\n puts \"# to see if you made #\"\n puts \"# the top 10! #\"\n puts \"# #\"\n puts \"##############################\"\n any_key\n send_to_leaderboard\n send_to_file\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def each(&block)\n @all_passed = true\n rows.each do |row|\n gemfile = row.gemfile\n if row.compatible_with_ruby?(current_ruby)\n @compatible_count += 1\n\n @aliased_rubys[current_ruby] = row.ruby\n\n print_title gemfile\n gemfile_passed = Env.with_gemfile(gemfile, row, &block)\n @all_passed &= gemfile_passed\n if gemfile_passed\n @results[row] = tint('Success', COLOR_SUCCESS)\n else\n @results[row] = tint('Failed', COLOR_FAILURE)\n end\n else\n @results[row] = tint(\"Skipped\", COLOR_WARNING)\n end\n end\n print_summary\n end"
] |
[
"0.6492726",
"0.6254932",
"0.6246565",
"0.587646",
"0.57969266",
"0.56613815",
"0.55932623",
"0.5583416",
"0.5527911",
"0.55012906",
"0.5499438",
"0.54545134",
"0.54389244",
"0.5417412",
"0.53962076",
"0.53961456",
"0.5386545",
"0.5377254",
"0.5377254",
"0.5377254",
"0.5367884",
"0.5365413",
"0.5353363",
"0.53343093",
"0.5330303",
"0.53067994",
"0.52849734",
"0.52780414",
"0.52618384",
"0.5249943",
"0.5223918",
"0.5222414",
"0.5219466",
"0.51987123",
"0.51890427",
"0.5180952",
"0.51723385",
"0.51645815",
"0.5162804",
"0.51530737",
"0.5151765",
"0.5151765",
"0.5151765",
"0.5149884",
"0.51468194",
"0.5146693",
"0.51251835",
"0.5120228",
"0.51193625",
"0.51189756",
"0.51111084",
"0.51103586",
"0.51069343",
"0.51036435",
"0.50845605",
"0.50803757",
"0.50794387",
"0.50772",
"0.5075244",
"0.5066526",
"0.5062024",
"0.50571483",
"0.50538015",
"0.5053275",
"0.5051417",
"0.5047642",
"0.5043561",
"0.5041754",
"0.5031136",
"0.5029725",
"0.5028461",
"0.5022565",
"0.501999",
"0.50061345",
"0.49999297",
"0.4998587",
"0.49976948",
"0.49963897",
"0.49896145",
"0.49786764",
"0.49768227",
"0.49760035",
"0.49750426",
"0.4971849",
"0.49710625",
"0.49690095",
"0.49668795",
"0.49602777",
"0.49601424",
"0.495722",
"0.49496785",
"0.49485955",
"0.4937213",
"0.49301553",
"0.49298838",
"0.49280506",
"0.4918121",
"0.4910185",
"0.49066705",
"0.49021676"
] |
0.5837879
|
4
|
Returns number of gems
|
def gems_count
@gems_count ||= gems.count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + gemd_count_for(klass)\n end\n end",
"def gems_used\n tree = repository.repo.lookup(revision).tree\n gemfile = tree.select{|blob| blob[:name] == 'Gemfile'}.first\n return 0 if !gemfile\n blob = gemfile[:oid]\n\n content = Rugged::Blob.lookup(repository.repo,blob).content\n Ripper.sexp(content).flatten.count('gem')\n end",
"def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def missingmodulecount\n $number_of_missing_modules = @missingmodules.count().to_s\nend",
"def number_of_files\n\t\tassets.length\n\tend",
"def num_shelf\n\t\tputs \"Library has #{@shelves.length} shelves\"\n\tend",
"def plugin_count\n return plugins.length - 1; \n end",
"def total_repo_count\n repositories.length\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def versions_count\n @ram_versions.size\n end",
"def length\n @array_specs.spec_count\n end",
"def lots_count\t\t\n lots.count\n end",
"def number_of_existing_apps\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n num = @driver.find_elements(:tag_name => \"article\").count\r\n puts \"+ <action> existing_app_num: #{num}\"\r\n return num\r\n end",
"def modulecount\n $number_of_modules = @ary.count().to_s\nend",
"def disgems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + disgemd_count_for(klass)\n end\n end",
"def number_of_applications\n\t\treturn self.appTemplates.size\n\tend",
"def number_of_manifestations_launched(login=nil)\n count_by_frbr(login, :launches, :how_many_manifestations?) \n end",
"def unverifiable_package_count\n published_packages.size - expected_cksums.size\n end",
"def vendor_count\n @vendor_count ||= Vendor.count\n end",
"def line_count\n entries.inject(0) do |count, entry|\n count + (entry.dir? ? 0 : entry.lines.size)\n end\n end",
"def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end",
"def songs_count\n value = 0\n packs.each do |pack|\n value += pack.songs.count\n end\n value += songs.count\n end",
"def get_number\n @number_of_repos\n end",
"def count\n `git rev-list HEAD --count`.presence.to_i\n rescue\n nil\n end",
"def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end",
"def numImages(path)\n\t\tDir.entries(path).size\n\tend",
"def count_imported\n return @count_imported\n end",
"def total_products_count\n products.inject(0) { |count, product| count + product.count.to_i }\n end",
"def num_gears\n num = 0\n group_instances.each { |g| num += g.gears.count}\n num\n end",
"def number_of_resources_launched(login=nil)\n count_by_frbr(login, :launches, :how_many_resources?) \n end",
"def count\n defined_types.size\n end",
"def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end",
"def Count()\r\n ret = _getproperty(1610743819, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def Count()\r\n ret = _getproperty(1610743819, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def count\n items.compact.count.to_d\n end",
"def Count()\r\n ret = _getproperty(1610743815, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def getCount()\r\n available = @emojiFiles.size()\r\n used = @usedEmojis.size()\r\n return available, used\r\n end",
"def Count()\r\n ret = _getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def count_items\n @items.size\n end",
"def number_of_works_to_whom_source_material_is_provided(login=nil)\n count_by_frbr(login, :provides_source_material_for, :how_many_works?) \n end",
"def count\r\n items.size\r\n end",
"def badges_count\n badges.count\n end",
"def versions_count\n @tc_storage.size\n end",
"def developers_count\n person_ids = []\n person_ids += solutions.pluck(:person_id)\n person_ids += bounty_claims.pluck(:person_id)\n person_ids += developer_goals.pluck(:person_id)\n\n person_ids.uniq.length\n end",
"def total_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.parent_job_id.blank?\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def class_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:defs,content)\n end.sum\n end",
"def count\n THEMES.size\n end",
"def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end",
"def item_count\n @items.length\n end",
"def count_shared_packages(packages, unit)\n packages.where(unit_id: unit.id).count\n end",
"def count\n `wc -l < #{filepath}`.to_i - 1\n end",
"def count_number_of_galleries(_browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n Log.logger.info(\"Counting the number of galleries present on the galleries first page.\")\n nog = wait.until { _browser.find_elements(:css => 'div#main div.media-gallery-item') }.size\n return nog\n end",
"def size\n specs.size\n end",
"def bundles\n bundle = 0\n instructions.chunk { |i|\n\tidx = bundle\n\tbundle += 1 unless i.bundled?\n\tidx\n }.map{|b| b[1]}\n end",
"def tag_count\n tags.count\n end",
"def get_total_games_played\n return games.size\n end",
"def get_total_games_played\n\t\treturn games.size\n\tend",
"def num_files_owned_by_user(in_user_name)\n command_string = 'find '+@install_root+' -user '+in_user_name+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def count_used_instances\n count = 0\n return count\n end",
"def issue_count\n issue_count = 0\n self.sections.each { | section| issue_count += section.issue_count }\n issue_count\n end",
"def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end",
"def size\n @tool_configs.size\n end",
"def nb_problems\n return @pb_list.length\n end",
"def num_products\n leftbar_el = get_el(doc.css(\"#navigator_bar\"))\n return 0 if leftbar_el.nil?\n leftbar = leftbar_el.content.to_s\n product_phrase = leftbar.match('Browsing \\d+ ').to_s\n num_products = product_phrase.match('\\d+').to_s\n return num_products.to_i\n end",
"def module_size\n @version * 4 + 17\n end",
"def dir_file_count\n directory = APP_CONFIG['import_maps_sftp_path']\n count = Dir[File.join(directory, '**')].count { |file| File.file?(file) }\n\n return count\n end",
"def size\n @components.values.inject(0) { |component_count, attribute| component_count + attribute.size }\n end",
"def processors_count\n @processors.length\n end",
"def processors_in_use\n procs = []\n Dir.glob(\"/proc/*/stat\") do |filename|\n next if File.directory?(filename)\n this_proc = []\n File.open(filename) {|file| this_proc = file.gets.split.values_at(2,38)}\n procs << this_proc[1].to_i if this_proc[0] == \"R\"\n end\n procs.uniq.length\n end",
"def repo_size\n Dir.glob(File.join(repo.path, '**', '*'), File::FNM_DOTMATCH).reject do |f|\n f.include?('..')\n end.map do |f|\n File.expand_path(f)\n end.uniq.map do |f|\n File.stat(f).size.to_i\n end.reduce(:+)\n end",
"def get_job_count(type='scanner')\n job_count = 0\n framework.jobs.each do |k, j|\n if j.name =~ /#{type}/\n job_count = job_count + 1\n end\n end\n return job_count\n end",
"def active_count(specs, ignored)\n result = 0\n specs.each do |spec|\n\tresult += 1 unless ignored[spec.full_name]\n end\n result\n end",
"def gemspecs; end",
"def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end",
"def numEnts\n num = 1\n num += @lfn_ents.size if @lfn_ents\n return num\n end",
"def num_items()\n items ? items.length : 0\n end",
"def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end",
"def number_of_tickets_bought() # working in terminal - console (eg.: customer1.number_of_tickets_bought)\n return films.count\n end",
"def number_of_bottles\n bottles = self.line_items.inject(0) {|bottles, line_item| bottles + line_item.quantity}\n end",
"def number_of_bottles\n bottles = self.line_items.inject(0) {|bottles, line_item| bottles + line_item.quantity}\n end",
"def item_count()\n @names.count\n end",
"def num_items\n backup_photo_albums.size\n end",
"def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end",
"def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end",
"def count\n Dir.glob(File.join(@dir, '*.{yml,yaml}')).size\n end",
"def photo_count\r\n infoxml = get_info\r\n return infoxml.at('photos/count').inner_text.to_i\r\n end",
"def class_count\n @_count ||= \"(#{classes.size}/#{vedeu_classes.size})\"\n end",
"def forks\n repositories.map do |r|\n octokit.repository(r)['forks_count']\n end.inject(&:+)\n end",
"def count\n each.size\n end",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def num_json_ids_to_process\n total = 0\n\n total += json_ids_to_process.length\n\n total\n end",
"def objects_count\n @objects_count ||= objects.size\n end",
"def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end",
"def active_count(specs, ignored)\n result = 0\n\n specs.each do |spec|\n result += 1 unless ignored[spec.full_name]\n end\n\n result\n end",
"def get_count(reload=false)\n @total_count = nil if reload\n\n @total_count ||= begin\n subdir = Rails.env.test? ? 'spec' : 'tmp'\n path = File.join Rails.root, subdir, '_definitions_count.txt'\n if File.file? path\n IO.read(path).to_i\n else\n total_count = count\n File.open(path, 'w') {|stream| stream.puts total_count }\n total_count\n end\n end\n end",
"def size\n Integer.new.tap do |count|\n each { |element| count += 1 }\n end\n end",
"def get_total_length(filenames)\n shell_formatted_filenames = Shellwords.join filenames\n res = `afinfo -b #{shell_formatted_filenames}` # total info\n length = 0\n res.lines{|l| length = length + l.split.first.to_f if l.split.first.to_f}\n length\n end",
"def loaded_count\n loaded_objects.size\n end"
] |
[
"0.78801644",
"0.7844472",
"0.675362",
"0.67533034",
"0.63811404",
"0.63425595",
"0.6255015",
"0.61621636",
"0.6152294",
"0.6152294",
"0.6152294",
"0.6140528",
"0.60733366",
"0.6068115",
"0.60059845",
"0.5995317",
"0.59810305",
"0.5902619",
"0.5865549",
"0.5857041",
"0.58540416",
"0.5825833",
"0.58180416",
"0.5816248",
"0.580423",
"0.57903",
"0.57901895",
"0.57772595",
"0.5764531",
"0.57526183",
"0.57165545",
"0.5711642",
"0.57082313",
"0.5703273",
"0.57000756",
"0.57000756",
"0.5685806",
"0.5671924",
"0.5670213",
"0.566963",
"0.5667849",
"0.5654811",
"0.5650554",
"0.5640939",
"0.56377065",
"0.56344146",
"0.5634255",
"0.56231785",
"0.561427",
"0.5611566",
"0.5609504",
"0.5607578",
"0.55993956",
"0.5596688",
"0.55632776",
"0.55528724",
"0.55515873",
"0.5546996",
"0.5541493",
"0.55393153",
"0.55387354",
"0.55350345",
"0.5523041",
"0.552063",
"0.55158204",
"0.55115485",
"0.5500611",
"0.5496514",
"0.5492378",
"0.54887635",
"0.54876363",
"0.54828954",
"0.54802424",
"0.5479413",
"0.5477418",
"0.5477056",
"0.5476426",
"0.5471889",
"0.5469646",
"0.5467039",
"0.5462884",
"0.5462884",
"0.5453854",
"0.54513705",
"0.5451132",
"0.54502654",
"0.54490364",
"0.54397064",
"0.5436225",
"0.5435654",
"0.5427182",
"0.54265803",
"0.54258424",
"0.5421071",
"0.54194266",
"0.5417971",
"0.54164296",
"0.54163706",
"0.5413202",
"0.5407609"
] |
0.87557924
|
0
|
Starts a timer and executes given block
|
def timer
start_at = Time.now
yield
seconds = Time.now - start_at
time_per_gem_text = "#{(seconds / Float(gems_count)).round(2)} second(s) per gem"
puts "\nIt took #{seconds} second(s) to spy #{gems_count} gem(s) (#{time_per_gem_text})."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def timer(&block)\n start_time = Time.now\n yield(start_time)\n time_elapsed = Time.now - start_time\n end",
"def with_timer(name, &block)\n start = Time.now\n block.call\n duration = Time.now - start\n # report in ms\n self.add_field(name, duration * 1000)\n self\n end",
"def with_timer(&block)\n start_time = Time.now\n block.call\n end_time = Time.now\n duration_in_seconds = (end_time - start_time).to_i\n $stderr.puts \"Total duration: #{ duration_in_seconds } seconds.\"\n end",
"def timer(*args, &b); \n if block_given?\n \tForce::Timer.timer(*args, &b)\n else\n Force::Timer.timer args[0] do\n send(args.shift, *args)\n end\n end\n end",
"def timer\n # 2. start executing the method\n start_time = Time.now\n yield # 3. jump out of 'timer', start execuding the block\n\n # 6. continue executing the method as per usual\n end_time = Time.now\n\n puts \"Elapsed time: #{end_time - start_time} s\"\nend",
"def start(&block)\n @start_time = Time.now\n show\n yield self\n show\n clear\n end",
"def then(&block)\n start_time = @_last_timer[2].nil? ? @_last_timer[1] : @_last_timer[2]\n @_timers << [@_last_timer[0], start_time, nil, block]\n end",
"def start!\n raise \"This timer cannot be started as it is already running!\" if @running\n @running = true\n @shutting_down = false\n @thread = Thread.new do\n begin\n if @one_shot\n sleep @timeout\n @block.call\n else\n loop do\n break if @shutting_down\n sleep @timeout\n @block.call\n end\n end\n rescue\n\n end\n end\n end",
"def time(label, &block)\n raise ArgumentError, 'no block given' unless block\n\n `#{@native}.time(label)`\n\n begin\n if block.arity == 0\n instance_exec(&block)\n else\n yield(self)\n end\n ensure\n `#{@native}.timeEnd()`\n end\n end",
"def timer(callback = nil, &blk)\n Timer.new(@loop, callback || blk)\n end",
"def timer(method=nil, *args)\n start_time = Time.now\n if block_given?\n yield\n else\n send(method, args)\n end\n end_time = Time.now\n puts \"Time elapsed #{(end_time - start_time)} seconds\"\nend",
"def start_timer\n stop_timer\n @timer = EventMachine::PeriodicTimer.new(1) do\n #puts \"TIMER PROCESS ITERATE\"\n do_timer\n end\n end",
"def time(key, &block)\n if block_given?\n yield\n else\n NullTimedExecution\n end\n end",
"def interval duration, &block\n `setInterval(function() { #{block.call} }, duration * 1000)`\n end",
"def create_timer(delay_seconds, &block)\n self.decision_context.workflow_clock.create_timer(delay_seconds, block)\n end",
"def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend",
"def measure_time(&block)\n start_time = Time.now\n yield\n Time.now - start_time\nend",
"def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end",
"def schedule(time, callback); end",
"def timer\n handle = Timer.new(@reactor)\n handle.progress &Proc.new if block_given?\n handle\n end",
"def timed(message=nil, &block)\n start!\n out(message) if message\n yield\n done!\n end",
"def create_timer(interval, &block)\n Timer.new(self, interval, &block)\n end",
"def add_timeout(interval, &block)\n @timer.add(interval, &block)\n end",
"def run_nonblock(&block)\n @timeout = 0\n run &block\n end",
"def timer(milliseconds, &callback)\n # Implement in subclass\n end",
"def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend",
"def timer\n rescuer do\n Timeout.timeout(ttl) { yield }\n end\n end",
"def schedule_call(&block)\n EM::next_tick(&block)\n end",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def time(&block)\n t = Time.now\n [yield, Time.now - t]\n end",
"def start &block\n @actions[:start] = block\n end",
"def start_timer\n @timer ||= detach_timer\n end",
"def time_operation(&block)\n start = Time.now.to_ms\n yield\n Time.now.to_ms - start\n end",
"def initialize(window, time, &block)\n @window = Native.convert(window)\n @after = time\n @block = block\n\n @id = `#@window.setTimeout(#{block.to_n}, time * 1000)`\n end",
"def regularly(time, &block)\n Thread.new do\n while true\n sleep time\n synchronize &block\n end\n end\n end",
"def start(timeout, repeat = 0)\n return if @closed\n @stopped = false\n\n # prevent timeouts less than 0 (very long time otherwise as cast to an unsigned)\n # and you probably don't want to wait a few lifetimes\n timeout = 0 if timeout < 0\n\n timeout = timeout.to_i\n repeat = repeat.to_i\n\n error = check_result ::Libuv::Ext.timer_start(handle, callback(:on_timer), timeout, repeat)\n reject(error) if error\n end",
"def time description = '', &block\n start = Time.now\n yield\n puts \"execution time of #{description.empty? ? block.to_s : description}: #{Time.now - start}\"\nend",
"def start\n EM.run {\n time = @config[:time] - (Time.now.hour*60*60 + Time.now.min*60 + Time.now.sec)\n time += 86000 if time < 0\n \n run_me = proc {\n notify\n EM.add_timer(86000, run_me)\n }\n \n EM.add_timer(time, run_me)\n }\n end",
"def every(interval, &block)\n Timer.new(self, interval, true, block)\n end",
"def start()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_start(@handle.ptr)\n end",
"def with_logging(&block)\n\tstart_time = Time.now\n\tputs \"Starting running code at #{start_time}\"\n\tblock.call\n\tend_time = Time.now\n\tputs \"Finishing running code #{end_time}\"\n\ttime_taken = end_time - start_time\n\tputs \"Time taken was #{time_taken} seconds\"\nend",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def with_logging(&block)\n\tputs \"Start running code\"\n\tblock.call\n\ttime_done = Time.now\n\tputs \"Finishing running code at #{time_done}\"\nend",
"def profile(description_of_block, &block)\n start_time = Time.now \n block.call \n duration = Time.now - start_time\n puts description_of_block+': '+duration.to_s+' seconds'\nend",
"def run_after(delay, &block)\n NSTimer.scheduledTimerWithTimeInterval( delay,\n target: block,\n selector: \"call:\",\n userInfo: nil,\n repeats: false)\n end",
"def initialize(interval, callback=nil, &blk)\n fire = proc {\n (callback || blk).call\n trigger(:fired)\n }\n @timer = NSTimer.scheduledTimerWithTimeInterval(interval,target: fire, selector: 'call:', userInfo: nil, repeats: false)\n end",
"def with_timeout(time, &block)\n Timeout.timeout(time) do\n block.call(self)\n end\n end",
"def start\n raise \"the interval has been aborted\" if aborted?\n return unless stopped?\n\n @stopped = false\n\n @id = `#@window.setInterval(#@block, #@every * 1000)`\n end",
"def with_timer(name)\n start = Time.now\n yield\n duration = Time.now - start\n # report in ms\n add_field(name, duration * 1000)\n self\n end",
"def trigger\n @timed_out = false\n @expires = Time.now + @period\n unless @thread\n @thread = Thread.new do\n begin\n begin\n sleepytime = @expires - Time.now\n while sleepytime > 0.0\n sleep(sleepytime)\n sleepytime = @expires - Time.now\n end\n @timed_out = true\n @expires += @period if @repeats\n @block.call if @block\n end while @repeats\n rescue StopTimerException\n @expires=nil\n ensure\n @thread = nil\n end\n end\n end\n end",
"def set_timeout(seconds, block)\n listener = { seconds: seconds, block: block, time: @time, target: @time + seconds }\n @timeout_listeners.push listener\n listener\n end",
"def start_timer\n @start_time = Time.now\n end",
"def create_timer_async(delay_seconds, &block)\n task { self.decision_context.workflow_clock.create_timer(delay_seconds, block) }\n end",
"def profile (block_description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def timer(*args)\n return 0,nil unless block_given?\n t1 = Time.now\n result = yield(*args)\n t2 = Time.now\n return (t2 - t1), result\n end",
"def time(identifier)\n if active?\n unless block_given?\n raise \"Please supply a block of code for Etalon to instrument\"\n end\n\n start = Time.now\n\n return_value = yield\n\n duration = elapsed(start)\n\n key = key_from(identifier: identifier)\n store = instrument_store_for(key: key)\n\n store[:count] += 1\n store[:min] = duration if duration < store[:min]\n store[:max] = duration if duration > store[:max]\n store[:all] << duration\n\n return_value\n else\n yield\n end\n end",
"def debug_time(msg, &block)\n t0 = Time.now\n value = block.call\n debug \"TIME: #{msg} #{sprintf \"%.6f\", (Time.now - t0)} sec\"\n value\n end",
"def run\n @lock.synchronize do\n until stopped?\n if run?\n begin\n @callback.call\n rescue => ex\n logger.warn \"[Neptune] Failed to run timer: #{ex.message}\"\n ensure\n # Always reset, regardless of whether it failed\n reset\n end\n else\n # Wait until enough time has passed for the next invocation\n @notifier.wait(@lock, seconds_left)\n end\n end\n end\n end",
"def timer=(_arg0); end",
"def timer=(_arg0); end",
"def timer=(_arg0); end",
"def timer=(_arg0); end",
"def start\n @timer = every(1) { tick }\n super\n end",
"def run (&code_block)\n raise ArgumentError, 'run requires a code block to execute.' unless block_given?\n @count=0\n\n start_time = Time.now\n\n (1..@max_count).each do |x|\n @count = x\n code_block.call\n\n sleep @interval_seconds unless @count == @max_count\n end\n\n ensure\n @running_time = Time.now - start_time unless start_time.nil?\n end",
"def time\n @began = Time.now\n yield\n ensure\n self.info \"Finished in %.1f sec.\" % (Time.now - @began)\n end",
"def start(&block)\n puts start_message if @pomodoros == @total\n begin\n yield(current_pomodoro) if block_given?\n display_countdown\n @pomodoros -= 1\n if stop?\n stop(&block)\n else\n start(&block)\n end\n rescue SystemExit, Interrupt\n puts quit_message\n end\n end",
"def setProcessingTime(&block)\n bTime = Time.new() ;\n block.call() ;\n eTime = Time.new() ;\n setBeginEndTime(bTime, eTime) ;\n end",
"def start(&block)\n begin\n yield(current_pomodoro) if block_given?\n\n display_countdown\n\n @pomodoros -= 1\n\n start(&block) unless stop?\n rescue SystemExit, Interrupt\n puts quit_message\n end\n end",
"def run_command interval, duration\n (duration / interval).times do \n yield\n sleep(interval)\n end\nend",
"def set_timer(delay=nil)\n if delay.class == Fixnum && block_given?\n return @j_del.java_method(:setTimer, [Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(delay,(Proc.new { |event| yield(event) }))\n end\n raise ArgumentError, \"Invalid arguments when calling set_timer(delay)\"\n end",
"def call\n SCC::Logger.info \"[TIMER] Starting timer for #{duration} seconds, with #{interval} second intervals.\"\n call_count.times do |n|\n yield\n\n SCC::Logger.info \"[TIMER] Finished #{n+1} of #{call_count} calls.\"\n\n if (n+1) != call_count\n SCC::Logger.info \"[TIMER] Waiting #{interval} seconds till next call.\"\n sleep interval\n end\n end\n end",
"def start(&block)\n loop do\n event_data = self.next\n block.(event_data)\n end\n end",
"def schedule(&block)\n pool_fiber.resume(block)\n end",
"def setInterval(seconds = 0, *args, id: nextTimerID__, now: false, &block)\n return unless block\n time = Time.now.to_f\n block.call(*args) if now\n setInterval__ id, time, seconds, args, &block\n end",
"def timer; end",
"def timer; end",
"def timer; end",
"def timer; end",
"def execute_in_main_thread(&block)\n EventMachine.schedule(&block)\n end",
"def time(name, &block)\n raise ArgumentError.new(\"Block required to time.\") unless block\n realtime = Benchmark.realtime { block.call }\n Stats.redis.rpush(name, realtime)\n end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def after(interval, &block)\n Timer.new(self, interval, false, block)\n end",
"def setTimeout(seconds = 0, *args, id: nextTimerID__, &block)\n return unless block\n setTimeout__ id, Time.now.to_f + seconds, args, &block\n end",
"def start_timer\n view.start_timer self\n end",
"def on_start(&block)\n @on_start << block\n end",
"def start &block\n raise RuntimeError.new(\"Can't start collectimng unless ready (currently #{@status})\") unless ready?\n @block = block\n raise ArgumentError.new(\"Num, timeout or block must be provided\") unless @options[:num] || @options[:timeout] || @block\n reset\n @status = :collecting\n log_start\n @notifier.add_listener self if @notifier\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def execute(&block)\n v = @v.map &block\n TimeArray.new(@start_time, v, zone: Time.zone.name)\n end",
"def profile blockDescription, &block\n startTime = Time.now\n\n block.call\n \n duration = Time.now - startTime\n\n puts blockDescription + ': '+duration.to_s+' seconds'\n\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def start_periodic_timers; end",
"def start_periodic_timers; end",
"def starter\n @starter = Thread.new do\n sleep_interval(60)\n yield # starter proc in :start \n end\n end",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def ding &block\n tund = Time.new.hour\n tund.times do\n block.call \n end\nend",
"def start\n File.open(@path, 'w') do |handle|\n handle.write(Time.new.to_i)\n handle.close\n end\n\n puts 'Starting a new timer'\n end",
"def every(seconds, &block)\n if !seconds.is_a?(Numeric) || seconds <= 0\n raise ArgumentError, 'Positive number of seconds is expected as an argument'\n end\n wrap_block = proc do\n @every_block_opts ||= {}\n opts = @every_block_opts[block.object_id] || {}\n next_run_at = opts[:next_run_at]\n next if next_run_at && next_run_at >= Time.now\n block.call\n opts[:next_run_at] = Time.now + seconds\n @every_block_opts[block.object_id] = opts\n end\n register_event_handler(:every, wrap_block)\n end",
"def create_periodic_timer(interval, &block)\n Timer.new(self, interval, :periodic => true, &block)\n end",
"def schedule_timer(timeout)\n @scheduler.schedule_timer(timeout)\n end",
"def with_time_passing(*blocks)\n time = Time.now\n\n blocks.each do |block|\n Time.stubs(:now => time)\n block.call\n time += 2.seconds\n end\n end"
] |
[
"0.7348997",
"0.6855058",
"0.6829429",
"0.6828768",
"0.6820101",
"0.6772839",
"0.67140955",
"0.654366",
"0.65370053",
"0.65215915",
"0.64120525",
"0.6399946",
"0.6378475",
"0.63638866",
"0.63542956",
"0.630586",
"0.6213037",
"0.6202187",
"0.6202161",
"0.61959404",
"0.61833644",
"0.6181416",
"0.61721534",
"0.6109433",
"0.61090934",
"0.6101084",
"0.60892695",
"0.6085111",
"0.60645545",
"0.60611266",
"0.60311013",
"0.6026249",
"0.6021582",
"0.5987596",
"0.5975385",
"0.59741175",
"0.59739846",
"0.5973234",
"0.5970301",
"0.59625727",
"0.5959843",
"0.5952463",
"0.5931491",
"0.5930791",
"0.59278023",
"0.5909116",
"0.58989865",
"0.5893395",
"0.58921564",
"0.587892",
"0.58648103",
"0.58562",
"0.5853167",
"0.5851934",
"0.5836036",
"0.58161396",
"0.57789004",
"0.57616264",
"0.5759323",
"0.5759323",
"0.5759323",
"0.5759323",
"0.57561386",
"0.5754298",
"0.5745935",
"0.57428944",
"0.5731086",
"0.57285005",
"0.57171345",
"0.57163393",
"0.5710023",
"0.5704762",
"0.57021075",
"0.56908196",
"0.5687057",
"0.5687057",
"0.5687057",
"0.5687057",
"0.5683437",
"0.5682379",
"0.5680353",
"0.5658561",
"0.5652826",
"0.5646065",
"0.56457883",
"0.5641776",
"0.56219536",
"0.56219536",
"0.56206906",
"0.5619115",
"0.5617372",
"0.56092215",
"0.56092215",
"0.55944234",
"0.5591389",
"0.55854553",
"0.5578572",
"0.5578277",
"0.5577417",
"0.5576563",
"0.5566128"
] |
0.0
|
-1
|
Returns list of gems to spy
|
def gems
@gems ||=
Bundler.load.current_dependencies.map do |dependency|
GemsBond::Gem.new(dependency)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def runtime_specific_gems\n []\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def spec_set\n Bundler.locked_gems.specs\n end",
"def gems(*args)\n gems.each{|g| gem(g) }\n end",
"def gemspecs; end",
"def r(*gems)\n gems.map {|g| require g.to_s}\nend",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def gems_for_testing_framework(testing_framework)\n %Q{gem \"#{testing_framework}\", :group => :test}\n end",
"def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end",
"def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end",
"def load_gems_in(*spec_dirs); end",
"def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end",
"def gem(*args)\n @gems << args unless args.empty?\n @gems\n end",
"def prod_gems\n test_gems\nend",
"def list(pattern = /.*/)\n if Gem::Specification.respond_to?(:each)\n Gem::Specification.select{|spec| spec.name =~ pattern }\n else\n Gem.source_index.gems.values.select{|spec| spec.name =~ pattern }\n end\n end",
"def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end",
"def testing_gems\n gem 'rake'\n gem 'rspec', '~> 3.0.0'\n gem 'rspec-wait'\n gem 'cucumber'\n gem 'simplecov'\n gem 'bundler', '~> 1.6'\n gem 'bunny', '~> 1.4'\n gem 'database_cleaner'\n gem 'racatt'\n gem 'codacy-coverage', :require => false\nend",
"def specs\n checkout\n\n return [] unless install_dir\n\n Dir.chdir install_dir do\n Dir['{,*,*/*}.gemspec'].map do |spec_file|\n directory = File.dirname spec_file\n file = File.basename spec_file\n\n Dir.chdir directory do\n spec = Gem::Specification.load file\n if spec\n spec.base_dir = base_dir\n\n spec.extension_dir =\n File.join base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version, \"#{name}-#{dir_shortref}\"\n\n spec.full_gem_path = File.dirname spec.loaded_from if spec\n end\n spec\n end\n end.compact\n end\n end",
"def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end",
"def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end",
"def require_gems; end",
"def platform_gems\n array = package_config[:gemfile]\n return [] if array.blank?\n path = vendor? ? \"./#{vendor_path}/vendor\" : source_vendor_path\n new_erb.erb_array(array, vendor_path: path)\n end",
"def libs; end",
"def pythons\n deps.map(&:to_formula)\n .select { |f| f.name.match?(/^python@\\d\\.\\d+$/) }\n .sort_by(&:version)\n .map { |f| f.opt_libexec/\"bin/python\" }\n end",
"def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end",
"def reset_gem_specs!\n return unless Gem.loaded_specs.keys.include?('locomotivecms_wagon')\n\n core_gems = %w(did_you_mean).freeze\n\n Gem.loaded_specs.values.each do |spec|\n next if core_gems.include?(spec.name)\n spec.full_require_paths.each do |path|\n $LOAD_PATH.delete(path)\n end\n\n # Without this statement, bundler will raise the infamous \"You have already activated ...\"\n Gem.loaded_specs.delete(spec.name)\n end\nend",
"def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end",
"def all_gems()\n self.sort.collect {|k,g| g }\n end",
"def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end",
"def find_bundle_measure_paths\n bundle_measure_paths = []\n\n puts \"Getting measure directories for bundle installed measure gems\"\n gems = Dir.entries(bundle_base_gem_path)\n gems.each do |gem|\n # check if has lib/measures\n gem = \"#{bundle_base_gem_path}/#{gem}/lib/measures\"\n next if ! Dir.exists?(gem)\n bundle_measure_paths << gem\n end\n\n puts \"found #{bundle_measure_paths.size} measure directories\"\n\n return bundle_measure_paths.sort\nend",
"def add_specs(*gem_specs); end",
"def refresh_from_gems(*components)\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install(name) }\n end",
"def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end",
"def test_gems\n gem 'tef-worker'\n gem 'tef-manager'\n gem 'tef-keeper'\n gem 'tef'\n gem 'tef-development'\nend",
"def list_beshared_libraries\n get_list_beshared_libraries\n end",
"def requires\n require_items.collect(&:package)\n end",
"def load_minimal_gems\r\n end",
"def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end",
"def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end",
"def packages\n @packages ||= []\n end",
"def packages\n @packages ||= []\n end",
"def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end",
"def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end",
"def gems_for_testing_framework(testing_framework)\n testing_framework == :rspec ? '' : %Q{gem \"#{testing_framework}\", :group => :test} \n end",
"def specs\n @specs ||= begin\n specs = resolve.materialize(requested_dependencies)\n\n all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))\n if all_dependencies.any? { |d| d.name == \"bundler\" } && !specs[\"bundler\"].any?\n bundler = sources.metadata_source.specs.search(bundler_query).last\n specs[\"bundler\"] = bundler\n end\n\n specs\n end\n end",
"def gemspecs\n return [] if directory.empty? || directory == '*'\n @gemspecs ||= Dir[File.join(directory, '**/*.gemspec')].select do |gs|\n config.allow? gs\n end\n end",
"def find_all(req)\n @specs.values.select do |spec|\n req.match? spec\n end.map do |spec|\n source = Gem::Source::Vendor.new @directories[spec]\n Gem::Resolver::VendorSpecification.new self, spec, source\n end\n end",
"def packages\n FileList[package_path('.*')]\n end",
"def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end",
"def build_gems; end",
"def installed_versions(name, requirement)\n if gem_installed?(name, requirement)\n Chef::Log.info \"Gem #{name} (#{requirement}) found in OpsWorks user space.\"\n # from rubygems/specification.rb#find_all_by_name\n Gem::Dependency.new(name, requirement).matching_specs\n else\n Chef::Log.debug \"Gem #{name} (#{requirement}) not found in OpsWorks user space.\"\n []\n end\n end",
"def from_installed_gems(*deprecated)\n if deprecated.empty?\n from_gems_in(*installed_spec_directories)\n else\n from_gems_in(*deprecated)\n end\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def test_framework_runtimes\n find_duplicates :frameworks\n end",
"def desired_gems(list_of_gems)\n specified_gems = []\n list_of_gems.each do |g| \n if self.has_key? g\n specified_gems << self[g]\n else\n specified_gems << \"'#{g}' not found in any gemset\"\n end\n end\n\n specified_gems\n end",
"def patched\n vendored.collect do |dep|\n # TODO: right now just handling git based alternate sources,\n # should be able to handle other types bundler supports\n # (path and alternate rubygems src)\n next unless dep.source.is_a?(Bundler::Source::Git)\n src = dep.source\n\n # retrieve gem\n gem = if src.version\n Polisher::Gem.new(:name => dep.name, :version => src.version)\n else\n Polisher::Gem.retrieve(dep.name)\n end\n\n # retrieve dep\n git = Polisher::Git::Repo.new :url => src.uri\n git.clone unless git.cloned?\n git.checkout src.ref if src.ref\n\n # diff gem against git\n gem.diff(git.path)\n end.compact!\n end",
"def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end",
"def get_list_beshared_libraries\n JSON.parse(curl_get(\"beshared-repos/\").body_str)\n end",
"def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def local_gems\n %x(ls #{local_cache_path}).split(/\\s+/)\n end",
"def specs\n collect_specs_via(:specs)\n end",
"def prefetch gems\n end",
"def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end",
"def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end",
"def collect_specs_via(method)\n specs_by_repo.values.collect do |idx|\n idx.send(method)\n end.flatten.sort\n end",
"def from_installed_gems(*deprecated); end",
"def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end",
"def add_gems\n gem 'data-confirm-modal', '~> 1.6.2'\n gem 'devise', '~> 4.4.3'\n gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'\n gem 'devise_masquerade', '~> 0.6.0'\n gem 'font-awesome-sass', '~> 4.7'\n gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'\n gem 'jquery-rails', '~> 4.3.1'\n gem 'bootstrap', '~> 4.0.0.beta'\n gem 'webpacker', '~> 3.0'\n gem 'foreman', '~> 0.84.0'\n gem_group :development, :test do\n gem 'rspec-rails', '~> 3.6.0'\n gem \"factory_bot_rails\", \"~> 4.10.0\"\n gem 'spring-commands-rspec'\n end\n\n gem_group :test do\n gem 'shoulda-matchers', '~> 3.1'\n end\nend",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end",
"def get_root_dirs_from_gems\n # Get Application root dir and Modules\n hlist = {}\n alist = []\n\n # All gems\n # NOTE: Gem::GemPathSearcher#initialize is deprecated with no replacement. It will be removed on or after 2011-10-01.\n # searcher = Gem::GemPathSearcher.new\n # list = searcher.init_gemspecs\n # GemPathSearcher => Specification\n path = \"\"\n specs = Gem::Specification.find_all # {|spec| spec.contains_requirable_file? path}\n specs = specs.sort_by { |spec| spec.version }\n\n specs.each do |spec|\n $log.debug \"spec name : #{spec.name}\"\n\n # TODO: pick the first (newone), must check the Gemfile?\n if spec.name == 'rails'\n if $rails_version.nil?\n $log.debug \"rails version is #{spec.version}\"\n $rails_version = spec.version.to_s\n end\n end\n\n # KNOWN security functions\n # authentication\n $authentication = 'devise' if spec.name == 'devise'\n $authentication = 'authlogic' if spec.name == 'authlogic' # TODO\n\n # authorization\n $authorization = 'cancan' if spec.name == 'cancan'\n $authorization = 'the_role' if spec.name == 'the_role' # TODO\n\n # test\n # TODO: rspec?\n $test = 'cucumber' if spec.name == 'cucumber'\n\n c_path = spec.full_gem_path + '/app/controllers'\n v_path = spec.full_gem_path + '/app/views'\n if File.exists?(c_path) && File.exists?(v_path)\n if hlist[spec.name].nil?\n # new\n $log.debug \"rails app?\"\n hlist[spec.name] = [spec.version, spec.full_gem_path]\n else\n # hit, select latest one\n if hlist[spec.name][0] < spec.version\n hlist[spec.name][0] = spec.version\n hlist[spec.name][1] = spec.full_gem_path\n end\n end\n elsif File.exists?(c_path)\n puts \"TODO C only #{spec.full_gem_path}\"\n elsif File.exists?(v_path)\n puts \"TODO V only #{spec.full_gem_path}\"\n end\n end\n # Add this app\n hlist['this'] = [nil, Dir.pwd]\n hlist\n end",
"def require_libs(*libs); end",
"def get_drivers\n drivers\n end",
"def all_plugin_specs\n @plugin_specs.values\n end",
"def request_libraries\n libraries.collect(&:request_libraries).flatten\n end",
"def released_specs\n collect_specs_via(:released_specs)\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def add_gem_paths; end",
"def refresh_from_gems(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install_gem(name, opts) }\n end",
"def test_dependencies\n []\n end",
"def test_dependencies\n []\n end",
"def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end",
"def fetch_dependency_remote_specs(gem_names, &blk)\n Bundler.ui.debug \"Query Gemcutter Dependency Endpoint API: #{gem_names.join(' ')}\"\n uri = URI.parse(\"#{@remote_uri}api/v1/dependencies?gems=#{gem_names.join(\",\")}\")\n marshalled_deps = fetch(uri)\n gem_list = Marshal.load(marshalled_deps)\n\n spec_list = gem_list.map do |s|\n [s[:name], Gem::Version.new(s[:number]), s[:platform]]\n end\n deps_list = gem_list.map do |s|\n s[:dependencies].collect {|d| d.first }\n end.flatten.uniq\n\n [spec_list, deps_list]\n end",
"def dependencies\n spec.dependencies\n end",
"def dependencies\n spec.dependencies\n end",
"def require_lib(*libs); end",
"def installed_spec_directories; end"
] |
[
"0.70879024",
"0.6976767",
"0.6734301",
"0.6725492",
"0.6725492",
"0.6725492",
"0.66878617",
"0.6617341",
"0.65354306",
"0.6518622",
"0.64967877",
"0.6388828",
"0.63587433",
"0.6313727",
"0.6254043",
"0.62126225",
"0.62045",
"0.61947095",
"0.61510247",
"0.61381125",
"0.6109692",
"0.60476893",
"0.60234374",
"0.6012021",
"0.5940593",
"0.5938449",
"0.59358144",
"0.59316856",
"0.5900867",
"0.58832145",
"0.5865679",
"0.5863918",
"0.5843929",
"0.58236223",
"0.58182764",
"0.5793288",
"0.57878447",
"0.577482",
"0.5750177",
"0.5744069",
"0.573992",
"0.57391334",
"0.5723534",
"0.5722959",
"0.5705054",
"0.5705054",
"0.57045144",
"0.569966",
"0.5699422",
"0.5693518",
"0.56888",
"0.5679621",
"0.56786114",
"0.5670314",
"0.56639796",
"0.5645935",
"0.56450903",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640267",
"0.5640115",
"0.56301886",
"0.56243104",
"0.5624182",
"0.56219083",
"0.56185937",
"0.5605747",
"0.5605061",
"0.55938035",
"0.55926234",
"0.5578261",
"0.55777144",
"0.5577262",
"0.5576112",
"0.55681205",
"0.55655545",
"0.555123",
"0.554054",
"0.5531265",
"0.5521227",
"0.55159277",
"0.55081654",
"0.5505801",
"0.5505452",
"0.55014765",
"0.5499979",
"0.5493717",
"0.5490905",
"0.5490905",
"0.5490164",
"0.5489648",
"0.54853463",
"0.54853463",
"0.54632616",
"0.54630375"
] |
0.6238493
|
15
|
Fetches data for each gem
|
def fetch_gems_data
puts "Fetching data for..."
# slice 100 to avoid too many requests on RubyGems and GitHub APIs
gems.each_slice(100) do |batch|
each_concurrently(batch) do |gem|
begin
retries ||= 0
# set verbose to true to stdout the gem name
gem.prepare_data(verbose: true)
# rescue SocketError, Faraday::ConnectionFailed...
rescue StandardError
(retries += 1) <= RETRIES ? retry : nil
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prefetch gems\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def prefetch reqs\n return unless @remote\n names = reqs.map { |r| r.dependency.name }\n needed = names - @data.keys\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n loaded = []\n\n Marshal.load(str).each do |ver|\n name = ver[:name]\n\n @data[name] << ver\n loaded << name\n end\n\n (needed - loaded).each do |missing|\n @data[missing] = []\n end\n end",
"def data_sets\n update\n library.values\n end",
"def load_details\n @commits = Package.new.git_commits\n @packages = Package.latest_first \n @package = Package.new\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end",
"def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def refresh_from_gems(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install_gem(name, opts) }\n end",
"def fetch_dependency_remote_specs(gem_names, &blk)\n Bundler.ui.debug \"Query Gemcutter Dependency Endpoint API: #{gem_names.join(' ')}\"\n uri = URI.parse(\"#{@remote_uri}api/v1/dependencies?gems=#{gem_names.join(\",\")}\")\n marshalled_deps = fetch(uri)\n gem_list = Marshal.load(marshalled_deps)\n\n spec_list = gem_list.map do |s|\n [s[:name], Gem::Version.new(s[:number]), s[:platform]]\n end\n deps_list = gem_list.map do |s|\n s[:dependencies].collect {|d| d.first }\n end.flatten.uniq\n\n [spec_list, deps_list]\n end",
"def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end",
"def refresh_from_gems(*components)\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install(name) }\n end",
"def ruby_gems_fetcher\n return @ruby_gems_fetcher if defined?(@ruby_gems_fetcher)\n\n @ruby_gems_fetcher = GemsBond::Fetchers::RubyGems.new(name).tap(&:start)\n end",
"def get_all_data\n init_data\n\n Bot::DB[my_name]\n end",
"def get_all_data\n init_data\n\n Bot::DB[my_name]\n end",
"def fetch_obs_packages\n log.info \"Fetching all required packages\"\n yast_url.each_with_index do |url, index|\n system \"zypper --root #{cache_dir} ar --no-gpgcheck -p #{index + 1} #{url} \" \\\n \"download-packages-#{index}\"\n end\n system \"xargs -a #{obs_pkg_list_path} zypper --root #{cache_dir} \" \\\n \"--pkg-cache-dir=#{cache_dir} download\"\n\n yast_url.size.times { |i| system \"zypper --root #{cache_dir} rr download-packages-#{i}\" }\n\n log.info \"Fetching packages from extra repositories\"\n @extra_repos.each do |repo|\n system \"zypper --root #{cache_dir} ar --no-gpgcheck #{repo[:server]} \" \\\n \"download-extra-packages\"\n system \"zypper --root #{cache_dir} --pkg-cache-dir=#{cache_dir} \" \\\n \"download #{repo[:packages].join(\" \")}\"\n system \"zypper --root #{cache_dir} rr download-extra-packages\"\n end\n end",
"def load_data\n @products = Product.find(:all, :conditions => ProductFilter.website_conditions(@website), :order => \"name\")\n @comment_types = CommentType.find(:all, :order => \"name\")\n @comment_statuses = CommentStatus.find(:all, :order => \"name\")\n @users = User.find(:all, :order => \"login\")\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def fetch_libraries\n Library.limit(10)\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end",
"def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end",
"def fetch_data(key)\n map { |om| om.fetch_data(key) }.flatten.compact\n end",
"def load_data\n ## @calculators = GiftPackage.calculators.sort_by(&:name)\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_list template_id=@@oauth_info[:template_id]\n check_validity\n to_return = {}\n\n response = api_get \"my\"\n #TODO: implement proper expection raising on following line\n if response == nil then return to_return end\n gems = response[\"gems\"]\n\n if gems == nil then return to_return end\n gems.delete_if { |gem| gem[\"gem_template_id\"] != template_id }\n gems.each { |gem| to_return[gem[\"gem_instance_id\"]] = {\n :title => gem[\"gem_instance_name\"],\n :gem_instance_id => gem[\"gem_instance_id\"],\n :remote_timestamp => gem[\"updated_timestamp\"],\n :last_saved => Time.at(gem[\"updated_timestamp\"].to_f/1000)\n }}\n return to_return\n end",
"def gems(*args)\n gems.each{|g| gem(g) }\n end",
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = dependents(uri).css('.btn-link')[1].text.delete('^0-9').to_i\n gem_data[gem.to_sym] = gem_properties(repo, contributors_count, used_by_count)\n end",
"def load_minimal_gems\r\n end",
"def generate_require_files_for_individual_gems\n puts 'Generating require files for individual gems'\n generate_require_files_for_gem(@mgmt_sdks_location)\n generate_require_files_for_gem(@data_sdks_location)\n end",
"def install_projects\n meta_data.projects = project_resource.all.map { |project| { name: project['name'], id: project['id'] }}\n meta_data.trackers = tracker_resource.all.map { |tracker| { name: tracker['name'], id: tracker['id'] }}\n meta_data.issue_priorities = priority_resource.all.map { |priority| { name: priority['name'], id: priority['id'] }}\n end",
"def refresh!\n from_installed_gems\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def find_all\n Regulate::Git::Interface.find_all.collect do |resource_data|\n self.new_from_git( resource_data )\n end\n end",
"def memcached_gem_info\n @memcached_gem_info ||= Rails.cache.read_multi(*@gem_information.values)\n end",
"def load_data\n # @categories = Category.find(:all)\n # @infoitems = Expert.find(:all)\n end",
"def download_specs\n UI.puts 'Downloading Rubygem specification index...'\n fetcher = Gem::SpecFetcher.fetcher\n results, errors = fetcher.available_specs(:released)\n\n unless errors.empty?\n UI.puts 'Error downloading Rubygem specification index: ' +\n errors.first.error.to_s\n return []\n end\n\n flatten_fetcher_results(results)\n end",
"def search\n request_params = prepare_search_params\n if request_params[:packages].empty?\n return render json: {\n messeage: 'please provide us with packages to provide you with dependencies',\n },\n status: 200\n end\n\n operating_system = OperatingSystem.find_by(\n name: request_params[:operating_system][:name],\n vendor: request_params[:operating_system][:vendor],\n bits: request_params[:operating_system][:bits],\n )\n package_manager = operating_system.package_manager if operating_system\n\n packages = []\n request_params[:packages].each do |package|\n package_name = package[:name]\n package_version = package[:version]\n\n packages << Package.find_by(name: package_name, version: package_version)\n end\n\n if packages.empty?\n return render json: {\n messeage: \"sorry we haven't any data about your gems\",\n },\n status: 404\n end\n\n packages_dependencies = []\n packages.compact.each do |package|\n packages_dependencies <<\n { package_name: package[:name], package_dependencies: package.package_dependencies }\n end\n\n system_dependencies = []\n packages_dependencies.compact.each do |package|\n dependencies = []\n package[:package_dependencies].each do |p|\n dependencies = PackageSystemDependency.where(\n package: p, operating_system: operating_system,\n ).map(&:system_dependency)\n end\n system_dependencies << {\n package_name: package[:package_name],\n system_dependencies: dependencies,\n }\n end\n\n render json: { packages: system_dependencies, package_manager: package_manager }, status: 200\n end",
"def collection_loop(github_num, rubygem_num)\n client = create_client()\n if USE_GOOGLE_DRIVE\n google_session = GoogleDrive::Session.from_config(GOOGLE_DRIVE_API_CONFIG)\n type_folder = ensure_google_type_folder(google_session)\n end\n ensure_data_folder\n ensure_program_log_file\n apps_hash = File.file?(TYPE_DATA_JSON_FILE) ? JSON.parse(File.read(TYPE_DATA_JSON_FILE)): {}\n file_hashes = {}\n app_num = 0\n\n\n File.open(ERROR_LOG, \"w\") { |f| f.puts(\"ERRORS\") }\n \n\n ## get list of github repos to download\n gh_list = get_github_list(client, github_num)\n\n # get list of rubygems repos to download\n rg_list = get_rubygems_list(rubygem_num)\n\n # combine them into a single program list\n prog_list = (gh_list + rg_list).uniq { |r| r[:name] }\n\n ## HACK: RAILS_GEMS are all included in rails already, similar with aws-sdk gems. Drop these from prog_list.\n prog_list.delete_if { |r| RAILS_GEMS.include?(r[:name]) || r[:name].start_with?(\"aws-sdk\") || r[:name].start_with?(\"sys-proctable\") } \n\n prog_list.each { |r|\n puts \"Working on app ##{app_num}...\"\n ## HACK... have to look into these cases separately \n next if [\"libv8\", \"facter\", \"sixarm_ruby_unaccent\"].include?(r[:name])\n \n if File.directory?(\"#{DATA_DIR}/#{r[:name]}\")\n ## if data already exists for this program, then just load that data and update it.\n \n ## below commented out line uses existing json file\n #meths_hash = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{TYPE_DATA_JSON_FILE}\"))\n puts \"Found .yardoc file for app #{r[:name]}. Loading...\"\n load_yard_doc(\"#{DATA_DIR}/#{r[:name]}/.yardoc\")\n #prog_log = load_prog_log(\"#{DATA_DIR}/#{r[:name]}/log.csv\")\n app_file_hashes = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{FILE_MD5_HASHES}\"))\n file_hashes.merge!(app_file_hashes) { |k, v1, v2| v1 | v2 }\n\n ## get all YARD method data\n meths = YARD::Registry.all(:method)\n\n ## extract the data we want\n meths_hash = get_yard_meths(meths)\n\n ## store the method data in the app data (if there is any method data)\n apps_hash[r[:name]] = meths_hash if !meths_hash.empty?\n else\n ## if data doesn't already exist, generate and save it.\n \n #commit_sha = client.commits(r[:full_name], r[:default_branch])[0][:sha]\n #prog_log = [r[:name], r[:name].hash, r[:html_url], r[:default_branch], commit_sha, Time.now.getutc.to_s, \"\", \"\"]\n prog_log = get_prog_log(r)\n \n download_prog(r)\n Dir.chdir(r[:dir_name])\n\n app_file_hashes = {}\n \n ## YARD stuff here\n meth_files = []\n generate_yard_doc\n meths = YARD::Registry.all(:method)\n meths_hash = get_yard_meths(meths, meth_files)\n\n ## save to apps_hash, program log\n if !meths_hash.empty?\n apps_hash[r[:name]] = meths_hash\n CSV.open(\"../#{LOG_FILE}\", \"a+\") { |csv|\n csv << prog_log\n }\n end\n\n ## collect MD5 hashes of all files in program\n meth_files.each do |f|\n next if f.nil? || !File.file?(f)\n key = Digest::MD5.hexdigest(IO.read(f))\n ## add file hash to both this app's hashes, and overall hashes\n if app_file_hashes.has_key?(key) then app_file_hashes[key].push(f) else app_file_hashes[key] = [f] end\n if file_hashes.has_key?(key) then file_hashes[key].push(f) else file_hashes[key] = [f] end\n end\n\n \n ## save app data files, and upload compressed app to google drive\n Dir.chdir(\"..\")\n save_app_data(r[:name], meths_hash, prog_log, app_file_hashes)\n compress_and_upload(type_folder, r[:dir_name]) if USE_GOOGLE_DRIVE\n cleanup(r[:dir_name])\n end\n app_num += 1\n }\n\n ## write type data\n File.open(TYPE_DATA_JSON_FILE,\"w\") do |f|\n f.write(JSON.pretty_generate(apps_hash))\n end\n\n ## write file hashes\n File.open(FILE_MD5_HASHES, \"w\") do |f|\n f.write(JSON.pretty_generate(file_hashes))\n end\n\n return [apps_hash, file_hashes]\nend",
"def fetch_data(connection,path,definition)\n @definition=definition\n @headers = definition.data_headers\n @headers.delete_if {|x| x=='source'}\n @raw_headers=headers # headers are the full set here\n items = []\n page = 1\n while page <= AMEE::Data::Category.get(connection, \"/data#{path}\").pager.last_page do\n category = AMEE::Data::Category.get(connection, \"/data#{path}\", { 'page' => \"#{page}\" })\n category.items.each do |item|\n items << item\n end\n page += 1\n end\n parse_api_rows items\n end",
"def get_all\n @data\n end",
"def fetch\n data = WebApi.json! \"IEconItems_#{app_id}\", 'GetSchema', 1, language: language\n\n @attributes = {}\n data[:attributes].each do |attribute|\n @attributes[attribute[:defindex]] = attribute\n @attributes[attribute[:name]] = attribute\n end\n\n @effects = {}\n data[:attribute_controlled_attached_particles].each do |effect|\n @effects[effect[:id]] = effect[:name]\n end\n\n @items = {}\n @item_names = {}\n data[:items].each do |item|\n @items[item[:defindex]] = item\n @item_names[item[:name]] = item[:defindex]\n end\n\n @item_levels = {}\n data[:item_levels].each do |item_level_type|\n @item_levels[item_level_type[:name]] = {}\n item_level_type[:levels].each do |level|\n @item_levels[item_level_type[:name]][level[:level]] = level[:name]\n end\n end if data.key? :item_levels\n\n @item_sets = {}\n data[:item_sets].each do |item_set|\n @item_sets[item_set[:item_set]] = item_set\n end\n\n @origins = []\n data[:originNames].each do |origin|\n @origins[origin[:origin]] = origin[:name]\n end\n\n @qualities = []\n data[:qualities].keys.each_with_index do |key, index|\n @qualities[index] = data[:qualityNames][key] || key.to_s.capitalize\n end\n end",
"def get_drivers\n return return_all_drivers\n end",
"def versions(name) # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + name\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n lines(str).each do |ver|\n number, platform, dependencies, requirements = parse_gem(ver)\n\n platform ||= \"ruby\"\n dependencies = dependencies.map {|dep_name, reqs| [dep_name, reqs.join(\", \")] }\n requirements = requirements.map {|req_name, reqs| [req_name.to_sym, reqs] }.to_h\n\n @data[name] << { name: name, number: number, platform: platform, dependencies: dependencies, requirements: requirements }\n end\n\n @data[name]\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 name; @gem_data[\"name\"]; end",
"def run\n build_report if self.class.needs.all? { |l| library_available?(l) }\n data_for_server\n end",
"def fetch\n end",
"def build_gems; end",
"def index\n @ruby_gems = RubyGem.all\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def collect_module_data\n return unless collect_module_exists?\n collect_keys.each do |key|\n mod_array = collect_module[key]\n next if mod_array.blank?\n collect_module_data_for(key, mod_array)\n end\n end",
"def list(all = false)\n list = {}\n\n file = all ? 'specs' : 'latest_specs'\n\n Gem.sources.each do |source_uri|\n source_uri = URI.parse source_uri\n\n if all and @specs.include? source_uri then\n list[source_uri] = @specs[source_uri]\n elsif @latest_specs.include? source_uri then\n list[source_uri] = @latest_specs[source_uri]\n else\n specs = load_specs source_uri, file\n\n cache = all ? @specs : @latest_specs\n\n cache[source_uri] = specs\n list[source_uri] = specs\n end\n end\n\n list\n end",
"def call\n timer do\n fetch_gems_data\n GemsBond::Printers::HTML.new(gems).call\n GemsBond::Printers::CSV.new(gems).call\n end\n end",
"def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end",
"def download_people_data\n print \"Getting IDs of articles about people...\\n\"\n PeopleGetter.new([MEN_URL, WOMEN_URL]).result\n end",
"def prefetch(reqs)\n return unless @specs.empty?\n\n @repositories.each do |name, (repository, reference)|\n source = Gem::Source::Git.new name, repository, reference\n source.root_dir = @root_dir\n source.remote = @remote\n\n source.specs.each do |spec|\n git_spec = Gem::Resolver::GitSpecification.new self, spec, source\n\n @specs[spec.name] = git_spec\n end\n end\n end",
"def fetch_apis_asynchronously \n threads = []\n threads << Thread.new { @resp1 = RestClient.get 'https://reqres.in/api/unknown' }\n threads << Thread.new { @resp2 = RestClient.get 'https://reqres.in/api/products' }\n threads.each { |thr| thr.join } \n end",
"def fetch(&block)\n query = Tipjar.query\n query.find do |tipjars, error|\n @table_data = [{\n cells: tipjars.map do |tipjar|\n {\n title: tipjar.name,\n action: :view_tipjar,\n arguments: { tipjar: tipjar }\n }\n end\n }]\n\n block.call if block\n end\n end",
"def core_fetch_dependency(package_name, vers, type, verbose)\n prerelease = false\n if vers == '>= 0-pre'\n prerelease = true\n vers = '>= 0'\n else\n prerelease = vers =~ /[a-zA-Z]/\n end\n\n dep = LibGems::Dependency.new(package_name, vers, type)\n cur_installed = LibGems.source_index.search(dep)\n\n begin\n installed = BPM::Remote.new.install(package_name, vers, prerelease)\n rescue LibGems::GemNotFoundException\n # If we have it locally but not remote, that's ok\n installed = []\n end\n\n cur_installed.each do |ci|\n installed.reject! { |i| ci.name == i.name && ci.version == i.version }\n end\n\n installed.each do |i|\n say \"~ Fetched #{i.name} (#{i.version}) from remote\"\n end\n\n end",
"def core_fetch_dependencies(deps, verbose)\n deps.each do |pkg_name, pkg_version|\n core_fetch_dependency pkg_name, pkg_version, :runtime, verbose\n end\n end",
"def fetch\n service = Diplomat::Service.get('resources')\n url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # if Rails.env.production?\n # service = Diplomat::Service.get('resources')\n # url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # else\n # url = 'http://localhost:3001/'\n # end\n conn = Faraday.new(url: url) do |faraday|\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n self.send(\"fetch_#{self.type}\", conn)\n end",
"def fetch_modules(definition, packages: [], download: nil)\n if download\n download_modules(definition, packages: packages)\n else\n local_files(definition, packages: packages)\n end\n end",
"def list\n @parent.gemset_list\n end",
"def find_all(req)\n res = []\n\n return res unless @remote\n\n if @to_fetch.include?(req.name)\n prefetch_now\n end\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number], @prerelease\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end",
"def get_data(contexts=[\"all\"])\n synchronize do\n \n # Prepares the URL to request the data\n context = contexts.map{|context| \"context=#{context}\"}*\"&&\"\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?#{context}\"\n\n # Asks for the data\n ntriples = RestClient.get dir, :content_type=>select_type\n\n # Makes the graph to return.\n Parser.parse(:rdf, ntriples)\n end\n\t \tend",
"def find_user_modules(username)\n module_array = []\n modules = PuppetForge::Module.where(owner: username) # The object will be used to return all user module data\n modules.unpaginated.map do | mod | # unpaginated results allow us to work with all module data on a single page\n username = mod.owner.username \n name = mod.name # The data retrieved from the methods are collected in each parameter\n downloads = mod.downloads # each method are related to parameters retrieved from the Forge API \n module_array << {\n name: name,\n downloads: downloads,\n username: username\n }\n end\n # binding.pry\n return module_array\nend",
"def load_data\n @promotions = Promotion.find(:all)\n @products = Product.find(:all, :conditions => ProductFilter.website_conditions(@website))\n end",
"def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end",
"def get_list_beshared_libraries\n JSON.parse(curl_get(\"beshared-repos/\").body_str)\n end",
"def all_gems()\n self.sort.collect {|k,g| g }\n end",
"def run\n process_args\n announcements\n results = get_gem_list_info.map {|gem| gem.join(\",\")}.join(\"\\n\")\n IO.write(@output, results)\n end",
"def fetchModules\n puts \"Fetching Modules\"\n #direct url to gradeTable\n url = @baseUrl + 'state=htmlbesch&moduleParameter=Student&menuid=notenspiegel&breadcrumb=notenspiegel&breadCrumbSource=menu&asi='\n # pp @sessionId\n gradePage = @agent.get(url + @sessionId)\n\n #fetch curriculum for creditpoints\n #curriculum = agent.get('http://web-1k.rz.fh-wiesbaden.de/bachelorcurriculum.cfm?fb=22&sprachid=1&sid=103&poid=93&detail=ja').body\n\n doc = Hpricot(gradePage.body)\n table = doc.at(\"//table[2]\")\n rows = (table/\"tr\")\n \n modules = []\n \n (1...rows.length).to_a.each do |i|\n size = (rows[i]/\"td\").size\n cells = (rows[i]/\"td\")\n \n #TODO insert debug/log code\n mod = Modul.new(cells[0],cells[1],cells[2],cells[3],cells[4],cells[5],cells[6],cells[7])\n modules.push mod\n end \n puts \"Fetched \" + modules.length.to_s + \" modules\"\n return modules\n end",
"def clouddata!\n\n # Collect all application ids, skipping any invalid ones\n ids = apps.collect do |app|\n app.id\n end.compact\n\n # Queries Apple's iTunes Store API for latest cloud data using undocumented bulk method\n response = Net::HTTP.get('itunes.apple.com', '/lookup?id=' + ids.join(','))\n results = JSON.parse(response)['results']\n results.each do |result|\n if app = get(result['trackId'] || -1)\n app.clouddata = result\n end\n end\n end",
"def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end",
"def fetch\n notify \"Downloading...\"\n @strategy.fetch\n extract\n end",
"def get_drivers\n drivers\n end",
"def each\n loop do\n data = fetch\n\n if data\n yield data\n else\n break\n end\n end\n end",
"def fetch_latest_everything\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\t\t@task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items\n\t\t@tasks = Hash.new\n\t\t@task_lists.each do |list|\n\t\t\t@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def tools_all\n @work_order_tools = WorkOrderTool.by_id\n render json: serialized_work_order_tools(@work_order_tools)\n end",
"def download_article_data\n print \"Getting list of articles...\\n\"\n ArticleGetter.new([ARTICLE_SOURCE]).result\n end",
"def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end",
"def all\n load_clients\n load_preferences\n end",
"def gemsets\n @parent.list_gemsets\n end",
"def fetch_loaded_json()\n load_albums()\n # now update the cache state in the cache db\n # update the cache state and set the json and version for each loader\n loader.update_cache_state(false)\n\n # and return the albums\n return json\n end"
] |
[
"0.68294436",
"0.6725108",
"0.6156221",
"0.6070934",
"0.5985889",
"0.5914395",
"0.58899057",
"0.5846923",
"0.5840874",
"0.5831891",
"0.5726342",
"0.5714451",
"0.5713304",
"0.57059944",
"0.5692749",
"0.5676398",
"0.5673906",
"0.5651266",
"0.5651266",
"0.5643925",
"0.5622125",
"0.56119096",
"0.56119096",
"0.56119096",
"0.56070393",
"0.5600939",
"0.55998284",
"0.5590571",
"0.5590571",
"0.5565325",
"0.5551935",
"0.55117536",
"0.5497386",
"0.5492605",
"0.5479289",
"0.54746985",
"0.54728997",
"0.54712945",
"0.54686666",
"0.54629934",
"0.54581606",
"0.54508334",
"0.54445034",
"0.54411024",
"0.5420483",
"0.5403998",
"0.5402919",
"0.53990525",
"0.5398175",
"0.53947157",
"0.53920484",
"0.5382186",
"0.5378483",
"0.5358025",
"0.5356525",
"0.5342455",
"0.53396815",
"0.5336913",
"0.5333577",
"0.53290075",
"0.5324759",
"0.5321207",
"0.5319838",
"0.531625",
"0.53091294",
"0.53070223",
"0.5301561",
"0.5295845",
"0.52955425",
"0.52763504",
"0.5273814",
"0.52733195",
"0.5270527",
"0.5265018",
"0.524353",
"0.52410847",
"0.5239756",
"0.52325433",
"0.52303576",
"0.5221502",
"0.5218685",
"0.52156204",
"0.52095515",
"0.5202411",
"0.5199922",
"0.5199661",
"0.51954126",
"0.5191593",
"0.5183491",
"0.51832664",
"0.5182065",
"0.51709324",
"0.5168475",
"0.5165272",
"0.51569605",
"0.5153993",
"0.51510346",
"0.51477253",
"0.5139715",
"0.5135604"
] |
0.8024932
|
0
|
Starts a thread to process the given gem
|
def gem_thread(gem)
Thread.new do
begin
retries ||= 0
# set verbose to true to stdout the gem name
gem.prepare_data(verbose: true)
# rescue SocketError, Faraday::ConnectionFailed...
rescue StandardError
(retries += 1) <= RETRIES ? retry : nil
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end",
"def start!\n start\n blocking_thread.join\n end",
"def start\n return if @thread\n @thread = Thread.new do\n loop do\n sleep\n load_files\n end\n end\n end",
"def thread(&block)\n warn 'A Block is Needed' unless block_given?\n Java::JavaLang::Thread.new(&block).start\n end",
"def start\n return unless @state == :stopped\n @stop_requested = false\n @thread = Thread.new do\n process\n end\n\n @state = :started\n end",
"def install_gem; end",
"def start!\n process.start\n end",
"def start\n start_thread\n wait(20) # This so that you wait until either the step is done or 20 seconds is up.\n # It doesn't have to wait the whole 20 seconds if the step finishes quickly.\n end",
"def start\n @mthread = monitor\n end",
"def thread; end",
"def thread; end",
"def thread; end",
"def start_thread\n @thread = @options[:sync] || Thread.new do\n begin\n loop do\n @status = :waiting_for_event\n process_event\n @event_queue.wait_for_new_event\n end\n rescue => e\n CFSM.logger.fatal \"#{e.class}: #{$!}\"\n Thread.main.raise e\n end\n end\n end",
"def thread\n @thread ||= Thread.new(sys) do |sys|\n eval(code)\n end\n end",
"def start(name, &block)\n\t\t\t\tThread.fork(name: name, &block)\n\t\t\tend",
"def install_gem\n Juwelier::Commands::InstallGem.build_for(self).run\n end",
"def start_monitor\n @thread = Thread.start { monitor }\n end",
"def start_framework\n @fw_thread = Thread.new do\n begin\n load(File.join(ROOT, 'main.rb'))\n rescue\n LOG.puts(\"Exception encountered - #{$!.message}\")\n LOG.puts($!.backtrace.join(\"\\n\"))\n end\n end\n end",
"def start\n\t\t\t@thread = Thread.new do\n\t\t\t\twhile true\n\t\t\t\t\tupdate\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def start\n activate\n @process_should_stop_mutex.synchronize do\n @process_should_stop = false\n end\n process_worker_thread\n process_monitor_thread\n end",
"def start\r\n\t\t\tswdebug 'Started new thread for message processing.'\r\n\t\t\t# Start a new child Thread\r\n\t\t\t@thread = Thread.new {\r\n\t\t\t\tloop do\r\n\t\t\t\t\titems = process\r\n\t\t\t\t\tif items == 0\r\n\t\t\t\t\t\tsleep(0.1)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tswdebug \"Processing #{items} items\"\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t}\t\t\t\t\r\n\t\tend",
"def starter\n @starter = Thread.new do\n sleep_interval(60)\n yield # starter proc in :start \n end\n end",
"def start_threaded_shell(shell)\n @thread = Thread.new do\n start_shell(shell)\n end\n end",
"def start_worker_thread\n @worker_threads << ControllableThread.new(@name + \"-worker\") {yield}\n end",
"def start\n @thread = Thread.new &@block\n @thread.eldritch_task = self\n end",
"def start\n @client.ping\n @state.set :run\n @thread ||= Thread.new{ work_loop }\n end",
"def starting(worker)\n end",
"def start\n EM.synchrony do\n run\n end\n end",
"def call\n if gem.exist?\n gem.prepare_data(keys: PRELOAD_KEYS, concurrency: false)\n GemsBond::Printers::Stdout.new(gem).call\n else\n puts \"Sorry, this gem could not be found!\"\n end\n end",
"def run(&block)\n unless @work = block\n raise ArgumentError, \"Usage: run { while_we_have_the_lock }\"\n end\n @shutdown = false\n @restart = false\n install_plugins\n startup # typically daemonizes the process, can have various implementations\n on_load.call(self) if on_load\n run_loop(&@work)\n on_exit.call(self) if on_exit\n shutdown\n end",
"def thread()\n #This is a stub, used for indexing\n end",
"def initialize(&blk)\n self.future_thread = Thread.new(&blk)\n end",
"def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_on_exception = true\n end\n end",
"def start_driver\n loop_thread = Thread.new { loop }\n start_listener\n loop_thread.kill!\n end",
"def processSysGem(args, successMsg='Successed', failMsg='Failed', &block)\n processStartCmds(GemCmd.suCmds + args, successMsg, failMsg, &block)\n end",
"def gem_build_task(gem,namespace_name=:gems)\n namespace(namespace_name) do\n gem_dir = CapyBrowser::Rake::RelativePath.new('tmp/gems').path\n directory gem_dir\n\n desc gem.build_description\n task :build => [:directories,gem.name.to_sym ] do |t|\n t.reenable\n end\n\n desc \"Build all gems\"\n task :rebuild do |t|\n rm_rf(gem_dir)\n Rake::Task[\"gems:build\"].reenable\n Rake::Task[\"gems:build\"].invoke\n end\n\n desc gem.build_gemfile_description\n task gem.name.to_sym => [gem.gemfile] do |t|\n t.reenable\n end\n\n file \"tmp/vendor/cache/#{gem.gemfile}\" => [gem.gemfile_path.relative_path]\n file gem.gemfile_path.relative_path => gem.gemfile\n file gem.gemfile => gem_dir do |t|\n puts gem.invoke!\n rm_rf(gem_dir)\n end\n end\nend",
"def build_gem; end",
"def start_in_background\n Thread.start { start }\n end",
"def start\n until @done\n json = retrieve_hook\n HookRunner.new(json) if json\n end\n end",
"def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end",
"def run!\n @thread && @thread.alive? ? @thread : start!\n end",
"def series\n Thread.new do\n begin\n activity = get_activity\n analyzer = get_analyzer\n activity.process\n analyzer.process\n rescue => e\n Rails.logger.debug e.backtrace.to_s + \" ----- \" + e.to_s\n ensure\n # do something\n end\n end\n msg = { :success => true, :message => \"Please wait while we process the repository!\" }\n end",
"def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\n end",
"def start\n self.join if @running\n @running=true\n @thread = Thread.new do\n while @running\n block=self.pop\n @processing=true\n block.call\n @processing=false\n end\n end\n end",
"def start\n prepare\n loop do\n git_poller.poll\n sleep ws.config.daemon_polling_period\n end\n end",
"def run\n env_args = @system_env ? [@system_env] : []\n options_args = @system_options ? [@system_options] : []\n system_args = [*env_args, *Rscons.command_executer, *@command, *options_args]\n\n @thread = Thread.new do\n system(*system_args)\n end\n end",
"def _start_new_worker(worker)\n Thread.new do\n worker.work\n end\n end",
"def install_gem(gem_name)\n if gem_name.match(/getopt/)\n install_name = \"getopt\"\n else\n install_name = gem_name.gsub(/\\//,\"-\")\n end\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{gem_name}\"\nend",
"def processUserGem(args, successMsg='Successed', failMsg='Failed', &block)\n args.push('--user-install')\n processStartCmds(GemCmd.locCmds + args, successMsg, failMsg, &block)\n end",
"def start\n yield self if block_given?\n classpath = self.classpath.is_a?(Array) ? self.classpath : []\n start_process(classpath)\n end",
"def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end",
"def start(tar_file, ¬ifier)\n raise 'busy' if busy?\n\n read_exit_time\n nuke_work_dir!\n @notifier = notifier\n FileUtils.mv(tar_file, task_tar_path)\n\n @plugin_images = @plugin_manager.run_hook(:extra_images, :instance => self).reduce({}, &:merge)\n\n @plugin_manager.run_hook(:before_exec, :instance => self, :tar_file => task_tar_path)\n\n file_locks = @plugin_images.map {|name, path|\n if name.to_s =~ /^(ubd.)c?(r?)c?$/\n lock_type = if $2 == 'r' then File::LOCK_SH else File::LOCK_EX end\n [path, lock_type]\n else\n raise \"Invalid plugin image name: #{name}\"\n end\n }\n\n @instance.set_options({\n :disks => @plugin_images.merge({\n :ubdarc => Paths.rootfs_path,\n :ubdbr => task_tar_path,\n :ubdc => output_tar_path\n }),\n :file_locks => file_locks,\n :mem => @settings['instance_ram'],\n :network => network_devices,\n :timeout => @settings['timeout'].to_i,\n :vm_log => vm_log_path\n })\n\n @instance.start\n end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def start_interrupter_thread()\r\n interrupter_tracepoint_init() if @auto_mode == :full\r\n @interrupter_thread = Thread.new() {interrupter_loop()}\r\n @interrupter_thread.priority = 1\r\n end",
"def start\n if spawner?\n register_spawn_hooks\n else\n register_job_hooks\n logger.info(\"Starting poller\")\n @pending = true\n at_exit { sync }\n unless Thread.new { poll }\n logger.error(\"Couldn't start poller thread\")\n end\n end\n end",
"def launch(cmd, &block)\n\t\tself.class.launch(cmd, &block)\n\tend",
"def start\n _init_actors\n unpause\n @stopping = false\n registry[:adapter].async.start\n Thread.new { _wait_for_changes }\n end",
"def start\n while not @entity_thread.stop?\n Kernel.sleep 0.1\n end\n\n @stopped = false \n @entity_thread.run\n end",
"def start(text_buffer)\n print \"Starting service \\\"#{@name}\\\"\\n\" if BASE_SERVICE_DEBUG\n @my_thread = Thread.new {\n do_abort = false\n while (!do_abort)\n @launch_time = Time.new.to_i\n begin\n print \"Starting internal \\\"#{name}\\\" thread\\n\" if BASE_SERVICE_DEBUG\n start_internal(text_buffer) \n print \"Finished internal \\\"#{name}\\\" thread\\n\" if BASE_SERVICE_DEBUG\n rescue => e\n print \"Thread \\\"#{name}\\\" got exception\\n\"\n timestamp = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n print \"#{timestamp}: Service thread \\\"#{@name} has died!\\n\"\n print \"#{e.to_s}\\n\"\n print \"#{e.backtrace}\\n\"\n now = Time.new.to_i\n # If it's been running for a while (5+ minutes), give it some\n # retries. If it's been less than that, increment the retry count\n if now - @launch_time > 5 * 50\n @error_count = 0\n else\n @error_count += 1\n end\n # Too many retries leads to error\n if @error_count > 3\n errored(text_buffer, e)\n do_abort = true\n end\n rescue\n print \"#{timestamp}: Service thread \\\"#{@name} has died!\\n\"\n print \"Unknown exception occurred\\n\"\n ensure\n print \"#{timestamp}: Service thread \\\"#{@name} has exited.\\n\"\n end\n end\n }\n end",
"def run\n start\n jetty.join\n end",
"def start()\n\t\t_start\n\t\tpossibly_self_provision()\n\tend",
"def start\n\n @stopped = false\n\n @scheduler_thread = Thread.new do\n\n Thread.current[:name] = @thread_name\n\n if defined?(JRUBY_VERSION)\n require 'java'\n java.lang.Thread.current_thread.name = @thread_name\n end\n\n loop do\n\n break if @stopped\n\n t0 = Time.now.to_f\n\n step\n\n d = Time.now.to_f - t0 # + @correction\n\n next if d > @precision\n\n sleep(@precision - d)\n end\n end\n end",
"def start_worker(build_id:, suite:, worker_id: rand_id)\n Process.spawn(\n \"#{EXEC_CMD} -w #{worker_id} -b #{build_id}\",\n chdir: suite_path(suite),\n out: (ENV[\"RSPECQ_DEBUG\"] ? :out : File::NULL)\n )\n end",
"def start_rating_run\n @rating_run.process\n end",
"def start_run; end",
"def start(*args)\n if @thread.nil? then\n @thread = Thread.start { @daemon.run(*args) }\n end\n end",
"def start!\n start\n wait_until_terminated(nil)\n end",
"def start\n @mutex.synchronize do\n return if @run\n @run = true\n Tracer.log.debug(\"Starting thread in the process: #{Process.pid}\")\n @worker = Thread.new { perform }\n end\n end",
"def start\n mutex.synchronize do\n return unless stopped\n @stopped = false\n end\n\n start_worker\n start_poller\n end",
"def start_broker()\n\n Thread.new do\n `ruby -r 'simplepubsub' -e \"SimplePubSub::Broker.start port: '55000'\"`\n end\n\n end",
"def start(feature=nil)\n result_io = ResultIO.new\n op_group = nil\n if feature.nil?\n op_group = PendingAppOpGroup.new(op_type: :start_app, user_agent: self.user_agent)\n else\n op_group = PendingAppOpGroup.new(op_type: :start_feature, args: {\"feature\" => feature}, user_agent: self.user_agent)\n end\n Application.run_in_application_lock(self) do\n self.pending_op_groups.push op_group\n self.run_jobs(result_io)\n result_io\n end\n end",
"def initialize( gem, arch )\n @gem = gem\n @arch = arch\n end",
"def gem(options=\"\")\n cmd = \"#{Gem.ruby} #{@ruby_options} #{@gem_path} #{options}\"\n system cmd\n end",
"def start\n before_start if respond_to? :before_start\n\n wthreads = if threads <= 1 then [run_thread]\n elsif workers <= 1 then standard_worker\n else wthreads = Array.new(workers){ |i| spawn_worker i } end\n\n after_start if respond_to? :after_start\n\n %i[INT TERM].each{ |sig| trap(sig){ stop } }\n wthreads.each(&:join) if workers > 1\n\n rescue => error\n error(error)\n end",
"def start\n @worker.start\n end",
"def spawn_thread\n Thread.new do\n while true\n x = @queue.shift\n if x == Directive::SUICIDE_PILL\n \t@worker_threads_count.decrement\n \tThread.current.terminate\n end\n Thread.pass\n begin\n x.job.call(x)\n rescue StandardError => e\n $stderr.puts \"Threadz: Error in thread, but restarting with next job: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n @worker_threads_count.increment\n end",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def start\r\n @proc.call\r\n end",
"def start(name, &block)\n\t\t\t\tProcess.fork(name: name, &block)\n\t\t\tend",
"def start!\n Signal.trap(\"INT\") { printer.done; exit }\n\n queue = Test.all_tests\n threads = (thread_count-1).times.map { |i| Thread.new { worker!(queue, i+1) } }\n\n worker!(queue, 0)\n threads.join\n\n printer.done\n end",
"def install\r\n super\r\n automated_install {\r\n @local_gems.flush_gem_cache\r\n gem_name = @override_gem_name.nil? ? installed_as_name_for( self.gem_short_name ) : @override_gem_name\r\n installed_gem = @local_gems.find( gem_name )\r\n fails_to_load gem_name if installed_gem.nil?\r\n installed_gem.activate\r\n }\r\n end",
"def run_input_thread; end",
"def inputs_thread_start\n EventMachine.run do\n @inputs.each do |plugin|\n # Tell EventMachine to watch the plugin source\n EventMachine::FileGlobWatchTail.new(plugin.source) do |emtail, entry| \n begin\n plugin.receive_data(entry) \n rescue Exception => e\n puts \"Exception: #{e}\"\n end\n end\n end\n end\n puts \"EventMachine exiting\"\n end",
"def start_poller\n @poller_thread = Thread.new { poll_changed_directories }\n end",
"def start\n return if @run\n @run = true\n @worker = Thread.new() do\n Datadog::Tracer.log.debug(\"Starting thread in the process: #{Process.pid}\")\n @last_flushed_services = nil\n next_send_services = Time.now\n\n # this loop assumes spans are flushed more often than services\n while @run\n callback_traces\n if Time.now >= next_send_services\n next_send_services = Time.now + @service_interval\n callback_services\n end\n sleep(@span_interval)\n end\n end\n end",
"def start\n loop do\n run\n end\n end",
"def start(*)\n @module_started = true\n end",
"def execute_next_line\n thread.run if thread.alive?\n end",
"def start!\n \t@initial_queue = Dispatch::Queue.current\n event :start\n end",
"def initialize\n @thread = Thread.new { loop { process_queue } }\n end",
"def start\n\t\t@quorum.start\n\n\t\t@dispatch_thread = Thread.new do\n\t\t\tbegin\n\t\t\t\tloop do\n\t\t\t\t\tselect_ready = select([@cpg.fd, @quorum.fd], [], [])\n\t\t\t\t\tif select_ready[0].include?(@quorum.fd) then\n\t\t\t\t\t\t@quorum.dispatch\n\t\t\t\t\tend\n\t\t\t\t\tif select_ready[0].include?(@cpg.fd) then\n\t\t\t\t\t\t@cpg.dispatch\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t# something happened that we don't know how to handle. We need to bail out.\n\t\t\t\t$stderr.write \"Fatal exception: #{e.to_s} (#{e.class})\\n#{e.backtrace.join(\"\\n\")}\\n\"\n\t\t\t\texit(1)\n\t\t\tend\n\t\tend\n\tend",
"def run &block\n worker = launch &block\n exit worker.wait\n end",
"def start\n return if @thread\n @thread = Thread.start do\n @fd = Inotify.init\n \n @watchers.each do |watch|\n watch.add_watch(@fd)\n end\n\n @filePtr = FFI::IO.for_fd(@fd)\n while true\n debug \" [+] @watch_thread listening for inotify events\"\n \n buffer = FFI::Buffer.alloc_out(Inotify::Event.size + 4096, 1, false)\n event = Inotify::Event.new buffer\n ready = IO.select([@filePtr], nil, nil, nil)\n n = Inotify.read(@fd, buffer, buffer.total)\n\n event_wd = event[:wd]\n event_mask = event[:mask]\n event_len = event[:len]\n\n debug \" [+] meta event message ignored.\" and next if event_len == 0\n \n # the filename is set after the event datastructure(16 bytes fixed)\n event_file = buffer.get_string(16) # 16 bytes offset\n\n debug \" [+] raw event notification wd(#{event_wd.inspect}) \" + \n \"len(#{event[:len]}) mask(#{event_mask}) \" +\n \"subject(#{event_file.inspect})\"\n\n @watchers.each do |watch|\n # process only if watch descriptor matches\n if event_wd == watch.wd\n watch.process(event_mask, event_file, @notify_targets)\n end\n end\n end\n debug \" [+] the watch thread is terminated.\"\n end # end thread\n end",
"def start\n # clear work and timeout queues?\n @pool_lock.synchronize {\n @terminate = false\n launch_manager\n 0.upto(@num_threads) { |i| launch_worker }\n }\n end",
"def processSelectGem(args, locFlag, successMsg='Successed', failMsg='Failed', &block)\n if locFlag then\n processUserGem(args, successMsg, failMsg, &block)\n else\n processSysGem(args, successMsg, failMsg, &block)\n end\n end",
"def start\n extract_and_configure\n if config.managed?\n @pid = spawn(config.env, *process_arguments)\n\n # Wait for fcrepo to start\n while !status\n sleep 1\n end\n end\n end",
"def start *args\n return self if attached? or running?\n @pid = ::Process.spawn Nutcracker.executable, *command\n Process.detach(@pid)\n sleep 2\n raise \"Nutcracker failed to start\" unless running?\n Kernel.at_exit { kill if running? }\n self\n end",
"def install_gem(gem_built_name)\n execute(:install_gem, \"gem install #{gem_built_name}\")\n end",
"def install(gem)\n version = gem['version'] == '> 0' ? '' : \"#{gem['version']} \"\n Utils.message \"\\n\"\n if preinstalled?(gem)\n Utils.message \"-----> Skipping #{gem['name']} #{version} - this gem is installed by default on Heroku\\n\"\n else\n proxy = Utils.slot =~ /codex/ ? \"--http-proxy http://localhost:3128\" : \"\"\n command = [\n \"export PATH=#{@slug.ruby_path};\",\n \"export GEM_HOME=#{@slug.gems_build_dir};\",\n \"gem install\",\n escape(gem['name']),\n proxy,\n \"--no-ri\",\n \"--no-rdoc\",\n \"--version=#{escape(gem['version'])}\",\n gem['source'].map {|s| \"-s #{escape(s)}\"}.join(\" \"),\n (\"--ignore-dependencies\" if gem[\"ignore-dependencies\"])\n ].compact.join(\" \")\n Utils.message \"-----> Installing gem #{gem['name']} #{version}from #{gem['source'].join(\", \")}#{\" and ignoring dependencies\" if gem['ignore-dependencies']}\\n\"\n exec_gem_install_command(command)\n end\n end",
"def run_start(version)\n puts \"starting chef, version #{version}\"\n end"
] |
[
"0.5795017",
"0.5713603",
"0.5627765",
"0.5621165",
"0.5576527",
"0.550631",
"0.54878664",
"0.54672587",
"0.5458609",
"0.54413325",
"0.54413325",
"0.54413325",
"0.5439998",
"0.543228",
"0.539618",
"0.5371561",
"0.53276306",
"0.531175",
"0.5305174",
"0.5288762",
"0.52602357",
"0.52321136",
"0.51890796",
"0.51872003",
"0.5181106",
"0.51755506",
"0.516583",
"0.5095395",
"0.5089118",
"0.50855935",
"0.50725484",
"0.506301",
"0.50594825",
"0.50574577",
"0.5050204",
"0.50464904",
"0.50460774",
"0.503601",
"0.50215846",
"0.5020568",
"0.50197303",
"0.5018651",
"0.5004391",
"0.5001608",
"0.49900103",
"0.49850607",
"0.49822435",
"0.4980758",
"0.49781236",
"0.4971908",
"0.4970046",
"0.4967874",
"0.49619332",
"0.4960765",
"0.49542302",
"0.49538228",
"0.49487725",
"0.49461582",
"0.49406895",
"0.49384147",
"0.49351114",
"0.49344626",
"0.49305812",
"0.4923542",
"0.49194196",
"0.49167892",
"0.49129215",
"0.4907983",
"0.49072292",
"0.4906463",
"0.4904131",
"0.49004173",
"0.48985156",
"0.48915035",
"0.4886013",
"0.48844704",
"0.48818633",
"0.48763892",
"0.487554",
"0.4874286",
"0.48720947",
"0.4866262",
"0.4863902",
"0.48638806",
"0.4862696",
"0.48619068",
"0.48442107",
"0.4837542",
"0.48364893",
"0.4833286",
"0.4828234",
"0.48256284",
"0.48216015",
"0.4816981",
"0.48166102",
"0.48135096",
"0.48114932",
"0.48109636",
"0.4802364",
"0.47991806"
] |
0.75423545
|
0
|
For new/create if a resource is going to be appended to a parent, the permissions should be based on the ability to update the parent it's going to be appended to. Enables users who only have permission to add to a single Ephemera Project.
|
def authorize_create!(change_set:)
if change_set.append_id.present?
authorize! :update, query_service.find_by(id: Array(change_set.append_id).first)
else
authorize! :create, resource_class
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:project_id) and params.key?(:permissions)\n project = Project.find_by(id: params[:project_id])\n target_user = nil\n user_needs_placeholder = false\n\n if params[:permissions].key?(:user_id)\n target_user = User.find_by(id: params[:permissions][:user_id])\n elsif params[:permissions].key?(:user_email)\n target_user = User.find_by(email: params[:permissions][:user_email])\n user_needs_placeholder = true unless target_user\n else\n error = \"No user specified.\"\n end\n\n if project and (target_user or user_needs_placeholder)\n\n if target_user and target_user == @current_user\n error = \"User permissions may not be modified.\"\n elsif project and user_can_access_project(project.id, [:can_author])\n\n p = params.require(:permissions).permit(\n :can_author, :can_view, :can_annotate)\n\n ## Decide whether the user_id or user_email field will be used.\n if target_user\n p[:user_id] = target_user.id\n else\n p[:user_email] = params[:permissions][:user_email]\n end\n\n ## Authors get full permissions.\n if get_with_default(p, :can_author, 'false') == 'true'\n p[:can_view] = 'true'\n p[:can_annotate] = 'true'\n ## Annotators get at least viewing and annotation permissions.\n elsif get_with_default(p, :can_annotate, 'false') == 'true'\n p[:can_view] = 'true'\n p[:can_author] = 'false'\n else\n p[:can_view] = 'true'\n p[:can_author] = 'false'\n p[:can_annotate] = 'false'\n end\n\n p[:project_id] = project.id\n\n begin\n permissions = ProjectPermission.create(p)\n rescue\n end\n error = \"Error updating permissions.\" unless permissions\n end\n else\n ## DEBUG\n #error = \"project missing or (target_user missing or user_needs_placeholder false)\"\n end\n else\n ## DEBUG\n #error = \"project_id or permissions missing\"\n end\n\n if permissions\n render json: permissions, serializer: ProjectPermissionSerializer,\n root: \"permissions\"\n else\n render_error error\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def enforce_new_permissions(opts={})\n enforce_create_permissions(opts)\n end",
"def only_create\n if !@user.is_project_create\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n # only admin can change anyone project\n if !@user.admin? && params[:owner_id] && params[:owner_id] != @user.id\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n true\n end",
"def only_create\n if !@user.is_project_create\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n # only admin can change anyone project\n if !@user.admin? && params[:owner_id] && params[:owner_id] != @user.id\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n true\n end",
"def create_permissions\n # initial_step is a controller action on some resources for creation...\n if user_groups.include?(HYHULL_USER_GROUPS[:content_creator]) || \n user_groups.include?(HYHULL_USER_GROUPS[:content_access_team]) || \n @current_user.admin?\n can [:initial_step, :create], :all\n end\n\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end",
"def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end",
"def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def has_permission_to_add_content(user, parent, content)\n return true if user.can_add_root_content?\n return false if parent.blank?\n parent.can_add_content?(user)\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def f_create(user)\n\t\tuser.projects << self\n\tend",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def can_edit?(project)\n current_user.id == project.created_by\n end",
"def create?\n record.resourceable.owner == user || user.is?(:admin)\n end",
"def can_add?\n project = Project.find(params[:project_id])\n\n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end",
"def allow_edit(user)\n permission = self.content_permissions.by_user(user).first\n if !permission # Make sure the user is only added once\n permission = self.content_permissions.create(:user => user)\n end\n permission\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:create], Collection\n can [:discover], Hydra::AccessControls::Embargo\n can [:discover], Hydra::AccessControls::Lease\n can [:create], [ CurationConcerns.config.curation_concerns ]\n can [:destroy], ActiveFedora::Base\n can [:permissions], [ CurationConcerns.config.curation_concerns ]\n end\n\n # Limits deleting objects to a the admin user\n #\n #if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n #end\n\n if current_user.has_role?('collection.manager')\n # can [:create, :show, :index, :edit, :update, :destroy], Collection\n can [:create], Collection\n end\n\n if current_user.has_role?('collection.depositor') or current_user.has_group_role?('collection.depositor')\n # can [:create, :show, :index, :edit, :update, :destroy], [ CurationConcerns.configuration.curation_concerns ]\n can [:create], [ CurationConcerns.config.curation_concerns ]\n # can [:show], Collection\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def create_project_permission(user, project, permission)\n # Keep backward compatibility of our old permission names\n # TODO is this in the right place or should we remove from this helper?\n if permission == USER\n permission = EDITOR\n end\n\n fields = {\n :project => project,\n :user => user,\n :role => permission\n }\n @rally.create(:project_permission, fields) if @create_flag\n end",
"def perm_ancestors\n super + [parent_resource]\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def define_user_privileges(user)\n # Projects\n can :create, Project\n can [:read, :save, :activate], Project, owner: user\n can :read, Project do |project|\n project.confirmation_approver? user\n end\n\n can :destroy, Project, owner: user, state: :active\n can :destroy, Project, owner: user, state: :inactive\n can :destroy, Project, owner: user, state: :unconfirmed\n\n # Note: this 'update' refers to the Update and Edit actions of ProjectsController,\n # not the ability to create Update objects associated with a project\n can :update, Project, owner: user, can_edit?: true\n\n can :create, Update do |update|\n update.project.can_update? and\n update.project.owner == user\n end\n\n can :destroy, Video do |video|\n video.project.owner = user\n end\n\n can :create, Comment if user.id\n can :destroy, Comment do |comment|\n comment.user == user and comment.body != \"comment deleted\"\n end\n\n can :create, Contribution do |contribution|\n contribution.project.owner != user and\n contribution.project.contributions.find_by_user_id(user.id).nil? and\n contribution.project.end_date >= Time.zone.today\n end\n # If the user is logged in, doesn't own the project, and has a contribution on this project,\n # they can edit\n can :update, Contribution do |contribution|\n !contribution.project.contributions.find_by_user_id(user.id).nil?\n end\n\n # Groups\n can [:create], Group\n can :remove_project, Group # had to move check for admin or project owner to controller\n\n can [:update, :admin, :destroy], Group, owner: user\n\n #Aprovals\n can :create, Approval\n can [:approve, :reject], Approval do |approval|\n approval.group.owner == user\n end\n\n can :read, User, id: user.id\n end",
"def allowed_parents\n return @allowed_parents if @allowed_parents\n @allowed_parents = Warehouse.find(:all, :conditions => Warehouse.allowed_to_condition(User.current, :add_subprojects))\n @allowed_parents = @allowed_parents - self_and_descendants\n if Manager.current.allowed_to?(:add_warehouse, nil, :global => true) || (!new_record? && parent.nil?)\n @allowed_parents << nil\n end\n unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent)\n @allowed_parents << parent\n end\n @allowed_parents\n end",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end",
"def create\n @parent_resource = ParentResource.find(params[:child_resource][:parent_resource_id])\n require_privilege(Alberich::Privilege::CREATE, ChildResource,\n @parent_resource)\n @child_resource = ChildResource.new(params[:child_resource])\n\n respond_to do |format|\n if @child_resource.save\n @child_resource.assign_owner_roles(current_user)\n format.html { redirect_to @child_resource, notice: 'Child resource was successfully created.' }\n format.json { render json: @child_resource, status: :created, location: @child_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @child_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project_permission(user, project, permission)\n # Keep backward compatibility of our old permission names\n if permission == USER\n permission = EDITOR\n end\n\n if permission != NOACCESS\n this_workspace = project[\"Workspace\"]\n new_permission_obj = {}\n new_permission_obj[\"Workspace\"] = this_workspace[\"_ref\"]\n new_permission_obj[\"Project\"] = project[\"_ref\"]\n new_permission_obj[\"User\"] = user._ref\n new_permission_obj[\"Role\"] = permission\n\n if @create_flag then new_permission = @rally.create(:projectpermission, new_permission_obj) end\n end\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def give_access_to_creator\n user = User.current_user\n unless user.blank?\n user_assignment = user.assigned_apps.where(app_id: self.id) rescue nil\n if user_assignment.blank?\n user.assigned_apps.create!(app_id: self.id)\n PermissionMap.instance.clean(user)\n end\n end\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n\n if self == other\n perms.permits! :write\n elsif other.admin?\n perms.permits! :write\n end\n end",
"def project_permissions\n user.project_permissions(rule.project)\n end",
"def put_can_create?\n false\n end",
"def create?\n @current_user.permission('Department', :clerk)\n end",
"def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end",
"def creatable_by?(user, parent = nil)\n raise \"#{self}.creatable_by?(user, parent = nil) must be overridden\"\n end",
"def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end",
"def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def can_create?\n allows_current_user_access_to? :create\n end",
"def prepare_permissions\n if current_ability.admin?\n else\n # Need to add admin group to current_ability\n # or presenter will not be accessible.\n current_ability.user_groups << \"admin\"\n if presenter.tombstone.present? \n else\n current_ability.user_groups.delete(\"admin\")\n end\n end\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def create\n @project = Project.new(params[:project])\n @project.creator_id = current_user.id\t \n respond_to do |format|\n if @project.save\n @project.users << current_user\n format.html { redirect_to project_path(@project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:id) and params.key?(:permissions)\n permissions = ProjectPermission.find_by(id: params[:id])\n if permissions\n if permissions.user and permissions.user == @current_user\n error = \"User permissions may not be modified.\"\n else\n project = permissions.project\n if project and user_can_access_project(project.id, [:can_author])\n\n p = params.require(:permissions).permit(\n :can_author, :can_view, :can_annotate).to_h\n\n p['can_view'] = p['can_view'] == 'true' if p.key? 'can_view'\n p['can_annotate'] = p['can_annotate'] == 'true' if p.key? 'can_annotate'\n p['can_author'] = p['can_author'] == 'true' if p.key? 'can_author'\n\n ## Authors get full permissions.\n if p['can_author']\n p['can_view'] = true\n p['can_annotate'] = true\n p['can_author'] = true\n ## Annotators get at least viewing and annotation permissions.\n elsif p['can_annotate']\n p['can_view'] = true\n end\n\n\n ## Make sure that can_view is not being taken away from a user with\n ## authoring or annotation permissions.\n if( !p['can_view'] and (\n get_with_default(p, 'can_author', permissions.can_author.to_s) == 'true' or \n get_with_default(p, 'can_annotate', permissions.can_annotate.to_s) == 'true'))\n # Rails.logger.debug \"Hello -- ILLEGAL STATE REACHED!\"\n error = \"Illegal state of permissions: you cannot revoke \"+\n \"viewing permissions from an author or annotator.\"\n else\n success = permissions.update(p)\n error = \"Error updating permissions.\" unless success\n end\n\n \n # success = false;\n # error = \"#{params.to_json} #{p.to_json}\"\n end\n end\n end\n end\n\n if success\n render json: permissions, serializer: ProjectPermissionSerializer,\n root: \"permissions\"\n else\n render_error error\n end\n end",
"def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"def add_user_permission(u)\n\t\t\n\tend",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def create\n @subproject = Subproject.new(subproject_params)\n @subproject.users << current_user\n # write subproject to database\n if @subproject.save\n redirect_to project_subprojects_path(:project_id => @subproject.project.id), :notice => 'Projekt erfolgreich erstellt.'\n else\n render 'new'\n end\n end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def can_create_opinion_from_admin?\n toggle_allow(admin_creation_is_enabled?) if permission_action.subject == :opinion\n end",
"def can_create_projects?\n Project.can_create?\n end",
"def require_permission_edit_or_update\n @project = Project.find(params[:project_id])\n @board = Board.find(params[:id])\n if @board.can_edit_users.where(:id => current_user.id).blank? && current_user.is_admin == false\n redirect_to project_path(@project), flash: { error: \"You do not have permission to do that.\" }\n end\n end",
"def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end",
"def ephemera_editor_permissions\n ephemera_permissions\n can [:create, :read, :edit, :update, :publish], Collection\n can [:create, :read, :edit, :update, :publish, :download], FileSet\n can [:destroy], FileSet do |obj|\n obj.depositor == [current_user.uid]\n end\n end",
"def patch_can_create?\n false\n end",
"def allow_new_records?\n self.permissions['new']\n end",
"def permissions = {}",
"def add_group_permission(g)\n\t\t\n\tend",
"def can_create?(folder_id)\n administrator? or\n permissions.for_create.exists? :folder_id => folder_id\n end",
"def authorized_for_create?\n current_user.is_admin\n end",
"def create?\n return false unless @user\n\n @user.try(:admin?) || @record.user == @user ||\n @record.group&.users&.include?(@user) ||\n NodePolicy.new(@user, @record.node).create?\n end",
"def can_add? record\n return true if current_user.admin?\n case record.class.to_s\n when 'TypusUser'\n false\n else\n true\n end\n end",
"def can_admin?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"adminable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end",
"def can_edit?(user)\n return true if check_creator(user)\n return true if user.any_role?('editor', 'manager')\n return true if !self.content_permissions.by_user(user).blank?\n return true if self.parent && self.parent.can_add_content?(user)\n false\n end",
"def writable?\n new? ? (root? || parent.access?(:create)) : access?(:write)\n end",
"def create?\n @current_user.permission('Fdp', :clerk)\n end",
"def add_creative_project_user\n creative_project_role = CreativeProjectRole.create( creative_project_id: self.id, \n role: 'project manager'\n )\n \n creative_project_user = CreativeProjectUser.create( user_id: self.user_id, \n creative_project_role_id: creative_project_role.id, \n creative_project_id: self.id,\n approved_by_project_manager: true,\n approved_by_user: true\n ) \n end",
"def create?\n relative? && (\n relative.admin? ||\n relative.editor?\n )\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def create\n @project = Project.new(project_params)\n current_user.projects << @project\n authorize @project\n if @project.save\n redirect_to @project, notice: I18n.t('flash.actions.project.create.notice')\n else\n render :new \n end\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def creation_allowed_only?\n creation_allowed? && !(\n programme_administrator_logged_in? ||\n Programme.site_managed_programme.present?\n )\n end",
"def updatable_by?(user)\n user.admin_for?(resource.course)\n end",
"def can_create\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:write, :posts)\n true\n end",
"def can_respond_project_creation_request?(user_or_person)\n return false unless message_type == PROJECT_CREATION_REQUEST\n return false if user_or_person.nil?\n \n\n person = user_or_person.person\n\n log_details = JSON.parse(details)\n\n return person.is_admin? if log_details['programme'].blank?\n\n programme = Programme.new(log_details['programme'])\n\n if programme.id.nil?\n person.is_admin?\n else\n (person.is_admin? && programme.site_managed?) || person.is_programme_administrator?(programme)\n end\n end",
"def add!(child)\n #should add defensive check here: is the child a Permission or a Command?\n self.children.add(child)\n end",
"def create\n authorize! :create, Project\n\n @project = Project.new(params[:project])\n @role = ProjectRole.new()\n @role.user = current_user\n @role.project = @project\n @role.role = \"owner\"\n @role.save\n ap @role\n\n puts @project\n \n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def can_create? cuser\n cuser and cuser.admin? or cuser.groups.exists? :id => Group::MOVIES\nend",
"def enforce_create_permissions(opts={})\n logger.debug(\"Enforcing create permissions\")\n if !can? :create, ActiveFedora::Base.new\n raise Hydra::AccessDenied.new \"You do not have sufficient privileges to create a new document.\"\n end\n end",
"def add_permission(permission) \n self.permissions << permission\n end",
"def build_permissions!\n #Deployment keys will keep the permissions even with non active projects\n @rewind_deploy = get_deploy_identifier(@rewind_deploy_keys)\n @read_deploy = get_deploy_identifier(@read_deploy_keys)\n\n if @project.active?\n @rewind = get_identifier(@rewind_users)\n @write = get_identifier(@write_users)\n @read = get_identifier(@read_users)\n active_project_gitolite_access\n else\n all_read = @rewind_users + @write_users + @read_users\n @read = get_identifier(all_read)\n @read << 'REDMINE_CLOSED_PROJECT' if @read.empty? && @read_deploy.empty?\n end\n\n convert_to_gitolite_format\n end",
"def create\n email = project_permission_params[:user_attributes][:email]\n user = User.find_by(:email => email)\n project = Project.find(params[:project_id])\n if user\n @project_permission = ProjectPermission.new(:user => user, :project => project,\n :permission => project_permission_params[:permission])\n end\n\n respond_to do |format|\n if @project_permission.save\n format.html { redirect_to @project_permission, notice: 'Project permission was successfully created.' }\n format.json { render json: {\n :redirect => project_path(project.id),\n :notice => \"#{user.fullname} has been added to #{project.name}.\",\n } }\n else\n format.html { render action: 'new' }\n format.json { render json: @project_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def can_org_admin?\n return self.can_grant_permissions? || self.can_modify_guidance? ||\n self.can_modify_templates? || self.can_modify_org_details?\n end",
"def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end",
"def check_permissions\n authorize! :create, Employee\n end",
"def project_permission_params\n params.require(:project_permission).permit(:id, :permission, user_attributes: [:composite_fullname_email, :email], project_attributes: [:id])\n end",
"def handle_grant_permission\n return if cbac_permission_exists?\n\n permission = Cbac::Permission.new\n permission.privilege_set = privilege_set\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission.context_role = pristine_role.name\n else\n generic_role = Cbac::GenericRole.where(name: pristine_role.name).first\n permission.generic_role = generic_role || Cbac::GenericRole.where(name: pristine_role.name, remarks: \"Autogenerated by Cbac loading / upgrade system\").create\n end\n\n register_change if permission.save\n permission\n end",
"def can_modify?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end",
"def updatable_by?(user, parent = nil)\n raise \"#{self.class}#updatable_by?(user, parent = nil) must be overridden\"\n end"
] |
[
"0.67868286",
"0.6540564",
"0.6443136",
"0.6385398",
"0.6385398",
"0.6385238",
"0.62786555",
"0.6266332",
"0.6266332",
"0.62471896",
"0.6221904",
"0.622131",
"0.6213768",
"0.62084085",
"0.61593294",
"0.6146667",
"0.61409307",
"0.6126567",
"0.6122699",
"0.61205477",
"0.6111573",
"0.6104676",
"0.608961",
"0.6058242",
"0.60502505",
"0.60109687",
"0.6003511",
"0.60005647",
"0.59861743",
"0.59798664",
"0.59623516",
"0.591251",
"0.5910114",
"0.58812577",
"0.5878563",
"0.58617616",
"0.5860517",
"0.5858796",
"0.58558613",
"0.5846178",
"0.58439493",
"0.5842041",
"0.5840546",
"0.5839563",
"0.5839563",
"0.5839563",
"0.5839563",
"0.58374244",
"0.5826976",
"0.58225584",
"0.58148104",
"0.58148104",
"0.58148104",
"0.5809207",
"0.579821",
"0.5796385",
"0.57902986",
"0.57803875",
"0.57577854",
"0.57506675",
"0.5748361",
"0.5732134",
"0.57307535",
"0.5729257",
"0.5706492",
"0.56864494",
"0.5686138",
"0.56842285",
"0.5683276",
"0.5670463",
"0.56664056",
"0.5663685",
"0.5646401",
"0.56322634",
"0.5630893",
"0.56308246",
"0.56252056",
"0.5621156",
"0.5616759",
"0.561391",
"0.5610877",
"0.5610438",
"0.5604746",
"0.5595655",
"0.55927485",
"0.5586529",
"0.5586128",
"0.55853117",
"0.5584075",
"0.55814314",
"0.5575308",
"0.55721605",
"0.55713105",
"0.55697626",
"0.5566095",
"0.55630684",
"0.5561751",
"0.5551018",
"0.5547403",
"0.5546216"
] |
0.5970547
|
30
|
Overridable method to enable controlling delete behavior in inherited
|
def around_delete_action
yield
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete; raise ActiveRecord::ReadOnlyRecord; end",
"def delete\n NotImplemented\n end",
"def delete\n NotImplemented\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def before_destroy; raise ActiveRecord::ReadOnlyRecord; end",
"def delete\n \n end",
"def delete\n # TODO: implement delete\n end",
"def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end",
"def delete\n end",
"def delete()\n super(VIRTUAL_CLUSTER_METHODS[:delete])\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n super\n rescue NoMethodError\n raise NotImplementedError, \"please implement 'destroy'\"\n end",
"def delete\n end",
"def deleted?\n false\n end",
"def delete\n\t\tfalse\n\tend",
"def destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete\n return false\n end",
"def delete\n before_delete\n this.delete\n self\n end",
"def delete\n\n end",
"def delete\n ret_val = error_if_exists('delete')\n super if ret_val\n return ret_val\n end",
"def deleted?\n end",
"def deleted?\n end",
"def destroy\n raise NotImplementedError\n end",
"def allow_destroy?\n true\n end",
"def _destroy(*)\n fail NotImplementedError\n end",
"def delete\n \n end",
"def delete(value)\n raise NotImplementedError, \"Please implement delete\"\n end",
"def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end",
"def delete\n super(MARKETPLACEAPP_METHODS[:delete])\n end",
"def _destroy_delete\n delete\n end",
"def _destroy_delete\n delete\n end",
"def destroy\n return unless destroyable?\n super\n end",
"def destroy\n if _immutable?\n raise ActiveRecord::ReadOnlyRecord \n else\n super\n end\n end",
"def destroy\n raise NotImplementedError\n end",
"def delete\n render_error :not_implemented, 'Requested functionality is not implemented'\n end",
"def delete(opts = nil)\n raise NotImplementedError, NOTIMPL_MSG\n end",
"def _delete_without_checking\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:delete)\n _set_prepared_statement_server(model.send(:prepared_delete)).call(pk_hash)\n else\n super\n end\n end",
"def delete\n super(ZONE_METHODS[:delete])\n end",
"def delete(_identifier)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end",
"def delete!(object)\n raise NotImplementedError\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def delete(*)\n unavailable_method\n end",
"def destroy\n # super\n end",
"def delete_view\n super\n end",
"def delete_operations; end",
"def destroy_with_custom_method\n # check if class has custom create method\n return destroy_without_custom_method unless self.class.custom_delete_method\n unless new_record?\n self.class.connection.log_custom_method(\"custom delete method with #{self.class.primary_key}=#{self.id}\", \"#{self.class.name} Destroy\") do\n self.class.custom_delete_method.bind(self).call\n end\n end\n\n freeze\n end",
"def before_delete_record(record)\n true\n end",
"def destroy\n NotImplementedError\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def delete(*)\n unavailable_method\n end",
"def deletable?\n parent.access?(:delete)\n end",
"def destroy\n super\n end",
"def delete\n del unless new_record?\n set_deleted_properties\n end",
"def _delete\n marked_for_destruction?\n end",
"def delete_if\n super { |r| yield(r) && orphan_resource(r) }\n end",
"def delete(object); end",
"def delete(resource)\n orphan_resource(super)\n end",
"def cannot_be_deleted\n return false if self.id == 1\n end",
"def enforce_delete_permissions\n enforce_edit_permissions\n end",
"def delete\n unavailable_method\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def destroy\n super\n end",
"def delete\n\n\tend",
"def deleted(item)\n end",
"def delete_responder\n super\n end",
"def delete\n return @delete\n end",
"def delete(key)\n raise NotImplementedError\n end",
"def delete\n trap_exception { delete! }\n end",
"def delete_content(key)\n raise \"subclass responsibility\"\n end",
"def deleted?(name, options = T.unsafe(nil)); end",
"def delete(uid)\n super uid\n end",
"def delete(uid)\n super uid\n end",
"def delete(uid)\n super uid\n end"
] |
[
"0.809797",
"0.80720335",
"0.8060069",
"0.8060069",
"0.792954",
"0.78638196",
"0.78638196",
"0.75142163",
"0.75142163",
"0.75142163",
"0.74707824",
"0.7406013",
"0.7365845",
"0.7125355",
"0.7125355",
"0.71045196",
"0.70952356",
"0.704617",
"0.7040714",
"0.7040714",
"0.7040714",
"0.7040714",
"0.7040714",
"0.7040714",
"0.7040714",
"0.70202833",
"0.7001142",
"0.6994213",
"0.6986876",
"0.6950085",
"0.69482243",
"0.69371706",
"0.6932495",
"0.69246763",
"0.6916179",
"0.6913161",
"0.6913161",
"0.69021857",
"0.68866646",
"0.6878426",
"0.68656784",
"0.6859252",
"0.6842731",
"0.68192977",
"0.6810096",
"0.6810096",
"0.680786",
"0.6781004",
"0.67793304",
"0.67788976",
"0.6777299",
"0.6774427",
"0.67705494",
"0.6756628",
"0.67448795",
"0.6740336",
"0.6740336",
"0.6740336",
"0.6740336",
"0.6740336",
"0.6740336",
"0.673727",
"0.67337686",
"0.67334545",
"0.6725129",
"0.67117184",
"0.66646296",
"0.6638698",
"0.6604734",
"0.6604734",
"0.6604734",
"0.6604734",
"0.6604734",
"0.6604734",
"0.660366",
"0.6601399",
"0.6599759",
"0.6593611",
"0.6587043",
"0.6576538",
"0.65710664",
"0.6541368",
"0.65360427",
"0.65354466",
"0.6532476",
"0.6532476",
"0.6532476",
"0.6532476",
"0.6532476",
"0.6532476",
"0.6503212",
"0.64979106",
"0.64972115",
"0.6493105",
"0.64889675",
"0.646117",
"0.64570534",
"0.64558643",
"0.644852",
"0.644852",
"0.644852"
] |
0.0
|
-1
|
Used for submissions from the FileBrowser in the File Manager interface.
|
def server_upload
change_set_persister.buffer_into_index do |buffered_changeset_persister|
change_set.validate(pending_uploads: change_set.pending_uploads + new_pending_uploads)
buffered_changeset_persister.save(change_set: change_set)
end
ServerUploadJob.perform_later(change_set.id.to_s, new_pending_uploads.map(&:id).map(&:to_s))
redirect_to ContextualPath.new(child: resource, parent_id: nil).file_manager
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file(_event)\n setTimeout 0 do\n @submitted = true\n @filed = true\n end\n end",
"def updated()\n # ICLA file form\n # TODO: why not used?\n _valid = %w(pubname email).all? do |name|\n document.querySelector(\"input[name=#{name}]\").validity.valid\n end\n\n # wire up form\n jQuery('form')[0].addEventListener('submit', self.file)\n jQuery('input[name=message]').val(window.parent.location.pathname)\n jQuery('input[name=selected]').val(decodeURIComponent(@@selected))\n\n # Safari autocomplete workaround: trigger change on leaving field\n # https://github.com/facebook/react/issues/2125\n if navigator.userAgent.include? \"Safari\"\n Array(document.getElementsByTagName('input')).each do |input|\n input.addEventListener('blur', self.onblur)\n end\n end\n end",
"def file_uploads; end",
"def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def submit_question\n @filename ||= ask 'Filename: '\n\n puts \"Submitting #{@question}...\"\n\n form = @submission_page.forms.first\n form.file_uploads.first.file_name = @filename\n @agent.submit form\n\n puts \"#{@question} has been successfully uploaded to Marmoset.\"\n\n rescue Mechanize::ResponseCodeError\n puts \"File #{@question} submission failed. Please try again!\"\n exit\n end",
"def new_files; end",
"def file\n end",
"def file\n end",
"def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend",
"def file_upload(criteria = T.unsafe(nil)); end",
"def file_field; end",
"def file_watcher; end",
"def file_watcher; end",
"def public_file_server; end",
"def public_file_server; end",
"def upload_file\n #TODO\n end",
"def upload_files_to_folder(folder_name)\n if frm.li(:text=>/A/, :class=>\"menuOpen\").exist?\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>\"menuOpen\").fire_event(\"onclick\")\n else\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n end\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Upload Files\").click\n instantiate_class(:upload_files)\n end",
"def public_file_server=(_arg0); end",
"def public_file_server=(_arg0); end",
"def multipart; end",
"def perform\n check_file # checks if the file uploaded is valid\n save_file_entry # Uploads the file to the server and saves a entry to database\n end",
"def client_side_multipart_upload\n end",
"def send_file_method\n :default\n end",
"def cmd_upload\n raise NotImplementedError, \"Subclass must implement cmd_upload()\"\n end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def enctype; end",
"def upload\n end",
"def upload\n end",
"def upload\r\n \r\n end",
"def submit; end",
"def choose_file=(file_name)\n frm.file_field(:name=>\"importPoolForm:_id6.upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n end",
"def upload_simple\r\n \r\n end",
"def on_other_file; end",
"def multipart_upload\n end",
"def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend",
"def on_replacing_entry(state, event, *event_args)\n super\n\n __debug_sim('The uploaded file is received in the Shrine cache.')\n\n # Verify validity of the uploaded file. # TODO: simulation - remove\n if simulating\n # From UploadController#upload:\n # stat, hdrs, body = FileUploader.upload_response(:cache, request.env)\n __debug_sim('CODE') do\n args = ':cache, request.env'\n \"FileUploader.upload_response(#{args})\"\n end\n __debug_sim(\"[edit_invalid_file: #{submission.invalid_file}]\")\n submission.file_valid = !submission.invalid_file\n if submission.file_valid\n self.succeeded << submission.id\n else\n self.failures << 'invalid file'\n end\n end\n\n # Verify validity of the uploaded file.\n unless simulating\n wf_upload_file(*event_args)\n end\n\n valid = ready?\n\n # TODO: simulation - remove\n if valid\n __debug_sim('The remediated file was determined to be VALID.')\n __debug_sim('The form is populated with extracted metadata.')\n __debug_sim('USER may modify metadata fields.')\n __debug_sim('USER must `cancel!` or `submit!` to advance...')\n else\n __debug_sim('The remediated file was determined to be INVALID.')\n __debug_sim('System generates a form error message to be displayed.')\n end\n\n # If the file is valid then the submission remains in this state until\n # the user completes and submits the form, or cancels the submission.\n reject! unless valid # NOTE: => :editing\n self\n end",
"def select_file=(file_name)\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n @@file_number += 1\n end",
"def fillFileUpload\n fileUploadField = @@browser.file_field(id: 'input_9')\n fileUploadField.exists?\n fileUploadField.set('C:\\upload\\Issues.pdf')\n end",
"def file\n @file\n end",
"def request_file\n @notifier_engine.request_file\n end",
"def upload\n begin\n solve(@viewable_list,@browse_list)\n render :result\n rescue Exception => e\n raise_error INCORRECT_DATA\n end\n end",
"def select_file(file_name, file_path=\"\")\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(file_path + file_name)\n @@file_number += 1\n end",
"def view_live\n id = params[:file_id]\n submission = File.read(FileSubmission.find(id).full_save_path)\n @contents = submission.split(/\\n/)\n end",
"def show\n @filedownload = @fileupload.filedownload\n @new_file_download = false\n if (!@filedownload)\n @filedownload = Filedownload.new\n @new_file_download = true\n end\n end",
"def request_file\n @queue.shift\n end",
"def request_file(options = Hash.new,&block)\n _options = default_options_for_cocoa_dialog(options)\n _options[\"title\"] = options[:title] || \"Select File\"\n _options[\"informative-text\"] = options[:prompt] || \"\"\n _options[\"text\"] = options[:default] || \"\"\n _options[\"select-only-directories\"] = \"\" if options[:only_directories]\n _options[\"with-directory\"] = options[:directory] if options[:directory]\n cocoa_dialog(\"fileselect\", _options,&block)\n end",
"def file\n FILE\n end",
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end",
"def tracked_files; end",
"def file_list\n end",
"def submit\n end",
"def show\n send_data(@document.file_content,\n type: @document.content_type,\n filename: @document.filename)\n end",
"def perform\n add_request_if_new do |request|\n self.class.notify_if_cookies_cleared request do\n multipart_set!(request) unless multipart?(request)\n escaped_arguments = escape_or_warn_of_escape_sequences(arguments)\n escaped_arguments.each_slice 2 do |name, value|\n if value =~ /^file:/\n request.multipart[name] = FilePart.new(name,value.gsub(/^file:/,\"\")) \n else\n request.multipart[name] = StringPart.new(name,value) \n end\n end\n request.body_update\n request\n end\n end\n end",
"def on_btnChooseFile_clicked(widget)\n dlg = Gtk::FileChooserDialog.new(\"PDF File\",\n @mainWindow,\n Gtk::FileChooser::ACTION_SAVE,\n nil,\n [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],\n [Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_ACCEPT])\n current_file = @txtFile.text\n unless current_file.nil?\n dir = File.dirname current_file\n if File.directory? dir\n dlg.current_folder = dir\n end\n end\n \n if dlg.run == Gtk::Dialog::RESPONSE_ACCEPT\n @txtFile.text = dlg.filename\n end\n dlg.destroy\n end",
"def before_form #:nodoc:\n params = self.params\n ids = params[:interface_userfile_ids]\n \n userfiles = Userfile.find(ids)\n\n if userfiles.size == 1 && userfiles.first.is_a?(FileCollection)\n params[:collection_id] = userfiles.first.id\n return \"\"\n else\n cb_error \"Probtrackx must be run on a single collection.\"\n end\n end",
"def html_uploader\n # TODO\n end",
"def submits; end",
"def file_input(method, options)\n basic_input_helper(:file_field, :file, method, options)\n end",
"def adm_upload_selected\n if params[:upload].nil?\n flash.now[:error]='Es wäre schon gut, vor dem Upload eine Datei auszuwählen'\n else\n fpath=params[:upload].tempfile\n fbasename=File.basename(params[:upload].original_filename)\n # tempf=File.open(fpath,'r:BOM|UTF-8')\n FileUtils.cp fpath, AMP_DIR+'/'+fbasename # Throws exception if it fails\n # tempf.close\n File.unlink(fpath) # Throws exception if it fails\n # Put information on it into DB.\n # Only adds to DB if not exists yet, otherwise old entry is kept\n added_info=Userpage.new_page_with_default(fbasename)\n if added_info.kind_of?(Array)\n if added_info.length == 0\n flash.now[:info]=\"Neue Version von #{fbasename} gespeichert.\"\n else\n flash.now[:error]=\"Fehler beim Speichern in die Datenbank: \"+added_info.to_sentence\n end\n else\n flash.now[:info]=\"Datei #{fbasename} gespeichert.\"\n end\n end\n prepare_admin_home_data\n render admin_pages_home_path\n end",
"def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def show\n feedback_file = record\n\n # Everything went fine; send file_content\n send_data feedback_file.file_content,\n type: feedback_file.mime_type,\n filename: feedback_file.filename,\n disposition: 'inline'\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or feedback file\n render 'shared/http_status', locals: { code: '404', message:\n e }, status: :not_found\n end",
"def on_editing_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n action =\n case existing_record\n when false then :set_record\n when true then :reset_record\n else :create_record\n end\n if action == :create_record\n # From UploadController#edit:\n # @item = (get_record(@item_id) unless show_menu?(@item_id))\n __debug_sim('CODE') do\n args = \"id=#{submission.id.inspect}\"\n \"@item = get_record(#{args})\"\n end\n submission.set_item\n else\n action = :set_record\n end\n else\n action = :create_record\n end\n\n unless simulating\n wf_start_submission(*event_args)\n end\n\n # TODO: simulation - remove\n __debug_sim do\n case action\n when :set_record then 'Form error message displayed if present.'\n when :reset_record then 'Edit form reset after cancel.'\n else 'System presents a pre-populated edit form.'\n end\n end\n\n # TODO: simulation - remove\n commit = file_valid? ? 'submit' : 'upload'\n __debug_sim('USER modifies form to enable submit.')\n __debug_sim(\"USER must `cancel!` or `#{commit}!` to advance...\")\n\n self\n end",
"def file_input(method, options)\n basic_input_helper(:file_field, :file, method, options)\n end",
"def action_performed event\n case event.source\n when @file_button\n load_file\n show\n else\n STDERR.puts \"Got unexpected event: #{event}\"\n end\n end",
"def new_by_mass_upload\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 file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",
"def save_file_entry\n @user.search_files.create!(file_path: uploaded_file_path.result, file_name: @file.original_filename, status: 'initialized')\n end",
"def multipart?; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end"
] |
[
"0.6768956",
"0.6276299",
"0.62280166",
"0.6095093",
"0.6012633",
"0.6012633",
"0.6006448",
"0.59877175",
"0.5953974",
"0.5953974",
"0.59244",
"0.5897041",
"0.58288395",
"0.57683426",
"0.57683426",
"0.5741936",
"0.5741936",
"0.57363397",
"0.57241136",
"0.57205904",
"0.57205904",
"0.5717771",
"0.5710403",
"0.57043374",
"0.57018274",
"0.569962",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5697535",
"0.5686277",
"0.5686277",
"0.5686277",
"0.5686277",
"0.5686277",
"0.5686277",
"0.56768227",
"0.5672552",
"0.5672552",
"0.5667363",
"0.5622981",
"0.5612149",
"0.56091446",
"0.5571508",
"0.5548924",
"0.5543302",
"0.5536752",
"0.5526643",
"0.5526596",
"0.5513846",
"0.5513327",
"0.55027807",
"0.54870546",
"0.5474245",
"0.5446419",
"0.542592",
"0.5415112",
"0.5407242",
"0.54063165",
"0.5398117",
"0.5392184",
"0.5365762",
"0.5363735",
"0.53535444",
"0.534262",
"0.5334451",
"0.5332691",
"0.53264725",
"0.5322771",
"0.5322717",
"0.5322049",
"0.5321223",
"0.5321223",
"0.5315946",
"0.5310833",
"0.5304261",
"0.52973056",
"0.5293733",
"0.5290998",
"0.5290998",
"0.5289879",
"0.5288832",
"0.5287817",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076",
"0.5286076"
] |
0.0
|
-1
|
Remove the resource from given parent
|
def remove_from_parent
@change_set = ChangeSet.for(resource)
parent_resource = find_resource(parent_resource_params[:id])
authorize! :update, parent_resource
parent_change_set = ChangeSet.for(parent_resource)
current_member_ids = parent_resource.member_ids
parent_change_set.member_ids = current_member_ids - [resource.id]
obj = nil
change_set_persister.buffer_into_index do |persist|
obj = persist.save(change_set: parent_change_set)
end
after_update_success(obj, @change_set)
rescue Valkyrie::Persistence::ObjectNotFoundError => e
after_update_error e
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def removeFromParent\n @parent.remove(self) if @parent\n end",
"def remove_parent(parent)\n ActsAsDAG::HelperMethods.unlink(parent, self)\n return parent\n end",
"def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end",
"def remove_item\n @parent.remove_item(self)\n end",
"def pop\n orphan_resource(super)\n end",
"def remove_parent_object(parent, relation = nil)\n\t parent.remove_child_object(self, relation)\n\tend",
"def delete(resource)\n orphan_resource(super)\n end",
"def remove_relationship_under\n authorize! :edit, form_params[:parent_id]\n\n if form.remove\n notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.parent), notice: notice\n else\n redirect_to redirect_path(item: form.parent), flash: { error: form.errors.full_messages }\n end\n end",
"def unregister_parent( *args )\n \n @parent = nil\n\n return self\n \n end",
"def remove_relationship_above\n authorize! :edit, form_params[:parent_id]\n if form.remove\n notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.child), notice: notice\n else\n redirect_to redirect_path(item: form.child), flash: { error: form.errors.full_messages }\n end\n end",
"def remove(resource)\n resource.delete\n end",
"def move_from_old_parent\n parent.remove(self)\n end",
"def perform_remove_parent(batch_client, parent_id)\n self.class.make_request(client, batch_client, :remove_parent, scope_parameters.merge(\n self.class.primary_key_name => primary_key,\n parent_id: parent_id\n ))\n end",
"def remove_parent(selector); end",
"def remove_act\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n\n # outdent children in case remove_act doesn't delete\n node.children.each do |child|\n child.outdent\n child.remove_act\n end\n\n # hold parent in case it need be updated\n old_parent = node.parent\n \n node.repititions.destroy_all\n node.destroy\n\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def delete!\n if parent\n parent.remove_child(id)\n @parent = nil\n end\n collection.remove(_id: id)\n self.id = nil\n true\n end",
"def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end",
"def remove_child(child)\n ActsAsDAG::HelperMethods.unlink(self, child)\n return child\n end",
"def remove_from_parent\n @__context__.executor << FlowFiber.new { @parent.remove(self) }\n end",
"def link_to_remove_parent\n image = image_tag(\"cross_small.png\", :border => 0, :alt => \"#{ _(\"Remove\") }\")\n link_to_function(image, 'jQuery(this).parent().remove();')\n end",
"def remove_child child\n @children.delete child\n end",
"def destroy\n @parent_of.destroy\n respond_to do |format|\n format.html { redirect_to parent_ofs_url }\n format.json { head :no_content }\n end\n end",
"def clear\n @parent = nil\n end",
"def remove(resource, transaction = nil)\n remove_containment_triple(resource.to_uri, transaction)\n end",
"def disassociate(parent, child)\n association_name = @parent ? @parent.name : name\n resource.disassociate(parent, child, association_name, type)\n end",
"def removing_plan_relation(transaction, parent, child, relations); end",
"def assign_to_parent(element)\n element.remove!\n element.parent = parent\n end",
"def remove(child)\n# if children.delete(child)\n# scene.unindex_prop(child) if scene\n @peer.remove(child.peer)\n# end\n end",
"def detach_from_parent\n return nil if parent.nil? # root\n oci = own_child_index\n parent.children.delete_at(oci) if oci\n self.parent = nil\n oci\n end",
"def destroy_resource(resource)\n resource.destroy\n resource\n end",
"def remove_child(component)\n @children.delete(component)\n component.parent = nil\n end",
"def remove_resource(name)\n self.resources.delete(name)\n end",
"def unlink_from_work\n work = parent_for(file_set: file_set)\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end",
"def node_leave_parent(node, parent)\n node.parents.delete(parent)\n end",
"def remove_from_list_resource\n manage_list_resource(:remove)\n end",
"def remove_parent(parent_id = nil)\n response = perform_remove_parent(nil, parent_id)\n reload!\n end",
"def delete_relationship_of_parent_with_child(parent_ou_id, child_ou_id)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{child_ou_id}/parents/#{parent_ou_id}\"\n _delete(path)\nend",
"def remove_child child\n throw 'Removing self as child' if child == self\n\n if self.categoryChilds\n self.categoryChilds.all(target_id: child.id).destroy\n end\n\n if child.categoryParent\n if child.categoryParent.source_id == self.id\n child.categoryParent.destroy\n end\n end\n\n self.reload\n self\n end",
"def delete_with_no_child(parent, direction)\n parent.send \"#{direction}=\".to_sym, nil\n end",
"def destroy\n super\n parent.unlist_item(@sym)\n end",
"def unregister_parent( parent_hash )\n \n @parents.delete( parent_hash )\n parent_hash.unregister_child( self )\n parent_keys = @parent_keys.delete( parent_hash )\n \n return self\n \n end",
"def remove(component)\n \t@children.delete(component)\n \tcomponent.parent = nil\n end",
"def unlink_from_work\n work = parent_for(file_set: file_set)\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end",
"def remove_child(child)\n if @children.delete(child)\n child.parent = nil\n end\n end",
"def batch_remove_parent(batch_client, parent_id = nil)\n perform_remove_parent(batch_client, parent_id)\n end",
"def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end",
"def disassociate\n _parent = parent_document\n _type = self.type.sub('associated:', '')\n _parent.doc_refs.delete(_type)\n self.parent_id = 0\n self.parent_ref = nil\n self.root_document_id = 0\n self.root_ref = nil\n DocumentRepository.update(_parent)\n DocumentRepository.update(self)\n end",
"def unregister_parent( parent_array )\n \n if @parents.delete( parent_array )\n parent_array.reverse_each_range do |this_object, this_parent_index|\n update_for_parent_delete_at( parent_array, this_parent_index, this_object )\n end\n @cascade_controller.unregister_parent( parent_array )\n parent_array.unregister_child( self )\n end\n \n return self\n \n end",
"def remove_child(le)\n\t\t\t@children.delete le\n\t\t\tle.parent = nil\n\t\tend",
"def shift\n orphan_resource(super)\n end",
"def destroy\n @child_resource = ChildResource.find(params[:id])\n # require modify permissions for this object\n require_privilege(Alberich::Privilege::MODIFY, @child_resource)\n @child_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to child_resources_url }\n format.json { head :no_content }\n end\n end",
"def remove_resource(index)\n self.contentMetadata.remove_resource(index)\n end",
"def orphan\n parent.disown self if parent\n @parent = nil\n end",
"def remove_resource(source_record:)\n ::Pundit.authorize(user, source_record, 'destroy?')\n end",
"def delete_relationship_of_child_with_parent(parent_ou_id, child_ou_id)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{parent_ou_id}/children/#{child_ou_id}\"\n _delete(path)\nend",
"def release(resource_id)\n if (child = children.find { |v| v.uid.to_s == resource_id.to_s })\n if child.release_self()\n children.delete(child)\n child\n else\n child = nil\n end\n else\n warn \"#{resource_id} does not belong to #{self.uid}(#{self.hrn}) - #{children.inspect}\"\n end\n child\n end",
"def remove_child(child)\n @children.delete(child.name)\n child.parent = nil\n child\n end",
"def destroy\n super do\n graph.delete [source.to_term, nil, nil]\n parent.delete [parent, nil, source.to_term]\n end\n end",
"def destroy\n\t\t@parent = Parent.find(params[:id])\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to '/parent', notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end",
"def remove_resource(doc_path, res_path)\n @content_tree.remove_resource(doc_path, res_path)\n remove_metadata(resource_meta_path(doc_path, res_path), :resource)\n end",
"def destroy\n @parent = nil\n @root = nil\n end",
"def destroy_record_of_self()\n \tdb_parent.remove_from_db(self)\n \treturn self\n end",
"def unlink_from_work\n work = file_set.parent\n # monkey patch\n work.total_file_size_subtract_file_set! file_set\n # monkey patch\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end",
"def removeResource(index) \n @obj.removeResource(index)\n end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def destroy\n @parent = Parent.find(params[:id])\n @course_id = params[:add_param]\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to course_path(@course_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parent = Parent.find_by_id(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(parents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\tparent = @fallacyfolder.parent\n\t\t@fallacyfolder.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:parent => parent.id}.to_json }\n\t\tend\n\tend",
"def remove_child(node)\n if node.parent == nil\n raise \"this is an orphan\"\n end \n node.parent = nil\n end",
"def destroy\n @parent = Parent.find(params[:id])\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to parents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end",
"def remove_parent_placeholers\n self.key.split('/')[0..-2].inject(\"\") do |x,y|\n x << y + '/'\n asset = Asset.find_by_key(x)\n unless asset.nil?\n asset.destroy if asset.is_placeholder_directory?\n end\n x\n end\n end",
"def removeChildLink(parent, child)\n raise \"Brick node: #{parent} does not exist.\" unless @tree.has_key?(parent)\n @tree[parent]['children'].delete(child)\n end",
"def destroy_resource_content\n resource_content\n end",
"def delete\n path = @p.path\n File::unlink path\n end",
"def destroy\n @parent = Parent.find(params[:id])\n @other_user = get_other_user(@parent.userid)\n @parent.destroy\n\n respond_to do |format|\n format.html { redirect_to(@other_user) }\n format.xml { head :ok }\n end\n end",
"def delete(resource)\n resource.client = self\n resource.delete\n end",
"def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end",
"def destroy\n @mixed_product = MixedProduct.find(params[:id])\n @product = @mixed_product.parent\n @mixed_product.destroy\n flash[:notice] = \"Successfully removed\"\n end",
"def rm(*path)\n super; on_success{ nil }\n end",
"def remove_containment_triple(resource, transaction = nil)\n target = transaction || graph\n target.delete(make_containment_triple(resource))\n set_last_modified(transaction) # #set_last_modified handles nil case\n self\n end",
"def delete_if\n super { |r| yield(r) && orphan_resource(r) }\n end",
"def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end",
"def remove(path:)\n param = get_by_name(path: path)\n raise \"Undefined params by path #{path}\" unless param.present?\n\n path_array = path.split '.'\n return param.delete if path_array.size == 1\n\n data_wrapper = get_parent_by_path path: path, data: param.data\n data_wrapper.delete path_array.last\n param.save!\n end",
"def clear_resource\n if self.delete_resource && (self.delete_resource == '1' || self.delete_resource == true)\n self.resource = nil\n end\n end",
"def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end",
"def destroy\n @rollup_parent.destroy\n respond_to do |format|\n format.html { redirect_to rollup_parents_url, notice: 'Rollup parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove!(child)\n @last_items_count -= +1 if child && child.last\n super\n end",
"def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end",
"def destroy\n post = @parent.find(params[:id])\n authorize! :destroy, post\n post.destroy\n\n render_accepted\n end",
"def relate_resource(resource)\n return if resource.nil?\n\n resource.collection = self\n\n unless resource.new_record?\n @cache[resource.key] = resource\n @orphans.delete(resource)\n end\n\n resource\n end",
"def parent(resource)\n if @resource_config[:parent]\n raise DefinitionError, \"parent already declared in #{self}\"\n end\n @resource_config[:parent] = resource\n end",
"def destroy\n r = self.class.delete(\"/domains/#{@@parent_id}/records/#{self.id}\")\n if r.code == 200\n self\n else\n raise StandardError, 'Could not delete the record'\n end \n end",
"def remove(name, key)\n issueKey_test(key)\n fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})\n end",
"def delete_nested_document!(parent, child_assoc, child_model, child_id)\n if child_model.embeddable?\n children = parent.send(child_assoc)\n child = find_child!(children, child_id)\n children.delete(child)\n unless parent.save\n error 400, convert(body_for(:internal_server_error))\n end\n child\n else\n delete_document!(child_model, child_id)\n end\n end",
"def destroy\n @parent.destroy\n respond_to do |format|\n format.html { redirect_to partners_url, notice: 'Parent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def parent\n @parent || NullResource.new\n end",
"def delete_at(offset)\n orphan_resource(super)\n end",
"def delete(resource:)\n orm_object = resource_factory.from_resource(resource: resource)\n orm_object.delete\n resource\n end"
] |
[
"0.79112875",
"0.7698963",
"0.76058424",
"0.7474343",
"0.7474127",
"0.71848273",
"0.71057445",
"0.6984999",
"0.6908093",
"0.6870487",
"0.67646116",
"0.6731585",
"0.6704699",
"0.65822965",
"0.6566884",
"0.65444684",
"0.6538078",
"0.6490064",
"0.64868987",
"0.6461714",
"0.64612114",
"0.64602524",
"0.64522177",
"0.6441596",
"0.6403061",
"0.64007604",
"0.63665944",
"0.63624233",
"0.6346292",
"0.63347185",
"0.6332797",
"0.6328705",
"0.6310734",
"0.63086534",
"0.62967783",
"0.6284357",
"0.6266525",
"0.6250671",
"0.6250051",
"0.6247545",
"0.62437755",
"0.623906",
"0.62379503",
"0.6203187",
"0.61926544",
"0.618899",
"0.6188478",
"0.6185576",
"0.6181021",
"0.61781496",
"0.61661834",
"0.6157611",
"0.6153728",
"0.6148946",
"0.61463654",
"0.61442584",
"0.6142125",
"0.6140303",
"0.61326927",
"0.6127055",
"0.61254853",
"0.611768",
"0.61097604",
"0.6100043",
"0.6082844",
"0.6064927",
"0.6061451",
"0.60408074",
"0.6034883",
"0.60333127",
"0.6032112",
"0.60204464",
"0.60140157",
"0.6011918",
"0.6003646",
"0.5996392",
"0.5976313",
"0.59705424",
"0.596968",
"0.5968343",
"0.59626603",
"0.5960955",
"0.59584355",
"0.5956265",
"0.59296924",
"0.59294045",
"0.5928606",
"0.59251726",
"0.5899843",
"0.5889096",
"0.5882969",
"0.58812857",
"0.5853874",
"0.58504736",
"0.5848678",
"0.5840443",
"0.5838696",
"0.5837199",
"0.58282834",
"0.58279073"
] |
0.7830073
|
1
|
Construct the pending download objects
|
def new_pending_uploads
@new_pending_uploads ||=
begin
metadata_ingest_files ||
(params[:ingest_files] || []).map do |ingest_file|
# Skip hidden files.
next if ingest_file.split("/").last.start_with?(".")
file = Valkyrie::StorageAdapter.find_by(id: ingest_file)
PendingUpload.new(
id: SecureRandom.uuid,
storage_adapter_id: file.id,
created_at: Time.current,
file_name: ingest_file.split("/").last
)
rescue
nil
end.compact
end.flatten
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def downloads\n @downloads ||= ApiFactory.new 'Projects::Downloads'\n end",
"def setup_download_list\n return unless @container.readable?\n\n # Check if we should show flags for classifications on each of the types of container file\n @allow_show_flags = {}\n %i[stored_file archived_file].each do |rt|\n full_name = \"nfs_store__manage__#{rt}\"\n show_flag = !!Classification::ItemFlagName.enabled_for?(full_name, current_user)\n @allow_show_flags[rt] = show_flag\n end\n\n # List types should we include flags for in the queries that return the stored_files and archived_files\n show_flags_for = @allow_show_flags.filter { |_k, v| v }.keys.map { |i| i.to_s.pluralize.to_sym }\n @downloads = Browse.list_files_from @container, activity_log: @activity_log, include_flags: show_flags_for\n # Prep a download object to allow selection of downloads in the browse list\n @download = Download.new container: @container, activity_log: @activity_log\n rescue FsException::NotFound\n @directory_not_found = true\n end",
"def initialize\n @downloaded = false\n end",
"def process_pending_objects\n prefix = \"#{path.base_name}/#{path.pending}\"\n collection = amazon_s3.bucket.objects(prefix: prefix)\n\n collection.map do |s3_object|\n _, _, filename = s3_object.key.split('/')\n object_type, _, _ = filename.split('_')\n\n content = amazon_s3.convert_download('json', s3_object.get.body.read).first\n s3_object.move_to(\"#{path.base_name_w_bucket}/#{path.ready}/#{filename}\")\n\n # return the content of file to create the requests\n { object_type => content }\n end.flatten\n end",
"def initialize\n @uploaders = []\n @downloaded_images = []\n end",
"def fetch_and_store!\n # Get links from page\n # Download files from links concurrently\n download self.extract!\n end",
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def download links\n # Start downloading files in pool\n links.map do |file|\n next if Duplicate.downloaded? file\n downloader.perform do\n link = \"#{self.uri}/#{file}\"\n puts \"Worker thread #{Thread.current.object_id} is downloading #{file}. Wait\".colorize(:blue)\n # Create new agent for each worker\n browser = Mechanize.new\n browser.pluggable_parser.default = Mechanize::Download\n browser.get(link).save(\"./tmp/#{file}\")\n puts \"Done. #{file}\".colorize(:green)\n Duplicate.save! file # Don't redownload file\n self.enqueue(file)\n end\n end\n\n # Cool down\n downloader.dispose(10) do\n puts \"[Downloader] Worker thread #{Thread.current.object_id} is shutting down.\".colorize(:yellow)\n end\n end",
"def initialize\n @tasks = []\n @futures = nil\n end",
"def download_no_progress(*params)\n\t\tself.inject([]) do |a,x| \n\t\t\tif x.respond_to?('download')\n\t\t\t\tres_one = safe{ x.download(*params) }\n\t\t\t\ta.push(res_one) unless res_one.nil? \n\t\t\tend\n\t\t\ta \n\t\tend.uniq\n\tend",
"def create_workers\n MAX_WORKERS.times do\n @workers.push(DownloadWorker.new(self))\n end\n end",
"def fetch\n notify \"Downloading...\"\n @strategy.fetch\n extract\n end",
"def fetch_torrents\n self.connect unless @status == :connected\n @torrents = Torrents.new\n args = [\n 'd.multicall',\n 'main',\n 'd.hash=',\n 'd.name=',\n 'd.custom1=',\n 'd.complete=',\n 'd.base_filename=',\n 'd.base_path=',\n 'd.is_multi_file=',\n 'd.tied_to_file=',\n 'd.get_size_bytes=',\n 'd.get_down_total=',\n 'd.get_up_total=',\n 'd.get_ratio=',\n 'd.get_priority=',\n ]\n @server.call(*args).each do |stats|\n torrent = RTorrent::Torrent.new\n torrent.hash = stats[0]\n torrent.name = stats[1]\n torrent.labels = stats[2]\n torrent.completed = stats[3] == 1 ? true : false\n torrent.base_filename = stats[4]\n torrent.base_path = stats[5]\n torrent.is_multi_file = stats[6] == 1 ? true: false\n torrent.tied_to_file = stats[7]\n torrent.size = stats[8]\n torrent.down_total = stats[9]\n torrent.up_total = stats[10]\n torrent.ratio = stats[11].to_f / 1000\n torrent.priority = stats[12]\n torrent.files = @server.call('f.multicall', torrent.hash, '', 'f.get_path=').flatten\n @torrents[torrent.hash] = torrent\n end\n end",
"def new_pending_uploads\n return @new_pending_uploads unless @new_pending_uploads.nil?\n\n @new_pending_uploads = []\n selected_files.each do |selected_file|\n file_attributes = selected_file.to_h\n\n # This is needed in order to ensure that files are authorized for the\n # download from the Cloud Service provider\n auth_header_values = file_attributes.delete(\"auth_header\")\n auth_header = JSON.generate(auth_header_values)\n\n @new_pending_uploads << PendingUpload.new(file_attributes.merge(id: SecureRandom.uuid, created_at: Time.current.utc.iso8601, auth_header: auth_header))\n end\n\n @new_pending_uploads\n end",
"def create_downloads(config, files)\n downloads = []\n # Write\n files&.each do |file|\n content_type = config[:format] == 'csv' ? 'text/csv' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n downloads << create_download(config[:user_id], file[:content], file[:filename], config[:export_type], content_type)\n end\n downloads\n end",
"def perform\n fetch_urls\n download_all\n create_mosaic\n cleanup\n end",
"def download_data\n # Custom downloader functionality implementation, this is just a simplified example template\n $log.info 'Starting downloading data from the Dummy API.'\n entities = @metadata.list_entities\n results = []\n entities.each do |entity|\n entity_custom = entity.custom\n load_metadata entity, entity_custom['fields']\n start_date, end_date = get_date_interval(entity)\n results << [entity, download_data_range(entity, start_date, end_date)]\n end\n save_to_s3 results\n end",
"def fetch\n DownloadManager.fetch(src, target)\n parse\n end",
"def post_init\n @current = nil\n @requests = []\n @pending = []\n @parser = Http::Parser.new(self)\n end",
"def queue_to_download\n self.save!\n end",
"def fetch_all\n downloaded = 0\n megabyte = 1024 * 1024\n mb_down = 0\n File.open(@file, 'wb+') do |file|\n @downloader.parts do |part|\n begin\n @server.request_get(part, @headers) do |res|\n res.read_body do |body|\n file.write body\n end\n end # /@server\n rescue Timeout::Error, EOFError, Errno::ECONNRESET => exception\n yield -1\n @server = Net::HTTP.start(@base_url.host, @base_url.port)\n STDERR.puts \"Connection error...\"\n retry\n end\n\n yield part\n end # /parts\n end # /File\n end",
"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 initialize(manga)\n @manga_data = manga\n @downloaded_a_page = false\n @generated_todo = false\n @params = Params.instance.download\n @dir = @params[:manga_path] + manga[:website][:dir] + 'mangas/' + manga[:name] + '/'\n @db = Manga_database.instance\n @aff = DownloadDisplay.new(manga)\n @todo = []\n @links = nil\n @got_web_data = false\n end",
"def initialize(repository_model, current_export:)\n @repository_model = repository_model\n @current_export = current_export\n @bitbucket_server = current_export.bitbucket_server\n @archiver = current_export.archiver\n @models = current_export.models_to_export & OPTIONAL_MODELS\n @team_builder = current_export.team_builder\n\n @pull_requests = []\n end",
"def initialize(dep_uri = 'https://index.rubygems.org/info/')\n super()\n\n dep_uri = URI dep_uri unless URI === dep_uri\n\n @dep_uri = dep_uri\n @uri = dep_uri + '..'\n\n @data = Hash.new {|h,k| h[k] = [] }\n @source = Gem::Source.new @uri\n\n @to_fetch = []\n end",
"def download\n track = tracks.joins(:library).where(:libraries => {:online => true}).first\n if track\n DownloadWorker.enqueue(:url => track.url, :song_id => self.id)\n else\n dequeue!\n end\n end",
"def downloads\n @downloads ||= DocumentDownloads.new(self)\n end",
"def get_download\n\tend",
"def initialize(opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n self.files = []\n \n opts.fetch(:files, []).each do |file|\n self.files << Metalink4File.new(file)\n end\n\n self.published = opts.fetch(:published, nil)\n self.updated = opts.fetch(:updated, nil)\n self.origin = opts.fetch(:origin, nil)\n self.origin_dynamic = opts.fetch(:origin_dynamic, false)\n\n self.xml = Builder::XmlMarkup.new(indent: 2)\n end",
"def download_thread\n Thread.new do\n file = nil\n until @download_list.empty?\n @download_mutex.synchronize do\n file = @download_list.pop\n end\n next if file.nil?\n # AWS stores directories as their own object\n next if file.content_length == 0 && file.key =~ /\\/$/\n\n tmp = Tempfile.new(file.object_id.to_s)\n @source_container.files.get(file.key) do |data, rem, cl|\n tmp.syswrite(data)\n end\n tmp.flush\n tmp.rewind\n @upload_mutex.synchronize do\n @upload_list.push(body: tmp, key: file.key)\n end\n end\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(url, api, options = {})\n @url = url\n @api = api\n @filename = options[:save_as]\n @downloads_dir = options[:downloads_dir] || Dir.pwd\n\n # OPTIMIZE replace these simple status variables with status codes\n # and corresponding errors like \"File not found\"\n #\n # set to true when file is successfully downloaded\n @downloaded = false\n # non-critical error is stored here, beside being displayed\n @error = nil\n\n @local_filename = options[:save_as]\n @filename = nil # It will be filled automatically by the #check method of the base class\n end",
"def do_download\n checksum = if new_resource.checksum\n new_resource._?(:checksum, '--checksum=sha-256=').join\n end\n header = if new_resource.header\n \"--header='#{new_resource._?(:header)[1]}'\"\n end\n aria2(checksum, header,\n new_resource._?(:path, '-o'),\n new_resource._?(:directory, '-d'),\n new_resource._?(:split_size, '-s'),\n new_resource._?(:connections, '-x'),\n new_resource._?(:check_cert, '--check-certificate=false'),\n new_resource.source)\n end",
"def initialize(opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n self.language = []\n self.os = []\n \n \n self.local_path = opts.fetch(:local_path, nil)\n self.copyright = opts.fetch(:copyright, nil)\n self.description = opts.fetch(:description, nil)\n self.identity = opts.fetch(:identity, nil)\n case opts.fetch(:language, nil)\n when Array\n self.language = opts.fetch(:language, nil)\n when String\n self.language = [opts.fetch(:language, nil)]\n end\n \n self.logo = opts.fetch(:logo, nil)\n case opts.fetch(:os, nil)\n when Array\n self.os = opts.fetch(:os, nil)\n when String\n self.os = [opts.fetch(:os, nil)]\n end\n\n self.urls = []\n opts.fetch(:urls, []).each do |url|\n self.urls << Metalink4FileUrl.new(url)\n end\n \n self.publisher_name = opts.fetch(:publisher_name, nil)\n self.publisher_url = opts.fetch(:publisher_url, nil)\n self.signature = opts.fetch(:signature, nil)\n self.version = opts.fetch(:version, nil)\n \n self.piece_size = opts.fetch(:piece_size, nil) \n self.piece_count = opts.fetch(:piece_count, nil) \n \n self.hashes = []\n end",
"def download_all\n raise NotImplementedError.new(\"#{self.class.name}#download_all is an abstract method.\")\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def beginDownload(dataFilename, stormFilename)\n\tchecksums = Array.new\n\tstatuses = Array.new\n\tif( File.file?(dataFilename) )\n\t\tputs \"Error: Data file \" + dataFilename + \" already exists!\"\n\t\texit 1\n\tend\n\tif( ! File.file?(stormFilename) )\n\t\tputs \"Error: Storm file \" + stormFilename + \" does not exist!\"\n\t\texit 1\n\tend\n\tdataFile = File.open(dataFilename, \"w\")\n\tstormFile = File.open(stormFilename, \"r\")\n\tuntil stormFile.eof?\n\t\tchecksum = stormFile.readline.chomp\n\t\tchecksums.push(checksum)\n\t\tstatuses.push(Incomplete)\n\tend\n\tdone = false\n\twhile( ! done )\n\t\t$hashlock.synchronize {\n\t\t\tdone = true\n\t\t\tfor number in 0 .. (checksums.size - 1) do\n\t\t\t\tif( statuses[number] == Incomplete )\n\t\t\t\t\tdone = false\n\t\t\t\t\tThread.new() { requestChunk(number, checksums, statuses) }\n\t\t\t\t\tsleep 0.2 \n\t\t\t\t\t# If we don't sleep then \"number\" is changed before the\n\t\t\t\t\t# thread can be created. Real obnoxious bug.\n\t\t\t\tend\t\t\t\t\n\t\t\tend\n\t\t}\n\t\tsleep Announcewait\n\tend\nend",
"def downloadTBD\n\n #just do a collection!\n\n @players = Player.all\n @players.each do |player|\n @playerHash = downloadStat(player.yahoo_pid)\n end \n\n end",
"def initialize \n @s3 = Aws::S3::Resource.new(region: 'us-east-1', access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key))\n @date_time = Time.new \n @file_names = []\n @downloads = []\n @sorted_downloads\n end",
"def create_data_download(project_id, opts = {})\n post \"projects/#{project_id}/datadownload\", opts\n end",
"def download_data\n subclass_must_define\n end",
"def initialize(params:)\n # Need source dir\n @params = params\n @source_dir = params.fetch(:source_dir, nil)\n @dm = ::DataCrosswalks::DataArchiveModel.new\n @errors = []\n @src_files = []\n @checked_files_in_metadata = []\n @checked_files_in_file = []\n end",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def initialize(url, refresh = true)\n self.tasks = []\n self.url = url\n self.refresh if refresh\n end",
"def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end",
"def initialize(object)\n @createdAt = DateTime.iso8601(object[\"createdAt\"]) if object[\"createdAt\"]\n @openedAt = DateTime.iso8601(object[\"openedAt\"]) if object[\"openedAt\"]\n\n @id = object[\"id\"]\n @assignedTo = Person.new(object[\"assignedTo\"]) if object[\"assignedTo\"]\n @createdBy = Person.new(object[\"createdBy\"]) if object[\"createdBy\"]\n @status = object[\"status\"]\n @source = Source.new(object[\"source\"]) if object[\"source\"]\n @fromMailbox = Mailbox.new(object[\"fromMailbox\"]) if object[\"fromMailbox\"]\n @type = object[\"type\"]\n @state = object[\"state\"]\n @customer = Person.new(object[\"customer\"]) if object[\"customer\"]\n @body = object[\"body\"]\n @to = object[\"to\"]\n @cc = object[\"cc\"]\n @bcc = object[\"bcc\"]\n @actionType = object[\"actionType\"]\n\n @attachments = []\n if object[\"attachments\"]\n object[\"attachments\"].each do |item|\n @attachments << Attachment.new(item)\n end\n end\n end",
"def perform\n # before downloading we have to check if file exists. checkfiles service\n # also gives us information for the download: hostname, file size for\n # progressbar\n return self unless self.check\n\n file = open(File.join(@downloads_dir, @filename), 'wb')\n block_response = Proc.new do |response|\n downloaded = 0\n total = response.header['content-length'].to_i\n\n unless total == @filesize\n @error = 'Access denied'\n return self\n end\n\n response.read_body do |chunk|\n file << chunk\n downloaded += chunk.size\n progress = ((downloaded * 100).to_f / total).round(2)\n yield chunk.size, downloaded, total, progress if block_given?\n end\n end\n\n RestClient::Request.execute(:method => :get,\n :url => self.download_link,\n :block_response => block_response)\n file.close()\n @downloaded = true\n self\n end",
"def build_me\n # Download all softwares in parallel\n download\n build\n end",
"def initialize(attrs = {})\n # Registro Nacional de Transportadores Rodoviarios de Carga\n @rntrc = attrs[:RNTRC]\n # Previsao\n @date = attrs[:dPrev]\n # Lotacao\n @capacity = attrs[:lota]\n # Conta Frete\n @ciot = attrs[:CIOT]\n\n # Coletas\n if attrs[:occ]\n @collections = create_resources(Collection, attrs[:occ])\n end\n\n # Vales pedagios\n if attrs[:valePed]\n @tolls = create_resources(Toll, attrs[:valePed])\n end\n\n # Veiculo\n if attrs[:veic]\n @vehicles = create_resources(Vehicle, attrs[:veic])\n end\n\n # Lacres\n if attrs[:lacRodo]\n @seals = to_array(attrs[:lacRodo])\n end\n\n if attrs[:moto]\n @drivers = create_resources(Person, attrs[:moto])\n end\n end",
"def download_fct(target,\n url_to_download,\n count,\n total)\n Log.log_debug('Into download_fct (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ' total=' + total.to_s)\n\n downloaded_filenames = {}\n unless %r{^(?<protocol>.*?)://(?<srv>.*?)/(?<dir>.*)/(?<name>.*)$} =~ url_to_download\n raise URLNotMatch \"link: #{url_to_download}\"\n end\n #\n common_efixes_dirname = get_flrtvc_name(:common_efixes)\n temp_dir = get_flrtvc_name(:temp_dir)\n tar_dir = get_flrtvc_name(:tar_dir)\n #\n if name.empty?\n #############################################\n # URL ends with /, look into that directory #\n #############################################\n case protocol\n when 'http', 'https'\n begin\n uri = URI(url_to_download)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 10\n http.open_timeout = 10\n http.use_ssl = true if protocol.eql?('https')\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if protocol.eql?('https')\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n subcount = 0\n if response.is_a?(Net::HTTPResponse)\n b_download = 0\n response.body.each_line do |response_line|\n next unless response_line =~ %r{<a href=\"(.*?.epkg.Z)\">(.*?.epkg.Z)</a>}\n url_of_file_to_download = ::File.join(url_to_download, Regexp.last_match(1))\n local_path_of_file_to_download = \\\n ::File.join(common_efixes_dirname, Regexp.last_match(1))\n Log.log_debug('Consider downloading ' +\n url_of_file_to_download +\n ' into ' +\n common_efixes_dirname +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n if !::File.exist?(local_path_of_file_to_download)\n # Download file\n Log.log_info('Downloading ' + url_of_file_to_download.to_s +\n ' into ' + common_efixes_dirname.to_s +\n ' and keeping into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = download(target,\n url_of_file_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug('Not downloading ' + url_of_file_to_download.to_s +\n ' : already into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n subcount += 1\n end\n Log.log_debug('Into download_fct (target=' +\n target +\n ') http/https url_to_download=' +\n url_to_download +\n ', subcount=' +\n subcount.to_s)\n end\n rescue Timeout::Error => error\n Log.log_err(\"Timeout sending event to server: #{error}\")\n raise 'timeout error'\n end\n when 'ftp'\n #\n ftp_download_result = ftp_download(target,\n url_to_download,\n count,\n total,\n srv,\n dir,\n common_efixes_dirname)\n Log.log_debug('After download_fct name.empty ftp')\n downloaded_filenames.merge(ftp_download_result)\n else\n raise \"protocol must be either 'http', 'https', ftp'\"\n end\n elsif name.end_with?('.tar')\n #####################\n # URL is a tar file #\n #####################\n local_path_of_file_to_download = ::File.join(tar_dir, name)\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n tar_dir +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n #\n if b_download == 1\n # We untar only if the tar file does not yet exist.\n # We consider that if tar file already exists,\n # then it has been already untarred.\n Log.log_debug(\"Untarring #{local_path_of_file_to_download} \\\ninto #{temp_dir} : #{count}/#{total} fixes.\")\n untarred_files = untar(local_path_of_file_to_download, temp_dir)\n # Log.log_debug(\"untarred_files = \" + untarred_files.to_s)\n #\n subcount = 1\n Log.log_debug('Copying ' + untarred_files.to_s + \\\n' into ' + common_efixes_dirname)\n untarred_files.each do |filename|\n # Log.log_debug(\" copying filename \" + filename\n # +\": #{count}.#{subcount}/#{total} fixes.\")\n FileUtils.cp(filename, common_efixes_dirname)\n downloaded_filenames[::File.basename(filename)] = b_download\n subcount += 1\n end\n elsif b_download == 0\n Log.log_debug(\"Not downloading #{url_to_download} : already \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n else\n Log.log_err(\"Error while downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n downloaded_filenames[url_to_download] = -1\n end\n else\n Log.log_debug(\"Already downloaded : not downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n end\n elsif name.end_with?('.epkg.Z')\n #######################\n # URL is an efix file #\n #######################\n local_path_of_file_to_download =\n ::File.join(common_efixes_dirname, ::File.basename(name))\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n local_path_of_file_to_download +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{local_path_of_file_to_download} : #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug(\"Not downloading #{url_to_download} : already into \\\n #{local_path_of_file_to_download} \\\n: #{count}/#{total} fixes.\")\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n end\n #\n Log.log_info('Into download_fct returning ' +\n downloaded_filenames.to_s)\n downloaded_filenames\n end",
"def download(url)\n at = DateTime.strptime(url.split('/').last, '%Y%m%d')\n dir = Rails.root.join('lib', 'data', at.strftime('%Y%m%d'))\n\n FileUtils::mkdir_p dir\n\n start = DateTime.now\n total = (PREDICTION_MAX_HOURS/HOUR_RESOLUTION).ceil * PREDICTION_PERIODS.count\n\n # build the queue of datasets to download\n datasets = Queue.new\n number_completed = 0\n\n PREDICTION_PERIODS.each do |period|\n (0..PREDICTION_MAX_HOURS).step(HOUR_RESOLUTION).each do |hour_offset|\n datasets << \"#{url}gfs_4_#{at.strftime('%Y%m%d')}_#{period}_#{hour_offset.to_s.rjust(3, '0')}.grb2\"\n end\n end\n\n # make a pool to download them\n threads = [THREAD_POOL_SIZE, datasets.size].min\n workers = []\n\n threads.times do\n workers << Thread.new do\n begin\n while (file_url = datasets.pop(true)).present?\n download_file file_url, dir\n\n number_completed += 1\n\n if number_completed % (total / 10).to_i == 0\n percentage = (100*number_completed/total.to_f)\n elapsed = (DateTime.now - start).to_f * 1.day\n remaining = elapsed / (percentage / 100) - elapsed\n\n puts \"#{percentage.round(1).to_s.rjust(5)}% complete (#{elapsed.round(2)}s elapsed, #{remaining.round(2)}s remaining)\"\n end\n end\n rescue ThreadError\n end\n end\n end\n\n workers.map(&:join)\n\n # logs!\n elapsed = (DateTime.now - start).to_f * 1.day\n puts \"#{elapsed.round(2)}s to download #{url.split('/').last} (#{total} checked)\".green\n\n GribConvert::convert_folder dir, serial: true\n end",
"def download!\n folder = \"tmp/#{self.order_code}_\" + Time.now.strftime('%Y%m%d%H%M%S%L')\n files = []\n\n # check if the directory existence\n # create the directory if it does not exist yet\n Dir::mkdir(folder) if Dir[folder].empty?\n\n xml_file = to_xml(folder)\n\n files << xml_file\n \n self.order_items.each_with_index do |o_i, index|\n next if o_i.photo.nil? || o_i.photo.image_file_name.nil?\n\n o_photo_url = o_i.photo.image.url\n\n o_photo = open(o_photo_url, &:read)\n\n File.open(\"#{folder}/#{index}_#{o_i.photo.image_name}\", 'wb') do |file|\n file << o_photo\n end\n\n files << \"#{folder}/#{index}_#{o_i.photo.image_name}\"\n end\n \n File.open(\"#{folder}/message.txt\", 'wb') do |file|\n file << \"\"\n end\n files << \"#{folder}/message.txt\"\n\n ## zip\n Zip::File.open(\"#{folder}.zip\", Zip::File::CREATE) do |zipfile|\n files.each do |file|\n zipfile.add(file.split(\"/\").last, file)\n end\n end\n\n FileUtils.rm_rf(folder)\n\n \"#{folder}.zip\"\n end",
"def initialize(baseDirectory, torrinfo, alertCallback = nil)\n @alertCallback = alertCallback\n @mutex = Mutex.new\n @results = []\n @requests = []\n # The progress of requests as they are being serviced, keyed by request id.\n @requestProgress = {}\n @progressMutex = Mutex.new\n @requestsSemaphore = Semaphore.new\n @resultsSemaphore = Semaphore.new\n @baseDirectory = baseDirectory\n @torrinfo = torrinfo\n @pieceIO = PieceIO.new(baseDirectory, torrinfo)\n @requestId = 0\n @logger = LogManager.getLogger(\"piecemanager\")\n @torrentDataLength = torrinfo.dataLength\n @startedCondition = ConditionVariable.new\n @startedMutex = Mutex.new\n @state = :before_start\n startThread\n end",
"def new_images &block\n Net::HTTP.start @thread_url.host, 80 do |http|\n # Net::HTTP#request with block does not guarantee that the fragment ends\n # at newlines. This buffers the last line of the previous fragment.\n buffer = \"\"\n \n # LOOK WHAT I HAVE TO GO THROUGH TO GET FRAGMENTED DOWNLOAD WHILE HAVING\n # ACCESS TO THE FRIGGIN’ HEADERS‼\n http.request(Net::HTTP::Get.new(@thread_url.path)) do |response|\n raise Thread404dError if response.code.to_i == 404\n @last_post_time = Time.parse response['Last-Modified']\n \n response.read_body do |fragment|\n next unless fragment # fragment may be nil if you turn the monkey patch off.\n fragment.insert 0, buffer\n buffer = \"\"\n \n fragment.each_line do |line|\n buffer = line and next unless line[-1] == ?\\n\n if line =~ IMAGE_PATTERN\n url, filename = $1, $2.gsub(/(\\..+?)/, \" — #$3\\\\1\")\n next if @downloaded_files.include? filename\n yield url, filename\n elsif @first_post_time.nil? and line =~ FIRST_POST_TIME_PATTERN\n @first_post_time = self.class.parse_time $1\n end\n end\n end\n end\n end\n end",
"def initialize\n @reports = []\n @last_status = nil\n end",
"def download\n # noinspection RubyCaseWithoutElseBlockInspection\n case type\n when 'direct'\n dir = File.dirname(path)\n FileUtils.mkdir_p(dir)\n Attachment.download_from_url(source, dir)\n when 'git'\n FileUtils.mkdir_p(File.dirname(path))\n ::Open3.capture3('git submodule update --init --recursive')\n end\n end",
"def initialize()\n\t\t@items = nil\n\t\t@copies = nil\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end",
"def initialize(url, downloader=nil)\n @url = url\n\n unless downloader.nil? || !downloader.class.method_defined?('get_content')\n @download_service = downloader\n else\n @download_service = Downloader.new\n end\n end",
"def initialize(base, url, temp_dir, options)\n @base = base\n @temp_dir = temp_dir\n self.options = options\n @file = File.basename(url)\n @zip_file = @file[/[.]zip$/]\n @file_path = File.join(temp_dir, @file)\n \n # TODO: GET THE FIRST DIRECTORY INSTEAD\n dir_name = @file.gsub(/[.]tar[.]gz$/, '').gsub(/[.]zip$/, '')\n @extracted_path = File.join(temp_dir, dir_name)\n \n @base.say_status 'download and compile', url\n \n download(url)\n extract\n configure unless options[:skip_configure]\n make\n make_install\n end",
"def load!\n transfer = find_or_create_transfer\n transfer.load!(order.items_waiting)\n end",
"def initialize(description, completed_status = false) # Initialize method that is similar to a Constructor in Java\n @description = description # Method initializes each task object with a description\n @completed_status = completed_status # Boolean value to determine whether task is complete or not complete, default is false\n end",
"def initialize\n@contents = []\n@open = true\n@lock = false\nend",
"def download\n #TODO: add time frame for downloading at a specific time\n src_url = get_pdfs_webpage_urlstr ;\t# puts src_url\n \n pdf_urls = []\n begin\n open(src_url) {\n |page| page_content = page.read().force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n doc = Nokogiri::HTML.parse(page_content) #HTree(page_content).to_rexml\n doc.xpath(\"//a\").map do |elem| #doc.root.each_element('//a') do |elem |\n #puts elem\n #a = elem.attribute(\"href\").value\n a = elem['href']\n #puts a\n if a =~ /.pdf$/\n pdf_urls << File.join(src_url.slice(0,src_url.rindex('/')),a)\n pdf_urls.uniq!\n end\n end\n }\n # p(pdf_urls)\n rescue => e\n puts \"#{src_url} failed to open! #{e}\"\n raise \"please check URL #{src_url}\"\n end\n \n ## should NOT be apparent to the user.\n urls_file = \"#{get_newspaper_sym}#{self.object_id}\"\t## same file not allowing the multithreading, ensure singularity.\n f = File.new(urls_file , \"w\") ; f.puts pdf_urls ; f.close\n repo = target_dir ;# puts repo\n system(\"wget -nv -i \" + urls_file +\" -P \" + repo)\t## download using wget tool\n File.delete urls_file if File.exists? urls_file\t## clean\n end",
"def initialize(items)\n @items = items\n @filename = 'tmp/dependencies'\n @graph = Nanoc3::DirectedGraph.new([ nil ] + @items)\n @previous_items = []\n end",
"def download_all_objects(objects, type)\n subdir = type + 's'\n puts \"Found #{objects.count} #{type}s, downloading...\"\n\n count = skip_count = 0\n objects.each do |info|\n id = info['id']\n if File.exist?(Utils.filepath(id, subdir: subdir))\n skip_count += 1\n next\n end\n\n send(\"save_#{type}_to_file\", id, name: id.to_s, output: false)\n count += 1\n printf(\"\\rDownloaded %d #{type}s, skipped %d, current id = %d\", count, skip_count, id)\n end\n puts ''\n puts \"Saved #{count} #{type}s to data/#{subdir} subdirectory\"\n end",
"def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end",
"def build\n add_access_request\n add_track_request\n end",
"def check_downloads\n @download_manager.done.each do |wrapper, download|\n entry = wrapper.entry\n receiver = wrapper.receiver\n if download.error?\n entry.status.error!(download.message)\n @link_table.update(entry)\n elsif download.successful?\n result = download.result\n if receiver.add(result[:url], result[:name], result[:cookies])\n download.change_status(:success, nil, \"added to #{receiver.name}\")\n else\n download.change_status(:error, nil, \"could not add URL to #{receiver.name}\")\n end\n end\n end\n end",
"def generate_download\n # TODO: to support scoping by other filters\n # we will have to scope all filter params throughout by their target base\n # e.g. collection_object[param]\n a = nil\n\n q = ::Queries::CollectionObject::Filter.new(params)\n q.project_id = nil\n\n if q.all(true)\n q.project_id = sessions_current_project_id\n a = DwcOccurrence.by_collection_object_filter(\n filter_scope: q.all,\n project_id: sessions_current_project_id)\n else\n a = DwcOccurrence.where(project_id: sessions_current_project_id)\n if params[:dwc_occurrence_start_date]\n a = a.where('dwc_occurrences.updated_at < ? and dwc_occurrences.updated_at > ?', params[:dwc_occurrence_start_date], params[:dwc_occurrence_end_date])\n end\n end\n\n @download = ::Export::Dwca.download_async(a, request.url, predicate_extension_params: predicate_extension_params )\n render '/downloads/show'\n end",
"def initialize(opts, &block)\n @allocator = block\n\n @stock = []\n @queue = []\n @acquired_resources = {}\n\n @limit = opts[:limit] || 4\n @size = 0\n end",
"def create_download(user_id, data, full_filename, export_type, content_type)\n download = Download.create(user_id: user_id, export_type: export_type, filename: full_filename)\n download.export_files.attach(io: data, filename: full_filename, content_type: content_type)\n download\n ensure\n FileUtils.remove_entry(File.dirname(data)) if data.is_a?(File) && File.exist?(data)\n end",
"def initialize\n # Single semaphore for use in critical sections\n @semaphore = Mutex.new\n\n # Read/parse immutable starting point file\n file = open(\"resources/data.json\")\n json = file.read\n file.close\n\n # Parse content\n parsed = JSON.parse(json)\n @products = parsed['products']\n if @products\n @products.map! { |prod| Product.new(prod['productId'],\n prod['description'], prod['quantityOnHand'], prod['reorderThreshold'],\n prod['reorderAmount'], prod['deliveryLeadTime']) }\n end\n @orders = parsed['orders']\n if @orders\n @orders.map! { |ord| Order.new(ord['orderId'],\n ord['status'], ord['dateCreated'], ord['items']) }\n end\n @purchaseOrders = Array.new\n end",
"def pull_data\n @pull_data ||= source_classes\n .map { |source| Thread.future { source.run(pull, page) } }\n .reduce({}) { |result, source_future| result.merge(~source_future) }\n end",
"def download_versions\n pool = Concurrent::CachedThreadPool.new\n @version_dates.keys.each do |version|\n pool.post(version) do |version_for_thread|\n downloads = get_ver_downloads_by_dates(version_for_thread)\n save_downloads(downloads, version_for_thread)\n end\n end\n pool.shutdown\n pool.wait_for_termination\n self\n end",
"def initialize\n super\n\n self.callbacks = ::ActiveSupport::HashWithIndifferentAccess.new\n self.callbacks_queue = []\n\n self.responses = ::ActiveSupport::HashWithIndifferentAccess.new\n self.responses_queue = []\n\n self.client = ::Syncano::Clients::Sync.instance\n self.received_data = ''\n end",
"def initialize(opts)\n @options = opts\n @download_finished = false\n @download_mutex = Mutex.new\n @upload_mutex = Mutex.new\n @download_list = []\n @upload_list = []\n\n source_store = define_store(\"source\")\n destination_store = define_store(\"destination\")\n\n @source_container = define_container(source_store, \"source\")\n @destination_container = define_container(destination_store, \"destination\",\n true)\n\n if perform_migration\n puts \"#{CLI.bold}#{CLI.blue}*** Migration complete#{CLI.reset}\\a\"\n else\n puts \"#{CLI.bold}#{CLI.red}*** Migration failed#{CLI.reset}\\a\"\n end\n rescue Excon::Errors::Unauthorized => err\n puts \"A provider has returned an Unauthorized error.\"\n puts err.inspect if @options[:verbose]\n exit 1\n end",
"def queue_urls\n @queue_urls ||= init_urls\n end",
"def process_two_phase_pending_objects\n prefix = \"#{path.base_name}/#{path.two_phase_pending}\"\n collection = amazon_s3.bucket.objects(prefix: prefix)\n\n collection.each do |s3_object|\n _, _, filename = s3_object.key.split('/')\n object_type, _, _ = filename.split('_')\n\n contents = s3_object.get.body.read\n\n s3_object.move_to(\"#{path.base_name_w_bucket}/#{path.pending}/#{filename}\")\n end\n end",
"def initialize(options={})\n @api_username = options[:api_username]\n @api_password = options[:api_password]\n @ftp_username = options[:ftp_username] || options[:api_username]\n @ftp_password = options[:ftp_password] || options[:api_password]\n @pod = options[:pod] || 5\n @api_url = options[:api_url] || \"http://api#{@pod}.silverpop.com\"\n @transact_url = options[:transact_url] || \"http://transact#{@pod}.silverpop.com\"\n @transfer_url = options[:transfer_url] || \"transfer#{@pod}.silverpop.com\"\n @ftp = Net::FTP.new\n @cached_lists = []\n end",
"def initialize\n @contents = []\n @open = true\n # @discarded_silverware = []\n end",
"def download_attributes\n { \n filename: download.filename, \n type: \"application/pdf\",\n disposition: \"attachment\"\n }\n end",
"def create\n @download = Download.new(download_params)\n\n respond_to do |format|\n if @download.save\n format.html { redirect_to @download, notice: 'Download was successfully created.' }\n format.json { render :show, status: :created, location: @download }\n else\n format.html { render :new }\n format.json { render json: @download.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @download = Download.new(download_params)\n\n respond_to do |format|\n if @download.save\n format.html { redirect_to @download, notice: 'Download was successfully created.' }\n format.json { render :show, status: :created, location: @download }\n else\n format.html { render :new }\n format.json { render json: @download.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(address)\n @requests = [HTTY::Request.new(address)]\n end",
"def initialize()\n @busy = false\n @job_mutex = Mutex.new()\n @duty_container = DutyContainer.new()\n @duty_completion_callback = Proc.new() {}\n @duty_failure_callback = Proc.new() {}\n end",
"def initialize\n @responses = []\n @semaphore = Semaphore.new\n @lock = Mutex.new\n end",
"def initialize\n @setup = false\n @reply_to = UUID.generate\n @pending = Hash.new\n end",
"def create\n @download = Download.new(params[:download])\n\n respond_to do |format|\n if @download.save\n format.html { redirect_to @download, notice: 'Download was successfully created.' }\n format.json { render json: @download, status: :created, location: @download }\n else\n format.html { render action: \"new\" }\n format.json { render json: @download.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createBackup\n fetch(\"#{@backupUrl}\", 3000)\n $LOG.info(\"#{@name} : Backupfile created\") \n sleep 120\n end",
"def do_prefetch_tracks(model, link_index, queue, max_entries)\n downloads_count = 0\n entry = queue.last.internal_ref+1\n max_downloads = max_entries+1 - queue.size\n while queue.size < max_entries+1 # queue has at least the [0] element -> +1\n iter = model.get_iter(entry.to_s)\n break if iter.nil? # Reached the end of the tracks\n\n iter[link_index].setup_audio_file\n if iter[link_index].playable? # OK or MISPLACED\n queue << TrackRefs.new(self, entry, iter[link_index])\n else\n # Track not available, check to see if not already in download tasks\n if @mc.tasks.track_in_download?(iter[link_index])\n downloads_count += 1\n else\n # If available on server and max downlaods not reached, start a task\n if downloads_count < max_downloads && iter[link_index].available_on_server?\n iter[link_index].get_remote_audio_file(TasksWindow::Task.new(:download, :track, iter[link_index], self), @mc.tasks)\n downloads_count += 1\n end\n end\n end\n entry += 1\n end\n end",
"def fetch\n requests = instantiate_modules.select(&:fetch?).map(&:requests).flatten\n\n total, done = requests.size, 0\n update_progress(total, done)\n\n before_fetch\n\n backend.new(requests).run do\n update_progress(total, done += 1)\n end\n\n after_fetch\n\n true\n rescue => e\n error(e)\n raise e\n end",
"def process_download(options = {})\n @download = Download.process(self, options)\n end",
"def download_attachments!(urls)\n return if urls.blank?\n begin\n # Send HTTP requests in parallel. – See Pupa's README to learn more.\n attachment_downloader.in_parallel(attachment_download_manager) do\n urls.each do |url|\n attachment_downloader.get(url)\n end\n end\n rescue Faraday::Error::ClientError => e\n error(e.response.inspect)\n end\n end",
"def initialise_job_tracking\n self.overall_count = 0\n self.overall_duration_seconds = 0\n self.overall_data_length_bytes = 0\n end",
"def download(url, download_to=File.expand_path(\".\")+File::SEPARATOR)\n $LOG.info \" Starting download of fillings from SEC url [\"+url+\"]\"\n files=[]\n content = open(url).read\n @links = Set.new\n uri=URI(url)\n @base_path=\"\"\n @base_path=(uri.scheme+\"://\"+uri.host+((uri.port==80 && \"\") || \":\"+uri.port.to_s)) unless uri.host.nil?\n parse(content)\n download_to += File::SEPARATOR unless download_to.end_with?(File::SEPARATOR)\n mkdir(download_to)\n @links.each do |link|\n file=download_to + link.split(\"/\")[-1]\n dump_to_file(file, open(link).read)\n files << file\n end unless uri.host.nil?\n files\n end",
"def initialize(sender, receiver, amount)\n @sender=sender\n @receiver=receiver\n @status=\"pending\"\n @amount=amount\n # @last_transfer = {sender}\n end",
"def download_files files,dest,opts = {}\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n str = \"Will download #{files.size} files to #{dest} ... \"\n download_all_files files,dest\n str += \" Done !\"\n Logger.<<(__FILE__,\"INFO\",str) if opts[:v]\n end",
"def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end",
"def setup_fetcher(options={})\n @fetch_base_url = options[:fetch_base_url] || \"\"\n\n @fetch_count=0\n\n\n @record_directory=options[:record_directory]\n @playback_directory=options[:playback_directory]\n\n @throttler=options[:throttler] || Nanikore::Throttler.new(options)\n end",
"def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end"
] |
[
"0.6575593",
"0.60133433",
"0.59669405",
"0.5819174",
"0.5802161",
"0.5762619",
"0.5666531",
"0.56363887",
"0.56182206",
"0.56048256",
"0.5569246",
"0.55197275",
"0.54748356",
"0.54615444",
"0.54092425",
"0.53610545",
"0.5302192",
"0.52952826",
"0.52792895",
"0.5258455",
"0.5242147",
"0.52392995",
"0.52174425",
"0.5204556",
"0.520224",
"0.5193658",
"0.5190025",
"0.5185662",
"0.5173842",
"0.5172488",
"0.51718915",
"0.51635444",
"0.5160788",
"0.51585454",
"0.5149673",
"0.51297075",
"0.51182896",
"0.5110169",
"0.5108239",
"0.50928503",
"0.50765806",
"0.50704426",
"0.50476646",
"0.5032121",
"0.5031692",
"0.5030722",
"0.502248",
"0.50188583",
"0.50140685",
"0.50120085",
"0.50117826",
"0.50110203",
"0.5006856",
"0.49993593",
"0.499271",
"0.49897668",
"0.49883664",
"0.49843797",
"0.49836347",
"0.4982004",
"0.49789092",
"0.49756685",
"0.49607962",
"0.49597937",
"0.49516898",
"0.49398446",
"0.49359906",
"0.49346426",
"0.49345005",
"0.4931211",
"0.49267447",
"0.49165127",
"0.48989463",
"0.48858717",
"0.48838073",
"0.48776758",
"0.4877053",
"0.48745367",
"0.4869255",
"0.4867583",
"0.48672187",
"0.4862829",
"0.4862191",
"0.4862191",
"0.4862101",
"0.48605824",
"0.4856256",
"0.48538777",
"0.4850477",
"0.48501784",
"0.48366404",
"0.48333025",
"0.4832306",
"0.48231876",
"0.48230612",
"0.48105124",
"0.480916",
"0.48039716",
"0.4801661",
"0.4800815",
"0.47985032"
] |
0.0
|
-1
|
Local file ingest submits file metadata as JSON in fields.
|
def metadata_ingest_files
return if params[:metadata_ingest_files].blank?
params[:metadata_ingest_files].map do |metadata|
metadata = JSON.parse(metadata, symbolize_names: true)
file = Valkyrie::StorageAdapter.find_by(id: metadata[:id])
PendingUpload.new(
id: SecureRandom.uuid,
storage_adapter_id: file.id,
created_at: Time.current,
file_name: metadata[:filename],
type: metadata[:type]
)
rescue
nil
end.compact
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def map_type_import_body(uploaded_file)\n { 'fileUpload' => UploadIO.new(uploaded_file, uploaded_file.content_type, uploaded_file.original_filename) }\n end",
"def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end",
"def metadata_file; end",
"def metadata_file; end",
"def initialize_fields(file)\n file.initialize_fields\n end",
"def initialize_fields(file)\n file.initialize_fields\n end",
"def add_file_metadata\n file_data = {}\n file_data[:filename] = File.basename(options[:original_filename])\n file_data[:file_size] = File.size(options[:original_filename])\n file_data[:record_delimiter] = options[:delimiter]\n file_data[:rows] = options[:rows]\n file_data[:columns] = options[:csv_column_datatypes].keys.size\n file_data[:processed_filename] = File.basename(options[:filename])\n file_data[:processed_file_path] = options[:filename]\n file_data[:processed_file_size] = File.size(options[:filename])\n file_data[:error_report] = options[:temp_file]\n return file_data\n end",
"def local_file_params\n params.require(:local_file).permit(:file, :file_fingerprint, :url)\n end",
"def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end",
"def external_file_attributes; end",
"def ingest (file, attrs = {})\n file = File.new(file, \"r\") if file.kind_of? String\n\n source_filename = File.basename file\n attrs[:name] = attrs[:name] || File.basename(file, \".*\")\n\n params = { input: source_filename }\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n\n # Create request object\n # TODO: This is not going to work with big files\n req = Net::HTTP::Post.new(\"/sources?\"+uri_params)\n req['Content-Length'] = File.size file\n req.body_stream = File.open file\n\n json_source = nil\n\n @lagoonserver.request_with_auth req do |resp|\n # Deal with the response. Response comes (mostly) in pairs:\n # - {\"start\": <some action>} <-- <some action> was started\n # - \"ok\" <-- the last <some action> finished\n #\n # We keep track of the state using a stack. Since we're getting packets\n # from the socket we need to keep track of the leftover, since we're\n # parsing lines.\n leftover = \"\"\n state = []\n resp.read_body do |segment|\n leftover = leftover + segment\n lines = leftover.lines\n\n # 'lines' will keep the '\\n' character. Whatever ends with '\\n' was\n # indeed a full line. The rest (which should be a single element array)\n # is the leftover.\n readys_leftover = lines.partition {|l| l.end_with? \"\\n\"}\n readys = readys_leftover[0].map(&:chomp)\n leftover = readys_leftover[1][0] || \"\"\n\n readys.each do |l|\n if l == \"\\\"ok\\\"\"\n # In case of \"ok\" we pop the last state and log that it's now done.\n log_info \"Done: #{state.pop}\"\n else\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n new_blob = JSON.parse(l)\n if start_token = new_blob[\"start\"]\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n log_info \"Start: \" + start_token\n state.push start_token\n elsif notice_token = new_blob[\"notice\"]\n # Sometimes it's a \"notice\"; very well, just log it.\n log_info \"Notice: \" + notice_token\n else\n # If it's neither \"ok\", a start or a notice, just log its JSON\n # representation and implicitly assume it might be the source\n # metadata.\n json_source = JSON.parse(l)\n log_info (JSON.pretty_generate json_source)\n end\n end\n end\n end\n end\n Source.new(json_source, self)\n end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def put_import_fields_from_fdf_in_storage_with_http_info(name, fdf_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_import_fields_from_fdf_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_import_fields_from_fdf_in_storage\"\n end\n # verify the required parameter 'fdf_file_path' is set\n if @api_client.config.client_side_validation && fdf_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'fdf_file_path' when calling PdfApi.put_import_fields_from_fdf_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/fdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fdfFilePath'] = fdf_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_import_fields_from_fdf_in_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def file_field; end",
"def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end",
"def put_import_fields_from_xfdf_in_storage_with_http_info(name, xfdf_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_import_fields_from_xfdf_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_import_fields_from_xfdf_in_storage\"\n end\n # verify the required parameter 'xfdf_file_path' is set\n if @api_client.config.client_side_validation && xfdf_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'xfdf_file_path' when calling PdfApi.put_import_fields_from_xfdf_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/xfdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'xfdfFilePath'] = xfdf_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_import_fields_from_xfdf_in_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def uploaded_data=(file)\n self.data = []\n if !file.kind_of?(String)\n self.name = file.original_filename\n self.content_type = file.content_type.chomp\n self.data = file.read\n end\n end",
"def content\n fields = self.get_fields\n fields.empty? ? self.data.merge(self.file_data).to_json : fields.to_json\n end",
"def initialize(metadata, fields = {})\n @metadata = JSON.parse(metadata).merge(fields)\n end",
"def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end",
"def create\n if params[:local_file].present?\n if ingest_local_file\n redirect_to sufia.batch_edit_path(params[:batch_id])\n else\n flash[:alert] = \"Error creating generic file.\"\n render :new\n end\n else\n # They are uploading files.\n super\n end\n end",
"def on_file_metadata_updated(event)\n return unless resource? event[:metadata]\n Hyrax.index_adapter.save(resource: event[:metadata])\n end",
"def process_file\n instance_variable_get(:@fields).keys.each do |locale|\n request = Request.new(\n client,\n process_url(locale),\n {},\n nil,\n version: sys[:version]\n )\n request.put\n end\n sys[:version] += 1\n self\n end",
"def file_args(upload, upload_metadata)\n args = {\n external_identifier: upload.signed_id,\n label: ::File.basename(upload.filename),\n filename: upload.filename\n }\n args.merge!(upload_metadata)\n # Symbolize\n args.transform_keys(&:to_sym)\n end",
"def parse_body(input_file, filemeta)\n body = {\n 'DocumentAsBase64String' => Base64.encode64(input_file),\n 'OutputHtml' => 'true',\n 'Configuration' => @configuration\n }\n\n body['RevisionDate'] = format_timestamp(filemeta.delete(:revision_date)) if filemeta.key?(:revision_date)\n\n body\n end",
"def file_upload_data(item = nil)\n fd = get_file_data(item)\n fd = fd[:uploader] if fd[:uploader].is_a?(Hash)\n fd.deep_symbolize_keys if fd[:storage].present?\n end",
"def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end",
"def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end",
"def file=(data)\n self.file.assign(data)\n # uploaded photos need metadata immediately in order to\n # \"Sync obs. w/ photo metadata\"\n if data.is_a?(ActionDispatch::Http::UploadedFile)\n extract_metadata(data.path)\n end\n end",
"def post_arguments(raw_file, filemeta)\n {\n method: :post,\n url: build_url(PARSE_RESUME),\n payload: parse_body(raw_file, filemeta).to_json,\n headers: headers,\n timeout: REQUEST_TIMEOUT_SECONDS\n }\n end",
"def create\n if params[:local_file].present?\n # Ingest files already on disk\n filename = params[:local_file][0]\n file = File.open(File.join(current_user.directory, filename), 'rb')\n create_and_save_generic_file(file, '1', nil, params[:batch_id], filename)\n if @generic_file\n Sufia.queue.push(ContentDepositEventJob.new(@generic_file.pid, current_user.user_key))\n redirect_to sufia.batch_edit_path(params[:batch_id])\n else\n flash[:alert] = \"Error creating generic file.\"\n render :new\n end\n else\n # They are uploading files.\n super\n end\n end",
"def extract_metadata!(data = {})\n data.tap do |d|\n file = File.open(@file)\n d[:filesize] = file.size\n file.close\n\n d[:content_type] = MIME::Types.type_for(@file).first.to_s\n end\n end",
"def add_local\n remap_resource_type\n process_date_ingest_fields\n add_controlled_fields\n end",
"def convert()\n @helper.post(@fields, @files, @raw_data)\n end",
"def finalize_file(uid, info = {})\n upload_id = info[\"multipart_id\"]\n parts = info[\"multipart_parts\"].map do |part|\n { part_number: part[\"part_number\"], etag: part[\"etag\"] }\n end\n\n multipart_upload = object(uid).multipart_upload(upload_id)\n multipart_upload.complete(multipart_upload: { parts: parts })\n\n info.delete(\"multipart_id\")\n info.delete(\"multipart_parts\")\n end",
"def create_uploaded_file\n Hyrax::UploadedFile.create(user: @user, file: local_file)\n end",
"def batch_import_params\n params.permit(:file)\n end",
"def apply_file_metadata(params)\n uploaded_file_ids = params[\"uploaded_files\"]\n return if uploaded_file_ids.nil?\n uploaded_file_ids.each do |uploaded_file_id|\n uploaded_file = find_or_create_uploaded_file(uploaded_file_id)\n next if uploaded_file.pcdm_use == \"primary\"\n apply_metadata_to_uploaded_file(uploaded_file, params)\n end\n params[\"etd\"].delete(\"supplemental_file_metadata\")\n params # return the params after processing, for ease of testing\n end",
"def put_import_fields_from_fdf_in_storage(name, fdf_file_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_import_fields_from_fdf_in_storage_with_http_info(name, fdf_file_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_import_fields_from_fdf_in_storage_with_http_info(name, fdf_file_path, opts)\n else\n raise\n end\n return data\n end",
"def put_import_fields_from_xml_in_storage_with_http_info(name, xml_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_import_fields_from_xml_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_import_fields_from_xml_in_storage\"\n end\n # verify the required parameter 'xml_file_path' is set\n if @api_client.config.client_side_validation && xml_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'xml_file_path' when calling PdfApi.put_import_fields_from_xml_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/xml\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'xmlFilePath'] = xml_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_import_fields_from_xml_in_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def prepare_data(body)\n data = MultiJson.decode(body)\n content = StringIO.new(data['content'])\n resource_id = data['resource_id']\n\n data.keep_if { |k,v| %w{title description mimeType}.include? k}\n file_content = Google::APIClient::UploadIO.new(content, data['mimeType'])\n\n [resource_id, data, file_content]\nend",
"def import_params\n params.require(:file)\n end",
"def import\n @obj = Node.create_sub_tree JSON.parse(File.read(params[:file_to_upload].tempfile.path), symbolize_names: true)\n\n respond_to do |format|\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n end\n end",
"def upload_data options={}\n metadata.merge({ tags: flickrize_tags(tags_from_object) }).merge(options)\n end",
"def grid_fs_file_params\n params.require(:grid_fs_file).permit(:filename, :contentType, :author, :topic, :uploadDate, :length, :chunkSize, :md5, :contents)\n end",
"def handle_input(data)\n puts 'New file received'\n unless data.key? 'uid'\n puts 'File without UID found, skipping'\n return\n end\n\n wonkofile_fn = wonkofile_filename data['uid']\n version_filename = wonkoversion_filename data['uid'], data['version']\n\n if data.key? 'name'\n puts ' Found \\'name\\' key in received file, assuming WonkoFile'\n\n if File.exists? wonkofile_fn\n write_json_file wonkofile_fn, wonkofile_merge(read_json_file(wonkofile_fn), data)\n else\n write_json_file wonkofile_fn, data\n end\n else\n puts ' No \\'name\\' key found in received file, assuming WonkoVersion'\n\n # write the version\n FileUtils.mkdir_p File.dirname version_filename\n write_json_file version_filename, data\n\n # add the version to the version index\n wfile = File.exists?(wonkofile_fn) ? read_json_file(wonkofile_fn) : wonkofile_stub_from_wonkoversion(data)\n wfile = wonkofile_add_version wfile, data\n write_json_file wonkofile_fn, wfile\n end\nend",
"def get_import_fields_from_fdf_in_storage_with_http_info(name, fdf_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_import_fields_from_fdf_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_import_fields_from_fdf_in_storage\"\n end\n # verify the required parameter 'fdf_file_path' is set\n if @api_client.config.client_side_validation && fdf_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'fdf_file_path' when calling PdfApi.get_import_fields_from_fdf_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/fdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fdfFilePath'] = fdf_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_import_fields_from_fdf_in_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_import_fields_from_xfdf_in_storage_with_http_info(name, xfdf_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_import_fields_from_xfdf_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_import_fields_from_xfdf_in_storage\"\n end\n # verify the required parameter 'xfdf_file_path' is set\n if @api_client.config.client_side_validation && xfdf_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'xfdf_file_path' when calling PdfApi.get_import_fields_from_xfdf_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/xfdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'xfdfFilePath'] = xfdf_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_import_fields_from_xfdf_in_storage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def upload_file\n #TODO\n end",
"def import_map_type_file(uploaded_file, options = {})\n path = \"#{base_uri}/import/file\"\n map_type_body = map_type_import_body(uploaded_file)\n request(path, options.merge(method: :post_multipart), map_type_body, false, MULTIPLE_MAPPINGS_UPLOAD_TIMEOUT).to_s\n end",
"def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end",
"def internal_file_attributes; end",
"def add_metadata(meta={})\n @local_metadata.deep_merge!(meta.dup)\n end",
"def ingestAudioRecording(audiofilename, dateformat) #dateformat should be optional\n # For ingesting the \"Raw\" audio file. Can be cut in to segments later or separately, then imported and connected to the recording node\n \n # Check if a JSON already exists. If so, use it\n # if not, get the metadata, generate the JSON, and use it\n # IF dateformat nil, set it to \"%Y%m%d_%H%M%S%z\" (Double-check this)\n # Mark the STRFTIME format so that the time can be re-parsed from the filename programically\n # Parse JSON metadata\n # Map the JSON to the properties we care about\n # Set name\n # Set date\n # Set location, if it exists\n # Set ingest date to now\n # set ingestedFile to the file\n # set ingestedMetadataFile to the JSON file\n\nend",
"def read_metadata; end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def import_data fields, datas, options = {}\n remote.import_data(fields, datas, options)\n end",
"def request_data\n {\n file: File.new(@upload_path, \"rb\"),\n data: @data.to_json\n }\n end",
"def uploaded_data\n return \"\"\n end",
"def upload(local, remote)\n local = Pathname.new(local) unless local.kind_of? Pathname\n raise \"no file\" unless local.exist?\n\n # we assume these are small enough to slurp.\n script = local.read\n limitkeys = [:method, :path, :script, @itemkey]\n remote = remote.select{|k,v| limitkeys.include? k }\n remote[:script] = script\n# post('', remote)\n if remote.has_key? @itemkey then\n put('/' + remote[@itemkey], remote) do |request, http|\n response = http.request(request)\n case response\n when Net::HTTPSuccess\n #return JSON.parse(response.body)\n when Net::HTTPNotFound\n verbose \"\\tDoesn't exist, creating\"\n post('/', remote)\n else\n showHttpError(request, response)\n end\n end\n else\n verbose \"\\tNo itemkey, creating\"\n post('/', remote)\n end\n end",
"def put_import_fields_from_xfdf_in_storage(name, xfdf_file_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_import_fields_from_xfdf_in_storage_with_http_info(name, xfdf_file_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_import_fields_from_xfdf_in_storage_with_http_info(name, xfdf_file_path, opts)\n else\n raise\n end\n return data\n end",
"def process_file(item_file, index)\n if item_file.upload_file_path\n @logger.info(\"[Child #{index}] Copying file in bag to path: #{item_file.upload_full_path}\")\n item_file.copy_to_upload_full_path\n file = item_file.upload_file_url\n else\n item_file.copy_to_metadata_full_path\n @logger.info(\"[Child #{index}] Uploading filename from metadata to server: #{item_file.metadata_full_path}\")\n file = upload_file(item_file)\n item_file.delete_metadata_full_path\n end\n file\n end",
"def entry_fields(rec, user:, serialize: JSON_SERIALIZE)\n user = user_id(user) unless user.is_a?(Integer)\n ed = rec.emma_metadata(refresh: true)\n fd = rec.file_data\n mime = fd&.deep_symbolize_keys&.dig(:metadata, :mime_type)\n fmt = mime_to_fmt(mime)\n ext = fmt_to_ext(fmt)\n {\n user_id: user,\n repository: ed[:emma_repository],\n submission_id: ed[:emma_repositoryRecordId],\n fmt: ed[:dc_format] || FileFormat.metadata_fmt(fmt),\n ext: ext,\n state: 'completed',\n phase: 'create',\n file_data: (serialize ? fd.to_json : fd),\n emma_data: (serialize ? ed.to_json : ed),\n }\n end",
"def render_file_data(field: :file_data, **opt)\n data = object.try(field) || object.try(:[], field)\n render_json_data(data, **opt, field_root: field)\n end",
"def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend",
"def update_file_data(task_data)\n task_data['files'].each { |f| f['name'] = f['filename'] }\n task_data\n end",
"def update_file_data(task_data)\n task_data['files'].each { |f| f['name'] = f['filename'] }\n task_data\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def post_import_fields_from_xfdf_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_import_fields_from_xfdf ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_import_fields_from_xfdf\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/xfdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'xfdf_data'] if !opts[:'xfdf_data'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_import_fields_from_xfdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize filename\n\t\tFile.open(filename) do |f|\n\t\t\ts = f.gets\n\t\t\tputs \"first line of the vineRecord file (should be the entire json string): #{string}\"\n\t\tend\n\n\t\t@record = JSON.parse(s)\n\tend",
"def import_params\n params.permit(:import_type, :file)\n end",
"def set_asset_metadata\n headers = fog_connection.head_object(CarrierWave::Uploader::Base.fog_directory, upload_data[:path]).headers\n\n self.name = upload_data[:filename]\n self.size = headers['Content-Length']\n self.etag = headers['Etag']\n self.content_type = headers['Content-Type']\n end",
"def post_import_fields_from_fdf_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_import_fields_from_fdf ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_import_fields_from_fdf\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/fdf\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'fdf_data'] if !opts[:'fdf_data'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_import_fields_from_fdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def uploaded_narrative=(narrative_field)\n # Nothing yet\n name=narrative_field.original_filename\n file=narrative_field\n if narrative_field!=\"\"\n self.content_type=narrative_field.content_type.chomp\n self.content=narrative_field.read\n if content.starts_with?(\"MSH|\") or content.starts_with?(\"FHS|\")\n raise WedgieError,\"This interface should not be used to upload HL7 -- use Upload File on the left-hand menu instead\"\n end\n convert_docs(name)\n else\n self.content_type=\"text/x-clinical\"\n end \n end",
"def append_raw(path, format, data)\n path = relativize_path path\n\n content_type = if format == :json then\n 'application/json'\n elsif format == :json_stream\n 'application/x-json-stream'\n elsif CSV === format\n 'text/csv'\n elsif format == :csv\n format = DEFAULT_CSV\n 'text/csv'\n else\n raise \"invalid format: #{format}\" # todo\n end\n\n csv_params = if CSV == format then\n { :escape => CSV.escape, :delimiter => CSV.delimiter, :quote => CSV.quote }\n else\n {}\n end\n\n header = { 'Content-Type' => content_type }\n params = { :apiKey => api_key, :receipt => true, :mode => 'batch' }.merge csv_params\n resp = Precog.post(self, \"/ingest/v#{VERSION}/fs/#{path}\", data, header, params)\n\n results = JSON.parse resp.body\n [results[\"ingested\"], results[\"errors\"]]\n end",
"def append_from_file(path, format, file)\n path = relativize_path path\n\n content_type = if format == :json then\n 'application/json'\n elsif format == :json_stream\n 'application/x-json-stream'\n elsif CSV === format\n 'text/csv'\n elsif format == :csv\n format = DEFAULT_CSV\n 'text/csv'\n else\n raise \"invalid format: #{format}\" # todo\n end\n\n csv_params = if CSV == format then\n { :escape => CSV.escape, :delimiter => CSV.delimiter, :quote => CSV.quote }\n else\n {}\n end\n\n header = { 'Content-Type' => content_type }\n params = { :apiKey => api_key, :receipt => true, :mode => 'batch' }.merge csv_params\n\n File.open(file, 'r') do |stream|\n back = []\n stream.each_line do |chunk|\n resp = Precog.post(self, \"/ingest/v#{VERSION}/fs/#{path}\", chunk, header, params)\n\n results = JSON.parse resp.body\n back << [results[\"ingested\"], results[\"errors\"]]\n end\n back\n end\n end",
"def payload_for(filename)\n JSON.parse(get_json(filename), symbolize_names: true)\n end",
"def pre_process_logger_file_upload\n @project = parent\n @data_templates = parent.managed_repository{Voeis::DataStream.all(:type => \"Sensor\")}\n @general_categories = Voeis::GeneralCategoryCV.all\n @sites = parent.managed_repository{Voeis::Site.all}\n end",
"def ingest_file(file)\n working_file = copy_file_to_working_directory(file, file_set.id)\n mime_type = file.respond_to?(:content_type) ? file.content_type : nil\n IngestFileJob.perform_later(file_set, working_file, mime_type, user, relation)\n true\n end",
"def _set(uploaded_file)\n write(uploaded_file ? uploaded_file.to_json : nil)\n end",
"def upload\n ActivityLogSeeder.import!(params[:csv_file].tempfile) # background it for large files\n render json: { message: 'Uploaded successfully' }\n end",
"def import_grid_file(file_path, name = nil, contentType = nil, metadata = nil)\n os_file = File.open(file_path, 'rb')\n description = {}\n description[:filename] = name if !name.nil?\n description[:contentType] = name if !contentType.nil?\n description[:metadata] = metadata if !metadata.nil?\n \n grid_file = Mongo::Grid::File.new(os_file.read, description)\n @@db.database.fs.insert_one(grid_file)\n end",
"def initialize file_path\n\t\t\t@file_path = file_path\n\t\t\t@meta = {}\n\t\tend",
"def uploaded_file=(file_field)\n self.filename = base_part_of(file_field.original_filename)\n\n f_str = Iconv.conv('utf-8', self.encoding, file_field.read)\n\n f = StringIO.new(f_str)\n\n if self.format == 'OBT'\n it = OBNOTextIterator.new(f, self.sentence_delimiter == 'delimiter')\n elsif self.format == 'VRT'\n it = VRTReader.new(f)\n else\n raise RuntimeError\n end\n\n it.each_sentence {|s| sentences << s}\n f.close()\n\n # add postamble stored in iterator after parsing last sentence\n # TODO add support for arbitrary data for OBT format\n if self.format = 'VRT'\n self.postamble = it.postamble\n end\n end",
"def extract_metadata; end",
"def postIngest_file( job_id, filedata)\n params = Hash.new\n params['job_id'] = job_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/ingest_file\",params)\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"def import\n Rails.logger.info(\"Beginning import of TripAdvisor location data\")\n data = JSON.parse(io.read)\n\n import_location(nil, data)\n Rails.logger.info(\"Finished import of TripAdvisor location data\")\n end",
"def multipart_upload\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def initialize(name, metadata = {})\n super\n @files = {}\n end",
"def string_based_upload(job)\n upload_files = job.instance_variable_get(:@files).each_with_index.map {|file, i|\n (original_filename, stream) = file\n io = File.open(stream)\n stringIO = StringIO.new(io.read)\n [\"files[#{i}]\", UploadIO.new(stringIO, \"text/plain\", original_filename)]\n }\n\n payload = Hash[upload_files].merge('job' => job.instance_variable_get(:@job).to_json)\n\n Rails.logger.debug(payload)\n\n response = JSONModel::HTTP.post_form(\"#{JSONModel(:job).uri_for(nil)}_with_files\",\n payload,\n :multipart_form_data)\n\n ASUtils.json_parse(response.body)\n end",
"def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"../report.txt\", \"w+\")\nend",
"def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end"
] |
[
"0.655321",
"0.6027442",
"0.5986133",
"0.5986133",
"0.59479463",
"0.59479463",
"0.59326756",
"0.58981025",
"0.58463246",
"0.57984537",
"0.5775936",
"0.57386565",
"0.57286096",
"0.5716162",
"0.5716162",
"0.5674555",
"0.56403655",
"0.56237704",
"0.56199056",
"0.5605414",
"0.5561615",
"0.555501",
"0.5549717",
"0.55265814",
"0.5525164",
"0.5494502",
"0.54825354",
"0.54683864",
"0.54652053",
"0.5463108",
"0.5463108",
"0.54540163",
"0.545125",
"0.54427326",
"0.54353875",
"0.54270554",
"0.5412414",
"0.54062235",
"0.54058385",
"0.5404128",
"0.53997916",
"0.5393669",
"0.5393344",
"0.539163",
"0.53915155",
"0.53903013",
"0.53863263",
"0.5383205",
"0.53744006",
"0.53463566",
"0.53355736",
"0.53337055",
"0.5324314",
"0.5316543",
"0.5316511",
"0.53161436",
"0.5312448",
"0.5310971",
"0.5304886",
"0.53010714",
"0.53006",
"0.5292169",
"0.52833974",
"0.5282387",
"0.5280997",
"0.52741456",
"0.5270262",
"0.5267797",
"0.5267077",
"0.5267077",
"0.5260932",
"0.52587086",
"0.52571213",
"0.5251087",
"0.52438813",
"0.52394193",
"0.52372813",
"0.52307165",
"0.52232206",
"0.52225655",
"0.52152693",
"0.5214731",
"0.52122736",
"0.5211179",
"0.5204342",
"0.520257",
"0.5191885",
"0.51855177",
"0.51811326",
"0.51777685",
"0.5172115",
"0.5168476",
"0.51648486",
"0.5159543",
"0.51488733",
"0.5144331",
"0.5142656",
"0.51421446",
"0.51405233",
"0.5131759"
] |
0.6006758
|
2
|
The activesupport to_query extension doesn't escape the = character as it's meant for a primary query string
|
def to_query(params)
params.to_query.gsub("=", "%3D").gsub("&", "%26")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stringToQuery (val)\n\t\t\n\tend",
"def to_query(key)\n \"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}\"\n end",
"def to_query(params)\n params.map do |key,value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end * '&'\n end",
"def to_query(params)\n params.map{|k,v| \"#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}\"}.join('&')\n end",
"def format_hash_as_query_string(query_params)\n # replace Ruby => assignment operators with JSON standard colons (:)\n sanitized_params = query_params.to_s.gsub(/=>/, ':')\n CGI.escape(sanitized_params)\n end",
"def escaped_query\n /\\s/.match?(query) ? \"\\\"#{query}\\\"\" : query\n end",
"def escape_query_value(s)\n s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/u) {\n '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase\n }.tr(' ', '+')\n end",
"def query\n params.sort.map { |k, v| \"#{k}=\" + escape(v) }.join('&')\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def url_query_string(leading_slash = true)\n (leading_slash ? \"/?\" : \"?\") << URI.escape(self.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n end",
"def pre_escape_query(query)\n # have to include apostrophe in here too, even though it's NOT\n # in the docs reserved list (and does not generally require URI escaping,\n # in theory) -- still need to double escape it to avoid YBoss returning\n # ' in suggestions! \n #\n # Do not need to double escape spaces even though they do need URI escaping. \n #\n # We are telling it ONLY to escape our list of punctuation that causes\n # trouble for YBoss unless double-escaped. Which means it won't escape\n # diacritics and other non-latin. Which means the output is still UTF8, \n # but ruby URI.escape incorrectly tags it \"ascii\", which causes probelms\n # later with illegal bytes -- so we need to retag as UTF-8 \n return URI.escape(query, \"/?&;:@,$=%\\\"#*<>{}|[]^\\\\`()'\").force_encoding(\"UTF-8\")\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def to_query(params)\n p = []\n params.each do |k,v|\n p << \"#{k}=#{v}\"\n end\n\n p.join \"&\"\n end",
"def to_query\n {\n params: query\n }\n end",
"def to_query\n {\n params: query\n }\n end",
"def serialize_query\n @query.map { |k,v| \"#{k}=#{v}\" }.join(\"&\")\n end",
"def querinize(hash)\n \"?\" + hash.map { |k, v| \"#{k}=#{URI.encode(v.to_s)}\" }.join(\"&\")\n end",
"def query_string(params)\n params = full_options params\n params[:sign] = sign params\n \"?\" + params.to_query\n end",
"def escape_query(query)\n # backslash escape doesn't seem to work\n #query.gsub(/([\\\\\\(\\)\\:])/) do |match|\n # \"\\\\#{$1}\"\n #end\n query.gsub(/([\\\\\\(\\)\\:])/, ' ')\n end",
"def query_string\n end",
"def query_string(**params)\n params.map { |k, v| [k, v].join('=') }.join('&')\n end",
"def query=(v)\n return @query = nil unless v\n raise InvalidURIError, \"query conflicts with opaque\" if @opaque\n\n x = v.to_str\n v = x.dup if x.equal? v\n v.encode!(Encoding::UTF_8) rescue nil\n v.delete!(\"\\t\\r\\n\")\n v.force_encoding(Encoding::ASCII_8BIT)\n raise InvalidURIError, \"invalid percent escape: #{$1}\" if /(%\\H\\H)/n.match(v)\n v.gsub!(/(?!%\\h\\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X' % $&.ord}\n v.force_encoding(Encoding::US_ASCII)\n @query = v\n end",
"def query_normalization\n uri = Addressable::URI.parse(@url)\n tmp_q = (uri.query_values || {}).merge(@query)\n\n return tmp_q if tmp_q.empty? && tmp_q.values.all? { |v| v.encode == @encoding }\n tmp_q.each_key { |k| tmp_q[k].encode! @encoding }\n tmp_q\n end",
"def query_string\n return @query_string\n end",
"def to_query(params = nil)\n return \"\" if params.nil?\n return \"\" if params.respond_to?(:empty?) && params.empty?\n\n escape = Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\")\n params_in_json = MultiJson.dump(params)\n uri_params = URI.escape(params_in_json, escape)\n\n params = {\n params: uri_params,\n signature: signature(params_in_json)\n }\n\n \"?\" + params.map { |k, v| \"#{k}=#{v}\" if v }.compact.join(\"&\")\n end",
"def query\n @query = Riddle::Query.escape params[:search]\n end",
"def query\n @query = Riddle::Query.escape params[:search]\n end",
"def to_query_string\n query = @uri.query\n query ? Wgit::Url.new(\"?#{query}\") : nil\n end",
"def query_string\n return nil if @request.query_string.to_s.empty?\n\n parts = @request.query_string.split(/[&;] */n)\n parts.map! { |p| p.split('=', 2).map!{ |s| unescape(s) } }\n parts.sort!\n parts.reject!(&self.class.query_string_ignore)\n parts.map! { |k,v| \"#{escape(k)}=#{escape(v)}\" }\n parts.empty? ? nil : parts.join('&')\n end",
"def to_query\n list.values.map {|element| element.to_query }.join('&')\n end",
"def escape(query)\n @my.escape(query)\n end",
"def to_query\n query = @uri.query\n query ? Wgit::Url.new(query) : nil\n end",
"def to_query_string(hash)\n hash.map do |key, value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end.join(\"&\")[/.+/]\n end",
"def query_string\n ast.to_query_string\n end",
"def to_query_string(params)\n params.map do |key, value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end.join('&')\n end",
"def query_string\n return nil if @request.query_string.nil?\n\n @request.query_string.split(/[&;] */n).\n map { |p| unescape(p).split('=', 2) }.\n sort.\n map { |k,v| \"#{escape(k)}=#{escape(v)}\" }.\n join('&')\n end",
"def query_string\n return nil if @request.query_string.nil?\n ignore_query_params = [\"no-cachely\", \"refresh-cachely\", Rack::Cachely.config.ignore_query_params].flatten\n query = @request.query_string.split(/[&;] */n).map { |p| unescape(p).split('=', 2) }.sort\n query = query.reject{|k,v| ignore_query_params.include?(k)}.map{ |k,v| \"#{escape(k)}=#{escape(v)}\" }\n\n query.join('&')\n end",
"def query_string(params)\n params.map do |k, v|\n \"#{CGI::escape(k)}=#{CGI::escape(v)}\"\n end.join(\"&\")\n end",
"def query_string=(value)\n @query_string = value\n end",
"def query_params\n @query_params ||= params[:query].present? ? JSON.parse(params[:query].gsub('=>', ':')) : {}\n end",
"def canonical_query_string\n params.sort\n .map { |key, value| \"#{uri_escape(key)}=#{uri_escape(value)}\" }\n .join('&')\n end",
"def escape_query(query, namespace = nil) # :nodoc:\n pairs = []\n\n query.each do |attr, value|\n left = namespace ? \"#{namespace}[#{attr.to_s}]\" : attr.to_s\n if values = Array.try_convert(value)\n pairs += params_from_array(left, values)\n elsif values = Hash.try_convert(value)\n pairs.push(escape_query(values, left.dup))\n else\n if value.respond_to?(:read)\n value = value.read\n end\n pairs.push(to_param(left, value))\n end\n end\n pairs.join('&')\n end",
"def to_query(hash)\n query = []\n hash.each do |key, value|\n query << \"#{key.to_s}=#{value.to_s}\"\n end\n query.join('&')\n end",
"def query_param(raw_query_str)\n \"query:(query_string:(analyze_wildcard:\" \\\n \"!t,query:'#{escape(raw_query_str)}'))\"\n end",
"def unsigned_query_string\n (should_encode? ? RestClient::Payload.generate(query_params) : query_params).to_s\n end",
"def par_query_string(llave, valor)\n \"#{URI.escape llave.to_s}=#{URI.escape valor.to_s}\"\n end",
"def append_to_query_string(piece)\n new_qs = '?' + [self.query_string.gsub(/^\\?/, ''), piece].reject{|e| e.blank? }.join('&')\n self.query_string = new_qs\n end",
"def query\n sanitize search_params['query']\n end",
"def query_params\n params.permit(:aql)\n end",
"def query\n\t\t\treturn @query if @query\n\n\t\t\t@query = CGI.parse(request.query_string)\n\t\t\t@query.default = nil # ruby/lib/cgi/core.rb:340 = den of iniquity.\n\t\t\t@query\n\t\tend",
"def build_query(uri, args = {})\n new_query = URI.decode_www_form(uri.query || '')\n args.to_a.each { |arg| new_query << arg }\n key = Phantomblaster.configuration.api_key\n new_query << ['key', key] if key && ENV['GEM_ENV'] != 'test'\n URI.encode_www_form(new_query)\n end",
"def create_query_string(hash)\n parts = hash.map {|key,value| \"#{CGI.escape(key)}=#{CGI.escape(value)}\"}\n return parts.join('&')\n end",
"def query=( uri )\n @query = Addressable::URI.parse( uri.to_s )\n #self.query = URI.parse( uri.to_s )\n uri\n end",
"def hash_to_querystring(hash)\n hash.keys.inject('') do |query_string, key|\n query_string << '&' unless key == hash.keys.first\n query_string << \"#{URI.encode(key.to_s)}=#{URI.encode(hash[key])}\"\n end\n end",
"def __to_params__\n map { |k,v| \"#{k.to_s}=#{URI.escape(v.to_s)}\" }.join('&')\n end",
"def uri\n \"#{query_uri}?#{query_options.to_query}\"\n end",
"def handle_query_param\n if params[:query].is_a? ActionController::Parameters \n params[:query].permit!\n params[:query].to_h\n else\n params[:query]\n end\n end",
"def uri_query(h)\n a = Array.new()\n h.each_pair {|key, val| a.push(URI.escape(key) + \"=\" + URI.escape(val)) }\n return a.join(\"&\")\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val |\n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def query_string\n ''\n end",
"def http_build_query(params = {})\n params.collect do |k,v|\n \"#{URI.encode(k.to_s)}=#{URI.encode(v.to_s)}\" unless v.nil?\n end.compact.join('&')\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def term_to_query(term)\n \"%#{term}%\"\nend",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def unsigned_query_string_stripped\n @query_params_text ||= obj_to_stripped_string(query_params)\n end",
"def query_string_params=(new_param_hash)\n self.query_string = qs_build(new_param_hash)\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end",
"def query_string\n \"\"\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val | \n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def normalize_with_encoded_query\n normalize_without_encoded_query.tap do |uri|\n if uri.query_values.present?\n uri.query_values = uri.query_values.map { |key, value| [key, value] }\n end\n uri\n end\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def serialize_for_query(value)\n return value if value.nil?\n str_val = value.to_s\n return value if str_val =~ /^==|=\\*/\n return value if str_val =~ /(\\.\\.\\.)/\n return value if str_val =~ /\\A(<|<=|>|>=)/\n\n @type.__filemaker_serialize_for_query(value)\n rescue StandardError => e\n warn \"[#{e.message}] Could not serialize for query: #{name}=#{value}\"\n value\n end",
"def sanitize_query(q)\n return '' if q.nil?\n q.gsub(/\\s+/, ' ').gsub(/[^a-zA-Z 0-9\\*\\?'\\\"]/i, '?')\n end",
"def hash_to_query_string(h)\n if qs = URI.escape(h.to_a.map{|e| e.join('=') }.join('&'))\n '?' + qs\n else\n ''\n end\n end",
"def to_http_query\n\t\t\t\t\tparams = {\n\t\t\t\t\t\t'message' => @message,\n\t\t\t\t\t\t'msisdn' => @recipient,\n\t\t\t\t\t\t'msg_class' => @msg_class,\n\t\t\t\t\t\t'want_report' => @want_report,\n\t\t\t\t\t\t'routing_group' => @routing_group,\n\t\t\t\t\t\t'source_id' => @source_id,\n\t\t\t\t\t\t'test_always_succeed' => @test_always_succeed,\n\t\t\t\t\t\t'test_always_fail' => @test_always_fail,\n\t\t\t\t\t\t'allow_concat_text_sms' => @concat_text_sms,\n\t\t\t\t\t\t'concat_text_sms_max_parts' => @concat_max_parts\n\t\t\t\t\t}\n\t\t\t\t\tquery_string = params.collect { |x, y| \"#{x}=#{y}\" }.join('&')\n\t\t\t\t\tURI.encode(query_string)\n\t\t\t\tend",
"def query(query, params={})\n query *= '+' if query.is_a? Array\n request '', params.merge(:query => query)\n end",
"def query\n Riddle::Query.escape params[:search_txt]\n end",
"def to_query_options(options)\n return '' if !options.is_a?(Hash) || options.empty?\n \"?#{options.map{ |k,v| \"#{k}=#{v}\" }.join('&')}\"\n end",
"def create_queries arg\n a = \"\"\n arg.each_key do |key|\n a << ((a.empty?) ? \"\" : \"&\") \n a << key.to_s << \"=\" << arg[key].to_s\n end\n a\n end",
"def percent_encoded_raw_user_search_query\n CGI.escape(@q)\n end",
"def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end",
"def preprocess_query(query, *binds)\n mutex.synchronize do\n self.last_query = query\n end\n\n ep = Epoxy.new(query)\n ep.quote { |x| %Q{'#{binds[x].to_s.gsub(/'/, \"''\")}'} }\n end",
"def force_convert_to_params\n build_nested_query(to_hash)\n end",
"def query_params\n params[:query]\n end",
"def build_query_params(url, query_params)\n params = URI.encode_www_form(query_params)\n url.concat(\"?#{params}\")\n end",
"def build_query_string(hash)\n elements = []\n query_string = \"\"\n\n hash.each do |key, value|\n\t key = CGI.escape key\n\t key += '[]' if value.class == Array\n\t value = [ value ] unless value.class == Array\n\t value.each { |val| elements << \"#{key}=#{CGI.escape(val.to_s)}\" }\n\tend\n unless elements.empty? then query_string << (\"?\" + elements.join(\"&\")) end\n \n return query_string\n end",
"def params\n @params||=Addressable::URI.parse(\"?#{@http_query_string}\").query_values\n end",
"def query_params\n params.fetch(:query, {})\n end",
"def method_6(query)\n\t\tquery = [query[0].chr + \"%\" + query[-1].chr]\n\tend",
"def to_param\n query_id\n end",
"def parse_query(qs, d = nil)\n params = {}\n (qs || '').split(d ? /[#{d}] */n : /[&;] */n).each do |p|\n k, v = p.split('=', 2).map { |x| CGI::unescape(x) }\n if (cur = params[k])\n if cur.class == Array\n params[k] << v\n else\n params[k] = [cur, v]\n end\n else\n params[k] = v\n end\n end\n\n params\n end",
"def query(value = nil, command = nil)\n return @query if value.nil?\n\n @query = sanitize_query(value, command)\n end",
"def normalize_qs(query_string)\n \"?\" + query_string.to_s.gsub(/^\\?/, '').split(/&/).sort.join('&')\n end",
"def query_params=(_arg0); end",
"def method_7(query)\n\t\tquery = [query[0..1] + \"%\" + query[-2..-1]]\n\tend",
"def serialize_for_query(value)\n return value if value.nil?\n return value if value =~ /^==|=\\*/\n return value if value =~ /(\\.\\.\\.)/\n\n @type.__filemaker_serialize_for_query(value)\n rescue StandardError => e\n warn \"[#{e.message}] Could not serialize for query: #{name}=#{value}\"\n value\n end",
"def build_canonical_querystring query\n params = query.split \"&\"\n params = params.map { |p| p.include?(\"=\") ? p : \"#{p}=\" }\n\n params.each.with_index.sort do |(a, a_offset), (b, b_offset)|\n a_name, a_value = a.split \"=\"\n b_name, b_value = b.split \"=\"\n if a_name == b_name\n if a_value == b_value\n a_offset <=> b_offset\n else\n a_value <=> b_value\n end\n else\n a_name <=> b_name\n end\n end.map(&:first).join(\"&\")\n end"
] |
[
"0.7703351",
"0.74878",
"0.73181206",
"0.7265",
"0.7253914",
"0.7204443",
"0.71720487",
"0.71463305",
"0.7111515",
"0.70547235",
"0.7051908",
"0.70347655",
"0.6945585",
"0.6938111",
"0.6905837",
"0.6905837",
"0.688844",
"0.68221706",
"0.67786735",
"0.67511123",
"0.67496675",
"0.66998625",
"0.6668401",
"0.6643194",
"0.6634347",
"0.66281533",
"0.66035604",
"0.6602188",
"0.6566675",
"0.65590787",
"0.655855",
"0.6554153",
"0.65523905",
"0.6541239",
"0.6540242",
"0.6536948",
"0.6512034",
"0.6496382",
"0.6477956",
"0.647561",
"0.64731836",
"0.6441105",
"0.64376396",
"0.64324003",
"0.64282876",
"0.6425635",
"0.64204204",
"0.64109135",
"0.64065236",
"0.640559",
"0.6388403",
"0.636829",
"0.63447624",
"0.6317852",
"0.6302336",
"0.62995183",
"0.6282769",
"0.62780386",
"0.62660575",
"0.62651956",
"0.6264242",
"0.6255585",
"0.6240328",
"0.6240328",
"0.62393314",
"0.62356603",
"0.62356603",
"0.6234525",
"0.62336385",
"0.6231996",
"0.62305766",
"0.62254155",
"0.6224296",
"0.62240237",
"0.62159765",
"0.6194941",
"0.6190858",
"0.6179057",
"0.6176162",
"0.61749065",
"0.616877",
"0.6164455",
"0.61640286",
"0.6159798",
"0.6157195",
"0.6151968",
"0.61423856",
"0.61409307",
"0.6117057",
"0.6115992",
"0.61103714",
"0.6096998",
"0.6094847",
"0.6094055",
"0.6076424",
"0.60758525",
"0.6059227",
"0.6043566",
"0.6037439",
"0.603644"
] |
0.77410597
|
0
|
TODO: Add email validation
|
def initials
self.first_name[0].to_s + self.last_name[0].to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def email; end",
"def email; end",
"def email; end",
"def email; end",
"def email; @email; end",
"def email\n end",
"def email_required?; false end",
"def inbound_email; end",
"def inbound_email; end",
"def email_required?\n false\n end",
"def email_required? \n false \n end",
"def check_email\n self.email_address=~/^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i if email_address\n end",
"def email_required?\r\n false\r\n end",
"def email_required?\n true\n end",
"def email_login\n end",
"def email_required?\n false\n end",
"def email\n params['email']\n end",
"def match_by_email\n true\n end",
"def email_required?\n \tfalse\n end",
"def validates_email\n self.type == 'email'\n end",
"def email\n\t\tnil\n\tend",
"def email\n\t\tnil\n\tend",
"def email\n @email \n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email\n\t\t@email\n\tend",
"def email\n\t\t@email\n\tend",
"def email_required?\n false\n end",
"def get_mail\n \n end",
"def email_list\n end",
"def email_required?\n return false\n end",
"def email_required?\n\t\tfalse\n\tend",
"def email_validate\n if !normalized_email.include? '@'\n puts \"Invalid e-mail address entered #{normalized_email}\"\n else\n true\n end\n end",
"def fValidateEmail (email)\n @users.validateEmail(email)\n end",
"def email\n login\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def email_required?\n false\n end",
"def validate_email\n return if self.email.blank?\n errors.add(:email, :not_a_valid_email) if !Valid.email?(self.email)\n end",
"def emailform\n end",
"def emailform\n end",
"def all_without_email\n\n end",
"def email\n\t\treturn @email\n\tend",
"def email_addr_acceptable\n #start\n #@user_name = params[:user_name]\n return true\n end",
"def email_validate(contacts, current_email) \n if contacts.where(email: current_email).present?\n return true\n end\n false\n end",
"def email_check\n if !email =~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n errors.add :base, \"Email is in an invalid format.\"\n end\n end",
"def email_valid?\n if self.class.exists?(email: self.email)\n false\n else\n true\n end\n end",
"def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end",
"def email_entered\n !email.nil? \n end",
"def email\n get_attribute('Email')\n end",
"def available_email_login?\n true\nend",
"def email\n find_by_type('email')\n end",
"def validateEmail(email)\n if (email == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def email\n begin\n super\n rescue NoMethodError\n nil\n end\n end",
"def email\n @attributes[:email]\n end",
"def email\n @attributes[:email]\n end",
"def email\n @attributes[:email]\n end",
"def email\n @attributes[:email]\n end",
"def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend",
"def set_email_field(email)\n end",
"def email\n return @email\n end",
"def email\n return @email\n end",
"def check_email\r\n \temail = Referral.where(:email=>self.email, :referrer=>self.referrer)\r\n \t if email.present?\r\n\t \traise \"You are already registered..!!\"\r\n\t end\r\n end",
"def email_available?\n\t\tself.valid?\n\tend",
"def vaid_email?\n\t\tif email.match(FORBIDDEN_EMAILS)\n\t\t\terrors.add(:email,\"error! email has been restricted!\")\n\t\tend\t\t\n\tend",
"def get_activate_email\n end",
"def username_is_email\n errors.add(:userName,'is not in email format') unless userName=~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n end",
"def email_valid(email)\n if !email.empty?\n self.email = email\n return true\n end\n end",
"def validate_email\n if !self.email.match(/\\A#{ApplicationHelper.form_field_attr('email')[:regex]}\\Z/i)\n self.errors.add(:email, \"#{ApplicationHelper.form_field_attr('email')[:generic]}\")\n end\n end",
"def sandbox_email_address; end",
"def sandbox_email_address; end",
"def email\n self[:emailAddress]\n end"
] |
[
"0.74439025",
"0.74439025",
"0.74439025",
"0.74439025",
"0.7364892",
"0.7335147",
"0.7242103",
"0.71166867",
"0.71166867",
"0.70264524",
"0.7018231",
"0.7018185",
"0.7002332",
"0.6996276",
"0.699015",
"0.69869304",
"0.6957409",
"0.694389",
"0.69387954",
"0.6933944",
"0.6926779",
"0.6926779",
"0.69171554",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912801",
"0.6912742",
"0.6912742",
"0.68759084",
"0.68728065",
"0.6871176",
"0.6839488",
"0.68165576",
"0.67964375",
"0.6771127",
"0.6758396",
"0.6709884",
"0.6709884",
"0.6709884",
"0.6709884",
"0.67029047",
"0.6696921",
"0.6696921",
"0.6685838",
"0.66769785",
"0.66595507",
"0.66530347",
"0.6652789",
"0.6629984",
"0.65976113",
"0.65905946",
"0.65902025",
"0.6585261",
"0.65741414",
"0.65674835",
"0.65397745",
"0.65301347",
"0.65301347",
"0.65301347",
"0.65301347",
"0.652803",
"0.6508303",
"0.65007615",
"0.65007615",
"0.64987683",
"0.64975655",
"0.6489167",
"0.6483738",
"0.6480202",
"0.648004",
"0.64753264",
"0.6471658",
"0.6471658",
"0.64653814"
] |
0.0
|
-1
|
Method for only sending mail to the first recipient that is not sent yet
|
def send_new_mail(document)
recipient = Recipient.where(document: document, sent: false).first
if recipient.present?
DocumentMailer.with(user: document.user,
email: recipient.email,
document: document).signature_email.deliver_later
recipient.update(sent: true)
DocumentEvent.create!(document: document, message: "E-post sendt til #{recipient.email} ")
if document.status != 1
document.update!(status: 1)
end
else
document.update!(status: 2)
send_signature_complete_mail(document)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first_email_sent_to(recipient)\n self.current_email = emails_sent_to(recipient).last\n end",
"def mailboxer_email(object)\n shouldSendEmail = true\n email if shouldSendEmail\n end",
"def delivered_mail(pos = 1)\n ActionMailer::Base.deliveries.last(pos).first\n end",
"def send_emails\n mail = build_mail\n get_recipients do |recipient|\n unless EmailResponse.exists?(email: recipient.email) # bounces & complaints\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end\n end\n end",
"def process_and_send_for_one (recipient)\n mail_payload = MailPayload.new(\n :subject => subject(recipient),\n :body => message(recipient),\n :recipient_record => recipient,\n :recipient_type => (recipient_type == 'parent' ? 'guardian' : recipient_type),\n :sender => User.find_by_id(sender_id),\n :hostname => Fedena.hostname,\n :mail_type => :alert,\n :alert_name => alert_name,\n :mail_logger => mail_logger\n )\n mail_payload.send_mail # TODO: handle response\n recipient\n end",
"def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n queued_email_strings.map do |x|\n \"#{x.key}=\\\"#{x.value}\\\"\"\n end.join(\" \")\n self.class.debug_log(log_msg)\n current_locale = I18n.locale\n result = false\n if user.present? && user == to_user\n unless Rails.env.test?\n raise(\"Skipping email with same sender and recipient: #{user.email}\\n\")\n end\n else\n result = deliver_email\n end\n I18n.locale = current_locale\n result\n rescue StandardError => e\n warn(\"ERROR CREATING EMAIL\")\n warn(log_msg)\n warn(e)\n warn(e.backtrace)\n I18n.locale = current_locale\n false\n end",
"def send_email_if_needed\n \tif self.is_response\n \t\tlogger.info \"Send Email\"\n \t\tMessageMailer.reply_email( self ).deliver\n \tend\n end",
"def first_contact\n\n mail(\n to:\n cc:\n subject: \"We will contact you soon!\"\n )\n end",
"def sends_notification_email(recipient)\n last_email = ActionMailer::Base.deliveries.last\n expect(last_email.to).to include(recipient.email) if last_email\nend",
"def create_mail\n # Removes the current user from the recipients and cc\n # if he doesn't want to receive notifications about what he does\n @author ||= User.current\n if @author.pref[:no_self_notified]\n recipients.delete(@author.mail) if recipients\n cc.delete(@author.mail) if cc\n end\n \n notified_users = [recipients, cc].flatten.compact.uniq\n # Rails would log recipients only, not cc and bcc\n mylogger.info \"Sending email notification to: #{notified_users.join(', ')}\" if mylogger\n \n # Blind carbon copy recipients\n if Setting.bcc_recipients?\n bcc(notified_users)\n recipients []\n cc []\n end\n super\n end",
"def process_mail_from sender\n if @state.include? :mail_from\n @state -= [:mail_from, :rcpt, :data]\n receive_reset\n end\n\n super\n end",
"def send_mail(recipient, subject)\n if recipient.email_notifications\n mail(to: recipient.email, subject: subject)\n else\n p 'recipient has email notifications turned off.'\n end\n end",
"def reserved_mail\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n email\n #if false\n #return nil\n end",
"def deliver_email\n#puts \"**** deliver_email: emails=#{emails}\"\n emails = @contact_info.map {|c| c[:email]}.compact.uniq\n self.subject ||= 'Message from SIM Nigeria'\n id_for_reply = self.following_up || id # a follow-up message uses id of the original msg\n#puts \"**** Messages#deliver_email response_time_limit=#{response_time_limit}\"\n outgoing = Notifier.send_group_message(:recipients=>emails, :content=>self.body, \n :subject => subject, :id => id_for_reply , :response_time_limit => response_time_limit, \n :bcc => true, :following_up => following_up) # send using bcc:, not to:\nraise \"send_email with nil email produced\" if outgoing.nil?\n outgoing.deliver\n # Mark all as being sent, but only if they have an email address\n # This is terribly inefficient ... need to find a way to use a single SQL statement\n sent_messages.each do |sm| \n sm.update_attributes(:msg_status => MsgSentToGateway) if sm.member.primary_email\n end\n end",
"def send_thx_email\n @user = User.where(:uid => self.uid).first\n if !@user.nil? && !@user.email.nil?\n Services::Mandrill.mail(@user.email, 'PicsforPets_2013_Reportback', 'How to get puppies adopted')\n end\n end",
"def send_email\n true\n end",
"def mail_should_not_be_sent\n email = ActionMailer::Base.deliveries.pop\n expect(email.present?).to be false\nend",
"def mail(subject, recipient, message)\n user = User.discover(id, recipient).take\n UserMailer.student_email(user, subject, message).deliver\n end",
"def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end",
"def get_email_recipient\n user == chat.sender ? chat.recipient : chat.sender\n end",
"def recipient\n @recipient ||= User.find_or_create_by(display_name: 'Recipient Patron', email: 'no-reply+recipient@lafayette.edu', username: 'no-reply+recipient')\n end",
"def receive_email\n \n \n #if one of the to addresses matches us, use that one. todo - correctly handle mulitple emails, or correctly fail\n if params[:to].match(/group\\+(\\d+)@/) && @group = Group.find($1)\n from = params[:from]\n body = params[:plain].gsub(/^On .* wrote:$\\s*(^>.*$\\s*)+/,'') #strip out replies and whatnot\n\n if @sender = @group.students.find_by_email(from)\n @group.send_message(@sender.name+\": \"+body,@sender,[@group.user])\n elsif @group.user.email==from\n @group.send_message(@group.user.display_name+\": \"+body,@group.user)\n end\n end\n render :text => 'success', :status => 200\n end",
"def recipient\n return self.unless_nil?('invitee.email', deliveries.unless_nil?('first.recipients', '') )\n end",
"def send_one!(recipient)\n message_data = message_data([recipient])\n @mandrill.messages.send_template(template, recipient.custom_html_data, message_data)\n end",
"def queued_message_sending\n if recipient.prefers_receive_email_notifications\n # we send some messgaes to the different mailer\n UserMailer.send(\"deliver_#{admin_message.mailer_method}\", self, recipient)\n end\n end",
"def mail\n if @message.to.empty?\n flash.now[:no_server] = true\n return render :edit\n end\n\n MessageMailerSenderJob.perform_later(@message)\n @message.sent!\n render :show\n end",
"def preview_to(recipient)\n @newsletter = build_newsletter\n mail = build_mail\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end",
"def send_email\n # There is a deliver_later method which we could use\n InvoiceMailer.email_invoice(self).deliver_now\n self.sent_by_email = true\n self.save\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\n end",
"def send!\n if id = send\n return id\n else\n raise Postal::CouldNotSendMailing, 'Your mail was invalid and could not be sent.'\n end\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def late(receiver)\n @greeting = \"Hi\"\n mail to: receiver, subject: \"Hi\"\n end",
"def set_recipient\n end",
"def send_email_to_participants(request)\n unless RAILS_ENV == \"test\"\n recipients(last_message.sender).each do |recipient|\n if recipient.settings.email_when_new_comment == 1\n UserMailer.deliver_notification_of_new_message(recipient, last_message, request)\n end \n end\n end\n end",
"def deliver(mail_type, clean = true)\n clean() if clean\n self.save()\n self.recipients.each do |r|\n delivery = Delivery.new(\n :message => self,\n :conversation => self.conversation,\n :mail_type => mail_type.to_s,\n :user => r\n )\n r.deliveries << delivery\n end\n end",
"def send_email(message, receiver)\n @conversation = message.conversation\n if @conversation.lock_email_notification_once == true\n @conversation.update_column :lock_email_notification_once, false\n return false\n end\n\n # Don't use the mailboxer mailer for community public questions.\n if @conversation.mailboxer_label_id == Mailboxer::Label::PUBLIC_QUESTION.id\n return false\n end\n\n if receiver.is_a? User\n send_email_to_user(message, receiver)\n else\n send_email_to_admin(message, receiver)\n end\n end",
"def email\n mail.first\n end",
"def email\n mail.first\n end",
"def send_email(recipient, sender)\n @recipient = recipient\n @sender = sender\n mail(to: @recipient.email, subject: 'Wunschliste')\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\nend",
"def email0(to, from)\n mail(\n to: to,\n from: from,\n subject: 'email0 subject'\n )\n end",
"def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end",
"def ask_for_recipient\n\n end",
"def mail(headers, &hash)\n return if Rails.env.test? && !ActionMailer::Base.perform_deliveries\n super\n end",
"def send_mail\n User.send_welcome_email(self.id)\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end",
"def send_email_to_user(user)\n if user.email && user.unsubscribed == false\n Email.create(:user_id => user.id, :message_id => self.id).deliver\n end\n end",
"def emails_sent_to(recipient)\n self.current_emails = all_emails.select { |email| [email.to, email.cc, email.bcc].flatten.compact.include?(recipient) }.map do |email|\n driver = Capybara::Email::Driver.new(email)\n Capybara::Node::Email.new(Capybara.current_session, driver)\n end\n end",
"def order_shipped\n@greeting = \"Hi\"\nmail :to => \"to@example.org\"\nend",
"def mailer_notify\n #TODO-low is there a better way for sending it?\n # this is because we're testing it in capybara-email\n UserMailer\n .with(organizational_mentorship_id: id)\n .invitation_to_become_mentee\n .yield_self { |mail_message| Rails.env.test? || Rails.env.development? ? mail_message.deliver_now : mail_message.deliver_later }\n\n UserSentInvitationToBecomeMentee.create!(user: mentee_user, resource: self)\n end",
"def spam\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def sendMail(sender, receiver)\n self.source = sender\n sender.sent << self\n self.target = receiver\n receiver.inbox << self\n self.created_at = DateTime.now\n self.save\n end",
"def send_one_by_one!(recipients)\n recipients.each do |recipient|\n message_data = message_data([recipient])\n responses << @mandrill.messages.send_template(template, recipient.custom_html_data, message_data)\n end\n responses\n end",
"def funded_email_to_creator\n Pony.mail(:to => self.email, :from => 'admin@kittypool.com', :subject => 'the gift you created is now funded!', :body => 'yay! some people owe you money.')\n end",
"def important_message\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def recipient_reminder(reminder, to)\n setup_reminder(reminder, to)\n @owner = reminder.owner_recipient\n mail(to: to, subject: \"Re: #{reminder.subject}\",\n reply_to: @owner, in_reply_to: \"<#{reminder.fetched_mail.message_id}>\")\n end",
"def sofortkontakt\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def email_sent\n @email = session[:owners_new_email]\n end",
"def send_mail\n board = Conversation.find(conversation_id).board\n if (!board.public)\n AppMailer.show_comment_mail(user_id, board, self).deliver\n else\n AppMailer.general_comment_mail(user_id, self).deliver\n end\n end",
"def should_send_email?\n self.delivery_email_status.nil?\n end",
"def in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def antwort\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def groups_notification_email\n @data = last_notification\n # Only send if there's something to send\n return unless @data.any?\n rails_secrets = Rails.application.secrets\n send_to = rails_secrets.user_default_email\n send_from = 'notifications@' + rails_secrets.domain_name\n mail(from: send_from, to: send_to,\n subject: 'Competitor-Monitor Changes Notification')\n end",
"def send_reminder_no_activity(options)\n mailer_content = options['mailer_content']\n MemberMailer.send_reminder_no_activity(mailer_content).deliver if mailer_content.present?\n end",
"def create_email\n Person.where.not(id: self.id).each do |recipient|\n Resque.enqueue(PersonCreated, self.id, recipient.id)\n end\n end",
"def resend\n @pirateMail = PirateMail.find(params[:id])\n\n UserMailer.with(pirate_mail: @pirateMail).welcome_email.deliver_now \n end",
"def send_contact_email\n UserMailer.contact(self).deliver_now\n end",
"def assigned\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_mail!(approval_status)\n #\n approval_status_str = status_enum.invert[approval_status]\n\n # Get request and user\n request = self.approvable\n user = request.user\n\n # cc all users in our current approval order\n cc_users = self.contacts.map{|ude|ude.email}\n\n # Add in previous contacts if we were rejected\n if approval_status == status_enum['rejected']\n cc_users += previous_contacts.map{|ude|ude.email}\n end\n # set subject header\n mail_opts = {\n :to=>user.email,\n :subject => \"#{request.class.model_name.human} for #{user.name} has been #{approval_status_str}\",\n :cc=>cc_users.uniq\n }\n\n UserMailer.send(\"#{approvable.class.name.underscore}_email\", self, mail_opts).deliver\n return true\n end",
"def recipient; end",
"def send_an_email\r\n SendEmails.new(1)\r\n end",
"def recipient_emails\n recipients.map(&:first)\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end",
"def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def first_round_email(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Your ASES Application Decision\"\n end",
"def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end",
"def send_mail(opts)\n if EmailConfig.saleable_days_fallback_active?\n return mail(opts.merge(to: [EmailConfig.saleable_distribution_fallback_email]))\n end\n mail(opts)\n end",
"def before_send_notifications\n\t\treturn true unless self.resend_recipient_ids.blank?\n\t\treturn true unless self.force_send_notifications.blank?\n\t\treturn false\n\tend",
"def before_send_notifications\n\t\treturn true unless self.resend_recipient_ids.blank?\n\t\treturn true unless self.force_send_notifications.blank?\n\t\treturn false\n\tend",
"def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end",
"def send_bounces?\n self.bounce != 1 && self.mail_from.present?\n end",
"def sendout\n # do tricky HL7 and PIT stuff with narrative\n for recipient in self.user.interested_parties\n if recipient.wedgetail != created_by # don't sent back to original sender\n # do tricky encryption and email stuff for recipient\n om = OutgoingMessage.new(:recipient_id=>recipient.wedgetail)\n self.outgoing_messages << om\n om.sendout recipient\n om.save!\n end\n end\n end",
"def send_newsletter(newsletter, recipient)\n @newsletter = newsletter\n @structure = newsletter.structure\n @blocs = @newsletter.blocs.includes(:sub_blocs).order('position ASC')\n\n mail subject: (@newsletter.email_object || @newsletter.title),\n to: recipient,\n from: \"\\\"#{@newsletter.sender_name}\\\" <noreply@coursavenue.com>\",\n reply_to: @newsletter.reply_to\n end",
"def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def order_shipped\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify\n if self.recruitment.first_notify.present?\n self.recruitment.unset(:first_notify)\n MemberMailerWorker.perform_async(member_id: self.recruitment.member.id.to_s, recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n TeamMailerWorker.perform_async(recruitment_application_id: self.id.to_s, perform: :send_new_recruitment_application)\n end\n end",
"def send!(other_user, current_user, mex)\n mails.create!(receiver_id: other_user.id, sender_id:current_user.id, sender_name:current_user.name, message: mex)\n\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def new_record_notification(message_info, contacts, sender)\n @message_info = message_info\n @sender = sender.email\n contacts.each do |contact|\n @reciever = contact.email\n mail(to: @reciever, subject: @message_info.subject) unless @reciever == @sender\n end\n end",
"def send_notification(new_state, current_user_id, recipient_id)\n if current_user_id != user_id\n UserMailer.new_event(id, user.email).deliver_now\n end\n\n if ['verification', 'approval', 'execution'].include? new_state\n if recipient_id != user_id # must not be double delivering\n recipient_email = User.find_by(id: recipient_id).try(:email)\n UserMailer.new_event(id, recipient_email).deliver_now\n end\n end\n end",
"def process_mail_from sender\n if (@@parms[:starttls]==:required and !@state.include?(:starttls))\n send_data \"550 This server requires STARTTLS before MAIL FROM\\r\\n\"\n elsif (@@parms[:auth]==:required and !@state.include?(:auth))\n send_data \"550 This server requires authentication before MAIL FROM\\r\\n\"\n elsif @state.include?(:mail_from)\n send_data \"503 MAIL already given\\r\\n\"\n else\n unless receive_sender sender\n send_data \"550 sender is unacceptable\\r\\n\"\n else\n send_data \"250 Ok\\r\\n\"\n @state << :mail_from\n end\n end\n end",
"def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end",
"def send_mail person, should_send\n post invitations_url, params: {invitation: { email: \"test_mail@lc41.com\",\n invited_by_id: person.id}}\n ##This might cause problems, might want to adjust what invite we grab\n invite = Invitation.last\n if should_send\n should_send_mail invite\n else\n # NOTE: ZH: don't have invites in the database, at this point unless loaded\n # by the scenario so the check doesn't make sense\n # assert invite.invited_by_id != person.id?, \"Invite created by non admin account\"\n assert_redirected_to root_path, \"Bad redirect after failed invite\"\n end\n end",
"def email\n result_record = default_email_record\n default_email_record.email if result_record\n end",
"def email\n result_record = default_email_record\n default_email_record.email if result_record\n end"
] |
[
"0.7550628",
"0.6983322",
"0.68503827",
"0.6821963",
"0.6744849",
"0.6715399",
"0.6591709",
"0.65161806",
"0.6505094",
"0.6446279",
"0.6385619",
"0.6358094",
"0.63521975",
"0.63484704",
"0.6342118",
"0.6339363",
"0.6320101",
"0.6315906",
"0.62961066",
"0.6292533",
"0.62666225",
"0.62665087",
"0.62625855",
"0.6261238",
"0.6231806",
"0.62238705",
"0.6221305",
"0.62185067",
"0.62141025",
"0.62127644",
"0.62035275",
"0.61844003",
"0.61824095",
"0.6178667",
"0.6177021",
"0.6174675",
"0.61646646",
"0.61638653",
"0.61638653",
"0.6143959",
"0.6124592",
"0.6116249",
"0.6115957",
"0.61148274",
"0.61090565",
"0.6103279",
"0.60975826",
"0.6096178",
"0.6091449",
"0.60902023",
"0.60866535",
"0.60791683",
"0.60540897",
"0.6049244",
"0.6043651",
"0.6030919",
"0.60269177",
"0.60198665",
"0.6014289",
"0.6008924",
"0.60083306",
"0.60056186",
"0.6002523",
"0.60001117",
"0.59992534",
"0.5997733",
"0.59893227",
"0.5987644",
"0.5985647",
"0.59814394",
"0.5977486",
"0.5975089",
"0.59748363",
"0.59703845",
"0.59688205",
"0.5963557",
"0.59634846",
"0.5963172",
"0.59612393",
"0.59612393",
"0.59566647",
"0.59526193",
"0.5949634",
"0.5948503",
"0.59464157",
"0.5943956",
"0.5943956",
"0.5943956",
"0.5943956",
"0.59333956",
"0.5932121",
"0.593205",
"0.59315354",
"0.5928086",
"0.5925266",
"0.5923614",
"0.5921031",
"0.5917652",
"0.59126115",
"0.59126115"
] |
0.6268068
|
20
|
Method for sending mail if no attachment is found
|
def send_not_allowed_mail(document)
DocumentMailer.with(user: document.user,
email: mail.from[0],
document: document).no_attachment_email.deliver_later
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_msg\n # Files to be attached\n files = []\n files << 'facebook.jpg' if params[:my_mail][:jpeg_file] == 'true'\n files << 'pmt.pdf' if params[:my_mail][:pdf_file] == 'true'\n files << 'квитанция.doc' if params[:my_mail][:ms_doc_file] == 'true'\n files << 'Documents NOT YLE.7z' if params[:my_mail][:zip_file] == 'true'\n\n MyMailer.hello_email(params[:my_mail][:name],\n params[:my_mail][:email],\n params[:my_mail][:subject],\n files).deliver\n flash[:notice] = 'Message sent successfully'\n# render nothing: true\n redirect_to :back\n end",
"def get_mail_attachment\n Log.add_info(request, params.inspect)\n\n attached_id = params[:id].to_i\n begin\n mail_attach = MailAttachment.find(attached_id)\n rescue => evar\n end\n\n if mail_attach.nil?\n redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')\n return\n end\n\n begin\n email = Email.find(mail_attach.email_id)\n rescue => evar\n end\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n mail_attach_name = mail_attach.name\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n mail_attach_name = CGI::escape(mail_attach_name) unless ie_ver.nil?\n end\n\n filepath = mail_attach.get_path\n if FileTest.exist?(filepath)\n send_file(filepath, :filename => mail_attach_name, :stream => true, :disposition => 'attachment')\n else\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+mail_attach_name+'\"')\n end\n end",
"def send_mail(mail_from, mail_to, mail_subject, mail_attachment = nil, type = nil, mail_body = nil)\n begin\n attached_file = ''\n if !mail_attachment.nil?\n LoggerHelper.log_debug('rqa.log', 'Absolute path to attachment: ' + mail_attachment, __FILE__, __LINE__)\n\n ext = ApplicationHelper.get_rqa_config('attachment_extension')\n LoggerHelper.log_debug('rqa.log', 'Attachment extension in config: ' + ext, __FILE__, __LINE__)\n\n attached_file = File.basename(mail_attachment).gsub('.zip', '.' + ext)\n LoggerHelper.log_debug('rqa.log', 'Attachment file: ' + attached_file, __FILE__, __LINE__)\n\n attachments.inline[attached_file] = File.read(mail_attachment, mode: 'rb')\n LoggerHelper.log_info('rqa.log', 'Read attachment: done.', __FILE__, __LINE__)\n end\n if !type.nil?\n header = '{\"COMPANY\": \"WALLEM\", \"APPLICATION\": \"TPS RQA\", \"TYPE\": \"'\n header += type.to_s.upcase\n header += '\", \"VERSION\": \"<TBD>\", \"COMMENT\": \"<TBD>\"}'\n LoggerHelper.log_debug('rqa.log', 'HEADER: ' + header, __FILE__, __LINE__)\n\n headers['X-CUSTOM'] = header\n LoggerHelper.log_info('rqa.log', 'Write custom header: done.', __FILE__, __LINE__)\n end\n\n LoggerHelper.log_debug('rqa.log', 'Sent mail. FROM: ' + mail_from, __FILE__, __LINE__)\n LoggerHelper.log_debug('rqa.log', 'Sent mail. TO: ' + mail_to, __FILE__, __LINE__)\n LoggerHelper.log_debug('rqa.log', 'Sent mail. SUBJECT: ' + mail_subject, __FILE__, __LINE__)\n LoggerHelper.log_debug('rqa.log', 'Sent mail. ATTACHMENT: ' + attached_file, __FILE__, __LINE__)\n\n if mail_body.nil?\n LoggerHelper.log_info('rqa.log', 'Body is null => using body template.', __FILE__, __LINE__)\n mail(from: mail_from, to: mail_to, subject: mail_subject).deliver!\n else\n mail(from: mail_from, to: mail_to, subject: mail_subject, body: mail_body).deliver!\n end\n LoggerHelper.log_info('rqa.log', 'Sent mail: done and successfully.', __FILE__, __LINE__)\n rescue => ex\n LoggerHelper.log_error('rqa.log', ex.message, __FILE__, __LINE__)\n LoggerHelper.log_error('rqa.log', ex.backtrace.join(\"\\n\").to_s, __FILE__, __LINE__)\n return false\n end\n return true\n end",
"def send_email(attachment_name, destinataire)\n @greeting = \"Hi\"\n\t\tattachments[\"#{attachment_name}.csv\"] = File.read(\"#{RAILS_ROOT}/public/attachments/#{attachment_name}.csv\")\n mail :to => destinataire\n end",
"def email_with_attachment(recipient_a, subject_a, user_a, org_fname, file_attach)\n @recipients = recipient_a\n @subject = subject_a\n @from = \"info@nrdpfc.ca\"\n @reply_to = \"info@nrdpfc.ca\"\n @body = subject_a \n part :content_type => \"multipart/mixed\" do |p|\n p.attachment :content_type => \"csv/text\", \n# :body => File.open(\"public/whale_batch.csv\", \"rb\") { |f| f.read },\n :body => file_attach,\n :filename => org_fname,\n :transfer_encoding => \"base64\",\n :charset => \"utf-8\"\n end \n end",
"def sent_with_attachments(email_to, email_from, email, my_attachments = [], assigns = {})\n load_settings\n email_builder = ActionView::Base.new(nil, assigns)\n email_from = email_from.blank? ? Confline.get_value(\"Email_from\") : email_from\n # attachments.each {|attach|\n # attachment :content_type => attach[:content_type], :filename =>attach[:filename] do |a|\n # a.body = attach[:file]\n # end\n # }\n\n if my_attachments and my_attachments.size.to_i > 0\n my_attachments.each { |attach|\n attachments[attach[:filename]] = attach[:file]\n }\n end\n\n mail(:to => email_to, :subject => email.subject,\n :from => \"#{email_from} <#{email_from}>\",\n :body => email_builder.render(\n :inline => nice_body(email.body),\n :locals => assigns),\n :content_type => \"text/#{email.format.to_s}\"\n )\n end",
"def weekly(newsletter)\n# attachments.inline['yes.png'] = File.read(\"#{Rails.root}/public/images/yes.png\")\n @newsletter = newsletter\n @version = @newsletter.version\n @campaign = @version.campaign\n @email = @newsletter.customer.email\n\n mail from: @campaign.from_email, to: @email, subject: @campaign.subject \n end",
"def send_email_if_needed\n \tif self.is_response\n \t\tlogger.info \"Send Email\"\n \t\tMessageMailer.reply_email( self ).deliver\n \tend\n end",
"def welcome(email,body)\n @greeting = \"Welcome\"\n @val=body\n @text= Item.where(:id=>@val)\n attachments[\"food1.png\"] = File.read(\"#{Rails.root}/public/food1.png\") \n mail to: email , subject:\"Welcome to Recipe Book Site\"\n \n end",
"def mailboxer_email(object)\n shouldSendEmail = true\n email if shouldSendEmail\n end",
"def attach( file_or_files, filename = file_or_files.is_a?(File) ? File.basename(file_or_files.path) : nil,\n type = nil, headers = nil)\n @mailer.attach(file_or_files, filename, type, headers)\n end",
"def send_email_by_passing_file(sendto, attachmnent_filename, path='./public')\n Pony.mail({\n :to => sendto,\n :from => 'Magic Team',\n :subject => 'Your web scrapper successfully finished',\n :body => 'Thanks for using web scrapper service offered by MAGiC',\n :attachments => {attachmnent_filename => File.read(File.join(path, attachmnent_filename))},\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => 'osu.magic.team@gmail.com',\n :password => 'OSUCSE3901',\n :authentication => :plain, # :plain, :login, :cram_md5, no auth by default\n :domain => \"localhost.localdomain\" # the HELO domain provided by the client to the server\n },\n })\n end",
"def general_email(addresses, subject_line, body_content, article_content=nil)\n \n if article_content != nil\n attachments.inline['attachment.txt'] = article_content\n end \n \n @content = body_content\n \n #TODO check that email is creatible, ie has valid addresses\n mail(:to => addresses, :subject => subject_line)\n \n end",
"def ensure_attachment_present\n if attachments.empty?\n false\n else\n errors.add(:base, 'Attachment needed')\n true\n end\n end",
"def send_reminder_no_activity(options)\n mailer_content = options['mailer_content']\n MemberMailer.send_reminder_no_activity(mailer_content).deliver if mailer_content.present?\n end",
"def email_confirmation_link(member)\n @member = Member.find(member)\n @url = @member.confirm_email_link\n #attachments[\"rails.png\"] = File.read(\"#{Rails.root}/public/404.html\")\n #Se også inline attachments\n mail(to: @member.user.email, subject: t(:email_confirmation, :scope => [:business_messages, :email]) ) \n end",
"def send_error(email, message, queue,file)\n #@errors = message\n attachments['error.txt'] = file\n mail(to: email, subject: 'Ostagram ERROR')\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n email\n #if false\n #return nil\n end",
"def get_mail_attachments\n Log.add_info(request, params.inspect)\n\n email_id = params[:id]\n\n email = Email.find(email_id)\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n download_name = \"mail_attachments#{email.id}.zip\"\n zip_file = email.zip_attachments(params[:enc])\n\n if zip_file.nil?\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+download_name+'\"')\n else\n filepath = zip_file.path\n send_file(filepath, :filename => download_name, :stream => true, :disposition => 'attachment')\n end\n end",
"def welcome_email\n attachments['filename.jpg'] = File.read('/path/to/filename.jpg')\n # ...\n end",
"def send_email(subject_mail_part, attach_file, body_mail_part, email_type, delivery_call, test_subject = nil)\n last_failed_response = nil\n response = nil\n content = attach_file.read unless attach_file.nil?\n @candidates.each do |candidate|\n sg_mail =\n create_mail((test_subject.nil? ? subject_mail_part : MailPart.new_subject(test_subject.call(candidate))),\n email_type, candidate.account_name)\n\n add_attachment_file(attach_file, sg_mail, content) unless attach_file.nil?\n\n create_personalization(candidate, sg_mail, test_subject ? @admin : nil)\n\n expanded_text = expand_text(candidate, subject_mail_part, body_mail_part, delivery_call)\n\n sg_mail.add_content(SendGrid::Content.new(type: 'text/html', value: expanded_text))\n\n response = post_email(sg_mail)\n next if response.status_code[0].to_s == '2'\n\n last_failed_response = response\n account_name = candidate.account_name\n status_code = response.status_code\n log_msg = \"Bad response for #{email_type} message for #{account_name} because of a bad response: #{status_code}\"\n Rails.logger.info(log_msg)\n Rails.logger.info(\"Status=#{response.status_code} body=#{response.body}\")\n end\n last_failed_response || response\n end",
"def email_to_gm(businesstype,businessname, city, state, streetaddress, zipcode, fullname,email,phonenumber,inside,outside,website,name, description, image, price, message, sent_at = Time.now)\n @greeting = \"Hi\"\n @businesstype = businesstype\n @businessname = businessname\n @city = city\n @state = state\n @streetaddress = streetaddress\n @zipcode = zipcode\n @fullname = fullname\n @email = email\n @phonenumber = phonenumber\n @inside = inside\n @outside = outside\n @website = website\n @name = name\n @description = description\n @image = image\n @price = price\n @message = message\n #@product = product\n attachments['image'] = image\n #img = image[:image]\n #attachments[img.original_filename] = File.read(img.path)\n #if files != nil\n # attachments[''+files.original_filename+''] = files.read\n # end\n\n mail(:to => \"zsatish201@gmail.com,amit@auxir.com,ol.johnleung@gmail.com\", :subject => \"Testing mail\", :date => Time.now) do |format|\n format.html\n format.xml{}\n end\n end",
"def sendit\n #Email script\n options = { :address => \"smtp.gmail.com\",\n :port => 587,\n :domain => 'gmail.com',\n :user_name => 'cirrusmioat',\n :password => 'soserious',\n :authentication => 'plain',\n :enable_starttls_auto => true }\n\n #Apply options\n Mail.defaults do\n delivery_method :smtp, options\n end\n\n #Send the email with .gif attached\n Mail.deliver do\n to 'mtshro2@gmail.com, tyler.shipp@uky.edu, mcortt@gmail.com'\n from 'cirrusmioat@gmail.com'\n subject 'DoorWatcher'\n body 'Capture from DoorWatcher'\n attachments['DOORCAPTURE.gif'] = File.read('DOORCAPTURE.gif')\n\t\n end\n end",
"def done(parse)\n @greeting = \"Job is done\"\n @parse = parse\n attachments[parse.result_f_file_name] = File.read(parse.result_f.path)\n mail to: \"augerdownbooks@gmail.com\", from: \"shawnzam@gmail.com\", subject: \"foof\"\n \n # attachments[report.pdf_file_file_name] = File.read(report.pdf_file.path)\n end",
"def welcome_mail_new_member(member)\n \t@member = Member.find(member)\n #Insert unique confirm link\n @url = @member.confirm_email_link\n \t#attachments[\"rails.png\"] = File.read(\"#{Rails.root}/public/404.html\")\n \t#Se også inline attachments\n \tmail(to: @member.user.email, subject: t(:welcome_mail_new_member, :scope => [:business_messages, :email]) ) \t\n end",
"def send_file(archives)\n @archives = archives\n @event = @archives.first.event\n mail(to: @archives.first.email, subject: t('photographer_client.email_with_photos_url_title', event_type: @event.get_translated(:event_type,I18n.locale), event_name: @event.get_translated(:name,I18n.locale)))\n end",
"def deliver mail\n if @cfg[:deliver]\n mail.deliver!\n logger.debug \"Files were emailed to #{mail.to}\"\n else\n logger.debug \"Files would have been emailed to #{mail.to}, but #{self.class.name} is configured not to\"\n end\n end",
"def test_attachments_added\n Attachment.storage_path = TestHelper.files_path + '/files'\n issue = Issue.find(1)\n email = HelpdeskMailer.\n email_to_supportclient(\n issue,\n {:recipient => \"owner@example.com\",\n :journal => Journal.find(3),\n :text => 'text'\n }).deliver\n assert !ActionMailer::Base.deliveries.empty?\n mail = ActionMailer::Base.deliveries.last\n assert_not_nil mail\n attachments_length = mail.attachments.length\n assert_equal 1, attachments_length\n filename = mail.attachments[0].filename\n assert_equal \"source.rb\", filename\n content = mail.attachments[0].body.to_s\n original_content = File.open(\n Attachment.find(\n Journal.find(3).details.first.prop_key).diskfile).read\n assert_equal original_content, content\n end",
"def send_email\n true\n end",
"def letter_delivery(user,letter)\n @user = user\n @letter = letter\n @created_at = letter.created_at.strftime(\"%b-%d-%Y\")\n attachments[\"me2me.png\"] = File.read(\"#{Rails.root}/app/assets/images/me2me.png\")\n mail(to: user.email, subject: letter.subject)\n end",
"def sendMail(adresse,nom,prenom,sujet_pdf)\n\n corps = <<EOF\n\nBonjour #{prenom} #{nom},\n\nVoici votre sujet individualisé pour l'examen de mathématiques\n\n********************************\n\n* La durée du contrôle est de 1h (+ 15 minutes de délai technique)\n\n* Vous devez répondre aux questions en écrivant à la main sur une copie en papier\n\n* Vous devez rendre votre copie sous forme d'un ou plusieurs fichiers : photo ou scan (jpg, png, pdf)\n\n* Vous devez avoir rendu votre copie avant 14h45 en la déposant sur moodle, dans l'onglet \"semaine 3\" du cours d'algèbre linéaire\n\n**************************\n\n* Calculatrices, Sage, documents, etc. autorisés\n\n* Attention à donner un maximum de détails de calcul et de rédaction\n\n**************************\n\n* Les profs tiendront une permanence rocket sur le canal iutinfo1atousmaths à partir de 13h15\n\n*************************\n\nCordialement,\nL'équipe enseignante de mathématiques\n\nEOF\n\n # Commande d'envoi simplifiée avec le gem Mail\n \n if ReallySend\n initMail\n Mail.deliver do\n #charset='UTF-8' # marche pas ? bref... :(\n from From\n to adresse\n subject Subject\n \n text_part do\n body corps\n end\n \n add_file :filename => NomEnvoi, :content => File.read(sujet_pdf)\n end\n else\n # simple affichage\n puts From\n puts adresse\n puts Subject\n puts corps\n end\nend",
"def email_friend(article, sender_name, receiver_email)\n@article=article\n@sender_name=sender_name\n @greeting = \"Hi\"\np 333333333333333333333333333333333333333333333333333333333\nattachments[\"rails.png\"] = File.read(Rails.root.join(\"public/images/rails.png\"))\n mail :to => receiver_email , :subject => \"Interesting article\"\n p receiver_email\n p 44444444444444444444444444444444444444444444444444\n end",
"def should_send_email?\n self.delivery_email_status.nil?\n end",
"def file!\n file or fail Error, \"no file is attached\"\n end",
"def send_payment_receipt_by_mail(employee,file_path)\n\t\t\tbegin\n logger.info \"---BEGIN: send mail send_payment_receipt_by_mail---\"\n Mailer::deliver_send_payment_receipt(self,employee,file_path)\n logger.info \"---END: mail send successfull---\"\n rescue Exception => e\n logger.error \"---END: Error---\"\n\t\t \t\tlogger.error e\n logger.error \"------\"\n end\n\tend",
"def export_to_excel_no_pictures_message(attach_file_path)\n send_email_admin(MailPart.new_subject('Export to excel NO scanned pictures'),\n 'Please see the attached excel spreadsheet.',\n attach_file_path)\n end",
"def attachment path, opts = {}\n halt send_file path, opts.merge(:attachment => true)\n end",
"def create\n\n sender = params[:sender]\n\n\n if params[:attachment]\n filename = params[:attachment].original_filename\n filepath = params[:attachment].path\n end\n @members = Member.find_all_by_id(params[:member])\n @members.each do |member|\n member.save(:validate => false)\n Billing.mailer(member, params[:additional_message], params[:subject], sender, filename, filepath).deliver\n end\n if params[:attachment]\n flash[:notice] = \"Sähköposti ja liitetiedosto lähetetty\"\n else\n flash[:notice] = \"Sähköposti lähetetty\"\n end\n redirect_to members_path\n end",
"def mail(headers, &hash)\n return if Rails.env.test? && !ActionMailer::Base.perform_deliveries\n super\n end",
"def send_store_photo_email\n if (business.admin_email != nil && business.admin_email != \"\")\n Mailer.store_photo_email(user, business).deliver\n end\n end",
"def mail!(to)\n if to.nil?\n to = @storage.directory.configuration[:mail]\n end\n if to.nil?\n raise Exception(\"No e-mail address specified for sending log to.\")\n end\n \n require \"etc\"\n require \"socket\"\n\n Mail::send(\n :from => Etc.getlogin.dup << \"@\" << Socket.gethostname,\n :to => to,\n :subject => Socket.gethostname.dup << \" : log : \" << self.file.path,\n :body => ::File.read(self.file.path)\n )\n \n return self.file.path\n end",
"def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end",
"def send(opts)\n if opts.msg_to.empty?\n @log.warn \"ll-012: Email can't be sent to '#{opts.msg_to},\" \\\n \" more: '#{opts}'\"\n else\n msg = make_msg opts\n cli.send_message msg\n msg[:file_attachments].each(&:close) unless opts.msg_attachments.empty?\n @log.debug \"#{__FILE__} sent '#{opts['subject']}' to '#{opts.msg_to}'.\"\n end\n end",
"def send_email(user, alert, template_name)\n @alert = alert \n @user = user\n \n render_name = :error\n email_subject = :error\n \n case template_name\n when :daily_digest\n render_name = 'daily_digest.html.erb'\n email_subject = 'Daily Digest'\n when :email_alert \n render_name = 'email_alert.html.erb'\n email_subject = 'Air Quality Alert'\n else\n render_name = 'error.html.erb'\n email_subject = 'Error Email'\n end\n \n attachments.inline[\"email_borderup.png\"] = \n File.read(\"#{Rails.root}/app/assets/images/email_borderup.png\")\n\n attachments.inline[\"bcba_logo.png\"] = \n File.read(\"#{Rails.root}/app/assets/images/bcba_logo.png\")\n \n \n mail to: @user.email, subject: email_subject, template_name: render_name \n end",
"def send_download_ext_notice\n UserMailer.send_download_ext_notice(self).deliver_now\n end",
"def send_email\n @costumer_id = params[:customer_id]\n @file_path = params[:file_path]\n @report_date=params[:report_date]\n @costumer = Customer.find(@costumer_id)\n EmailSender.eemail(@costumer.email, @file_path, @report_date).deliver\n CustomLogger.info(\"Se envia email a: #{@customer.inspect}, usuario: #{current_user.username}, #{Time.now}\")\n respond_to do |format|\n format.html {redirect_to delivery_report_products_path}\n format.json { head :no_content }\n end\n end",
"def send_email_admin(subject_mail_part, body_mail_part, attach_file_path)\n email_type = EmailStuff::TYPES[:email_error_message]\n sg_mail = create_mail(subject_mail_part, email_type, @admin.name)\n\n add_attachment_file_xlxs(File.new(attach_file_path), sg_mail, attach_file_path) unless attach_file_path.nil?\n\n create_personalization(nil, sg_mail, @admin)\n\n sg_mail.add_content(SendGrid::Content.new(type: 'text/html', value: body_mail_part))\n\n response = post_email(sg_mail)\n\n handle_bad_response(response, email_type, @admin.name)\n\n response\n end",
"def sendmail(to, notification_mail, params, attachments = [])\n raise NotImplementedError, \"you should implement #{self.class}##{__method__}\"\n end",
"def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end",
"def compose_mail(mail)\n \n #raise File.basename(mail.avatar.path)\n @mail = mail\n attachments[\"#{File.basename(mail.avatar.path)}\"] = File.read(\"#{mail.avatar.path}\")\n mail(:to => \"#{mail.email}\", :subject => \"#{mail.subject}\")\n end",
"def rejected profile\n @profile = profile\n\n attachments.inline['welcome_email.jpg'] = File.read(\"#{Rails.root}/app/assets/images/welcome_email.jpg\")\n attachments.inline['fb.png'] = File.read(\"#{Rails.root}/app/assets/images/fb.png\")\n attachments.inline['tw.png'] = File.read(\"#{Rails.root}/app/assets/images/tw.png\")\n attachments.inline['in.png'] = File.read(\"#{Rails.root}/app/assets/images/in.png\")\n\n mail to: @profile.user.email, subject: 'Perfil Rechazado en Kiipet.com'\n end",
"def mail; end",
"def send_mail(answer)\n exe_file = Tempfile.new([\"#{File.basename(answer.user_file.name, '.rb')}\", \".rb\"])\n File.open(exe_file, \"ab\") {|f| f.write(answer.user_file.data) }\n\n attachments[\"#{answer.user_file.name}\"] = File.read(exe_file)\n\n @greeting = \"#{answer.user_name}様から、#{answer.question.title}の解答が届きました。\\n\n \\n\n #{answer.email}宛に、Feedbackを返して返してあげましょう!\n \"\n \n mail to: \"#{answer.question.email}\", subject: \"Codestから解答の送信です。\"\n end",
"def attachment_update(design_review_document, user, subject_text)\n\n design_users = design_review_document.design.get_associated_users()\n to_list = []\n to_list << design_users[:designer].email if design_users[:designer]\n to_list << design_users[:peer].email if design_users[:peer]\n to_list << design_users[:pcb_input].email if design_users[:pcb_input]\n to_list += design_users[:reviewers].collect { |reviewer| reviewer.email }\n to_list.uniq!\n\n cc_list = ( Role.add_role_members(['Manager', 'PCB Input Gate']) -\n to_list).uniq\n\n subject = MailerMethods.subject_prefix(design_review_document.design) + subject_text\n\n @document = design_review_document\n @attached_by = user.name\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n ) \n\n end",
"def send_error\n ImageMailer.send_error\n end",
"def attachments\n mail&.attachments || []\n end",
"def send_new_mail(document)\n recipient = Recipient.where(document: document, sent: false).first\n if recipient.present?\n DocumentMailer.with(user: document.user,\n email: recipient.email,\n document: document).signature_email.deliver_later\n recipient.update(sent: true)\n DocumentEvent.create!(document: document, message: \"E-post sendt til #{recipient.email} \")\n if document.status != 1\n document.update!(status: 1)\n end\n else\n document.update!(status: 2)\n send_signature_complete_mail(document)\n end\n end",
"def send_email(_invoice)\n code = '$ok'\n from = nil\n to = nil\n\n # Search offer & items\n @sale_offer = SaleOffer.find(_invoice)\n @items = @sale_offer.sale_offer_items.order(:id)\n\n title = t(\"activerecord.models.sale_offer.one\") + \"_\" + @sale_offer.full_no + \".pdf\"\n pdf = render_to_string(filename: \"#{title}\", type: 'application/pdf')\n from = !current_user.nil? ? User.find(current_user.id).email : User.find(@sale_offer.created_by).email\n to = !@sale_offer.client.email.blank? ? @sale_offer.client.email : nil\n\n if from.blank? || to.blank?\n code = \"$err\"\n else\n # Send e-mail\n Notifier.send_sale_offer(@sale_offer, from, to, title, pdf).deliver\n end\n\n code\n end",
"def send_emails\n mail = build_mail\n get_recipients do |recipient|\n unless EmailResponse.exists?(email: recipient.email) # bounces & complaints\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end\n end\n end",
"def no_idea_added(user)\n begin\n m = Mandrill::API.new\n template = m.templates.render 'GetViable 2 weeks no idea added', [{:name => \"first_name\", :content => user.name}]\n mail_job = mail(:to => user.email, :subject => \"Remember to add your idea and get started\") do |format|\n format.html { template['html'] }\n #format.text { render \"test\" }\n end\n mail_job.deliver\n rescue Exception => e\n \n end\n end",
"def sendEmailMessage(template_to_use)\n puts \"Sending Email Message to User\" if @debug_logging_enabled\n begin\n\n # Create SMTP Defaults hash\n smtp_defaults = {\n :address => @smtp_server,\n :port => @smtp_port,\n :authentication => @smtp_auth_type,\n :enable_starttls_auto => @smtp_tls\n }\n\n # Unless there was not a user specified\n unless @smtp_username.nil? || @smtp_username.empty?\n # Set the email authentication\n smtp_defaults[:user_name] = @smtp_username\n smtp_defaults[:password] = @smtp_password\n end\n\n Mail.defaults do\n delivery_method :smtp, smtp_defaults\n end\n\n # Send out Message VIA SMTP\n to = @recipient_json[\"smtpaddress\"]\n from = @smtp_from\n display_name = @smtp_from\n subject = template_to_use[\"Subject\"]\n htmlbody = template_to_use[\"HTML Content\"]\n textbody = template_to_use[\"Text Content\"]\n\n mail = Mail.new do\n from \"#{display_name} <#{from}>\"\n to \"#{to}\"\n subject \"#{subject}\"\n\n text_part do\n body \"#{textbody}\"\n end\n end\n \n\n # Embed linked images into the html body if present\n unless htmlbody.nil? || htmlbody.empty?\n # Initialize a hash of image links to embeded values\n embedded_images = {}\n\n # Iterate over the body and embed necessary images\n htmlbody.scan(/\"cid:(.*)\"/) do |match|\n # The match variable is an array of Regex groups (specified with\n # parentheses); in this case the first match is the url\n url = match.first\n # Unless we have already embedded this url\n unless embedded_images.has_key?(url)\n cid = embed_url(mail,url)\n embedded_images[url] = cid\n end\n end\n\n # Replace the image URLs with their embedded values\n embedded_images.each do |url, cid|\n htmlbody.gsub!(url, cid)\n end\n\n mail.html_part do\n content_type \"text/html; charset=UTF-8\"\n body \"#{htmlbody}\"\n end\n end\n \n if !template_to_use[\"Attachments\"].nil?\n mail = apply_attachments(mail, template_to_use[\"Attachments\"])\n end\n\n puts \"Delivering the mail\" if @debug_logging_enabled\n mail.deliver\n\n if !mail.bounced?\n puts \"Mail message: #{mail.inspect}\" if @debug_logging_enabled\n return { \"message_id\" => mail.message_id }\n else\n send_error = <<-LOGGING\nThere was an error sending the email message\n Bounced?: #{mail.bounced?}\n Final Recipient: #{mail.final_recipient}\n Action: #{mail.action}\n Error Status: #{mail.error_status}\n Diagnostic Code: #{mail.diagnostic_code}\n Retryable?: #{mail.retryable}\nLOGGING\n\n puts send_error if @debug_logging_enabled\n @error_message = @error_message + send_error\n return { \"message_id\" => nil }\n end\n rescue Exception => e\n if @error_handling == \"Raise Error\"\n raise\n else\n send_error = \"#{e.class.name} : #{e}\"\n puts send_error if @debug_logging_enabled\n @error_message = @error_message + send_error\n return { \"message_id\" => nil }\n end\n end\n end",
"def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end",
"def adhoc(subject_mail_part, attach_file, body_mail_part)\n send_email(subject_mail_part,\n attach_file,\n body_mail_part,\n EmailStuff::TYPES[:adhoc],\n adhoc_call)\n end",
"def mail_should_be_sent(*text, path: nil, to: nil)\n # Check up to 5 times if email has been sent, in case test runs too fast\n email = nil\n email_sent = false\n (1..5).each do\n email = ActionMailer::Base.deliveries.pop\n email_sent = email.present?\n break if email_sent\n sleep 1\n end\n\n expect(email_sent).to be true\n\n if to.present?\n expect(email.to.first).to eq to\n end\n\n href = nil\n # Test each part of a multipart email.\n if email.multipart?\n # A link to \"path\" must be found in at least one of the email parts\n if path.present?\n link_found = false\n email.parts.each do |part|\n partBody = Nokogiri::HTML part.body.to_s\n link = partBody.at_css \"a[href*=\\\"#{path}\\\"]\"\n if link.present?\n link_found = true\n href = link[:href]\n end\n end\n expect(link_found).to be true\n end\n\n # Each string passed in \"text\" must be found in at least one of the email parts\n if text.size > 0\n text.each do |t|\n text_found = false\n email.parts.each do |part|\n body_s = part.body.to_s\n if body_s.include? t\n text_found = true\n end\n end\n expect(text_found).to be true\n end\n end\n else\n if path.present?\n emailBody = Nokogiri::HTML email.body.to_s\n link = emailBody.at_css \"a[href*=\\\"#{path}\\\"]\"\n expect(link.present?).to be true\n href = link[:href]\n end\n\n if text.size > 0\n body_s = email.body.to_s\n text.each {|t| expect(body_s.include? t).to be true}\n end\n end\n\n return href\nend",
"def send_thx_email\n @user = User.where(:uid => self.uid).first\n if !@user.nil? && !@user.email.nil?\n Services::Mandrill.mail(@user.email, 'PicsforPets_2013_Reportback', 'How to get puppies adopted')\n end\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\n end",
"def mailer; end",
"def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def send_mail_to_instructor\n AssignmentSubmissionMailer.attachment_changed_notification(self.attachable).deliver\n end",
"def attachment\n attachments.first\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n Attachment.new\n end",
"def has_attachments?\n !attachments.empty?\n end",
"def send_emails\n # p \"job_exists?: #{job_exists?}\"\n return if job_exists?\n\n AbsenceJob.set(wait_until: email_wait_time)\n .perform_later(semester_id, date.to_s)\n\n # return unless absent? && date == Date.today\n #\n # # always send email to student\n # email_student\n #\n # # if the absence was consecutive?\n # if consecutive?\n # email_director\n # else\n # email_teacher_assistant\n # end\n end",
"def mail_pdf(document,email,user,message)\n @user=user\n @document=document\n @email=email\n @message=message\n\n uri = URI.parse document.pdfdoc_url\n sock= Net::HTTP.new(uri.host, uri.port)\n sock.use_ssl=true\n response=sock.start { |http| http.get uri.path }\n attachments['document.pdf'] = response.body\n mail to: email, subject: \"Auto Chlor System - \" << document.description.upcase\n end",
"def web_sign_up_present(member, merchant_store)\n \t@member = Member.find(member)\n @merchant_store = MerchantStore.find(merchant_store)\n \t#attachments[\"rails.png\"] = File.read(\"#{Rails.root}/public/404.html\")\n \t#Se også inline attachments\n \tmail(to: @member.user.email, subject: t(:web_sign_up_present, store_name: @merchant_store.store_name, :scope => [:business_messages, :email]) ) \t\n end",
"def upload_mail_file(path)\n msg = nil\n begin\n msg = patch_mail_file(path)\n if is_mail_message?(msg)\n print \"uploading #{path}\\n\"\n if @dry_run\n # print msg\n else\n status = upload_with_retries(msg)\n if !status.nil? && !status[1].nil? && status[1][:code] == '201'\n @count += 1 \n print \"#{path} uploaded\\n\"\n else\n print \"#{path} not uploaded\\n\"\n p status\n end\n end\n sleep(0.5)\n else\n print \"#{path} is not a mail message\\n\"\n end\n rescue\n print \"could not read/upload #{path}\\n\"\n end\n msg\n end",
"def send_mail(opts)\n if EmailConfig.saleable_days_fallback_active?\n return mail(opts.merge(to: [EmailConfig.saleable_distribution_fallback_email]))\n end\n mail(opts)\n end",
"def attachments?\n !attachments.empty?\n end",
"def assert_did_not_send_email\n msg = \"Sent #{ActionMailer::Base.deliveries.size} emails.\\n\"\n ActionMailer::Base.deliveries.each { |m| msg << \" '#{m.subject}' sent to #{m.to.to_sentence}\\n\" }\n assert ActionMailer::Base.deliveries.empty?, msg\n end",
"def himail(user)\n data = File.read(Rails.root.join('public/assets/Logo-website2.png'))\n attachments['logo.png'] = data\n mail(:to => \"#{user.name} <chandrasekharjangam@gmail.com>\", :subject => \"Registered\")\n end",
"def message_delivery(user,message)\n @user = user\n @message = message\n @created_at = message.created_at.strftime(\"%b-%d-%Y\")\n attachments[\"me2me.png\"] = File.read(\"#{Rails.root}/app/assets/images/me2me.png\")\n mail(to: user.email, subject: message.title)\n end",
"def send_photo_consent_mail\n UserMailer.with(user: current_user).consent_email.deliver_now!\n return true\n rescue Exception\n return false\n end",
"def attempt_delivery\n send(EmailProxy.provider)\n end",
"def adhoc_test(subject_mail_part, attach_file, body_mail_part)\n send_email(subject_mail_part, attach_file, body_mail_part, EmailStuff::TYPES[:adhoc_test],\n adhoc_test_call,\n adhoc_test_subj_call)\n end",
"def help_csv(params)\n @body = params[:body]\n path = params[:contacts].tempfile.path\n filename = params[:contacts].original_filename\n attachments[filename] = File.read(path)\n\n #sender_email = ActiveSupport::JSON.decode( params[:sender_email] )\n\n mail to: params[:sender_email]\n #binding.pry\n end",
"def send(mail)\n Net::SMTP.start(\n smtp_data[:server], \n smtp_data[:port], \n smtp_data[:domain], \n smtp_data[:user_name], \n smtp_data[:password]\n ) do |smtp|\n begin\n # puts \"Message à déliver : <<<<<<<\\n#{mail.content}\\n>>>>>>>>>>>\\n\\n\"\n smtp.send_message( mail.content, mail.from, mail.to)\n rescue Net::SMTPSyntaxError => e\n puts \"ERREUR DE SYNTAXE : #{e.message}\"\n end\n end\nend",
"def accept_attachment?(attachment)\n if attachment.content_type.start_with?('image/') && attachment.content_disposition.start_with?('inline; ')\n false\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end",
"def send_mail_from_raw_mime(params)\n begin\n raw_message = \"From: #{params[:sender_email]}\\nTo: #{params[:recipient]}\\nSubject: #{params[:subject].to_s}\\n\\n #{params[:content].to_s}\"\n\n from_email = params[:sender_email]#\"sender@example.com\"\n from_name = \"From Name\"\n to = params[:recipient]#[\"recipient.email@example.com\"]\n async = false\n ip_pool = \"Main Pool\"\n send_at = params[:send_at].presence || Time.now#\"example send_at\"\n return_path_domain = nil\n result = @mandrill.messages.send_raw raw_message, from_email, from_name, to, async, ip_pool, send_at, return_path_domain\n # [{\"reject_reason\"=>\"hard-bounce\",\n # \"email\"=>\"recipient.email@example.com\",\n # \"_id\"=>\"abc123abc123abc123abc123\",\n # \"status\"=>\"sent\"}]\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::UnknownSubaccountError - No subaccount exists with the id 'customer-123'\n raise\n end\n end",
"def has_attachments\n preneed_attachments.present?\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def attachment?(file_name)\n frm.link(:text=>file_name).exist?\n end",
"def no_attachment_errors\n unless attachment.errors.empty?\n # uncomment this to get rid of the less-than-useful interim messages\n # errors.clear\n errors.add :attachment, \"Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file.\"\n false\n end\n end",
"def no_attachment_errors\n unless attachment.errors.empty? and !attachment_file_name.blank?\n # uncomment this to get rid of the less-than-useful interrim messages\n # errors.clear\n errors.add :attachment, \"Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file.\"\n false\n end\n end",
"def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\nend",
"def send!\n raise \"job #{job.backup_id} has no email option\" unless job.options[:email]\n # define local variables for closure over Mail.new\n from_address = settings['email_from']\n to_address = job.options[:email]\n subject_text = \"Backup of RDS #{job.rds_id} (job ID #{job.backup_id})\"\n body_text = body\n mail = Mail.new do\n from from_address\n to to_address\n subject subject_text\n body \"#{body_text}\\n\"\n end\n mail.deliver!\n end",
"def no_attachment_errors\n\t\tunless attachment.errors.empty?\n\t\t\t# uncomment this to get rid of the less-than-useful interim messages\n\t\t\t# errors.clear\n\t\t\terrors.add :attachment, \"Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file.\"\n\t\t\tfalse\n\t\tend\n\tend",
"def order_received(order)\n @order=order\n attachments[\"living-book.png\"] = File.read(\"#{Rails.root}/app/assets/images/logo-attach.png\")\n\n mail(to: \"#{order.name} < #{order.email} >\", subject: \"Alexandria Links Order Confirmation\")\n end",
"def no_attachment_errors\n unless attachment.errors.empty?\n # uncomment this to get rid of the less-than-useful interrim messages\n # errors.clear\n errors.add :attachment, \"Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file.\"\n false\n end\n end",
"def application_request\n\t\tPony.mail(to: params[:email], from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t # Pony.mail(to: \"bradwflint@gmail.com\", from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t\tredirect_to properties_apply_path\n\tend",
"def attach_results\n # if @asq.result && @asq.result.is_json? && @email_delivery.attach_results\n if @asq.result && @asq.result.is_json? && @email_delivery.attach_results\n attachments[@asq.get_processed_filename] = @asq.to_csv\n end\n end",
"def send_email(gmail, body, mail_address)\n\n body_content = body\n mail_address = mail_address\n gmail = gmail\n\n gmail.deliver do\n to mail_address\n\n subject \"[Presentation] - The Hacking Project - Formation d'informatique gratuite\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body body_content\n end\n puts \"mail sent to #{mail_address}\"\n #in order to stay below the 10 mail / sec limit\n sleep(1)\n\n end\nend"
] |
[
"0.69067234",
"0.66721886",
"0.6578228",
"0.6543926",
"0.6509965",
"0.65033174",
"0.6387092",
"0.63591826",
"0.63224727",
"0.6287134",
"0.627994",
"0.62671113",
"0.6246887",
"0.62191373",
"0.619815",
"0.6185012",
"0.61657",
"0.6159606",
"0.614271",
"0.6115382",
"0.61143345",
"0.6113657",
"0.6110723",
"0.6100931",
"0.60312617",
"0.5976646",
"0.5959862",
"0.5915965",
"0.59056234",
"0.58981377",
"0.5888358",
"0.58863115",
"0.5880973",
"0.5844138",
"0.5832604",
"0.5829743",
"0.58073884",
"0.58006895",
"0.5795278",
"0.5789344",
"0.57845765",
"0.5784331",
"0.57800066",
"0.5777616",
"0.57697946",
"0.57635707",
"0.5761133",
"0.57582694",
"0.57419705",
"0.5732697",
"0.5719116",
"0.5715526",
"0.57050335",
"0.5704839",
"0.5700809",
"0.5684537",
"0.5681241",
"0.5678195",
"0.56773424",
"0.56772155",
"0.5672823",
"0.56666696",
"0.56517",
"0.56295735",
"0.5627003",
"0.5626442",
"0.5625413",
"0.5625287",
"0.56210285",
"0.56175774",
"0.56166327",
"0.56129265",
"0.56117564",
"0.56110805",
"0.5609158",
"0.5608125",
"0.56064343",
"0.560543",
"0.56021196",
"0.560193",
"0.5596124",
"0.55919653",
"0.5585946",
"0.5577879",
"0.5577739",
"0.55765533",
"0.5571504",
"0.55660546",
"0.55643743",
"0.55628735",
"0.5559534",
"0.5551466",
"0.5551285",
"0.55465",
"0.55428",
"0.55423725",
"0.55421895",
"0.55411834",
"0.55358195",
"0.55323666"
] |
0.5899764
|
29
|
Method for sending mail notifying signatures are complete
|
def send_signature_complete_mail(document)
DocumentMailer.with(email: document.user.email,
document: document).signing_complete.deliver_later
DocumentEvent.create!(document: document, message: "Varsel om ferdig signering sendt til #{document.user.email} ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def completed\n SignaturesMailer.completed\n end",
"def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def transaction_complete\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def sig_confirmation_mail(signature)\n @signature = signature\n @petition = @signature.petition\n\n @confirm_url = url_for(controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key,\n locale: I18n.locale)\n\n subject = t('mail.confirm.signature.subject', petition_name: @petition.name)\n\n mail(to: @signature.person_email, subject: subject)\n end",
"def payment_notification(options={})\n options = options.symbolize_keys\n receivers = fetch_payment_receivers(options)\n @amount = ((options[:amount].to_f)/100)\n @conn_count = options[:connection_count]\n @last4 = options[:last4]\n mail(:to => receivers, :subject => \"Payment Successful!\")\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def inform_user_of_news_update_mail(signature, update)\n @signature = signature\n @update = update\n @petition = @signature.petition\n @unique_key = url_for(\n controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key)\n\n subject = t('mail.petition.progress_subject', petition: @petition.name)\n\n mail(to: signature.person_email, subject: subject)\n end",
"def withdraw_note(addresses, publication_title) \n #send note to publication creator that the pub has been withdrawn\n #they can checkout the comments to see if there is more info about the withdraw\n \n @publication_title= publication_title \n\n mail(:to => addresses, :subject => publication_title + \" has been withdrawn.\")\n \n end",
"def transaction_complete\n NotificationsMailer.transaction_complete\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def signup_notification(recipient)\n @account = recipient\n\n #attachments['LogoMailingHallist_head.png'] = File.read(\"#{Rails.root}/assets/images/LogoMailingHallist_head.png\")\n #attachments['terms.pdf'] = {:content => generate_your_pdf_here() }\n\n mail(:to => recipient.email_address_with_name,\n :subject => \"New account information\") #do |format|\n #format.text { render :text => \"Welcome! #{recipient.name} go to #{customer_activation_url(:a => recipient.perishable_token )}\" }\n #format.html { render :text => \"<h1>Welcome to HALLIST!</h1> <p>Your account has been created for the following email address: <br> #{recipient.email}</p> <p>Please finish your registration process here: <a href='#{customer_activation_url(:a => recipient.perishable_token )}'>Click to Activate</a></p> <p>Sincerely, <br> The HALLIST team</p>\" }\n #end\n\n end",
"def handed_over_signatories_mail(signature)\n @signature = signature\n @petition = @signature.petition\n @unique_key = url_for(\n controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key)\n\n subject = t('mail.handed_over_subject', petition: @petition.name)\n mail(to: signature.person_email, subject: subject)\n end",
"def send_recover_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: false)\n end",
"def completed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def acknowledge\n if params[PayFast.signature_parameter_name] == generate_signature(:notify)\n response = ssl_post(PayFast.validate_service_url, notify_signature_string,\n 'Content-Type' => \"application/x-www-form-urlencoded\",\n 'Content-Length' => \"#{notify_signature_string.size}\"\n )\n raise StandardError.new(\"Faulty PayFast result: #{response}\") unless ['VALID', 'INVALID'].include?(response)\n\n response == \"VALID\"\n end\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end",
"def send_email\n # There is a deliver_later method which we could use\n InvoiceMailer.email_invoice(self).deliver_now\n self.sent_by_email = true\n self.save\n end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def send_new_mail(document)\n recipient = Recipient.where(document: document, sent: false).first\n if recipient.present?\n DocumentMailer.with(user: document.user,\n email: recipient.email,\n document: document).signature_email.deliver_later\n recipient.update(sent: true)\n DocumentEvent.create!(document: document, message: \"E-post sendt til #{recipient.email} \")\n if document.status != 1\n document.update!(status: 1)\n end\n else\n document.update!(status: 2)\n send_signature_complete_mail(document)\n end\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"cneumann@marsmonitoring.com\") #.deliver_later\n end",
"def complete_registration\n Userregistration.user_registration_receipt(self).deliver\n end",
"def fingering_submitted_email(fingering, admin)\n @fingering = fingering\n mail(:to => admin.email, :subject => \"Fingering Submitted for Approval\", :from => 'bassoonfingeringfinder@gmail.com') \n end",
"def send_verification_email\n update!(email_status: \"sent\", email_verification_token: SecureRandom.uuid)\n JobMailer.confirm_email(self).deliver!\n end",
"def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end",
"def notify_email\n begin\n QuoteMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send quote email notification. #{e.message}\")\n end\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def mail; end",
"def confirm_booksbymail_email(user, bib, values)\n @to = \"bkbymail@pobox.upenn.edu\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end",
"def deliver_confirmation_email_instructions!\n # TODO\n end",
"def done(parse)\n @greeting = \"Job is done\"\n @parse = parse\n attachments[parse.result_f_file_name] = File.read(parse.result_f.path)\n mail to: \"augerdownbooks@gmail.com\", from: \"shawnzam@gmail.com\", subject: \"foof\"\n \n # attachments[report.pdf_file_file_name] = File.read(report.pdf_file.path)\n end",
"def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for #{payment.offer.venue.name}\"\n reply_to 'used@inbound.foodcircles.net'\n html_part do\n content_type 'text/html; charset=UTF-8'\n body \"<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p>\n <p style= text-align: justify>\n <b>confirmation code:</b> #{payment.code}<br>\n <b>good for:</b> #{payment.offer.name}<br>\n <b>only at:</b> #{payment.offer.venue.name}<br>\n <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br>\n <b>expiring:</b> #{30.days.from_now.to_date}</p><br>\n <b>3 steps to redeem:</b>\n <p>\n <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br>\n <b>2)</b> Order regular food or drink for each person in party.<br>\n <b>3)</b> Mark Voucher used by following this link! <a href=\\\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\\\">Mark Voucher Used</a></br>\n </p><br><br>\n Enjoy!<br><br>\n Contact support at <b>support@joinfoodcircles.org</b> if you have any concerns or questions whatsoever.<br><br><br>\n <h3><u>FOR SERVERS:</u></h3>\n <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \\\"Buy One, Feed One\\\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>\"\n end\n end\n end",
"def send_email\n true\n end",
"def notifyRecipients (statusMsgAddress, statusMsgPassword, recipientList, downTitle, downMessage)\n recipientList.length.times do |i|\n msg = \"Subject: #{downTitle}\\n\\n#{downMessage}\"\n smtp = Net::SMTP.new 'smtp.gmail.com', 587\n smtp.enable_starttls\n smtp.start(\"gmail\", statusMsgAddress, statusMsgPassword, :login) do\n smtp.send_message(msg, statusMsgAddress, recipientList[i])\n end\n end\nend",
"def email_sent(to)\n puts green(\"Notification sent to: #{to}\")\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end",
"def invoice_is_ready invoice = Invoice.first\n @invoice = invoice\n mail(to: @invoice.user.email, subject: \"You Invoice is ready\") do |format|\n format.text\n format.mjml\n end\n end",
"def sent_verification_mail()\n @user= User.find(params[:id]);\n TweetsMailer.verification(@user).deliver_now;\n flash[:success]=\"Mail to #{@user.email} has been sended!\";\n redirect_to(verification_user_url(@user));\n end",
"def deliver_email\n#puts \"**** deliver_email: emails=#{emails}\"\n emails = @contact_info.map {|c| c[:email]}.compact.uniq\n self.subject ||= 'Message from SIM Nigeria'\n id_for_reply = self.following_up || id # a follow-up message uses id of the original msg\n#puts \"**** Messages#deliver_email response_time_limit=#{response_time_limit}\"\n outgoing = Notifier.send_group_message(:recipients=>emails, :content=>self.body, \n :subject => subject, :id => id_for_reply , :response_time_limit => response_time_limit, \n :bcc => true, :following_up => following_up) # send using bcc:, not to:\nraise \"send_email with nil email produced\" if outgoing.nil?\n outgoing.deliver\n # Mark all as being sent, but only if they have an email address\n # This is terribly inefficient ... need to find a way to use a single SQL statement\n sent_messages.each do |sm| \n sm.update_attributes(:msg_status => MsgSentToGateway) if sm.member.primary_email\n end\n end",
"def study_upload_complete(user, num_successful, problem_lines, warning_lines)\n\t\tbegin\n\t\t\tfrom \t\t\tDEFAULT_FROM\n\t\t\treply_to \t\tDEFAULT_REPLY_TO\n\t\t\tsubject \t\t\"Your SRDR Study Upload\"\n\t\t\trecipients \t\tuser.email\n\t\t\tsent_on \t\tTime.now\n\t\t\t@num_successful = num_successful\n\t\t\t@problem_lines = problem_lines\n\t\t\t@warning_lines = warning_lines\n\t\trescue Exception=>e \n\t\t\tputs \"ERROR SENDING UPLOAD NOTIFICATION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n\t\tend\n\tend",
"def send_verification_email\n UserMailer.user_group_verification(self).deliver_now\n end",
"def receive_success me,member\n @by_member = member\n @amount = me.amount\n @currency = me.account.currency\n @me = me\n subjects = \"You have been sent some money\"\n mail to: me.receiver.email, subject: subjects\n #when receiver has account\n end",
"def signup_email\n MnoEnterprise::SystemNotificationMailer.registration_instructions(params.require(:user).require(:email)).deliver_later\n\n head :no_content\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def confirm ( recipient,subject,message)\n @recipients = recipient \n @subject = subject \n @from = 'sundtju@gmail.com' \n @password= 'job1come'\n @message=message \n @headers = {} \n sub = @subject + Time.now.strftime(\"%A %B %d, %Y\") \n \n mail(:to => recipient, :subject => sub)\n \n end",
"def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end",
"def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end",
"def send_newsletter_email\n UserMailer.newsletter_confirmation(self).deliver_later\n end",
"def sendmail\n run_mail_tools_queue(@command) do |msg, env|\n # Send the Message\n msg.puts @qmsg.message\n msg.close\n\n env.write('F' + @qmsg.return_path + \"\\0\")\n p @qmsg.recipients\n @qmsg.recipients.each { |r| env.write('T' + r + \"\\0\") }\n env.write(\"\\0\") # End of \"file\"\n end\n\n MailTools::Result.new(@qmsg, :queue, @exit_code)\n end",
"def sending_email\n puts\n email = \"Sending notification email\"\n puts bold(email)\n puts email.length.times.map {\"=\"}.join\n puts\n end",
"def new_user_waiting_for_approval(faculty)\n @faculty = faculty\n\n mail(to: 'rorteammaker@gmail.com', subject: 'A new faculty member is awaiting approval!', body: 'A new faculty member is awaiting your approval!')\n end",
"def send_notifications\n\t\t#puts \"------------- CAME TO SEND NOTIFICAITONS FOR RECEIPT ------------------\"\n\t\t## we will have to override the gather recipients.\n\t\t## how to get the patient ?\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\t#puts \"recipient is: #{recipient}\"\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => RECEIPT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => build_var_hash,\n\t\t\t\t\t:template_sender_id => RECEIPT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\t#puts \"the recipient has email id\"\n\t\t\t\t#puts recipient.email_ids.to_s\n\t\t\t\temail = OrderMailer.receipt(recipient,self,self.payable_to_organization.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def notification(params)\n mail(params)\n end",
"def host_confirmation\n \t#binding.pry\n \tSendMailToHost.host_confirmation(self).deliver!\n end",
"def post_approve_email\n NotificationMailer.post_approve_email('default@email.com')\n end",
"def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end",
"def inform_user_of_answer_mail(signature, answer)\n @signature = signature\n @petition = @signature.petition\n @answer = answer\n @unique_key = url_for(\n controller: 'signatures',\n action: 'confirm',\n signature_id: @signature.unique_key)\n\n subject = t('mail.petition.has_answer_subject', petition: @petition.name)\n\n mail(to: signature.person_email, subject: subject)\n end",
"def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def send_signature_reminder(signature_id)\n request :post, \"/v3/signatures/#{signature_id}/reminder.json\"\n end",
"def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end",
"def send_email_confirmation\n SiteMailer.delay.confirm_product_registration(self)\n end",
"def send_activation_or_reset_mail\n end",
"def approve\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def resend_activation_email\n create_activation_digest\n save\n send_activation_email\n end",
"def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"mitsuimasayoshi@gmail.com\", subject: \"[Localgarage]Printer_URL\"\n end",
"def send_email( params )\n puts \"From: #{params[:from]}\"\n puts \"To: #{params[:to]}\"\n puts \"Email subject: #{params[:subject]}\"\n puts \"Email body: #{params[:body]}\" \n return true\n end",
"def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end",
"def mailer; end",
"def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def send_invoice\n if payment_at_changed? && payment_at.present?\n payable.try(:payment_completed!, self)\n if payable_type == 'UserGroup'\n UserMailer.payment_completed(user, self).deliver\n end\n end\n end",
"def summary(client)\n\n @client = client\n @greeting = \"Hi, here is a pdf\"\n mail to: client.email, subject: 'Summary Confirmation'\n\n\n\n end",
"def resend_mail\n if step_active? && merchant_session_active?\n # send an email verification mail to merchant\n @merchant = Merchant.find(session[:temporary_merchant_id])# get merchant details \n MerchantsMailer.registration_email(@merchant).deliver_later\n render 'new'\n return\n else\n redirect_to root_path\n return\n end\n end",
"def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end",
"def send_download_ext_notice\n UserMailer.send_download_ext_notice(self).deliver_now\n end",
"def send_eighty_g_reciept_notification(donation)\n begin\n # send mail for 80g reciept\n donour = Donour.find(donation.donour_id)\n product = CfrProduct.where(:id => donation.product_id, :is_other_product => 1)\n product_or_event_name = ''\n if product.present?\n product_or_event_name = product.name.to_s\n else\n product_or_event_name = 'General Donation'\n end\n\n if donour.present?\n donour_name = donour.first_name\n if donour.last_name.present?\n donour_name += ' ' + donour.last_name\n end\n if donour.email_id.present?\n begin\n session[:donor_name] = donour_name\n session[:donation_amount] = donation.donation_amount.to_s\n session[:don_id] = donation.id.to_s\n session[:donor_address] = donour.address.to_s\n session[:created_at] = donation.created_at.day.to_s + \"/\" + donation.created_at.mon.to_s + \"/\" + donation.created_at.year.to_s\n \n number = donation.donation_amount.to_s\n amt_parts = number.to_s.split(\".\")\n dec_result = amt_parts.count > 1 ? amt_parts[1].to_s : 0\n \n amt_rupees_text = \"#{wordify number.to_i}\"\n amt_paise_text = nil\n \n begin\n if dec_result.to_i > 0\n amt_paise_text = \"#{wordify dec_result.to_i}\" + ' paise'\n end\n rescue\n amt_paise_text = nil\n end\n if amt_paise_text.nil?\n session[:donation_amount_text] = amt_rupees_text + ' rupees'\n else\n session[:donation_amount_text] = amt_rupees_text + ' rupees and ' + amt_paise_text\n end\n \n pdf_80g_reciept = WickedPdf.new.pdf_from_string(\n render_to_string('pdf_templates/don_receipt_80g.pdf.erb')\n )\n email_text = confirmation_mail_template_with_eighty_g(donour_name, donour.email_id,\n donation.donation_amount.to_s, \n donation.id.to_s, \n product_or_event_name)\n puts \"Emails \" + donour.email_id\n send_mails_with_attachment(donour.email_id, 'Donation Confirmation', email_text, pdf_80g_reciept, 'DonationReciept.pdf')\n session[:donor_name], session[:donation_amount], session[:don_id], session[:donation_amount_text], session[:donor_address] = ''\n \n rescue Exception => e\n logger.warn \"Unable to send mail: #{e}\" \n end\n end \n end\n rescue Exception => ex\n logger.warn \"Unable to send notification: #{ex}\" \n end \n end",
"def notify_finalpayment\n @pack = Packages.find( :all, :conditions => {:finalDelivery => true} )\n @pay = Payment.find( :all )\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id ) && ( t.carriers_id = s.users_id )\n @notification = Notifications.new\n @notification.users_id = t.carriers_id\n @notification.description = \"an amout has been added to your account and another amount has been deducted\"\n @notification.save\n end\n end\n end\n end\n return;\n end",
"def notify\n ReminderMailer.notify\n end",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def send_email_changed_notification; end",
"def send_reminder\r\n\t\tif Date.today == expiration_date - 1\r\n\t\t\tReminderMailer.food_reminder_msg(@user).deliver\r\n \t\tflash[:notice] = \"#{@user.username} has been notified by email.\" \r\n \tend\r\n end",
"def part_num_update(part_numbers, designers, active_designs, total_part_nums, num_updated)\n subject = 'Part Number Descriptions Have Been Auto Updated' \n\n recipients = []\n recipients += designers.collect { |u| u.email}\n recipients += User.where(:last_name => [\"Kasting\", \"Light\", \"Michaels\"]).collect { |u| u.email}\n recipients << \"dtg@teradyne.com\"\n #recipients << \"jonathan.katon@teradyne.com\"\n \n @part_numbers = part_numbers\n @active_designs = active_designs\n @total_part_nums = total_part_nums\n @num_updated_part_nums = num_updated\n \n mail(:to => recipients.uniq,\n :subject => subject \n )\n end",
"def trust_responder_notification(buyer_first_name,buyer_email,buyer_mail_number,investor,trust_responder_notification,buyer_id,is_squeeze_buyer)\n @from = \"#{investor.full_name } <#{investor.investor_email_address}>\"\n @recipients = buyer_email\n @subject = \"#{trust_responder_notification.email_subject}\"\n @sent_on = Time.now\n @body[:buyer_first_name] = buyer_first_name\n @body[:buyer_mail_number] = buyer_mail_number\n @body[:email_body] = trust_responder_notification.email_body\n @body[:investor] = investor\n @body[:buyer_id] = buyer_id\n @body[:is_squeeze_buyer] = is_squeeze_buyer\n @content_type = \"text/html\"\n bts_hdr = {:category => EMAIL_CATEGORIES[:bts]}\n @headers[\"X-SMTPAPI\"] = bts_hdr.to_json\n end",
"def alert_sender\n InvitationMailer.mail_sender(self).deliver\n end",
"def send_fundraiser_featured_notification\n person.send_email :fundraiser_featured_notification, fundraiser: self\n end",
"def sent_success me, member\n @by_member = member\n @amount = me.amount\n @me = me\n @currency = me.account.currency\n subjects = \"Money sent success\"\n mail to: me.sender.email, subject: subjects\n end",
"def perform(user_name, content)\n\t\tNotificationMailer.notify_email(user_name, content).deliver\n\tend",
"def sendeoreturnmail(emails, engineorder, user)\n \n @user = user\n\n @engineorder = engineorder\n\n mail to: emails, subject: \"【重要】R2システムからのエンジン返却登録完了の通知です。\"\n\n return self\n\n end",
"def notify_email\n begin\n InsuranceLeadMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send insurnace lead notification. #{e.message}\")\n end\n end",
"def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end",
"def notify(bodystr, subject=nil, *to_addrs)\n from = '\"VAUtil\" <vautil@' + `/bin/hostname`.chomp + '>'\n to = to_addrs.map { |a| '<' + a + '>' }.join(', ')\n message = <<HERE\nFrom: #{from}\nTo: #{to}\nSubject: #{subject.nil? ? \"VAUtil Notification\" : subject }\nDate: #{Time.now}\nMessage-Id: <#{(0...20).map{ (('0'..'9').to_a + ('a'..'z').to_a).to_a[rand(36)] }.join}@coredial.com>\n\n#{bodystr}\nHERE\n Net::SMTP.start(VAUtil.config['mail_host'], 25, 'coredial.com') do |smtp|\n smtp.send_message(message, from, to_addrs)\n end\n end",
"def email_confirm\n end",
"def send_payment_receipt_by_mail(employee,file_path)\n\t\t\tbegin\n logger.info \"---BEGIN: send mail send_payment_receipt_by_mail---\"\n Mailer::deliver_send_payment_receipt(self,employee,file_path)\n logger.info \"---END: mail send successfull---\"\n rescue Exception => e\n logger.error \"---END: Error---\"\n\t\t \t\tlogger.error e\n logger.error \"------\"\n end\n\tend",
"def send_email_changed_notification?; end"
] |
[
"0.6952288",
"0.6925116",
"0.6554835",
"0.6492871",
"0.6489387",
"0.6475009",
"0.64749724",
"0.6465613",
"0.6453635",
"0.6434189",
"0.6397043",
"0.6321912",
"0.6308923",
"0.6290171",
"0.62781715",
"0.62780416",
"0.6263897",
"0.6260927",
"0.6233106",
"0.6228436",
"0.6227088",
"0.6224877",
"0.62242967",
"0.62106204",
"0.62082285",
"0.6188827",
"0.6155539",
"0.6155064",
"0.61274475",
"0.61233306",
"0.61200196",
"0.6116601",
"0.6113272",
"0.60927814",
"0.60911083",
"0.60811",
"0.60790014",
"0.6076203",
"0.60746443",
"0.6067687",
"0.6064264",
"0.60455316",
"0.60408366",
"0.6034063",
"0.6030513",
"0.6016453",
"0.6015644",
"0.6015135",
"0.60142624",
"0.6013056",
"0.6006879",
"0.6000976",
"0.60004747",
"0.5994709",
"0.59931993",
"0.5992193",
"0.5986193",
"0.59852964",
"0.59818244",
"0.5979459",
"0.59718794",
"0.5970291",
"0.59691286",
"0.59649074",
"0.59622943",
"0.5960181",
"0.59527475",
"0.59518296",
"0.5948602",
"0.59436184",
"0.5937512",
"0.5931907",
"0.5926958",
"0.5925852",
"0.59233755",
"0.59225535",
"0.592118",
"0.59135854",
"0.5913492",
"0.59096986",
"0.5909178",
"0.5901593",
"0.5900306",
"0.58982337",
"0.5895412",
"0.58866256",
"0.58852893",
"0.5882893",
"0.58778936",
"0.5869487",
"0.586637",
"0.58657247",
"0.5860948",
"0.58579946",
"0.5855924",
"0.5852472",
"0.58522147",
"0.5848946",
"0.58469856",
"0.5845059"
] |
0.7214326
|
0
|
Method for making a viable ActiveStorage blob from attachment
|
def attachment
mail.attachments.map do |attachment|
blob = ActiveStorage::Blob.create_after_upload!(
io: StringIO.new(attachment.decoded),
filename: attachment.filename,
content_type: attachment.content_type
)
return blob
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def blob\n generate\n storage.get(path).body\n end",
"def save_to_storage\n if save_attachment?\n object = self.class.bucket.objects.build(full_filename)\n\n object.content_type = content_type\n object.acl = attachment_options[:acl]\n object.content = temp_path ? File.open(temp_path) : temp_data\n object.save\n end\n true\n end",
"def build_attachment(attachable)\n FileStorage::Attachment.new(\n name: name,\n record: record,\n\n # blob: blob,\n location: location,\n namespace: namespace,\n\n original_filename: attachable.original_filename,\n filename: attachable.original_filename,\n filepath: store_path(attachable)\n )\n end",
"def blob; end",
"def blob; end",
"def uploaded_blob(name, serialized_json)\n gzipped = gzip(serialized_json)\n s3_client = ActiveStorage::Blob.service.client\n bucket = ActiveStorage::Blob.service.bucket\n blob = ActiveStorage::Blob.new\n io = StringIO.new(gzipped)\n blob.filename = name\n blob.checksum = blob.send(:compute_checksum_in_chunks, io)\n blob.byte_size = io.size\n blob.content_type = \"application/json\"\n\n bucket.object(blob.key).put(body: io, content_type: \"application/json\", content_encoding: \"gzip\")\n blob.save\n blob\n end",
"def store_blob(blob)\n super #=> returns blob[:tempfile]\n end",
"def blob(arg)\r\n file MojoMagick::tempfile(arg)\r\n end",
"def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"def blob\n @blob ||= image.to_blob\n end",
"def set_blob\n @blob = Blob.find(params[:id])\n end",
"def set_blob\n @blob = Blob.find(params[:id])\n end",
"def create\n @dataservice_blob = Dataservice::Blob.new(params[:blob])\n authorize @dataservice_blob\n\n respond_to do |format|\n if @dataservice_blob.save\n flash[:notice] = 'Dataservice::Blob was successfully created.'\n format.html { redirect_to(@dataservice_blob) }\n format.xml { render :xml => @dataservice_blob, :status => :created, :location => @dataservice_blob }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataservice_blob.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_block_blob(container, blob, content, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n\n # set x-ms-blob-type to BlockBlob\n headers['x-ms-blob-type'] = 'BlockBlob'\n\n # set the rest of the optional headers\n headers['Content-Type'] = options[:content_type] || 'application/octet-stream'\n headers['Content-Encoding'] = options[:content_encoding] if options[:content_encoding]\n headers['Content-Language'] = options[:content_language] if options[:content_language]\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n headers['Cache-Control'] = options[:cache_control] if options[:cache_control]\n\n headers['x-ms-blob-content-type'] = options[:blob_content_type] if options[:blob_content_type]\n headers['x-ms-blob-content-encoding'] = options[:blob_content_encoding] if options[:blob_content_encoding]\n headers['x-ms-blob-content-language'] = options[:blob_content_language] if options[:blob_content_language]\n headers['x-ms-blob-content-md5'] = options[:blob_content_md5] if options[:blob_content_md5]\n headers['x-ms-blob-cache-control'] = options[:blob_cache_control] if options[:blob_cache_control]\n headers['x-ms-blob-content-disposition'] = options[:blob_content_disposition] if options[:blob_content_disposition]\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n # call PutBlob with empty body\n response = call(:put, uri, content, headers)\n\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob\n\n result\n end",
"def create_blob(content)\n options = {\n headers: headers,\n body: {\n content: content,\n encoding: \"base64\"\n }.to_json\n }\n response = self.class.post(\"#{BASE_URI}/repos/#{@owner}/#{@repo}/git/blobs\", options)\n response.parsed_response\n end",
"def to_blob\n f = File.new @path\n f.binmode\n f.read\n ensure\n f.close if f\n end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n end\n attachment\n end",
"def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end",
"def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end",
"def blob\n nil\n end",
"def download_blob_to_tempfile(&block); end",
"def download_blob_to_tempfile(&block); end",
"def attachment; end",
"def meta\n blob = ActiveStorage::Blob.find_signed(params[:id])\n\n render json: { blob: blob, url: rails_blob_url(blob) }\n end",
"def initialize blob, path\n @blob = blob\n self.content = blob.data\n self.path = path\n end",
"def blob\n dbf.blob\n end",
"def add_blob\n repository.add(blob_path)\n end",
"def blob\n @blob ||= ($repo.gblob(@rev + ':' + @name))\n end",
"def to_blob\n @blob\n end",
"def attach(attachable)\n # Moving the file to some safe place; as tmp files will be flushed timely\n blob_was = attached? ? read_file(attachable) : nil\n blob = create_file_from(attachable)\n\n unless blob == blob_was\n detach\n write_attachment build_attachment(attachable)\n end\n end",
"def blob_params\n params.require(:blob).permit(:name, :length, :last_modified)\n end",
"def upload\n permitted_params = params[:attachment]\n file = permitted_params.delete(:file)\n attr = {file: file, user: current_user}\n\n if permitted_params[:attachmentable_type].present? && permitted_params[:attachmentable_id].present?\n attachmentable_type = permitted_params[:attachmentable_type]\n attachmentable_id = permitted_params[:attachmentable_id]\n attr = attr.merge(attachmentable_type: attachmentable_type, attachmentable_id: attachmentable_id)\n end\n\n attachment = Attachment.new(attr)\n if attachment.savee\n render json:{\n code: 0,\n data: AttachmentSerializer.new(attachment)\n }\n else\n render json:{\n code: -1,\n data: {\n message: attachment.errors.full_messages,\n }\n }\n end\n\n end",
"def blob(s)\n SQL::Blob.new(s)\n end",
"def to_blob(constraints = {})\n to_datastream(constraints).to_blob\n end",
"def to_blob(constraints = {})\n to_datastream(constraints).to_blob\n end",
"def attach_file_to_a_task(blob:, filename:, task_id:)\n # find the task to add this attachment to\n the_task = find_task_or_throw_execution_error(task_id: task_id)\n\n # authorize this action\n unless TaskPolicy.new(context[:current_user], the_task).update_task?\n raise GraphQL::ExecutionError, \"You are not authorized to add an attachment to this task.\"\n end\n\n # create a new attachment in memory\n new_attachment = the_task.attachments.new(\n file: { io: StringIO.new(Base64.decode64(blob)), filename: filename },\n created_by: context[:current_user]\n )\n\n # and save it to the database\n if new_attachment.save\n { attachment: new_attachment }\n else\n raise GraphQL::ExecutionError, attachment.errors.full_messages.join(\" | \")\n end\n end",
"def show\n send_file_by_disk_key @blob, content_type: @blob.content_type\n rescue ActionController::MissingFile, ActiveStorage::FileNotFoundError\n head :not_found\n rescue ActiveStorage::IntegrityError\n head :unprocessable_entity\n end",
"def attach_file_to_an_indicator(blob:, filename:, indicator_id:)\n # find the indicator to add this attachment to\n the_indicator = find_indicator_or_throw_execution_error(indicator_id: indicator_id)\n\n # authorize this action\n unless IndicatorPolicy.new(context[:current_user], the_indicator).update_indicator?\n raise GraphQL::ExecutionError, \"You are not authorized to add an attachment to this indicator.\"\n end\n\n # create a new attachment in memory\n new_attachment = the_indicator.attachments.new(\n file: { io: StringIO.new(Base64.decode64(blob)), filename: filename },\n created_by: context[:current_user]\n )\n\n # and save it to the database\n if new_attachment.save\n { attachment: new_attachment }\n else\n raise GraphQL::ExecutionError, attachment.errors.full_messages.join(\" | \")\n end\n end",
"def attachment\n raise NotImplementedError, 'Please implement me. :('\n end",
"def to_blob\n File.binread(path)\n end",
"def create_attachment_raw(name, binary, filename)\n type = MIME::Types.type_for(filename).first\n mime = type ? type.content_type : \"application/octet-stream\"\n write_attribute(\"#{name}_id\", BSON::ObjectId.new)\n write_attribute(\"#{name}_name\", filename)\n write_attribute(\"#{name}_size\", binary.size)\n write_attribute(\"#{name}_type\", mime)\n create_attachment_queue[name] = binary\n end",
"def createThumbnail(blob, contenttype, device )\n\n\n thumb_path = \"public/thumbnails/#{device.id}/\"\n \n thumb_name = blob.blob_hash.to_s+\".png\"\n\n if contenttype == \"image/jpeg\" or contenttype == \"image/png\" or contenttype == \"image/gif\"\n data = getBlobById(blob.blob_hash)\n createIcon(data, thumb_name, thumb_path)\n blob.update_attribute(:thumbnail_name, thumb_name)\n return thumb_name\n \n elsif contenttype == \"video/x-msvideo\" or contenttype == \"video/msvideo\"\n format = blob.devfile.name.split(\".\").last\n if format == 'avi'\n vR_default_thumbnail_file = \"vR_avi.png\"\n elsif format == 'mov'\n vR_default_thumbnail_file = \"vR_mov.png\"\n end\n \n elsif contenttype == \"application/mswordapplication/x-mswordapplication/x-wordapplication/wordtext/plain\"\n vR_default_thumbnail_file = \"vR_doc.png\"\n elsif contenttype == \"application/x-ruby\"\n vR_default_thumbnail_file = \"vR_ruby.png\"\n elsif contenttype == \"text/plain\"\n vR_default_thumbnail_file = \"vR_txt.png\"\n else\n puts \"Unknown Filetype: #{contenttype.to_s}\".background(:red)\n vR_default_thumbnail_file = \"vR_unknown.png\"\n end\n \n # create dir if it does not exist\n if not (File.exists?(thumb_path) && File.directory?(thumb_path))\n FileUtils.mkdir_p(thumb_path)\n end\n \n # Copy default thumbnail to file\n from = \"public/thumbnails/vR_default_thumbnails/\" + vR_default_thumbnail_file\n to = thumb_path+thumb_name\n # ftools (ruby 1.8.7)\n #File.copy(from, to )\n \n # fileutils (ruby 1.9.2)\n FileUtils.cp(from, to )\n \n \n blob.update_attribute(:thumbnail_name, thumb_name)\n return thumb_name\n end",
"def attach_file_to_a_case(blob:, filename:, case_id:)\n # find the case to add this attachment to\n the_case = find_case_or_throw_execution_error(case_id: case_id)\n\n # authorize this action\n unless CasePolicy.new(context[:current_user], the_case).update_case?\n raise GraphQL::ExecutionError, \"You are not authorized to add an attachment to this case.\"\n end\n\n # create a new attachment in memory\n new_attachment = the_case.attachments.new(\n file: { io: StringIO.new(Base64.decode64(blob)), filename: filename },\n created_by: context[:current_user]\n )\n\n # and save it to the database\n if new_attachment.save\n { attachment: new_attachment }\n else\n raise GraphQL::ExecutionError, attachment.errors.full_messages.join(\" | \")\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n @attachment.name = @attachment.file.blob.checksum\n respond_to do |format|\n if @attachment.save\n convert_to_line\n format.html { redirect_to attachment_line_list_path(@attachment), notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create_attachment\n @mode = params[:mode]\n logger.debug \"==== Create attachment ====\"\n frbr_model_as_string = params[:frbr][:object]\n @mode = params[:attachment_mode][:mode]\n @frbr_object = convert_id_to_model(frbr_model_as_string)\n klass = @frbr_object.class.to_s.underscore\n \n logger.debug \"Klass is #{klass}\"\n \n valid = false\n begin MediaItem.transaction \n @media_item = MediaItem.new(params[:media_item])\n @media_item.updated_by = @login.login_id\n logger.debug \"** MEDIA ITEM UPDATED BY IS #{@media_item.updated_by}\"\n logger.debug @media_item.to_yaml\n @media_item.save \n logger.debug \"MEDIA ITEM SAVED\"\n \n #Create a new class for the attachment, such as SampleAttachment, VenueAttachment etc\n attachment_class_string = @frbr_object.class.to_s+\"Attachment\"\n attachment_class_string.gsub!(\"CampaignMailout\", \"Mailout\") #fix for attachment table with non standard name\n attachment_class = attachment_class_string.constantize\n @klass_attachment = attachment_class.send('new')\n \n logger.debug \"KLASS attachment is #{@klass_attachment}\"\n logger.debug \"Sending to klass_attachment: #{klass}_id, #{@frbr_object.id}\"\n @klass_attachment.send(klass+\"_id=\",@frbr_object.id)\n #@klass_attachment.send(\"manifestation_id\",@frbr_object.id)\n logger.debug \"klass attachment is now #{@klass_attachment.to_yaml}\"\n @klass_attachment.media_item = @media_item\n \n if @klass_attachment.respond_to?('attachment_type_id')\n if @mode == 'tiny_mce'\n @klass_attachment.attachment_type_id = AttachmentType::TINY_MCE.attachment_type_id\n else\n \n \n #get the attachment type from the drop down\n type_id = params[:attachment_type][:attachment_type_id]\n logger.debug \"TYPE_ID: #{type_id}\"\n raise ArgumentError, \"Please provide an attachment type\" if type_id.blank?\n \n #now check its valid\n new_attachment_type = AttachmentType.find(type_id)\n raise ArgumentError, \"The selected attachment type of id #{type_id} is invalid\" if new_attachment_type.blank?\n logger.debug \"NEW ATT TYPE: #{new_attachment_type}\"\n @klass_attachment.attachment_type = new_attachment_type\n \n end\n end\n \n @klass_attachment.save\n valid = @frbr_object.save # This will save the attachment\n logger.debug \"Media Item created\"\n #Rescue a failed transaction\n rescue Exception => e\n logger.debug \"Transaction was invalid\"\n logger.debug \"AttachmentException: #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n @error_message = \"The upload failed, the error was #{e.message}\"\n valid = false\n end\n\n respond_to do |format|\n if valid\n logger.debug \"Valid response\"\n flash[:attachment] = 'MediaItem was successfully created.'\n \n #This is rather naughty... \n #See http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent for background\n #Without the option of forcing .js routing from a form tag (as opposed to remote form tag) the\n #HTML response is doing javascript manipulation of the page\n format.html do\n logger.debug \"VALID RESPONSE, HTML\"\n responds_to_parent do\n @media_items = attachments(@frbr_object)\n render :update do |page|\n edit_media_item_form = 'shared/attachments/edit_media_item'\n # special case for campaign mailouts\n edit_media_item_form = 'campaign_mailouts/media_item' if @frbr_object.class.to_s.match('CampaignMailout')\n \n page.insert_html :bottom, \"attachments_\"+generate_id(@frbr_object),\n :partial => edit_media_item_form, :locals => {:object => @frbr_object, :media_item => @media_item, :mode => @mode.to_sym}\n #Clear the text field of the image upload\n # page.replace_html 'uploadWidget', :partial => 'shared/attachments/upload_widget'\n page.replace_html 'new_attachment_form_'+generate_id(@frbr_object), :partial => 'shared/attachments/new_attachment_form_button', :locals => {:object => @frbr_object, :mode => @mode.to_sym}\n \n page.visual_effect :highlight, generate_id(@media_item)\n \n end\n end\n end\n format.xml { head :created, :location => media_item_url(@media_item) }\n \n else\n logger.debug \"Response for invalid option\"\n flash[:attachment] = 'The file upload failed for some reason'\n \n #Ensure rendering in case where user does not select an attachment type\n @attachment_type = AttachmentType.new if @attachment_type.blank?\n format.html { \n #prepare_edit\n get_attachment_types(@frbr_object)\n responds_to_parent do\n render :update do |page|\n \n dom_id = 'new_attachment_form_'+generate_id(@frbr_object)\n \n page.replace_html dom_id,\n :partial => 'shared/attachments/attachment_form',\n :locals => {:object => @frbr_object, :submission => :new, :media_item => @media_item, :mode => @mode}\n page.visual_effect :shake, dom_id\n page << \"alert('#{@error_message}');\"\n end\n end\n }\n format.xml { render :xml => @media_item.errors.to_xml }\n \n end\n end\n end",
"def blob_to_base64 (photo)\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn \"data:image/jpeg;base64,\" + [photo].pack('m0')\n\tend",
"def create\n @attachment = Attachment.new(uploaded_data: params[:file], col_sep: params[:col_sep], quote_char: params[:quote_char], encoding: params[:encoding])\n @attachment.user = current_user\n @attachment.save!\n # TODO rescue parser errors -> rows empty\n rows = @attachment.rows(4)\n render json: {errors: @attachment.parse_error, id: @attachment.id, rows: rows}, status: :ok\n end",
"def blob(repo)\n @blob ||= Grit::Blob.create(repo,\n :id => @sha, :name => name, :size => @size)\n end",
"def attachment_representation\n parametrized_attachment.tap do |attachment|\n %w(filename target_directory max_file_size).each do |attr|\n attachment.public_send(\"#{attr}=\", public_send(attr))\n end\n attachment.readonly!\n end\n end",
"def blob(s)\n if s.is_a?(SQL::Blob)\n s\n else\n SQL::Blob.new(s)\n end\n end",
"def create_page_blob(container, blob, length, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n\n # set x-ms-blob-type to PageBlob\n headers['x-ms-blob-type'] = 'PageBlob'\n\n # ensure content-length is 0 and x-ms-blob-content-length is the blob length\n headers['Content-Length'] = 0.to_s\n headers['x-ms-blob-content-length'] = length.to_s\n\n # set x-ms-sequence-number from options (or default to 0)\n headers['x-ms-sequence-number'] = (options[:sequence_number] || 0).to_s\n\n # set the rest of the optional headers\n headers['Content-Type'] = options[:content_type] if options[:content_type]\n headers['Content-Encoding'] = options[:content_encoding] if options[:content_encoding]\n headers['Content-Language'] = options[:content_language] if options[:content_language]\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n headers['Cache-Control'] = options[:cache_control] if options[:cache_control]\n\n headers['x-ms-blob-content-type'] = options[:blob_content_type] if options[:blob_content_type]\n headers['x-ms-blob-content-encoding'] = options[:blob_content_encoding] if options[:blob_content_encoding]\n headers['x-ms-blob-content-language'] = options[:blob_content_language] if options[:blob_content_language]\n headers['x-ms-blob-content-md5'] = options[:blob_content_md5] if options[:blob_content_md5]\n headers['x-ms-blob-cache-control'] = options[:blob_cache_control] if options[:blob_cache_control]\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n # call PutBlob with empty body\n response = call(:put, uri, nil, headers)\n\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob\n\n result\n end",
"def get_blob(container, blob, options={})\n query = { }\n query['snapshot'] = options[:snapshot] if options[:snapshot]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n headers['x-ms-range'] = \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n headers['x-ms-range-get-content-md5'] = true if options[:get_content_md5]\n end\n\n response = call(:get, uri, nil, headers)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end",
"def rest_api_test_object\n Factory(:pdf_sop, policy: Factory(:downloadable_public_policy)).content_blob\n end",
"def backing_store\n Attachment.backing_store(url)\n end",
"def attachment(params, &block)\n ActiveSupport::Deprecation.warn \"attachment() is deprecated and will be removed in future versions. \" <<\n \"Please use the attachments[] API instead.\"\n params = { :content_type => params } if String === params\n\n params[:content] ||= params.delete(:data) || params.delete(:body)\n\n if params[:filename]\n params = normalize_file_hash(params)\n else\n params = normalize_nonfile_hash(params)\n end\n\n part(params, &block)\n end",
"def image\n return unless object.image.attached?\n\n # object.image.blob.attributes\n # .slice('filename', 'byte_size')\n # .merge(url: image_url)\n # .tap { |attrs| attrs['name'] = attrs.delete('filename') }\n object.image.service_url\n \n end",
"def s3_object\n attached_file&.storage&.object(file.id)\n end",
"def get_blob(container, blob, options={})\n query = { }\n StorageService.with_query query, 'snapshot', options[:snapshot]\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = StorageService.common_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n StorageService.with_header headers, 'x-ms-range', \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n StorageService.with_header headers, 'x-ms-range-get-content-md5', true if options[:get_content_md5]\n end\n add_blob_conditional_headers options, headers\n\n response = call(:get, uri, nil, headers, options)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end",
"def convert_data_uri_to_upload(obj_hash)\n if obj_hash.try(:match, %r{^data:(.*?);(.*?),(.*)$})\n image_data = split_base64(obj_hash)\n image_data_string = image_data[:data]\n image_data_binary = Base64.decode64(image_data_string)\n temp_img_file = Tempfile.new(\"data_uri-upload\")\n temp_img_file.binmode\n temp_img_file << image_data_binary\n temp_img_file.rewind\n\n img_params = {:filename => \"data-uri-img-#{DateTime.now.strftime('%Q').to_i}.#{image_data[:extension]}\", :type => image_data[:type], :tempfile => temp_img_file}\n uploaded_file = ActionDispatch::Http::UploadedFile.new(img_params)\n end\n return uploaded_file \n end",
"def blob_to_private_image_object(storage_account, blob, blob_properties)\n hash = blob.to_h.merge(\n :storage_account => storage_account.to_h,\n :blob_properties => blob_properties.to_h,\n :operating_system => blob_properties[:x_ms_meta_microsoftazurecompute_ostype],\n :uri => File.join(\n storage_account.blob_endpoint_from_hash,\n blob[:container],\n blob.name_from_hash\n )\n )\n\n StorageAccount::PrivateImage.new(hash).tap { |image| image.resource_group = storage_account.resource_group }\n end",
"def lob_object(pdf_image_url)\n image = Image.where(pdf_image_url: pdf_image_url).first\n @lob.objects.create(\n name: image.instagram_id,\n file: image.image_url,\n setting_id: \"500\" # 4x6 color Gloss Photo\n )\n end",
"def featured_image\n if object.featured_image.attached?\n {\n url: rails_blob_url(object.featured_image)\n }\n end\n end",
"def convert_data_uri_to_upload(obj_hash)\n puts \"========#{obj_hash}\"\n # if obj_hash.try(:match, %r{^data:(.*?);(.*?),(.*)$})\n image_data = split_base64(obj_hash)\n image_data_string = image_data[:data]\n image_data_binary = Base64.decode64(image_data_string)\n\n temp_img_file = Tempfile.new(\"data_uri-upload\")\n temp_img_file.binmode\n temp_img_file << image_data_binary\n temp_img_file.rewind\n\n img_params = {:filename => \"data-uri-img.#{image_data[:extension]}\", :type => image_data[:type], :tempfile => temp_img_file}\n uploaded_file = ActionDispatch::Http::UploadedFile.new(img_params)\n\n #\n # obj_hash[:image] = uploaded_file\n # obj_hash.delete(:remote_image_url)\n # end\n\n uploaded_file\nend",
"def create\n @channel = Channel.find_by_name(params[:channel_id])\n @attachment = Attachment.new(params[:attachment])\n\n # {\"file\"=>#<ActionDispatch::Http::UploadedFile:0x00000005bc3158 @original_filename=\"investor_faq.org\", @content_type=\"application/octet-stream\",\n # @headers=\"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"investor_faq.org\\\"\\r\\nContent-Type: application/octet-stream\\r\\n\", @tempfile=#<File:/tmp/RackMultipart20111212-24212-4znzta>>\n # \"commit\"=>\"Upload\",\n # \"utf8\"=>\"✓\",\n # \"authenticity_token\"=>\"SrS7bnPQ76RQJLWOx58bm1uyDsQq5f4FObPLl9Zh+Ao=\",\n # \"remotipart_submitted\"=>\"true\",\n # \"X-Requested-With\"=>\"IFrame\",\n # \"X-Http-Accept\"=>\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01\",\n # \"channel_id\"=>\"Shiro\"\n # }\n\n @attachment.user = current_user\n @attachment.channel = Channel.find_by_name(params[:channel_id])\n @attachment.file = params[:file]\n\n respond_to do |format|\n if @attachment.save\n format.html { }\n format.js\n format.json { render json: @attachment, status: :created }\n else\n format.html { render action: \"new\" }\n format.js\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment\n record.public_send(\"#{name}_file\")\n end",
"def from_blob(blob)\n generate_uid\n tmp_file = Pathname.new(Dir::tmpdir).join(\"#{@uid}_#{@source.basename}\")\n tmp_image = image_from_blob(blob)\n `#{@command} '#{tmp_image}' '#{tmp_file.to_s}' #{lang} #{psm} #{config_file} #{clear_console_output}`\n @value = File.read(\"#{tmp_file.to_s}.txt\").to_s\n @uid = nil\n remove_file([tmp_image,\"#{tmp_file.to_s}.txt\"])\n rescue\n raise RTesseract::ConversionError\n end",
"def create_blob_block(container, blob, block_id, content, options={})\n query = { 'comp' => 'block'}\n query['blockid'] = Base64.strict_encode64(block_id)\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n\n response = call(:put, uri, content, headers)\n\n response.headers['Content-MD5']\n end",
"def create_attachment(name,file)\n case\n when file.is_a?(Hash)\n filename = file[:filename]\n size = File.size(file[:tempfile])\n mime = file[:type]\n unless mime\n type = MIME::Types.type_for(filename).first\n mime = type ? type.content_type : \"application/octet-stream\"\n end\n when file.respond_to?(:read)\n filename = case\n when file.respond_to?(:original_filename) && file.original_filename\n file.original_filename\n when file.respond_to?(:tempfile)\n File.basename(file.tempfile.path)\n else\n File.basename(file.path)\n end\n size = File.size(file.respond_to?(:tempfile) ? file.tempfile : file)\n type = MIME::Types.type_for(filename).first\n mime = type ? type.content_type : \"application/octet-stream\"\n else\n return\n end\n write_attribute(\"#{name}_id\", BSON::ObjectId.new)\n write_attribute(\"#{name}_name\", filename)\n write_attribute(\"#{name}_size\", size)\n write_attribute(\"#{name}_type\", mime)\n create_attachment_queue[name] = file\n end",
"def blob?\n @blob\n end",
"def create_empty_vhd_blob(storage_account_name, container_name, blob_name, blob_size_in_gb)\n @logger.info(\"create_empty_vhd_blob(#{storage_account_name}, #{container_name}, #{blob_name}, #{blob_size_in_gb})\")\n blob_created = false\n initialize_blob_client(storage_account_name) do\n begin\n @logger.info(\"create_empty_vhd_blob: Start to generate vhd footer\")\n opts = {\n :type => :fixed,\n :name => \"/tmp/footer.vhd\", # Only used to initialize Vhd, no local file is generated.\n :size => blob_size_in_gb\n }\n vhd_footer = Vhd::Library.new(opts).footer.values.join\n\n # Reference Virtual Hard Disk Image Format Specification\n # http://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc\n vhd_size = blob_size_in_gb * 1024 * 1024 * 1024\n blob_size = vhd_size + 512\n options = {\n :timeout => 300 # seconds\n }\n @logger.info(\"create_empty_vhd_blob: Create empty vhd blob #{blob_name} with size #{blob_size}\")\n @blob_service_client.create_page_blob(container_name, blob_name, blob_size, options)\n blob_created = true\n\n @logger.info(\"create_empty_vhd_blob: Start to upload vhd footer\")\n\n @blob_service_client.create_blob_pages(container_name, blob_name, vhd_size, blob_size - 1, vhd_footer, options)\n rescue => e\n @blob_service_client.delete_blob(container_name, blob_name) if blob_created\n cloud_error(\"Failed to create empty vhd blob: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n end\n end\n end",
"def active_storage_param(relation)\n if relation.has_one?\n relation.name.to_s.gsub(/(_attachment)$/, '').to_sym\n else\n { relation.name.to_s.gsub(/(_attachments)$/, '').to_sym => [] }\n end\n end",
"def file_on_disk\n ActiveStorage::Blob.service.send(:path_for, file.key)\n end",
"def create_file_to_upload\n file_path = $redis.get(\"tempfile_path_#{self.id}\")\n tempfile = File.open(file_path,'r')\n\n file = ActionDispatch::Http::UploadedFile.new({\n :tempfile => File.new(tempfile)\n })\n file.original_filename = File.basename(file_path).split(\"_\", 2).last\n file.content_type = \"application/#{File.basename(file_path).split('.').last}\" \n file\n end",
"def add_attachment_from_io(storage, remote_path, io, file_size)\n \n file_attachment = nil\n\n transaction do |t|\n file_attachment = FileAttachment::create_from_io(self, storage, remote_path, io, file_size)\n file_attachments << file_attachment\n save\n end\n\n return file_attachment\n\n end",
"def retrieve!(identifier)\n HesCloudStorage::HesCloudStorageEngine::File.new(uploader, self, ::File.basename(uploader.store_path(identifier), uploader.root))\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end",
"def init_fog_file(filename, body, options={})\n # If the \"filename\" or the \"body\" are empty then return nil\n return nil if filename.nil? || body.nil?\n # Set file's access control list (ACL).\n\n aws_acl = (self.config.aws_acl?)? self.config.aws_access_control_list.to_s : nil\n # expiry is the number of seconds the file will available publicly\n expiry = options.has_key?(:expiry)? options[:expiry] : ((self.config.expiry?)? self.config.expiry.to_i : nil)\n ext = File.extname(filename)[1..-1] # The file extension\n mime = MultiMime.lookup(ext) # Look up the content type based off the file extension\n prefix = options.has_key?(:prefix)? options[:prefix] : self.config.prefix\n full_filename = (self.config.local? || !self.config.enabled?)? filename : \"#{prefix}#{filename}\"\n disposition_attachment = options.has_key?(:attachment)? options[:attachment] : false\n\n # file Hash to be used to create a Fog for upload\n file = {\n :key => \"#{full_filename}\",\n :body => body,\n :content_type => mime\n }\n file.merge!({:content_disposition => \"attachment\"}) if disposition_attachment\n\n file.merge!({:public => true}) if self.config.public?\n\n if self.config.aws?\n if self.config.public? && self.config.expiry?\n file.merge!({:cache_control => \"public, max-age=#{expiry}\"})\n end\n # valid acls: private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control\n file.merge!({:acl=>self.config.aws_access_control_list.to_s}) if self.config.aws_acl?\n file.merge!({:expires => Time.now.utc.to_i + expiry}) if !self.config.public? && self.config.expiry?\n file.merge!({:storage_class => 'REDUCED_REDUNDANCY'}) if self.config.aws_rrs?\n end\n\n return file\n end",
"def create_empty_vhd_blob(storage_account_name, container_name, blob_name, blob_size_in_gb)\n @logger.info(\"create_empty_vhd_blob(#{storage_account_name}, #{container_name}, #{blob_name}, #{blob_size_in_gb})\")\n blob_created = false\n initialize_blob_client(storage_account_name) do\n begin\n @logger.info(\"create_empty_vhd_blob: Start to generate vhd footer\")\n opts = {\n :type => :fixed,\n :name => \"/tmp/footer.vhd\", # Only used to initialize Vhd, no local file is generated.\n :size => blob_size_in_gb\n }\n vhd_footer = Vhd::Library.new(opts).footer.values.join\n\n # Reference Virtual Hard Disk Image Format Specification\n # http://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc\n vhd_size = blob_size_in_gb * 1024 * 1024 * 1024\n blob_size = vhd_size + 512\n options = {\n :timeout => TIMEOUT_FOR_BLOB_OPERATIONS\n }\n options = merge_storage_common_options(options)\n @logger.info(\"create_empty_vhd_blob: Calling create_page_blob(#{container_name}, #{blob_name}, #{blob_size}, #{options})\")\n @blob_service_client.create_page_blob(container_name, blob_name, blob_size, options)\n blob_created = true\n\n @logger.info(\"create_empty_vhd_blob: Start to upload vhd footer\")\n\n options = merge_storage_common_options(options)\n # Do not log vhd_footer because its size is 512 bytes.\n @logger.info(\"create_empty_vhd_blob: Calling put_blob_pages(#{container_name}, #{blob_name}, #{vhd_size}, #{blob_size - 1}, [VHD-FOOTER], #{options})\")\n @blob_service_client.put_blob_pages(container_name, blob_name, vhd_size, blob_size - 1, vhd_footer, options)\n rescue => e\n if blob_created\n options = merge_storage_common_options()\n @logger.info(\"create_empty_vhd_blob: Calling delete_blob(#{container_name}, #{blob_name}, #{options})\")\n @blob_service_client.delete_blob(container_name, blob_name, options)\n end\n cloud_error(\"create_empty_vhd_blob: Failed to create empty vhd blob: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\")\n end\n end\n end",
"def initialize(blob, commit)\n @blob = blob\n @commit = commit\n @file = File.new(blob.path, nil)\n end",
"def to_blob\n stream = StringIO.new\n @surface.write_to_png(stream)\n stream.string\n end",
"def upload\n requires_user_can :edit, task\n\n attachment = paper_attachment.file\n paper_attachment.worker.download(\n paper,\n paper_attachment.s3_url,\n current_user\n )\n\n render json: attachment,\n status: paper_attachment.existing_file ? 200 : 201,\n root: 'attachment',\n serializer: AttachmentSerializer\n end",
"def meta_for_blob(blob)\n {\n \"name\" => blob.filename,\n \"size\" => blob.byte_size,\n \"mimeType\" => blob.content_type,\n \"url\" => blob.service_url(disposition: :inline, expires_in: 1.hour),\n }.as_json\n end",
"def blob(id, commit_sha=nil, path=nil)\n blob = self.lookup(id); blob_entry={}\n if commit_sha && path\n commit = self.lookup(commit_sha)\n unless commit\n root_tree = commit.tree\n blob_entry = Gitlab::Git::Blob.find_entry_by_path(self, root_tree.oid, path)\n end\n end\n if blob\n Gitlab::Git::Blob.new(\n id: blob.oid,\n name: blob_entry[:name],\n size: blob.size,\n data: blob.content,\n mode: blob_entry[:mode],\n path: path,\n commit_id: commit_sha,\n )\n end\n end",
"def attached_file\n=begin # TODO: remove when :json resolved\n file || (file_attacher.load_data(file_data) if file_data.present?)\n=end\n file || file_attacher_load\n end",
"def attachment_field(object_name, method, object:, **options)\n options[:data] ||= {}\n\n definition = object.send(:\"#{method}_attachment_definition\")\n options[:accept] = definition.accept\n\n if options[:direct]\n url = PmacsRefile.attachment_upload_url(object, method, host: options[:host], prefix: options[:prefix])\n options[:data].merge!(direct: true, as: \"file\", url: url)\n end\n\n if options[:presigned] and definition.cache.respond_to?(:presign)\n url = PmacsRefile.attachment_presign_url(object, method, host: options[:host], prefix: options[:prefix])\n options[:data].merge!(direct: true, presigned: true, url: url)\n end\n\n options[:data][:reference] = SecureRandom.hex\n options[:include_hidden] = false\n\n attachment_cache_field(object_name, method, object: object, **options) + file_field(object_name, method, options)\n end",
"def upload_file(filename,mime)\n file = ActionDispatch::Http::UploadedFile.new(filename: 'test.pdf', type: 'application/pdf', tempfile: File.new(\"#{Rails.root}/spec/fixtures/test.pdf\"))\n file\n end",
"def newobj(type, name, hash)\n transport = Puppet::TransObject.new(name, \"file\")\n transport[:path] = path\n transport[:ensure] = \"file\"\n assert_nothing_raised {\n file = transport.to_ral\n }\n end",
"def create_claim_attachment(claim_id:, path: nil, file: nil, bytes: nil, base64: nil, file_name: nil, file_type: nil, description: '')\n data = if path\n claim_attachment_from_path(path)\n elsif file\n claim_attachment_from_file(file)\n elsif bytes\n raise ArgumentError.new(\"file_name is required when supplying bytes\") unless file_name\n claim_attachment_from_bytes(bytes, file_name, file_type)\n elsif base64\n raise ArgumentError.new(\"file_name is required when supplying base64\") unless file_name\n raise ArgumentError.new(\"file_type is required when supplying base64\") unless file_type\n claim_attachment_from_base46(base64, file_name, file_type)\n else\n {}\n end.merge({description: description})\n\n post(\"claims/#{claim_id}/attachments\", data)\n end",
"def create(**opts, &block)\n @blob.create(**opts) do |io|\n @compress.writer(io, **@opts) do |cio|\n @format.encoder(cio, **@opts, &block)\n end\n end\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::TrueVault::File.new(api_key, vault_id, identifier)\n end",
"def blob_params\n params.require(:blob).permit(:blob_url, :datum, datum_attributes: [:title, :description, :price, :id])\n end",
"def call(filename, storage_info, public_flag)\n primary_store = storage_info.keys.first\n asset = create filename,\n repository(primary_store),\n storage_info[primary_store],\n copies(storage_info),\n public_flag\n json_from asset\n end"
] |
[
"0.7118034",
"0.682665",
"0.67741495",
"0.67528325",
"0.67528325",
"0.6704198",
"0.66375333",
"0.66314626",
"0.66031206",
"0.64447635",
"0.6307627",
"0.6277796",
"0.6250707",
"0.62150043",
"0.6202388",
"0.617266",
"0.6167845",
"0.6167845",
"0.6167845",
"0.6167845",
"0.6167845",
"0.6167845",
"0.61530775",
"0.6132929",
"0.6132929",
"0.61311203",
"0.60832036",
"0.60832036",
"0.60374606",
"0.60288596",
"0.599828",
"0.5959946",
"0.5956804",
"0.5934965",
"0.5930495",
"0.59295005",
"0.58969986",
"0.5896841",
"0.5858404",
"0.5849261",
"0.5849261",
"0.5844676",
"0.58442056",
"0.5841566",
"0.5833938",
"0.58322227",
"0.58241856",
"0.580634",
"0.57959455",
"0.57815605",
"0.57573533",
"0.5753995",
"0.5738237",
"0.57257015",
"0.5725041",
"0.57174355",
"0.5712752",
"0.5705583",
"0.5696479",
"0.5695866",
"0.5686801",
"0.5682731",
"0.56765866",
"0.5665679",
"0.5656298",
"0.564427",
"0.56147516",
"0.56125087",
"0.56123716",
"0.56085247",
"0.56081164",
"0.5605555",
"0.5603574",
"0.55970955",
"0.5596538",
"0.55748814",
"0.55657935",
"0.5558206",
"0.55565935",
"0.55545163",
"0.5553696",
"0.55345786",
"0.55345786",
"0.55345786",
"0.5527282",
"0.55196506",
"0.5518163",
"0.5491566",
"0.5490943",
"0.54882306",
"0.54841775",
"0.5476705",
"0.54683447",
"0.5464011",
"0.5456809",
"0.54535145",
"0.54517424",
"0.5423525",
"0.5417591",
"0.5405235"
] |
0.69095224
|
1
|
Retrieve email_token from mail
|
def email_token
recipient = mail.recipients.find { |r| MATCHER.match?(r) }
recipient[MATCHER, 1]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extract_token_from_email(token_name)\n mail_body = last_email.body.to_s\n mail_body[/#{token_name.to_s}_token=([^\"]+)/, 1]\n end",
"def extract_token_from_email(token_name)\n mail_body = last_email.to_s\n mail_body[/#{token_name.to_s}_token=([^\"\\n\\r]+)/, 1]\n end",
"def read_user_emailtoken(emailtoken)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:emailtoken].to_s, emailtoken)\n return search_map_user_fields(filter, 1)[0]\n end",
"def cloudmail_token(message)\n Digest::SHA1.hexdigest(\"#{message.id}-#{id}-#{CLOUDMAIL_SEED}-#{email}\")[0..8]\n end",
"def get_email_verification_token(email)\n if isNullOrWhiteSpace(email)\n raise LoginRadius::Error.new, getValidationMessage('email')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n body_parameters = {}\n body_parameters['email'] = email\n\n resource_path = 'identity/v2/manage/account/verify/token'\n post_request(resource_path, query_parameters, body_parameters)\n end",
"def getToken(email,password)\n path = '/api/login'\n data = \"email=#{@email}&password=#{ERB::Util.url_encode(password)}\" \n payload = Base64.encode64(data)\n #puts payload \n\n response, token = agent.post(path,payload) \n\n unless response.code.to_i == 200\n raise \"Failed to fetch token for #{email}\"\n end\n token.strip.to_s\n end",
"def from_token_request(request)\n find_by email: request[:email].downcase\n end",
"def token_receipt\n AccountsMailer.token_receipt\n end",
"def confirm_email\n @token = params[:token]\n end",
"def create_token\n self.token = email.first(4).upcase + Time.now.strftime(\"%H:%M:%S\").strip().to_s.gsub(/[^\\d]/, \"\")\n end",
"def get_email(email)\n self.api_get(:email, {:email => email})\n end",
"def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end",
"def get_token\n get(TOKEN_URL)\n end",
"def generate_email_token\n self[:email_token] = SecureRandom.hex(4)\n end",
"def get_email_from_access_token(google_access_token)\n data= {\n :access_token => google_access_token,\n :fields => 'email' # specify we only want the email\n } \n r = RestClient.post GOOGLE_OAUTH_TOKEN_VALIDATION_URL, data\n json = JSON.parse(r.body)\n puts \"\\n#{json['email']}\\n\"\n json['email']\nend",
"def token(email, password)\n if @data[email]\n begin\n cached = CachedToken.new(@data[email])\n if cached.verify_password(password)\n token = cached.decrypt_token(password)\n if token\n begin\n cached.test_token(token)\n token\n rescue => e\n fail_token('Token cached, verified and decrypted, but rejected by Discord', email, e)\n sleep 1 # wait some time so we don't get immediately rate limited\n nil\n end\n else; fail_token('Token cached and verified, but decryption failed', email)\n end\n else; fail_token('Token verification failed', email)\n end\n rescue => e; fail_token('Token cached but invalid', email, e)\n end\n else; fail_token('Token not cached at all')\n end\n end",
"def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end",
"def assigned_a_token\n OpportunityMailer.assigned_a_token\n end",
"def get_raw_token_identity(token,options={})\n response = els_http_request(\"/attributes\",\"subjectid=#{token}\",options)\n if response.code.eql? \"200\"\n response.body\n else\n response.error!\n end\n end",
"def email_address\n authentications.emails.active.first.uid rescue nil\n end",
"def generate_token\n self.token = Digest::MD5.hexdigest(\"PersonRecordToken#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def send_verify_email(email, user, token)\n @user = user\n @token = token\n mail( :to => email,\n :subject => 'WatchIoT verify email!!')\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def auth_token\n self.auth_response[:auth_token]\n end",
"def request_token\n self.token = Pivotal::Client.fetch_token(email, password)\n end",
"def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end",
"def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end",
"def auth_token(auth)\n validate_auth(auth, %i[token])\n auth[:token]\n end",
"def get_token_from_auth_data(auth_data)\n auth_data.split(\" \")[1]\nend",
"def google_token\n \tx = self.authentications.find_by(provider: 'google_oauth2')\n \treturn x.token unless x.nil?\t\n end",
"def get_mail\n \n end",
"def get_token_from_code(auth_code)\n OUTLOOK_CLIENT.auth_code.get_token(auth_code,\n :redirect_uri => OUTLOOK_REDIRECT_URI,\n :scope => OUTLOOK_SCOPES.join(' '))\n end",
"def token\n @token\n end",
"def get_devise_auth_token\n authorization = Authorization.where(:provider => 'devise', :customer_id => id.to_s).first\n\n unless authorization.blank?\n authorization.token\n end\n end",
"def get_user_email\n useremail[:value]\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def get_token\n response = HTTParty.post(\n GIT_BASE_URL + 'session',\n :body => {\n :email => self.mail_address,\n :password => 'pass4git'\n }\n\n )\n Rails.logger.info \"Git server response (get token): #{response}\"\n self.git_token = response['private_token']\n end",
"def token\n @data[:token]\n end",
"def retrieve_subject_token!\n content, resource_name = token_data\n if @credential_source_format_type == \"text\"\n token = content\n else\n begin\n response_data = MultiJson.load content, symbolize_keys: true\n token = response_data[@credential_source_field_name.to_sym]\n rescue StandardError\n raise \"Unable to parse subject_token from JSON resource #{resource_name} \" \\\n \"using key #{@credential_source_field_name}\"\n end\n end\n raise \"Missing subject_token in the credential_source file/response.\" unless token\n token\n end",
"def get_for_email(email)\n full_path = full_resource_path(\"/email\")\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def auth_token\n @@auth_token\n end",
"def fetch_token_details\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_tm_gtdbs')\n\n # as the above method would return error if token was not found.\n # it is a valid scenario here, this ignoring error\n @token = token_resp.data\n\n success\n\n end",
"def grab_auth_token\n return @authToken if @authToken\n home_page = get_page(HOME_URL)\n @authToken = home_page.forms.first['authenticity_token']\n STDERR.puts \"FOUND AUTH TOKEN #{@authToken}\" if DEBUG\n end",
"def email\n mail.first\n end",
"def email\n mail.first\n end",
"def token\n if notification_config && notification_config['host_token'] && @resource.callback # we need to have a token available for this service\n notification_config['host_token'][notification_host]\n elsif notification_config && notification_config['token']\n notification_config['token']\n else\n nil # send no token; assume no authorization needed\n end\n end",
"def login_token\n user ? email : seed\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def token\n @attributes[:token]\n end",
"def get_token\n session[:token] if authorized?\n end",
"def auth_token\n Auth.decode(header_token)\n end",
"def message\n @token.message\n end",
"def getLoginBy_email( email)\n params = Hash.new\n params['email'] = email\n return doCurl(\"get\",\"/login/by_email\",params)\n end",
"def token\n item = read\n return item['token'] if item['token']\n token_reset\n read['token']\n end",
"def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'tm_b_1')\n return error_with_go_to(\n token_resp.internal_id,\n token_resp.general_error_identifier,\n GlobalConstant::GoTo.token_setup\n ) unless token_resp.success?\n\n @token = token_resp.data\n\n success\n\n end",
"def invitation_token\n \tinvitation.token if invitation\n end",
"def expiring_token(token)\n @token = token\n @access_token = token.oauth_access_token\n\n mail(to: @token.user.email, from: Settings.mailer.from)\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def user_token\n google_account.id.to_s\n end",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\tend",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end",
"def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end",
"def with_reset_password_token(token); end",
"def token\n @token.present? ? @token : token_hash\n end",
"def get_email(email_id)\n request :get, \"/v3/emails/#{email_id}.json\"\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def created_token(token)\n @token = token\n @access_token = token.oauth_access_token\n\n mail(to: @token.user.email, from: Settings.mailer.from)\n end",
"def get_activate_email\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def get_MIT_people_email()\n \tkerberos = self.email.split('@')[0]\n \tinfo = RestClient.get 'http://web.mit.edu/bin/cgicso?', {:params => {:options => \"general\", :query => kerberos, :output =>'json'}}\n \treturn info.downcase\n\tend",
"def token\n Rails.cache.read(AUTH_TOKEN_CACHE_KEY) || retrieve_token!\n end",
"def get_request_token\n @consumer.get_request_token\n end",
"def email_credential\n user.credentials.where(name: email).first\n end",
"def password_change_token _email, _token\n @token = _token\n mail(to: _email, subject: \"Please change your password\")\n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\nend",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end",
"def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end",
"def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end",
"def retrieve_token!\n body = request_token\n # Refresh our token early so that it won't expire while a request is in-flight. We expect 15m\n # expirys for tokens but are careful not to trim the expiry by too much, just in case\n expires_in = body['expires_in'].seconds\n if expires_in - AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES > 0\n expires_in -= AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES\n end\n token = \"#{body['token_type']} #{body['access_token']}\"\n Rails.cache.write(AUTH_TOKEN_CACHE_KEY, token, expires_in: expires_in)\n token\n end",
"def request_token\n @request_token\n end",
"def make_email_verification_code\n self.email_verification_code = self.class.make_token\n end",
"def personal_access_token # :yields: String\n @@token\n end",
"def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)\n if isNullOrWhiteSpace(email)\n raise LoginRadius::Error.new, getValidationMessage('email')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n unless isNullOrWhiteSpace(email_template)\n query_parameters['emailTemplate'] = email_template\n end\n unless isNullOrWhiteSpace(reset_password_url)\n query_parameters['resetPasswordUrl'] = reset_password_url\n end\n unless send_email == false\n query_parameters['sendEmail'] = send_email\n end\n\n body_parameters = {}\n body_parameters['email'] = email\n\n resource_path = 'identity/v2/manage/account/forgot/token'\n post_request(resource_path, query_parameters, body_parameters)\n end",
"def getCustomerIdByMail(mailaddress)\n key = \"id\"\n #value = mailaddress\n url_data = \"/api/customers\"\n filter = \"?filter[email]=#{mailaddress}\"\n url_request = \"#{url_data}/#{filter}\"\n #puts \"url_request: #{url_request}\"\n response_data_customer = readData(url_request)\n # looking for customerid and kind of account-registration (accountMode) because an buyer with no useraccount can not log in\n if response_data_customer['data'][0] != nil #&& response_data_customer['data'][0][\"accountMode\"] == 0\n customer_id_by_mail = response_data_customer['data'][0][key]\n else\n customer_id_by_mail = \"no customer with #{mailaddress} and password exists\"\n end\n return customer_id_by_mail\n end",
"def token\n @token\n end",
"def get_token_identity(token,options={})\n ElsIdentity.new(get_raw_token_identity(token,options))\n end",
"def email_address\n response = get 'v1/market/private/user/email.json'\n response[:email]\n end",
"def authorized_email\n session[:browserid_email]\n end",
"def token\n authenticated\n end",
"def get_user_email(access_token)\n callback = Proc.new { |r| r.headers['Authorization'] = \"Bearer #{access_token}\"}\n\n graph = MicrosoftGraph.new(base_url: 'https://graph.microsoft.com/v1.0',\n cached_metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, 'metadata_v1.0.xml'),\n &callback)\n\n me = graph.me\n email = me.user_principal_name\nend",
"def email\n find_by_type('email')\n end",
"def request_token\n consumer.get_request_token\n end"
] |
[
"0.7751956",
"0.770032",
"0.73534673",
"0.71477175",
"0.69954956",
"0.6732436",
"0.6707616",
"0.67053014",
"0.6529971",
"0.64795786",
"0.6404596",
"0.6400369",
"0.63746166",
"0.6369599",
"0.63327336",
"0.63007706",
"0.6294674",
"0.6222821",
"0.6216576",
"0.6200276",
"0.6198405",
"0.6136684",
"0.6094481",
"0.6091311",
"0.6087043",
"0.60832477",
"0.60432214",
"0.60405266",
"0.60337186",
"0.6030548",
"0.60259694",
"0.60201883",
"0.6018989",
"0.601606",
"0.6014089",
"0.6010049",
"0.60084426",
"0.6006356",
"0.6002323",
"0.59987056",
"0.5996087",
"0.5992885",
"0.5983357",
"0.5980224",
"0.5980224",
"0.5975272",
"0.5974327",
"0.5968434",
"0.5962728",
"0.59607995",
"0.5955418",
"0.59446263",
"0.59369695",
"0.5935599",
"0.59340334",
"0.5928956",
"0.592829",
"0.59275186",
"0.59248614",
"0.5920455",
"0.59113455",
"0.59113455",
"0.59113455",
"0.59113455",
"0.59113455",
"0.5905857",
"0.59030867",
"0.5898642",
"0.5897173",
"0.5897173",
"0.5894775",
"0.58920336",
"0.5891642",
"0.5891642",
"0.5891642",
"0.5891642",
"0.5875255",
"0.58738786",
"0.58685255",
"0.5867036",
"0.58546317",
"0.58493024",
"0.5839836",
"0.5834875",
"0.5834148",
"0.5830784",
"0.58237135",
"0.5816696",
"0.5816338",
"0.5814854",
"0.58044004",
"0.5802114",
"0.58015466",
"0.5801295",
"0.57962847",
"0.57882303",
"0.57823646",
"0.5774918",
"0.57728255",
"0.5768768"
] |
0.82676584
|
0
|
Creates a new SlimcdGateway The gateway requires that valid credentials be passed in the +options+ hash. ==== Options :client_id Assigned by the Slim CD administrator. (REQUIRED) :site_id Assigned by the Slim CD administrator. (REQUIRED) :price_id Assigned by the Slim CD administrator. (REQUIRED) :password Plaintext password for the client account. (REQUIRED) :key SDK developer key obtained from Slim CD, Inc. (REQUIRED)
|
def initialize(options = {})
requires!(options, :client_id, :site_id, :price_id, :password, :key)
@options = options
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(client_id, client_secret, options = {})\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n\n options = {\n :self_key => 'WePay',\n :hash_algo => 'sha512',\n }.merge(options)\n\n @self_key = options[:self_key].to_s\n @hash_algo = options[:hash_algo].to_s\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def initialize(options)\n @pos_id = options[:pos_id].to_i\n @pos_auth_key = options[:pos_auth_key]\n @key1 = options[:key1]\n @key2 = options[:key2]\n @gateway_url = options[:gateway_url] || 'www.platnosci.pl'\n @variant = options[:variant] || 'default'\n @encoding = options[:encoding] || 'UTF'\n @test_payment = options.fetch(:test_payment, false)\n @add_signature = options.fetch(:add_signature, true)\n\n validate_options!\n end",
"def initialize(options = {})\n @services = { }\n\n settings = Config.client_settings(options)\n\n # pick up the username from the options, the global, or assume no username\n @username = settings[:username]\n\n # do a similar thing for the api key\n @api_key = settings[:api_key]\n\n # grab token pair\n @userId = settings[:userId]\n @authToken = settings[:authToken]\n\n # and the endpoint url\n @endpoint_url = settings[:endpoint_url] || API_PUBLIC_ENDPOINT\n\n # set the user agent to the one provided, or set it to a default one\n @user_agent = settings[:user_agent] || \"softlayer_api gem/#{SoftLayer::VERSION} (Ruby #{RUBY_PLATFORM}/#{RUBY_VERSION})\"\n\n # and assign a time out if the settings offer one\n @network_timeout = settings[:timeout] if settings.has_key?(:timeout)\n\n raise \"A SoftLayer Client requires an endpoint URL\" if !@endpoint_url || @endpoint_url.empty?\n end",
"def initialize(options = {})\n requires!(options, :applogin, :conntkt) \n\n @options = {\n :pem => QuickbooksMerchantServiceGateway.pem_file\n }.update(options)\n\n raise ArgumentError, \"You need to pass in your pem file using the :pem parameter or set it globally using ActiveMerchant::Billing::QuickbooksMerchantServiceGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) or similar\" if @options[:pem].blank?\n\n # Set the gateway mode, default to test.\n Base.gateway_mode = @options[:gw_mode].to_sym ||= :test\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password, :gateway_id)\n super\n end",
"def initialize(options={})\n @debug = options[:debug]\n @wskey = options[:wskey]\n @secret = options[:secret]\n @principalDNS = options[:principalDNS]\n @principalID = options[:principalID]\n end",
"def gateway\n raise 'No Gateway secret configured' unless ENV['GATEWAY_SECRET_KEY']\n ChargeIO::Gateway.new(\n :site => ENV['GATEWAY_URI'],\n :secret_key => ENV['GATEWAY_SECRET_KEY']\n )\n end",
"def initialize options\n @client_identifier = options.delete(:client_identifier) or raise ArgumentError.new(\"No :client_identifier given\")\n @bridge_secret = options.delete(:bridge_secret) or raise ArgumentError.new(\"No :bridge_secret given\")\n\n @checkdin_landing_url = options.delete(:checkdin_landing_url) || CHECKDIN_DEFAULT_LANDING\n\n end",
"def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end",
"def initialize(options)\n @client_options = options.merge(client: self)\n end",
"def initialize options = {}\n @config = options[:config]\n @config ||= AWS.config\n @config = @config.with(options)\n @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')\n end",
"def initialize options = {}\n \n if options[:endpoint]\n options[:\"#{self.class.service_ruby_name}_endpoint\"] = \n options.delete(:endpoint)\n end\n \n options_without_config = options.dup\n @config = options_without_config.delete(:config)\n @config ||= AWS.config\n @config = @config.with(options_without_config)\n @signer = @config.signer\n @http_handler = @config.http_handler\n @stubs = {}\n \n end",
"def create_client(options = {})\n post(:clients, clients: [options]).pop\n end",
"def create_client(client, options={})\n if !client || !client.is_a?(Invoicexpress::Models::Client)\n raise ArgumentError, \"Need a Invoicexpress::Models::Client instance\"\n end\n\n if !client.name\n raise ArgumentError, \"Client's name is required\"\n end\n\n params = { :body => client, :klass => Invoicexpress::Models::Client }\n post(\"clients.xml\", params.merge(options))\n end",
"def create(global_options, options)\n status, body = client_create(global_options, options)\n\n if status == 201\n save_message('Client': ['created!'])\n true\n else\n save_message(body)\n false\n end\n end",
"def initialize( aws_access_key_id, aws_secret_access_key, options = {} )\n @aws_access_key_id, @aws_secret_access_key = aws_access_key_id, aws_secret_access_key\n opts = DEFAULT_SQS_OPTIONS.merge(options)\n @endpoint = opts[:endpoint]\n end",
"def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end",
"def initialize(options = {})\n [:username, :password, :rpc_key, :auth_key].each do |credential|\n raise \"#{credential} is required\" if option[crendential].nil?\n instance_variable_set credential, options[crendential]\n end\n @server = XMLRPC::Client.new_from_hash(host: 'cp.secureserver.co.nz', path: '/remote_cp_server/server.asys', use_ssl: true)\n end",
"def initialize(options = {})\n requires!(options, :test, :ssl_merchant_id, :ssl_user_id, :ssl_pin)\n @options = options\n super\n end",
"def initialize(options)\n\n # Create logger and add to options (passed to other objects)\n @logger = Logger.new(STDOUT)\n options[:logger] = @logger\n\n # Create the appropriate broker\n if options[:kinesis_enabled] == true\n @logger.debug(\"#{TAG} Kinesis enabled. create KinesisClient\")\n @broker = RedTrack::KinesisClient.new(options)\n else\n @logger.debug(\"#{TAG} Kinesis disabled. create FileClient\")\n @broker = RedTrack::FileClient.new(options)\n end\n\n # Bind to the interface for checking data types\n @data_types = RedTrack::DataTypes.new(options)\n @valid_data_types = @data_types.valid_data_types\n\n aws_options = {\n :access_key_id => options[:access_key_id],\n :secret_access_key => options[:secret_access_key],\n :region => options[:region],\n :logger => @logger\n }\n AWS.config(aws_options)\n\n @options = options\n end",
"def initialize(options = {})\n opts = {\n oauth_site: 'https://user.gini.net/',\n oauth_redirect: 'http://localhost',\n api_uri: 'https://api.gini.net',\n api_version: 'v1',\n api_type: 'json',\n upload_timeout: 90,\n processing_timeout: 180,\n log: Logger.new(STDOUT),\n user_agent: \"gini-api-ruby/#{VERSION} (Faraday v#{Faraday::VERSION})\"\n }.merge(options)\n\n # Ensure mandatory keys are set\n [:client_id, :client_secret].each do |k|\n raise Gini::Api::Error.new(\"Mandatory option key is missing: #{k}\") unless opts.key?(k)\n end\n\n # Populate instance variables from merged opts\n opts.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n self.class.send(:attr_reader, k)\n end\n\n # Ensure STDOUT is flushed\n STDOUT.sync = true\n\n # Sanitize api_uri\n @api_uri.sub!(/(\\/)+$/, '')\n\n # Register parser (json+xml) based on API version\n register_parser\n\n @log.info('Gini API client initialized')\n @log.info(\"Target: #{@api_uri}\")\n end",
"def initialize(client_id, private_key, options = {})\n @client_id = client_id\n @url_signer = UrlSigner.new(private_key)\n @connect_timeout = options[:connect_timeout] || DEFAULT_CONNECT_TIMEOUT\n @read_timeout = options[:read_timeout] || DEFAULT_READ_TIMEOUT\n @retry_timeout = options[:retry_timeout] || DEFAULT_RETRY_TIMEOUT\n @http_client = Carto::Http::Client.get(HTTP_CLIENT_TAG)\n end",
"def initialize(options = {})\n raise ArgumentError, \"Options hash required.\" unless options.is_a?(Hash)\n\n @dev_id = options[:dev_id]\n @secret_key = options[:secret_key]\n end",
"def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end",
"def initialize(options)\n raise ArgumentError, 'an options Hash is required' if !options.instance_of?(Hash)\n raise ArgumentError, ':username required' if options[:username].nil?\n raise ArgumentError, ':password required' if options[:password].nil?\n \n self.class.debug_output $stdout if options[:debug]\n self.class.base_uri options[:base_uri] || SMSIFIED_ONEAPI_PUBLIC_URI\n @auth = { :username => options[:username], :password => options[:password] }\n \n @destination_address = options[:destination_address]\n @sender_address = options[:sender_address]\n end",
"def client(options)\n Service::Client.new(\n :username => options[:username],\n :password => options[:password],\n :url => options[:server],\n :user_agent => USER_AGENT\n )\n end",
"def initialize\n options ||= QuadrigaCX.configuration\n unless options.client_id && options.api_key && options.api_secret\n raise ArgumentError, \"Options required\"\n end\n\n @client_id = options.client_id\n @api_key = options.api_key\n @api_secret = options.api_secret\n end",
"def initialize(options = {})\n if options.is_a?(String)\n @options = YAML.load_file(options)\n else\n @options = options\n end\n @options.symbolize_keys!\n\n if ENV['DATABASE_COM_URL']\n url = URI.parse(ENV['DATABASE_COM_URL'])\n url_options = Hash[url.query.split(\"&\").map{|q| q.split(\"=\")}].symbolize_keys!\n self.host = url.host\n self.client_id = url_options[:oauth_key]\n self.client_secret = url_options[:oauth_secret]\n self.username = url_options[:user]\n self.password = url_options[:password]\n else\n self.client_id = ENV['DATABASEDOTCOM_CLIENT_ID'] || @options[:client_id]\n self.client_secret = ENV['DATABASEDOTCOM_CLIENT_SECRET'] || @options[:client_secret]\n self.host = ENV['DATABASEDOTCOM_HOST'] || @options[:host] || \"login.salesforce.com\"\n end\n self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]\n self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]\n self.version = self.version.to_s if self.version\n self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || @options[:sobject_module]\n end",
"def initialize(options={})\n options = Desk.options.merge(options)\n\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def create(options)\n new(options).create\n end",
"def initialize(options = {})\n\n @conn = Faraday.new do |f|\n f.use Middleware, self\n f.response :logger\n f.request :multipart\n f.request :url_encoded\n f.adapter Faraday.default_adapter\n end\n @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)\n [:username, :password, :client_id, :client_secret, :auth_code, :access_token, :refresh_token, :ttl, :rest_url, :rest_token, :auth_host, :rest_host].each do |opt|\n self.send \"#{opt}=\", options[opt] if options[opt]\n end\n\n end",
"def initialize(opts = {})\n @opts = opts\n @opts[:type] ||= :block\n @opts[:timeout] ||= 10\n\n sanitize_opts!\n create_client\n end",
"def client\n if !@client || @client.hash != options.hash\n @client = Croudia::Client.new\n end\n @client\n end",
"def gateway_client\n @gateway_client ||= get_gateway_client({client_id: @client_id, gateway_type: gateway_type})\n end",
"def initialize(options)\n @access_key_id = options[:access_key_id] or raise ArgumentError, \"No access key id given\"\n @secret_access_key = options[:secret_access_key] or raise ArgumentError, \"No secret access key given\"\n @use_ssl = options[:use_ssl]\n @timeout = options[:timeout]\n @debug = options[:debug]\n end",
"def initialize(options = {})\n @api_secret = options.fetch(:api_secret, ShippingEasy.api_secret)\n @method = options.fetch(:method, :get)\n @path = options.fetch(:path)\n @body = options.fetch(:body, nil)\n @params = options.fetch(:params, {})\n @api_signature = params.delete(:api_signature)\n @api_timestamp = params.fetch(:api_timestamp, nil).to_i\n @expected_signature = ShippingEasy::Signature.new(api_secret: @api_secret, method: @method, path: @path, params: @params, body: @body)\n end",
"def create_rate_limiter_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RateLimiterApi.create_rate_limiter ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling RateLimiterApi.create_rate_limiter\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling RateLimiterApi.create_rate_limiter\"\n end\n if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length > 255\n fail ArgumentError, 'invalid value for \"opts[:\"name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length > 255\n fail ArgumentError, 'invalid value for \"opts[:\"uri_dictionary_name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'uri_dictionary_name'].nil? && opts[:'uri_dictionary_name'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"uri_dictionary_name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'\n end\n\n allowable_values = [\"HEAD\", \"OPTIONS\", \"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"TRACE\"]\n if @api_client.config.client_side_validation && opts[:'http_methods'] && !opts[:'http_methods'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"http_methods\\\", must include one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'http_methods'].nil? && opts[:'http_methods'].length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"http_methods\"]\" when calling RateLimiterApi.create_rate_limiter, number of items must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] > 10000\n fail ArgumentError, 'invalid value for \"opts[:\"rps_limit\"]\" when calling RateLimiterApi.create_rate_limiter, must be smaller than or equal to 10000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'rps_limit'].nil? && opts[:'rps_limit'] < 10\n fail ArgumentError, 'invalid value for \"opts[:\"rps_limit\"]\" when calling RateLimiterApi.create_rate_limiter, must be greater than or equal to 10.'\n end\n\n allowable_values = [1, 10, 60]\n if @api_client.config.client_side_validation && opts[:'window_size'] && !allowable_values.include?(opts[:'window_size'])\n fail ArgumentError, \"invalid value for \\\"window_size\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'client_key'].nil? && opts[:'client_key'].length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"client_key\"]\" when calling RateLimiterApi.create_rate_limiter, number of items must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] > 60\n fail ArgumentError, 'invalid value for \"opts[:\"penalty_box_duration\"]\" when calling RateLimiterApi.create_rate_limiter, must be smaller than or equal to 60.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'penalty_box_duration'].nil? && opts[:'penalty_box_duration'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"penalty_box_duration\"]\" when calling RateLimiterApi.create_rate_limiter, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"response\", \"response_object\", \"log_only\"]\n if @api_client.config.client_side_validation && opts[:'action'] && !allowable_values.include?(opts[:'action'])\n fail ArgumentError, \"invalid value for \\\"action\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'action'].nil? && opts[:'action'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"action\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length > 255\n fail ArgumentError, 'invalid value for \"opts[:\"response_object_name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be smaller than or equal to 255.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'response_object_name'].nil? && opts[:'response_object_name'].to_s.length < 1\n fail ArgumentError, 'invalid value for \"opts[:\"response_object_name\"]\" when calling RateLimiterApi.create_rate_limiter, the character length must be great than or equal to 1.'\n end\n\n allowable_values = [\"azureblob\", \"bigquery\", \"cloudfiles\", \"datadog\", \"digitalocean\", \"elasticsearch\", \"ftp\", \"gcs\", \"googleanalytics\", \"heroku\", \"honeycomb\", \"http\", \"https\", \"kafka\", \"kinesis\", \"logentries\", \"loggly\", \"logshuttle\", \"newrelic\", \"openstack\", \"papertrail\", \"pubsub\", \"s3\", \"scalyr\", \"sftp\", \"splunk\", \"stackdriver\", \"sumologic\", \"syslog\"]\n if @api_client.config.client_side_validation && opts[:'logger_type'] && !allowable_values.include?(opts[:'logger_type'])\n fail ArgumentError, \"invalid value for \\\"logger_type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/rate-limiters'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['uri_dictionary_name'] = opts[:'uri_dictionary_name'] if !opts[:'uri_dictionary_name'].nil?\n form_params['http_methods'] = @api_client.build_collection_param(opts[:'http_methods'], :csv) if !opts[:'http_methods'].nil?\n form_params['rps_limit'] = opts[:'rps_limit'] if !opts[:'rps_limit'].nil?\n form_params['window_size'] = opts[:'window_size'] if !opts[:'window_size'].nil?\n form_params['client_key'] = @api_client.build_collection_param(opts[:'client_key'], :csv) if !opts[:'client_key'].nil?\n form_params['penalty_box_duration'] = opts[:'penalty_box_duration'] if !opts[:'penalty_box_duration'].nil?\n form_params['action'] = opts[:'action'] if !opts[:'action'].nil?\n form_params['response_object_name'] = opts[:'response_object_name'] if !opts[:'response_object_name'].nil?\n form_params['logger_type'] = opts[:'logger_type'] if !opts[:'logger_type'].nil?\n form_params['feature_revision'] = opts[:'feature_revision'] if !opts[:'feature_revision'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RateLimiterResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"RateLimiterApi.create_rate_limiter\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RateLimiterApi#create_rate_limiter\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n\n @options = {\n :pem => pem_file,\n :signature => signature\n }.update(options)\n\n if @options[:pem].blank? && @options[:signature].blank?\n raise ArgumentError, \"An API Certificate or API Signature is required to make requests to PayPal\"\n end\n\n super\n end",
"def initialize(url, options = { })\n @url = url\n \n raise ArgumentError, \"Feedtosis::Client options must be in Hash form if provided\" unless options.is_a?(Hash)\n @options = options.reverse_merge(DEFAULTS)\n\n @backend = @options[:backend]\n \n unless @url.match(URI.regexp('http'))\n raise ArgumentError, \"Url #{@url} is not valid!\"\n end\n \n unless @backend.respond_to?(:[]) && @backend.respond_to?(:[]=)\n raise ArgumentError, \"Backend needs to be a key-value store\"\n end\n end",
"def initialize(options =\n {\n :client_id => DEFAULT_CLIENT_ID,\n :client_secret => DEFAULT_CLIENT_SECRET,\n :username => DEFAULT_USERNAME,\n :password => DEFAULT_PASSWORD,\n :session_storage => DEFAULT_SESSION_STORAGE\n })\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n\n @auth_client = Fabricio::Authorization::AuthorizationClient.new\n session = obtain_session\n network_client = Fabricio::Networking::NetworkClient.new(@auth_client, @session_storage)\n\n @organization_service ||= Fabricio::Service::OrganizationService.new(session, network_client)\n @app_service ||= Fabricio::Service::AppService.new(session, network_client)\n @build_service ||= Fabricio::Service::BuildService.new(session, network_client)\n end",
"def initialize(options={})\n requires!(options, :merchant_id, :api_key)\n super\n end",
"def create(identity, client, scope, redirect_uri = nil, expires = nil, instance_name = \"default-client\", instance_description = \"default client\" )\n raise ArgumentError, \"Identity must be String or Integer\" unless String === identity || Integer === identity\n scope = Utils.normalize_scope(scope) & client.scope # Only allowed scope\n expires_at = Time.now.to_i + (expires || 300)\n fields = { :_id=>Server.secure_random, :identity=>identity, :scope=>scope,\n :client_id=>client.id, :redirect_uri=>client.redirect_uri || redirect_uri,\n :created_at=>Time.now.to_i, :expires_at=>expires_at, :granted_at=>nil,\n :access_token=>nil, :revoked=>nil ,\n :instance_name => instance_name, :instance_description => instance_description }\n collection.insert fields\n Server.new_instance self, fields\n end",
"def initialize(options = {})\n options = Ipayout.options.merge(options)\n @service_param_map = Ipayout::ServiceParamMap.new\n Config::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def initialize(order, account, options = {})\n requires!(options, :amount, :locale, :secret, :access_code)\n\n # The following elements need to be removed from params to not\n # trigger an error, but can't be added to the object yet since\n # the @fields Hash has not been set up yet via super()\n locale = options.delete(:locale)\n access_code = options.delete(:access_code)\n # For generating the secure hash\n secret = options.delete(:secret)\n\n super\n\n add_field('vpc_gateway', 'ssl')\n add_field('vpc_Command', 'pay')\n add_field('vpc_Version', '1')\n add_field('vpc_VirtualPaymentClientURL', 'https://migs.mastercard.co.in/vpcpay')\n\n self.locale = locale\n self.access_code = access_code\n @secret = secret\n end",
"def initialize(options = {})\n # Mandatory params\n @client_id = @@client_id || options.fetch(:client_id)\n @client_key = @@client_key || options.fetch(:client_key)\n @tenant_id = @@tenant_id || options.fetch(:tenant_id)\n\n # Optional params\n @subscription_id = @@subscription_id || options[:subscription_id]\n @resource_group = @@resource_group || options[:resource_group]\n @api_version = @@api_version || options[:api_version] || '2015-01-01'\n @grant_type = @@grant_type || options[:grant_type] || 'client_credentials'\n\n # The content-type used for all internal http requests\n @content_type = @@content_type || 'application/json'\n\n # Call the get_token method to set this.\n @token = @@token || options[:token]\n\n # Base URL used for REST calls. Modify within method calls as needed.\n @base_url = Azure::Armrest::RESOURCE\n end",
"def initialize(options = {})\n @access_key_id = options[:access_key_id]\n @secret_access_key = options[:secret_access_key]\n @use_ssl = options[:use_ssl] || false\n @debug = options[:debug]\n @timeout = options[:timeout]\n end",
"def create(options=nil)\n valid_param?(:options, options, Hash, true)\n if not options[:brand_id]\n raise_invalid_request(\"brand_id must be provided\")\n end\n if not options[:vertical]\n raise_invalid_request(\"vertical must be provided\")\n end\n if not options[:usecase]\n raise_invalid_request(\"usecase must be provided\")\n end\n if not options[:message_flow]\n raise_invalid_request(\"message_flow must be provided\")\n end\n if not options[:help_message]\n raise_invalid_request(\"help_message must be provided\")\n end\n if not options[:optout_message]\n raise_invalid_request(\"optout_message must be provided\")\n end\n perform_create(options)\n end",
"def initialize(crowd_url, app_name, app_password, options = {})\n @crowd_url = crowd_url\n @crowd = Savon::Client.new(@crowd_url + (Client.debug? ? '?wsdl' : ''))\n if options[:verify_cert] == false\n @crowd.request.http.ssl_client_auth(:verify_mode => OpenSSL::SSL::VERIFY_NONE)\n end\n @app_name = app_name\n @app_password = app_password\n @app_token = nil\n end",
"def initialize(options)\n @options = options\n @params = {}\n @connection = build_connection\n end",
"def initialize(client_id, client_secret, opts={})\n self.options = opts.dup\n self.token_method = self.options.delete(:access_token_method) || :post\n adapter = self.options.delete(:adapter)\n ssl_opts = self.options.delete(:ssl) || {}\n connection_opts = ssl_opts ? {:ssl => ssl_opts} : {}\n self.id = client_id\n self.secret = client_secret\n self.site = self.options.delete(:site) if self.options[:site]\n self.connection = Faraday::Connection.new(site, connection_opts)\n self.json = self.options.delete(:parse_json)\n self.raise_errors = !(self.options.delete(:raise_errors) == false)\n\n if adapter && adapter != :test\n connection.build do |b|\n b.adapter(*[adapter].flatten)\n end\n end\n end",
"def initialize(client_id, client_secret, opts={})\n @id = client_id\n @secret = client_secret\n @site = opts.delete(:site)\n ssl = opts.delete(:ssl)\n @options = { :authorize_url => '/oauth/authorize',\n :access_token_url => '/oauth/access_token', \n :access_token_method => :post,\n :connection_opts => {},\n :parse_json => false,\n :raise_errors => true }.merge(opts)\n @options[:connection_opts][:ssl] = ssl if ssl\n end",
"def initialize(opts = {})\n raise InvalidOption, :shared_secret unless opts[:shared_secret]\n self.shared_secret = opts[:shared_secret]\n self.issuer = opts[:issuer]\n self.audience = opts[:audience]\n self.expiration = (opts[:expiration] or 3600)\n end",
"def configure_client(options = T.unsafe(nil)); end",
"def initialize(client, options = {})\n raise Xeroizer::InvalidClientError.new unless [OAuth, OAuth2].member?(client.class)\n @xero_url = options[:xero_url] || \"https://api.xero.com/api.xro/2.0\"\n @rate_limit_sleep = options[:rate_limit_sleep] || false\n @rate_limit_max_attempts = options[:rate_limit_max_attempts] || 5\n @nonce_used_max_attempts = options[:nonce_used_max_attempts] || 1\n @default_headers = options[:default_headers] || {}\n @before_request = options.delete(:before_request)\n @after_request = options.delete(:after_request)\n @around_request = options.delete(:around_request)\n @client = client\n @logger = options[:logger] || false\n @unitdp = options[:unitdp] || 2\n end",
"def initialize(options = {})\n requires!(options, :account, :secret)\n super\n end",
"def initialize(options={})\n @options = {:host => nil,\n :vendor => \"Dell\",\n :model => nil,\n :version => \"2c\",\n :community => \"public\"\n }\n @options.merge!(options) if options.is_a?(Hash)\n @debug = false\n end",
"def initialize options = {}\n\n options = options.dup # so we don't modify the options passed in\n\n @service_ruby_name = self.class.service_ruby_name\n\n # translate these into service specific configuration options,\n # e.g. :endpoint into :s3_endpoint\n [:endpoint, :region, :port, :signature_version].each do |opt|\n if options[opt]\n options[:\"#{service_ruby_name}_#{opt}\"] = options.delete(opt)\n end\n end\n\n @config = (options.delete(:config) || AWS.config)\n @config = @config.with(options)\n\n @region = @config.send(:\"#{service_ruby_name}_region\")\n\n @credential_provider = @config.credential_provider\n @http_handler = @config.http_handler\n @endpoint = config.send(:\"#{service_ruby_name}_endpoint\")\n @port = config.send(:\"#{service_ruby_name}_port\")\n\n # deprecated attributes\n @http_read_timeout = @config.http_read_timeout\n end",
"def initialize(site_key, api_key, options = {})\n @url_safe = !options.key?(:url_safe) || options[:url_safe]\n @crypto_key = EzCrypto::Key.with_password(site_key, api_key)\n end",
"def initialize(opts={})\n options = HelloSign.options.merge(opts)\n HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|\n self.send(\"#{key}=\", options[key])\n end\n end",
"def initialize(opts)\n if opts[:api_key].nil?\n raise ArgumentError, \"Required option missing. Please pass ':api_key'.\"\n end\n\n client(opts)\n self\n end",
"def initialize(options={})\n @endpoint = options[:endpoint]\n @account_id = options[:account_id]\n @service_key = options[:service_key]\n @configuration = options[:configuration] || \"_000000_0_00000001_1101010110001100_1_0000000000000111111102000000000010000100000000000000000000100\"\n @revision_date = options[:revision_date]\n end",
"def initialize(customer_id=nil)\n @customer_id = customer_id\n @client = OpenpayApi.new(ENV[\"OPEN_PAY_MERCHANT_ID\"], ENV[\"OPEN_PAY_PRIVATE_KEY\"])\n # resource_name is defined in child classes.\n @resource = @client.create(resource_name)\n end",
"def initialize(options = {:retry_auth => true}) \n @authuser = options[:username] || (raise Exception::MissingArgument, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise Exception::MissingArgument, \"Must supply an :api_key\")\n @auth_url = options[:auth_url] || (raise Exception::MissingArgument, \"Must supply an :auth_url\")\n @authtenant = options[:authtenant] || @authuser\n @auth_method = options[:auth_method] || \"password\"\n @service_name = options[:service_name] || nil\n @service_type = options[:service_type] || \"compute\"\n @region = options[:region] || @region = nil\n @is_debug = options[:is_debug]\n\n auth_uri=nil\n begin\n auth_uri=URI.parse(@auth_url)\n rescue Exception => e\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter: #{e.message}\"\n end\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter.\" if auth_uri.nil? or auth_uri.host.nil?\n @auth_host = auth_uri.host\n @auth_port = auth_uri.port\n @auth_scheme = auth_uri.scheme\n @auth_path = auth_uri.path\n @retry_auth = options[:retry_auth]\n @proxy_host = options[:proxy_host]\n @proxy_port = options[:proxy_port]\n @authok = false\n @http = {}\n OpenStack::Compute::Authentication.init(self)\n end",
"def initialize(client, options = {})\n @client = client\n\n @local_port = options[:local_port] || 4443\n\n server_type = ::HighLine.color(\"#{options[:server_type]} \", [:bold, :cyan]) if options[:server_type]\n @network_errors_handler = options[:error_handler] || -> (_) {\n ::Kernel.puts\n ::Kernel.puts '-' * 80\n ::Kernel.puts ::HighLine.color(\"WARNING:\", [:bold, :red]) + \" Failed to contact #{server_type}server!\"\n ::Kernel.puts \"You might need to start bastion connection with #{::HighLine.color(\"knife bastion start\", [:bold, :magenta])} to access server.\"\n ::Kernel.puts '-' * 80\n ::Kernel.puts\n ::Kernel.raise\n }\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def create_transfer(options = {})\n required_params = %i( amount currency)\n required_params_present = required_params.all? { |e| options.keys.include?(e) }\n raise \"Required Argument Error. Must include #{required_params.join(', ')}\" unless required_params_present\n mutually_exclusive_params = %i( merchant pbntag)\n mutually_exclusive_params_present = mutually_exclusive_params.any? { |e| options.keys.include?(e) }\n raise \"Required Argument Error. Must include one of #{mutually_exclusive_params.join(', ')}\" unless required_params_present\n body = {\n cmd: \"create_transfer\",\n amount: options[:amount],\n currency: options[:currency],\n }\n body[:merchant] = options[:merchant] if options[:merchant]\n body[:pbntag] = options[:pbntag] if options[:pbntag]\n body[:auto_confirm] = 1 if options[:auto_confirm]\n post body\n\n end",
"def init_client keyfile, options\n verify_keyfile! keyfile\n client_opts = client_options keyfile, options\n Signet::OAuth2::Client.new client_opts\n end",
"def create_client_of_cybozu\n cybozu = Cybozu.find(1) \n CybozuApi::Client.new(cybozu.url, cybozu.login_id, cybozu.password)\n end",
"def initialize(client_id, client_secret, options={})\n @base_uri = 'https://api.foursquare.com'\n @defaults = {:client_id => client_id, :client_secret => client_secret, :v => '20110727'}.merge(options)\n self\n end",
"def client\n @client = Zaim::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def create_image(options)\n data = JSON.generate(:createImage => options)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n image_id = response[\"Location\"].split(\"/images/\").last\n OpenStack::Compute::Image.new(@compute, image_id)\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def configure(options)\n options = self.class.default_options.merge(options)\n self.class.validate_options(options)\n\n @client_name = options[:client_name]\n @client_key = File.expand_path(options[:client_key])\n @organization = options[:organization]\n @thread_count = options[:thread_count]\n @ssh = options[:ssh]\n @validator_client = options[:validator_client]\n @validator_path = options[:validator_path]\n @encrypted_data_bag_secret_path = options[:encrypted_data_bag_secret_path]\n\n unless @client_key.present? && File.exist?(@client_key)\n raise Errors::ClientKeyFileNotFound, \"client key not found at: '#{@client_key}'\"\n end\n\n faraday_options = options.slice(:params, :headers, :request, :ssl, :proxy)\n uri_hash = Addressable::URI.parse(options[:server_url]).to_hash.slice(:scheme, :host, :port)\n\n unless uri_hash[:port]\n uri_hash[:port] = (uri_hash[:scheme] == \"https\" ? 443 : 80)\n end\n\n if org_match = options[:server_url].match(/.*\\/organizations\\/(.*)/)\n @organization ||= org_match[1]\n end\n\n unless organization.nil?\n uri_hash[:path] = \"/organizations/#{organization}\"\n end\n\n server_uri = Addressable::URI.new(uri_hash)\n\n @conn = Faraday.new(server_uri, faraday_options) do |c|\n c.request :chef_auth, client_name, client_key\n c.response :chef_response\n c.response :json\n\n c.adapter Faraday.default_adapter\n end\n end",
"def create_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.create_service ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"vcl\", \"wasm\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.create_service\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceApi#create_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def paypal_gateway\n gw_defaults = { :ppx_class => \"ActiveMerchant::Billing::PaypalExpressUkGateway\" }\n gw_opts = gw_defaults.merge(paypal_site_options @order)\n \n begin \n requires!(gw_opts, :ppx_class, :login, :password, :signature)\n rescue ArgumentError => err\n raise ArgumentError.new(<<\"EOM\" + err.message)\nProblem with configuring Paypal Express Gateway:\nYou need to ensure that hook \"paypal_site_options\" sets values for login, password, and signature.\nIt currently produces: #{paypal_site_options.inspect}\nEOM\n end \n\n gateway = gw_opts[:ppx_class].constantize.new(gw_opts)\n end",
"def initialize(options = {})\n @magento_url = options.delete(:magento_url)\n @magento_username = options.delete(:magento_username)\n @magento_api_key = options.delete(:magento_api_key)\n end",
"def initialize(service, options = {})\n if service.nil?\n raise ArgumentError, \"Service name cannot be nil\"\n end\n \n @service = service\n \n options.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n \n @auth_url ||= 'https://www.google.com/accounts/ClientLogin'\n @account_type ||= 'HOSTED_OR_GOOGLE'\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/spanner/v1/spanner_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @spanner_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Spanner::V1::Spanner::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(options = {}, &block)\n service_options = options.clone\n client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)\n @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]\n @api_version = service_options[:api_version] || Azure::Storage::File::Default::STG_VERSION\n signer = service_options[:signer] || client_config.signer || Azure::Storage::Common::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)\n signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner\n super(signer, client_config.storage_account_name, service_options, &block)\n @storage_service_host[:primary] = client.storage_file_host\n @storage_service_host[:secondary] = client.storage_file_host true\n end",
"def create\n client = Client.new(client_params)\n\n if !client.billing_plan\n render json: {error: \"you need to select a plan\"} \n else \n client.save\n render json: client, status: :created\n end\n end",
"def create_server opts\n Server.create opts.merge :account => self\n end",
"def initialize(options = {})\n options[:store_id] ||= ENV['IGLOBAL_STORE_ID']\n options[:api_key] ||= ENV['IGLOBAL_API_KEY']\n \n requires!(options, :store_id, :api_key)\n @options = options\n super\n end",
"def client_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/clients.json\",\n body: client_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def initialize(gateway, options = {})\n default = self.class.settings\n @template = options.fetch(:template) { default.template }\n @counter = options.fetch(:counter) { default.counter }\n @logger = options.fetch(:logger) { default.logger }\n @paths = options[:paths] || [options.fetch(:path) { default.path }]\n @gateway = gateway\n @registrar = self.class.registrar.new(gateway)\n end",
"def set_or_create_clients(options)\n client = options[:client]\n @key_vault_client = if options[:key_vault_client]\n options[:key_vault_client]\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n\n @metadata_client = if options[:bypass_auto_encryption]\n nil\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n end",
"def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @gateway = nil\n @enabled = false\n @public_keys = Hash.new\n \n end",
"def initialize(license_key, wsdl_url='http://ws.cdyne.com/SmsWS/SMS.asmx?wsdl')\n @license_key = license_key\n\t\t\t@soap_driver = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver\n end",
"def initialize_client\n @client = HelpScoutDocs::Client.new(@options) unless defined?(@client) && @client.hash == @options.hash\n @client\n end",
"def save\n requires :customer_gateway_id, :vpn_gateway_id, :type\n opts = {}\n opts['Options.StaticRoutesOnly'] = options['staticRoutesOnly'] unless options.nil?\n tunnel_options.each_with_index do |tunnel, idx|\n tunnel.each do |key, value|\n opts[\"Options.TunnelOptions.#{idx+1}.#{key}\"] = tunnel[key]\n end\n end\n opts.delete_if {|key, value| value.nil?}\n data = service.create_vpn_connection(customer_gateway_id, vpn_gateway_id, type, opts).body['vpnConnection']\n new_attributes = data.reject {|key,value| key == 'requestId'}\n merge_attributes(new_attributes)\n true\n end",
"def create(client, scope, redirect_uri, response_type, state, instance_name = 'default-client', instance_description = 'default client')\n scope = Utils.normalize_scope(scope) & client.scope # Only allowed scope\n fields = { :client_id=>client.id, :scope=>scope, :redirect_uri=>client.redirect_uri || redirect_uri,\n :response_type=>response_type, :state=>state,\n :grant_code=>nil, :authorized_at=>nil,\n :created_at=>Time.now.to_i, :revoked=>nil,\n :instance_name => instance_name, :instance_description => instance_description }\n fields[:_id] = collection.insert(fields)\n Server.new_instance self, fields\n end",
"def client_options\n\topts = {}\n\topts['client_id'] = 'OAuth Client ID'\n\topts['service_email'] = 'Service E-Mail'\n\topts['key'] = \"/path/toprivatekey.p12\"\n\topts['project_id'] = 'Project ID'\n\topts\nend",
"def initialize(options = {}, &block)\n service_options = options.clone\n client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)\n @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]\n @api_version = service_options[:api_version] || Azure::Storage::Queue::Default::STG_VERSION\n signer = service_options[:signer] || client_config.signer || Azure::Storage::Common::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)\n signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner\n super(signer, client_config.storage_account_name, service_options, &block)\n @storage_service_host[:primary] = client.storage_queue_host\n @storage_service_host[:secondary] = client.storage_queue_host true\n end",
"def payment_gateway(**options)\n return if payment_gateway_type.blank?\n\n PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {})\n end",
"def initialize(guid = nil, options = {})\n self.errors = []\n self.guid = guid\n self.proxy = options[:proxy]\n\n # savon client options\n self.client_options = { wsdl: SOAP_API_WSDL_URL }\n client_options[:proxy] = proxy if proxy\n end",
"def create(project_id, options)\n @_client.post(resource_root(project_id), options)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/apigateway/v1/apigateway_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @api_gateway_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end"
] |
[
"0.6130195",
"0.5729571",
"0.5636998",
"0.5613266",
"0.55797356",
"0.5565636",
"0.5554126",
"0.5524659",
"0.55031383",
"0.54439574",
"0.5438366",
"0.54274815",
"0.53963387",
"0.53900474",
"0.53895235",
"0.53841865",
"0.53803444",
"0.53724813",
"0.5343282",
"0.5324289",
"0.5322335",
"0.5309685",
"0.52882224",
"0.52858126",
"0.5276895",
"0.52738315",
"0.52738315",
"0.52717656",
"0.52656573",
"0.52582455",
"0.5241194",
"0.5235831",
"0.5231951",
"0.5206658",
"0.5205257",
"0.5188785",
"0.5178415",
"0.51717216",
"0.516941",
"0.51634955",
"0.51519203",
"0.5143525",
"0.5132817",
"0.51017314",
"0.5095621",
"0.5095332",
"0.50945663",
"0.50943655",
"0.5074069",
"0.50673497",
"0.5052348",
"0.50506276",
"0.50467056",
"0.5043168",
"0.50409085",
"0.50397116",
"0.50362396",
"0.50271237",
"0.5016996",
"0.5016712",
"0.5006865",
"0.500412",
"0.5001369",
"0.4997032",
"0.49933967",
"0.49895558",
"0.49859756",
"0.49833643",
"0.49817696",
"0.49804935",
"0.49781132",
"0.49757743",
"0.49570706",
"0.49472618",
"0.49472618",
"0.49472618",
"0.49424106",
"0.49361297",
"0.49319756",
"0.4931141",
"0.49296892",
"0.49234498",
"0.49213678",
"0.49213478",
"0.49194345",
"0.49151853",
"0.49134323",
"0.4911383",
"0.49093318",
"0.49089307",
"0.49076572",
"0.49053907",
"0.4903718",
"0.489712",
"0.48958275",
"0.4889253",
"0.4882352",
"0.48798645",
"0.4875734",
"0.48738378"
] |
0.6456997
|
0
|
Performs an authorization, which reserves the funds on the customer's credit card, but does not charge the card. ==== Parameters money The amount to be authorized. Either an Integer value in cents or a Money object. creditcard The CreditCard details for the transaction. options A hash of optional parameters.
|
def authorize(money, creditcard, options = {})
post = {}
add_invoice(post, options)
add_creditcard(post, creditcard)
add_address(post, creditcard, options)
add_customer_data(post, options)
add_duplicate_window(post)
commit('AUTH', money, post)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end",
"def authorize(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('AUTH', money, parameters)\n end",
"def authorize(money, creditcard, options={})\n post = {} # { amount: money }.merge(options)\n\n add_order_id(post, options)\n add_creditcard(post, creditcard, options)\n add_amount(post, money, options)\n add_currency(post, options)\n add_customer_data(post, options)\n add_test(post)\n commit(:authorize, post)\n end",
"def authorize(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformAuthOnly(request, response)\r\n return create_response(response)\r\n end",
"def authorize(money, creditcard, options = {})\n raise ActiveMerchantError if creditcard.is_a? ActiveMerchant::Billing::Check\n auth_or_purchase('AUTH_ONLY', money, creditcard, options)\n end",
"def authorize(money, creditcard, options = {})\n form = {}\n add_salestax(form, options)\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:authorize, money, form)\n end",
"def authorize(money, credit_card, options = {})\n post = {}\n add_amount(post, money)\n add_invoice(post, options)\n add_payment_source(post, credit_card, options)\n unless credit_card.is_a?(String) && !options[:store]\n add_address(post, credit_card, options)\n add_customer_data(post, options)\n end\n \n commit(:authorization, money, post)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_customer_data(post, options)\n add_amount(post, money, options)\n\n commit('PreAuth', post, options)\n end",
"def authorize(money, credit_card, options={})\n execute_new_order(:authorize, money, credit_card, options)\n end",
"def authorize(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(PRE_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def authorize(money, creditcard_or_billing_id, options = {})\n store_entry_exec money, creditcard_or_billing_id, (money == 0 ? :check : :auth), options\n end",
"def credit(money, creditcard_or_authorization, options = {})\n if creditcard_or_authorization.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, creditcard_or_authorization, options)\n else\n credit_new_order(money, creditcard_or_authorization, options)\n end\n end",
"def credit(money, credit_card, options = {})\n standard_response\n end",
"def purchase(money, creditcard, options = {})\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture(money, response.authorization, options)\n end",
"def credit(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformCredit(request, response)\r\n return create_response(response)\r\n end",
"def authorize(money, creditcard_or_credit_card_id, options = {})\n post = {}\n post[:authonly] = 1\n\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def authorize_payment(credit_card, options = {})\n\n # this is the major function that interacts with the credit card company\n options[:order_id] = number # currently just loading a date\n # options[:email] = 'developer@fitwit.com'\n # options[:billing_address] = {\n # :name => 'Cody Fauser',\n # :address1 => '1234 Shady Brook Lane',\n # :address2 => 'Apartment 1',\n # :city => 'Ottawa',\n # :state => 'ON',\n # :country => 'CA',\n # :zip => 'K3P5N5',\n # :phone => '999-999-9999'}\n\n authorization = OrderTransaction.authorize(amount, credit_card, options)\n self.save!\n self.order_transactions << authorization\n\n if authorization.success?\n self.payment_authorized!\n else\n self.transaction_declined!\n end\n\n authorization\n #end\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n response = authorize(money, creditcard, options)\n # dove è finita l'etica del programmatore?\n # dove è finito l'incapsulamento dei dati\n if response.success? && response.fraud_review?[:fraud_result] == 'C'\n response.instance_variable_set('@success', false)\n response.instance_variable_set('@message', \"CAN'T CAPTURE, CHALLENGED AUTHORIZATION\")\n end\n \n return response unless response.success?\n\n commit(build_capture_request(money, options[:order_id], credit_card_type(creditcard)))\n end",
"def credit(money, authorization, options={})\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, authorization, options)\n end",
"def authorize(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_token_request(PRE_TYPE, money, authorization_or_credit_card, options)\n #request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)\n end\n\n puts \"PAYMENT REQUEST\"\n puts request\n\n commit(request)\n end",
"def authorize(money, creditcard, options = {})\n requires!(options, :shop_transaction_id)\n requires_credit_card_name(creditcard)\n transaction_data = TransactionData.new({:money => money, :credit_card => creditcard}.merge(options))\n get_response(\"PAGAMS2S.asp\", transaction_data, options)\n end",
"def purchase(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(AUTH_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def authorize(money, creditcard, options = {})\n vindicia_transaction = authorize_transaction(money, creditcard, options)\n response = check_transaction(vindicia_transaction)\n\n # if this response is under fraud review because of our AVS/CVV checks void the transaction\n if !response.success? && response.fraud_review? && !response.authorization.blank?\n void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], options)\n if void_response.success?\n return response\n else\n return void_response\n end\n end\n\n response\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_CAPTURE', money, post)\n end",
"def credit(money, creditcard, options = {})\n if creditcard.is_a?(String)\n raise ArgumentError, \"Reference credits are not supported. Please supply the original credit card or use the #refund method.\"\n end\n\n form = {}\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:credit, money, form)\n end",
"def credit(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_credit : :ns_credit, money, post)\n end",
"def credit(money, creditcard_or_reference, options = {})\n setup_address_hash(options)\n commit(build_credit_request(money, creditcard_or_reference, options), :credit, money, options)\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n parameters = {\n :order_id => options[:order_id],\n :cust_id => options[:customer],\n :amount => amount(money),\n :pan => creditcard.number,\n :expdate => expdate(creditcard),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n } \n \n commit('purchase', parameters) \n end",
"def add_customer_credit_card(customer, credit_card, options = {})\n credit_card = credit_card.to_vaulted_billing\n\n authorization = authorize(customer, credit_card, 1.00, options)\n void = void(authorization.id, options) if authorization.success?\n\n respond_with(credit_card, authorization.response, { \n :success => authorization.success?, \n :transactions => { :void => void, :authorization => authorization }\n }) do |cc|\n cc.vault_id = authorization.response.body['PaymentAccountDataToken'].presence\n end\n end",
"def purchase(money, credit_card, options = {})\n requires!(options, :order_id)\n requires!(options, :AccessID)\n requires!(options, :AccessPass)\n order_id = format_order_id( options[:order_id] )\n\n post = {}\n post[:Method] = 1\n post[:JobCd] = 'CAPTURE'\n\n post[:AccessID] = options[:AccessID]\n post[:AccessPass] = options[:AccessPass]\n\n add_credit_card( post, credit_card )\n add_order( post, order_id )\n\n response = commit 'pay', post\n\n if successful_payment? response\n return Response.new true, 'Success', response, { test: test?, authorization: order_id }\n end\n\n Response.new false, response[:errors], response, { test: test?, authorization: order_id }\n end",
"def purchase(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('CAPTURE', money, parameters)\n end",
"def credit(amount, authorization, options={})\n adjust_and_save(amount.abs, :credit, {:authorization => authorization}.merge(options))\n end",
"def authorize(money, card, options = {})\n # Ignore params for basic_auth\n init.basic_auth\n end",
"def purchase(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n end\n\n commit(request)\n end",
"def authorize(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('RES', post)\n end",
"def authorize(amount, creditcard, options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n if response.success?\n options[:session_ticket] = response.authorization\n xml = customer_credit_card_auth_rq(amount, creditcard, options)\n commit('authonly', xml)\n end\n end",
"def purchase(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def credit(amount = nil, options = {})\n execute(:credit, {:amount => amount || self.amount}.reverse_merge(options))\n end",
"def authorize(amount, card_number, card_expiry, cvv, reference, customer_ip)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend",
"def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend",
"def credit(money, identification_or_credit_card, options = {}) \n if reference_transaction?(identification_or_credit_card)\n # Referenced credit: refund of a settled transaction\n perform_reference_credit(money, identification_or_credit_card, options)\n else # must be a credit card or card reference\n perform_non_referenced_credit(money, identification_or_credit_card, options)\n end\n end",
"def purchase(money, creditcard, options = {})\n if creditcard.expired?\n mess = \"Credit Card is expired #{creditcard.inspect}\"\n raise ArgumentError.new(mess)\n end\n if options[:zip_code].nil?\n mess = \"Require zip code in options #{options.inspect}\"\n raise ArgumentError.new(mess)\n end\n hash = {\n total: money,\n mop: creditcard.brand,\n zip_code: options[:zip_code],\n credit_card_num: creditcard.number,\n credit_card_expiry: \"#{creditcard.month}/#{creditcard.year}\"\n }\n process_credit_card_v1(hash)\n end",
"def authorize_payment(options = {})\n options = populate_options if options.size == 0\n options[:order_id] = self.order_number\n transaction do\n authorization = OrderTransaction.authorize(self.total_in_cents, \n self.credit_card, options\n )\n self.transactions << authorization\n if authorization.success?\n payment_authorized!\n else\n transaction_declined!\n end\n authorization\n end\n end",
"def authorize(amount, card, gateway_options)\n handle_response(\n perform_authorization(amount, card, gateway_options)\n )\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('SALE', money, post)\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def refund(money, authorization, options = {})\n post = {}\n add_order_id(post, order_id_from(authorization))\n add_amount(post, money, options)\n\n commit('Credit', post, options)\n end",
"def credit(money, reference_or_credit_card, options = {})\n if reference_or_credit_card.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, reference_or_credit_card)\n else\n request = build_refund_request(money, reference_or_credit_card, options)\n commit(request)\n end\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def authorize_credit_card\n main_body = {\n createTransactionRequest: {\n merchantAuthentication: merchant_authentication,\n transactionRequest: {\n transactionType: 'authOnlyTransaction',\n amount: '8.75',\n payment: {\n creditCard: {\n cardNumber: '5424000000000015',\n expirationDate: '1220',\n cardCode: '900'\n }\n }\n }\n }\n }\n\n response = self.class.post('', basic_auth: @auth, body: main_body.to_json,\n headers: { 'Content-Type' => 'application/json' })\n JSON.parse(response.body.delete(''))\n end",
"def purchase(amount, creditcard, options = {})\n response = session_ticket\n if response.success?\n options[:session_ticket] = response.authorization\n options[:order_id] ||= generate_unique_id\n xml = customer_credit_card_charge_rq(amount, creditcard, options)\n commit('purchase', xml)\n end\n \n end",
"def credit(money, identification, options = {})\n post = { :gateid => identification }\n\n commit('CREDIT', money, post)\n end",
"def authorize(options)\n response = gateway.authorize(options.fetch(:amount), options.fetch(:creditcard), options[:extra])\n transaction_id = response.success? ? response.params['transaction_id'] : nil\n [transaction_id, response]\n end",
"def purchase(money, credit_card, options={})\n execute_new_order(:purchase, money, credit_card, options)\n end",
"def credit(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.debit_request\n set_initial_request_parameters(request)\n set_amount_request_parameters(request, '-' + money.to_s, gateway_options)\n set_payment_process_parameters(request, response_code)\n set_sequence_request_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end",
"def charge!(amount, options = {})\n unless credit_card_stored?\n logger.info(\"Buyer #{self.id} was not charged: credit card missing\")\n raise Finance::Payment::CreditCardMissing\n end\n\n gateway_options = options.delete(:gateway_options) || {}\n\n transaction = payment_transactions.build(options.reverse_merge(:action => :purchase,\n :amount => amount))\n\n # add order_id\n if options[:invoice].is_a?(Invoice) && gateway_options.include?(:order_id)== false\n gateway_options[:order_id]= options[:invoice].id\n end\n\n gateway_options.reverse_merge!(payment_method_id: payment_detail.payment_method_id) if provider_payment_gateway.is_a?(ActiveMerchant::Billing::StripeGateway)\n\n logger.info(\"Processing transaction for buyer #{self.id} with code #{credit_card_auth_code}, gateway #{provider_payment_gateway} & options #{gateway_options}\")\n\n transaction.process!(credit_card_auth_code, provider_payment_gateway, gateway_options)\n end",
"def capture(money, authorization, options = {})\n requires!(options, :credit_card)\n\n form = {}\n add_salestax(form, options)\n add_approval_code(form, authorization)\n add_invoice(form, options)\n add_creditcard(form, options[:credit_card])\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:capture, money, form)\n end",
"def credit amount, description=nil, meta={}\n self.account.credit(amount, description, meta, self.uri)\n end",
"def credit(amount, payment_method, options = {})\n post = {}\n add_invoice(post, amount, options)\n add_order_number(post, options)\n add_payment_method(post, payment_method)\n add_customer_data(post, options)\n add_soft_descriptors(post, options)\n add_customer_reference(post, options)\n\n commit('refund', post)\n end",
"def purchase credit_card, order_number, options={}\n error_response \"Not yet supported\"\n end",
"def test_credit_card_authorize_and_void\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert void = @gateway.void(@amount, auth.authorization, @credit_card, @options)\n assert_success void\n assert_equal 'Approved', void.message\n end",
"def purchase(_money, _credit_card, _options = {})\n ActiveMerchant::Billing::Response.new(true, 'PayUIn Gateway: Forced success', {}, test: test?)\n end",
"def purchase(money, creditcard, options = {})\n\n body = credentials\n body[:ssl_transaction_type] = :ccsale\n body[:ssl_amount] = '%.2f' % (money / 100.0)\n\n if options[:ssl_token].present?\n body[:ssl_token] = options[:ssl_token]\n else\n body[:ssl_card_number] = creditcard.card_number\n body[:ssl_exp_date] = ('%02d' % creditcard.expiration_month.to_i)+('%02d' % (creditcard.expiration_year.to_i % 1000))\n body[:ssl_first_name] = creditcard.first_name[0..19] if creditcard.first_name.present?\n body[:ssl_last_name] = creditcard.last_name[0..19] if creditcard.last_name.present?\n\n if creditcard.cid.present?\n body[:ssl_cvv2cvc2] = creditcard.cid\n body[:ssl_cvv2cvc2_indicator] = 1\n end\n\n billing_address = options[:billing_address]\n\n if billing_address.present?\n body[:ssl_avs_zip] = billing_address[:zip]\n body[:ssl_avs_address] = billing_address[:address1]\n body[:ssl_city] = billing_address[:city]\n body[:ssl_state] = billing_address[:state]\n body[:ssl_country] = billing_address[:country]\n end\n end\n\n body_text = xmlize({:txn => body})\n\n # for logging\n safe_request = xmlize({:txn => sanitize_body(body)})\n logger.error 'REQUEST: ' + safe_request\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n \n logger.error 'RESPONSE: ' + response\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result] == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :auth_code => doc[:ssl_approval_code],\n :avs_result => doc[:ssl_avs_response],\n :cvv_result => doc[:ssl_cvv2_response],\n :request => safe_request,\n :response => doc.to_json\n )\n end",
"def authorize(amount, options={})\n adjust_and_save(amount.abs * -1, :authorize, options)\n end",
"def test_successful_purchase_and_declined_cancellation_anda\n omit\n credit_card = credit_card('6031998427187914', month: '12', year: '2024',\n verification_value: '111', first_name: 'Santiago', last_name: 'Navatta')\n\n purchase = @gateway.purchase(@amount, credit_card, @options)\n assert_success purchase\n\n assert void = @gateway.void(purchase.authorization, @cancel_options)\n assert_failure void\n end",
"def test_purchase_and_non_referenced_credit\n assert credit = @gateway.credit(100, @credit_card, @options)\n assert_success credit\n end",
"def remove_customer_credit_card(customer, credit_card)\n respond_with credit_card.to_vaulted_billing\n end",
"def credit(money, identification, options = {})\n order = retrieve_order(identification)\n return order if order.is_a?(Response)\n response = commit(build_do_refund_request(identification, order[:country_code]))\n if response.success?\n commit(build_set_refund_request(identification, order[:payment_product_id]))\n else\n response\n end\n end",
"def credit(amount, description)\n super(amount, description) # Call and pass data to the original methods of the BankAccount\n charge_fee # And also charge a fee, add another transaction\n end",
"def purchase(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n\n post = {}\n\n add_amount(post, money, options)\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_standard_parameters('pay', post, options[:unique_id])\n add_3ds(post, options)\n add_tx_source(post, options)\n\n commit(post)\n end",
"def charge_card(total)\n raise 'Tried to charge card of user without a balanced account' unless has_balanced_account?\n # Please remember, the total has to be in cents!\n balanced_customer.debit(amount: total)\n end",
"def create\n creditcard = @payment_presenter.creditcard\n creditcard.address = @payment_presenter.address\n creditcard.order = @order\n \n begin\n creditcard.authorize(@order.total)\n rescue Spree::GatewayError => ge\n flash.now[:error] = \"Authorization Error: #{ge.message}\"\n render :action => \"new\" and return \n end\n creditcard.save\n @order.next!\n redirect_to checkout_order_url(@order)\n end",
"def credit(money, identification, options = {})\n body = credentials\n body[:ssl_transaction_type] = :ccreturn\n\n body[:ssl_amount] = (money.to_money/100.0).to_s\n body[:ssl_txn_id] = identification\n\n body_text = xmlize({:txn => body})\n\n logger.error 'REQUEST: ' + body_text\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n #logger.error body_text\n #logger.error response.to_s\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result].to_s == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def purchase(money, _, options={})\n requires!(options, :collectdate, :customeraccountname, :customerbic, :customeriban, :description, :invoicenumber, :mandatedate, :mandatereference)\n buckaroo_validate(money, options)\n\n mandatereference = options[:mandatereference]\n mandatereference = \"#{@options[:sepa_mandate_prefix]}-#{mandatereference}\" if @options[:sepa_mandate_prefix]\n\n post_params = {\n brq_amount: money,\n brq_channel: \"CALLCENTER\",\n brq_culture: options[:culture] ? options[:culture] : \"EN\",\n brq_currency: options[:currency] ? options[:currency] : \"EUR\",\n brq_description: options[:description],\n brq_invoicenumber: options[:invoicenumber],\n brq_payment_method: \"simplesepadirectdebit\",\n brq_service_simplesepadirectdebit_action: \"Pay\",\n brq_service_simplesepadirectdebit_collectdate: options[:collectdate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_customeraccountname: options[:customeraccountname],\n brq_service_simplesepadirectdebit_customerbic: options[:customerbic],\n brq_service_simplesepadirectdebit_customeriban: options[:customeriban],\n brq_service_simplesepadirectdebit_mandatedate: options[:mandatedate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_mandatereference: mandatereference,\n brq_startrecurrent: true,\n brq_websitekey: @options[:websitekey]\n }.merge(options.select {|k, *| k.to_s.start_with?(\"add_\") })\n\n BuckarooBPE3Toolbox.call(\"TransactionRequest\", post_params, @options[:secretkey], true)\n end",
"def test_credit_card_authorize_and_capture_amount_low\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert capture = @gateway.capture(@amount-100, auth.authorization, @credit_card, @options)\n assert_success capture\n assert_equal 'Approved', capture.message\n end",
"def test_authorize_and_void\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.void(response.authorization)\n assert_success capture\n end",
"def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end",
"def charge_credit_card(customer, credit_card, amount, payment, summary)\n\n # Set up the gateway -- test mode is specified in the environment.rb config file\n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login => SmartFlix::Application::AUTHORIZE_NET_API_LOGIN_ID,\n :password => SmartFlix::Application::AUTHORIZE_NET_TRANSACTION_KEY)\n # Set up the credit card authorization options\n options = {\n # We store payment ID as invoice ID - XYZFIX P3 - huh - what is this!?!?!\n :order_id => payment.id, # XYZ P1 - what is this?\n :description => summary,\n :address => {},\n :currency => \"USD\",\n :billing_address => {\n :name => customer.full_name,\n :address1 => customer.billing_address.address_1,\n :city => customer.billing_address.city,\n :state => customer.billing_address.state.code,\n :country => customer.billing_address.country.name,\n :zip => customer.billing_address.postcode\n },\n }\n\n amount_to_charge = amount * 100.0\n\n response = gateway.authorize(amount_to_charge, credit_card.active_merchant_cc, options)\n\n if !response.success?\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end\n\n response = gateway.capture(amount_to_charge, response.authorization)\n\n # In development, this test fails but we want to do it in production\n if (Rails.env == 'production')\n if (!response.success?)\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end\n end\n\n return [true, nil ]\n\n rescue Exception => e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end",
"def add_creditcard(request, creditcard)\r\n\r\n cardNo = creditcard.number\r\n cardNo.strip!\r\n if ((cardNo.length == 44) || (cardNo =~ /[A-Z]/i) || (cardNo =~ /\\+/) || (cardNo =~ /\\=/))\r\n request.Set(RocketGate::GatewayRequest::CARD_HASH, creditcard.number)\r\n else\r\n request.Set(RocketGate::GatewayRequest::CARDNO, creditcard.number)\r\n request.Set(RocketGate::GatewayRequest::CVV2, creditcard.verification_value)\r\n request.Set(RocketGate::GatewayRequest::EXPIRE_MONTH, creditcard.month)\r\n request.Set(RocketGate::GatewayRequest::EXPIRE_YEAR, creditcard.year)\r\n request.Set(RocketGate::GatewayRequest::CUSTOMER_FIRSTNAME, creditcard.first_name)\r\n request.Set(RocketGate::GatewayRequest::CUSTOMER_LASTNAME, creditcard.last_name)\r\n end\r\n end",
"def test_credit_card_purchase_and_void_amount_not_specified\n assert purchase = @gateway.purchase(@amount, @credit_card, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert void = @gateway.void(nil, purchase.authorization, @credit_card, @options)\n assert_failure void\n assert_equal 'TRANSACTION AMOUNT IS REQUIRED', void.message\n end",
"def credit *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n appears_on_statement_as = args[3] || options.fetch(:appears_on_statement_as) { nil }\n \n if self.has_account?\n meta = args[2] || options.fetch(:meta) { nil }\n destination_uri = args[4] || options.fetch(:destination_uri) { self.uri }\n credit = self.account.credit(\n :amount => amount,\n :meta => meta,\n :description => description,\n :destination_uri => destination_uri,\n :appears_on_statement_as => appears_on_statement_as\n )\n else\n credit = Credit.new(\n :uri => self.credits_uri,\n :amount => amount,\n :description => description,\n :appears_on_statement_as => appears_on_statement_as\n )\n credit.save\n end\n\n credit\n end",
"def refund(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('refund', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def store(creditcard, options = {})\n requires!(options, :order_id, :billing_address)\n money = 101\n options = options.merge(:order_id => \"STORE-#{creditcard.last_digits}-#{Time.now.to_i}\")\n options = options.merge(:transaction_type => \"PREAUTH\")\n options = options.merge(:xml_transaction_wrapper => 'CardDetailsTransaction')\n options = options.merge(:soap_action => \"https://www.thepaymentgateway.net/CardDetailsTransaction\")\n\n commit(build_purchase_request(money, creditcard, options), options)\n end",
"def credit_card(options = {})\n ActiveMerchant::Billing::CreditCard.new( credit_card_hash(options) )\n end",
"def authorize(money, source, options = {})\r\n logger.debug 'SPS ACTION: authorize'\r\n return ActiveMerchant::Billing::Response.new(source.success?, \"Authorize Error\", {:message => \"\"}, {})\r\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 authorize_recurring_and_store_card_details(encrypted_card, options = {})\n @authorize_response = authorize_with_encrypted_card(encrypted_card, options)\n @authorize_response.success? && store_credit_card_details\n end",
"def capture(money, authorization, options = {})\n post = {} \n add_authorization(post, reference_from(authorization))\n add_invoice(post, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def credit(payment)\n payment_gateway = payment.payment_method\n check_environment(payment_gateway)\n\n amount = payment.credit_allowed >= payment.order.outstanding_balance.abs ? payment.order.outstanding_balance.abs : payment.credit_allowed.abs\n if payment_gateway.payment_profiles_supported?\n response = payment_gateway.credit((amount * 100).round, self, payment.response_code, minimal_gateway_options(payment, false))\n else\n options = {:card_number => payment.source.last_digits}.merge(minimal_gateway_options(payment, false))\n response = payment_gateway.credit((amount * 100).round, payment.response_code, options)\n end\n\n ## Thomas: add action here, until we update to a later version of active merchant\n response.params['action'] = \"CREDIT\" unless response.params['action']\n record_log payment, response\n\n if response.success?\n Spree::Payment.create(:order => payment.order,\n :source => payment,\n :payment_method => payment.payment_method,\n :amount => amount.abs * -1,\n :response_code => response.authorization,\n :state => 'completed')\n else\n gateway_error(response)\n end\n rescue ActiveMerchant::ConnectionError => e\n gateway_error e\n end",
"def credit(description, amount)\n\t\tadd_transaction(description, amount)\n\tend",
"def verify(credit_card, options={})\n MultiResponse.run(:use_first_response) do |r|\n r.process { authorize(100, credit_card, options) }\n r.process(:ignore_result) { void(r.authorization, options) }\n end\n end",
"def authorize cc_or_token, order_number, opts={}\n unless opts[:currency]\n return error_response('Currency is a required option')\n end\n\n unless opts[:discriminator]\n return error_response 'Discriminator is not defined, please choose one [%s]' % FORM_TYPES.join(', ')\n end\n\n unless FORM_TYPES.include?(opts[:discriminator].to_sym)\n return error_response 'Discriminator [%s] not found, please choose one [%s]' % [opts[:discriminator], FORM_TYPES.join(', ')]\n end\n\n body = {\n amount: opts[:amount] || 0.0,\n currency: opts[:currency],\n discriminator: opts[:discriminator],\n token: store(cc_or_token),\n order_number: order_number\n }\n\n authorization_form = ::Io::Flow::V0::Models::AuthorizationForm.from_json(body)\n response = flow_instance.authorizations.post @flow_organization, authorization_form\n\n Response.new true, 'Flow authorize - Success', { response: response }, { authorization: response.id }\n rescue => exception\n error_response exception\n end",
"def exec_action(money, payment, action, options={})\n raise ArgumentError, \"Money should be a positive integer in cents\" if money < 0 \n raise ArgumentError, \"Payment should be a token string or a CreditCard object\" if !payment\n requires!(options, :id)\n post = {}\n add_invoice(post, money, options)\n add_payment(post, payment)\n add_customer_data(post, options)\n add_parmx(post, options)\n\n commit(action, post)\n end",
"def capture(money, authorization, options = {})\n txn_number, order_id = authorization.split(';')\n\n parameters = {\n :txn_number => txn_number,\n :order_id => order_id,\n :comp_amount => amount(money),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n }\n\n commit('completion', parameters) \n end",
"def capture(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformTicket(request, response)\r\n return create_response(response)\r\n end",
"def capture(money, authorization, options = {})\n post = {}\n\n # remove last 4 digits of cc number as they are not required here\n post[:postonly] = authorization[0...-4]\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def authorize(billing_key, amount)\n raise MethodNotImplemented\n end"
] |
[
"0.82812846",
"0.8008966",
"0.7876404",
"0.7872116",
"0.7845436",
"0.7813927",
"0.7808644",
"0.7757511",
"0.7746927",
"0.7649464",
"0.744128",
"0.7372949",
"0.72782403",
"0.7277621",
"0.7263517",
"0.7257591",
"0.72059345",
"0.7167714",
"0.7099423",
"0.70803833",
"0.7073006",
"0.7058599",
"0.7025224",
"0.6949891",
"0.690342",
"0.6835204",
"0.6759932",
"0.6712395",
"0.6708058",
"0.66997933",
"0.66826946",
"0.66634834",
"0.6638463",
"0.656793",
"0.65509796",
"0.6541134",
"0.6517369",
"0.6516057",
"0.6507087",
"0.64538974",
"0.6446627",
"0.64187664",
"0.6418084",
"0.63849825",
"0.63847584",
"0.6377138",
"0.6377138",
"0.63657886",
"0.63284874",
"0.6326349",
"0.6326349",
"0.6287055",
"0.62533796",
"0.6228747",
"0.6190646",
"0.61610335",
"0.61588967",
"0.6147612",
"0.613717",
"0.607481",
"0.60629547",
"0.60562986",
"0.60291564",
"0.60103625",
"0.6003977",
"0.60039663",
"0.5997154",
"0.59834105",
"0.59773684",
"0.5967033",
"0.5911767",
"0.5906155",
"0.5902975",
"0.586208",
"0.5857867",
"0.5853178",
"0.58487314",
"0.5834254",
"0.58293647",
"0.5802783",
"0.57935315",
"0.5781558",
"0.57667977",
"0.5766773",
"0.57596946",
"0.5750568",
"0.57500136",
"0.5729714",
"0.5705577",
"0.57049453",
"0.5703197",
"0.5696047",
"0.56954134",
"0.56797683",
"0.5675342",
"0.5674256",
"0.56657237",
"0.566233",
"0.56326854",
"0.562637"
] |
0.79264265
|
2
|
Perform a purchase, which is essentially an authorization and capture in a single operation. ==== Parameters money The amount to be purchased. Either an Integer value in cents or a Money object. creditcard The CreditCard details for the transaction. options A hash of optional parameters.
|
def purchase(money, creditcard, options = {})
post = {}
add_invoice(post, options)
add_creditcard(post, creditcard)
add_address(post, creditcard, options)
add_customer_data(post, options)
add_duplicate_window(post)
commit('SALE', money, post)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def purchase(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(AUTH_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def purchase(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('CAPTURE', money, parameters)\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n parameters = {\n :order_id => options[:order_id],\n :cust_id => options[:customer],\n :amount => amount(money),\n :pan => creditcard.number,\n :expdate => expdate(creditcard),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n } \n \n commit('purchase', parameters) \n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_CAPTURE', money, post)\n end",
"def purchase(money, credit_card, options = {})\n requires!(options, :order_id)\n requires!(options, :AccessID)\n requires!(options, :AccessPass)\n order_id = format_order_id( options[:order_id] )\n\n post = {}\n post[:Method] = 1\n post[:JobCd] = 'CAPTURE'\n\n post[:AccessID] = options[:AccessID]\n post[:AccessPass] = options[:AccessPass]\n\n add_credit_card( post, credit_card )\n add_order( post, order_id )\n\n response = commit 'pay', post\n\n if successful_payment? response\n return Response.new true, 'Success', response, { test: test?, authorization: order_id }\n end\n\n Response.new false, response[:errors], response, { test: test?, authorization: order_id }\n end",
"def purchase(money, credit_card, options={})\n execute_new_order(:purchase, money, credit_card, options)\n end",
"def purchase(money, creditcard, options = {})\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture(money, response.authorization, options)\n end",
"def purchase(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n response = authorize(money, creditcard, options)\n # dove è finita l'etica del programmatore?\n # dove è finito l'incapsulamento dei dati\n if response.success? && response.fraud_review?[:fraud_result] == 'C'\n response.instance_variable_set('@success', false)\n response.instance_variable_set('@message', \"CAN'T CAPTURE, CHALLENGED AUTHORIZATION\")\n end\n \n return response unless response.success?\n\n commit(build_capture_request(money, options[:order_id], credit_card_type(creditcard)))\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n\n post = {}\n\n add_amount(post, money, options)\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_standard_parameters('pay', post, options[:unique_id])\n add_3ds(post, options)\n add_tx_source(post, options)\n\n commit(post)\n end",
"def purchase(money, creditcard, options = {})\n if creditcard.expired?\n mess = \"Credit Card is expired #{creditcard.inspect}\"\n raise ArgumentError.new(mess)\n end\n if options[:zip_code].nil?\n mess = \"Require zip code in options #{options.inspect}\"\n raise ArgumentError.new(mess)\n end\n hash = {\n total: money,\n mop: creditcard.brand,\n zip_code: options[:zip_code],\n credit_card_num: creditcard.number,\n credit_card_expiry: \"#{creditcard.month}/#{creditcard.year}\"\n }\n process_credit_card_v1(hash)\n end",
"def purchase(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def purchase(amount, creditcard, options = {})\n response = session_ticket\n if response.success?\n options[:session_ticket] = response.authorization\n options[:order_id] ||= generate_unique_id\n xml = customer_credit_card_charge_rq(amount, creditcard, options)\n commit('purchase', xml)\n end\n \n end",
"def purchase credit_card, order_number, options={}\n error_response \"Not yet supported\"\n end",
"def purchase(money, creditcard, options = {})\n\n body = credentials\n body[:ssl_transaction_type] = :ccsale\n body[:ssl_amount] = '%.2f' % (money / 100.0)\n\n if options[:ssl_token].present?\n body[:ssl_token] = options[:ssl_token]\n else\n body[:ssl_card_number] = creditcard.card_number\n body[:ssl_exp_date] = ('%02d' % creditcard.expiration_month.to_i)+('%02d' % (creditcard.expiration_year.to_i % 1000))\n body[:ssl_first_name] = creditcard.first_name[0..19] if creditcard.first_name.present?\n body[:ssl_last_name] = creditcard.last_name[0..19] if creditcard.last_name.present?\n\n if creditcard.cid.present?\n body[:ssl_cvv2cvc2] = creditcard.cid\n body[:ssl_cvv2cvc2_indicator] = 1\n end\n\n billing_address = options[:billing_address]\n\n if billing_address.present?\n body[:ssl_avs_zip] = billing_address[:zip]\n body[:ssl_avs_address] = billing_address[:address1]\n body[:ssl_city] = billing_address[:city]\n body[:ssl_state] = billing_address[:state]\n body[:ssl_country] = billing_address[:country]\n end\n end\n\n body_text = xmlize({:txn => body})\n\n # for logging\n safe_request = xmlize({:txn => sanitize_body(body)})\n logger.error 'REQUEST: ' + safe_request\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n \n logger.error 'RESPONSE: ' + response\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result] == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :auth_code => doc[:ssl_approval_code],\n :avs_result => doc[:ssl_avs_response],\n :cvv_result => doc[:ssl_cvv2_response],\n :request => safe_request,\n :response => doc.to_json\n )\n end",
"def purchase(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n end\n\n commit(request)\n end",
"def purchase(_money, _credit_card, _options = {})\n ActiveMerchant::Billing::Response.new(true, 'PayUIn Gateway: Forced success', {}, test: test?)\n end",
"def authorize(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(PRE_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def authorize(money, creditcard, options={})\n post = {} # { amount: money }.merge(options)\n\n add_order_id(post, options)\n add_creditcard(post, creditcard, options)\n add_amount(post, money, options)\n add_currency(post, options)\n add_customer_data(post, options)\n add_test(post)\n commit(:authorize, post)\n end",
"def purchase(money, card_or_transaction, options={})\n MultiResponse.run do |r|\n r.process { access_token_request }\n r.process do\n post = {}\n access_token_from(r, options)\n\n add_amount(post, money)\n add_invoice(post, options)\n add_payment(post, card_or_transaction, options)\n add_address(post, options)\n add_extra_data(post, options)\n\n if card_or_transaction.kind_of?(Integer)\n commit('/v1/transactions/sale/by_transaction', post, options)\n else\n commit('/v1/transactions/sale/keyed', post, options)\n end\n end\n end\n end",
"def authorize(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('AUTH', money, parameters)\n end",
"def purchase(money, options = {})\n post = {}\n\n add_invoice(post, money, options)\n add_payment(post, options)\n add_address(post, options)\n add_customer_data(post, options)\n\n commit(:Sale, post)\n end",
"def credit(money, credit_card, options = {})\n standard_response\n end",
"def authorize(money, creditcard, options = {})\n form = {}\n add_salestax(form, options)\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:authorize, money, form)\n end",
"def credit(money, creditcard, options = {})\n if creditcard.is_a?(String)\n raise ArgumentError, \"Reference credits are not supported. Please supply the original credit card or use the #refund method.\"\n end\n\n form = {}\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:credit, money, form)\n end",
"def authorize(money, credit_card, options = {})\n post = {}\n add_amount(post, money)\n add_invoice(post, options)\n add_payment_source(post, credit_card, options)\n unless credit_card.is_a?(String) && !options[:store]\n add_address(post, credit_card, options)\n add_customer_data(post, options)\n end\n \n commit(:authorization, money, post)\n end",
"def store(creditcard, options = {})\n requires!(options, :order_id, :billing_address)\n money = 101\n options = options.merge(:order_id => \"STORE-#{creditcard.last_digits}-#{Time.now.to_i}\")\n options = options.merge(:transaction_type => \"PREAUTH\")\n options = options.merge(:xml_transaction_wrapper => 'CardDetailsTransaction')\n options = options.merge(:soap_action => \"https://www.thepaymentgateway.net/CardDetailsTransaction\")\n\n commit(build_purchase_request(money, creditcard, options), options)\n end",
"def authorize(money, creditcard, options = {})\n raise ActiveMerchantError if creditcard.is_a? ActiveMerchant::Billing::Check\n auth_or_purchase('AUTH_ONLY', money, creditcard, options)\n end",
"def authorize(money, credit_card, options={})\n execute_new_order(:authorize, money, credit_card, options)\n end",
"def authorize(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformAuthOnly(request, response)\r\n return create_response(response)\r\n end",
"def credit(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformCredit(request, response)\r\n return create_response(response)\r\n end",
"def authorize_payment(credit_card, options = {})\n\n # this is the major function that interacts with the credit card company\n options[:order_id] = number # currently just loading a date\n # options[:email] = 'developer@fitwit.com'\n # options[:billing_address] = {\n # :name => 'Cody Fauser',\n # :address1 => '1234 Shady Brook Lane',\n # :address2 => 'Apartment 1',\n # :city => 'Ottawa',\n # :state => 'ON',\n # :country => 'CA',\n # :zip => 'K3P5N5',\n # :phone => '999-999-9999'}\n\n authorization = OrderTransaction.authorize(amount, credit_card, options)\n self.save!\n self.order_transactions << authorization\n\n if authorization.success?\n self.payment_authorized!\n else\n self.transaction_declined!\n end\n\n authorization\n #end\n end",
"def purchase(money, _, options={})\n requires!(options, :collectdate, :customeraccountname, :customerbic, :customeriban, :description, :invoicenumber, :mandatedate, :mandatereference)\n buckaroo_validate(money, options)\n\n mandatereference = options[:mandatereference]\n mandatereference = \"#{@options[:sepa_mandate_prefix]}-#{mandatereference}\" if @options[:sepa_mandate_prefix]\n\n post_params = {\n brq_amount: money,\n brq_channel: \"CALLCENTER\",\n brq_culture: options[:culture] ? options[:culture] : \"EN\",\n brq_currency: options[:currency] ? options[:currency] : \"EUR\",\n brq_description: options[:description],\n brq_invoicenumber: options[:invoicenumber],\n brq_payment_method: \"simplesepadirectdebit\",\n brq_service_simplesepadirectdebit_action: \"Pay\",\n brq_service_simplesepadirectdebit_collectdate: options[:collectdate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_customeraccountname: options[:customeraccountname],\n brq_service_simplesepadirectdebit_customerbic: options[:customerbic],\n brq_service_simplesepadirectdebit_customeriban: options[:customeriban],\n brq_service_simplesepadirectdebit_mandatedate: options[:mandatedate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_mandatereference: mandatereference,\n brq_startrecurrent: true,\n brq_websitekey: @options[:websitekey]\n }.merge(options.select {|k, *| k.to_s.start_with?(\"add_\") })\n\n BuckarooBPE3Toolbox.call(\"TransactionRequest\", post_params, @options[:secretkey], true)\n end",
"def credit(money, creditcard_or_reference, options = {})\n setup_address_hash(options)\n commit(build_credit_request(money, creditcard_or_reference, options), :credit, money, options)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('AUTH', money, post)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_customer_data(post, options)\n add_amount(post, money, options)\n\n commit('PreAuth', post, options)\n end",
"def charge!(amount, options = {})\n unless credit_card_stored?\n logger.info(\"Buyer #{self.id} was not charged: credit card missing\")\n raise Finance::Payment::CreditCardMissing\n end\n\n gateway_options = options.delete(:gateway_options) || {}\n\n transaction = payment_transactions.build(options.reverse_merge(:action => :purchase,\n :amount => amount))\n\n # add order_id\n if options[:invoice].is_a?(Invoice) && gateway_options.include?(:order_id)== false\n gateway_options[:order_id]= options[:invoice].id\n end\n\n gateway_options.reverse_merge!(payment_method_id: payment_detail.payment_method_id) if provider_payment_gateway.is_a?(ActiveMerchant::Billing::StripeGateway)\n\n logger.info(\"Processing transaction for buyer #{self.id} with code #{credit_card_auth_code}, gateway #{provider_payment_gateway} & options #{gateway_options}\")\n\n transaction.process!(credit_card_auth_code, provider_payment_gateway, gateway_options)\n end",
"def credit(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_credit : :ns_credit, money, post)\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def purchase(amount, payfort_token, options = {})\n request_params = {}\n request_params[:amount] = amount\n request_params[:eci] = options[:eci]\n request_params[:card_security_code] = options[:card_security_code]\n request_params[:command] = 'PURCHASE'\n request_params[:currency] = options[:currency] || default_currency\n request_params[:customer_email] = options[:email]\n request_params[:customer_name] = options[:name]\n request_params[:customer_ip] = options[:ip]\n request_params[:language] = 'en'\n request_params[:merchant_reference] = options[:id]\n request_params[:order_description] = options[:description]\n request_params[:payment_option] = options[:payment_option]\n request_params[:phone_number] = options[:phone_number]\n request_params[:remember_me] = options[:remember_me]\n request_params[:settlement_reference] = options[:settlement_reference]\n request_params[:signature] = ''\n request_params[:token_name] = payfort_token\n request_params[:return_url] = options[:return_url]\n commit(request_params.compact)\n end",
"def authorize(money, creditcard_or_credit_card_id, options = {})\n post = {}\n post[:authonly] = 1\n\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end",
"def credit(money, creditcard_or_authorization, options = {})\n if creditcard_or_authorization.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, creditcard_or_authorization, options)\n else\n credit_new_order(money, creditcard_or_authorization, options)\n end\n end",
"def authorize(money, creditcard, options = {})\n requires!(options, :shop_transaction_id)\n requires_credit_card_name(creditcard)\n transaction_data = TransactionData.new({:money => money, :credit_card => creditcard}.merge(options))\n get_response(\"PAGAMS2S.asp\", transaction_data, options)\n end",
"def setup_purchase(money, options = {})\n requires!(options, :issuer_id, :return_url, :order_id, :currency, :description, :entrance_code)\n\n commit(build_transaction_request(money, options))\n end",
"def authorize(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_token_request(PRE_TYPE, money, authorization_or_credit_card, options)\n #request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)\n end\n\n puts \"PAYMENT REQUEST\"\n puts request\n\n commit(request)\n end",
"def purchase(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def purchase(payment_method_token, amount, options = {})\n execute(:purchase, options.merge(:payment_method_token => payment_method_token, :amount => amount))\n end",
"def credit(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.debit_request\n set_initial_request_parameters(request)\n set_amount_request_parameters(request, '-' + money.to_s, gateway_options)\n set_payment_process_parameters(request, response_code)\n set_sequence_request_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end",
"def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend",
"def purchase(money, source, options = {})\r\n logger.debug 'SPS ACTION: purchase'\r\n return ActiveMerchant::Billing::Response.new(source.success?, \"Authorize Error\", {:message => \"\"}, {})\r\n end",
"def purchase(money, e_wallet_source, payment_method_options = {})\n Spree::PAYONE::Logger.info \"Purchase process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.authorization_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, payment_method_options)\n set_e_wallet_request_parameters(request, e_wallet_source)\n set_amount_request_parameters(request, money, payment_method_options)\n set_order_request_parameters(request, payment_method_options)\n set_personal_data_request_parameters(request, payment_method_options)\n set_billing_request_parameters(request, payment_method_options)\n set_shipping_request_parameters(request, payment_method_options)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end",
"def purchase(amount, options={})\n adjust_and_save(amount.abs * -1, :purchase, options)\n end",
"def credit(money, identification_or_credit_card, options = {}) \n if reference_transaction?(identification_or_credit_card)\n # Referenced credit: refund of a settled transaction\n perform_reference_credit(money, identification_or_credit_card, options)\n else # must be a credit card or card reference\n perform_non_referenced_credit(money, identification_or_credit_card, options)\n end\n end",
"def purchase\n purchase = @gateway.purchase(amount, @card, options)\n @result[:message] = purchase.message\n purchase.success?\n end",
"def credit(amount = nil, options = {})\n execute(:credit, {:amount => amount || self.amount}.reverse_merge(options))\n end",
"def credit(money, identification, options = {})\n body = credentials\n body[:ssl_transaction_type] = :ccreturn\n\n body[:ssl_amount] = (money.to_money/100.0).to_s\n body[:ssl_txn_id] = identification\n\n body_text = xmlize({:txn => body})\n\n logger.error 'REQUEST: ' + body_text\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n #logger.error body_text\n #logger.error response.to_s\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result].to_s == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def authorize(money, creditcard_or_billing_id, options = {})\n store_entry_exec money, creditcard_or_billing_id, (money == 0 ? :check : :auth), options\n end",
"def credit_card(options = {})\n ActiveMerchant::Billing::CreditCard.new( credit_card_hash(options) )\n end",
"def authorize_payment(options = {})\n options = populate_options if options.size == 0\n options[:order_id] = self.order_number\n transaction do\n authorization = OrderTransaction.authorize(self.total_in_cents, \n self.credit_card, options\n )\n self.transactions << authorization\n if authorization.success?\n payment_authorized!\n else\n transaction_declined!\n end\n authorization\n end\n end",
"def capture(money, authorization, options = {})\n requires!(options, :credit_card)\n\n form = {}\n add_salestax(form, options)\n add_approval_code(form, authorization)\n add_invoice(form, options)\n add_creditcard(form, options[:credit_card])\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:capture, money, form)\n end",
"def purchase(money, billing_id)\n if (response = get_customer_profile(:customer_profile_id => billing_id)).success?\n create_customer_profile_transaction(:transaction => { :customer_profile_id => billing_id, :customer_payment_profile_id => response.params['profile']['payment_profiles']['customer_payment_profile_id'], :type => :auth_capture, :amount => amount(money) })\n else\n response\n end\n end",
"def credit(money, authorization, options={})\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, authorization, options)\n end",
"def add_customer_credit_card(customer, credit_card, options = {})\n credit_card = credit_card.to_vaulted_billing\n\n authorization = authorize(customer, credit_card, 1.00, options)\n void = void(authorization.id, options) if authorization.success?\n\n respond_with(credit_card, authorization.response, { \n :success => authorization.success?, \n :transactions => { :void => void, :authorization => authorization }\n }) do |cc|\n cc.vault_id = authorization.response.body['PaymentAccountDataToken'].presence\n end\n end",
"def purchase\n\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n \n #create_card_transaction(action: \"purchase\", amount: price_in_cents, response: response)\n \n #@registration.update_attribute(:purchased_at, Time.now) if response.success?\n #response.success?\n end",
"def purchase\n response = GATEWAY.purchase(self.price * 100, credit_card)\n transactions.create!(:price => self.price, :response => response)\n self.transaction_number = response.subscription_id if response.respond_to? :subscription_id\n self.status = response.success?\n create_transaction if self.status\n self.save\n end",
"def credit(money, reference_or_credit_card, options = {})\n if reference_or_credit_card.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, reference_or_credit_card)\n else\n request = build_refund_request(money, reference_or_credit_card, options)\n commit(request)\n end\n end",
"def credit(amount, payment_method, options = {})\n post = {}\n add_invoice(post, amount, options)\n add_order_number(post, options)\n add_payment_method(post, payment_method)\n add_customer_data(post, options)\n add_soft_descriptors(post, options)\n add_customer_reference(post, options)\n\n commit('refund', post)\n end",
"def authorize(money, creditcard, options = {})\n vindicia_transaction = authorize_transaction(money, creditcard, options)\n response = check_transaction(vindicia_transaction)\n\n # if this response is under fraud review because of our AVS/CVV checks void the transaction\n if !response.success? && response.fraud_review? && !response.authorization.blank?\n void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], options)\n if void_response.success?\n return response\n else\n return void_response\n end\n end\n\n response\n end",
"def credit(amount, authorization, options={})\n adjust_and_save(amount.abs, :credit, {:authorization => authorization}.merge(options))\n end",
"def run_customer_transaction(command, amount, creditcard, gateway_options)\n return unless creditcard.gateway_customer_profile_id?\n\n token = security_token(gateway_options)\n request = customer_transaction_request(amount, creditcard, gateway_options)\n request['Command'] = command\n\n response = @client.request :run_customer_transaction do\n soap.body = { \"Token\" => token,\n \"CustNum\" => creditcard.gateway_customer_profile_id,\n \"PaymentMethodID\" => creditcard.gateway_payment_profile_id,\n \"Parameters\" => request }\n end\n billing_response response[:run_customer_transaction_response][:run_customer_transaction_return]\n end",
"def capture(money, authorization, options = {})\n post = {}\n\n # remove last 4 digits of cc number as they are not required here\n post[:postonly] = authorization[0...-4]\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def credit *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n appears_on_statement_as = args[3] || options.fetch(:appears_on_statement_as) { nil }\n \n if self.has_account?\n meta = args[2] || options.fetch(:meta) { nil }\n destination_uri = args[4] || options.fetch(:destination_uri) { self.uri }\n credit = self.account.credit(\n :amount => amount,\n :meta => meta,\n :description => description,\n :destination_uri => destination_uri,\n :appears_on_statement_as => appears_on_statement_as\n )\n else\n credit = Credit.new(\n :uri => self.credits_uri,\n :amount => amount,\n :description => description,\n :appears_on_statement_as => appears_on_statement_as\n )\n credit.save\n end\n\n credit\n end",
"def capture(money, authorization, options = {})\n parameters = extract_authorization(authorization, {})\n\n commit('SALES', money, parameters)\n end",
"def purchase_with_card!\n puts 'purchase_with_card!'\n unless validate_card \n puts 'card invalid'\n puts 'calling err'\n err!\n puts 'state'\n puts self.state\n puts 'saving...'\n self.save!\n puts 'saved. state is'\n puts self.state\n puts 'valid?'\n puts self.valid?\n puts self.errors.full_messages\n return false \n end\n \n mode = self.account.gateway.mode\n gateway = self.account.gateway.authorize_net\n \n response = gateway.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", \n :amount => price_in_cents, \n :response => response,\n :meth => 'card',\n :origin => 'web',\n :gateway_mode => mode)\n \n puts \"RESPONSE.success?\"\n puts response.success?\n \n if response.success?\n puts \"calling FINALIZE\"\n finalize!\n puts \"STATE\"\n puts state\n else\n puts \"calling ERR!\"\n err!\n puts 'STATE:'\n puts state\n end\n \n # response.success?\n end",
"def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end",
"def credit(money, identification, options = {})\n post = { :gateid => identification }\n\n commit('CREDIT', money, post)\n end",
"def capture(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformTicket(request, response)\r\n return create_response(response)\r\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def test_successful_purchase_with_a_canadian_bank_account_full_number\n bank_account = check({ account_number: '4100', routing_number: '011000015' })\n @options[:currency] = 'CAD'\n assert response = @gateway.purchase(10000, bank_account, @options)\n assert_successful_response(response)\n end",
"def process_payment\n\n raise 'invalid credit card' unless @credit_card && @credit_card.valid?\n \n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => LOGIN_ID,\n :password => TRANSACTION_KEY\n )\n\n description = \"Concerts in the Clearing\"\n if reservation\n description += \"/Tickets, #{reservation.concert.name}\"\n end\n\n response = gateway.purchase((amount * 100).to_i, @credit_card, name_and_address.merge({:description => description}))\n return [true, response.authorization] if response.success?\n return [false, response.message]\n \n end",
"def capture(money, authorization, options = {})\n post = {} \n add_authorization(post, reference_from(authorization))\n add_invoice(post, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def purchase(amount, params = {})\n params = params.reverse_merge(\n :command => :v,\n :amount => amount,\n :currency => default_currency\n )\n lookup_currency(params)\n requires!(params, :amount, :currency, :client_ip_addr)\n commit(params)\n end",
"def credit amount, description=nil, meta={}\n self.account.credit(amount, description, meta, self.uri)\n end",
"def exec_action(money, payment, action, options={})\n raise ArgumentError, \"Money should be a positive integer in cents\" if money < 0 \n raise ArgumentError, \"Payment should be a token string or a CreditCard object\" if !payment\n requires!(options, :id)\n post = {}\n add_invoice(post, money, options)\n add_payment(post, payment)\n add_customer_data(post, options)\n add_parmx(post, options)\n\n commit(action, post)\n end",
"def store(credit_card, options = {})\n post = {}\n post[:customer_id] = options[:customer_id] || SecureRandom.hex(12)\n add_payment(post, credit_card)\n add_address(post, credit_card, options)\n response = commit(ENDPOINTS[:store], post)\n check_token_response(response, ENDPOINTS[:store], post, options)\n end",
"def credit(money, identification, options = {})\n order = retrieve_order(identification)\n return order if order.is_a?(Response)\n response = commit(build_do_refund_request(identification, order[:country_code]))\n if response.success?\n commit(build_set_refund_request(identification, order[:payment_product_id]))\n else\n response\n end\n end",
"def purchase!\n if adyen_cc_payment?\n capture!\n else\n super\n end\n end",
"def purchase!(payment: nil, provider: nil, card: nil, email: true, skip_buyer_validations: false, skip_quickbooks: false, current_user: nil)\n return true if purchased?\n\n raise('unable to purchase voided order') if voided?\n\n # Assign attributes\n assign_attributes(\n skip_buyer_validations: skip_buyer_validations,\n\n status: :purchased,\n purchased_at: (purchased_at.presence || Time.zone.now),\n purchased_by: (purchased_by.presence || current_user),\n\n payment: payment_to_h(payment.presence || 'none'),\n payment_provider: (provider.presence || 'none'),\n payment_card: (card.presence || 'none')\n )\n\n if current_user&.email.present?\n assign_attributes(email: current_user.email)\n end\n\n # Updates surcharge and total based on payment_provider\n assign_order_charges()\n\n begin\n Effective::Order.transaction do\n run_purchasable_callbacks(:before_purchase)\n\n save!\n update_purchasables_purchased_order!\n\n run_purchasable_callbacks(:after_purchase)\n end\n rescue ActiveRecord::RecordInvalid => e\n Effective::Order.transaction do\n save!(validate: false)\n update_purchasables_purchased_order!\n end\n\n raise(e)\n end\n\n send_order_receipts! if email\n after_commit { sync_quickbooks!(skip: skip_quickbooks) }\n\n true\n end",
"def authorize(amount, creditcard, options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n if response.success?\n options[:session_ticket] = response.authorization\n xml = customer_credit_card_auth_rq(amount, creditcard, options)\n commit('authonly', xml)\n end\n end",
"def capture_payment(options = {})\n options = populate_options if options.size == 0\n\n amount = if options[:amount] \n options[:amount] * 100\n else\n self.total_in_cents\n end\n\n transaction do\n capture = OrderTransaction.capture(amount, authorization_reference, options)\n self.transactions << capture\n if capture.success?\n payment_captured!\n else\n transaction_declined!\n end\n capture\n end\n end",
"def capture(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('capture', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def authorize(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('RES', post)\n end",
"def store(credit_card, address = nil, user = nil)\n\t\t\t\ta = ActiveMerchantCall.new(:login => username, :password => password, :user => user)\n a.interact('create_customer_profile', {\n\t\t :profile => {\n\t\t\t\t\t\t:merchant_customer_id => \"#{Time.now.to_i}-#{(rand()*100000).to_i}\",\n\t\t\t\t\t\t:payment_profiles => {\n\t\t\t\t\t :customer_type => 'individual',\n\t\t\t\t\t :bill_to => params_for_address(address),\n\t\t\t\t\t :payment => {\n\t\t\t\t\t\t\t :credit_card => credit_card\n\t\t\t\t\t\t\t}\n\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t })\n\t\t\t\treturn a.response\n end",
"def capture(money, authorization, options = {})\n txn_number, order_id = authorization.split(';')\n\n parameters = {\n :txn_number => txn_number,\n :order_id => order_id,\n :comp_amount => amount(money),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n }\n\n commit('completion', parameters) \n end",
"def cash(payment_object, options={})\n defaults = { :order_id => number }\n options = defaults.merge(options).symbolize_keys\n\n # before_payment\n seller.send( :before_payment, self ) if seller && seller.respond_to?( :before_payment )\n\n self.build_addresses\n self.build_invoice unless self.invoice\n\n payment = self.invoice.cash(payment_object, options)\n if payment.success?\n process_payment!\n approve_payment!\n end\n\n # after_payment\n buyer.send( :after_payment, self ) if buyer && buyer.respond_to?( :after_payment )\n payment\n end",
"def store(credit_card, options={})\n # locale can only be one of en_US, fr_CA, en_GB\n requires!(options, :locale)\n post = {}\n add_credit_card(post, credit_card, options)\n add_customer_data(post, options)\n\n commit(:post, 'customervault/v1/profiles', post)\n end",
"def purchase(_amount, source, gateway_options)\n if gateway_options[:portions].nil?\n return ActiveMerchant::Billing::Response.new(false, Spree.t('komerci.messages.invalid_portions'), {}, {})\n end\n\n if gateway_options[:portions] == 1\n transaction = '04'\n portions = '00'\n else\n transaction = Spree::KomerciConfig[:portions_type]\n portions = gateway_options[:portions]\n end\n\n params = prepare_authorize_params source, gateway_options\n params[:transacao] = transaction\n params[:parcelas] = portions\n\n response = Spree::KomerciConfig.authorize params\n\n verify_authorize_response(source, gateway_options, response, 'purchase')\n end",
"def credit(payment)\n payment_gateway = payment.payment_method\n check_environment(payment_gateway)\n\n amount = payment.credit_allowed >= payment.order.outstanding_balance.abs ? payment.order.outstanding_balance.abs : payment.credit_allowed.abs\n if payment_gateway.payment_profiles_supported?\n response = payment_gateway.credit((amount * 100).round, self, payment.response_code, minimal_gateway_options(payment, false))\n else\n options = {:card_number => payment.source.last_digits}.merge(minimal_gateway_options(payment, false))\n response = payment_gateway.credit((amount * 100).round, payment.response_code, options)\n end\n\n ## Thomas: add action here, until we update to a later version of active merchant\n response.params['action'] = \"CREDIT\" unless response.params['action']\n record_log payment, response\n\n if response.success?\n Spree::Payment.create(:order => payment.order,\n :source => payment,\n :payment_method => payment.payment_method,\n :amount => amount.abs * -1,\n :response_code => response.authorization,\n :state => 'completed')\n else\n gateway_error(response)\n end\n rescue ActiveMerchant::ConnectionError => e\n gateway_error e\n end"
] |
[
"0.8893022",
"0.8756157",
"0.86764383",
"0.8644797",
"0.85461795",
"0.85436106",
"0.84747267",
"0.8463791",
"0.83907115",
"0.8383068",
"0.83319694",
"0.8189441",
"0.8118193",
"0.79195374",
"0.7839045",
"0.7764937",
"0.77463335",
"0.7647809",
"0.7558204",
"0.75515723",
"0.7501437",
"0.73506856",
"0.7349025",
"0.7335964",
"0.7316464",
"0.73064584",
"0.73007786",
"0.7295167",
"0.7281351",
"0.7241278",
"0.72079813",
"0.7198289",
"0.7168335",
"0.70883846",
"0.7065786",
"0.70619327",
"0.7053397",
"0.70529956",
"0.7041172",
"0.7041172",
"0.69697404",
"0.6964072",
"0.6938622",
"0.69295937",
"0.68970716",
"0.68259525",
"0.67975855",
"0.6783872",
"0.67388177",
"0.6679289",
"0.6675547",
"0.6641301",
"0.6546316",
"0.6538862",
"0.65274286",
"0.65188795",
"0.6509508",
"0.6500666",
"0.64841",
"0.64609355",
"0.64475435",
"0.6432108",
"0.6397686",
"0.6389346",
"0.6351069",
"0.6347212",
"0.63043624",
"0.6271297",
"0.62709504",
"0.62628466",
"0.62327135",
"0.6217316",
"0.62134004",
"0.6200661",
"0.6196988",
"0.61947936",
"0.6192804",
"0.6175387",
"0.61675334",
"0.6132006",
"0.61281216",
"0.6108462",
"0.61070603",
"0.60995245",
"0.6088351",
"0.60882807",
"0.608386",
"0.60808384",
"0.60622877",
"0.6050505",
"0.60500854",
"0.6032547",
"0.60287493",
"0.6013218",
"0.60001284",
"0.5998123",
"0.59958446",
"0.599468",
"0.59859276",
"0.5985791"
] |
0.82954663
|
11
|
Captures the funds from an authorized transaction. ==== Parameters money The amount to be captured. Either an Integer value in cents or a Money object. authorization The authorization returned from the previous authorize request.
|
def capture(money, authorization, options = {})
post = { :gateid => authorization }
commit('FORCE', money, post)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end",
"def capture(money, authorization, options = {})\n post = {} \n add_authorization(post, reference_from(authorization))\n add_invoice(post, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def capture(money, authorization, options = {})\n txn_number, order_id = authorization.split(';')\n\n parameters = {\n :txn_number => txn_number,\n :order_id => order_id,\n :comp_amount => amount(money),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n }\n\n commit('completion', parameters) \n end",
"def capture(money, authorization, options = {})\n request = build_void_or_capture_request(FULFILL_TYPE, money, authorization, options)\n\n commit(request)\n end",
"def capture(money, authorization, options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:capture, post)\n end",
"def capture(money, authorization, options = {})\n commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))\n end",
"def capture(money, authorization, options = {})\n post = {}\n\n # remove last 4 digits of cc number as they are not required here\n post[:postonly] = authorization[0...-4]\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def capture(money, authorization, options={})\n execute_dependant(:capture, money, authorization, options)\n end",
"def capture(money, authorization, options = {})\n requires!(options, :credit_card)\n\n form = {}\n add_salestax(form, options)\n add_approval_code(form, authorization)\n add_invoice(form, options)\n add_creditcard(form, options[:credit_card])\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:capture, money, form)\n end",
"def capture(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformTicket(request, response)\r\n return create_response(response)\r\n end",
"def capture(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('capture', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def capture(money, authorization, options = {})\n options = options.merge(:transaction_type => \"COLLECTION\")\n options = options.merge(:xml_transaction_wrapper => 'CrossReferenceTransaction')\n options = options.merge(:soap_action => \"https://www.thepaymentgateway.net/CrossReferenceTransaction\")\n\n commit(build_capture_request(money, authorization, options), options)\n end",
"def capture(money, authorization, options = {})\n parameters = extract_authorization(authorization, {})\n\n commit('SALES', money, parameters)\n end",
"def capture(money, authorization, options = {})\n commit(build_mark_for_capture_xml(money, authorization, options))\n end",
"def capture(money, authorization, options = {})\n post = {}\n add_status_action(post, 'SETTLE')\n add_forced_settlement(post, options)\n add_transaction_id(post, authorization)\n commit(:change_status, money, post)\n end",
"def capture(money, authorization, options = {})\n document = Document.new(self, @options) do\n add_order_form(authorization) do\n add_transaction(:PostAuth, money)\n end\n end\n\n commit(document)\n end",
"def capture(money, authorization, options = {})\n requires!(options, :order_id) \n \n order = retrieve_order(options[:order_id])\n return order if order.is_a?(Response)\n commit(build_capture_request(money, options[:order_id], order[:payment_product_id])) \n end",
"def credit(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformCredit(request, response)\r\n return create_response(response)\r\n end",
"def refund(money, authorization, options = {})\n post = {}\n add_order_id(post, order_id_from(authorization))\n add_amount(post, money, options)\n\n commit('Credit', post, options)\n end",
"def find_captured_authorization(authorization_number)\n self.transactions.find(:first, :conditions => [\n \"authorization = ? AND action = ?\", authorization_number, 'capture'\n ])\n end",
"def purchase(money, creditcard, options = {})\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture(money, response.authorization, options)\n end",
"def authorize(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_token_request(PRE_TYPE, money, authorization_or_credit_card, options)\n #request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)\n end\n\n puts \"PAYMENT REQUEST\"\n puts request\n\n commit(request)\n end",
"def authorize(money, creditcard, options={})\n post = {} # { amount: money }.merge(options)\n\n add_order_id(post, options)\n add_creditcard(post, creditcard, options)\n add_amount(post, money, options)\n add_currency(post, options)\n add_customer_data(post, options)\n add_test(post)\n commit(:authorize, post)\n end",
"def authorize(money, creditcard, options = {})\n vindicia_transaction = authorize_transaction(money, creditcard, options)\n response = check_transaction(vindicia_transaction)\n\n # if this response is under fraud review because of our AVS/CVV checks void the transaction\n if !response.success? && response.fraud_review? && !response.authorization.blank?\n void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], options)\n if void_response.success?\n return response\n else\n return void_response\n end\n end\n\n response\n end",
"def capture(money, authorization, options = {})\n\n body = credentials\n body[:ssl_transaction_type] = :cccomplete\n body[:ssl_description] = 'Keyed Sale API'\n body[:ssl_amount] = (money.to_money/100.0).to_s if money.present?\n body[:ssl_txn_id] = authorization\n\n names = [ :ssl_merchant_id,\n :ssl_user_id,\n :ssl_pin,\n :ssl_description,\n :ssl_transaction_type,\n :ssl_txn_id ]\n\n body_text = 'xmldata=<txn>' + xmlize2(body,names) + '</txn>'\n\n # for logging\n logger.error 'REQUEST: ' + body_text\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result] == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_customer_data(post, options)\n add_amount(post, money, options)\n\n commit('PreAuth', post, options)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end",
"def authorize(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('AUTH', money, parameters)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('AUTH', money, post)\n end",
"def authorize(money, creditcard_or_billing_id, options = {})\n store_entry_exec money, creditcard_or_billing_id, (money == 0 ? :check : :auth), options\n end",
"def credit(money, authorization, options={})\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, authorization, options)\n end",
"def capture(money, authorization, options = {})\n options[:confirmation_id] = authorization\n response_message = 'XML Capture file successfully submitted.'\n begin\n xml = build_capture_xml(money, options)\n success = upload_file xml\n rescue Exception => e\n response_message = \"XML Capture failed: #{e.message}\"\n end\n #TODO: what to build for the response? what is needed?\n response = {}\n # Return the response.\n Response.new(success, response_message, response,\n :test => test?,\n # :authorization => @response['authorizationCode'],\n # :avs_code => @response['addressValidationCode'],\n # :transaction_id => @response['transactionCode']\n )\n end",
"def refund(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('refund', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def capture(_, authorization, options = {})\n transaction { transaction_api.capture_transaction(preferences[:access_token], location_id, authorization) }\n end",
"def capture(amount, authorization, options={})\n adjust_and_save(amount.abs * -1, :capture, {:authorization => authorization}.merge(options))\n end",
"def authorize(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(PRE_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end",
"def capture(amount, authorization, options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n if response.success?\n options[:session_ticket] = response.authorization\n xml = customer_credit_card_capture_rq(amount, authorization, options)\n commit('capture', xml)\n end\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n response = authorize(money, creditcard, options)\n # dove è finita l'etica del programmatore?\n # dove è finito l'incapsulamento dei dati\n if response.success? && response.fraud_review?[:fraud_result] == 'C'\n response.instance_variable_set('@success', false)\n response.instance_variable_set('@message', \"CAN'T CAPTURE, CHALLENGED AUTHORIZATION\")\n end\n \n return response unless response.success?\n\n commit(build_capture_request(money, options[:order_id], credit_card_type(creditcard)))\n end",
"def purchase(money, billing_id)\n if (response = get_customer_profile(:customer_profile_id => billing_id)).success?\n create_customer_profile_transaction(:transaction => { :customer_profile_id => billing_id, :customer_payment_profile_id => response.params['profile']['payment_profiles']['customer_payment_profile_id'], :type => :auth_capture, :amount => amount(money) })\n else\n response\n end\n end",
"def authorize(money, creditcard, options = {})\n raise ActiveMerchantError if creditcard.is_a? ActiveMerchant::Billing::Check\n auth_or_purchase('AUTH_ONLY', money, creditcard, options)\n end",
"def refund(money, authorization, options={})\n execute_dependant(:refund, money, authorization, options)\n end",
"def authorize(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformAuthOnly(request, response)\r\n return create_response(response)\r\n end",
"def authorize(money, credit_card, options={})\n execute_new_order(:authorize, money, credit_card, options)\n end",
"def credit(amount, authorization, options={})\n adjust_and_save(amount.abs, :credit, {:authorization => authorization}.merge(options))\n end",
"def refund(money, authorization ,options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:refund, post)\n end",
"def test_credit_card_authorize_and_capture_amount_low\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert capture = @gateway.capture(@amount-100, auth.authorization, @credit_card, @options)\n assert_success capture\n assert_equal 'Approved', capture.message\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_CAPTURE', money, post)\n end",
"def test_authorization_and_capture\n assert authorization = @gateway.authorize(@amount, @good_card, @options)\n assert_success authorization\n\n assert capture = @gateway.capture(@amount, authorization.authorization)\n assert_success capture\n assert capture.params['aux_msg'].include? 'has been successfully marked for settlement.'\n assert_equal 'Success', capture.message\n end",
"def test_authorize_and_capture\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.capture(amount, response.authorization)\n assert_success capture\n end",
"def find_authorization(authorization_number, with_expiry=true)\n if with_expiry\n self.transactions.find(:first, :conditions => [\n \"authorization = ? AND expires_at >= ? AND action = ? AND voided_at IS NULL AND captured_at IS NULL\",\n authorization_number, Time.now.utc, 'authorize']\n )\n else\n self.transactions.find(:first, :conditions => [\n \"authorization = ? AND action = ? AND voided_at IS NULL AND captured_at IS NULL\",\n authorization_number, 'authorize']\n )\n end\n end",
"def test_authorization_and_capture\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert capture = @gateway.capture(@amount, authorization.authorization)\n assert_success capture\n assert_match(/This transaction has been approved/, capture.message)\n end",
"def authorize(money, creditcard, options = {})\n form = {}\n add_salestax(form, options)\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:authorize, money, form)\n end",
"def authorize(money, credit_card, options = {})\n post = {}\n add_amount(post, money)\n add_invoice(post, options)\n add_payment_source(post, credit_card, options)\n unless credit_card.is_a?(String) && !options[:store]\n add_address(post, credit_card, options)\n add_customer_data(post, options)\n end\n \n commit(:authorization, money, post)\n end",
"def purchase(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n end\n\n commit(request)\n end",
"def test_authorization_and_capture\n assert authorization = @gateway.authorize(100, @good_creditcard)\n assert authorization.success?\n \n assert capture = @gateway.capture(100, authorization.authorization)\n assert capture.success?\n assert_equal 'Success', capture.message\n end",
"def authorize(money, creditcard, options = {})\n requires!(options, :shop_transaction_id)\n requires_credit_card_name(creditcard)\n transaction_data = TransactionData.new({:money => money, :credit_card => creditcard}.merge(options))\n get_response(\"PAGAMS2S.asp\", transaction_data, options)\n end",
"def capture(amount = nil)\n \n return { :error => \"This invoice doesn't seem to be authorized.\" } if !self.success\n \n ct = InvoiceTransaction.where(:parent_id => self.id, :transaction_type => InvoiceTransaction::TYPE_CAPTURE, :success => true).first \n return { :error => \"Funds for this invoice have already been captured.\" } if ct\n \n # Make sure the amount given isn't greater than the invoice total \n return { :error => \"Amount given to capture is greater than the current invoice total.\" } if amount && amount.to_f > self.invoice.total.to_f \n amount = self.invoice.total if amount.nil? \n \n resp = Caboose::StdClass.new\n sc = self.invoice.site.store_config \n case sc.pp_name\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin \n c = Stripe::Charge.retrieve(self.transaction_id) \n return { :error => \"Amount given to capture is greater than the amount authorized. amount = #{amount}, c.amount = #{c.amount}\" } if (amount*100).to_i > c.amount \n amount = (amount.to_f * 100.0).to_i\n if amount == c.amount \n c = c.capture\n else\n c = c.capture({ :amount => amount })\n end\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.invoice_id,\n :parent_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100.0, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.captured = true\n self.save \n self.invoice.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.invoice.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end\n return resp\n \n end",
"def authorize(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('RES', post)\n end",
"def authorize(money, creditcard_or_credit_card_id, options = {})\n post = {}\n post[:authonly] = 1\n\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def credit(money, identification, options = {})\n post = { :gateid => identification }\n\n commit('CREDIT', money, post)\n end",
"def credit(money, creditcard_or_authorization, options = {})\n if creditcard_or_authorization.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, creditcard_or_authorization, options)\n else\n credit_new_order(money, creditcard_or_authorization, options)\n end\n end",
"def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend",
"def build_capture_request(money, authorization, options)\n post = {}\n add_pair(post, :authorizationid, authorization)\n add_amount(post, money, options)\n add_pair(post, :completetype, (options[:complete] || \"Complete\"))\n add_pair(post, :note, options[:description]) if options[:description]\n add_pair(post, :softdescriptor, options[:soft_descriptor]) if options[:soft_descriptor]\n post\n end",
"def capture(money, identification, options = {})\n response = post(Vindicia::Transaction.capture({\n :transactions => [{ :merchantTransactionId => identification }]\n }))\n\n if response[:return][:returnCode] != '200' || response[:qtyFail].to_i > 0\n return fail(response)\n end\n\n success(response, identification)\n end",
"def test_successful_authorize_and_capture\n response = @gateway.authorize(@amount, @credit_card, @options)\n assert_success response\n\n response = @gateway.capture(@amount, response.authorization)\n assert_success response\n end",
"def capture_funds\n \n resp = StdClass.new \n it = InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\" \n elsif self.total > it.amount\n resp.error = \"The invoice total exceeds the authorized amount.\"\n elsif it.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name\n \n #when 'authorize.net'\n # transaction = AuthorizeNet::AIM::Transaction.new(sc.authnet_api_login_id, sc.authnet_api_transaction_key)\n # response = transaction.prior_auth_capture(t.transaction_id, self.total)\n # \n # ot = Caboose::InvoiceTransaction.create(\n # :invoice_id => self.id,\n # :date_processed => DateTime.now.utc,\n # :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n # :payment_processor => sc.pp_name,\n # :amount => self.total, \n # :success => response.response_code && response.response_code == '1', \n # :transaction_id => response.transaction_id,\n # :auth_code => response.authorization_code,\n # :response_code => response.response_code\n # )\n # if ot.success\n # self.date_captured = DateTime.now.utc\n # self.save \n # end \n # self.update_attribute(:financial_status, Invoice::FINANCIAL_STATUS_CAPTURED)\n # resp.success = 'Captured funds successfully'\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n it = Caboose::InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n if it.nil?\n resp.error = \"Error capturing funds for invoice #{self.id}. No previous successful authorization for this invoice exists.\"\n return false\n else \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.retrieve(it.transaction_id)\n c = c.capture\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n end\n \n end \n end \n return resp\n end",
"def purchase(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(AUTH_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def credit(money, identification, options = {})\n order = retrieve_order(identification)\n return order if order.is_a?(Response)\n response = commit(build_do_refund_request(identification, order[:country_code]))\n if response.success?\n commit(build_set_refund_request(identification, order[:payment_product_id]))\n else\n response\n end\n end",
"def authorize_and_capture\n \n resp = StdClass.new \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.create(\n :amount => (self.total * 100).to_i,\n :currency => 'usd',\n :customer => self.customer.stripe_customer_id,\n :capture => true,\n :metadata => { :invoice_id => self.id },\n :statement_descriptor => \"#{self.site.description.truncate(22)}\"\n ) \n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => c.id,\n :transaction_type => InvoiceTransaction::TYPE_AUTHCAP,\n :payment_processor => sc.pp_name,\n :amount => c.amount / 100.0,\n :captured => true,\n :date_processed => DateTime.now.utc,\n :success => c.status == 'succeeded'\n )\n if c.status == 'succeeded'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end \n end \n return resp\n end",
"def test_authorize_and_void\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.void(response.authorization)\n assert_success capture\n end",
"def refund(money, identification, options = {})\n parameters = extract_authorization(identification, {})\n\n commit('REFUND', money, parameters)\n end",
"def purchase(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('CAPTURE', money, parameters)\n end",
"def execute_dependant(action, money, authorization, options)\n request = build_request do |xml|\n add_identification_authorization(xml, authorization, options)\n add_payment(xml, action, money, options)\n end\n\n commit(request)\n end",
"def transfer ( bank, person, amount)\r\n\t\tif @bank_listing[person.id_number][:balance] >= amount\r\n\t\t\t@bank_listing[person.id_number][:balance]-=amount\r\n\t\t\tputs \"#{@bank_name}: #{person.name}, your transfer of #{amount} to #{bank.bank_name} is complete.\"\r\n\t\t\tbank.deposit(person, amount)\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry #{person.name}, insufficient funds.\"\r\n\t\tend\r\n\t\t\t\r\n\tend",
"def auth_capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_CAPTURE\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def authorize(money, card, options = {})\n # Ignore params for basic_auth\n init.basic_auth\n end",
"def authorize(amount, params = {})\n params = params.reverse_merge(\n :command => :a,\n :msg_type => 'DMS',\n :amount => amount,\n :currency => default_currency\n )\n lookup_currency(params)\n requires!(params, :amount, :currency, :client_ip_addr, :msg_type)\n commit(params)\n end",
"def test_credit_card_authorize_and_void\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert void = @gateway.void(@amount, auth.authorization, @credit_card, @options)\n assert_success void\n assert_equal 'Approved', void.message\n end",
"def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end",
"def authorize_credit_card\n main_body = {\n createTransactionRequest: {\n merchantAuthentication: merchant_authentication,\n transactionRequest: {\n transactionType: 'authOnlyTransaction',\n amount: '8.75',\n payment: {\n creditCard: {\n cardNumber: '5424000000000015',\n expirationDate: '1220',\n cardCode: '900'\n }\n }\n }\n }\n }\n\n response = self.class.post('', basic_auth: @auth, body: main_body.to_json,\n headers: { 'Content-Type' => 'application/json' })\n JSON.parse(response.body.delete(''))\n end",
"def transfer(to_account, amount)\n to_acc = Account.find_by(id: to_account)\n\n if to_acc.nil?\n self.errors.add(\"Transaction denied! Cannot get data of account.\")\n return\n end\n\n if self.balance<amount\n self.errors.add(\"Transaction denied! Insufficient ballance to cover transfer amount.\")\n return\n end\n\n Transaction.transfer(self.id, to_account, amount, \"A2A\")\n end",
"def capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_auth_code' => approval_code,\n 'x_type' => \"CAPTURE_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def void(money, authorization, options = {})\n order = build_void_request_xml(money, authorization, options) do |xml|\n add_online_reversal_ind_xml(xml, options[:online_reversal_ind]) if options[:online_reversal_ind] && @options[:api_version].to_f >= 5.2\n end\n @logger.debug(\"void request #{order.inspect}\") if @logger\n commit(order)\n end",
"def authorize(billing_key, amount)\n raise MethodNotImplemented\n end",
"def credit(money, credit_card, options = {})\n standard_response\n end",
"def capture(transaction_id, amount)\n params = {\n :transaction_amount => amount,\n :transaction_id => transaction_id,\n :operation => 'CAPTURE',\n }\n\n process_response params\n end",
"def recurring(authorization, money, options={})\n post = {\n ticketId: authorization\n }\n\n add_order_id(post, options)\n add_amount(post, money ,options)\n add_currency(post, options)\n commit(:authorizeticket, post)\n end",
"def credit(money, identification, options = {})\n body = credentials\n body[:ssl_transaction_type] = :ccreturn\n\n body[:ssl_amount] = (money.to_money/100.0).to_s\n body[:ssl_txn_id] = identification\n\n body_text = xmlize({:txn => body})\n\n logger.error 'REQUEST: ' + body_text\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n #logger.error body_text\n #logger.error response.to_s\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result].to_s == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def authorize(amount, card, gateway_options)\n handle_response(\n perform_authorization(amount, card, gateway_options)\n )\n end",
"def authorize(amount, card_number, card_expiry, cvv, reference, customer_ip)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend",
"def void amount, authorization_id, options={}\n options[:authorization_id] = authorization_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.reversals.post @flow_organization, options\n\n Response.new true, 'void success', { response: response }\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def void(authorization, options = {})\n post = {}\n order_id, amount, currency = split_authorization(authorization)\n add_order_id(post, order_id)\n post['Total'] = (options[:amount] || amount)\n post['CurrencyCode'] = currency\n\n commit('Refund', post, options)\n end",
"def charge(billing_key, amount, user = nil)\n a = ActiveMerchantCall.new(:login => username, :password => password, :user => user)\n a.interact('create_customer_profile_transaction', :transaction => {\n\t :customer_profile_id => user.customer_profile_id,\n\t :customer_payment_profile_id => billing_key,\n\t :type => :auth_capture,\n\t\t\t\t\t:validation_mode => validation_mode,\n\t :amount => (amount.cents/100.0)\n\t })\n\t\t\t\treturn FreemiumTransaction.new(:billing_key => billing_key, :amount => amount, :success => a.response.success?, :gateway_message => a.response.message)\n end",
"def capture(transaction_id, amount)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend",
"def credit(amount, current_period)\n if balance.zero?\n \"You do not have a balance.\"\n else\n @balance -= amount\n calculate_interest(current_period, @txns.keys.last)\n save_txn(current_period, 'credit', amount, @balance)\n @ints << @interest\n get_balance\n end\n end",
"def test_purchase_and_credit_for_check_with_differing_amounts\n assert purchase = @gateway.purchase(10000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.credit(500, purchase.authorization, @options)\n assert_success void\n assert_not_equal 'Approved', void.message\n end",
"def transfer_to(account, amount)\n # `account.name` is accessing the name of the account we are transfering to\n debit amount, \"Transfer to #{account.name}\"\n account.credit amount, \"Transfer from #{@name}\"\n end",
"def void_transaction!(authorization)\n response = provider_payment_gateway.void(authorization)\n log_gateway_response(response, \"void [transaction: #{authorization}]\")\n response.success?\n end",
"def withdraw ( person, amount )\r\n\t\tif @bank_listing[person.id_number][:balance] >= amount\r\n\t\t\t@bank_listing[person.id_number][:balance]-=amount\r\n\t\t\tputs \"#{@bank_name}: Thanks #{person.name}, here's your $#{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry #{person.name}, insufficient funds.\"\r\n\t\tend\r\n\tend"
] |
[
"0.7781379",
"0.742546",
"0.7403893",
"0.7383614",
"0.7358988",
"0.73279506",
"0.7236774",
"0.72200316",
"0.7190169",
"0.7178628",
"0.71686333",
"0.70894414",
"0.6960688",
"0.6744804",
"0.6726318",
"0.66828895",
"0.6623468",
"0.661429",
"0.6598622",
"0.6541584",
"0.6457358",
"0.642773",
"0.63183326",
"0.631101",
"0.6279814",
"0.62524766",
"0.61998945",
"0.6198429",
"0.6143342",
"0.61065966",
"0.6103881",
"0.6079249",
"0.6059256",
"0.6057478",
"0.60499483",
"0.60327655",
"0.6007316",
"0.60061336",
"0.59952384",
"0.59926724",
"0.5970404",
"0.596713",
"0.59584206",
"0.5958232",
"0.59036446",
"0.5903544",
"0.58881766",
"0.5875855",
"0.5868725",
"0.58348536",
"0.5794777",
"0.5786997",
"0.57821673",
"0.5769908",
"0.5761053",
"0.5747364",
"0.5746709",
"0.5649273",
"0.56452864",
"0.5639224",
"0.562606",
"0.55926937",
"0.55914456",
"0.5574051",
"0.55719095",
"0.5542902",
"0.5506877",
"0.5480138",
"0.54796416",
"0.54518145",
"0.5444239",
"0.54279107",
"0.54126936",
"0.53979975",
"0.5395833",
"0.5389257",
"0.5386296",
"0.5367151",
"0.5299556",
"0.5266921",
"0.525309",
"0.5231122",
"0.5216014",
"0.51731277",
"0.5158209",
"0.51244766",
"0.5116692",
"0.5112805",
"0.5104345",
"0.50964046",
"0.50406253",
"0.50373876",
"0.50369537",
"0.5033801",
"0.5010306",
"0.5004532",
"0.50044906",
"0.50007576",
"0.49870685",
"0.4983763"
] |
0.6933785
|
13
|
Void a previous transaction ==== Parameters authorization The authorization returned from the previous authorize request.
|
def void(authorization, options = {})
post = { :gateid => authorization }
commit('VOID', nil, post)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def void(authorization)\n post = {\n transactionId: authorization\n }\n\n commit(:cancel, post)\n end",
"def void_transaction!(authorization)\n response = provider_payment_gateway.void(authorization)\n log_gateway_response(response, \"void [transaction: #{authorization}]\")\n response.success?\n end",
"def void(authorization, options = {})\n request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)\n\n commit(request)\n end",
"def void(authorization, options = {})\n request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)\n \n commit(request)\n end",
"def void(authorization, options={})\n adjust_and_save(nil, :void, {:authorization => authorization}.merge(options))\n end",
"def void(authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformVoid(request, response)\r\n return create_response(response)\r\n end",
"def void(authorization, options = {})\n post = { trans_id: authorization }\n add_duplicate_window(post)\n commit('VOID', nil, post)\n end",
"def void(authorization, options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n if response.success?\n options[:session_ticket] = response.authorization\n xml = customer_credit_card_txn_void_or_refund_rq(authorization, options)\n commit('void', xml)\n end\n end",
"def void(authorization, options={})\n execute_dependant(:void, nil, authorization, options)\n end",
"def void(authorization, options = {})\n body = credentials\n body[:ssl_transaction_type] = :ccvoid\n\n body[:ssl_txn_id] = authorization\n\n body_text = xmlize({:txn => body})\n\n # for logging\n logger.error 'REQUEST: ' + body_text\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result].to_s == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def void(money, authorization, options = {})\n order = build_void_request_xml(money, authorization, options) do |xml|\n add_online_reversal_ind_xml(xml, options[:online_reversal_ind]) if options[:online_reversal_ind] && @options[:api_version].to_f >= 5.2\n end\n @logger.debug(\"void request #{order.inspect}\") if @logger\n commit(order)\n end",
"def void_transaction\n data = full_params.merge(\n 'x_trans_id' => transaction_id,\n 'x_type' => \"VOID\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def void(authorization, options = {})\n post = {}\n order_id, amount, currency = split_authorization(authorization)\n add_order_id(post, order_id)\n post['Total'] = (options[:amount] || amount)\n post['CurrencyCode'] = currency\n\n commit('Refund', post, options)\n end",
"def void(authorization, options = {})\n commit(:ns_void, nil, options.merge(:historykeyid => authorization[0...-4], :last4digits => authorization[-4..-1]))\n end",
"def void amount, authorization_id, options={}\n options[:authorization_id] = authorization_id\n\n if amount\n options[:amount] = assert_currency options[:currency], amount\n end\n\n response = flow_instance.reversals.post @flow_organization, options\n\n Response.new true, 'void success', { response: response }\n rescue Io::Flow::V0::HttpClient::ServerError => exception\n error_response exception\n end",
"def void_pending_authorizations\n self.transactions.authorized.pending.each do |t|\n t.account.void(t.authorization)\n end\n end",
"def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end",
"def authorize(transaction)\n raise \"implement #authorize in your class\"\n end",
"def test_authorize_and_void\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.void(response.authorization)\n assert_success capture\n end",
"def capture(_, authorization, options = {})\n transaction { transaction_api.capture_transaction(preferences[:access_token], location_id, authorization) }\n end",
"def void(response_code, _gateway_options)\n transaction = Cielo::Transaction.new\n ret = transaction.cancel!(response_code)\n\n ActiveMerchant::Billing::Response.new(true, Spree.t('cielo.messages.void_success'), {}, authorization: ret[:transacao][:tid])\n rescue\n verify_error 'void', ret\n end",
"def end_transaction\n @connection = @auth_token = @version = nil\n end",
"def void_pending_expired_authorizations\n self.transactions.authorized.pending.expired.each do |t|\n t.account.void(t.authorization)\n end\n end",
"def void\n @order = Order.find(params[:id])\n # Don't try to void an order that's missing a transaction id\n if @order.auth_transaction_id.blank? then\n flash[:notice] = \"The system doesn't have a record of the payment processor's transaction id for this order.<br/>This transaction can't be voided.\"\n redirect_to :action => 'show', :id => @order.id\n end\n # Get a transaction ready to be voided\n transaction = @order.get_void_transaction\n begin\n transaction.submit\n message = \"Order voided successfully:<br/>#{transaction.authorization}\"\n # Save transaction id for later\n #@order.auth_transaction_id = transaction.transaction_id\n # Set the order status to cancelled / voided\n @order.order_status_code_id = 8\n @order.new_notes = message\n @order.save\n # Flash the success or error message and redirect to show.\n flash[:notice] = message\n redirect_to :action => 'show', :id => @order.id\n rescue\n # Order failed - store transaction id\n #@order.auth_transaction_id = transaction.transaction_id\n # Log errors\n logger.error(\"\\n\\n[ERROR] FAILED ORDER VOID \\n\")\n logger.error(transaction.inspect)\n logger.error(\"\\n\\n\")\n # Redirect to checkout and allow them to enter info again.\n message = \"Order void failed:<br/>\"\n message << \"#{transaction.error_message}<br/>\"\n @order.new_notes = message\n @order.save\n # Flash the success or error message and redirect to show.\n flash[:notice] = message\n redirect_to :action => 'show', :id => @order.id\n end\n end",
"def test_credit_card_authorize_and_void\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert void = @gateway.void(@amount, auth.authorization, @credit_card, @options)\n assert_success void\n assert_equal 'Approved', void.message\n end",
"def capture(money, authorization, options = {})\n txn_number, order_id = authorization.split(';')\n\n parameters = {\n :txn_number => txn_number,\n :order_id => order_id,\n :comp_amount => amount(money),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n }\n\n commit('completion', parameters) \n end",
"def void(unique_id)\n request('payment/void', :void => {:unique_id => unique_id} )\n end",
"def void(identification, options = {})\n post = {}\n add_authorization(post, reference_from(identification))\n commit('DES', post)\n end",
"def auth_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def authorize\n transaction = GatewayTransaction.gateway.authorize( request )\n landing_url = transaction.success? ? GatewayTransaction.gateway.success_url( transaction ) : GatewayTransaction.gateway.error_url( transaction )\n redirect_to landing_url\n end",
"def void(identification, options = {})\n response = post(Vindicia::Transaction.cancel({\n :transactions => [{\n :account => { :merchantAccountId => @account_id },\n :merchantTransactionId => identification,\n :sourceIp => options[:ip]\n }]\n }))\n\n if response[:return][:returnCode] == '200' && response[:qtyFail].to_i == 0\n success(response, identification)\n else\n fail(response)\n end\n end",
"def void_transaction(id)\n resp = post(\"/transaction/void\", \"TransactionId\" => id)\n resp[\"Success\"] == true\n end",
"def refund(money, authorization, options = {})\n post = {}\n add_order_id(post, order_id_from(authorization))\n add_amount(post, money, options)\n\n commit('Credit', post, options)\n end",
"def void_last_transaction\n @total = @total - @last_transaction_amt\n end",
"def set_transaction\n @transaction = Transaction.find_by(\n id: params[:id],\n user_id: current_user.id\n )\n\n return unless @transaction.nil?\n current_user.errors.add :authorization, 'Not Authorized'\n render_json_api_error(current_user, :unauthorized)\n end",
"def end_transaction(result = nil)\n agent&.end_transaction(result)\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 close_account\n self.void_pending_authorizations\n if probono = Organization.probono\n if probono.piggy_bank && probono.piggy_bank.reload && probono.piggy_bank != self\n result = self.transfer(probono.piggy_bank, self.available_balance, :limits => false) if probono.piggy_bank\n raise BankError, \"remaining funds could not be transferred\" if !result || !result.success?\n end\n end\n end",
"def destroy\n render status: :forbidden, text: \"Forbidden!\" unless @transaction.user == current_user\n\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def void_last_transaction\n @total-=self.total\n end",
"def refund(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('refund', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end",
"def capture(money, authorization, options = {})\n parameters = extract_authorization(authorization, {})\n\n commit('SALES', money, parameters)\n end",
"def refund(money, authorization, options={})\n execute_dependant(:refund, money, authorization, options)\n end",
"def release(account, merchant, transaction_id)\n delete \"/#{CGI::escape(account)}/transactions/#{transaction_id}\" + \"?merchant=#{merchant}\"\n expect_status! 'CANCELLED'\n end",
"def void_transaction(location_id:,\n transaction_id:)\n warn 'Endpoint void_transaction in TransactionsApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/locations/{location_id}/transactions/{transaction_id}/void',\n 'default')\n .template_param(new_parameter(location_id, key: 'location_id')\n .should_encode(true))\n .template_param(new_parameter(transaction_id, key: 'transaction_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def authorize(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_token_request(PRE_TYPE, money, authorization_or_credit_card, options)\n #request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)\n end\n\n puts \"PAYMENT REQUEST\"\n puts request\n\n commit(request)\n end",
"def grant_authorization\n create_verification_code if authorized?\n redirect_back\n end",
"def void_last_transaction\n self.total -= @last_transaction.pop\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n authorize! :destroy, @transaction\n\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n end\n end",
"def test_purchase_and_void_for_check\n assert purchase = @gateway.purchase(1000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.void(purchase.authorization, @options)\n assert_success void\n assert_approved void\n end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def void_last_transaction\n self.total = self.total - self.last_transaction\n end",
"def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end",
"def capture(money, authorization, options = {})\n post = {}\n add_status_action(post, 'SETTLE')\n add_forced_settlement(post, options)\n add_transaction_id(post, authorization)\n commit(:change_status, money, post)\n end",
"def send(data, authorization)\n @authorization = authorization\n request.body = data if data\n response = super(data)\n fail_unless_expected_response response, Net::HTTPSuccess\n response.body\n end",
"def finish_invocation(signature, result)\n @invocation_callbacks.delete(signature).transfer(result) if @invocation_callbacks.has_key?(signature)\n end",
"def finish_invocation(signature, result)\n @invocation_callbacks.delete(signature).transfer(result) if @invocation_callbacks.has_key?(signature)\n end",
"def authorize(money, creditcard, options = {})\n vindicia_transaction = authorize_transaction(money, creditcard, options)\n response = check_transaction(vindicia_transaction)\n\n # if this response is under fraud review because of our AVS/CVV checks void the transaction\n if !response.success? && response.fraud_review? && !response.authorization.blank?\n void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], options)\n if void_response.success?\n return response\n else\n return void_response\n end\n end\n\n response\n end",
"def get_void_transaction\n\t\ttrans = self.create_transaction\n\t\t# This is necessary for voiding an order\n\t\t# Return nil if we don't have a record of the transaction id\n\t\tif !self.contains_valid_transaction_id? then\n\t\t\treturn nil\n\t\telse\n\t\t\ttrans.transaction_id = self.auth_transaction_id\n\t\tend\n\t\ttrans.type = 'VOID'\n\t\treturn trans\n\tend",
"def funding_txn_void(options)\n transaction = @cnp_txn.funding_txn_void(options)\n @txn_counts[:numFundingInstructionVoid] += 1\n \n add_txn_to_batch(transaction, :fundingInstructionVoid, options)\n end",
"def finalize_with_avalara_tax!\n finalize_without_avalara_tax!\n\n avalara_tax_transaction.commit\n end",
"def cancel_preauth(tx, reason)\n payment = {}\n Result::Success.new(payment)\n rescue => e\n Result::Error.new(e.message)\n end",
"def void_payment(event)\n payment = extract_payment_from_event(event)\n reason = event.data.object.cancellation_reason\n\n payment.with_lock do\n break if payment.void?\n\n payment.void!.tap do\n SolidusStripe::LogEntries.payment_log(\n payment,\n success: true,\n message: \"Payment was voided after payment_intent.voided webhook (#{reason})\"\n )\n end\n end\n end",
"def void\n @order.void_payment\n render 'status'\n end",
"def cancel_saferpay_payment\n return unless transaction_id = saferpay_payment.transaction_id\n\n gateway.void(transaction_id)\n end",
"def void(identification, options = {})\n form = {}\n add_txn_id(form, identification)\n add_test_mode(form, options)\n commit(:void, nil, form)\n end",
"def destroy\n @authorization = Authorization.find(params[:id])\n redirect_to @authorization.restaurant && return unless current_user && current_user.has_permission_to?(:manage, @authorization.restaurant)\n @authorization.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorizations_url) }\n format.xml { head :ok }\n end\n end",
"def process_cancel_preauth!\n if self.transaction_type.to_sym == :preauth\n do_preauth_cancel\n else\n LOG.error message: \"Cannot cancel this type of transaction\", financial_transaction_id: self.id, transaction_type: self.transaction_type\n raise \"Cannot cancel this type of transaction on this status\"\n end\n end",
"def end_transaction!\n @in_transaction = false\n end",
"def refund(money, authorization ,options={})\n post = {\n amount: money\n }\n\n add_reference(post, authorization)\n commit(:refund, post)\n end",
"def abort_transaction\n response = script_mode do\n query(\"cfgtransabort\")\n end\n #empty response is ok\n case\n when response.data.split(\"\\n\").size==1\n return true\n when response.data.match(/#{Replies::NO_TRANSACTION}/)\n return false\n when response.data.match(/#{Replies::OUTSTANDING_TRANSACTION}/)\n raise Agent::Error.new(Agent::Error::TRANS_NOTOWNER)\n else\n error = response.data.split(\"\\n\").delete_if {|item| item.match(/^#{@prompt}/)}.join(\"\\n\")\n raise Agent::Error.new(error)\n end\n end",
"def test_successful_purchase_and_declined_cancellation_anda\n omit\n credit_card = credit_card('6031998427187914', month: '12', year: '2024',\n verification_value: '111', first_name: 'Santiago', last_name: 'Navatta')\n\n purchase = @gateway.purchase(@amount, credit_card, @options)\n assert_success purchase\n\n assert void = @gateway.void(purchase.authorization, @cancel_options)\n assert_failure void\n end",
"def confirm_execution(*args)\n # pass\n end",
"def void_transaction(sbp_request, opts = {})\n data, status_code, headers = void_transaction_with_http_info(sbp_request, opts)\n return data\n end",
"def test_credit_card_purchase_and_void_amount_not_specified\n assert purchase = @gateway.purchase(@amount, @credit_card, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert void = @gateway.void(nil, purchase.authorization, @credit_card, @options)\n assert_failure void\n assert_equal 'TRANSACTION AMOUNT IS REQUIRED', void.message\n end",
"def execute_dependant(action, money, authorization, options)\n request = build_request do |xml|\n add_identification_authorization(xml, authorization, options)\n add_payment(xml, action, money, options)\n end\n\n commit(request)\n end",
"def destroy\n @authorization = Authorization.find(params[:id])\n @authorization.destroy\n\n respond_to do |format|\n format.html { redirect_to authorizations_url }\n format.json { head :no_content }\n end\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end",
"def internal_delete_object\n if self.transaction_activity.is_confirmed?\n self.errors.add(:generic_errors, \"Transaction sudah di konfirmasi\")\n return self \n end\n \n self.destroy \n end",
"def capture(money, authorization, options = {})\n post = {} \n add_authorization(post, reference_from(authorization))\n add_invoice(post, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def void(*args)\n commit('void', *args)\n end",
"def destroy\n @complete_transaction.destroy\n respond_to do |format|\n format.html { redirect_to @complete, notice: 'Transaksi berjaya dipadamkan' }\n format.json { head :no_content }\n end\n end",
"def execute_transaction\n if self.valid? == true && status != \"complete\"\n self.receiver.balance += self.amount\n self.sender.balance -= self.amount\n self.status = \"complete\"\n else\n self.status = \"rejected\"\n return \"Transaction rejected. Please check your account balance.\"\n end\n end",
"def unauthorize!\n throw(:warden)\n end",
"def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end",
"def capture(money, authorization, options = {})\n request = build_void_or_capture_request(FULFILL_TYPE, money, authorization, options)\n\n commit(request)\n end",
"def destroy\n @transaction.destroy\n render_success_response({}, \"Transaction successfully deleted\", status = 200)\n end",
"def void_transaction(location_id, transaction_id, opts = {})\n data, _status_code, _headers = void_transaction_with_http_info(location_id, transaction_id, opts)\n return data\n end",
"def complete_operation\n transfer_request = OwnershipTransferRequest.find_by(\n transfer_key: params[:transfer_key]\n )\n\n if transfer_request.nil? || transfer_request.recipient != current_user\n render status: 404, json: {\n error: 'Invalid key or you don\\'t have property to receive'\n } and return\n end\n\n begin\n OwnershipTransfer::CompleteRequest.call(transfer_request)\n\n render status: 200, json: { success: true }\n rescue StandardError => e\n render status: 422, json: { error: e.message }\n end\n end",
"def execute_transaction\n if valid? && sender.balance > amount && status == \"pending\"\n receiver.balance += amount\n sender.balance -= amount\n self.status = \"complete\"\n else \n reject_transfer\n end\n end",
"def test_purchase_cancel\n response = @gateway.setup_purchase(200, @options)\n\n assert_success response\n # now try to authorize the payment, issuer simulator has cancelled the payment\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'Cancelled', response.transaction['status'], 'Transaction should cancel'\n end",
"def void(options)\n response = gateway.void(options.fetch(:transaction_id))\n transaction_id = response.success? ? response.params['transaction_id'] : nil\n [transaction_id, response]\n end",
"def customer_credit_card_txn_void_or_refund_rq(authorization, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n\n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardTxnVoidOrRefundRq') do\n xml.tag!('TransRequestID', options[:order_id])\n xml.tag!('CreditCardTransID', authorization)\n xml.tag!('Amount', options[:amount])\n end\n }\n \n xml.target!\n end",
"def abort_transaction\n return System.abort_transaction\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.status = 'rejected'\n @transaction.save\n end",
"def execute_transaction\n if self.sender.balance > self.amount && self.status == \"pending\" && self.valid?\n self.receiver.deposit(self.amount)\n self.sender.deposit(-self.amount) \n self.status = \"complete\"\n else\n self.status = \"rejected\" \n \"Transaction rejected. Please check your account balance.\"\n end\n end",
"def call\n transaction do\n execute!\n\n confirm_success\n end\n\n rescue Exception => error\n confirm_failure error\n end",
"def destroy\n\t\tauthorize! :destroy, Transaccion\n @transaccion.destroy\n respond_to do |format|\n format.html { redirect_to transacciones_url, notice: 'Transaccion fue borrado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8511658",
"0.79625285",
"0.7513325",
"0.74927235",
"0.7229536",
"0.7138171",
"0.71273863",
"0.70469546",
"0.7023595",
"0.70138997",
"0.69301736",
"0.6682827",
"0.6679052",
"0.6623339",
"0.65439206",
"0.64832014",
"0.63889873",
"0.6101253",
"0.59945524",
"0.5891246",
"0.58826524",
"0.58809245",
"0.58193535",
"0.57908094",
"0.578042",
"0.5775854",
"0.5762737",
"0.5744899",
"0.5692991",
"0.56573874",
"0.5627916",
"0.5608572",
"0.5598172",
"0.5596055",
"0.555694",
"0.5555856",
"0.55376387",
"0.553762",
"0.5536018",
"0.5525968",
"0.55016667",
"0.5498803",
"0.54913175",
"0.5445841",
"0.54454887",
"0.5445456",
"0.5439963",
"0.5436801",
"0.5428265",
"0.54249626",
"0.5412644",
"0.54120964",
"0.54120964",
"0.54120964",
"0.54039675",
"0.53996366",
"0.5371803",
"0.5368933",
"0.5368933",
"0.53630525",
"0.5362847",
"0.5360723",
"0.5346105",
"0.53335464",
"0.53316337",
"0.533039",
"0.5317015",
"0.53143615",
"0.53137934",
"0.5313065",
"0.5312209",
"0.53019315",
"0.5296982",
"0.5294278",
"0.52711624",
"0.5263833",
"0.5258975",
"0.5253249",
"0.52463686",
"0.52302",
"0.5223319",
"0.5222802",
"0.52166563",
"0.52158993",
"0.5215443",
"0.52142435",
"0.5205749",
"0.5205443",
"0.5200854",
"0.51978004",
"0.5196193",
"0.51891905",
"0.51879716",
"0.51852304",
"0.5179858",
"0.5178292",
"0.5177071",
"0.5169745",
"0.51689285",
"0.51603043"
] |
0.7399
|
4
|
Credit an account. This transaction is also referred to as a Refund and indicates to the gateway that money should flow from the merchant to the customer. ==== Parameters money The amount to be credited to the customer. Either an Integer value in cents or a Money object. identification The ID of the original transaction against which the credit is being issued. options A hash of parameters. ==== Options :card_number The credit card number the credit is being issued to. (REQUIRED)
|
def credit(money, identification, options = {})
post = { :gateid => identification }
commit('CREDIT', money, post)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def credit(money, identification_or_credit_card, options = {}) \n if reference_transaction?(identification_or_credit_card)\n # Referenced credit: refund of a settled transaction\n perform_reference_credit(money, identification_or_credit_card, options)\n else # must be a credit card or card reference\n perform_non_referenced_credit(money, identification_or_credit_card, options)\n end\n end",
"def credit(money, creditcard_or_reference, options = {})\n setup_address_hash(options)\n commit(build_credit_request(money, creditcard_or_reference, options), :credit, money, options)\n end",
"def credit(money, identification, options = {})\n order = retrieve_order(identification)\n return order if order.is_a?(Response)\n response = commit(build_do_refund_request(identification, order[:country_code]))\n if response.success?\n commit(build_set_refund_request(identification, order[:payment_product_id]))\n else\n response\n end\n end",
"def credit(money, identification, options = {})\n body = credentials\n body[:ssl_transaction_type] = :ccreturn\n\n body[:ssl_amount] = (money.to_money/100.0).to_s\n body[:ssl_txn_id] = identification\n\n body_text = xmlize({:txn => body})\n\n logger.error 'REQUEST: ' + body_text\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n #logger.error body_text\n #logger.error response.to_s\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result].to_s == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end",
"def credit(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformCredit(request, response)\r\n return create_response(response)\r\n end",
"def credit(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_credit : :ns_credit, money, post)\n end",
"def credit(money, creditcard, options = {})\n if creditcard.is_a?(String)\n raise ArgumentError, \"Reference credits are not supported. Please supply the original credit card or use the #refund method.\"\n end\n\n form = {}\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:credit, money, form)\n end",
"def credit(money, credit_card, options = {})\n standard_response\n end",
"def credit(money, authorization, options={})\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, authorization, options)\n end",
"def credit(money, creditcard_or_authorization, options = {})\n if creditcard_or_authorization.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, creditcard_or_authorization, options)\n else\n credit_new_order(money, creditcard_or_authorization, options)\n end\n end",
"def credit(money, reference_or_credit_card, options = {})\n if reference_or_credit_card.is_a?(String)\n deprecated CREDIT_DEPRECATION_MESSAGE\n refund(money, reference_or_credit_card)\n else\n request = build_refund_request(money, reference_or_credit_card, options)\n commit(request)\n end\n end",
"def credit amount, description=nil, meta={}\n self.account.credit(amount, description, meta, self.uri)\n end",
"def authorize(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('AUTH', money, parameters)\n end",
"def credit(amount = nil, options = {})\n execute(:credit, {:amount => amount || self.amount}.reverse_merge(options))\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def credit! amount, options\n if hpp_payment? || adyen_cc_payment?\n process { payment_method.credit(amount, response_code, options) }\n else\n fail NotImplementedError, \"Spree::Payment does not implement credit!\"\n end\n end",
"def credit *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n description = args[1] || options.fetch(:description) { nil }\n appears_on_statement_as = args[3] || options.fetch(:appears_on_statement_as) { nil }\n \n if self.has_account?\n meta = args[2] || options.fetch(:meta) { nil }\n destination_uri = args[4] || options.fetch(:destination_uri) { self.uri }\n credit = self.account.credit(\n :amount => amount,\n :meta => meta,\n :description => description,\n :destination_uri => destination_uri,\n :appears_on_statement_as => appears_on_statement_as\n )\n else\n credit = Credit.new(\n :uri => self.credits_uri,\n :amount => amount,\n :description => description,\n :appears_on_statement_as => appears_on_statement_as\n )\n credit.save\n end\n\n credit\n end",
"def refund(money, identification, options = {})\n requires!(options, :card_number)\n\n post = { trans_id: identification,\n card_num: options[:card_number] }\n\n post[:first_name] = options[:first_name] if options[:first_name]\n post[:last_name] = options[:last_name] if options[:last_name]\n post[:zip] = options[:zip] if options[:zip]\n\n add_invoice(post, options)\n add_duplicate_window(post)\n\n commit('CREDIT', money, post)\n end",
"def authorize(money, creditcard, options={})\n post = {} # { amount: money }.merge(options)\n\n add_order_id(post, options)\n add_creditcard(post, creditcard, options)\n add_amount(post, money, options)\n add_currency(post, options)\n add_customer_data(post, options)\n add_test(post)\n commit(:authorize, post)\n end",
"def credit(amount, authorization, options={})\n adjust_and_save(amount.abs, :credit, {:authorization => authorization}.merge(options))\n end",
"def purchase(money, creditcard, options = {})\n parameters = {}\n add_creditcard(parameters, creditcard)\n add_currency_code(parameters, money, options)\n add_invoice(parameters, options)\n add_customer_data(parameters, options)\n\n commit('CAPTURE', money, parameters)\n end",
"def credit(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.debit_request\n set_initial_request_parameters(request)\n set_amount_request_parameters(request, '-' + money.to_s, gateway_options)\n set_payment_process_parameters(request, response_code)\n set_sequence_request_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end",
"def credit(amount, payment_method, options = {})\n post = {}\n add_invoice(post, amount, options)\n add_order_number(post, options)\n add_payment_method(post, payment_method)\n add_customer_data(post, options)\n add_soft_descriptors(post, options)\n add_customer_reference(post, options)\n\n commit('refund', post)\n end",
"def authorize(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformAuthOnly(request, response)\r\n return create_response(response)\r\n end",
"def authorize(money, credit_card, options={})\n execute_new_order(:authorize, money, credit_card, options)\n end",
"def authorize(money, creditcard_or_credit_card_id, options = {})\n post = {}\n post[:authonly] = 1\n\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def authorize(money, creditcard, options = {})\n form = {}\n add_salestax(form, options)\n add_invoice(form, options)\n add_creditcard(form, creditcard)\n add_address(form, options)\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:authorize, money, form)\n end",
"def authorize(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(PRE_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def credit_card(options = {})\n ActiveMerchant::Billing::CreditCard.new( credit_card_hash(options) )\n end",
"def credit(transaction_id, amount)\n params = {\n transaction_amount: amount,\n transaction_id: transaction_id,\n operation: 'CREDIT'\n }\n\n process_response params\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_CAPTURE', money, post)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('AUTH', money, post)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_customer_data(post, options)\n add_amount(post, money, options)\n\n commit('PreAuth', post, options)\n end",
"def authorize(money, credit_card, options = {})\n post = {}\n add_amount(post, money)\n add_invoice(post, options)\n add_payment_source(post, credit_card, options)\n unless credit_card.is_a?(String) && !options[:store]\n add_address(post, credit_card, options)\n add_customer_data(post, options)\n end\n \n commit(:authorization, money, post)\n end",
"def purchase(money, credit_card, options = {})\n if result = test_result_from_cc_number(credit_card.number)\n return result\n end\n \n request = build_purchase_or_authorization_request(AUTH_TYPE, money, credit_card, options)\n \n commit(request)\n end",
"def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end",
"def credit(amount, description)\n super(amount, description) # Call and pass data to the original methods of the BankAccount\n charge_fee # And also charge a fee, add another transaction\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n parameters = {\n :order_id => options[:order_id],\n :cust_id => options[:customer],\n :amount => amount(money),\n :pan => creditcard.number,\n :expdate => expdate(creditcard),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n } \n \n commit('purchase', parameters) \n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n response = authorize(money, creditcard, options)\n # dove è finita l'etica del programmatore?\n # dove è finito l'incapsulamento dei dati\n if response.success? && response.fraud_review?[:fraud_result] == 'C'\n response.instance_variable_set('@success', false)\n response.instance_variable_set('@message', \"CAN'T CAPTURE, CHALLENGED AUTHORIZATION\")\n end\n \n return response unless response.success?\n\n commit(build_capture_request(money, options[:order_id], credit_card_type(creditcard)))\n end",
"def credit(description, amount)\n\t\tadd_transaction(description, amount)\n\tend",
"def purchase(money, credit_card, options = {})\n requires!(options, :order_id)\n requires!(options, :AccessID)\n requires!(options, :AccessPass)\n order_id = format_order_id( options[:order_id] )\n\n post = {}\n post[:Method] = 1\n post[:JobCd] = 'CAPTURE'\n\n post[:AccessID] = options[:AccessID]\n post[:AccessPass] = options[:AccessPass]\n\n add_credit_card( post, credit_card )\n add_order( post, order_id )\n\n response = commit 'pay', post\n\n if successful_payment? response\n return Response.new true, 'Success', response, { test: test?, authorization: order_id }\n end\n\n Response.new false, response[:errors], response, { test: test?, authorization: order_id }\n end",
"def credit(amount, options = {})\n transaction do\n begin\n Transaction.credit(self, amount, options)\n self.balance += amount\n rescue ActiveRecord::StatementInvalid\n self.balance -= amount\n end\n end\n self.save!\n self.balance\n end",
"def refund(money, authorization, options = {})\n post = {}\n add_order_id(post, order_id_from(authorization))\n add_amount(post, money, options)\n\n commit('Credit', post, options)\n end",
"def purchase(money, creditcard_or_credit_card_id, options = {})\n post = {}\n add_address(post, options)\n add_custom(post, options)\n add_invoice(post, options)\n add_payment_source(post, creditcard_or_credit_card_id, options)\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def authorize(money, creditcard_or_billing_id, options = {})\n store_entry_exec money, creditcard_or_billing_id, (money == 0 ? :check : :auth), options\n end",
"def authorize(money, creditcard, options = {})\n vindicia_transaction = authorize_transaction(money, creditcard, options)\n response = check_transaction(vindicia_transaction)\n\n # if this response is under fraud review because of our AVS/CVV checks void the transaction\n if !response.success? && response.fraud_review? && !response.authorization.blank?\n void_response = void([vindicia_transaction[:transaction][:merchantTransactionId]], options)\n if void_response.success?\n return response\n else\n return void_response\n end\n end\n\n response\n end",
"def purchase(money, creditcard, options = {})\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture(money, response.authorization, options)\n end",
"def purchase(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n\n post = {}\n\n add_amount(post, money, options)\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_standard_parameters('pay', post, options[:unique_id])\n add_3ds(post, options)\n add_tx_source(post, options)\n\n commit(post)\n end",
"def authorize(money, creditcard, options = {})\n raise ActiveMerchantError if creditcard.is_a? ActiveMerchant::Billing::Check\n auth_or_purchase('AUTH_ONLY', money, creditcard, options)\n end",
"def authorize(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_token_request(PRE_TYPE, money, authorization_or_credit_card, options)\n #request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)\n end\n\n puts \"PAYMENT REQUEST\"\n puts request\n\n commit(request)\n end",
"def credit_account\n if @invoice.amount\n result = @invoice.bank_account.credit_account(seller_amount) rescue false\n else\n false\n end\n end",
"def refund(money, identification, options = {})\n parameters = extract_authorization(identification, {})\n\n commit('REFUND', money, parameters)\n end",
"def purchase(money, authorization_or_credit_card, options = {})\n requires!(options, :order_id)\n\n if authorization_or_credit_card.is_a?(String)\n request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n else\n request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)\n end\n\n commit(request)\n end",
"def authorize(money, creditcard, options = {})\n requires!(options, :shop_transaction_id)\n requires_credit_card_name(creditcard)\n transaction_data = TransactionData.new({:money => money, :credit_card => creditcard}.merge(options))\n get_response(\"PAGAMS2S.asp\", transaction_data, options)\n end",
"def credit(transaction_id, amount)\n params = {\n :query => {\n :amount => amount,\n :transactionId => transaction_id,\n :operation => \"CREDIT\"\n }\n }\n\n Responses::CreditResponse.new(self.class.get(\"/Netaxept/Process.aspx\", params).parsed_response)\n end",
"def authorize_payment(credit_card, options = {})\n\n # this is the major function that interacts with the credit card company\n options[:order_id] = number # currently just loading a date\n # options[:email] = 'developer@fitwit.com'\n # options[:billing_address] = {\n # :name => 'Cody Fauser',\n # :address1 => '1234 Shady Brook Lane',\n # :address2 => 'Apartment 1',\n # :city => 'Ottawa',\n # :state => 'ON',\n # :country => 'CA',\n # :zip => 'K3P5N5',\n # :phone => '999-999-9999'}\n\n authorization = OrderTransaction.authorize(amount, credit_card, options)\n self.save!\n self.order_transactions << authorization\n\n if authorization.success?\n self.payment_authorized!\n else\n self.transaction_declined!\n end\n\n authorization\n #end\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('SALE', money, post)\n end",
"def purchase credit_card, order_number, options={}\n error_response \"Not yet supported\"\n end",
"def credit(money_cents, _source, response_code, _gateway_options)\n protected_request do\n result = braintree.transaction.refund(\n response_code,\n dollars(money_cents)\n )\n Response.build(result)\n end\n end",
"def purchase(money, credit_card, options={})\n execute_new_order(:purchase, money, credit_card, options)\n end",
"def credit(payment)\n payment_gateway = payment.payment_method\n check_environment(payment_gateway)\n\n amount = payment.credit_allowed >= payment.order.outstanding_balance.abs ? payment.order.outstanding_balance.abs : payment.credit_allowed.abs\n if payment_gateway.payment_profiles_supported?\n response = payment_gateway.credit((amount * 100).round, self, payment.response_code, minimal_gateway_options(payment, false))\n else\n options = {:card_number => payment.source.last_digits}.merge(minimal_gateway_options(payment, false))\n response = payment_gateway.credit((amount * 100).round, payment.response_code, options)\n end\n\n ## Thomas: add action here, until we update to a later version of active merchant\n response.params['action'] = \"CREDIT\" unless response.params['action']\n record_log payment, response\n\n if response.success?\n Spree::Payment.create(:order => payment.order,\n :source => payment,\n :payment_method => payment.payment_method,\n :amount => amount.abs * -1,\n :response_code => response.authorization,\n :state => 'completed')\n else\n gateway_error(response)\n end\n rescue ActiveMerchant::ConnectionError => e\n gateway_error e\n end",
"def charge!(amount, options = {})\n unless credit_card_stored?\n logger.info(\"Buyer #{self.id} was not charged: credit card missing\")\n raise Finance::Payment::CreditCardMissing\n end\n\n gateway_options = options.delete(:gateway_options) || {}\n\n transaction = payment_transactions.build(options.reverse_merge(:action => :purchase,\n :amount => amount))\n\n # add order_id\n if options[:invoice].is_a?(Invoice) && gateway_options.include?(:order_id)== false\n gateway_options[:order_id]= options[:invoice].id\n end\n\n gateway_options.reverse_merge!(payment_method_id: payment_detail.payment_method_id) if provider_payment_gateway.is_a?(ActiveMerchant::Billing::StripeGateway)\n\n logger.info(\"Processing transaction for buyer #{self.id} with code #{credit_card_auth_code}, gateway #{provider_payment_gateway} & options #{gateway_options}\")\n\n transaction.process!(credit_card_auth_code, provider_payment_gateway, gateway_options)\n end",
"def purchase(money, creditcard, options = {})\n\n body = credentials\n body[:ssl_transaction_type] = :ccsale\n body[:ssl_amount] = '%.2f' % (money / 100.0)\n\n if options[:ssl_token].present?\n body[:ssl_token] = options[:ssl_token]\n else\n body[:ssl_card_number] = creditcard.card_number\n body[:ssl_exp_date] = ('%02d' % creditcard.expiration_month.to_i)+('%02d' % (creditcard.expiration_year.to_i % 1000))\n body[:ssl_first_name] = creditcard.first_name[0..19] if creditcard.first_name.present?\n body[:ssl_last_name] = creditcard.last_name[0..19] if creditcard.last_name.present?\n\n if creditcard.cid.present?\n body[:ssl_cvv2cvc2] = creditcard.cid\n body[:ssl_cvv2cvc2_indicator] = 1\n end\n\n billing_address = options[:billing_address]\n\n if billing_address.present?\n body[:ssl_avs_zip] = billing_address[:zip]\n body[:ssl_avs_address] = billing_address[:address1]\n body[:ssl_city] = billing_address[:city]\n body[:ssl_state] = billing_address[:state]\n body[:ssl_country] = billing_address[:country]\n end\n end\n\n body_text = xmlize({:txn => body})\n\n # for logging\n safe_request = xmlize({:txn => sanitize_body(body)})\n logger.error 'REQUEST: ' + safe_request\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n \n logger.error 'RESPONSE: ' + response\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result] == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :auth_code => doc[:ssl_approval_code],\n :avs_result => doc[:ssl_avs_response],\n :cvv_result => doc[:ssl_cvv2_response],\n :request => safe_request,\n :response => doc.to_json\n )\n end",
"def purchase(amount, creditcard, options = {})\n response = session_ticket\n if response.success?\n options[:session_ticket] = response.authorization\n options[:order_id] ||= generate_unique_id\n xml = customer_credit_card_charge_rq(amount, creditcard, options)\n commit('purchase', xml)\n end\n \n end",
"def credit(amount, current_period)\n if balance.zero?\n \"You do not have a balance.\"\n else\n @balance -= amount\n calculate_interest(current_period, @txns.keys.last)\n save_txn(current_period, 'credit', amount, @balance)\n @ints << @interest\n get_balance\n end\n end",
"def build_credit_request(transaction_type, money, transaction_id, card)\n build_xml_request(transaction_type, transaction_id) do |xml|\n add_credit_card(xml, card) if card\n xml.tag! 'TotalAmount', amount(money)\n\n xml.target!\n end\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 charge_credit_invoice\n @invoice = Invoice.find(params[:id])\n Stripe.api_key = \"\"\n total_invoice_stripe = Money.new(@invoice.total_due, \"USD\")\n \n charge = Stripe::Charge.create(\n :amount => total_invoice_stripe.cents,\n :currency => \"usd\",\n :card => params[:invoice][:stripe_card_token],\n :description => @invoice.invoice_number\n )\n \n @invoice.stripe_card_token = charge.id\n if(@invoice.save!)\n @invoice.payment_received = true\n @invoice.save!\n redirect_to invoice_path(@invoice.id)\n else\n redirect_to root_path\n end\n end",
"def purchase(money, creditcard, options = {})\n if creditcard.expired?\n mess = \"Credit Card is expired #{creditcard.inspect}\"\n raise ArgumentError.new(mess)\n end\n if options[:zip_code].nil?\n mess = \"Require zip code in options #{options.inspect}\"\n raise ArgumentError.new(mess)\n end\n hash = {\n total: money,\n mop: creditcard.brand,\n zip_code: options[:zip_code],\n credit_card_num: creditcard.number,\n credit_card_expiry: \"#{creditcard.month}/#{creditcard.year}\"\n }\n process_credit_card_v1(hash)\n end",
"def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend",
"def authorize(options)\n response = gateway.authorize(options.fetch(:amount), options.fetch(:creditcard), options[:extra])\n transaction_id = response.success? ? response.params['transaction_id'] : nil\n [transaction_id, response]\n end",
"def credit(credit_cents, payment_id, options)\n order = options[:originator].try(:payment).try(:order)\n order_number = order.try(:number)\n order_currency = order.try(:currency)\n MollieLogger.debug(\"Starting refund for order #{order_number}\")\n\n begin\n Mollie::Payment::Refund.create(\n payment_id: payment_id,\n amount: {\n value: format_money(order.display_total.money),\n currency: order_currency\n },\n description: \"Refund Spree Order ID: #{order_number}\",\n api_key: get_preference(:api_key)\n )\n MollieLogger.debug(\"Successfully refunded #{order.display_total} for order #{order_number}\")\n ActiveMerchant::Billing::Response.new(true, 'Refund successful')\n rescue Mollie::Exception => e\n MollieLogger.debug(\"Refund failed for order #{order_number}: #{e.message}\")\n ActiveMerchant::Billing::Response.new(false, 'Refund unsuccessful')\n end\n end",
"def purchase(money, _, options={})\n requires!(options, :collectdate, :customeraccountname, :customerbic, :customeriban, :description, :invoicenumber, :mandatedate, :mandatereference)\n buckaroo_validate(money, options)\n\n mandatereference = options[:mandatereference]\n mandatereference = \"#{@options[:sepa_mandate_prefix]}-#{mandatereference}\" if @options[:sepa_mandate_prefix]\n\n post_params = {\n brq_amount: money,\n brq_channel: \"CALLCENTER\",\n brq_culture: options[:culture] ? options[:culture] : \"EN\",\n brq_currency: options[:currency] ? options[:currency] : \"EUR\",\n brq_description: options[:description],\n brq_invoicenumber: options[:invoicenumber],\n brq_payment_method: \"simplesepadirectdebit\",\n brq_service_simplesepadirectdebit_action: \"Pay\",\n brq_service_simplesepadirectdebit_collectdate: options[:collectdate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_customeraccountname: options[:customeraccountname],\n brq_service_simplesepadirectdebit_customerbic: options[:customerbic],\n brq_service_simplesepadirectdebit_customeriban: options[:customeriban],\n brq_service_simplesepadirectdebit_mandatedate: options[:mandatedate].strftime(\"%Y-%m-%d\"),\n brq_service_simplesepadirectdebit_mandatereference: mandatereference,\n brq_startrecurrent: true,\n brq_websitekey: @options[:websitekey]\n }.merge(options.select {|k, *| k.to_s.start_with?(\"add_\") })\n\n BuckarooBPE3Toolbox.call(\"TransactionRequest\", post_params, @options[:secretkey], true)\n end",
"def capture(money, identification, options = {})\n response = post(Vindicia::Transaction.capture({\n :transactions => [{ :merchantTransactionId => identification }]\n }))\n\n if response[:return][:returnCode] != '200' || response[:qtyFail].to_i > 0\n return fail(response)\n end\n\n success(response, identification)\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 refund(money, identification, options = {})\n form = {}\n add_txn_id(form, identification)\n add_test_mode(form, options)\n commit(:refund, money, form)\n end",
"def credit_card\n @credit_card ||= ActiveMerchant::Billing::CreditCard.new(\n :number => card_number,\n :verification_value => card_verification,\n :month => card_expires_on.month,\n :year => card_expires_on.year,\n :first_name => first_name,\n :last_name => last_name\n )\n end",
"def authorize(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('RES', post)\n end",
"def credit(credit_cents, payment_id, options)\n order_number = options[:originator].try(:payment).try(:order).try(:number)\n MollieLogger.debug(\"Starting refund for order #{order_number}\")\n\n begin\n amount = credit_cents / 100.0\n Mollie::Payment::Refund.create(\n payment_id: payment_id,\n amount: amount,\n description: \"Refund Spree Order ID: #{order_number}\",\n api_key: get_preference(:api_key)\n )\n MollieLogger.debug(\"Successfully refunded #{amount} for order #{order_number}\")\n ActiveMerchant::Billing::Response.new(true, 'Refund successful')\n rescue Mollie::Exception => e\n MollieLogger.debug(\"Refund failed for order #{order_number}: #{e.message}\")\n ActiveMerchant::Billing::Response.new(false, 'Refund unsuccessful')\n end\n end",
"def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end",
"def capture(money, authorization, options = {})\n requires!(options, :credit_card)\n\n form = {}\n add_salestax(form, options)\n add_approval_code(form, authorization)\n add_invoice(form, options)\n add_creditcard(form, options[:credit_card])\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:capture, money, form)\n end",
"def credit_with_payment_profiles(amount, payment, response_code, option)\n provider.credit(amount, payment)\n end",
"def credit amount, description=nil, meta={}, destination_uri=nil\n credit = Credit.new(\n :uri => self.credits_uri,\n :amount => amount,\n :meta => meta,\n :description => description,\n :destination_uri => destination_uri,\n )\n credit.save\n end",
"def credit_card\n\t\t@credit_card ||= ActiveMerchant::Billing::CreditCard.new(\n\t\t\t:type => card_type,\n\t\t\t:number => card_number,\n\t\t\t:verification_value => card_cvv,\n\t\t\t:month => card_exp_month,\n\t\t\t:year => card_exp_year,\n\t\t\t:first_name => self.billing_address.name.split(' ').first,\n\t\t\t:last_name => self.billing_address.name.split(' ').last\n\t\t\t)\n\tend",
"def add_customer_credit_card(customer, credit_card, options = {})\n credit_card = credit_card.to_vaulted_billing\n\n authorization = authorize(customer, credit_card, 1.00, options)\n void = void(authorization.id, options) if authorization.success?\n\n respond_with(credit_card, authorization.response, { \n :success => authorization.success?, \n :transactions => { :void => void, :authorization => authorization }\n }) do |cc|\n cc.vault_id = authorization.response.body['PaymentAccountDataToken'].presence\n end\n end",
"def credit!(amount)\n self.balance += parse_monetary_value(amount)\n self.store\n end",
"def purchase(_money, _credit_card, _options = {})\n ActiveMerchant::Billing::Response.new(true, 'PayUIn Gateway: Forced success', {}, test: test?)\n end",
"def capture(money, authorization, options = {})\n post = {}\n\n # remove last 4 digits of cc number as they are not required here\n post[:postonly] = authorization[0...-4]\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end",
"def refund(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('refund', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end",
"def charge_credit_card(params = {})\n request = token_request(payment_method: {\n type: 'card', register_card_token: 0\n })\n response = PaybywayConnector.auth_payment(request).parsed_response\n {\n result: response['result'],\n token: response['token'],\n amount: request[:amount],\n currency: request[:currency],\n payment_url: PaybywayConnector.charge_url\n }\n end",
"def authorize_payment(options = {})\n options = populate_options if options.size == 0\n options[:order_id] = self.order_number\n transaction do\n authorization = OrderTransaction.authorize(self.total_in_cents, \n self.credit_card, options\n )\n self.transactions << authorization\n if authorization.success?\n payment_authorized!\n else\n transaction_declined!\n end\n authorization\n end\n end",
"def refund(money, card, transaction_id, options = {})\n if options[:refund_all].present?\n transaction { refund_all(transaction_id) }\n else\n transaction do\n refund_amount cent_amount: money,\n currency: options[:originator].payment.currency,\n transaction_id: transaction_id,\n reason: options[:originator].reason.name\n end\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 purchase(money, options = {})\n post = {}\n\n add_invoice(post, money, options)\n add_payment(post, options)\n add_address(post, options)\n add_customer_data(post, options)\n\n commit(:Sale, post)\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def cash(payment_object, options={})\n defaults = { :order_id => number }\n options = defaults.merge(options).symbolize_keys\n\n # before_payment\n seller.send( :before_payment, self ) if seller && seller.respond_to?( :before_payment )\n\n self.build_addresses\n self.build_invoice unless self.invoice\n\n payment = self.invoice.cash(payment_object, options)\n if payment.success?\n process_payment!\n approve_payment!\n end\n\n # after_payment\n buyer.send( :after_payment, self ) if buyer && buyer.respond_to?( :after_payment )\n payment\n end",
"def apply_freshbooks_credit!\n credit = [ self.organization.accounting_gateway.available_credits[:USD], self.invoice_balance ].min\n response = FreshBooks.account.payment.create({ payment: {\n invoice_id: self.freshbooks_invoice_id,\n client_id: self.organization.accounting_gateway.freshbooks_id,\n amount: credit,\n type: 'Credit'\n }})\n end",
"def customer_credit_card_charge_rq(amount, creditcard, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n\n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardChargeRq') do\n xml.tag!('TransRequestID', options[:order_id])\n add_creditcard(xml, creditcard) \n xml.tag!('Amount', amount)\n add_address(xml, options) \n add_creditcard_security_code(xml, creditcard)\n end\n }\n\n xml.target!\n end"
] |
[
"0.813205",
"0.78354686",
"0.7818792",
"0.7759083",
"0.7637752",
"0.76291376",
"0.7576386",
"0.74380124",
"0.7097683",
"0.7074614",
"0.6963055",
"0.69241565",
"0.68987834",
"0.6822871",
"0.66994894",
"0.66994894",
"0.6695116",
"0.6693651",
"0.66687053",
"0.6605151",
"0.65588117",
"0.6551999",
"0.6533349",
"0.65176606",
"0.6498431",
"0.64882314",
"0.6484942",
"0.6479353",
"0.6476182",
"0.6463202",
"0.6458431",
"0.6454486",
"0.64304817",
"0.6371527",
"0.6368217",
"0.63353807",
"0.6333641",
"0.6332812",
"0.62964225",
"0.6290824",
"0.6254154",
"0.6250584",
"0.6244863",
"0.61489725",
"0.6120156",
"0.61143947",
"0.6084639",
"0.60658634",
"0.60479486",
"0.6034545",
"0.60203",
"0.5986467",
"0.59860444",
"0.5956718",
"0.59456766",
"0.5943185",
"0.5933434",
"0.59199935",
"0.59076494",
"0.590506",
"0.5883878",
"0.5857832",
"0.5854145",
"0.5844608",
"0.5826361",
"0.57825667",
"0.5772915",
"0.57665044",
"0.5741343",
"0.5713409",
"0.5706352",
"0.56948954",
"0.5682689",
"0.56721044",
"0.5666452",
"0.5665083",
"0.56555927",
"0.56498355",
"0.56422657",
"0.56152326",
"0.56101316",
"0.5568576",
"0.5563175",
"0.5562098",
"0.5544372",
"0.554408",
"0.5507267",
"0.550708",
"0.5472944",
"0.5467183",
"0.54644895",
"0.5457833",
"0.5451162",
"0.5449998",
"0.5435188",
"0.5433592",
"0.5433592",
"0.5422672",
"0.54030645",
"0.5392537"
] |
0.8146303
|
0
|
Make a ruby type out of the response string
|
def normalize(field)
case field
when "true" then true
when "false" then false
when "" then nil
when "null" then nil
else field
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert(value, type)\n begin\n case type\n when 'json' then JSON.parse(value)\n when 'base64' then JSON.parse(Base64.decode64(value))\n when 'integer' then Integer(value)\n when 'number' then Float(value)\n else\n value.to_s\n end\n rescue ArgumentError\n value.to_s\n end\n end",
"def deserialize(response, return_type)\n body = response.body\n\n return nil if body.nil? || body.empty?\n\n # return response body directly for String return type\n return body if return_type == 'String'\n\n # ensuring a default content type\n content_type = response.headers['Content-Type'] || 'application/json'\n\n fail \"Content-Type is not supported: #{content_type}\" unless json_mime?(content_type)\n\n begin\n data = JSON.parse(\"[#{body}]\", :symbolize_names => true)[0]\n rescue JSON::ParserError => e\n if %w(String Date DateTime).include?(return_type)\n data = body\n else\n raise e\n end\n end\n\n convert_to_type data, return_type\n end",
"def parse_value(type)\n value=:unknown\n case type\n when \"int16\"\n value=@xdr.int16\n when \"uint16\"\n value=@xdr.uint16\n when \"uint32\"\n value=@xdr.uint32\n when \"int32\"\n value=@xdr.int32\n when \"float\"\n value=@xdr.float32\n when \"double\"\n value=@xdr.float64\n when \"string\"\n value=@xdr.string\n else\n #puts \"Received unknown type #{type}\"\n end\n return value\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n OpenapiClient.const_get(return_type).build_from_hash(data)\n end\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'BOOLEAN'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object, return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map {|item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n SimplyRetsClient.const_get(return_type).new.tap do |model|\n model.build_from_hash data\n end\n end\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'BOOLEAN'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map {|item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n SwaggerClient.const_get(return_type).new.tap do |model|\n model.build_from_hash data\n end\n end\n end",
"def get_data_type_from_response(response)\n return nil unless response\n return nil unless content_type = response['content-type']\n return nil unless m=content_type.match(/;\\s* type=([0-9A-Za-z:]+)/x)\n m[1]\n end",
"def to_type(str)\n if str && type && !mapping\n send(\"parse_#{type}\", str)\n elsif str && mapping && mapping.values.map(&:to_s).include?(str)\n mapping.find { |_, v| v.to_s == str.to_s }[0]\n else\n str\n end\n end",
"def decode_with_type(s, type)\n s = StringIO.new(s) if s.is_a?(String)\n if type == Integer\n item = s.read(1)\n if item.nil?\n raise InvalidError.new \"invalid Integer value nil\"\n elsif item == \"\\x80\".b || item.empty?\n 0\n elsif item.ord < 0x80\n item.ord\n else\n size = item[0].ord - 0x80\n Ciri::Utils.big_endian_decode(s.read(size))\n end\n elsif type == Bool\n item = s.read(1)\n if item == Bool::ENCODED_TRUE\n true\n elsif item == Bool::ENCODED_FALSE\n false\n else\n raise InvalidError.new \"invalid bool value #{item}\"\n end\n elsif type.is_a?(Class) && type.respond_to?(:rlp_decode)\n type.rlp_decode(s)\n elsif type.is_a?(Array)\n decode_list(s) do |list, s2|\n i = 0\n until s2.eof?\n t = type.size > i ? type[i] : type[-1]\n list << decode_with_type(s2, t)\n i += 1\n end\n end\n elsif type == Bytes\n str = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{str.class} from Bytes\" unless str.is_a?(String)\n str\n elsif type == List\n list = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{list.class} from List\" unless list.is_a?(Array)\n list\n elsif type == Raw\n decode_stream(s)\n else\n raise RLP::InvalidError.new \"unknown type #{type}\"\n end\n rescue\n error \"when decoding #{s} into #{type}\"\n raise\n end",
"def parse_by_type(value, type)\n case type\n when \"Integer\"\n Integer(value)\n when \"String\"\n value.inspect\n # when \"IntegerArray\"\n # [JSON(value)]\n when \"StringArray\"\n value\n else\n value\n end\n value\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SimplyRetsClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def decoded_value\n case value_type\n when \"Fixnum\" then value.to_i\n when \"Float\" then value.to_f\n when \"Date\" then Date.parse(value)\n when \"Array\", \"Hash\" then JSON.parse(value)\n when \"Boolean\" then value == \"true\" ? true : false\n else value.to_s\n end\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'BOOLEAN'\n data == true\n when 'DateTime'\n # parse date time (expecting ISO 8601 format)\n DateTime.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models, e.g. Pet\n LemonWayClient.const_get(return_type).new.tap do |model|\n model.build_from_hash data\n end\n end\n end",
"def deserialize(value)\n cast(value)\n end",
"def convert_to_type(data, return_type, api_version)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'Time'\n # parse date time (expecting ISO 8601 format)\n Time.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type, api_version) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type, api_version) }\n end\n else\n # models (e.g. Pet) or oneOf\n klass = DatadogAPIClient.const_get(api_version).const_get(return_type)\n klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)\n end\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), response.body ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n VesAPIClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n GoogleIidClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n KeycloakRest.const_get(type).build_from_hash(value)\n end\n end",
"def deserialize(string)\n string\n end",
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n TBA API v3 Ruby Client.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = YextClient.const_get(type).new\n if defined? temp_model.isEnum \n value.to_s\n else\n temp_model.build_from_hash(value)\n end\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = PulpRpmClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def deserialize_json(s, type)\n headers = { 'Content-Type' => 'application/json' }\n response = double('response', headers: headers, body: s)\n API_CLIENT.deserialize(response, type)\nend",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n AmzSpApi::FulfillmentOutboundApiModel.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n OpenapiClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CloudmersiveVirusScanApiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CloudmersiveOcrApiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpenapiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), uncompress_body(response) ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = CnsOpenapiRubyClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BitbarCloudApiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BitbarCloudApiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CloudmersiveValidateApiClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def convert_to_type(data, return_type)\n return nil if data.nil?\n case return_type\n when 'String'\n data.to_s\n when 'Integer'\n data.to_i\n when 'Float'\n data.to_f\n when 'Boolean'\n data == true\n when 'Time'\n # parse date time (expecting ISO 8601 format)\n Time.parse data\n when 'Date'\n # parse date time (expecting ISO 8601 format)\n Date.parse data\n when 'Object'\n # generic object (usually a Hash), return directly\n data\n when /\\AArray<(.+)>\\z/\n # e.g. Array<Pet>\n sub_type = $1\n data.map { |item| convert_to_type(item, sub_type) }\n when /\\AHash\\<String, (.+)\\>\\z/\n # e.g. Hash<String, Integer>\n sub_type = $1\n {}.tap do |hash|\n data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }\n end\n else\n # models (e.g. Pet) or oneOf\n klass = Petstore.const_get(return_type)\n klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def type_cast(value)\n case type\n when 'N' # number\n unpack_number(value)\n when 'I' # integer\n unpack_unsigned_long(value)\n when 'F' # float\n unpack_float(value)\n when 'D' # date\n decode_date(value)\n when 'T' # datetime\n decode_datetime(value)\n when 'L' # logical\n boolean(value)\n else\n value.to_s.strip\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = OryClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = OryHydraClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Shotstack.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n #there is bug with ruby while searching for constraint which is under 2 modules\n temp_model = DocuSign_eSign.const_get('OAuth').const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = IntersightClient.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def decode_body(str)\n @serializer.decode(str)\n end"
] |
[
"0.6822089",
"0.6656662",
"0.65263885",
"0.6480913",
"0.6479441",
"0.6401203",
"0.63952774",
"0.6370618",
"0.6332342",
"0.62896943",
"0.6285262",
"0.62674725",
"0.6253528",
"0.6251857",
"0.62380135",
"0.623284",
"0.62236094",
"0.62236094",
"0.6209322",
"0.6204596",
"0.6199452",
"0.619238",
"0.619238",
"0.6185352",
"0.6178419",
"0.6167156",
"0.61563617",
"0.6140487",
"0.61397356",
"0.6131476",
"0.6120208",
"0.611687",
"0.611687",
"0.611687",
"0.611687",
"0.611687",
"0.6115098",
"0.610775",
"0.61058694",
"0.61038136",
"0.61019045",
"0.6100505",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60978264",
"0.60971797",
"0.6095369",
"0.6075782",
"0.6075782",
"0.6071724",
"0.6069703",
"0.6067403",
"0.60649085",
"0.6057532",
"0.6057374",
"0.6054368",
"0.604874",
"0.6048552",
"0.6041975",
"0.6041975",
"0.6041236",
"0.6041236",
"0.6037247",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032923",
"0.6032171",
"0.6032171",
"0.6032171",
"0.6032171",
"0.6032171",
"0.6030805"
] |
0.0
|
-1
|
return pointer for use with pack('L')
|
def str_to_ptr(v)
[v].pack('p*').unpack('L')[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pack(p0) end",
"def unpack_pointer(packed_pointer)\n if is_64bit\n # Assume little endian\n packed_pointer.unpack('Q<')[0]\n else\n packed_pointer.unpack('V')[0]\n end\n end",
"def p32(*address)\n\treturn address.pack(\"L*\")\nend",
"def ret_s\n result = ''\n func = get_func(Fiddle::TYPE_LONG)\n if func\n result = Fiddle::Pointer.new(func.call(*@args)).to_s\n end\n result\n end",
"def get_long\n get(4).unpack('l')\n end",
"def long_to_pointer(long)\n long < 0 ? long + (2 ** LPARAM_BITS) : long\n end",
"def get_ulong\n get(4).unpack('L')\n end",
"def unpack(p0) end",
"def pack tl, tm, th, ch, cl, n\nraw = [tl, tm, th, ch, cl, n].pack \"NnnCCa6\"\nret = new raw\nret.freeze\nret\nend",
"def to_ptr\n @pointer\n end",
"def to_ptr\n @pointer\n end",
"def to_ptr\n @pointer\n end",
"def to_ptr\n @pointer\n end",
"def to_ptr\n @pointer\n end",
"def pack_dword(w)\n [w & 255, w >> 8].pack(\"c*\")\n end",
"def ptr_s(va)\n (ptr_32?) ? (\"0x%.8x\" % va) : (\"0x%.16x\" % va)\n end",
"def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend",
"def fetch_long ( addr )\n\tif ( addr < @base || (addr + 3) > @limit )\n\t return nil\n\tend\n\tindex = addr - @base\n\tbytes = @im[index,4]\n\tvals = bytes.unpack \"L\"\n\tval = vals[0]\n end",
"def pack(arg)\n [self].pack(arg)\n end",
"def wrap(msg,len)\n finalmsg = [msg].pack(\"v\")\n finalLen = [len].pack(\"V\")\n return finalmsg+finalLen\nend",
"def read_pointer\n to_ptr.ptr\n end",
"def to_ptr\n @ptr\n end",
"def to_ptr\n @ptr\n end",
"def to_ptr\n @ptr\n end",
"def to_ptr\n @ptr\n end",
"def makefptr(bytestr)\n ptr = makelong(bytestr)\n ptr = ptr - 0x00800000\n return ptr\n end",
"def get_byte(offset) datap[offset].unpack('C*')[0] end",
"def value\n [offset].pack(\"L\").unpack(\"F\").first\n end",
"def pack_int64le(val)\n [val & 0x00000000ffffffff, val >> 32].pack(\"V2\")\n end",
"def ropstack_encode_pointer(pointer)\n ropstack = []\n\n epointer = encode_pointer(pointer)\n # 0x1001D695 : # POP EAX # RETN \t[Module : GCDSRV32.dll] ** \n ropstack.push(0x1001d695)\n # encoded pointer\n ropstack.push(epointer)\n\n # 0x6004803D : # POP ECX # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x6004803d)\n # key for the pointer\n ropstack.push(@@pointer_key[pointer])\n\n # fix pointer\n # 0x6004AA8A : # SUB EAX,ECX # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x6004aa8a)\n\n ropstack\n end",
"def pack\n end",
"def pointer_size\n is_64bit ? 8 : 4\n end",
"def pointer_to_long(pointer)\n pointer = pointer.to_i\n pointer > (2 ** (LPARAM_BITS - 1)) ?\n pointer - (2 ** LPARAM_BITS) : pointer\n end",
"def from_ptr(ptr)\n pointer = Fiddle::Pointer.new(ptr)\n size = 4 # Linux and OS X is 4 bytes UTF-32.\n if Helper.platform_windows?\n size = 2 # Windows UTF-16 2-byte wide chars.\n end\n\n index = 0\n result = ''\n loop do\n val = []\n size.times do |i|\n n = pointer[index + i].to_i\n val << n if n != 0\n end\n break if val.empty?\n\n index = index + size\n\n str = from_array(val)\n result = result + str\n end\n result\n end",
"def packed()\n body = @flags.chr +\n @authen_method.chr +\n @priv_lvl.chr + \n @authen_type.chr +\n @service.chr +\n @user_len.chr +\n @port_len.chr +\n @rem_addr_len.chr +\n @arg_cnt.chr\n \n body << @arg_lens.pack('C*') if (@arg_lens.length != 0)\n body << @user if (@user)\n body << @port if (@port)\n body << @rem_addr if (@rem_addr)\n body << @args.join if (@args.length != 0)\n\n return(body)\n end",
"def pack\n @volume_uuid + [@offset].pack(\"L\")\n end",
"def gen_get_block_ptr(recklass, info, blk, b, context)\r\n blab = (info[1].to_s + '+blk+' + blk[1].to_s).to_sym\r\n minfo = MethodDefinition::RubyMethod[blab][recklass]\r\n\r\n func2 = minfo[:func]\r\n if func2 == nil then\r\n argtype = minfo[:argtype].map {|ele|\r\n ele.type.llvm\r\n }\r\n rett = minfo[:rettype]\r\n rettllvm = rett.type\r\n if rettllvm == nil then\r\n rettllvm = VALUE\r\n else\r\n rettllvm = rettllvm.llvm\r\n end\r\n ftype = Type.function(rettllvm, argtype)\r\n func2 = context.builder.get_or_insert_function(recklass, blab.to_s, ftype)\r\n end\r\n context.rc = b.ptr_to_int(func2, MACHINE_WORD)\r\n context\r\n end",
"def struct_gep(ptr, idx, name = \"\")\n struct_gep2(nil, ptr, idx, name)\n end",
"def getlx ( addr )\n \"40000000\"\nend",
"def packed()\n body = TacacsPlus.pack_int_net(@user_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) +\n @flags.chr\n \n body << @user_msg if (@user_msg)\n body << @data if (@data)\n return(body)\n end",
"def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend",
"def ptr\r\n if embedded?\r\n @str.as.ary\r\n else\r\n @str.as.heap.ptr.deref\r\n end\r\n end",
"def gep(ptr, *indices)\n ptr = Convert(ptr, :pointer)\n type = ptr.type.element_type\n type = type.element_type while type == :pointer\n struct = LLVM::Script::Struct[type]\n indices.flatten!\n indices.unshift(0) if indices[0].is_a?(String) || indices[0].is_a?(Symbol) \n indices = indices.map{ |idx| idx.is_a?(String) || idx.is_a?(Symbol) ? struct.index(idx) : idx }\n @builder.gep(ptr, indices.flatten.map{|idx| Convert(idx, :integer)})\n end",
"def get_data\n return @data.unpack(\"S>*\")\n end",
"def read_pointer(buffer, offset = 0)\n unpack_pointer(buffer[offset, (offset + pointer_size)])\n end",
"def pack_int64_bigendian(value)\n (0..7).map { |index| (value >> (index * 8)) & 0xFF }.reverse.map(&:chr).join\n end",
"def assemble_buffer(direction, function, args)\n layout = {} # paramName => BufferItem\n blob = \"\"\n #puts \" building buffer: #{direction}\"\n function.params.each_with_index do |param_desc, param_idx|\n #puts \" processing #{param_desc[0]} #{param_desc[1]} #{param_desc[2]}\"\n # we care only about inout buffers\n if param_desc[2] == direction\n buffer = nil\n # Special case:\n # The user can choose to supply a Null pointer instead of a buffer\n # in this case we don't need space in any heap buffer\n if param_desc[0][0,1] == 'P' # type is a pointer\n if args[param_idx] == nil\n next\n end\n end\n\n case param_desc[0] # required argument type\n when \"PDWORD\"\n dw = param_to_number(args[param_idx])\n buffer = [dw].pack('V')\n when \"PWCHAR\"\n raise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n buffer = str_to_uni_z(args[param_idx])\n when \"PCHAR\"\n raise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n buffer = str_to_ascii_z(args[param_idx])\n when \"PBLOB\"\n raise \"param #{param_desc[1]}: please supply your BLOB as string!\" unless args[param_idx].class == String\n buffer = args[param_idx]\n # other types (non-pointers) don't reference buffers\n # and don't need any treatment here\n end\n\n if buffer != nil\n #puts \" adding #{buffer.length} bytes to heap blob\"\n layout[param_desc[1]] = BufferItem.new(param_idx, blob.length, buffer.length, param_desc[0])\n blob += buffer\n # sf: force 8 byte alignment to satisfy x64, wont matter on x86.\n while( blob.length % 8 != 0 )\n blob += \"\\x00\"\n end\n #puts \" heap blob size now #{blob.length}\"\n end\n end\n end\n #puts \" built buffer: #{direction}\"\n return [layout, blob]\n end",
"def _pack_raw(n, size)\n n.to_s(16).rjust(2 * size, \"0\").scan(/../).reverse.map{ |b|\n [b].pack('H*')[0]\n }.join.force_encoding(\"ascii-8bit\")\nend",
"def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end",
"def to_flat_a\n addr = self.addr\n addr[0, addr.size].unpack(\"F*\")\n end",
"def to_native(value, ctx)\n case\n when value.kind_of?(::FFI::Pointer)\n value\n when value.kind_of?(::FFI::Struct)\n value.to_ptr\n else\n ::FFI::Pointer.new(value.to_i)\n end\n end",
"def get_int64\n raise EOFError if @position + 8 > @size\n hi, lo = @response[@position, 8].unpack('N*N*')\n @position += 8\n return (hi << 32) + lo\n end",
"def ptr\n TestLab::Utility.ptr(self.address)\n end",
"def dl_bignum_to_ulong(x)\n if x.class == Fixnum\n return DL::PtrData.new(x)\n else\n # shut up\n c = x / 4\n e = x - (c * 4)\n v = DL::PtrData.new 0\n v += c\n v += c\n v += c\n v += c\n v += e\n return v\n end\n end",
"def byte(*bytes)\n return string(bytes.pack('C*')) \n end",
"def to_ptr\n ptr or FFI::Pointer::NULL\n end",
"def write_word32_native(val)\n pw(val, 'L')\n end",
"def to_buffer(item)\n\n #Try to convert the item to an array, and then to a string,\n #if it supports it. This allows us to easily get a byte string\n #from most Ruby types.\n #\n #Strings _shouldn't_ support either of these methods, and thus will\n #pass unaltered.\n # \n item = item.to_a if item.respond_to?(:to_a)\n item = item.pack(\"C*\") if item.respond_to?(:pack)\n \n #Create a new buffer, and fill it with our byte string.\n buffer = FFI::MemoryPointer.new(item.byte_size)\n buffer.put_bytes(0, item)\n\n #And return the filled buffer.\n return buffer\n \n end",
"def get_pointer_at(index)\n IO.binread(@path, POINTER_SIZE, HEADER_SIZE + POINTER_SIZE * index).unpack(\"N\").first\n end",
"def gen_lenptr var, ptr, len\n name = $namespace.new var\n name.declaration = \"static sourcecode_t #{name}\"\n name.definition = sprintf '%s = { %#05x, %s, };',\n name.declaration, len, ptr\n name\n end",
"def signed_byte(ret_val)\n ret_val = [ret_val].pack(\"c\").unpack(\"c\")[0]\n return ret_val\n end",
"def read_dword(unpack_method=\"L*\")\n red = self.read(4)\n if unpack_method\n return red.unpack(unpack_method)\n else\n return red\n end\n end",
"def packed()\n body = @status.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@server_msg_len,2) + \n TacacsPlus.pack_int_net(@data_len,2) \n \n body << @server_msg if (@server_msg)\n body << @data if (@data) \n return(body)\n end",
"def get_i64\n hi, lo, @data = @data.unpack(\"NNa*\")\n self.underrun! unless hi and lo\n (hi << 32) | lo\n end",
"def to_ffi_value(ffi_type)\n self.addr\n end",
"def get_data\n return @data.unpack(\"C*\")\n end",
"def next_chunk\n mwc = (new_z << 16) + new_w\n [mwc].pack('L>')\n end",
"def _unpack(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend",
"def pack_format\n \"a#{width}\"\n end",
"def pointer_for(obj)\n ::FFI::MemoryPointer.new(:uint).write_uint(obj.object_id)\n end",
"def packed()\n header = self.version.chr + \n @type.chr + \n @seq_no.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@session_id,4) + \n TacacsPlus.pack_int_net(@length,4)\n return(header)\n end",
"def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end",
"def get_short\n get(2).unpack('s')\n end",
"def get_entry(pEntry)\n return client.railgun.memread(pEntry,41).unpack('VVVVVVVVVvCCC')\n end",
"def assemble_buffer(direction, function, args)\n\t\t\t\t\t\t\tlayout = {} # paramName => BufferItem\n\t\t\t\t\t\t\tblob = \"\"\n\t\t\t\t\t\t\t#puts \" building buffer: #{direction}\"\n\t\t\t\t\t\t\tfunction.params.each_with_index do |param_desc, param_idx|\n\t\t\t\t\t\t\t\t#puts \" processing #{param_desc[0]} #{param_desc[1]} #{param_desc[2]}\"\n\t\t\t\t\t\t\t\t# we care only about inout buffers\n\t\t\t\t\t\t\t\tif param_desc[2] == direction\n\t\t\t\t\t\t\t\t\tbuffer = nil\n\n\t\t\t\t\t\t\t\t\t# Special case:\n\t\t\t\t\t\t\t\t\t# The user can choose to supply a Null pointer instead of a buffer\n\t\t\t\t\t\t\t\t\t# in this case we don't need space in any heap buffer\n\t\t\t\t\t\t\t\t\tif param_desc[0][0,1] == 'P' # type is a pointer\n\t\t\t\t\t\t\t\t\t\tif args[param_idx] == nil\n\t\t\t\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\tcase param_desc[0] # required argument type\n\t\t\t\t\t\t\t\t\t\twhen \"PDWORD\"\n\t\t\t\t\t\t\t\t\t\t\tdw = param_to_dword(args[param_idx])\n\t\t\t\t\t\t\t\t\t\t\tbuffer = [dw].pack('V')\n\t\t\t\t\t\t\t\t\t\twhen \"PWCHAR\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = str_to_uni_z(args[param_idx])\n\t\t\t\t\t\t\t\t\t\twhen \"PCHAR\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: string expected\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = str_to_ascii_z(args[param_idx])\n\t\t\t\t\t\t\t\t\t\twhen \"PBLOB\"\n\t\t\t\t\t\t\t\t\t\t\traise \"param #{param_desc[1]}: please supply your BLOB as string!\" unless args[param_idx].class == String\n\t\t\t\t\t\t\t\t\t\t\tbuffer = args[param_idx]\n\t\t\t\t\t\t\t\t\t\t# other types (non-pointers) don't reference buffers\n\t\t\t\t\t\t\t\t\t\t# and don't need any treatment here\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tif buffer != nil\n\t\t\t\t\t\t\t\t\t\t#puts \" adding #{buffer.length} bytes to heap blob\"\n\t\t\t\t\t\t\t\t\t\tlayout[param_desc[1]] = BufferItem.new(param_idx, blob.length, buffer.length, param_desc[0])\n\t\t\t\t\t\t\t\t\t\tblob += buffer\n\t\t\t\t\t\t\t\t\t\t#puts \" heap blob size now #{blob.length}\"\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#puts \" built buffer: #{direction}\"\n\t\t\t\t\t\t\treturn [layout, blob]\n\t\t\t\t\t\tend",
"def syscall_alloc(sz); ptr(Ragweed::Wrap32::virtual_alloc_ex(@h, sz)); end",
"def literal_handle(_buffer, string)\n case string\n when /^\\d{,3}$/\n return if string.size < 3\n [string.to_i].pack('U')\n when /^o([0-7]{,3})$/i\n return if Regexp.last_match(1).size < 3\n [Integer(\"0#{Regexp.last_match(1)}\")].pack('U')\n when /^x(\\h{,2})$/i\n return if Regexp.last_match(1).size < 2\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n when /^u(\\h{,4})$/\n return if Regexp.last_match(1).size < 4\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n when /^U(\\h{,8})$/\n return if Regexp.last_match(1).size < 8\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n end\n end",
"def unpack_unsigned_long(value)\n value.unpack('V')[0]\n end",
"def unpack! format\n ary = @b.unpack \"#{format}a*\"\n @b = ary.pop\n ary\n end",
"def bin2str(binary)\n str = [binary].pack(\"B*\")\n return str\nend",
"def unpack_one! format\n ary = @b.unpack \"#{format}a*\"\n @b = ary.pop\n ary[0]\n end",
"def read_long!(bytes, md)\n bytes = bytes.slice!(0..7)\n md << bytes\n bytes.unpack('q>')[0]\n end",
"def read_and_free(pointer)\n result = pointer.to_s\n pointer.free\n result\n end",
"def read_and_free(pointer)\n result = pointer.to_s\n pointer.free\n result\n end",
"def ptr(x)\r\n ret = Ragweed::Ptr.new(x)\r\n ret.p = self\r\n return ret\r\n end",
"def get_int1(offset)\n @buf[offset]\n end",
"def unpack\n if ! @unpacked && @sec_buffer && @struct\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLPLLP\")\n dataBufferSize, dType, dataBuffer, tokenBufferSize, tType, tokenBuffer = @sec_buffer.unpack(\"LLP#{dataBufferSize}LLP#{tokenBufferSize}\")\n @buffer = dataBuffer\n @struct = nil\n @sec_buffer = nil\n @unpacked = true\n end\n end",
"def ptr\r\n if embedded?\r\n @arr.as.ary\r\n else\r\n @arr.as.heap.ptr\r\n end\r\n end",
"def unpack format\n @b.unpack format\n end",
"def addr_iton(addr, v6=false)\n if(addr < 0x100000000 && !v6)\n return [addr].pack('N')\n else\n w = []\n w[0] = (addr >> 96) & 0xffffffff\n w[1] = (addr >> 64) & 0xffffffff\n w[2] = (addr >> 32) & 0xffffffff\n w[3] = addr & 0xffffffff\n return w.pack('N4')\n end\n end",
"def int2ptr(val, ty, name = \"\")\n Instruction.from_ptr(C.build_int_to_ptr(self, val, LLVM::Type(ty), name))\n end",
"def lmp(lm)\n [cadr(lm), caddr(lm)]\nend",
"def *(p0) end",
"def *(p0) end",
"def *(p0) end",
"def wrap(pointer, offset = 0)\n if offset < 0 || pointer.byte_size - offset * self.size < self.size\n ::Kernel::raise ::ArgumentError, \"pointer size is too small.\"\n end\n @pointer = pointer\n @address = @pointer.address + offset * self.size\n wrap_address\n end",
"def value\n @bytes.pack('C*')\n end",
"def reg_addr\n @cnt ||= -1\n buffer = 0x61a080\n @cnt += 1\n buffer + @cnt * 8\nend",
"def read_long; end",
"def getbyte()\n #This is a stub, used for indexing\n end"
] |
[
"0.6726432",
"0.65648407",
"0.64998645",
"0.64528",
"0.62805027",
"0.62515354",
"0.62072206",
"0.6075672",
"0.60337585",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5783891",
"0.5777143",
"0.5731012",
"0.57200515",
"0.570562",
"0.5607328",
"0.5537669",
"0.55358726",
"0.55358726",
"0.55358726",
"0.5535771",
"0.54683757",
"0.54657346",
"0.5434617",
"0.53887403",
"0.53819525",
"0.5371198",
"0.535657",
"0.53474385",
"0.53461653",
"0.5326545",
"0.53258765",
"0.5322391",
"0.5301725",
"0.52937937",
"0.5256152",
"0.52304024",
"0.5227402",
"0.5225895",
"0.5224196",
"0.5211994",
"0.52097714",
"0.520511",
"0.5190813",
"0.5174981",
"0.51736397",
"0.516746",
"0.5132429",
"0.5123996",
"0.51217204",
"0.51212204",
"0.50923055",
"0.50843024",
"0.5066311",
"0.50522244",
"0.5051645",
"0.5049968",
"0.50487834",
"0.5046655",
"0.504045",
"0.50349736",
"0.5034335",
"0.50300276",
"0.5029849",
"0.5028671",
"0.50259167",
"0.5009696",
"0.5009057",
"0.50007564",
"0.49818322",
"0.49771765",
"0.4970141",
"0.49627307",
"0.49551162",
"0.49516308",
"0.4950787",
"0.4948157",
"0.4939572",
"0.49372053",
"0.49372053",
"0.4935744",
"0.49356365",
"0.49323976",
"0.49251807",
"0.49188054",
"0.49132714",
"0.4908358",
"0.49001214",
"0.48958352",
"0.48946208",
"0.48946208",
"0.48897335",
"0.48881835",
"0.4884218",
"0.4878858",
"0.48709953"
] |
0.66304564
|
1
|
Print all odd numbers from 1 to 99, inclusive. All numbers should be printed on separate lines. create a method that takes two arguments iterate over a range creating a new array with the selected elements output that numbers on seperate lines
|
def odd_numbers(num1, num2)
(num1..num2).select { |n| n.odd? }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_odd\n range = (1..99).to_a\n range.each do |num|\n if num % 2 == 0\n puts num\n end\n end\nend",
"def print_odd(numbers)\n\tnumbers.each do |number|\n\t\tif number % 2 == 1\n\t\t\tp number\n\t\tend\n\tend\nend",
"def pares(num1, num2)\n (num1..num2).each do |par|\n puts par if par.even?\n end\nend",
"def num(num1, num2)\n (num1..num2).each do |i|\n puts i if i.even?\n end\nend",
"def print_even\n (1..99).each do |num|\n if num.even?\n puts num\n end\n end\nend",
"def basic_2\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" if n % 2 != 0 }\n puts\nend",
"def print_odd_numbers_r(bound=99, n=3)\n if iteration <= bound\n puts n\n print_odd_numbers_r(bound, n+2)\n end\n\nend",
"def odd_range(min, max)\n\tarr = []\n \tfor i in min..max\n if i % 2 != 0 \n arr << i\n end\n end\n return arr\n \nend",
"def odd_range(min, max)\n odds = []\n index = min \n \n while index <= max\n if index % 2 == 1 \n odds << index \n end \n index += 1 \n end \n \n return odds \n \nend",
"def odd_range(min, max)\n odd_numbers = []\n \n i = min\n while i <= max\n if i % 2 == 1\n odd_numbers << i\n end\n \n i += 1\n end\n \n return odd_numbers\nend",
"def oddNum arr\r\n puts (1..255).select {|i| i%2 != 0}\r\nend",
"def odd_range(min, max)\n new_arr = []\n i = min\n while i <= max\n if i % 2 != 0\n new_arr << i\n end\n i += 1\n end\n return new_arr\nend",
"def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend",
"def odd_range(min, max)\n\tarry = []\n \ti = min\n while i <= max\n if i % 2 == 0\n else\n arry << i\n end\n i += 1\n end\n return arry\nend",
"def print_odds()\n\t(1..255).step(2) { |i| print i, \" \" }\nend",
"def odd_range(min, max)\n newArr = []\n i = min\n while i <= max\n if i % 2 != 0\n newArr << i\n end\n i += 1\n end\n return newArr\n end",
"def odd_range(min, max)\n new_array = []\n i = min\n\n while i <= max\n if i % 2 != 0\n new_array << i\n end\n i += 1\n end\n\n return new_array\nend",
"def damepares(n1, n2)\n (n1..n2).each do |i|\n puts i if i.even?\n end\nend",
"def oddNum arr\n puts (1..255).select {|i| i%2 != 0}\nend",
"def even_nums(max)\n print (0..max).step(2).to_a\nend",
"def output\n @range.each do |number|\n if even_split?(number, 3)\n puts \"fizz\"\n elsif even_split?(number, 5)\n puts \"buzz\"\n else\n puts number\n end\n end\n end",
"def printOdd(number)\n (1...number).each do |num|\n num % 2 == 0 ? (nil) : (puts num)\n end\nend",
"def odd_range(min, max) # Define method with 2 params\n \n i = min # since we are being to ask to start with first param we set i to start at min; the first param\n new_array = [] # Create an empty array to shovel values into\n \n while i <= max # Sets condition\n \n if i % 2 != 0 # If statement that uses an expression to determine if number is NOT an even number, odd numbers will always equal 1, but you can also put not equal to 0. Logical expression\n new_array << i # Shovel not even number value screened by above condition into array\n end # End of if loop\n \n i += 1 # Increments each iteration by one\n end # End of method\n return new_array # Returns array values after end of method\n\nend",
"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 odd_range(min, max)\n odd_array = []\n\n i = min\n while i <= max\n if !(i % 2 == 0)\n odd_array << i\n end\n i += 1\n end\n return odd_array\nend",
"def entero(num1, num2)\n (num1..num2).each do |i|\n puts i if (i % 2).even?\n end\nend",
"def OddNumbers()\n\tputs (1..255).find_all {|i| i % 2 != 0 }\nend",
"def select_every_even array\n\n array.map!.with_index do |n, i, x| \n\n if i.even?\n puts 'i was even'\n puts x\n puts i\n puts n \n elsif i.odd?\n puts 'i was odd'\n puts x\n puts i\n puts array.slice!(i)\n end \n end\n end",
"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 number_check\n nums = [0, 1, 2, 3, 4, 5, 6 , 7, 8, 9, 10, 11, 12, 13, 14, 15]\n nums.each do |i|\n if i % 2 == 0\n puts \"#{i} even\"\n else\n puts \"#{i} odd\"\n end\n end\n end",
"def odd_range(min, max)\n odds = []\n i = min\n while i <= max\n if i % 2 == 1\n odds << i\n end\n i += 1\n end\n return odds\n end",
"def every_other_number\n number = 0\n while number < 100\n if number % 2 != 0\n puts number\n end \n number += 1\n end\nend",
"def each_odd num\n \tnum.select {|x| x % 2 != 0} \n end",
"def even_num(num)\n num.each do |element|\n if(element %2 == 1)\n p element\n end\n end\nend",
"def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend",
"def goldbach_list(range)\n range.select { |n| n % 2 == 0 }. map { |n| goldbach(n) }\nend",
"def oddNum\n for i in 1..255 \n if i%2 == 1\n puts i\n end\n end\nend",
"def A1\n arr=[*1..100]\n arr2 = []\n\tif array.each.even?\n\t\t|x| puts x \n\telsif array.each.odd?\n\t \tarr2.push(|x|)\n\tend\nend",
"def odd_numbers(array)\n end",
"def puts_even_odd(array = [1, 2, 3, 4, 5, 6, 7, 8, 9])\n puts array.select { |el| el.even? }\n puts array.select { |el| el.odd? }\nend",
"def odd_range(min, max)\n newArr = []\n\n while min <= max\n newArr << min if min % 2 == 1\n min += 1\n end\n return newArr\nend",
"def odd_range(min, max)\n (min..max).select{|num| !(num.even?) }\nend",
"def oddNum\r\n for i in 1..255 \r\n if i%2 == 1\r\n puts i\r\n end\r\n end\r\nend",
"def two(a, b)\n for i in a..b\n puts i if a.even?\n a += 1\n end\nend",
"def odd_nums_r (bound=99, n=3)\n if n <= bound\n puts n\n odd_nums_r(bound, n + 1)\n end\nend",
"def output\n @range.each { |number| puts format(number) }\n end",
"def output\n @range.each { |number| puts format(number) }\n end",
"def output\n @range.each { |number| puts format(number) }\n end",
"def even_numbers_less_than num\n array = []\n for i in 0...num\n if i % 2 == 0\n array.push(i)\n end\n end\n array\nend",
"def even_numbers_less_than num\n array=[]\n i = 0\n begin\n if (i % 2 == 0)\n array.push (i)\n end\n i+=1\n end while ( i < num)\n array\nend",
"def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend",
"def odd_integers(array)\nend",
"def another_example_of_even_odd(array)\n arr_evens = []\n arr_odds = []\n\n array.each { |num| num.even? ? arr_evens << num : arr_odds << num }\n p arr_evens \n p arr_odds\nend",
"def arr_even_square()\n [1, 3, 4, 5, 12, 23].each {|num|\n if num % 2 === 0\n puts num\n end\n }\nend",
"def oddNumbers(l, r)\nfirst_num = l.even? ? (l + 1) : l\n(first_num..r).step(2).to_a\nend",
"def even_numbers(num_array)\n\n\tnum_array.select! do |num|\n\t\tnum % 2 == 0\n\tend\n\n\tnum_array\n\nend",
"def double_odd_index_numbers(numbers)\n result = []\n numbers.each_with_index do |number,i|\n result << number*2 if i.odd?\n result << number if i.even?\n end\n result\nend",
"def oddArray\n\tarr=[]\n\tarr.push((1..255).find_all{|x| x % 2 != 0})\n\tputs arr\nend",
"def odd_num\n y = []\n [*1..255].map do |i| \n if i % 2 != 0\n y << i\n end\n end\n y\nend",
"def every_other_array(array)\n result = []\n array.each_with_index { |item, index| result << item if (index + 1).odd?}\n p result\nend",
"def select_every_odd arr\n ans = []\n arr.each_with_index do |item, i|\n if i%2 == 1 \n ans.push item\n end\n end\n ans\nend",
"def even_numbers_less_than num\n even_array = []\n for number in 0...num\n if number % 2 == 0\n even_array.push(number)\n end\n end\n return even_array\nend",
"def return_odd(list)\n odd_ones = []\n list.each_with_index do |el, index|\n unless index % 2 == 0\n odd_ones << el\n end\n end\n puts odd_ones\nend",
"def even_numbers_less_than num\n array_for_even_numbers = []\n for i in 0...num\n if i % 2 == 0\n array_for_even_numbers.push(i)\n end\n end\n return array_for_even_numbers\n\nend",
"def odd_array(numbers)\n odd_value = []\n \n numbers.each_with_index do |value, idx|\n odd_value << value if idx.even?\n end\n odd_value\nend",
"def oddities(array)\n array.select { |a| puts a if a % 2 == 0 }\nend",
"def basic_1\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" }\n puts\nend",
"def print_range\n\n\tsum = 0\n\t\n\tfor i in 1...1000 do\n\t\t\t\t\n\t\tif i%3 == 0 or i%5 == 0\n\t\t\t\n\t\t\tsum += i\n\t\t\t\n\t\t\t#just for initial tracing\n\t\t\t#puts i \n\n\t\tend\t\n\n\tend\t \n\t\t\n\tputs sum\n\t\t\nend",
"def prints_evens_and_odds(array)\n odds = []\n evens = []\n array.each {|number| number.even? ? evens << number : odds << number }\n p evens\n p odds\nend",
"def select_evens(array)\n output_array = []\n\n array.each do |number|\n if number % 2 == 0\n output_array << number\n end\n end\n\n return output_array\nend",
"def sliced_print_range\n whole_range = (@lower..@upper).to_a\n whole_range.each_slice(@size).to_a\n end",
"def q13\n numbers = [1, 2, 3, 4, 5]\n\n p numbers.select(&:odd?)\nend",
"def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend",
"def odd_elems(arr)\n arr.each do\n |el|\n next if el % 2 == 0\n puts el\n end\nend",
"def oddities(array)\nresult = []\narray.each_with_index do |value, idx|\n result << value if (idx + 1).odd?\nend\nresult\nend",
"def odd_positions(list)\n position=0\n while position <= (list.length - 1) do\n puts list[position]\n position += 2\n end\nend",
"def odds(arr)\n\tret = []\n\tarr.each_index { |i|\n\t\tif i % 2 == 1\n\t\t\tret << arr[i]\n\t\tend\n\t}\n\tret\nend",
"def odd_index_nums(array)\n array.select do |num|\n current_index = array.index(num)\n \n if current_index % 2 == 1\n num\n end\n end\nend",
"def even_num_array(numbers)\n puts \"The original array is #{numbers}\"\n\tnumbers = numbers.select {|n| n.even? } \n\tputs \"The modified array is #{numbers}\"\nend",
"def even_numbers_less_than num\n # i = 0\n # even_numbers = []\n # while i < num\n # even_numbers.push i\n # i += 2\n # end\n # return even_numbers\n\n array = []\n (0...num).each do |i|\n if i%2 == 0\n array.push i\n end\n end\n return array\nend",
"def printable_display(numbers)\n numbers.each { |i| puts i.join('') }\n end",
"def evens_below(integer)\n integer = integer - 1\n array = []\n integer.downto(0) do |i|\n if i % 2 == 0\n array << i\n end\n end \n p array\nend",
"def evenNumbers(n)\n arr = Array.new\n i = 1\n\n while arr.length < n\n i = i + 1\n if i % 2 == 0\n arr << i\n end\n end\n\n puts \"#{arr.length} and #{arr}\"\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def ex1\n for i in (0..5)\n for j in (1..(6 - i))\n print '#'\n end\n print \"\\n\"\n end\nend",
"def even_or_odd(my_nums)\n my_nums.each do |i|\n if(i%2==0)\n @numChecker << \"even\"\n else\n @numChecker << \"odd\"\n end\n end\n return \"#{@numChecker}\"\n end",
"def even_numbers_less_than num\n\t# array_of_nums = []\n\t# i = 0\n\t# while i < num\n\t# \tarray_of_nums.push(i)\n\t# \t# array_of_nums.delete_if &:odd?\n\t# \ti += 2\n\t# end\n\t# array_of_nums\n\t(0...num).select { |numbers| numbers.even? }\nend",
"def printNums(min, max, step)\n # min sets the starting i, max sets where i will stop, step will set the increment/decrement values\n i = min\n while i <= max\n puts i\n \n i += step\n end\nend",
"def even_numbers_less_than(num)\n array = (0...num).to_a\n array.select { |x| x if x.even? }\nend",
"def select_odds(numbers)\n odd_numbers = []\n \n i = 0\n while i < numbers.length\n if numbers [i] % 2 == 1\n odd_numbers << numbers [i]\n end\n \n i += 1\n end\n \n return odd_numbers\nend",
"def double_odd_numbers(numbers)\n doubled_numbers = []\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n current_number *= 2 if current_number.odd?\n doubled_numbers << current_number\n \n\n counter += 1\n end\n\n doubled_numbers\nend",
"def even_nums(max)\n result = []\n\tfor i in 0..max\n \tif i % 2 == 0 \n result << i\n end\n end\n return result\nend",
"def oddities2(arr)\n index = 0\n result = []\n loop do\n break if index >= arr.size\n result << arr[index]\n index += 2\n end\n result\nend",
"def printNums(min,max, step)\n i = min\n while i <= max\n puts i\n\n i += step\n end\nend",
"def evenlists(array)\n even = []\n j = 0\n while array.count >= j \n even << array[j]\n j +=2\n end \n p even\nend",
"def select_odds(numbers)\n index = 0 \n \n odds = [] \n \n while index < numbers.length \n if numbers[index] % 2 != 0\n odds << numbers[index]\n end \n \n index += 1 \n end \n \n return odds \n \nend",
"def for_mod(number, increment)\n\tnumbers = [] # create an empty array named and assign it to the variable numbers\n\tfor i in (0...number).step(increment) # we use Range.step(n) funtion instead of the increment i\n\t\tputs \"At the top i is #{i}\"\n\t\tnumbers.push(i) #add i to numbers array\n\t\tputs \"Numbers now: #{numbers}\"\n\t\tputs \"At the bottom i is #{i}\"\n\tend\n\treturn numbers #array\nend",
"def odd_indexed_integers(array)\n\nend",
"def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend"
] |
[
"0.845888",
"0.70679986",
"0.7051553",
"0.69453037",
"0.6926996",
"0.68728495",
"0.68418354",
"0.67936015",
"0.67302054",
"0.67041266",
"0.66925186",
"0.66859",
"0.66788906",
"0.66597515",
"0.66531456",
"0.6646816",
"0.66437536",
"0.6639255",
"0.6637021",
"0.66350055",
"0.6615106",
"0.6589281",
"0.65631545",
"0.6553079",
"0.65462375",
"0.65458786",
"0.65115494",
"0.6489112",
"0.6460759",
"0.6447169",
"0.6435119",
"0.64264894",
"0.6417702",
"0.6415605",
"0.638745",
"0.637462",
"0.6369678",
"0.6363379",
"0.6361334",
"0.63506395",
"0.6331793",
"0.62988484",
"0.6268244",
"0.6247284",
"0.62123185",
"0.6210682",
"0.6210682",
"0.6210682",
"0.6206539",
"0.616639",
"0.61563635",
"0.61520296",
"0.6147016",
"0.61458915",
"0.61045694",
"0.61037403",
"0.6101851",
"0.60999763",
"0.6089762",
"0.6070474",
"0.6051037",
"0.6026675",
"0.6012753",
"0.5994303",
"0.5982812",
"0.5978027",
"0.59677756",
"0.5961803",
"0.595298",
"0.5938194",
"0.5925991",
"0.59186125",
"0.59095424",
"0.59008",
"0.5898636",
"0.5880974",
"0.58786917",
"0.5877322",
"0.58739763",
"0.5866984",
"0.58627695",
"0.5855915",
"0.58476883",
"0.58355486",
"0.58355486",
"0.58112127",
"0.5808012",
"0.5801629",
"0.58015156",
"0.5798799",
"0.57957",
"0.5794951",
"0.5780369",
"0.57768774",
"0.57720786",
"0.5769758",
"0.5767481",
"0.5759897",
"0.57536846",
"0.57522196"
] |
0.6031004
|
61
|
Delivers integer of sum number of equipments owned by character instance
|
def total_items
items = Inventory.where(character_id: self.id)
items.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pool_acts_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.pool_acts_mod ||= 0)\n sum += mod\n end\n end",
"def character_weight\n total_weight = 0\n items = Inventory.where(character_id: self.id)\n items.each do |i|\n x = Equipment.find(i.equipment_id).weight\n total_weight += x if x \n end\n total_weight\n end",
"def battlers_number\n return @battlers_number.sum\n end",
"def consumable_item_count(item)\n if item.is_a?(RPG::BaseItem)\n if item.is_a?(RPG::Item)\n return $game_party.item_number(item)\n elsif item.is_a?(RPG::Weapon) && item.tool_itemcost_type > 0\n n = $game_party.item_number(actor.current_ammo)\n n = n.nil? ? 0 : n + 1\n return n\n elsif (item.tool_itemcost || 0) > 0\n return $game_party.item_number($data_items[item.tool_itemcost])\n end\n end\n return nil\n end",
"def number_of_calories\n self.ingredients.sum(\"calories\")\n end",
"def atk_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.batk_acts_mod ||= 0)\n sum += mod\n end\n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def total_blocks\n weapon_class_ids = self.equipped_weapons.reduce([]) do |acc, weapon|\n acc + weapon.weapon_class_ids\n end\n skills_hash = skills_ranks_hash\n total = self.equipped_weapons.length + skills_bonus(skills_hash, :bonus_blocks, weapon_class_ids)\n \"#{total} + #{self.equipped_weapons.length} panic block(s) for half your next offense budget\"\n end",
"def inventory_count\n @inventory.count\n end",
"def skill_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.skill_acts_mod ||= 0)\n sum += mod\n end\n end",
"def card_total(player_or_dealer_array)\n value_array = player_or_dealer_array.map { |v| v[1] }\n card_value_counter = 0\n \n value_array.each do |value|\n if value.is_a? Integer\n card_value_counter += value\n elsif value != 'Ace'\n card_value_counter += 10\n else\n card_value_counter += 11\n end\n end\n \n #decided total based on total number of aces. Will keep adjusting ace value to 1 until the toal is 21 or under\n value_array.select { |v| v == 'Ace'}.count.times do\n card_value_counter -= 10 if card_value_counter > 21\n end\n \n card_value_counter\nend",
"def item_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.item_acts_mod ||= 0)\n sum += mod\n end\n end",
"def chip_total(chips)\n\t\tchips = chips.to_i\n\t\t# sum each value in total\n\t\t# return chips WON/lost\n\t\tchips_won_or_lost = chips.to_i\n\t\treturn chips_won_or_lost\n\tend",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def strength\n players.map{|p| p.strength}.reduce{|sum,n| sum + n}\n end",
"def get_sum_defender_facilities\n all_facilities = 0\n @defender_facilities.each do |instance|\n all_facilities = all_facilities + instance.count\n end\n return all_facilities\n end",
"def count_ai_battler\n count = -1\n @battle_info.parties.each do |bank|\n count += bank.size\n end\n log_debug(\"Found #{count} AI\")\n return count\n end",
"def attack\n total_for(:attack) \n end",
"def total_review_character_count\n review_character_counts.inject(:+)\n end",
"def item_max\n $game_party.battle_members.size\n end",
"def quantity\n consumables.size\n end",
"def target_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.target_acts_mod ||= 0)\n sum += mod\n end\n end",
"def calorie_count\n @sugar_amount * CALORIES_PER_SUGAR_GRAM +\n @flour_amount * CALORIES_PER_FLOUR_GRAM\n end",
"def item_max\r\n @actor ? @actor.equip_slots.size : 0\r\n end",
"def product_count\n self.items.inject(0) {|sum, item| sum + item.quantity}\n end",
"def getDealTotal()\n\ttotal = 0\n\ti = 0\n\twhile i < $dealerCards.length\n\t\tx = $dealerCards.at(i)\n\t\tif x == 1\n\t\t\t$playerSoft = true\n\t\tend\t\n\t\ttotal = total + x\n\t\ti += 1\n\tend\n\treturn total\nend",
"def party_size\n @actors.size + 3\n end",
"def total (player=nil, mods=nil)\n player ||= belongs_to_player\n mods ||= modifiers(player)\n base_value + mods\n end",
"def count_items(electives)\n electives.length #counts number of items in the array\nend",
"def item_cnt(user, item)\n return 0 unless item.physical? # Hit type is not physical\n return 0 unless opposite?(user) # No counterattack on allies\n return cnt # Return counterattack rate\n end",
"def dealer_hand_total\n dealers_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def animal_count\n @inventory.length\n end",
"def inventory_without_hiting_the_database\n variants.inject(0) {|total, variant| total += variant.inventory}\n end",
"def occupation\n occupation_sum = 0\n team_roles.each do |team_role|\n occupation_sum += team_role.occupancy\n end\n return occupation_sum\n end",
"def weapon_number(weapon_id)\r\n # ハッシュに個数データがあればその数値を、なければ 0 を返す\r\n return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0\r\n end",
"def total_charged\n return self.trips.sum(&:cost)\n end",
"def all_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.all_acts_mod ||= 0)\n sum += mod\n end\n end",
"def sum_player_hand(player_hand)\n player_hand.reduce(:+)\n end",
"def amount_of_ships(user, unit_id)\n \n return @attacker_fleet.ship_groups.find_by(unit_id: unit_id).number\n end",
"def return_total_char_count(catalogue)\n total = 0\n catalogue.each_value { |value| total += value }\n total\nend",
"def total_seats_left\n [self.house_capacity - vouchers.size, 0].max\n end",
"def calculated_soak\n soak = brawn\n soak += equipped_armor.armor.soak if equipped_armor\n\n # Then increase based on selected talents.\n talent_alterations.each do |_talent_id, stat|\n stat.each do |type, value|\n soak += value['count'] if type == :soak\n end\n end\n\n cybernetics[:bonuses].each do |cb|\n soak += cb[1] if cb[0] == :soak\n end\n\n soak\n end",
"def item_max\r\n $game_party.members.size\r\n end",
"def item_max\n $game_party.members.size\n end",
"def item_max\n $game_party.members.size\n end",
"def soak\n soak = self.brawn\n\n if self.equipped_armor\n soak += self.equipped_armor.armor.soak\n end\n\n # Then increase based on selected talents.\n self.talent_alterations.each do |talent_id, stat|\n stat.each do |type, value|\n if type == :soak\n soak += value['count']\n end\n end\n end\n\n # Add soak increase from cybenetics.\n self.cybernetics[:bonuses].each do |cb|\n if cb[0] == :soak\n soak += cb[1]\n end\n end\n\n soak\n end",
"def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if tot2 > 17\n return tot2\n elsif tot2 == 17\n unless @hit_soft_17\n return tot2\n end\n end\n end\n return tot\n end",
"def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end",
"def num_characters\n Character.all.select {|character| character.actor == self}.size\n end",
"def total_life\n items.map(&:life).inject(0) { |sum, current| sum += current }\n end",
"def countPlayerPieces(owner)\n # well im pretty sure the design team is braindead.\n # I dont think i can write this without clarification of the nature of player\n # Maybe need new methods in player or does it really want me to call validateOwner\n # like 4 dozen times and then how do i get at their hand\n # Am i counting their hand or just the ones on the board\n \n end",
"def item_count\n order_items.map(&:quantity).sum\n end",
"def capacity\n\t\tcapacity = 0\n\t\trooms.all.each do |room|\n\t\t\tcapacity += room.capacity\n\t\tend\n\t\tcapacity\n\tend",
"def item_max() SES::Bestiary.get_enemy_list.size end",
"def item_max\r\n $game_troop.alive_members.size\r\n end",
"def ability_count_hash(final_character)\n count_hash = Hash.new\n gifts = [ :command, :change, :illusion, :gutter_magic ]\n ranks = final_character.ranks\n gifts.each do |gift|\n private_rank = ranks.where(item: Rank.items[gift]).first.private_rank\n lowest_rank = final_character.character_system.ranks.where(item: Rank.items[gift]).maximum(:public_rank)\n basic_num = basic_abilities(private_rank, lowest_rank)\n int_num = int_abilities(private_rank, lowest_rank)\n adv_num = adv_abilities(private_rank, lowest_rank)\n count_hash[gift] = {:basic => basic_num, :intermediate => int_num, :advanced => adv_num}\n end\n count_hash\n end",
"def weight_watchers(hash)\n calories_count = 0\n hash.each do |k, v|\n calories_count = v * CALORIES[k] + calories_count\n end\n return calories_count\nend",
"def pays_players\n self.players.inject(0) {|sum, player| sum += player.pay}\n end",
"def inventory_quantity\n return @cItemPossess.text.to_i\n end",
"def total_inventory\n inventory = Hash.new(0)\n @vendors.each do |vendor|\n vendor.inventory.keys.each do |item|\n inventory[item] += vendor.inventory[item]\n end\n end\n inventory\n end",
"def valleyCounter(n,s)\n currentAltitude = 0\n lastAltitude = 0\n index = 0\n numberOfValleys = 0\n s.each_char do |char|\n if char == \"U\"\n currentAltitude += 1\n lastAltitude = currentAltitude - 1\n else\n currentAltitude -= 1\n lastAltitude = currentAltitude + 1\n end\n if currentAltitude == 0 && lastAltitude < 0\n numberOfValleys += 1\n end\n end\n puts numberOfValleys\nend",
"def total\n total = 0\n aces = 0\n @hand.each do |card|\n case card[0]\n when 2..10 then total += card[0]\n when 'A' then aces += 1\n else total += 10\n end\n end\n total += add_aces(total, aces)\n total\n end",
"def total_count\n @total_count ||= @possibility_distribution.inject(0) { |sum, n| sum + n.last }\n end",
"def wealth\n @gold + inventory_worth\n end",
"def player_capacity\n 2\n end",
"def count_items(elective_array)\n return elective_array.length\nend",
"def enrollee_count\n count = 0\n courses.each do |c|\n count += c.course.all_enrollee_count\n end\n count += extra_enrollees.size\n count\n end",
"def dessert_item_count\n desserts = @menu[:desserts]\n total = 0\n desserts.each { |k, v| total += v.size }\n total\n end",
"def item_count\n self.line_items.inject(0) { |total, line_item| total + line_item.quantity }\n end",
"def space_available\n\t\tspaceTaken = 0\n\t\t#add up the size of all items inside player's inventory\n\t\tfor i in @inventory\n\t\t\tspaceTaken = spaceTaken + i.size\n\t\tend #for\n\t\t#return the difference between what's carried and the max capacity\n\t\treturn @capacity - spaceTaken\n\tend",
"def getPlayTotal()\n\ttotal = 0\n\ti = 0\n\twhile i < $playerCards.length\n\t\tx = $playerCards.at(i)\n\t\tif x == 1\n\t\t\t$playerSoft = true\n\t\tend\t\n\t\ttotal = total + x\n\t\ti += 1\n\tend\n\treturn total\nend",
"def get_player_total(player_hand)\n\tplayer_total = 0 \t\t# Total value of player's hand\n\n\tfor i in 0..player_hand.length - 1\n\t\tplayer_total += $cards[player_hand[i]]\n\tend\n\treturn player_total\nend",
"def related_count(type)\n cyc.talk(\"(length (#{type.to_s.gsub(\"_\",\"-\")} #{self.to_cyc}))\").to_i\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def pokemon_actual\n actual = @pokemones[@pokemon_actual]\n @pokemon_actual += 1\n actual\n end",
"def total_owed_amount(ower)\n return data[ower] ? data[ower].values.reduce(:+) : 0\n end",
"def orb_count (orb, turn)\n return orb[turn].inject(:+)\n end",
"def count_enemies()\r\n _enemy_nb = 0\r\n for i in 0..3\r\n if @warrior.feel(DIRECTIONS[i]).enemy?\r\n _enemy_nb += 1\r\n end\r\n end\r\n return _enemy_nb\r\n end",
"def score\n dealt.inject(0){|sum,card| sum + card.value}\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end",
"def inventory_worth\n get_worth_of( shared_inventory )\n end",
"def disenchantGoldens\n\t\tdust = 0\n\t\tn = 0\n\t\tfor card in @cards[TOTAL_UNIQUE_CARDS..2*TOTAL_UNIQUE_CARDS-1]\n\t\t\textras = card.removeAll\n\t\t\tdust += card.disenchant_value * extras\n\t\t\tn += extras\n\t\tend\n\t\treturn dust, n\n\tend",
"def count\n @deck.count\n end",
"def calculate_num_adjs(num_rooms, num_chairs, num_wings)\n\t\t \t#residue is how many higher rooms will have an \"extra\"\n\t\t \tresidue = num_wings % num_rooms;\n\n\t\t \t#q is how many each room should have minimum\n\t\t \t#the 1 represents the chair\n\t\t \t#num_wings / num_rooms is how wing allocations per room we can definitely do\n\t\t \tq = 1 + num_wings / num_rooms; #this will naturally floor()\n\n\t\t \textra = 0; #assume no extra\n\t\t \t#if in upper lot of rooms, assign 1 extra wing\n\t\t \tif (residue != 0) && (@num_rooms_assigned <= residue)\n\t\t \t\textra = 1;\n\t\t \tend\n\t\t \t\n\t\t \treturn (q + extra);\n\t\t end",
"def count_total()\n self.regulatory_elements.count\n end",
"def move_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.move_acts_mod ||= 0)\n sum += mod\n end\n end",
"def total_kills\n mob_kills + player_kills\n end",
"def owner_pet_count(owner)\n return owner[:pets].length()\nend",
"def battler_count(bank)\n count = 0\n $game_temp.vs_type.times { |i| count += 1 if battler(bank, i)&.dead? == false }\n return count\n end",
"def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend",
"def count\n @letters.length\n end",
"def tiles_remaining\n # still not sure why or how this is working. TODO: may take out later\n total_num_tiles = @default_set.inject(0) { |letter, letter_quantity| letter += letter_quantity[1] }\n p \"++++TEST++++\"\n p total_num_tiles\n return total_num_tiles\n end",
"def count\n @deck.size\n end",
"def increase_used\n self[:numUsed] += 1\n end",
"def count_unit_type unit_type\n count = 0\n warrior.listen.each do |unit|\n count += 1 if unit.to_s.to_sym == unit_type\n end\n return count\n end",
"def total_num_items\n line_items.reduce(0) { |sum, item| sum + item.quantity }\n end",
"def total\n sum = 0\n hand.each do |card|\n sum += card.find_face_value\n end\n sum = correct_for_aces(sum)\n end",
"def get_sum_defender_units\n all_units = 0\n @defender_fleet.ship_groups.each do |group|\n all_units = all_units + group.number\n end\n return all_units\n end",
"def same_model_count(reservations)\n count = 0\n reservations.each { |res| count += 1 if (res.equipment_model == self.equipment_model) }\n count\n end",
"def chuck_wood(num)\n\t\t@chuck_count += num\n\tend"
] |
[
"0.6859731",
"0.68530625",
"0.65938455",
"0.6434458",
"0.6389056",
"0.6367064",
"0.62905943",
"0.62845594",
"0.62666035",
"0.62512994",
"0.62505794",
"0.6243097",
"0.62177783",
"0.62088156",
"0.6208674",
"0.619741",
"0.6176754",
"0.6137139",
"0.6111489",
"0.61032027",
"0.609677",
"0.6095965",
"0.6088908",
"0.6074874",
"0.60722226",
"0.60573596",
"0.6048243",
"0.6043297",
"0.6030856",
"0.6010209",
"0.5991371",
"0.59911525",
"0.59711",
"0.59577066",
"0.5956581",
"0.5934262",
"0.5921576",
"0.5904347",
"0.5890852",
"0.58797336",
"0.58698124",
"0.5862914",
"0.5852294",
"0.5845553",
"0.5845553",
"0.58396137",
"0.58393395",
"0.58392715",
"0.58331466",
"0.5827248",
"0.5823589",
"0.58225614",
"0.581419",
"0.58126104",
"0.58122396",
"0.5808438",
"0.5798468",
"0.5794409",
"0.5781606",
"0.5776082",
"0.5766977",
"0.5765084",
"0.5759612",
"0.57554555",
"0.57463884",
"0.57369024",
"0.5735355",
"0.5722081",
"0.5714289",
"0.57069457",
"0.57036144",
"0.56981444",
"0.5690299",
"0.5689273",
"0.56760347",
"0.5675105",
"0.56736916",
"0.56699854",
"0.5669834",
"0.5661222",
"0.5660337",
"0.5659418",
"0.56531334",
"0.5647713",
"0.5636922",
"0.56317616",
"0.56313515",
"0.56287783",
"0.56265604",
"0.56253016",
"0.5619583",
"0.56180936",
"0.56168276",
"0.5616382",
"0.56160164",
"0.5613989",
"0.5611905",
"0.5605909",
"0.5605235",
"0.5604537"
] |
0.6991001
|
0
|
Delivers integer describing sum of equipments owned weights
|
def character_weight
total_weight = 0
items = Inventory.where(character_id: self.id)
items.each do |i|
x = Equipment.find(i.equipment_id).weight
total_weight += x if x
end
total_weight
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def weight\n self.ingredients.map{|i| i.quantity}.reduce(:+)\n end",
"def weightedsum\n ws = 0\n @inputs.each_index { |i| ws = ws + @inputs[i]*@weights[i] }\n ws\n end",
"def total_weight\n order_items.collect { |oi| oi.weight }.inject { |sum, x| sum + x } || 0\n end",
"def calculate_weight\n update_attribute :weight, votes.sum(:value)\n weight\n end",
"def total_weight\r\n\t\t@items.inject(0.0) { |sum, i| sum + i.total_unit_weight * i.quantity }\r\n\tend",
"def calc_total_weight\n 0\n end",
"def weight\n product_weight * quantity\n end",
"def weight\n product_weight * quantity\n end",
"def compute_weight object\n object.line_items.map { |li| (li.variant.weight || 0) * li.quantity }.sum\n end",
"def weight\n sides.map(&:weight).reduce(&:+)\n end",
"def weighted_sum\n index = 0\n sum = 0\n\n while index < id_digits.size\n sum += id_digits[index] * CHARACTER_WEIGHTS[index]\n index += 1\n end\n\n sum\n end",
"def total_weight\n line_items.map(&:weight).sum\n end",
"def get_worth_of(inventory)\n inventory.inject(0) { |sum, inv| (inv.respond_to? :price) ? (sum + inv.price) : (sum) } \n end",
"def total_weight\n order_items.inject(BigDecimal(0)) { |t,i| t + i.total_weight}\n end",
"def weight\n 2 # ounces\n end",
"def weight\n 0\n end",
"def calcWeightAndValue(possible_solution)\r\n \r\n @sum_weight=0\r\n @sum_value=0\r\n \r\n (0...@optionSize).each do |idx|\r\n if possible_solution.m_Data[idx] \r\n\r\n @sum_weight += @itemWeight[idx].to_f\r\n @sum_value += @itemValue[idx].to_f\r\n\r\n end \r\n end\r\n \r\n end",
"def calculate_weighted_sum(base, weight_factors); end",
"def total_owed_amount(ower)\n return data[ower] ? data[ower].values.reduce(:+) : 0\n end",
"def box_weight_sum\n num1 = @quantity_per_box\n num2 = @item_weight\n sum = num1 * num2\n sum.round(2)\n end",
"def rating_sum(wastes)\n wastes.inject(0) { |sum, v| sum + v.rating }\n end",
"def pool_acts_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.pool_acts_mod ||= 0)\n sum += mod\n end\n end",
"def weight\n if box\n box.weight * self.quantity\n else\n raise \"Weight not known.\"\n end\n end",
"def strength\n players.map{|p| p.strength}.reduce{|sum,n| sum + n}\n end",
"def wealth\n @gold + inventory_worth\n end",
"def weight\n return data.weight\n end",
"def total_score\n rank_items.to_a.sum { |item| item.rank_score * item.weight }\n end",
"def weight; end",
"def product_weight\n price_calculator.weight\n end",
"def weight\n return @weight\n end",
"def weight_in_stones\n\t\t((@weight * 2.20462) / 14).to_i\n\tend",
"def weighted_score\n score * metric.weight\n end",
"def query_all_weight\n d = 0 \n eqs = query_all_wearings\n p \"=>wearing=#{eqs.inspect}\"\n eqs.each {|k,v|\n d+= v.weight if v\n }\n return d\n end",
"def total_weight\n\t\tif catogery_id == 1\n\t\t\tfomular_1 * amount_qty\n\t\telsif category_id == 2\n\t\t\tfomular_2 * amount_qty\n\t\telsif category_id == 3\n\t\t\tfomular_3 * amount_qty\n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"def inventory_worth\n get_worth_of( shared_inventory )\n end",
"def total_iron\n food.iron * quantity\n end",
"def weight\n\t\tweight = 0\n\t\tself.order_line_items.each do |item|\n\t\t\tweight += item.quantity * item.product.weight\n\t\tend\n\t\treturn weight\n\tend",
"def weight(index)\n index.nil? ? 0 : (FIRST_INTEGER_WEIGHT - index)\n end",
"def prom_weight\n if pet_histories.length > 0\n promw= pet_histories.sum(:weight)\n promw/pet_histories.length\n else\n \"0\"\n end\n end",
"def activation(dendrites, nueron_number)\n\tweights=Array.new\n\ttotal_value=0\n\tfor i in 0...dendrites.size\n\t\tvalue=dendrites[i].print_value \n\t\tweights=dendrites[i].print_weight\n\t\ttotal_value=total_value + (weights[nueron_number-1]*value)\n\tend\n\treturn total_value\nend",
"def profitability\n # based on \n # @pools.map { |p| }.sum\n end",
"def weight\n options.reduce(0) { |memo, option| option.weight > 0 ? memo + option.weight : memo }\n end",
"def total_sodium\n food.sodium * quantity\n end",
"def weed_amount\n\t (params[:user][:weed]).to_i\n end",
"def total (player=nil, mods=nil)\n player ||= belongs_to_player\n mods ||= modifiers(player)\n base_value + mods\n end",
"def skill_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.skill_acts_mod ||= 0)\n sum += mod\n end\n end",
"def addweight(w)\n @weight += w\n end",
"def item_bonus\n features_sum(:item_bonus)\n end",
"def ndp_sum=(i); typecast i; end",
"def item_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.item_acts_mod ||= 0)\n sum += mod\n end\n end",
"def ndp_sum; self[:ndp_sum].to_i; end",
"def weight\n questions.reduce(0) { |memo, question| question.weight > 0 ? memo + question.weight : memo }\n end",
"def sum_player_hand(player_hand)\n player_hand.reduce(:+)\n end",
"def total_unit_weight\r\n\t\ttotal = self.unit_weight\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_weight\r\n\t\tend\r\n\r\n\t\ttotal\r\n\tend",
"def total_unit_weight\r\n\t\ttotal = self.unit_weight\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_weight\r\n\t\tend\r\n\r\n\t\ttotal\r\n\tend",
"def total_votes\n votes.sum(:weight)\n end",
"def reduce_weight \n @weight -= WEIGHT_INCREMENT\n # increment could be confusing and imply an increase rather than a decrease \n # but it is being reduced by increments of 10 so it makes sense??? \n # It's the best of the names that came to mind.\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def sell_bonus\n bonus = 0.0\n battle_members.each { |member| bonus += member.sell_bonus }\n bonus\n end",
"def weight\n @mass * @hopper.size\n end",
"def weight\n order_lines.inject(0) { |sum, l| sum + l.weight }\n end",
"def get_total_weight(line_items)\n line_items.map do |li|\n # use default item weight if the weight is not defined for a product\n item_weight = li.variant.weight.nil? ? self.preferred_default_item_weight : li.variant.weight\n item_weight * li.quantity\n end.sum\n end",
"def get_total_weight(line_items)\n line_items.map do |li|\n # use default item weight if the weight is not defined for a product\n item_weight = li.variant.weight.nil? ? self.preferred_default_item_weight : li.variant.weight\n item_weight * li.quantity\n end.sum\n end",
"def get_weight_unit_for_exercise(workout_type, exercise_name)\n return ExerciseType.find_by(name: exercise_name, workout_type_id: workout_type.id).weight_unit.id.to_int\n end",
"def remaining_pints\n ((current_weight-14.25)/0.45).to_i > 0 ? ((current_weight-14.25)/0.45).to_i : 0\n end",
"def max_duffel_bag_value(cake_types, max_weight)\n cake_types.map do |type|\n #check if the max_weight is evenly divisible by the\n if max_weight % type[0] === 0\n value = (max_weight / type[0]) * type[1]\n else\n # if not, find the number of times that the\n #max_weight is evenly divisible by the type's weight\n # and calculate a value that we will add to \n remainder = max_weight / type[0]\n value = remainder * type[1]\n end\n\n if cake_types.count > 1 && remainder != nil\n other_types = cake_types.find_all do |typ|\n typ != type\n end\n\n\n #for the other types of cake,\n #check if the remainder is divisible by each weight\n # if it is divide it by the weight and multiply by the value\n #add this number to the value\n #***this doesn't take into account situations where it is not evenly divisible\n #but where we could still add to the weight value***\n options = other_types.map do |cake_type|\n if remainder % cake_type[0] == 0\n value = value + (remainder/type[0]) * type[1]\n end\n end\n end\n value\n end.max\nend",
"def total_potassium\n food.potassium * quantity\n end",
"def weighted_sum(value, weights)\n digits = value.split('').map { |d| d.to_i }\n weights = weights.cycle.take(digits.count) if weights.count < digits.count\n digits.zip(weights).inject(0) { |s,p| s + p[0] * p[1] }\n end",
"def total_vitaminD\n food.vitaminD * quantity\n end",
"def weight_watchers(hash)\n calories_count = 0\n hash.each do |k, v|\n calories_count = v * CALORIES[k] + calories_count\n end\n return calories_count\nend",
"def knapsack_table(weights, values, capacity)\n return 0 if capacity == 0 \n solution = [] \n sum_val = 0\n weights.each_with_index do |weight, idx| \n if capacity - weight >= 0 \n sum_val += values[idx] \n capacity -= weight \n end \n end \n len = weights.length\n sum_val\n end",
"def currentWeight() weighins.last.weight end",
"def knapsack_table(weights, values, capacity)\n return 0 if capacity == 1\n end",
"def calc_class(weights)\n sum = weights.inner_product @attributes\n if sum > 0\n 1\n else\n 0\n end\n end",
"def target_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.target_acts_mod ||= 0)\n sum += mod\n end\n end",
"def get_total_weight(line_items)\n line_items.map do |li|\n # use default item weight if the weight is not defined for a product\n item_weight = li.variant.weight.nil? ? self.preferred_default_item_weight : li.variant.weight\n item_weight * li.quantity\n end.sum\n end",
"def party_worth\n get_worth_of( shared_inventory + actors_inventory )\n end",
"def weight\n @parents.inject(1) { |res, p| res + p.weight * @parent_multiplier }\n end",
"def calc_total_weight_to_s\n calc_total_weight.to_s\n end",
"def target_value\n items.reduce(0) do |sum, item|\n sum + item.target * item.price\n end\n end",
"def vote_weights\n @vote_weights ||= offers.map(&:booking).compact.flat_map(&:votes_for).map(&:vote_weight)\n end",
"def battlers_number\n return @battlers_number.sum\n end",
"def bonus multiplier\n employee_salary = @underlings.reduce(0){|sum, employee|\n sum + employee.salary + (employee.class == Manager ? employee.sum_of_underlings : 0)\n }\n employee_salary * multiplier\n end",
"def weight\n puts 'used custom getter'\n 2\n end",
"def total_owed\n self.appointments.sum(:cost)\n end",
"def weighted_score\n return nil if self.points.nil?\n self.points * self.weighting / self.maximum_points\n end",
"def calculated_wounds\n wound_th = brawn\n wound_th += race.wound_threshold if race && race.wound_threshold\n # Then increase based on selected talents.\n talent_alterations.each do |_talent_id, stat|\n stat.each do |type, value|\n wound_th += value if type == :wound\n end\n end\n wound_th\n end",
"def atk_lmt_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.batk_acts_mod ||= 0)\n sum += mod\n end\n end",
"def knapsack(weights, values, capacity)\n\n end",
"def total_cholesterol\n food.cholesterol * quantity\n end",
"def total_saturated\n food.saturated * quantity\n end",
"def value\n @items.map{ |x| x.price * x.quantity}.inject(:+)\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def total_servingSize\n food.servingSize * quantity\n end",
"def compute_weighted_overall_score\n (Player::Feedback::FIT_WEIGHT * avg_fit_score +\n Player::Feedback::PUNC_WEIGHT * avg_punctuality_score +\n Player::Feedback::SKILL_WEIGHT * avg_skill_score +\n Player::Feedback::PERS_WEIGHT * avg_personality_score)\n end",
"def fow_bonus(unit)\n return 0\n end",
"def qty_to_add\n 0\n end",
"def qty_to_add\n 0\n end",
"def total_cost\n ingredients_cost + components_cost\n end"
] |
[
"0.71391046",
"0.7086918",
"0.6982984",
"0.68481654",
"0.6818408",
"0.6754476",
"0.6699343",
"0.6699343",
"0.66631263",
"0.66443664",
"0.66359967",
"0.6633059",
"0.66157764",
"0.6575519",
"0.6495228",
"0.6480172",
"0.6399907",
"0.63695735",
"0.6368915",
"0.6348292",
"0.633856",
"0.6298999",
"0.62565076",
"0.6251182",
"0.6216112",
"0.6211444",
"0.6189942",
"0.61778396",
"0.6177347",
"0.6167231",
"0.6164847",
"0.6163437",
"0.6158724",
"0.6157288",
"0.61472243",
"0.61396646",
"0.6138325",
"0.6124386",
"0.6121486",
"0.6107623",
"0.60717446",
"0.6057786",
"0.60555345",
"0.6052453",
"0.6036701",
"0.6035367",
"0.60316885",
"0.6008843",
"0.6006793",
"0.6003616",
"0.60016066",
"0.5997662",
"0.5995098",
"0.598883",
"0.598883",
"0.5975926",
"0.59744793",
"0.59702104",
"0.59634256",
"0.59583765",
"0.5945492",
"0.5936975",
"0.5936975",
"0.59366125",
"0.5924727",
"0.59247035",
"0.59172314",
"0.5914875",
"0.5911976",
"0.591166",
"0.59101355",
"0.5903275",
"0.5898876",
"0.58860916",
"0.5879785",
"0.58678156",
"0.5866846",
"0.5865363",
"0.5854982",
"0.58482486",
"0.5844183",
"0.58433986",
"0.5839478",
"0.58343965",
"0.583073",
"0.58254725",
"0.58251184",
"0.58201003",
"0.58082366",
"0.58053035",
"0.5797164",
"0.57919943",
"0.5786333",
"0.5786333",
"0.57846653",
"0.578345",
"0.57623875",
"0.57538044",
"0.57538044",
"0.5750517"
] |
0.64749855
|
16
|
GET /bestgames/1 GET /bestgames/1.json
|
def show
@bestgame = Bestgame.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @bestgame }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = current_user.games\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def show\n render json: @games_leaderboard\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n @home_team = Team.find(@game.home_team_id)\n @away_team = Team.find(@game.away_team_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def show\n render json: @game\n end",
"def index\n @games = Game.find_all_by_meeting_id(@meeting.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n @player_games = current_user.games rescue nil\n @ongoing_games = Game.where(outcome: 'In progress').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gameplay }\n end\n end",
"def show\n @user = User.find(params[:user_id]) \n @game = @user.games.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def index\n @games = Game.paginate page: params[:page], order: 'created_at desc', per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n if Game.last\n @game = Game.find(params[:id])\n render json: @game\n else\n @game = Game.create()\n render json: @game\n end\n end",
"def show\n @game = Game.instance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n render json: Game.find(params[:id])\n end",
"def index\n @video_games = VideoGame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @video_games }\n end\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end",
"def index\n game = Game.find(params[:game_id])\n @player_games = game.player_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @player_games }\n format.json { render :json => @player_games}\n end\n end",
"def game\n fetch('games.super_mario.games')\n end",
"def show\n @old_game = OldGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @old_game }\n end\n end",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def show\n @game_tournament = GameTournament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_tournament }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arcade_games }\n end\n end",
"def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bet_scores }\n end\n end",
"def show\n @game = Game.find_by_id(params[:id])\n\n unless @game\n flash[:error] = \"Game not found.\"\n redirect_to games_path\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @player_game = PlayerGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @player_game }\n end\n end",
"def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end",
"def index\n @games = Game.all\n raise RecordNotFound, 'No records on games' if @games.empty?\n\n # TODO: Just for Test. Do not forget to delete when finish the test.\n # raise 'error !!'\n # sleep 1\n\n render 'index', formats: 'json', handlers: 'jbuilder'\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end",
"def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end",
"def index\n @games = current_creator.games\n redirect_to root_path\n end",
"def index\n if params[:term]\n @games = Game.search(params[:term]).paginate(page: params[:page], per_page: 10)\n elsif params[:filter]\n @filter = params[:filter]\n ids = []\n if @filter == 'popular'\n Game.popular(25).each { |k, _v| ids << k }\n elsif @filter == 'favorited'\n Game.favorited(25).each { |k, _v| ids << k }\n elsif @filter == 'owned'\n Game.owned(25).each { |k, _v| ids << k }\n elsif @filter == 'recent'\n Game.recently_added(25).each { |g| ids << g }\n elsif @filter == 'import'\n Game.none\n end\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n else\n ids = []\n Game.popular(25).each { |k, _v| ids << k }\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n end\n\n respond_to do |format|\n format.json.array! @games, partial: 'game.json'\n end\n end",
"def show\n @game_stat = GameStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_stat }\n end\n end",
"def show_game\n @game = Event.where(\n game_id: params[:game_id]\n ).order(:game_date, :id)\n\n render json: @game, status: 200\n end",
"def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @games = Game.all\n end",
"def index\n listing_games\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def games_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.games_get ...\"\n end\n # resource path\n local_var_path = \"/games\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#games_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @player = Player.find(params[:id])\n if @player.games.count >= 1\n @last_team_name = @player.games.find(:last).team_name\n @year = @player.games.first.date.year\n @newest_year = @player.games.last.date.year\n else\n @last_team_name = \"Your team name\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player }\n end\n end",
"def index\n @games = @theme.games.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @games.to_xml }\n end\n end",
"def index\n if params[:show] == \"upcoming\"\n @games = Game.where(:final => false).order(\"kickoff\")\n else\n @games = Game.order(\"kickoff\")\n end\n\n # Find all tips for the currently logged in user\n setup_user_tips_hash\n setup_winners_right_now\n calculate_odds\n\n # Get the leaders for the sidebar\n @leaders = User.order(\"points DESC\").limit(10)\n\n # Find the latest comment. For the polling to work.\n @last_comment = Comment.order(\"updated_at DESC\").first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @game_game_instance = Game::GameInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_game_instance }\n end\n end",
"def show\n @video_game = VideoGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video_game }\n end\n end",
"def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end",
"def new\n @bet = Bet.new\n @games = Game.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def index\n @games = current_user.games\n @my_turns = current_user.games.my_turn\n\n respond_to do |format|\n format.html do\n @game = Game.new # for the form\n render :action => 'index'\n end\n format.json do\n render json: (params[:my_turn] ? @my_turns : @games)\n end\n end\n end",
"def index\n\t\t@games = Game.all\n\tend",
"def show\n @user = User.find(params[:id])\n @games = @user.games\n\n end",
"def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link').inner_html,\n :description => (item/:description).inner_html,\n :gameid => pull_gameid((item/'link').inner_html)\n }\n end\n return games\n end",
"def index\n @game_servers = Game::Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_servers }\n end\n end",
"def index\n if params[:term]\n @games = Game.search(params[:term]).paginate(page: params[:page], per_page: 10)\n elsif params[:filter]\n @filter = params[:filter]\n ids = []\n if @filter == 'popular'\n Game.popular(25).each { |k, _v| ids << k }\n elsif @filter == 'favorited'\n Game.favorited(25).each { |k, _v| ids << k }\n elsif @filter == 'owned'\n Game.owned(25).each { |k, _v| ids << k }\n elsif @filter == 'recent'\n Game.recently_added(25).each { |g| ids << g }\n elsif @filter == 'import'\n Game.none\n end\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n else\n ids = []\n Game.popular(25).each { |k, _v| ids << k }\n @games = Game.for_ids_with_order(ids).paginate(page: params[:page], per_page: 10)\n end\n\n respond_to do |format|\n format.html\n format.json.array! @games, partial: 'game.json'\n format.js\n end\n end",
"def index\n @games = Game.get_all_active\n end",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @team_schedule = Schedule.all.where(laxid: params[:laxid]).last[:games]\n ap @team_schedule\n respond_to do |format|\n format.json{render json: @team_schedule}\n end\n end",
"def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end"
] |
[
"0.75343937",
"0.7344581",
"0.726822",
"0.7268165",
"0.7268165",
"0.7268165",
"0.7207151",
"0.71713203",
"0.71511453",
"0.71043414",
"0.7099059",
"0.69591147",
"0.6954685",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.69472194",
"0.6920973",
"0.69202876",
"0.68848336",
"0.687377",
"0.6865297",
"0.6837113",
"0.68339455",
"0.68331146",
"0.68048626",
"0.67762846",
"0.6770812",
"0.67684096",
"0.6767163",
"0.67458975",
"0.67227626",
"0.67059904",
"0.6688201",
"0.6674536",
"0.6674092",
"0.6621043",
"0.65862775",
"0.65841424",
"0.6566527",
"0.65622836",
"0.6561549",
"0.6557632",
"0.6555743",
"0.6543743",
"0.6543063",
"0.6538021",
"0.65342414",
"0.6530739",
"0.65304464",
"0.65282553",
"0.6526873",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65247273",
"0.65092355",
"0.6503186",
"0.64995015",
"0.64990735",
"0.64947414",
"0.6487523",
"0.6458266",
"0.64532983",
"0.64412457",
"0.6421901",
"0.64210075",
"0.64011365",
"0.63974255",
"0.6384861",
"0.6376405",
"0.6373307",
"0.6369545",
"0.6369334",
"0.6369334",
"0.63671225",
"0.63588583"
] |
0.7781176
|
0
|
GET /bestgames/new GET /bestgames/new.json
|
def new
@bestgame = Bestgame.new
@player_select_data = Player.all.collect{|p| [p.name, p.id]}
@lineup_select_data = ""
@non_lineup_select_data = Player.all.collect{|p| [p.name, p.id]}
respond_to do |format|
format.html # new.html.erb
format.json { render json: @bestgame }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @game = Game.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @old_game = OldGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @old_game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @bet = Bet.new\n @games = Game.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def new\n\t\t@game = Game.new\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game }\n format.json { render json: @game }\n end\n end\n\tend",
"def new\n populate_players\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @gameplay = Gameplay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gameplay }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @game = @user.games.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end",
"def new\n @teams = Team.find(:all, :order => 'name ASC').collect {|t| [ t.name, t.id ] }\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def new\n @game_tournament = GameTournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_tournament }\n end\n end",
"def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end",
"def create\n @bestgame = Bestgame.new(params[:bestgame])\n\n respond_to do |format|\n if @bestgame.save\n format.html { redirect_to @bestgame, notice: 'Bestgame was successfully created.' }\n format.json { render json: @bestgame, status: :created, location: @bestgame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bestgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n format.json { render :json => @game }\n end\n end",
"def new\n @gameboard = Gameboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gameboard }\n end\n end",
"def new\n @user_game = UserGame.new\n\n respond_to do |format|\n format.json { render json: @user_game }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @player_game = PlayerGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @player_game }\n end\n end",
"def new\n @game_stat = GameStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_stat }\n end\n end",
"def new\n @game_instance = GameInstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_instance }\n end\n end",
"def new_game\n\tresponse\n\tif params[\"difficulty\"]\n\t\tdifficulty = params[\"difficulty\"]\n\t\tsettings.game_data = Ben::Game.new( Integer difficulty )\n\t\tresponse = game_json\n\telse\n\t\tresponse = \"Server couldn't load new game.\"\n\tend\n\treturn response\nend",
"def new\n @game_score = GameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_score }\n end\n end",
"def new\n @comp = Comp.new\n\t@games = Game.find_all_by_comp_id(nil)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comp }\n end\n end",
"def new\n @game = Game.new\n\n @corporations = Corporation.order(:faction, :slogan)\n @runners = Runner.order(:faction, :name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game_game_instance = Game::GameInstance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_game_instance }\n end\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def new\n @game_code = GameCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_code }\n end\n end",
"def new\n game = Game.find(params[:game_id])\n @player_game = PlayerGame.new\n @player_game.game = game\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player_game }\n format.json { render :json => @player_game}\n end\n end",
"def new\n @rock = Rock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rock }\n end\n end",
"def new\n @bet_score = @match.bet_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet_score }\n end\n end",
"def new\n @tournament = Tournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @game_player = GamePlayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_player }\n end\n end",
"def new\n @winner = Winner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @winner }\n end\n end",
"def new\n @video_game = VideoGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_game }\n end\n end",
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def new\n @game_system = GameSystem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_system }\n end\n end",
"def new\n @player_game_stat = PlayerGameStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player_game_stat }\n end\n end",
"def new\n @rink_league = RinkLeague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rink_league }\n end\n end",
"def new\n @game_server = Game::Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_server }\n end\n end",
"def new\n @game_source = GameSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_source }\n end\n end",
"def new\n (kick and return) if not is_god?\n @team = Team.new\n @mode = :new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @game = Game.new\n @home_team = Team.new\n @away_team = Team.new\n @players = Player.order :firstname, :lastname\n \n names = [\"Predators\", \"Lions\", \"Railers\", \n \"Tornadoes\", \"Steamrollers\", \"Beachcombers\",\n \"Gladiators\", \"Gorillas\", \"Jugernauts\"].sort_by { rand }\n @home_team.name = names.pop\n @away_team.name = names.pop\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game_watch = GameWatch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_watch }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def new\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def show\n if Game.last\n @game = Game.find(params[:id])\n render json: @game\n else\n @game = Game.create()\n render json: @game\n end\n end",
"def new\n @battle = Battle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @battle }\n end\n end",
"def new\n @military_battle_round = Military::BattleRound.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @military_battle_round }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def create\n @old_game = OldGame.new(params[:old_game])\n\n respond_to do |format|\n if @old_game.save\n format.html { redirect_to @old_game, notice: 'Old game was successfully created.' }\n format.json { render json: @old_game, status: :created, location: @old_game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @old_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end",
"def new\n @play = Play.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @play }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @swim_team = SwimTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @swim_team }\n end\n end",
"def new\n @local_league = LocalLeague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @local_league }\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n end\n end",
"def new\n @season = Season.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @season }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @colleague = Colleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colleague }\n end\n end",
"def new\n @colleague = Colleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colleague }\n end\n end",
"def new\n @game = Game.new\n @game.player_1_id = current_user.id\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @game = Game.new\n\n\t\t@platforms_list = Tag.where(\"category = 'platform'\").order('name').collect {|t| [t.name, t.id]}\n\t\t@platforms_selected = [] \n\n\t\t@genres_list = Tag.where(\"category = 'genre'\").order('name').collect {|t| [t.name, t.id]}\n\t\t@genres_selected = []\n\n\t\t@publishers_list = Tag.where(\"category = 'publisher'\").order('name').collect {|t| [t.name, t.id]}\n\t\t@publishers_selected = [] \n\n\t\t@developers_list = Tag.where(\"category = 'studio'\").order('name').collect {|t| [t.name, t.id]}\n\t\t@developers_selected = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @trackleague = Trackleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trackleague }\n end\n end",
"def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\n end\n end",
"def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end",
"def new\n @bot = Bot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bot }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @ultimate_team = UltimateTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ultimate_team }\n end\n end",
"def new\n @nba_team = NbaTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nba_team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @team }\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :ok, location: game_url(@game, format: :json) }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7815345",
"0.77895147",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7759262",
"0.7621673",
"0.75953907",
"0.75934213",
"0.757585",
"0.7552501",
"0.7500164",
"0.7462923",
"0.7445139",
"0.739772",
"0.7396635",
"0.7381793",
"0.73751414",
"0.7358211",
"0.73440903",
"0.7321314",
"0.73211217",
"0.7320367",
"0.7279117",
"0.72633725",
"0.7262752",
"0.7206365",
"0.720285",
"0.7184333",
"0.71683615",
"0.716407",
"0.71558285",
"0.7122066",
"0.7121513",
"0.7121513",
"0.7121513",
"0.7118874",
"0.711158",
"0.7092645",
"0.701261",
"0.7011662",
"0.701069",
"0.70098215",
"0.70019233",
"0.69826186",
"0.6970228",
"0.6953547",
"0.6947655",
"0.69442785",
"0.69257057",
"0.69257057",
"0.69257057",
"0.69257057",
"0.69170487",
"0.69166327",
"0.6912864",
"0.68984073",
"0.68966734",
"0.6889428",
"0.6888809",
"0.6885027",
"0.6885027",
"0.6885027",
"0.6885027",
"0.6885027",
"0.6885027",
"0.6885027",
"0.6884308",
"0.685649",
"0.68420553",
"0.6841461",
"0.6840453",
"0.68295646",
"0.68295646",
"0.68295646",
"0.6828092",
"0.6828092",
"0.6822001",
"0.6807761",
"0.68071175",
"0.68055624",
"0.67995197",
"0.6798592",
"0.6796073",
"0.67924553",
"0.67756397",
"0.6766796",
"0.6760902",
"0.6760902",
"0.6760902",
"0.6760902",
"0.6760902",
"0.67550623"
] |
0.70340425
|
46
|
POST /bestgames POST /bestgames.json
|
def create
@bestgame = Bestgame.new(params[:bestgame])
respond_to do |format|
if @bestgame.save
format.html { redirect_to @bestgame, notice: 'Bestgame was successfully created.' }
format.json { render json: @bestgame, status: :created, location: @bestgame }
else
format.html { render action: "new" }
format.json { render json: @bestgame.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end",
"def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end",
"def create\n @game = Game.new(game_params)\n @game.user_id = current_user.id \n @game.img_url_small = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"image\"][\"screen_url\"]\n @game.img_url_large = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"image\"][\"small_url\"]\n @game.deck = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"deck\"]\n @game.developers = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"developers\"][0][\"name\"]\n @game.genre = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"genres\"][0][\"name\"]\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to search_index_path, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\t\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Create a team to hold the home team players\n home_team = Team.new\n home_team.name = params[:home_team_name]\n home_team.save\n @game.home_team_id = home_team.id\n \n #Create a team to hold the away team players\n away_team = Team.new\n away_team.name = params[:away_team_name]\n away_team.save\n @game.away_team_id = away_team.id\n \n #Create home and away teams from available players\n build_teams(home_team, away_team)\n \n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = @contest.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to contest_games_path, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p = game_params\n\n home_team_name = p.delete(:home_team_name)\n away_team_name = p.delete(:away_team_name)\n p[:home_team_id] = find_or_create_team(home_team_name).try(:id)\n p[:away_team_id] = find_or_create_team(away_team_name).try(:id)\n\n @game = Game.new(p)\n @game.user = current_user\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, notice: 'Game was successfully created.' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n @corporations = Corporation.order(:faction, :slogan)\n @runners = Runner.order(:faction, :name)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n @game.set_curb_choice\n @game.find_winner\n\n respond_to do |format|\n if @game.save\n @game_result = GameResult.new(user_choice: @game.user_choice,\n curb_choice: @game.curb_choice,\n winner: @game.winner)\n format.json { render :show, status: :created }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to games_url, notice: \"Game was successfully created.\" }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @game = @user.games.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to user_game_path(@user,@game), :notice => 'Game was successfully created.' }\n format.json { render :json => @game, :status => :created }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @games_leaderboard = Games::Leaderboard.new(games_leaderboard_params)\n\n if @games_leaderboard.save\n render json: @games_leaderboard, status: :created, location: @games_leaderboard\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end",
"def create\n @game = current_user.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to game_steps_path(game_id: @game.id), notice: 'La partie a bien été créée' }\n format.json { render :show, status: :created, location: games_path }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to games_path, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mini_game = MiniGame.new(mini_game_params)\n if @mini_game.save\n render json: @mini_game, status: :ok\n else\n render json: @mini_game.errors, status: :unprocessable_entity\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :ok, location: game_url(@game, format: :json) }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @games_team = GamesTeam.new(games_team_params)\n\n respond_to do |format|\n if @games_team.save\n format.html { redirect_to @games_team, notice: 'Games team was successfully created.' }\n format.json { render :show, status: :created, location: @games_team }\n else\n format.html { render :new }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n @game.user_id = params[:game][:user].first[:id]\n @game.item_id = params[:game][:item].first[:id]\n\n if @game.save\n render json: @game, status: :created, location: @game\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:nr, :date, :home_id, :away_id, :score_home, :score_away)\n end",
"def create\n @game = Game.new(game_params)\n\n params[:players].each do |player_name|\n p = Player.new\n p.name = player_name\n p.game = @game\n p.save!\n end\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_user_game = {}\n new_user_game[:game_id] = params[:game_id].to_i\n new_user_game[:user_id] = current_user.id\n @user_game = UserGame.new(new_user_game)\n\n respond_to do |format|\n if @user_game.save\n format.html { redirect_to user_games_url, notice: 'User game was join in game with success.' }\n format.json { render action: 'index', status: :created, location: @user_game }\n else\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: \"Game was successfully created.\" }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n\n calculategeneraltable(@game.tournament_id, @game.home_team)\n calculategeneraltable(@game.tournament_id, @game.visit_team)\n\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gamesofweek = Gamesofweek.new(gamesofweek_params)\n\n respond_to do |format|\n if @gamesofweek.save\n format.html { redirect_to @gamesofweek, notice: 'Gamesofweek was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gamesofweek }\n else\n format.html { render action: 'new' }\n format.json { render json: @gamesofweek.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.role == \"admin\" || current_user.role == \"god\"\n @game = Game.new(game_time: params[\"date\"] + \" \" + params[\"time\"])\n\n @game.game_teams.build(team_id: params[\"home_team_id\"], home_team: true)\n @game.game_teams.build(team_id: params[\"away_team_id\"], home_team: false)\n end\n\n respond_to do |format|\n if current_user.role == :admin || current_user.role == :god || @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: { message: \"Created Game\" } }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:home_team, :home_team_result, :visit_team, :visit_team_result, :stadium, :game_date, :tournament_id, :status, :points, :scorepoints)\n end",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def create\n @game = Game.new(game_params)\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @playedgame = Playedgame.new(playedgame_params)\n\n respond_to do |format|\n if @playedgame.save\n format.html { redirect_to @playedgame, notice: 'Playedgame was successfully created.' }\n format.json { render :show, status: :created, location: @playedgame }\n else\n format.html { render :new }\n format.json { render json: @playedgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game].merge({ :user_id => current_user.id }))\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to games_path, notice: 'Game was successfully added.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_game = UserGame.new(user_game_params)\n\n respond_to do |format|\n if @user_game.save\n format.html { redirect_to @user_game, notice: 'User game was successfully created.' }\n format.json { render :show, status: :created, location: @user_game }\n else\n format.html { render :new }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:date, :round_id, :home_team, :visitor_team, :stadium_id)\n end",
"def create\n new_game = helpers.generate_game(params[\"game_name\"])\n\n slack_id = params[\"slack_id\"]\n\n response_url = params[\"response_url\"]\n\n @game = Game.new(new_game.new_game_data)\n\n if @game.save\n player = Player.exists?(slack_id: \"#{slack_id}\")\n if player\n player_records = Player.find_by(slack_id: \"#{slack_id}\")\n Rails.logger.info player_records[\"id\"].inspect\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\", player_id: \"#{player_records[\"id\"]}\"}\n else\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\"}\n end\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n\n word_blanks = new_game.display_word_state\n\n HTTParty.post(response_url, \n {\n body: {\"text\" => \"#{word_blanks}\",\"response_type\" => \"in_channel\"}.to_json,\n headers: {\n \"Content-Type\" => \"application/json\"\n }\n }\n )\n \n end",
"def create\n @league_game = LeagueGame.new(league_game_params)\n\n respond_to do |format|\n if @league_game.save\n format.html { redirect_to @league_game, notice: 'League game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @league_game }\n else\n format.html { render action: 'new' }\n format.json { render json: @league_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_game\n\tresponse\n\tif params[\"difficulty\"]\n\t\tdifficulty = params[\"difficulty\"]\n\t\tsettings.game_data = Ben::Game.new( Integer difficulty )\n\t\tresponse = game_json\n\telse\n\t\tresponse = \"Server couldn't load new game.\"\n\tend\n\treturn response\nend",
"def create\n @game = GameBuilder.build(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new\n #create the first player\n first_player = Player.new\n first_player.name = params[:first_player_name]\n first_player.game = @game\n\n #create the second player\n second_player = Player.new\n second_player.name = params[:second_player_name]\n second_player.game = @game\n\n # add first and second players to the game object\n @game.first_player = first_player\n @game.second_player = second_player\n\n respond_to do |format|\n if @game.save\n #create a new game round using a redirect to new_game_round_path\n format.html { redirect_to new_game_round_path(@game), notice: t(\"games.successfully_created\") }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'El juego se ha creado!.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gameplay = Gameplay.new(params[:gameplay])\n\n respond_to do |format|\n if @gameplay.save\n format.html { redirect_to @gameplay, notice: 'Gameplay was successfully created.' }\n format.json { render json: @gameplay, status: :created, location: @gameplay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gameplay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @qa_game = QaGame.new(qa_game_params)\n\n respond_to do |format|\n if @qa_game.save\n format.html { redirect_to @qa_game, notice: 'Qa game was successfully created.' }\n format.json { render :show, status: :created, location: @qa_game }\n else\n format.html { render :new }\n format.json { render json: @qa_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @player_game = PlayerGame.new(params[:player_game])\n\n respond_to do |format|\n if @player_game.save\n format.html { redirect_to @player_game, :notice => 'Player game was successfully created.' }\n format.json { render :json => @player_game, :status => :created, :location => @player_game }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @player_game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @game_tournament = GameTournament.new(params[:game_tournament])\n\n respond_to do |format|\n if @game_tournament.save\n format.html { redirect_to @game_tournament, notice: 'Game tournament was successfully created.' }\n format.json { render json: @game_tournament, status: :created, location: @game_tournament }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = current_user.games_as_player1.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n populate_players\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: game_params }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:date, :opponent, :my_score, :opponent_score, :user_id)\n end",
"def game_params\n params.require(:game).permit(:team_id, :opponent_id, :team_score, :opponent_score, :date, :location,:tournament_id, :fecha)\n end",
"def game_params\n params.require(:game).permit(:series_id, :venue_id, :match_type, :first_team, :second_team, :home_team, :first_team_score, :second_team_score, :first_inning_fours, :second_inning_fours, :first_inning_sixes, :second_inning_sixes, :first_inning_wickets, :second_inning_wickets, :result, :winning_team, :first_inning_six_over_runs, :first_inning_ten_over_runs, :first_inning_twenty_over_runs, :first_inning_wides, :first_inning_extras, :second_inning_six_over_runs, :second_inning_ten_over_runs, :second_inning_twenty_over_runs, :second_inning_wides, :second_inning_extras,:game_type,:first_inning_thirty_over_runs,:first_inning_forty_over_runs,:first_inning_fifty_over_runs,:second_inning_thirty_over_runs,:second_inning_forty_over_runs,:second_inning_fifty_over_runs)\n end",
"def game_params\n params.require(:game).permit(:contest_id, :team_a_name, :team_b_name, :team_a_result, :team_b_result, :game_date, :group, :active, :user_id, :entry_id, :game_id, :raffle_number)\n end",
"def create\n @games_of_week = GamesOfWeek.new(games_of_week_params)\n\n respond_to do |format|\n if @games_of_week.save\n format.html { redirect_to @games_of_week, notice: 'Games of week was successfully created.' }\n format.json { render action: 'show', status: :created, location: @games_of_week }\n else\n format.html { render action: 'new' }\n format.json { render json: @games_of_week.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.create(params[:game])\n\t\t@game.rate_average = 0.0\n\t\t@game.rate_quantity = 0\t\n\t\t@game.tags = build_tags_from_params(params) if params[:commit] == 'Update Game' \n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @howtoplaygame = Howtoplaygame.new(howtoplaygame_params)\n\n respond_to do |format|\n if @howtoplaygame.save\n format.html { redirect_to @howtoplaygame, notice: 'Howtoplaygame was successfully created.' }\n format.json { render :show, status: :created, location: @howtoplaygame }\n else\n format.html { render :new }\n format.json { render json: @howtoplaygame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @game = Game.new\n @game.save\n render :json => {}\n # render :json => {}\n # @game = Game.new(game_params)\n # new_game = false\n # if !params.has_key(:secret_id)\n # @game = Game.new\n # secret_id = @game.secret_id\n # new_game = true\n # else\n # secret_id = params[:game_id]\n # end\n # @game.save\n\n # if new_game\n # render :json => {:new_secret_id => @game.secret_id}\n # end\n\n # render :json => {}\n\n # respond_to do |format|\n # if @game.save\n # format.html { redirect_to game_path(:id => @game.secret_id), notice: 'Game was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @game }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @game.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def game_params\n params.require(:game).permit(:date_played, :oponent_id, :score_oponent, :user_score)\n end",
"def create\n @best = Best.new(best_params)\n\n respond_to do |format|\n if @best.save\n format.html { redirect_to @best, notice: 'Best was successfully created.' }\n format.json { render :show, status: :created, location: @best }\n else\n format.html { render :new }\n format.json { render json: @best.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #directions = Score::DIRECTIONS.map{|k,v| k}\n #directions.shuffle!\n params[:game].merge!({:meeting_id => @meeting.id})\n @game = Game.create!(params[:game])\n participant_ids = params[:participants].collect{|id| id.to_i} if params[:participants]\n participant_ids.each do |id|\n score = Score.new\n score.game_id = @game.id\n score.participant_id = id.to_i\n #score.direction = directions.shift\n score.save!\n end\n\n respond_to do |format|\n if @game\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board_game = BoardGame.new(board_game_params)\n\n respond_to do |format|\n if @board_game.save\n format.html { redirect_to @board_game, notice: \"Board game was successfully created.\" }\n format.json { render :show, status: :created, location: @board_game }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @board_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n @game.manager_id = current_user.id\n\n @usergame = UserGame.new\n @usergame.user_id = current_user.id\n\n respond_to do |format|\n if @game.save\n @usergame.game_id = @game.id\n @usergame.balance = @game.budget\n @usergame.save!\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posgames = Game.where(:giver_id => current_user.id).where(:gamestatus => \"give\")\n if @posgames.count > 0\n @game = @posgames.first\n\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { render :show, status: :created, location: @game }\n end\n else\n \t@allwords = File.new(\"config/wordlist\").readlines.sample(15)\n \t@allwords.each do |w|\n \tw.include?(\"\\n\") ? w.gsub!(\"\\n\", \"\").upcase! : w.upcase!\n \t\tend\n \t\t@correctwords = @allwords.sample(7)\n \t\t@loseword = @correctwords[0]\n \t\t@correctwords.slice!(0)\n\n \t\t@game = Game.new\n \t\t@game.update(:allwords => @allwords, :gamestatus => \"give\", :correctwords => @correctwords, \n \t\t\t:loseword => @loseword, :giver_id => current_user.id)\n\n \t\trespond_to do |format|\n if @game.save\n format.html { redirect_to @game }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def new\n @bet = Bet.new\n @games = Game.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def create\n @game = color_param == 'white' ? Game.new(white_player_id: user_param) : Game.new(black_player_id: user_param)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: { redirect: game_path(@game) } }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @old_game = OldGame.new(params[:old_game])\n\n respond_to do |format|\n if @old_game.save\n format.html { redirect_to @old_game, notice: 'Old game was successfully created.' }\n format.json { render json: @old_game, status: :created, location: @old_game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @old_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { render :edit, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n gp = game_params\n gp['organizer_id'] = current_user.id\n @game = Game.new(gp)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to edit_game_path(@game), notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wantedgame_params\n params.require(:wantedgame).permit(:game_api_id, :game_name, :game_image, :game_owned, :user_id)\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def game_params\n params.require(:game).permit(:date_played, :user_id, :opponent_id, :user_score, :opponent_score)\n end",
"def game_params\n params.require(:game).permit(:score, :duration, :backflips, :verification_token)\n end",
"def create\n @game = Game.new(params[:game])\n @game.user_id = current_user.id\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:teamh, :teama, :teama_id, :teamh_id, :league, :event_time, :teama_score, :teamh_score, :score_spread, :status, :game_winner, :event_city, :event_venue, :season, :title)\n end",
"def new\n @user = User.find(params[:user_id])\n @game = @user.games.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end",
"def create\n @game_score = GameScore.new(params[:game_score])\n\n respond_to do |format|\n if @game_score.save\n format.html { redirect_to @game_score, notice: 'Game score was successfully created.' }\n format.json { render json: @game_score, status: :created, location: @game_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # create game and save, then add Score connector\n @game = Game.new(params[:game])\n respond_to do |format|\n # creating new game, and new association between selected player and game\n if @game.save && @game.add_player(@player)\n flash[:notice] = 'Game was successfully created.'\n format.html { redirect_to(games_url) }\n format.xml { render :xml => @game, :status => :created, :location => @game }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(game_params)\n @game.user = current_user\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.new(params[:game])\n @game.game_state = \"started\"\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:winner_id, :winner_score, :loser_id, :loser_score)\n end",
"def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][:winner]\n @game.overall_score = ActiveSupport::JSON.decode(params[:game][:overall_score])\n @game.game_state = ActiveSupport::JSON.decode(params[:game][:game_state])\n\n respond_to do |format|\n if @game.save\n format.json { head :no_content }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n temp_game = Game.new()\n temp_game.date = game_params[:date].to_date\n temp_game.numplay = game_params[:numplay]\n temp_game.backwards = game_params[:backwards]\n temp_game.notrump = game_params[:notrump]\n temp_game.description = game_params[:description]\n\n puts game_params[:rounds_attributes]\n\n game_params[:rounds_attributes].each do |r|\n puts \"0: \" + r[0]\n puts \"1: \" + r[1][:score]\n # score = r[1][:score]\n # place = r[1][:place]\n # correct = r[1][:correct]\n # asterisk = r[1][:asterisk]\n # player_id = r[1][:player_id]\n myround = Round.new(r[1])\n temp_game.rounds << myround\n end\n\n puts temp_game\n\n message = \"\"\n temp_rounds = temp_game.rounds.sort_by{|e| -e[:score]}\n place = 0\n @game = temp_game\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n @game.rounds << round\n message = message + \" \" + round.player.nickname + \" place set to \" + place.to_s\n end\n\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: message }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n populate_players\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def turn\n turn = Turn.create(\n user: current_user,\n game: game,\n stack: stack,\n answer: params[:answer],\n match: sanitize_match(params[:match])\n )\n\n if params[:game_over] && stack.can_end?\n stack.mark_winner!(current_user)\n end\n\n if turn.valid?\n serializable = Serializable::Game.new(game: game.reload, viewer: current_user)\n serialized = GameSerializer.new(serializable).to_hash[:data][:attributes]\n render json: { game: serialized }\n else\n flash[:error] = \"❌ Your answer was not submitted. Please try again.\"\n return redirect_back(fallback_location: game_path(game))\n end\n end",
"def new\n @game = Game.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def game_params\n params.require(:game).permit(:id, :season_id, :time, :field_id, :home_team_id, :home_team_score, :away_team_id, :away_team_score, :game_type_id, :until)\n end",
"def create\n @game = current_user.games.build(game_params)\n if @game.save\n redirect_to @game\n else\n render :new\n end\n end"
] |
[
"0.7068596",
"0.68883044",
"0.68633133",
"0.6773922",
"0.662005",
"0.6604422",
"0.653616",
"0.6505623",
"0.6488154",
"0.6471678",
"0.6464274",
"0.645424",
"0.64496934",
"0.64488995",
"0.6444146",
"0.6435989",
"0.6425111",
"0.6406201",
"0.63908786",
"0.63902277",
"0.63902277",
"0.63902277",
"0.63902277",
"0.63902277",
"0.6384146",
"0.6366703",
"0.6363206",
"0.634856",
"0.6342856",
"0.6341727",
"0.63417196",
"0.6329947",
"0.63273245",
"0.6318331",
"0.6313429",
"0.6308942",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6305595",
"0.6299255",
"0.6278383",
"0.6273136",
"0.62684697",
"0.62673223",
"0.625797",
"0.62559164",
"0.62255937",
"0.6222141",
"0.62175965",
"0.6207715",
"0.62055564",
"0.6204188",
"0.6197163",
"0.6193347",
"0.61894697",
"0.61851317",
"0.61844164",
"0.61762136",
"0.6151889",
"0.6150145",
"0.614868",
"0.61480296",
"0.61313266",
"0.61305344",
"0.61225885",
"0.61197674",
"0.61173826",
"0.61163217",
"0.61064273",
"0.61061656",
"0.61048746",
"0.60992354",
"0.6093076",
"0.60921234",
"0.6091546",
"0.6090968",
"0.6089686",
"0.6088279",
"0.6072933",
"0.60650355",
"0.6049438",
"0.60480917",
"0.60430676",
"0.60397637",
"0.60386664",
"0.60350883",
"0.603179",
"0.6029472",
"0.6022234",
"0.6021479",
"0.60096234",
"0.6008789",
"0.60003436"
] |
0.7362521
|
0
|
PUT /bestgames/1 PUT /bestgames/1.json
|
def update
@bestgame = Bestgame.find(params[:id])
respond_to do |format|
if @bestgame.update_attributes(params[:bestgame])
format.html { redirect_to @bestgame, notice: 'Bestgame was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @bestgame.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end",
"def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][:winner]\n @game.overall_score = ActiveSupport::JSON.decode(params[:game][:overall_score])\n @game.game_state = ActiveSupport::JSON.decode(params[:game][:game_state])\n\n respond_to do |format|\n if @game.save\n format.json { head :no_content }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Find teams and update their names\n home_team = Team.find(@game.home_team_id)\n home_team.name = params[:home_team_name]\n away_team = Team.find(@game.away_team_id)\n away_team.name = params[:away_team_name]\n \n #Create home and away teams from available players\n build_teams(home_team, away_team)\n \n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.where(\"secret_id='#{secret_id}\").first\n respond_to do |format|\n if game.update\n format.html\n format.json { render json: @game }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n update_standings\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, :notice => 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.get(params[:id])\n\n respond_to do |format|\n if @game.update(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @games_leaderboard = Games::Leaderboard.find(params[:id])\n\n if @games_leaderboard.update(games_leaderboard_params)\n head :no_content\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @games_team.update(games_team_params)\n format.html { redirect_to @games_team, notice: 'Games team was successfully updated.' }\n format.json { render :show, status: :ok, location: @games_team }\n else\n format.html { render :edit }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @best.update(best_params)\n format.html { redirect_to @best, notice: 'Best was successfully updated.' }\n format.json { render :show, status: :ok, location: @best }\n else\n format.html { render :edit }\n format.json { render json: @best.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bestgame = Bestgame.new(params[:bestgame])\n\n respond_to do |format|\n if @bestgame.save\n format.html { redirect_to @bestgame, notice: 'Bestgame was successfully created.' }\n format.json { render json: @bestgame, status: :created, location: @bestgame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bestgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to contest_games_path, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find_by_slug(params[:id])\n\t\t@game.tags = build_tags_from_params(params) if params[:commit] == 'Update Game'\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = current_user.games.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game].merge({ :user_id => current_user.id }))\n format.html { redirect_to games_path, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @game = @user.games.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to user_game_path(@user,@game), :notice => 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n p = game_params\n\n p[:home_team_id] = find_or_create_team(p.delete(:home_team_name)).try(:id) if p[:home_team_name].present?\n p[:away_team_id] = find_or_create_team(p.delete(:away_team_name)).try(:id) if p[:away_team_name].present?\n\n respond_to do |format|\n if @game.update(p)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n @games = current_club_player.games\n format.html { redirect_to dashboard_path, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n game = Game.find(params[:game_id])\n @player_game = game.player_games.find(params[:id])\n\n respond_to do |format|\n if @player_game.update_attributes(params[:player_game])\n format.html { redirect_to(@player_game, :notice => 'Player game was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @player_game}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @player_game.errors, :status => :unprocessable_entity }\n format.json { render :json => @player_game}\n end\n end\n end",
"def update\n @game_tournament = GameTournament.find(params[:id])\n\n respond_to do |format|\n if @game_tournament.update_attributes(params[:game_tournament])\n format.html { redirect_to @game_tournament, notice: 'Game tournament was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @mini_game.update(mini_game_params)\n render json: @mini_game, status: :ok\n else\n render json: @mini_game.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to games_url, notice: \"Game was successfully updated.\" }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to games_path, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = User.find_by_fb_id(params[:id]).id\n @user_game = UserGame.find_by_user_id(id)\n\n respond_to do |format|\n if @user_game.update_attributes(params[:user_game])\n format.json { head :no_content }\n else\n format.json { render json: @user_game.errors }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n @corporations = Corporation.order(:faction, :slogan)\n @runners = Runner.order(:faction, :name)\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: \"Game was successfully updated.\" }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to games_url, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to(@game, :notice => 'Game was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n if @gameplay.update_attributes(params[:gameplay])\n format.html { redirect_to @gameplay, notice: 'Gameplay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gameplay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: game_url(@game, format: :json) }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @old_game = OldGame.find(params[:id])\n\n respond_to do |format|\n if @old_game.update_attributes(params[:old_game])\n format.html { redirect_to @old_game, notice: 'Old game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @old_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to root_path, notice: 'Los datos de tu juego se han actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @league_game.update(league_game_params)\n format.html { redirect_to @league_game, notice: 'League game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @league_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to games_path, notice: 'La partie a bien été éditée' }\n format.json { render :show, status: :ok, location: games_path }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.instance\n\n respond_to do |format|\n if @game.update_attributes(game_params)\n format.html { redirect_to game_path, flash: { success: 'Game was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_game.update(user_game_params)\n format.html { redirect_to @user_game, notice: 'User game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_game.update(user_game_params)\n format.html { redirect_to @user_game, notice: 'User game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @howtoplaygame.update(howtoplaygame_params)\n format.html { redirect_to @howtoplaygame, notice: 'Howtoplaygame was successfully updated.' }\n format.json { render :show, status: :ok, location: @howtoplaygame }\n else\n format.html { render :edit }\n format.json { render json: @howtoplaygame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gamesofweek.update(gamesofweek_params)\n format.html { redirect_to @gamesofweek, notice: 'Gamesofweek was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gamesofweek.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_game = PlayerGame.find(params[:id])\n\n respond_to do |format|\n if @player_game.update_attributes(params[:player_game])\n format.html { redirect_to @player_game, :notice => 'Player game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @player_game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_game.update(user_game_params)\n format.html { redirect_to @user_game, notice: 'User game was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_game }\n else\n format.html { render :edit }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playedgame.update(playedgame_params)\n format.html { redirect_to @playedgame, notice: 'Playedgame was successfully updated.' }\n format.json { render :show, status: :ok, location: @playedgame }\n else\n format.html { render :edit }\n format.json { render json: @playedgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @games_pick.update(games_pick_params)\n format.html { redirect_to @games_pick, notice: 'Games pick was successfully updated.' }\n format.json { render :show, status: :ok, location: @games_pick }\n else\n format.html { render :edit }\n format.json { render json: @games_pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to(@game, :notice => 'Game was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to(@game, :notice => 'Game was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wantedgame.update(wantedgame_params)\n format.html { redirect_to @wantedgame, notice: 'Wantedgame was successfully updated.' }\n format.json { render :show, status: :ok, location: @wantedgame }\n else\n format.html { render :edit }\n format.json { render json: @wantedgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boxscore = @game.boxscores.find(params[:id])\n \n\n respond_to do |format|\n if @boxscore.update_attributes(params[:boxscore])\n format.html { redirect_to game_boxscores_url(@game), notice: 'Boxscore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boxscore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n if @game_score.update_attributes(params[:game_score])\n format.html { redirect_to @game_score, notice: 'Game score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @qa_game.update(qa_game_params)\n format.html { redirect_to @qa_game, notice: 'Qa game was successfully updated.' }\n format.json { render :show, status: :ok, location: @qa_game }\n else\n format.html { render :edit }\n format.json { render json: @qa_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n players = params.select { |key, value| key=~/player/i }\n player_vals = {}\n players.each { |key, value| player_vals[key]=value[\"id\"] }\n @game.update_attributes(player_vals)\n\n @game.scores.destroy_all\n Rails.cache.clear\n\n players.each do |key, value|\n #\"home_player_one_id\"=>{\"id\"=>\"10\",\n # \"scores\"=>{\"hole_1\"=>\"4\",\n # \"hole_2\"=>\"3\",\n # \"hole_3\"=>\"4\",\n # \"hole_4\"=>\"3\",\n # \"hole_5\"=>\"5\",\n # \"hole_6\"=>\"4\",\n # \"hole_7\"=>\"5\",\n # \"hole_8\"=>\"3\",\n # \"hole_9\"=>\"5\"}}\n player = Player.find(value['id'])\n value['scores'].each do |key, value|\n player.scores.create!(:hole_id => key.split(\"_\").last, :score => value, :game_id => @game.id)\n end\n end\n @game.reload\n @game.set_scores\n\n respond_to do |format|\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @games_of_week.update(games_of_week_params)\n format.html { redirect_to @games_of_week, notice: 'Games of week was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @games_of_week.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video_game = VideoGame.find(params[:id])\n\n respond_to do |format|\n if @video_game.update_attributes(params[:video_game])\n format.html { redirect_to @video_game, notice: 'Video game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def update\n respond_to do |format|\n if @game.update(game_params)\n sync_update @game\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game.battling_armies.each do |army|\n army.is_loser = true if army.is_winner == false\n army.save\n end\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @best_ever.update(best_ever_params)\n format.html { redirect_to @best_ever, notice: 'Best ever was successfully updated.' }\n format.json { render :show, status: :ok, location: @best_ever }\n else\n format.html { render :edit }\n format.json { render json: @best_ever.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n flash[:notice] = 'Jogo editado com sucesso.'\n format.html { redirect_to theme_games_url(@theme) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_game.update(admin_game_params)\n format.html { redirect_to @admin_game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_game }\n else\n format.html { render :edit }\n format.json { render json: @admin_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n flash[:notice] = 'Game was successfully updated.'\n format.html { redirect_to(@game) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @game.update_attributes(params[:game])\n redirect_to creators_games_path, notice: 'Игра успешно изменена.'\n else\n render action: 'edit'\n end\n end",
"def update\n @game = Game.find(params[:id])\n \n if @game.update(game_params)\n redirect_to @game\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @games_from_result.update(games_from_result_params)\n format.html { redirect_to @games_from_result, notice: 'Games from result was successfully updated.' }\n format.json { render :show, status: :ok, location: @games_from_result }\n else\n format.html { render :edit }\n format.json { render json: @games_from_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @game\n \n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if User.update(current_user.id, :game_id => params[:id])\n format.json { head :no_content }\n end\n end\n end",
"def update\n begin\n ActiveRecord::Base.transaction do\n closing_game_request? ? close_game : update_game\n respond_to do |format|\n format.html { redirect_to [@organization, @game], notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n end\n end\n rescue => e\n logger.error(e)\n respond_to do |fomat|\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @game.update(game_old_params)\n listing_games\n format.js\n end\n end"
] |
[
"0.68059254",
"0.6749593",
"0.6680789",
"0.6541481",
"0.6424901",
"0.641676",
"0.6412682",
"0.64113194",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.63943595",
"0.6390868",
"0.6361885",
"0.635334",
"0.6353",
"0.63510776",
"0.63506657",
"0.63223046",
"0.631284",
"0.63105935",
"0.6309113",
"0.6280321",
"0.6248374",
"0.6240197",
"0.6239854",
"0.62322253",
"0.62218803",
"0.6221236",
"0.62136847",
"0.62136245",
"0.6213293",
"0.62127095",
"0.6207222",
"0.6207222",
"0.6207222",
"0.6201757",
"0.61868703",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.6186347",
"0.617955",
"0.6154827",
"0.61243814",
"0.6122461",
"0.60812247",
"0.60759085",
"0.60759085",
"0.6075706",
"0.6059186",
"0.6058782",
"0.60550755",
"0.6040784",
"0.6040644",
"0.6034882",
"0.6032075",
"0.60296273",
"0.60130334",
"0.6012882",
"0.6010927",
"0.60065967",
"0.6002687",
"0.60001594",
"0.5995943",
"0.5995919",
"0.5989969",
"0.59876204",
"0.59819305",
"0.5981771",
"0.5969595",
"0.5964406",
"0.5953457",
"0.59529597",
"0.59505785",
"0.59456426",
"0.594025",
"0.59336835"
] |
0.7373703
|
0
|
DELETE /bestgames/1 DELETE /bestgames/1.json
|
def destroy
@bestgame = Bestgame.find(params[:id])
@bestgame.destroy
respond_to do |format|
format.html { redirect_to bestgames_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @game = Game.find(params[:id])\n # @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = current_user.games.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to organization_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_path }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @old_game = OldGame.find(params[:id])\n @old_game.destroy\n\n respond_to do |format|\n format.html { redirect_to old_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gameplay = Gameplay.find(params[:id])\n @gameplay.destroy\n\n respond_to do |format|\n format.html { redirect_to gameplays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_stat = GameStat.find(params[:id])\n @game_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @league_game.destroy\n respond_to do |format|\n format.html { redirect_to league_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id].to_i\n UserGame.find(id)\n @user_game.destroy\n respond_to do |format|\n format.html { redirect_to user_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player_game = PlayerGame.find(params[:id])\n @player_game.destroy\n\n respond_to do |format|\n format.html { redirect_to player_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @espn_game.destroy\n respond_to do |format|\n format.html { redirect_to espn_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to user_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts @game.date.to_s\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_title.destroy\n respond_to do |format|\n format.html { redirect_to game_titles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'El juego ha sido correctamente eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drinking_game.destroy\n respond_to do |format|\n format.html { redirect_to drinking_games_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_info.destroy\n respond_to do |format|\n format.html { redirect_to game_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @game = @user.games.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to user_games_url(@user) }\n format.json { head :ok }\n end\n end",
"def destroy\n game = @goal.game\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to game_path(game) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: \"Game was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: \"Game was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_game.destroy\n respond_to do |format|\n format.html { redirect_to admin_games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gamesofweek.destroy\n respond_to do |format|\n format.html { redirect_to gamesofweeks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to admin_users_path(@admin), notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @games_from_result.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Games from result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @howtoplaygame.destroy\n respond_to do |format|\n format.html { redirect_to howtoplaygames_url, notice: 'Howtoplaygame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gameboard = Gameboard.find(params[:id])\n @gameboard.destroy\n\n respond_to do |format|\n format.html { redirect_to gameboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wantedgame.destroy\n respond_to do |format|\n format.html { redirect_to wantedgames_url, notice: 'Wantedgame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa_game.destroy\n respond_to do |format|\n format.html { redirect_to qa_games_url, notice: 'Qa game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_score = GameScore.find(params[:id])\n @game_score.destroy\n\n respond_to do |format|\n format.html { redirect_to game_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @game.destroy\n render json: { success: true, game: @game}\n end\n end",
"def destroy\n # delete Score first, then Game\n @score.destroy if @score\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game_tournament = GameTournament.find(params[:id])\n @game_tournament.destroy\n\n respond_to do |format|\n format.html { redirect_to game_tournaments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playedgame.destroy\n respond_to do |format|\n format.html { redirect_to playedgames_url, notice: 'Playedgame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n game = Game.find(params[:game_id])\n @player_game = game.player_games.find(params[:id])\n @player_game.destroy\n\n respond_to do |format|\n format.html { redirect_to(player_games_path, :notice => 'Player game was successfully removed.') }\n format.xml { head :ok }\n format.json { render :json => @player_game}\n end\n end",
"def destroy\n @games_leaderboard.destroy\n\n head :no_content\n end",
"def destroy\n\t\t@game.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to games_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @game_server = Game::Server.find(params[:id])\n @game_server.destroy\n\n respond_to do |format|\n format.html { redirect_to game_servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to theme_games_url(@theme) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gameplay.destroy\n respond_to do |format|\n format.html { redirect_to gameplays_url, notice: 'Gameplay was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video_game = VideoGame.find(params[:id])\n @video_game.destroy\n\n respond_to do |format|\n format.html { redirect_to video_games_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7487991",
"0.74776",
"0.7429544",
"0.74243677",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.73951095",
"0.73951095",
"0.73706836",
"0.73706836",
"0.73706836",
"0.73706836",
"0.73706836",
"0.73706836",
"0.73706836",
"0.73112065",
"0.7295633",
"0.72936577",
"0.7267128",
"0.72343016",
"0.72113717",
"0.71857214",
"0.7170335",
"0.7169739",
"0.7128541",
"0.71144766",
"0.71144766",
"0.71144766",
"0.71144766",
"0.71144766",
"0.71144766",
"0.7111419",
"0.7100441",
"0.7091628",
"0.70841855",
"0.7078615",
"0.70577085",
"0.7041829",
"0.7040512",
"0.7023063",
"0.7011555",
"0.7011555",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70101833",
"0.70094514",
"0.6996561",
"0.699203",
"0.698949",
"0.6987075",
"0.6986172",
"0.69844526",
"0.6968113",
"0.69641906",
"0.69621474",
"0.69617426",
"0.6960144",
"0.6953873",
"0.695122",
"0.6948108",
"0.6938278",
"0.6926279",
"0.69207734",
"0.6918777",
"0.6917663"
] |
0.7804282
|
0
|
Override for default bottom bar:
|
def default_bbar
[
:add.action, :edit.action, :apply.action, :del.action,
"-", # Adds a separator
:search.action,
"-", # Adds a separator
{
:menu => [:add_in_form.action, :edit_in_form.action],
:text => I18n.t(:edit_in_form),
:icon => "/images/icons/application_form.png"
},
"-", # Adds a separator
:row_counter.action
]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bottom_links(content=nil,opts={}, &block)\n content_for(:bottom_linkbar, capture(&block))\n end",
"def default_bbar\n [\n :show_details.action, # The custom action defined below via JS\n :search.action,\n \"-\", # Adds a separator\n :del.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end",
"def bottom=(value)\n @bottom = value\n end",
"def default_bbar\n [\n :show_details.action,\n :ctrl_manage.action,\n :search.action,\n \"-\", # Adds a separator\n :add.action, :edit.action, :del.action,\n :apply.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end",
"def hcShowBar _args\n \"hcShowBar _args;\" \n end",
"def hbarchart(*args)\n HBar.new(self, *args)\n end",
"def default_bbar\n [ :apply, :add_in_form, :search ]\n end",
"def default_bbar\n [ :apply, :add_in_form, :search ]\n end",
"def default_bbar\n [ :apply, :add_in_form, :search ]\n end",
"def default_bbar\n [\n :commit_rows.action,\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def default_bbar\n [:add, :edit, :apply, :del]\n end",
"def default_bbar\n [ :apply, :add_in_form]\n end",
"def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def bottom_line\n border_options ? super : nil\n end",
"def bottom\n @widget.margins.bottom + @widget.borders.bottom\n end",
"def draw_footer; end",
"def bar_dir\n @bar_dir ||= :bar\n end",
"def bottom_panel\n Panel.bottom_panel(pointer)\n end",
"def do_bar state\n value, y = mega_pop(state), state[:y_position]\n height = state[:height]\n if 0 == value # move down if value = 0\n state[:y_position] = (y+1) % height\n else # up otherwise\n state[:y_position] = y == 0 ? height - 1 : y - 1\n end\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end",
"def update_boss_hp_bar\n return unless @boss_hp_bar\n @boss_hp_bar.update\n end",
"def bar_gauge(options = {})\n @draw_stack << Displays::BarGauge.new(options)\n end",
"def bottom=(bottom)\n @view__.bottom = bottom\n end",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def has_bottom_control?\n !self.hide_bottom_control && !self.is_static?\n end",
"def html_bottom_items\n @html_bottom_items ||= []\n end",
"def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end",
"def moving_bar(type, div='', bookend='')\n case type\n when :bat\n @bat_dir + bar_monitor([@bat_percent])\n end\n end",
"def _empty_hud_green_bar\n b = Bitmap.new(1, 12)\n (1..6).each {|i| b.fill_rect(0, i-1, 1, 14-i*2, Color.new(0, 40*i/3, 0))}\n return b\n end",
"def barchart(*args)\n Bar.new(self, *args)\n end",
"def default_bbar\n bbar = [ :search ]\n bbar.concat [ :apply ] if can? :update, BikeBrand\n bbar.concat [ :add_in_form ] if can? :create, BikeBrand\n bbar\n end",
"def bar\n return nil if state.total.is_a? Symbol\n skel = render_template(:main, [:bar])\n lwid = state.scope_at[0] == :tty ? terminal_width() : scope.line_width\n barlen = [lwid - skel.gsub(STRIP_ANSI, '').length, 0].max\n fill = [0,[(state.done.to_f/state.total*barlen).to_i,barlen].min].max\n thebar = scope.template.barchar * fill + scope.template.padchar * [barlen - fill,0].max\n thebar.length == 0 ? nil : thebar\n end",
"def change_border_bottom(weight='thin')\n change_border(:bottom, weight)\n end",
"def _hud_green_bar\n b = Bitmap.new(1, 12)\n (1..6).each {|i| b.fill_rect(0, i-1, 1, 14-i*2, Color.new(0, 40*i, 0))}\n return b\n end",
"def custom_progress_bar(name,value,options = {})\n value = ((value*100.0).round.to_f)/100.0\n result = custom_static_progress_bar(name,value, options)\n result += javascript_tag(\"$('\"+name+\"_progress_bar').remove();\")\n result += custom_dynamic_progress_bar(name, value, options)\n end",
"def default_bbar\n bbar = [ :search ]\n bbar.concat [ :apply ] if can? :update, BikeModel\n bbar.concat [ :add_in_form ] if can? :create, BikeModel\n bbar\n end",
"def set_bottom_menu\n @bottom_menu = BottomMenu.find(params[:id])\n end",
"def _hud_white_bar\n b = Bitmap.new(1, 12)\n (1..6).each {|i| b.fill_rect(0, i-1, 1, 14-i*2, Color.new(40*i, 40*i, 40*i))}\n return b\n end",
"def custom_dynamic_progress_bar(name, value, options = {})\n value = ((value*100.0).round.to_f)/100.0\n # handle the case of several back images\n if options[:bar_images].nil? then\n bar_images = \"'\"+image_path('progress_bar/percentImage_back.png')+\"'\"\n else\n bar_images = \"Array(\"+(options[:bar_images].map! { |x| \"'\"+image_path(x)+\"'\" }).join(\",\")+\")\"\n end\n # we set the progress bar\n result = '<span id=\"'+name+'\"></span>'\n # we set the properties of the js observer\n result += javascript_tag(\"\n Event.observe(window, 'load', function() {\"+\n name+\"PB = new JS_BRAMUS.jsProgressBar(\n $('\"+name+\"'),\"+\n (value*100).to_s+\",\n {\n showText\t: \"+(options[:show_text]||false).to_s+\",\n animate\t: \"+(options[:animate]||false).to_s+\",\n width\t: \"+(options[:width]||120).to_s+\",\n height\t: \"+(options[:height]||12).to_s+\",\n boxImage\t: '\"+image_path(options[:box_image]||'progress_bar/percentImage.png')+\"',\n barImage\t: \"+bar_images+\"\n }\n );},\n false);\")\n end",
"def index\n if current_user\n @links = current_user.links \n @bottom_bar_header = \"My Links\"\n end\n end",
"def draw_album_bar\n bar_width = 200\n margin = 15\n box_height = 50\n add_element(ELEMENT,0,0,bar_width,HEIGHT,PRIMARY,MIDDLE, \"rect_album_background\")\n\n # If statements determine the current page number using\n # a instance variable to shift viewable elements out and in\n # of the defined amount of viewable albums\n if !(@page <= 0)\n add_element(ELEMENT,0,0,bar_width,25,HIGHLIGHT,MIDDLE,\"scroll_button_0\")\n end\n if !(@page + @viewable_albums >= @data_array.size)\n # Helps scale button positioning to work around the playbar\n # and prevent the UI overlapping\n @show_playbar ? offset = 100 : offset = 25 \n add_element(ELEMENT,0,HEIGHT - offset,bar_width,25,HIGHLIGHT,MIDDLE,\"scroll_button_1\")\n end\n display_albums(margin, box_height, bar_width)\nend",
"def bottom_panel\n FFI::NCurses.bottom_panel(@pointer)\n end",
"def footer\n end",
"def bottom()\n @view__.bottom\n end",
"def _empty_hud_white_bar\n b = Bitmap.new(1, 12)\n (1..6).each {|i| b.fill_rect(0, i-1, 1, 14-i*2, Color.new(40*i/3, 40*i/3, 40*i/3))}\n return b\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def page_down_to_bottom_of_scroll_bar\n scroll_down_one_page while vertical_scroll_percent < 99.99\n end",
"def init_bar(hash)\n @max = hash[:max]\n @variable = hash[:var]\n @default = 0 if @default.nil?\n @switch = hash[:sw] if hash[:sw] != nil\n @distance = hash[:distance].nil? ? 1 : hash[:distance]\n @bar_color = hash[:color]\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def use_progress_bar?; true end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def bottom\n return @bottom\n end",
"def draw_actor_hp_gauge(actor, x, y, width = 120)\n if actor.hide_info?\n gw = width * 100 / 100\n gc1 = hp_gauge_color1\n gc2 = hp_gauge_color2\n self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)\n self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)\n else\n super\n end\n end",
"def draw_actor_mp_gauge(actor, x, y, width = 120)\n if actor.hide_info?\n gw = width * 100 / [100, 1].max\n gc1 = mp_gauge_color1\n gc2 = mp_gauge_color2\n self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)\n self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2) \n else\n super\n end \n end",
"def border_bottom()\n return get_border(:bottom)\n end",
"def separator\n self.horizontal_bar * @width\n end",
"def align_bottom\n @vertical_align = :bottom\n return self\n end",
"def quicklinks_bottom\n 'En apprendre encore plus sur l’atelier Icare ?'.in_h3 +\n menu_links_overview.in_ul(class: 'tdm_bottom_page')\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def bottom_margins=(value)\n @bottom_margins = value\n end",
"def display_both_bottoms\n\t\tdisplay_boards_separators(method(:display_bottom_separator))\n\tend",
"def margin_bottom\n cur_page.margin_bottom\n end",
"def dispose_boss_hp_bar\n return unless @boss_hp_bar\n @boss_hp_bar.dispose \n end",
"def quicklinks_bottom\n 'En apprendre encore plus sur l’atelier Icare ?'.in_h3 +\n menu_links_overview.in_ul(class: 'nav no-puces')\n end",
"def bar_points\n self[:bar_points] || event.bar_points\n end",
"def under_help\n @help_window.bottom_corner\n end",
"def bottom_border\n \"#{self.align_center} \\n#{BORDER}\"\n end",
"def progress_bar(name,value, display_percentage_text = false, multicolor = false)\n value = ((value*100.0).round.to_f)/100.0\n result = static_progress_bar(name,value, display_percentage_text)\n result += javascript_tag(\"$('\"+name+\"_progress_bar').remove();\")\n if multicolor then\n result += custom_dynamic_progress_bar(name,value,{:show_text => display_percentage_text, :animate => true, :bar_images => ['progress_bar/percentImage_back4.png','progress_bar/percentImage_back3.png','progress_bar/percentImage_back2.png','progress_bar/percentImage_back1.png']})\n else\n result += custom_dynamic_progress_bar(name, value, {:show_text => display_percentage_text, :animate => true})\n end\n return result\n end",
"def kopal_layout_after_page_footer\n \n end",
"def init_bar(hash)\n @max = hash[:max]\n @min = hash[:min] if hash[:min]\n @perc = hash[:perc] == false ? false : true\n @variable = hash[:var]\n @default = 0 if @default.nil? && !hash[:not_initialize]\n @switch = hash[:sw] if hash[:sw] != nil\n @distance = hash[:distance].nil? ? 1 : hash[:distance]\n @bar_color = 1\n @bar_color = hash[:color] if hash[:color]\n end",
"def bar\n step = @options[:step].to_f\n height = @options[:height].to_f\n width = ((@norm_data.size - 1) * step).to_f\n background_color = @options[:background_color]\n\n create_canvas(@norm_data.length * step + 2, height, background_color)\n\n upper = @options[:upper].to_f\n below_color = @options[:below_color]\n above_color = @options[:above_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n i = 1\n # raise @norm_data.to_yaml\n max_normalized = normalize(@maximum_value)\n @norm_data.each_with_index do |r, index|\n color = ((@data[index] || @minimum_value) >= upper) ? above_color : below_color\n @draw.stroke('transparent')\n @draw.fill(color)\n bar_height_from_top = @canvas.rows - ( (r.to_f / max_normalized.to_f) * @canvas.rows)\n @draw.rectangle( i, @canvas.rows, i + step - 2, bar_height_from_top )\n i += step\n end\n\n unless target.nil?\n adjusted_target_value = (height - 3 - normalize(target)/(101.0/(height-4))).to_i\n @draw.stroke(target_color)\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n end\n\n @draw.draw(@canvas)\n @canvas\n end",
"def get_current_bar\n if !params[:bar_name].nil?\n @current_bar = HomeBar.find_by_name(params[:bar_name])\n end\n end",
"def display_bar?\n !@options['debug'] && !@options['silent']\n end",
"def footer_top_position\n bounds.bottom + layout.margin.bottom\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def add_bar(bar)\n for i in 0..bar.length - 1\n add_beat(bar[i])\n end\n end",
"def set_bar\n unless user_signed_in? && current_user.admin?\n flash[:notice] = \"You don't have access to that page!\"\n redirect_to root_path\n return\n end\n @bar = Bar.find(params[:id])\n end",
"def show\n redirect_to bar_graphs_url\n end",
"def is_scrollbar_reach_bottom?\n begin\n thumb = Element.new(\"(#{@locator}/ancestor::div | #{@locator}/following::div)[div[@class='vscrollbar']]/div[@class='vscrollbar']/div[contains(@class,'thumb')]\")\n if thumb.is_present?\n $browser.execute_script(\"var evt = document.createEvent('MouseEvents');\" +\n \"evt.initMouseEvent('mouseover',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);\" +\n \"arguments[0].dispatchEvent(evt);\", thumb.get_element)\n\n tracker_tip = Element.new(\"//div[@id='trackerDwell' and @class='tooltip']\")\n tracker_text = tracker_tip.text.strip\n\n if tracker_text =~ /(\\d+)-(\\d+)\\/(\\d+)/\n return $2 == $3\n else\n raise \"Tool tip not match /(\\\\d+)-(\\\\d+)\\\\/(\\\\d+)/\"\n end\n else\n return true\n end\n rescue Exception => e\n raise \"Scroll bar reach bottom has exception: #{e}\"\n end\n end",
"def is_scrollbar_reach_bottom?\n begin\n thumb = Element.new(\"(#{@locator}/ancestor::div | #{@locator}/following::div)[div[@class='vscrollbar']]/div[@class='vscrollbar']/div[contains(@class,'thumb')]\")\n if thumb.is_present?\n $browser.execute_script(\"var evt = document.createEvent('MouseEvents');\" +\n \"evt.initMouseEvent('mouseover',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);\" +\n \"arguments[0].dispatchEvent(evt);\", thumb.get_element)\n\n tracker_tip = Element.new(\"//div[@id='trackerDwell' and @class='tooltip']\")\n tracker_text = tracker_tip.text.strip\n\n if tracker_text =~ /(\\d+)-(\\d+)\\/(\\d+)/\n return $2 == $3\n else\n raise \"Tool tip not match /(\\\\d+)-(\\\\d+)\\\\/(\\\\d+)/\"\n end\n else\n return true\n end\n rescue Exception => e\n raise \"Scroll bar reach bottom has exception: #{e}\"\n end\n end",
"def display_bottom_separator(width = HOLE_SIZE, new_line = true, tab = true)\n\t\tdisplay_separator_row(SEPARATOR[:sw_corner], SEPARATOR[:s_divide], \n\t\t\t SEPARATOR[:se_corner], width, new_line, tab)\n\tend",
"def bar_points\n self[:bar_points] || standings.bar_points\n end",
"def updateHpBar\n return if self.disposed?\n # updates the current state of the HP bar\n zone = 0\n zone = 1 if self.hp <= @battler.totalhp*0.50\n zone = 2 if self.hp <= @battler.totalhp*0.25\n @sprites[\"hp\"].bitmap.blt(0,0,@colors,Rect.new(zone*2,0,2,6))\n hpbar = @battler.totalhp == 0 ? 0 : (self.hp*@hpBarWidth/@battler.totalhp.to_f)\n @sprites[\"hp\"].zoom_x = hpbar\n # updates the HP text\n str = \"#{self.hp}/#{@battler.totalhp}\"\n @sprites[\"textHP\"].bitmap.clear\n textpos = [[str,@sprites[\"textHP\"].bitmap.width,0,1,Color.white,Color.new(0,0,0,125)]]\n pbDrawTextPositions(@sprites[\"textHP\"].bitmap,textpos) if @showhp\n end",
"def on_load\n set_nav_bar_button :left, title: \"Back\", action: :close_help_screen\n end",
"def no_bar\r\n\t return x \r\n\tend",
"def set_menu_bar mb\n @menu_bar = mb\n add_widget mb\n mb.toggle_key ||= Ncurses.KEY_F2\n if !mb.toggle_key.nil?\n ch = mb.toggle_key\n bind_key(ch, 'Menu Bar') do |_form| \n if !@menu_bar.nil?\n @menu_bar.toggle\n @menu_bar.handle_keys\n end\n end\n end\n end",
"def bottom_menu_params\n params.require(:bottom_menu).permit(:name, :icon, :url, :active_icon)\n end",
"def bar(depth)\n if @html\n \"<FONT COLOR=\\\"#{@colour_chart[depth % @n_chart_colours]}\\\">#{@spacebar}</FONT>\"\n else\n @spacebar\n end\n end",
"def set_tool_bar\n if (has_role? :superuser)\n @tool_bar = \"AdminToolbar\"\n else\n @tool_bar = \"MemberToolbar\"\n end\n end",
"def set_tool_bar\n if (has_role? :superuser)\n @tool_bar = \"AdminToolbar\"\n else\n @tool_bar = \"MemberToolbar\"\n end\n end",
"def fallen_off_bottom?\n self.y > $window.height\n end",
"def hideToolBars()\n @ie.AddressBar = true\n @ie.StatusBar = true\n @ie.ToolBar= false\n @ie.MenuBar = false\n end",
"def horizontal_bar\n unicode? ? \"\\u2501\" : '-'\n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def no_bar\n\t return x \n\tend",
"def show_bottom_of_page\n driver.execute_script('window.scrollTo(0,document.body.scrollHeight)')\n end"
] |
[
"0.64004856",
"0.60715175",
"0.60101473",
"0.5988939",
"0.59506136",
"0.5872297",
"0.58097005",
"0.58091897",
"0.58091897",
"0.5774728",
"0.575915",
"0.573333",
"0.5695456",
"0.56887484",
"0.5688596",
"0.5678407",
"0.56711644",
"0.5654639",
"0.5635766",
"0.5601477",
"0.5601477",
"0.5591007",
"0.55885947",
"0.5581539",
"0.5469229",
"0.5451922",
"0.5404149",
"0.53995365",
"0.5399377",
"0.537718",
"0.5359199",
"0.5318124",
"0.5302379",
"0.5301094",
"0.52907854",
"0.5261815",
"0.5259405",
"0.5253994",
"0.52463967",
"0.5214458",
"0.521185",
"0.5209424",
"0.5208379",
"0.52077746",
"0.52058524",
"0.5192192",
"0.51891285",
"0.5188519",
"0.5188519",
"0.5185276",
"0.51804245",
"0.5173144",
"0.517272",
"0.5157319",
"0.51549256",
"0.5108794",
"0.5080746",
"0.50752944",
"0.50667506",
"0.5066248",
"0.5043168",
"0.5041986",
"0.5029104",
"0.50123906",
"0.49996126",
"0.49955553",
"0.4994952",
"0.49926844",
"0.49903163",
"0.49835104",
"0.4982356",
"0.49814138",
"0.4979768",
"0.49624103",
"0.4961208",
"0.49594325",
"0.49404714",
"0.49349156",
"0.49313495",
"0.4918116",
"0.49147162",
"0.4913647",
"0.48874152",
"0.48874152",
"0.48847497",
"0.4883214",
"0.4875709",
"0.4853447",
"0.48469305",
"0.48428434",
"0.48404595",
"0.4832641",
"0.48299405",
"0.48299405",
"0.4829317",
"0.4828463",
"0.48208803",
"0.48199558",
"0.481144",
"0.48081127"
] |
0.57073534
|
12
|
Override for default context menu
|
def default_context_menu
[
:row_counter.action,
"-", # Adds a separator
*super # Inherit all other commands
]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 default_context_menu\n res = %w{ add edit del }.map(&:to_sym).map(&:action)\n res\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 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 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 on_help(menu)\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 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 menu_toolbar(context=\"\")\n toolbar = Gtk::Toolbar.new\n\n up_button = Gtk::ToolButton.new(Gtk::Stock::GO_UP)\n up_button.important = true\n up_button.sensitive = true\n toolbar.insert(-1, up_button)\n up_button.signal_connect(\"clicked\") do\n if (context == \"meterpreter\")\n parent = dirname_up(@parent_remote)\n remote_ls(parent)\n else\n parent = File.dirname(@parent_local)\n local_ls(parent)\n end\n # up_button.sensitive = @parent != \"/\"\n end\n home_button = Gtk::ToolButton.new(Gtk::Stock::HOME)\n home_button.important = true\n toolbar.insert(-1, home_button)\n home_button.signal_connect(\"clicked\") do\n if (context == \"meterpreter\")\n parent = @parent_remote_init\n remote_ls(parent)\n else\n parent = GLib.home_dir\n local_ls(parent)\n end\n up_button.sensitive = true\n end\n \n refresh_button = Gtk::ToolButton.new(Gtk::Stock::REFRESH)\n refresh_button.important = true\n toolbar.insert(-1, refresh_button)\n refresh_button.signal_connect(\"clicked\") do\n if (context == \"meterpreter\")\n remote_ls()\n else\n local_ls()\n end\n up_button.sensitive = true\n \n end\n\n return toolbar\n end",
"def on_context_item_selected(mi) # not yet used\n pos = mi.menu_info.position\n\n case mi.title.to_s\n when \"Edit\"\n edit @scripts_list[pos]\n when \"Execute\"\n begin\n execute IO.read(@scripts_list[pos]), \"[Running #{@scripts_list[pos]}]\"\n rescue\n toast \"#{@scripts_list[pos]} not found!\"\n end\n when \"Delete\"\n @confirm_delete = @scripts_list[pos]\n AlertDialog::Builder.new(@ruboto_java_instance).\n setMessage(\"Delete #{@confirm_delete}?\").\n setCancelable(false).\n setPositiveButton(\"Yes\", (proc{|d,w| my_dialog_click(d,w)})).\n setNegativeButton(\"No\", (proc{|d,w| my_dialog_click(d,w)})).\n create.\n show\n end\n\n true\n end",
"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 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 menu_selection \nend",
"def menu # can do custom methods within a method/class\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 showCommandingMenu _args\n \"showCommandingMenu _args;\" \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 openContextPopup(pos, wItem)\n poRow = wItem.row\n poColumn = wItem.column\n process = taskItemAtRow(wItem.row).process\n\n menu = Qt::Menu.new\n insertDefaultActions(menu, poColumn, process)\n createPlayerMenu(menu, poColumn, process)\n action = menu.exec(pos)\n if action then\n $log.code { \"execute : '#{action.data.toString}'\" }\n cmd, exe = action.data.toString.split(/@/, 2)\n $log.code { \"cmd(#{cmd}), exe(#{exe})\" }\n if cmd =~ /^play/\n playMedia(cmd, process, exe)\n elsif self.respond_to?(cmd)\n self.method(cmd).call(process, wItem)\n else\n $log.warn { \"No method #{cmd} in contextmenu.\" }\n end\n end\n menu.deleteLater\n end",
"def assigned_menu\n\n end",
"def init_menu\n @menus.set_selected(\"about\")\n end",
"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 menu_options #:nodoc:\n @menu_options ||= {}\n end",
"def define_menu_items\n add_menu_item(\"File storage.\", 1)\n add_menu_item(\"Sqlite3.\", 2)\n end",
"def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms/media',\n :options => {:title => app.t.media_admin_menu.album_management,\n :link_route => \"/admin/media/album\",\n :description => 'The albums admin tools to create and modify media albums.',\n :module => 'cms',\n :weight => 2}}] \n \n end",
"def main_menu\n prompt = TTY::Prompt.new(active_color: :blue)\n response = prompt.select(\"CTT-Lite\", available_options)\n system \"clear\"\n handle_main_menu(response)\n end",
"def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend",
"def quick_menuitem(how, what)\n if mac_internal? || (window_id != nil && window_id <= 0)\n QuickMenuItem.new(self, how, what, name == 'Opera' ? nil : name)\n else\n QuickMenuItem.new(self, how, what, window_id)\n end\n end",
"def remove_default_help_menu\n @remove_default_help_menu = true\n end",
"def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select{ |a| a.http_methods.include?(:get) }\n actions.map do |action|\n wording = wording_for(:menu, action)\n %{\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"pjax\" href=\"#{locale_url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => (object.try(:persisted?) && object.try(:id) || nil) })}\">\n <i class=\"#{action.link_icon}\"></i>\n <span#{only_icon ? \" style='display:none'\" : \"\"}>#{wording}</span>\n </a>\n </li>\n }\n end.join.html_safe\n end",
"def main_menu_link; MAIN_MENU_LINK; end",
"def menu_for(parent, abstract_model = nil, object = nil, only_icon = true) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }\n actions.collect do |action|\n next unless authorized?(action.action_name, abstract_model)\n wording = wording_for(:menu, action)\n href_url = case action.action_name.to_s\n when \"export\"\n \"/admin/#{abstract_model.try(:to_param)}.xls\"\n when \"import\"\n \"/admin/#{abstract_model.try(:to_param)}/import\"\n else\n url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))\n end\n case action.key.to_s\n when \"new\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:left\">\n <a class=\"btn btn-primary\"}\" href=\"#{href_url}\">#{wording}</a>\n </li>\n )\n when \"import\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"export\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:right\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"index\"\n else\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n end\n end.join.html_safe\n end",
"def menu\n \nend",
"def menu(options = {})\n config.menu_item_options = options\n end",
"def action\n (@current_level = 'X' ; return) if ( @user_choice == 'X' || @user_choice == 'x')\n\n (menu_level_left ; return) if @user_choice == \"\\e[D\"\n\n tmp_lvl = @current_level + '.' + @user_choice\n cmd = @menu_map[tmp_lvl][1]\n cmd ? execute_action(cmd) : @current_level = tmp_lvl\n end",
"def current_menu_entries(e=nil)\n @cursor_helper.current_menu_entries(menu)\n end",
"def help_menu\n\n buffer, window = popup_buffer('help', 44)\n\n buffer[1] = \"--------------------------------------------\"\n buffer[2] = \"--- VimCity Help ---\"\n buffer[3] = \"--------------------------------------------\"\n\n buffer[6] = \" -- while in command mode (default) -- \"\n buffer[7] = \" ? : bring up help menu \"\n buffer[8] = \" h,j,k,l : move cursor \"\n buffer[9] = \" i : place building (enter insert mode) \"\n buffer[10] = \" x : destroy building underneath \"\n buffer[11] = \" cursor \"\n buffer[12] = \" :q : quit game \"\n\n buffer[14] = \" -- while in insert mode -- \"\n buffer[15] = \" p : place building \"\n buffer[16] = \" space : return to command mode \"\n\n buffer[window.height-2] = \"--------------------------------------------\"\n buffer[window.height-1] = \"--- press any key to return ---\"\n buffer[window.height] = \"--------------------------------------------\"\n\n redraw\n wait_for_input([\"any\"])\n quit\n end",
"def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms',\n :options => {:title => app.t.cms_admin_menu.cms_menu,\n :description => 'Content management', \n :module => 'cms',\n :weight => 10}},\n {:path => '/cms/newcontent',\n :options => {:title => app.t.cms_admin_menu.content_new,\n :link_route => \"/admin/cms/content/new\",\n :description => 'Creates a new content.',\n :module => 'cms',\n :weight => 6}}, \n {:path => '/cms/contenttypes',\n :options => {:title => app.t.cms_admin_menu.contenttype_management,\n :link_route => \"/admin/cms/content-types\",\n :description => 'Manages the content types: creation and update of content types.',\n :module => 'cms',\n :weight => 5}}, \n {:path => '/cms/contents',\n :options => {:title => app.t.cms_admin_menu.content_management,\n :link_route => \"/admin/cms/contents\",\n :description => 'Contents explorer.',\n :module => 'cms',\n :weight => 4}},\n {:path => '/cms/comments',\n :options => {:title => app.t.cms_admin_menu.comment_management,\n :link_route => \"/admin/cms/comments\",\n :description => 'Comments manager.',\n :module => 'cms',\n :weight => 3}}, \n {:path => '/cms/taxonomies', \n :options => {:title => app.t.cms_admin_menu.taxonomy_management,\n :link_route => \"/admin/cms/taxonomy\",\n :description => 'Manages the taxonomies: creation and update of taxonomies.',\n :module => 'cms',\n :weight => 2}},\n {:path => '/cms/templates', \n :options => {:title => app.t.cms_admin_menu.template_management,\n :link_route => \"/admin/cms/templates\",\n :description => 'Manages template: creation and update of template.',\n :module => 'cms',\n :weight => 1}}, \n {:path => '/cms/redirects',\n :options => {:title => app.t.cms_admin_menu.redirects_management,\n :link_route => \"/admin/cms/redirects\",\n :description => 'Redirects a content',\n :module => 'cms',\n :weight => 12}}, \n {:path => '/sbm',\n :options => {:title => app.t.cms_admin_menu.build_site_menu,\n :description => 'Site building',\n :module => 'cms',\n :weight => 9 }},\n {:path => '/sbm/blocks', \n :options => {:title => app.t.cms_admin_menu.block_management,\n :link_route => \"/admin/cms/blocks\",\n :description => 'Manage the blocks. It allows to discover and configure modules blocks.',\n :module => 'cms',\n :weight => 6}},\n {:path => '/sbm/views',\n :options => {:title => app.t.cms_admin_menu.view_management,\n :link_route => \"/admin/cms/views\",\n :description => 'Manage the views: creation and update of views.',\n :module => 'cms',\n :weight => 5}},\n {:path => '/sbm/menus', \n :options => {:title => app.t.site_admin_menu.menu_management,\n :link_route => \"/admin/cms/menu-management\",\n :description => 'Manage the menus. It allows to define custom menus.',\n :module => :cms,\n :weight => 7}}\n ] \n \n end",
"def menu_items\n\n menu.items(self)\n\n end",
"def menu _command\n send_cmd(\"menu #{_command}\")\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 toggle_menu menu_text=nil\n unless menu_text\n h = { \n # :h => :toggle_hidden, \n :c => :toggle_case, :l => :toggle_long_list , \"1\" => :toggle_columns, \n :g => :use_gui_browser, :t => :use_text_browser}\n ch, menu_text = menu \"Toggle Menu\", h\n end\n case menu_text\n when :toggle_hidden\n $hidden = $hidden ? nil : \"D\"\n refresh\n when :toggle_case\n #$ignorecase = $ignorecase ? \"\" : \"i\"\n $ignorecase = !$ignorecase\n refresh\n when :toggle_columns\n $gviscols = 3 if $gviscols == 1\n $long_listing = false if $gviscols > 1 \n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n when :use_gui_browser\n $open_command = $browser_gui || \"open\"\n when :use_text_browser \n $open_command = $browser_text || \"elinks\"\n\n when :toggle_long_list\n $long_listing = !$long_listing\n if $long_listing\n $gviscols = 1\n $pagesize = $grows\n else\n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n end\n refresh\n end\nend",
"def getMenu(menu)\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 main_menu\n main_menu_options = {'Interact with Existing Kits' => :list_and_select_kit,\n 'Create a new Kit' => :prompt_kit_params, \n 'Quit' => :quit}\n \n op = @io.select_from_options(\"What would you like to do?\", main_menu_options)\n @operation_stack.unshift op\n \n # return nil, because there's nothing to pass onto the next method\n return\n end",
"def menu_items\n menu.items(self)\n end",
"def menu_items\n menu.items(self)\n end",
"def nMenuItems _obj, _args\n \"_obj nMenuItems _args;\" \n end",
"def ide_menu\n\t\tputs \"***IDE Menu***\"\n\t\tputs \"1. Comment a selection \"\n\t\tputs \"2. Save a file\"\n\t\tputs \"3. Create new file\"\nend",
"def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\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 streamlined_top_menus\n [\n [\"TBD\", {:action=>\"new\"}]\n ]\n end",
"def default_cmd ; %w{urxvt} ; end",
"def menu\nend",
"def menu\n \n \n\nend",
"def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end",
"def menu(name, *args, &block)\n if self[name]\n self[name].extend(&block)\n else\n self[name] = Menu.new(nil, :menu, name, *args, &block)\n end\n end",
"def menu(selected)\n @menu = selected\n end",
"def menu_options\n @menu_options ||= {}\n end",
"def configure_menu_item_attribute(attribute_value_hash)\n if preferences? && attribute_value_hash[:command]\n ::Tk.ip_eval(\"proc ::tk::mac::ShowPreferences {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}\")\n elsif help? && attribute_value_hash[:command]\n ::Tk.ip_eval(\"proc ::tk::mac::ShowHelp {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}\")\n elsif quit? && attribute_value_hash[:command]\n ::Tk.ip_eval(\"proc ::tk::mac::Quit {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}\")\n else\n @parent_proxy.tk.entryconfigure label, attribute_value_hash\n end\n end",
"def menu_item(id, options = {})\n if actions = options[:only]\n actions = [] << actions unless actions.is_a?(Array)\n actions.each { |a| menu_items[controller_name.to_sym][:actions][a.to_sym] = id }\n else\n menu_items[controller_name.to_sym][:default] = id\n end\n end",
"def change_context(args, cmd=[])\n begin\n # check if we are doing switch context\n if args.join(\"\").match(/\\A\\-\\Z/)\n revert_context()\n return\n end\n\n # remember current context\n @previous_context = @active_context.clone_me()\n\n # jump to root\n reset if args.join('').match(/^\\//)\n\n # begin\n # hack: used just to avoid entering assembly/id/node or workspace/node context (remove when include this contexts again)\n first_c, warning_message = nil, nil\n first_c = @active_context.context_list().first.name unless @active_context.context_list().empty?\n tmp_active_context = @active_context.clone_me\n restricted = is_restricted_context(first_c, args, tmp_active_context)\n\n args = restricted[:args]\n warning_message = restricted[:message]\n node_specific = restricted[:node_specific]\n\n DTK::Client::OsUtil.print_warning(warning_message) if warning_message\n # end\n\n # Validate and change context\n @active_context, error_message = prepare_context_change(args, @active_context, node_specific, cmd, true)\n\n load_context(active_context.last_context_name)\n\n if error_message\n revert_context()\n raise DTK::Client::DtkValidationError, error_message\n end\n rescue DTK::Client::DtkValidationError => e\n DTK::Client::OsUtil.print(e.message, :yellow)\n rescue DTK::Shell::Error, Exception => e\n DtkLogger.instance.error_pp(e.message, e.backtrace)\n ensure\n return shell_prompt()\n end\n end",
"def interactive_menu\n loop do\n print_menu\n selection\n end\nend",
"def action\n puts \"\\nHelp menu\"\n puts '=' * 'Help menu'.length + \"\\n\\n\"\n puts \" Command \\t Description\"\n puts \" \" + '-' * 'Command'.length + \" \\t \" + '-' * 'Description'.length\n commands.map {|cmd , desc| puts \" #{cmd} \\t #{desc}\"}\n puts \"\\n\\n\"\n end",
"def on_create\n #of course, menu options are also addable programmatically:\n add_menu(\"Execute\", drawable_ic_menu_play) do\n #some business logic here\n end \n end",
"def local_action(command, id, action)\n super(command,id,ACTION[action])\n end",
"def menu_type\n\t\t\"secondary\" if controller_name == \"users\"\n\tend",
"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 render_clf_main_menu(project, options = {})\n # Default options\n options = {\n :ul_class => 'nav',\n :li_class => 'menucontent',\n :menulink_class => 'menulink',\n :title => :clf2_text_main_menu\n }.merge(options)\n\n render_clf_menu((project && !project.new_record?) ? :project_menu : :application_menu, project, options)\n end",
"def menu_extras\n self[:menu_extras] || []\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 type\n \"mymenu\"\n end",
"def create_menu\n @tk_root.tk_item.native_item.bind('Command-r', -> { main_component.execute_sql(nil) })\n end",
"def open_menu\n touch_screen_element menu_icon\n end",
"def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend",
"def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\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 normal_menu header, *options\n\t\t\t\tmenu :green, :light_cyan, split(header, 43), *options\n\t\t\tend",
"def on_create_options_menu(menu)\n\t\t\tm1 = menu.add('Dashboard')\n\t\t m1.set_icon Ruboto::R::drawable::info\n\t\t m1.set_show_as_action 2\n\t\t m1.set_on_menu_item_click_listener do |menu_item|\n\t\t\t toast menu_item.title\n\t\t\t true # Prevent other listeners from executing.\n\t\t end\n\n\t\t m2 = menu.add('Properties')\n\t\t m2.set_icon Ruboto::R::drawable::prop\n\t\t m2.set_show_as_action 2\n\t\t m2.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m3 = menu.add('Settings')\n\t\t m3.set_icon Ruboto::R::drawable::settings\n\t\t m3.set_show_as_action 2\n\t\t m3.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m4 = menu.add('More')\n\t\t m4.set_icon Ruboto::R::drawable::more\n\t\t m4.set_show_as_action 2\n\t\t m4.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\t\t true # Display the menu.\n\tend",
"def set_current_menu\r\n @current_menu = params[:controller].to_sym\r\n @current_sub_menu = nil\r\n end",
"def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end",
"def menu_for(parent, abstract_model = nil, object = nil) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select{ |action| action.http_methods.include?(:get) }\n actions.map do |action|\n %{\n <li class=\"#{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a href=\"#{url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => object.try(:id) })}\">\n #{wording_for(:menu, action)}\n </a>\n </li>\n }\n end.join.html_safe\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 show # Show method\n menu # Show menu method above\n end",
"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 main_menu\n\n\tputs \"***Ruby Cheatsheet***\"\n\tputs \"1. Command Line\"\n\tputs \"2. IDE\" \n\tputs \"3. Search\"\n\tputs \"4. Quit\"\n\tputs \"Make a selection 1 - 4:\"\n\nend",
"def context_methods\n super + [:context]\n end",
"def show_menu\n puts \"Type 'q' to quit\"\n puts \"Or press Return to continue\"\nend",
"def hq_menu\n changes = ChangeRequest.list\n\n list = changes.map do |c|\n c.add_to_hash({'i' => c.cr_id, \"action_#{c.cr_id}\" => 'N' })\n end\n\n values = {\n 'form_url' => url(:handle_hq_menu),\n 'list' => list,\n 'action_opts' => { \n 'A' => 'Accept change',\n 'D' => 'Deny change',\n 'N' => 'Do nothing'\n }\n \n }\n standard_page(\"List Pending Changes\", values, LIST_PENDING)\n end",
"def menu_options\n raise Puerto::AbstractMethodError\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def addMenu _obj, _args\n \"_obj addMenu _args;\" \n end",
"def hcSelected _args\n \"hcSelected _args;\" \n end",
"def menu_prompt\n print \"[x - exit | h - help]\\nEnter your command: \"\nend",
"def build(menu, options = {})\n\n @menu = menu\n\n super(default_options.merge(options))\n\n build_menu\n\n end",
"def update_call_menu\n end",
"def update_help\n super\n @help_window.set_item(item.item) if @help_window\n mat_window.set_item(item) if mat_window\n info_window.set_item(item.item) if info_window\n gold_window.set_item(item) if gold_window\n end",
"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 initialize_context(**opt)\n super.tap do |ctx|\n ctx[:cancel] ||= index_path\n end\n end"
] |
[
"0.7952461",
"0.7736506",
"0.7444761",
"0.6571905",
"0.65416527",
"0.65416527",
"0.6477728",
"0.64531034",
"0.6404722",
"0.6214464",
"0.6174655",
"0.6155644",
"0.61534774",
"0.61178565",
"0.607794",
"0.60713536",
"0.5826118",
"0.5812436",
"0.5742729",
"0.57195675",
"0.5714136",
"0.5669278",
"0.5658685",
"0.5640462",
"0.56364876",
"0.56029916",
"0.5599778",
"0.5597048",
"0.5594414",
"0.5594023",
"0.55855036",
"0.55784804",
"0.5570803",
"0.5568193",
"0.5559711",
"0.55554074",
"0.5550012",
"0.55459434",
"0.55451834",
"0.5544675",
"0.5536154",
"0.5534",
"0.55320954",
"0.5526148",
"0.552011",
"0.55180585",
"0.55180585",
"0.550672",
"0.5493812",
"0.5489986",
"0.5468538",
"0.54649407",
"0.54613674",
"0.5456092",
"0.5452745",
"0.5450117",
"0.5436304",
"0.5429271",
"0.5427213",
"0.5425911",
"0.54116017",
"0.5407497",
"0.53972274",
"0.5396847",
"0.53840214",
"0.5369225",
"0.5367061",
"0.5365286",
"0.53649765",
"0.53563404",
"0.5350172",
"0.53458023",
"0.5345722",
"0.5345003",
"0.53431743",
"0.5332948",
"0.5331878",
"0.53228563",
"0.5316477",
"0.53138304",
"0.53108233",
"0.5292429",
"0.52852535",
"0.52841485",
"0.528135",
"0.5273896",
"0.5269633",
"0.524594",
"0.52457833",
"0.52447295",
"0.5237691",
"0.52359384",
"0.52359384",
"0.5232663",
"0.52255505",
"0.52225226",
"0.5221572",
"0.5219068",
"0.5217357"
] |
0.76309144
|
3
|
Don't require email or password, as we also use OAuth
|
def email_required?
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def oauth_authentication; end",
"def capable_plain_auth?; end",
"def password_required?\n super unless has_facebook_auth\n end",
"def valid_for_http_auth?; end",
"def password_required?\n return false if provider.to_s == 'google_oauth2'\n super\n end",
"def use_oauth\n\t\t\t\n\t\tend",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def password_required?\n if new_record? && oauth_account\n false\n else\n super\n end\n end",
"def http_auth?; end",
"def require_no_authentication\n end",
"def auth email_or_token, password = nil\n password ? post(\"auth\", email: email_or_token, password: password) :\n post(\"auth/#{email_or_token}\")\n end",
"def password_required?\n super && authorizations.length == 0 && !auth_temp_token\n end",
"def check_if_password_and_email_provided!\n\n unless @user_credential_params[:email].blank? || @user_credential_params[:password]\n fail_immediately(:no_email_or_pwd_provided)\n end\n\n end",
"def auth_provided?\n !username.nil? && !password.nil?\n end",
"def capable_login_auth?; end",
"def valid_for_params_auth?; end",
"def can_edit_email?\n encrypted_password.present? || oauth?\n end",
"def auth_param; end",
"def oauth_required\n head oauth.no_access! unless oauth.authenticated?\n end",
"def skip_authorization; end",
"def password_required?; false; end",
"def require_no_authentication\n # skip this!\n end",
"def optional_api_user_or_token\n authenticate_user\n rescue AuthenticationError => e\n api_log_warn(\"AuthenticationError: #{e.message} (on #{request.method} that doesn't require it... ignoring)\")\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def passwordy?\n # puts \"*****************----------------> Handling user as PASSWORDY.\"\n !self.has_oauth?\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def auth\n end",
"def auth\n end",
"def auth\r\n OAuth2\r\n end",
"def email_required?\n not password.nil?\n end",
"def password_required?\n super && facebook_uid.blank? && twitter_uid.blank? && google_uid.blank?\n end",
"def require_login\n end",
"def initialize(email, password = nil)\n @email = email\n @password = password\n end",
"def auth(user, password, domain = T.unsafe(nil)); end",
"def password_required?; end",
"def email_login\n end",
"def allow_params_authentication!; end",
"def auth(value); end",
"def signin_with_invalid_email(user)\n\n\tfill_in \"Email\",\twith: \"bogusemail@example.net\"\n\tfill_in \"Password\",\twith: user.password\t\n\tclick_button \"Sign in\"\n\t\nend",
"def ensure_email_or_phone_is_provided\n return if params[:user] && (params[:user][:email].present? || params[:user][:phone].present?)\n user = User.new\n user.errors.add(:base, \"Login is missing, Please return to homepage and try again.\")\n respond_with user, location: root_path\n end",
"def allowed_auth_methods; end",
"def initialize(email, password)\n response = self.class.get '/profile.json', :basic_auth => {\n :username => email,\n :password => password\n }\n \n if response == 'Access Denied'\n raise Ketchup::AccessDenied\n else\n @access_token = response['single_access_token']\n end\n end",
"def login_required\n return if authorized?\n unauthorized! unless auth.provided?\n bad_request! unless auth.basic?\n unauthorized! unless authorize(*auth.credentials)\n @req.env['REMOTE_USER'] = auth.username\n end",
"def http_auth_hash; end",
"def http_authenticatable?; end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def authenticate!\n # Do nothing yet\n end",
"def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end",
"def initialize(email, passwd)\n modify_headers('Content-Type' => 'application/x-www-form-urlencoded')\n resp = post(API_CLIENT_LOGIN_URL, :body => params.merge!('Email' => email, 'Passwd' => passwd))\n self.code = resp.code\n if resp.code == 200\n token = resp.split('=').last.gsub(/\\n/, '')\n modify_headers(\"Authorization\" => \"GoogleLogin auth=#{token}\")\n else\n raise exception(\"#{resp.code} #{resp.parsed_response}\")\n end\n end",
"def bind_with_oauth\n if u = User.find_by_email(params[:user][:email])\n flash[:alert] = I18n.t 'devise.oauth_services.user.email_has_been_token'\n redirect_to new_oauth_user_registration_path and return\n end \n u = build_resource permitted_params.merge(name: session[:oauth].info.name, password: SecureRandom.hex )\n\n u.bypass_humanizer = true\n if u.save\n u.apply_oauth session[:oauth]\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: (I18n.t \"devise.oauth_services.providers.#{session[:oauth].provider}\") if session[:oauth].present?\n sign_in_and_redirect @user, :event => :authentication\n else\n flash[:alert] = I18n.t 'devise.oauth_services.user.failure'\n redirect_to new_oauth_user_registration_path\n end\n end",
"def oauth_account_params\n params.require(:oauth_account).permit(:email, :telephone, :password)\n end",
"def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend",
"def api_authentication_required\n unauthorized unless current_user?\n end",
"def login_not_required\n false\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end",
"def token_auth(*args, &block); end",
"def api_auth\n api_response(403, \"Invalid Authorization header\") unless api_user\n end",
"def require_authenticated\n if !session[:email]\n halt 401\n end\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def oauth_required\n invalid_oauth_response and return false unless current_token\n end",
"def login_request\n #TODO validate incoming parameters\n client_user = User.new params.require(:user).permit(\n :user,\n :external_id,\n :name,\n :email,\n :access_token,\n :profile_pictures)\n client_user.password = \"1\"\n\n # This is to spam calls to api which will cause unwanted entries into database \n\n existing_user = User.find_by(external_id: client_user.external_id)\n if existing_user.blank?\n client_user.save\n else\n # WHY IS THIS REQUIRED?\n existing_user.name = client_user.name\n\n # NO POINT SAVING THIS TOKEN - this is short lived.\n existing_user.access_token = client_user.access_token\n existing_user.email = client_user.email\n #existing_user.profile_pictures = client_user.profile_pictures\n existing_user.save\n end\n log_in(client_user)\n render :nothing => true\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def auth\n {}\n end",
"def password_required?\n provider.present? ? false : super\n end",
"def auth_methods; end",
"def auth_scheme; end",
"def needs_login?() false end",
"def oauth_token_required\n unless oauth_token\n headers['WWW-Authenticate'] = 'Bearer'\n halt 403, 'OAuth token required'\n end\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def email_required?\n provider != 'twitter'\n end",
"def require_no_authentication\n require_no_authentication_or_app_jwt\n end",
"def userauth_request(username, next_service, auth_method, *others); end",
"def email\n login\n end",
"def password_auth(opts={})\n url = URI.join(@auth_site, @token_url).to_s\n body = {client_id: @client_id,\n client_secret: @client_secret,\n email: @email,\n password: @password,\n scope: \"read write share\",\n grant_type: \"password\"}.merge(opts)\n\n #ITout.logger.info(\"ITout::OAuth post-ing #{url} with params #{{body: body, headers: headers}}\")\n response = HTTParty.send(:post, url, body: body, headers: headers)\n #ITout.logger.debug(\"ITout::OAuth #{url} response: #{response.code} #{response.body}\")\n\n if response.code == 200 and JSON.parse(response.body)[\"access_token\"] != nil\n @access_token = JSON.parse(response.body)[\"access_token\"]\n else\n raise \"Client failed to get an auth token, response was: \" + response.body\n end\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def params_auth_hash; end",
"def email_required?; false end",
"def basic_auth(user, password, domain = T.unsafe(nil)); end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def password_required?\n provider.blank? && super\n end",
"def request_authenticity_tokens; end",
"def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end",
"def initialize user = { email: nil, password: nil }\n unless user[:email] == nil || user[:password] == nil\n @email = user[:email]\n @password = user[:password]\n login \n end\n end",
"def signin\n oauth_authorize\n end",
"def auth_params\n params.require(:user).permit(:email, :password)\n end",
"def user_params_without_password\n params.required(:user).permit(:first_name, :last_name, :email)\n end",
"def authorize(username, password)\np username\np password\n username == settings.username && password == settings.password\n end",
"def use_oauth1\r\n @auth_method = AuthMethod::OAUTH1_SIGNATURE\r\n @username = nil\r\n @password = nil\r\n @current_oauth_request = nil\r\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def capable_auth_types; end",
"def email_required?\n (authentications.empty?) && super\n end"
] |
[
"0.70852697",
"0.69221854",
"0.6912944",
"0.6893468",
"0.68055665",
"0.6797814",
"0.67725945",
"0.66705346",
"0.6625113",
"0.6622187",
"0.6611939",
"0.66031384",
"0.65685743",
"0.65513724",
"0.6541997",
"0.6499946",
"0.6492842",
"0.64732224",
"0.6431902",
"0.6423503",
"0.63822544",
"0.63762885",
"0.63524437",
"0.6351807",
"0.6351807",
"0.6347693",
"0.6304351",
"0.628367",
"0.628367",
"0.62614906",
"0.6259172",
"0.6236074",
"0.6209757",
"0.6190422",
"0.6176566",
"0.6173785",
"0.6169855",
"0.6161221",
"0.61475873",
"0.61398184",
"0.6137619",
"0.6134452",
"0.6128978",
"0.6120271",
"0.6107041",
"0.61030805",
"0.61014587",
"0.6085272",
"0.6079066",
"0.6059744",
"0.60585135",
"0.6050457",
"0.6049724",
"0.6047635",
"0.6042846",
"0.60373306",
"0.60370433",
"0.6020041",
"0.6019895",
"0.6017814",
"0.6009967",
"0.6009967",
"0.6009967",
"0.6009967",
"0.6009967",
"0.6008097",
"0.6006757",
"0.6001873",
"0.59905636",
"0.59904116",
"0.5990273",
"0.59876174",
"0.5977637",
"0.5975519",
"0.5964516",
"0.59626293",
"0.5959823",
"0.5958605",
"0.5957544",
"0.59566635",
"0.595633",
"0.59442484",
"0.5940144",
"0.5940089",
"0.593425",
"0.59304005",
"0.5929026",
"0.59272254",
"0.5919743",
"0.59174126",
"0.5917056",
"0.5913132",
"0.5905142",
"0.59020126",
"0.58878696",
"0.58878696",
"0.58878696",
"0.58878696",
"0.58878696",
"0.58837277",
"0.58797055"
] |
0.0
|
-1
|
if food == elsif food == elsif food == elsif food == end end
|
def rate_my_food(food)
case food
when "Steak"
"Pass the steak sauce! That's delicious"
when "Sushi"
"Great choice! My favorite food"
when "Tacos", "Burritos", "Quesadillas" # operator or
"Cheesy and filling! The perfect combination"
when "Tofu", "Brussel Sprouts"
"Disgusting! Yuck!"
else
"I don't know about that food!"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def should_eat( food, season )\n if (food == \"ice cream\" && season == \"winter\") || (food = \"hot chocolate\" && season == \"summer\")\n return false\n else\n return true\nend\nend",
"def should_eat(food, season)\n if food == \"hot chocolate\" && season == \"summer\"\n return \"False\"\n elsif food == \"ice cream\" && season == \"winter\"\n return \"False\"\n else return \"true\"\n end\nend",
"def myfood(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the Steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Thats raw. I don't eat raw food\"\r\n when \"Tacos\", \"Burrito\", \"Quesadillas\"\r\n \"The perfect Combination!\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n puts \"No Thanks\"\r\n else\r\n \"I don't know that food\"\r\n end\r\nend",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def rate_my_food(food)\n case food\n when \"Steak\" #if food is eq to Steak\n \"Pass the sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Tacos\", \"Burritos\", \"Strawhat\"\n \"That all is great\"\n when \"Tofu\", \"Brussels\"\n \"Yuck!\"\n else\n \"I dont know about this\"\n end\n\nend",
"def find_the_cheese(foods)\n foods.find{ |cheese| cheese == \"cheddar\" || cheese == \"gouda\" || cheese ==\n \"camembert\"}\nend",
"def food_question3(food_answer3)\n if food_answer3 == \"none\"\n @food_score3 = 0\n elsif food_answer3 == \"1 meal\"\n @food_score3 = 1\n elsif food_answer3 == \"2+ meals\"\n @food_score3 = 2\n end\n @food_score3\nend",
"def refine_food(food) \n case food[\"type\"]\n when /coffee/i\n food[\"category\"] = \"coffee\"\n when /bar/i\n food[\"category\"] = \"bar\"\n when /thai/i\n food[\"category\"] << \"thai\"\n food[\"type\"] = \"thai restaurant\"\n when /indian|curry/i\n food[\"category\"] << \"indpak\"\n when /french|france/i\n food[\"category\"] << \"french\"\n food[\"type\"] =\"french restaurant\"\n when /ital(ian|y)/i\n food[\"category\"] << \"italian\"\n food[\"type\"] = \"italian restaurant\"\n when /fish|seafood/i\n if (food[\"type\"] =~ /chips/i)\n then food[\"category\"] << \"fishnchips\"\n else\n food[\"category\"] << \"seafood\"\n food[\"type\"] = \"fish restaurant\"\n end\n end\n return food\n end",
"def rate_food(food)\n case food\n when \"Steak\"\n \"Pass the stack sause! Delicious!\"\n when \"Sushi\"\n \"Great choise, my favouirete food!\"\n when \"egss\", \"pizza\", \"barbecue\"\n \"even better! yep!\"\n when \"tofu\", \"pasulj\"\n \"yuck!\"\n else\n \"#{food} is not a food!!\"\n end\nend",
"def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend",
"def rate_my_food(food)\n case food\n when \"Steak\"\n \"Pass the steak sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Pizza\"\n \"My favorite food\"\n when \"Tacos\", \"Burritos\", \"Quesadillas\"\n # o lo uno o lo otro\n \"Cheesy and filling!\"\n when \"Tofu\", \"Brussel Sprouts\"\n \"Disguisting!\"\n else\n \"I don't know about that food\"\n end\nend",
"def rate_my_food(food)\n case food\n when 'Githeri'\n 'pass the pilipili'\n when 'Mukimo'\n 'pass the thukuma'\n when 'ngima', 'muchere', 'ngacii'\n 'pass maziwa mala'\n else\n 'Nilale njaa'\n end\nend",
"def ice_cream_shop(flavors, favorite)\n return favorite == flavors[0] if flavors.length <= 1\n flavors[0] == favorite || ice_cream_shop(flavors[1..-1], favorite)\nend",
"def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end",
"def hungry?\r\n @food <= 2\r\n end",
"def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend",
"def food_question1(food_answer1)\n if food_answer1 == \"never\"\n @food_score1 = 0\n elsif food_answer1 == \"1 - 3 days per week\"\n @food_score1 = 1\n elsif food_answer1 == \"4 or more days per week\"\n @food_score1 = 2\n end\n @food_score1\nend",
"def food_question2(food_answer2)\n if food_answer2 == \"never\"\n @food_score2 = 0\n elsif food_answer2 == \"1 - 3 days per week\"\n @food_score2 = 1\n elsif food_answer2 == \"4 or more days per week\"\n @food_score2 = 2\n end\n @food_score2\nend",
"def meal_choice (veg1, veg2, protein = \"meat\")\n food_message1 = \"What a nutritious meal!\"\n food_message2 = \"A plate of #{protein} with #{veg1} and #{veg2}.\"\n puts food_message1\n puts food_message2\n return food_message1 && food_message2\nend",
"def lovefunc(flower1, flower2)\n (flower1.even? || flower2.even?) && (flower1.odd? || flower2.odd?)\nend",
"def ice_cream_shop(flavors, favorite)\n flavors.select{|word| word == favorite }.empty? == false \nend",
"def lovefunc(flower1, flower2)\n flower1Odd = flower1.odd?\n flower2Odd = flower2.odd?\n flower1Even = flower1.even?\n flower2Even = flower2.even?\n \n firstOddSecondEven = flower1Odd && flower2Even\n firstEvenSecondOdd = flower1Even && flower2Odd\n\n inLove = firstOddSecondEven || firstEvenSecondOdd\n \n return inLove\nend",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def ice_cream_shop(flavor, favorite)\n return false if flavor.empty?\n return flavor[0] == favorite if flavor.length == 1\n return flavor[0] == favorite || ice_cream_shop(flavor[1..-1], favorite)\nend",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.length.zero?\n\n return flavors.first == favorite if flavors.length == 1\n\n flavors.first == favorite || ice_cream_shop(flavors[1..-1], favorite)\nend",
"def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend",
"def ==(another_expense)\n self.name == another_expense.name && self.category == another_expense.category #likely not required for present purposes but included for illustration\n end",
"def food?; @food; end",
"def food?; @food; end",
"def food?; @food; end",
"def weatherman (condition, temperature)\n if condition == \"rainy\" && temperature == \"cold\"\n puts \"Better stay inside!\"\n elsif condition == \"rainy\" && temperature == \"hot\"\n puts \"Sounds like a gross combination.\"\n elsif condition == \"sunny\" && temperature == \"hot\"\n puts \"Maybe best to go swimming.\"\n elsif condition == \"windy\" && temperature == \"cold\"\n puts \"Bundle up!\"\n elsif condition == \"windy\" && temperature == \"hot\"\n puts \"Tornado warning!\"\n end\nend",
"def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend",
"def ice_cream_shop(flavors, favorite)\n if flavors.empty?\n return false\n end\n\n return true if favorite == flavors.pop\n ice_cream_shop(flavors, favorite)\nend",
"def check_dog\n if @vaccinated && @wormed\n \"#{@name} can be accepted\"\n elsif @vaccinated || @wormed\n \"#{@name} can only be accepted by itself\"\n else\n \"#{@name} can not be accepted\"\n end\nend",
"def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def eq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n type = EQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 380:6: '=='\n match( \"==\" )\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__, 53 )\n\n end",
"def eq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 69 )\n\n type = EQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 190:6: '=='\n match( \"==\" )\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__, 69 )\n\n end",
"def part4(inDoor)\n if 1\n puts 'You got eaten'\n elsif 2\n puts 'You ate strangers'\n elsif 3\n puts 'You got a billion'\n else\n puts 'You got nothing'\n end\nend",
"def casefold?() end",
"def favorite_food(name)\n formatted_name = name.capitalize\n\n return 'vindaloo' if formatted_name == 'Lister'\n return 'mashed potatoes' if formatted_name == 'Rimmer'\n\n 'hard to say...maybe fried plantain?'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def C\r\n puts \"\\nYOU HAVE #{$food} UNITS OF FOOD\"\r\n puts \"HOW MANY DO YOU WANT TO EAT?\"\r\n wanna_eat = gets.strip.to_i\r\n if wanna_eat> $food\r\n puts \"THATS MORE FOOD THAN YOU HAVE\\n\"\r\n else\r\n $food = $food-wanna_eat\r\n $strength = $strength+(5*wanna_eat)\r\n end\r\n return \"F\" \r\nend",
"def jungle_animal(animal, my_speed)\n # YOUR CODE HERE\n\n if animal == 'zebra'\n puts \"Try to ride a zebra!\"\n elsif animal == 'cheetah' && my_speed > 115\n puts 'Run!'\n elsif animal == 'cheetah' && my_speed <= 115\n puts 'Stay calm and wait!'\n else\n puts 'Introduce yourself!'\n end\n\n\nend",
"def they_here\n included = true\n new_animals = [\"Andean Cat\", \"Dodo\", \"Saiga Antelope\"]\n new_animals.each do |animal|\n @animal_array.each do |animal2|\n if animal == animal2\n included\n puts \"#{animal} is extinct\"\n else\n !included\n end\n end\n end\nend",
"def compare_cats\n puts \"\\nWhich two cats would you like to compare?\"\n puts \"\\nOr, you can type 'exit' to go back to the Main Menu.\"\n puts \"\\nPlease enter the name of first cat you'd like to compare...\"\n first = gets.chomp\n if first == \"exit\"\n main_menu\n end\n puts \"\\nPlease enter the name of second cat...\"\n second = gets.chomp\n cat_1 = Cat.find_by(name: first)\n cat_2 = Cat.find_by(name: second)\n case\n when cat_1.nil? || cat_2.nil?\n puts \"\\nOne or both of those cats is not in the database.\"\n puts \"\\nPlease put in a valid name\"\n compare_cats\n else\n if cat_1.name == cat_2.name\n puts \"\\nThat's the same cat...\"\n elsif cat_1.temperament == true && cat_2.temperament == true\n puts \"\\nThese cats get along with everyone 😻\"\n elsif cat_1.temperament == true && cat_2.temperament == false\n puts \"\\nThese cats will NOT get along! 😾\"\n elsif cat_1.temperament == false && cat_2.temperament == true\n puts \"\\nThese cats will NOT get along! 😾\"\n elsif cat_1.temperament == false && cat_2.temperament == false\n puts \"\\nThese cats don't get along with anybody!! 😾\"\n end\n end\n end",
"def might_be_extinct(hash, string)\n is_It = \"This animal is NOT extinct.\"\n hash.each do |animal, year|\n if string == animal\n is_It = \"This animal is extinct...\"\n end\n end\n is_It\nend",
"def favourite_foods(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def meal_choice(op1, op2, op3 = \"tofu\")\n puts\"What a nutritious meal!\"\n meal = \"A plate of #{op3} with #{op1} and #{op2}.\"\n puts meal\n meal\nend",
"def ice_cream_shop(flavors, favorite)\n return true if flavors.pop == favorite\n return false if flavors.length == 1 || flavors.empty?\n ice_cream_shop(flavors, favorite)\nend",
"def ice_cream_shop(flavors,favorite)\r\n return false if flavors.length == 0\r\n return true if flavors[0] == favorite\r\n ice_cream_shop(flavors[1..-1],favorite)\r\nend",
"def meal \n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return \"Breakfast\"\n \"Dinner\"\nend",
"def can_i_access_your_profile(is_friend, my_city, their_city, their_school)\n if is_friend\n is_friend\n elsif my_city == their_city && their_school == \"MakerSquare\"\n puts \"Yes\"\n elsif my_city == their_city\n puts \"Mehh\"\n else\n puts \"Naw\"\n end\nend",
"def greet(name)\n puts \"hi #{name}!\"\n if name == \"nico\" || name == \"nicolas\"\n puts \"that's a great name \\n\"\n end\nend",
"def ice_cream_shop(flavors, favorite) \n offers = flavors[0] == favorite \n return offers if offers == true\n return offers if flavors.length <= 1\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def all_else_equal(arr)\n\nend",
"def equality\r\n node = relational()\r\n\r\n loop do\r\n if consume(\"==\")\r\n node = new_binary(ND_EQ, node, relational())\r\n elsif consume(\"!=\")\r\n node = new_binary(ND_NE, node, relational())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def other_options\n puts \"\\nWould you like to see another recipe?\\nPlease enter 'Yes' or 'No':\"\n\n input = \"\"\n while input\n input = gets.strip.upcase\n case input\n when \"YES\"\n return true\n when \"NO\"\n puts \"\\nEnjoy your meal!\"\n return false\n else\n puts \"\\nPlease enter 'Yes' or 'No'.\"\n end\n end\n end",
"def similar!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = SIMILAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 56:10: '=='\n match( \"==\" )\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__, 35 )\n\n\n end",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n return ice_cream_shop(flavors, favorite)\nend",
"def mood\n #it \"has a method 'mood' that returns 'happy' when the user is more happy than nauseous\" do\n if self.happiness && self.nausea\n if self.happiness > self.nausea\n \"happy\"\n #it \"has a method 'mood' that returns 'sad' when the user is more nauseous than happy\" do\n elsif self.happiness < self.nausea\n \"sad\"\n end\n end\n end",
"def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.first == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def ice_cream_shop(flavors, favorite)\n checker = flavors.pop\n return true if checker == favorite\n return false if flavors.length == 0\n ice_cream_shop(flavors, favorite)\nend",
"def elseif!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n type = ELSEIF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 324:10: 'elseif'\n match( \"elseif\" )\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__, 22 )\n\n end",
"def ice_cream_shop(flavors, favorite)\n return false if flavors == []\n return true if flavors[0] == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.length == 0\n\n flavors[0] == favorite ? true : ice_cream_shop(flavors[1..-1], favorite)\nend",
"def decide\n input = '0'\n puts \"What would you like to do? 1) hit 2) stay\"\n loop do\n input = gets.chomp\n if !['1', '2'].include?(input)\n puts \"Error: you must enter 1 or 2\"\n else\n break\n end\n end\n puts \"Hit me!\" if input == '1'\n puts \"Stay!\" if input == '2'\n input \n end",
"def ice_cream_shop(flavors, favorite)\n return true if favorite == flavors[0]\n return false if flavors.length <= 1\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def ice_cream_shop(flavors,favorite)\n return true if flavors[0] == favorite\n return false if flavors.length < 1\n ice_cream_shop(flavors[1..-1],favorite)\nend",
"def meal_choice(food_type = \"meat\")\n food_type\nend",
"def food_item?\n @itype_id == 3\n end",
"def ice_cream_shop(flavors, favorite)\n return true if flavors.first == favorite\n return false if flavors.empty?\n\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def produce_food\n\n # if @type != \"corn\" || @type != \"wheat\"\n # \"Error Type! Please enter corn or wheat\"\n\n if @type == \"corn\"\n @area * Corn\n\n elsif @type == \"wheat\"\n @area * Wheat\n end\n end",
"def eat(food)\n if food.veggie? && !@carnivore\n @hunger -= 10\n elsif food.meat? && @carnivore\n @hunger -= 10\n end\n @hunger = 0 if @hunger < 0\n end",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors[0] == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def equal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n\n\n type = EQUAL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 54:8: '='\n match( 0x3d )\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__, 33 )\n\n\n end",
"def meal_choice( food = \"meat\") \n return food\nend",
"def ice_cream_shop(flavors, favorite)\n return true if flavors.first == favorite\n ice_cream_shop(flavors[1..-1],favorite) until flavors.first == nil\nend",
"def super_effective(type1, type2)\n # Psychic effective against everything non-pyschic\n if type1 == :psychic && type2 != :psychic\n return SUPER_EFFECTIVE_FACTOR\n elsif SUPER_EFFECTIVE[type1] == type2\n return SUPER_EFFECTIVE_FACTOR\n else\n return 1\n end\nend",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n # favorite == flavors[0] if flavors.length == 1 #错的\n return true if favorite == flavors[0]\n ice_cream_shop(flavors[1..-1], favorite)\nend",
"def vowels_with_ternary_operator(letter)\n (vowels.include? letter) ? true : false # this only seems to work when I put the conditional in parenthesis\nend",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n if flavors[0] == favorite && flavors.length == 1\n return true\n else\n pick_one_flavors = flavors.sample\n flavors.delete(pick_one_flavors) unless pick_one_flavors == favorite\n ice_cream_shop(flavors, favorite)\n end\nend",
"def check_extinct(animal, extinct_list)\n if extinct_list[animal]\n puts \"#{animal} is extinct\"\n else\n puts \"#{animal} is not extinct\"\n end\nend",
"def prompt_hit_or_stay\n puts \"\\nWould you like to (1) hit or (2) stay?\"\n response = gets.chomp\n while response != \"1\" && response != \"2\"\n puts \"Please choose either (1) for hit or (2) for stay.\"\n response = gets.chomp\n end\n return response\n end",
"def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend",
"def switch(it)\n it == true ? false : true\nend",
"def food_and_drink; end",
"def body_function \n puts \"Please leave a desposit...\"\n body_function = gets.chomp #local variable\n if ['wee', 'pee', 'piss', 'slash', 'tinkle', 'piddle', 'urinate', 'wee-wee', 'pee-pee', '1'].any? { |word| body_function.downcase.include?(word) } # => true\n puts \"You pee into the bowl\"\n elsif ['poo', 'poop', 'crap', 'defecation', 'excretion', 'dung', 'discharge', 'shit', 'turd', 'bog', '2'].any? { |word| body_function.downcase.include?(word) } # => true\n puts \"You poo into the bowl\" \n elsif ['fart', 'fluff', 'puff', 'let rip'].any? { |word| body_function.downcase.include?(word) } # => true\n puts 'You fart into the toilet bowl'\n end\nend",
"def equals(one, two)\n matched_by(one, two)\n matched_by(two, one)\n end"
] |
[
"0.67317057",
"0.64594895",
"0.63268614",
"0.62275034",
"0.6100794",
"0.5943807",
"0.5914828",
"0.5830672",
"0.5829338",
"0.5818682",
"0.57995474",
"0.5782956",
"0.5764162",
"0.574029",
"0.56559646",
"0.5612018",
"0.55872655",
"0.5573228",
"0.55652463",
"0.5513945",
"0.54975706",
"0.5447697",
"0.5440023",
"0.5440023",
"0.54267853",
"0.54267853",
"0.54246825",
"0.54217607",
"0.5411257",
"0.5368172",
"0.53622824",
"0.53622824",
"0.53622824",
"0.5359929",
"0.5346731",
"0.534174",
"0.53352773",
"0.5326449",
"0.5311295",
"0.5301546",
"0.52979785",
"0.5296874",
"0.52796507",
"0.5279587",
"0.5279587",
"0.5279587",
"0.5279587",
"0.5279587",
"0.5279587",
"0.5279587",
"0.5279587",
"0.52764314",
"0.52729493",
"0.5264554",
"0.52457225",
"0.52383053",
"0.5236884",
"0.52196157",
"0.521911",
"0.5214067",
"0.52105594",
"0.51921296",
"0.5176943",
"0.5176005",
"0.5168217",
"0.516379",
"0.51627034",
"0.5154855",
"0.51498085",
"0.51470566",
"0.5145239",
"0.51329815",
"0.5128541",
"0.51266044",
"0.51262504",
"0.510798",
"0.5100147",
"0.5098727",
"0.5098609",
"0.5093856",
"0.5092821",
"0.5089201",
"0.50811553",
"0.5080602",
"0.5079032",
"0.5077514",
"0.50737673",
"0.5068249",
"0.50673413",
"0.5066445",
"0.5064845",
"0.5059124",
"0.5053063",
"0.5052212",
"0.50518",
"0.50511056",
"0.50448763",
"0.50400364",
"0.5037038",
"0.50298625"
] |
0.622389
|
4
|
Returns an Array containing the segments of a constant path.
|
def constant_segments(node)
segments = []
if node.children[0]
segments.concat(constant_segments(node.children[0]))
end
segments << node.children[1].to_s
return segments
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] unless match.pre_match.empty?\n segments << match[2].intern\n path = strip[match.post_match]\n end\n segments << strip[path] unless path.empty?\n segments\n end",
"def segments\n if !@segments.present?\n @segments = path.split('/').select { |s| !s.empty? }\n else\n @segments\n end\n end",
"def path_segments(path, segments = [])\n if path == '/'\n return segments\n else\n prefix, _ = File.split(path)\n return path_segments(prefix, [path] + segments)\n end\n end",
"def path_arr()\n return @paths\n end",
"def key_segments\n if !@key_segments.present?\n @key_segments ||= path.split('/').map do |s|\n s if s[0] == ':'\n end.compact\n else\n @key_segments\n end\n end",
"def patharray\n return @pathArray\n end",
"def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def path_comps path\n path.nil? || path.empty? ? [] : path[1..(path[-1] == \"/\" ? -2 : -1)].split('/')\n end",
"def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end",
"def getPathElements(path)\n #N Without this path as a single string won't be decomposed into a list of elements\n return path.is_a?(String) ? (path == \"\" ? [] : path.split(\"/\")) : path\n end",
"def const_candidates(segments)\n [segments] + segments.map.with_index do |segment, idx|\n candidate = segments[0...(segments.size - (idx + 1))]\n candidate + segments[(segments.size - (idx + 1))..-1].map do |sub_seg|\n \"#{sub_seg}#{suffix}\"\n end\n end\n end",
"def path_components\n ENV[\"PATH\"].split(File::PATH_SEPARATOR)\n end",
"def find_segments(cookie_line)\n\t\tsegments_str = cookie_line.scan(/\\ssegments=[a-zA-z1-9,]*\\s{1}/).first # Scan the string for segments= and comma-separated values\n\t\tif segments_str \n\t\t\tsegments_str.gsub!('segments=','')\n\t\t\tarray = segments_str.split(',')\n\t\t\tarray.each(&:strip!) # Remove any extra spaces\n\t\telse\n\t\t\t[]\n\t\tend\n\tend",
"def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end",
"def paths\n Array(config.path).map(&:to_s)\n end",
"def path_array\n a = []\n each_filename { |ea| a << ea }\n a\n end",
"def paths_to_array\n [{:paths => paths.collect {|p| p.to_array}}]\n end",
"def symbol_segments\n segments.select{ |s| s.is_a?(Symbol) }\n end",
"def content_paths(path)\n arr = []\n @content_tree.with_subtree(path, nil, nil) do |node|\n arr << node.doc_path\n end\n arr\n end",
"def pathlist\n @path\n end",
"def path\n [[\"path\"].concat(ENV['PATH'].split(File::PATH_SEPARATOR))]\n end",
"def convert_to_path_params_segments(some_path)\n segs = strip_bookend_slashes(some_path).split('/')\n \n return segs.map{ |seg|\n if ms = seg.match(/(?<=:)\\w+/)\n ms[0].to_sym\n else\n seg\n end\n }\n end",
"def split(path)\n array = path.kind_of?(String) ? path.split(\"/\") : path.dup\n array.shift if nil_or_empty_string?(array[0])\n array.pop if nil_or_empty_string?(array[-1])\n array\n end",
"def split_path(path)\n path.strip.split(/[,;:\\ \\n\\t]/).map{|s| s.strip}\n end",
"def split_nsh_path(path)\n result = [\"\",path]\n result[0] = path.split(\"/\")[2] if path.start_with?(\"//\")\n result[1] = \"/#{path.split(\"/\")[3..-1].join(\"/\")}\" if path.start_with?(\"//\") \n result\n end",
"def loadable_constants_for_path(path, bases = autoload_paths)\n path = path.chomp(\".rb\")\n expanded_path = File.expand_path(path)\n paths = []\n\n bases.each do |root|\n expanded_root = File.expand_path(root)\n next unless expanded_path.start_with?(expanded_root)\n\n root_size = expanded_root.size\n next if expanded_path[root_size] != ?/\n\n nesting = expanded_path[(root_size + 1)..-1]\n paths << nesting.camelize unless nesting.blank?\n end\n\n paths.uniq!\n paths\n end",
"def paths\n @paths ||= []\n @paths\n end",
"def paths\n @paths ||= []\n @paths\n end",
"def get_array(path='.')\n Element.get_array(@element, path)\n end",
"def path_array\n path = []\n yield_path do |x, y|\n path << [x,y]\n end\n path.reverse\n end",
"def qualified_segments\n @qualified_segment_mutex.synchronize { @qualified_segments.clone }\n end",
"def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end",
"def list_paths\n @paths = RouteRecognizer.new.initial_path_segments.reject do |path|\n %w(assets rails).include? path\n end\n end",
"def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end",
"def get_subresources(path)\n ret = []\n @route_info.keys.sort.each do |sub|\n if RAPIDoc.is_sub_path(path, sub)\n ret << sub\n end\n end\n return ret\n end",
"def all\n segments_attrs = @connection.send_request('get_segments')['result']\n segments_attrs.map do |id, attrs|\n Segment.new(attrs.merge('id' => id))\n end\n end",
"def get_all_segment_ids\n allsegs = get_all_segments\n segs = JSON.parse(allsegs)\n # make an array of ids\n return segs['segments'].map {|k,v| k['id']}\n end",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def split_path(str)\n return str.map(&:to_s) if str.is_a?(::Array)\n @delimiter_handler.split_path(str.to_s)\n end",
"def segments; end",
"def split_all(path)\n head, tail = File.split(path)\n return [tail] if head == '.' || tail == '/'\n return [head, tail] if head == '/'\n return split_all(head) + [tail]\n end",
"def split_all(path)\n head, tail = File.split(path)\n return [tail] if head == '.' || tail == '/'\n return [head, tail] if head == '/'\n return split_all(head) + [tail]\n end",
"def get_array(path=\"\")\n Element.get_array(@element, path)\n end",
"def segment_names_a\n [from.value, to.value]\n end",
"def segments(gfa)\n raise \"Unindexed GFA\" unless gfa.indexed?\n [gfa.segments[from.value], gfa.segments[to.value]]\n end",
"def route_enclosing_names\n @route_enclosing_names ||= returning(Array.new) do |req|\n enclosing_segments.each do |segment|\n unless segment.is_optional or segment.is_a?(::ActionController::Routing::DividerSegment)\n req << [segment.value, true] if segment.is_a?(::ActionController::Routing::StaticSegment)\n req.last[1] = false if segment.is_a?(::ActionController::Routing::DynamicSegment)\n end\n end\n end\n end",
"def lb_paths(linkbase_constant)\n paths=[]\n begin\n linkbase_refs=@taxonomy_content[\"annotation\"][0][\"appinfo\"][0][\"linkbaseRef\"]\n linkbase_refs.each do |ref|\n if ref[\"xlink:role\"]==linkbase_constant\n paths << \"#{@taxonomy_file_basedir}#{ref[\"xml:base\"]}#{ref[\"xlink:href\"]}\"\n end\n end\n rescue Exception => e\n end\n paths\n end",
"def make_segment_array(segment_hash, segment)\n merged_hash = nil\n segment_var = segment.to_s.split('_').first\n eval(\"merged_hash = segment_hash.merge(@#{segment_var})\")\n segment_array = merged_hash.segmentize.to_string\n end",
"def get_path_pins(path); end",
"def get_path_pins(path); end",
"def toPathList(arr); arr.join(File::PATH_SEPARATOR) end",
"def path(start,predicate)\n array = Array.new\n start.each { |elem|\n array.push(elem)\n if predicate.call(elem)\n return array\n end\n }\n nil\n end",
"def metadata_paths(path)\n arr = []\n @metadata_tree.with_subtree(path, nil, nil, nil) do |node|\n arr << node.doc_path\n end\n arr\n end",
"def path_parts(input) # :nodoc:\n case input\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)([\\[\\/])(['\"])([^\\3]*)$/\n $~.to_a.slice(1, 4).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+(?:\\[[^\\]]+\\])*)(\\.)(\\w*)$/\n $~.to_a.slice(1, 3).push($~.pre_match)\n when /((?:@{1,2}|\\$|)\\w+)$/\n $~.to_a.slice(1, 1).push(nil).push($~.pre_match)\n else\n [ nil, nil, nil ]\n end\n end",
"def rubylog_segments\n segments = [[0]]\n vars = []\n\n scan RUBYLOG_VAR_REGEXP do\n match = Regexp.last_match\n segments.last << match.begin(0)\n segments << [match.end(0)]\n vars << rubylog_get_string_variable(match[1], match[2])\n end\n \n\n segments.last << length\n segments = segments.map{|s|self[s[0]...s[1]]}\n return segments, vars\n end",
"def split_path(path)\n parts = path.split('/')\n [parts[0..-2].join('/'), parts[-1]]\n end",
"def paths(arrs)\n arrs.inject([[]]) do |paths, arr|\n arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)\n end\n end",
"def paths\n end_verts = ends\n paths = []\n vertices.each do |v|\n end_verts.each do |e|\n x = path?(v.id, e.id)\n if x.is_a?(Array)\n x[1] << v.data\n paths << x[1]\n end\n end\n end\n end_verts.each { |e| paths << e.data }\n paths\n end",
"def split_path; end",
"def lists_and_segments\n response = get \"listsandsegments\", {}\n Hashie::Mash.new(response)\n end",
"def segmentpairs\n unless defined?(@segmentparis); parse_segmentpairs; end\n @segmentpairs\n end",
"def paths_s\n \"['#{paths.join(\"','\")}']\"\n end",
"def segmentpairs\n unless defined?(@segmentpairs); parse_segmentpairs; end\n @segmentpairs\n end",
"def path_to_parts(path)\n path.\n downcase.\n split('/').\n map { |part| part.empty? ? nil : part.strip }.\n compact\n end",
"def split() File.split(path).map {|f| Path::Name.new(f) } end",
"def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end",
"def path\n @path || []\n end",
"def path_ids\n @objects.map{|e| e.path_id}\n end",
"def split_path(path)\n path.split(\"/\", -1)\n end",
"def color(path)\r\n color_array = Array.new\r\n\r\n path[0...-1].each_with_index {|x, index|\r\n lines_curr = Array.new\r\n lines_next = Array.new\r\n lines_curr = lines_at_station(x)\r\n lines_next = lines_at_station(path[index+1])\r\n color_array.push((lines_curr & lines_next).first)\r\n }\r\n\r\n return color_array\r\n end",
"def all_data_paths(path)\n each_data_path(path).to_a\n end",
"def find_path(val)\n self.each_with_index do |v, k|\n k, v = v if self.kind_of?(Hash)\n return [k] if v == val\n\n c = v.respond_to?(:find_path) ? v.find_path(val) : []\n return c.unshift(k) unless c.blank?\n end\n []\n end",
"def split_paths\n symbols = ox_doc.locate('svg/defs/g/symbol')\n symbols.each do |symbol|\n path = symbol.nodes.first\n parsed_path = Savage::Parser.parse(path[:d])\n subpath_elements = []\n\n parsed_path.subpaths.each do |subpath|\n path_element = Ox::Element.new('path').tap { |prop| prop[:d] = subpath.to_command }\n subpath_elements.push path_element\n end\n\n symbol.nodes.clear\n subpath_elements.each { |pth| symbol << pth }\n end\n end",
"def segments\n if magic32?\n command(:LC_SEGMENT)\n else\n command(:LC_SEGMENT_64)\n end\n end",
"def paths\n @paths ||= {}.with_indifferent_access\n end",
"def constants\n @constant_ids.collect { |idx| BConstant.store[idx] }\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def path\n return @path_array if @path_array\n parent_category = self\n @path_array = [parent_category]\n while (parent_category = parent_category.parent) != nil do\n @path_array.insert(0, parent_category) \n end\n @path_array\n end",
"def split_paths(path)\n dir_list = path.split('/').drop(1) # drops the \"\" because of the first \"/\"\n path_list = ['/'+dir_list.first]\n dir_list.drop(1).each do |dir|\n path = path_list.last + '/' + dir\n path_list.push path\n end\n path_list\nend",
"def path_to_searchable(path)\n last = path.last\n return [last.node.node_id, last.first_side]\n end",
"def get_contact_segments(id)\n return make_request(\"#{self.endpoint}/#{id}/segments\")\n end",
"def getSegments (xStart, xEnd, yStart, yEnd, board)\n\n\tsegBoard = Array.new\n\tind = 0\n\tfor i in xStart..xEnd\n\t\tfor j in yStart..yEnd\n\t\t\tsegBoard[ind] = board[j][i]\n\t\t\tind+=1\n\t\tend\n\tend \n\n\treturn segBoard\n\nend",
"def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end",
"def path_components\n [configuration_name]\n end",
"def make_segment_array(segment_hash, segment)\n merged_hash = nil\n segment_variable = segment.to_s.split('_').first\n if !segment_hash.blank?\n # This is to insert '#' to the segment option for which size hash is defined\n eval(\" if @#{segment_variable}[:size]\n @#{segment_variable}[:size].each do |key, value|\n segment_hash[key] += \\\"#\\#{value}\\\" if segment_hash[key]\n end\n end\n merged_hash = segment_hash.merge(@#{segment_variable})\")\n end\n if !merged_hash.blank?\n merged_hash.delete(:size)\n segment_array = merged_hash.segmentize.to_string\n end\n end",
"def slices\n slice_names.map do |name|\n Object.full_const_get(name) rescue nil\n end.compact\n end",
"def constants\n all = []\n method_compilers.each_compiler{|comp| all += comp.constants }\n all\n end",
"def path_ids\n ancestry_ascendente_directo.split(',').map{|a| a.to_i if a.present?}.compact\n end",
"def __endpoint_parts\n parts = @spec['url']['paths'].select do |a|\n a.keys.include?('parts')\n end.map do |path|\n path&.[]('parts')\n end\n (parts.inject(&:merge) || [])\n end",
"def find_each_path_rectangle\n paths = []\n\n iterate_over_each_character_in_array_of_lines(@map_in_lines) do |y, x|\n c = @map_in_lines[y][x]\n\n next if c == '.'\n\n if above(y, x) == '.' and left(y, x) == '.'\n paths.push([])\n paths.last.push([y,x])\n\n until below(y, x) == '.' and left(y, x) == '.'\n y += 1\n end\n\n until below(y, x) == '.' and right(y, x) == '.'\n x += 1\n end\n\n paths.last.push([y, x])\n end\n end\n\n paths\n end",
"def parse(node_path)\n path = node_path[1..-1] while node_part.start_with '/' # lstrip '/'\n key = []\n for part in @path\n if part.is_a? String\n if path.start_with(part)\n path = path[part.length..-1]\n else\n raise \"Incorrect path for #{self} at #{part}: #{node_path} at #{part}\"\n end\n elsif part.is_a? Symbol\n value, path = path.split('/', 1)\n key << value\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n key\n end",
"def to_array_form(external_ref_path)\n # TODO: use regexp disjunction\n external_ref_path.gsub(/^node\\[/, '').gsub(/^service\\[/, '').gsub(/\\]$/, '').split('][')\n end",
"def all_active_paths\n all_active_states.map(&:path)\n end",
"def enclosing_segments\n segments = remove_namespaces_from_segments(recognized_route.segments.dup)\n while segments.size > 0\n segment = segments.pop\n return segments if segment.is_a?(::ActionController::Routing::StaticSegment) && segment.value == resource_specification.segment\n end\n ResourcesController.raise_missing_segment(self)\n end",
"def cspsearchpath\n eval @paths_key\n end",
"def split_path(path)\n m = CHEF_OBJECT_RE.match(path)\n unless m\n warn \"Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments/*.{rb,json}' or '*data_bags/*.{rb,json}'\"\n return\n else\n parent_seg, child_seg = m.captures\n child_seg.gsub!(/\\.(rb|json)$/, \"\")\n extension = $1\n [parent_seg, child_seg, extension]\n end\n end",
"def san_paths\n san_array_node = self.sans.first.san_array_node\n return [] if san_array_node.nil?\n x = san_array_node.san_interfaces\n return [] if x.length < 1\n xx = x.enum_slice((x.length / 2)).to_a \n # permitation of san controllers\n san_port_array = xx.first.zip(xx.last).flatten(1)\n san_interfaces.map{|saniface| [saniface.first, \n san_port_array[saniface.last.split('.').last.to_i % san_port_array.length].last] }\n end",
"def to_a = @paths.dup",
"def defined_paths()\n return root_defined_path_part\n end"
] |
[
"0.73867816",
"0.7174711",
"0.66963434",
"0.66170824",
"0.620103",
"0.61622316",
"0.6158511",
"0.61437505",
"0.6074302",
"0.6015535",
"0.60024714",
"0.5941801",
"0.5906851",
"0.5896547",
"0.58913326",
"0.586919",
"0.58139795",
"0.58119565",
"0.5810146",
"0.5738162",
"0.57370985",
"0.5736184",
"0.5676277",
"0.5674388",
"0.56588197",
"0.5635269",
"0.56343037",
"0.56343037",
"0.56203645",
"0.5594357",
"0.55849147",
"0.5582624",
"0.55814093",
"0.55701876",
"0.5543219",
"0.5523319",
"0.5514685",
"0.55044407",
"0.55044407",
"0.54935235",
"0.54807097",
"0.54737836",
"0.54737836",
"0.5458448",
"0.54550326",
"0.54487115",
"0.5413642",
"0.5411834",
"0.5383455",
"0.5382947",
"0.5382947",
"0.53825486",
"0.53818256",
"0.53792965",
"0.5365695",
"0.53511745",
"0.53458625",
"0.5340338",
"0.5332537",
"0.53162897",
"0.5311562",
"0.53105295",
"0.5309375",
"0.53067046",
"0.5292035",
"0.5284702",
"0.52842814",
"0.5282273",
"0.5276008",
"0.5256399",
"0.5234327",
"0.5229842",
"0.5208949",
"0.52059484",
"0.5193596",
"0.51916456",
"0.51849306",
"0.51753724",
"0.517274",
"0.5160649",
"0.51540595",
"0.51528305",
"0.51395524",
"0.51349425",
"0.51256114",
"0.51209533",
"0.5094557",
"0.5091753",
"0.50860417",
"0.5068043",
"0.5067219",
"0.5065386",
"0.5065237",
"0.50592935",
"0.50579774",
"0.5053047",
"0.50383",
"0.50281626",
"0.5027033",
"0.50192803"
] |
0.7640927
|
0
|
Don't do fill setup
|
def fill_setup(_gc)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fill_setup(gc)\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n # noop\n end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n self.setup! unless self.setup?\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def before_setup\n # do nothing by default\n end",
"def do_setup; \"\" end",
"def reset\n setup\n end",
"def setup\n # no setup\n\tend",
"def reset\n initialize\n setup\n end",
"def setup\n true\n end",
"def setup()\n end",
"def setup\r\n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def minimal_setup\n raise NotImplemented\n end",
"def after_setup\n # do nothing by default\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def fill\n \t@fill\n end",
"def setup\n # override this if needed\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n raise \"Unimplemented method #setup\"\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup; end",
"def setup\n yield self\n self\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n yield self\n self\n end",
"def setup\n ''\n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n # override and do something appropriate\n end",
"def post_setup\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup(state) ; end",
"def before_setup; end",
"def setup(&b)\r\n\t\t\t@setup = b\r\n\t\tend"
] |
[
"0.75280595",
"0.7078427",
"0.7078427",
"0.6971083",
"0.6915514",
"0.6915514",
"0.6868871",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6563023",
"0.650687",
"0.6501948",
"0.6470721",
"0.6460074",
"0.6424137",
"0.6386713",
"0.6369103",
"0.63268673",
"0.63268673",
"0.6326644",
"0.630733",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.6293223",
"0.62848926",
"0.6275994",
"0.6248439",
"0.6248439",
"0.6248439",
"0.6248439",
"0.6248439",
"0.62109584",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.6181108",
"0.61673117",
"0.6164003",
"0.61530674",
"0.61530674",
"0.61530674",
"0.61530674",
"0.61530674",
"0.61530674",
"0.61435825",
"0.60799634",
"0.6063387",
"0.6063387",
"0.6063387",
"0.6063387",
"0.6063387",
"0.6063387",
"0.6063387",
"0.6037824",
"0.6037824",
"0.6029698",
"0.6029698",
"0.6029698",
"0.601558",
"0.5987366",
"0.59354985",
"0.59354985",
"0.5933929",
"0.5933929",
"0.5933929",
"0.5933929",
"0.5933929",
"0.5933929",
"0.5932811",
"0.5911797",
"0.5897387"
] |
0.75122476
|
1
|
OVERRIDE: Null out each controlled field before saving, meaning only incoming values will persist on the record. This results in blank controlled values in ingested CSVs being "deleted".
|
def update_collection(attrs)
# OVERRIDE: add call to custom #null_controlled_fields! method
null_controlled_fields!(attrs)
object.attributes = attrs
object.save!
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end",
"def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end",
"def normalize_blank_values\n attributes.each do |column, value|\n self[column].present? || self[column] = nil\n end\n end",
"def blank_out\n\t\tself.write_attribute(:value, nil )\n\tend",
"def flush_field\n (record_fields[current_field] ||= []) << current_value if current_field && current_value.to_s.match?(/[^\\s]/)\n @current_field = nil\n @current_value = nil\n end",
"def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end",
"def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end",
"def save\n self.attributes.delete('customer')\n self.attributes.delete('product')\n self.attributes.delete('credit_card')\n super\n end",
"def nullify_fields\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend",
"def nullify_fields\n user_fields = %W(\n comment\n )\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def clear_value_if_empty\n write_attribute(:value, nil) if self.value.is_a?(String) && self.value.empty?\n end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def clear!\n fields.each { |tag, field| self.__send__(\"#{field.name}=\", nil) }\n end",
"def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end",
"def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end",
"def clear_default_fields\n reset_cleared_default_fields\n self.default_fields.each do |k, v|\n if respond_to?(\"#{k}=\") && unescape(self.send(\"#{k}\")) == unescape(v)\n add_to_cleared_default_fields(k, self.send(\"#{k}\")) and self.send(\"#{k}=\", \"\")\n end\n end\n end",
"def clean_up\n @minefield = nil\n end",
"def reset_unnecessary_fields\n self.department_id = nil\n self.media = nil\n self.telephone = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end",
"def nullify_fields_if_these_are_admin_mode_settings\n # if mission_id is nil, that means we're in admin mode\n if mission_id.nil?\n (attributes.keys - ADMIN_MODE_KEYS - %w(id created_at updated_at mission_id)).each { |a| self.send(\"#{a}=\", nil) }\n end\n end",
"def clear_fields\n\t\tend",
"def sanitize_attributes!\n remove_invalid_subjects!\n remove_invalid_audiences!\n remove_invalid_levels!\n set_prices!\n nil\n end",
"def empty_unused_fields\n if @publication.scientific_article?\n # Empty fields specific to categories other than scientific_article\n @publication.book_title = ''\n @publication.book_authors = ''\n @publication.book_publisher = ''\n @publication.url = ''\n else\n # Empty fields specific to scientific_article\n @publication.journal_id = 0\n @publication.new_journal_name = ''\n @publication.DOI = ''\n @publication.volume = ''\n @publication.issue = ''\n @publication.pages = ''\n unless @publication.chapter?\n # Empty fields specific to book_chapter\n @publication.book_title = ''\n @publication.book_authors = ''\n end\n end\n end",
"def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end",
"def nullify_variant_values\n associated_variants.update_all( \"#{ variant_column } = NULL\" )\n end",
"def save\n# if empty?\n# nil\n# else\n super\n# end\n end",
"def add_converter_for_blank_fields\n CSV::Converters[:blank] = lambda { |s| s || '' }\n end",
"def strip_blanks\n STRIP_ATTRS.each { |attr| self[attr] = self[attr].strip if !self[attr].blank? }\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clean(record)\n return unless record.changed?\n attributes.each do |attribute|\n next unless record.changes[attribute.to_s]\n clean_each(record, attribute)\n end\n end",
"def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end",
"def persist\n prepare do\n document.attributes.delete(field)\n execute(\"$unset\")\n end\n end",
"def reset!\n defaults = Settler.config[self.key]\n self.label = defaults['label']\n self.value = defaults['value']\n self.editable = defaults['editable']\n self.deletable = defaults['deletable']\n self.deleted = false\n save(:validate => false)\n end",
"def clean_attributes\n attributes.delete(:bare_metal)\n attributes.delete(:flavor_id)\n attributes.delete(:ephemeral_storage)\n end",
"def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end",
"def nullify_blanks\n self.author = nil if author.blank?\n end",
"def nullify_insurance_fields_if_necessary\n return if self[:insured]\n self[:insurance_state_id] = nil\n self[:insurance_valid_from] = nil\n self[:insurance_valid_until] = nil\n self.insurance_certificate = nil\n return true\n end",
"def nullify\n criteria.update_all(foreign_key => nil)\n _target.clear do |doc|\n unbind_one(doc)\n doc.changed_attributes.delete(foreign_key)\n end\n end",
"def fill_fields(bf, ef)\n bf.each do |key, value|\n if value != \" \"\n ef.delete(key)\n end\n end\nend",
"def nil_if_blank\n NULL_ATTRS.each { |attr| self[attr] = nil if self[attr].blank? }\n end",
"def before_validation()\n self.attribute_names.each do |n|\n self[n] = self[n].strip if self[n].kind_of?(String)\n end\n end",
"def reset_default_fields\n self.cleared_default_fields.each do |k, v|\n self.send(\"#{k}=\", v)\n end\n end",
"def nullify\n target.send(metadata.foreign_key_setter, nil)\n target.send(:remove_instance_variable, \"@#{metadata.inverse(target)}\")\n base.send(:remove_instance_variable, \"@#{metadata.name}\")\n target.save\n end",
"def save_all_fields_from_record(record)\n self.save_base_attributes(record)\n self.changed_keys = record.attributes.keys\n self.old_values ||= Hash.new\n self.new_values ||= Hash.new\n record.attributes.keys.each do |key|\n self.old_values[key] = record.attributes[key]\n self.new_values[key] = nil\n end\n self.filter_attributes(record)\n end",
"def clear!\n set_ds_field []\n end",
"def clear!\n set_ds_field []\n end",
"def reset_unnecessary_fields\n self.raw_location = nil\n self.lat = nil\n self.lng = nil\n self.city = nil\n self.state = nil\n self.country_code = nil\n self.zip = nil\n self.photo_file_name = nil\n self.photo_content_type = nil\n self.photo_file_size = nil\n self.photo_updated_at = nil\n self.url = nil\n self.media = nil\n self.organization = nil\n self.department_id = nil\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n\n # TODO: 2. Finish the implementation to set the other fields. DONE\n end",
"def blank_to_nil_params\n record_params.merge!(record_params){|k, v| v.blank? ? nil : v}\n end",
"def clean_attributes\n @attribute_changes = {}\n end",
"def clean_data( field )\n\tfield.to_s.strip\nend",
"def model_attributes(params)\n clean_params = super #hydra-editor/app/forms/hydra_editor/form.rb:54\n # model expects these as multi-value; cast them back\n clean_params[:rights] = Array(params[:rights]) if params[:rights]\n clean_params[:title] = Array(params[:title]) if params[:title]\n if params[:description]\n clean_params[:description] = Array(params[:description])\n clean_params[:description].map! do |description|\n ::DescriptionSanitizer.new.sanitize(description)\n end\n end\n # Model expects provenance as single-value.\n if params[:provenance]\n clean_params[:provenance] = ::DescriptionSanitizer.\n new.sanitize(params[:provenance])\n end\n\n # Oops; we're blanking out these values when changing permissions and probably versions, too\n # -- they don't have these fields in the form at all so they don't get repopulated.\n clean_params = encode_physical_container(params, clean_params)\n clean_params = encode_external_id(params, clean_params)\n\n clean_params.keys.each do |key|\n # strip ALL the things!\n if clean_params[key].is_a?(Array)\n clean_params[key].map!(&:strip)\n elsif clean_params[key].is_a?(String)\n clean_params[key] = clean_params[key].strip\n end\n end\n\n clean_params\n end",
"def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def reset_fields\n each_field_name do |key|\n reset_field(key)\n end\n end",
"def reset_unnecessary_fields\n self.media = nil\n self.raw_location = nil\n self.lat = nil\n self.lng = nil\n self.city = nil\n self.state = nil\n self.country_code = nil\n self.zip = nil\n self.photo_file_name = nil\n self.photo_content_type = nil\n self.photo_file_size = nil\n self.photo_updated_at = nil\n self.url = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.department_id = nil\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end",
"def reset_persistence_values\n self.id = nil\n\n if respond_to?(:updated_at=)\n self.updated_at = nil\n self.updated_at_will_change!\n end\n\n if respond_to?(:created_at=)\n self.created_at = nil\n self.created_at_will_change!\n end\n\n # mark all other attributes is changing\n (attributes.keys - changes.keys).each{ |key| self.send(:\"#{key}_will_change!\") }\n end",
"def reset_fields\n if self.is_default?\n self.applies_to_all = true\n self.codes = []\n elsif self.applies_to_all?\n self.codes = []\n end\n\n return true\n end",
"def post_parse(record)\n numeric_fields.each do |field|\n if val = record[field] and val != :absent\n record[field] = record[field].split(\",\")\n end\n end\n end",
"def strip_string_fields\n all_fields = self.get_array_of_symbolic_keys\n # stripping\n all_fields.each do |field|\n unless self[field].nil?\n if self[field].class == String\n self[field] = self[field].strip\n end\n end\n end\n end",
"def set_old_values\n self._old_values = {}\n\n self.class.fields.each do |field|\n self._old_values[field] = self.send(field) unless field[0] == '_'\n end\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n # self.preferred_text_editor = @preferred_text_editor.text.strip.chomp\n # self.teaching_experience = @teaching_experience.text.strip.chomp\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def nillify_fields\n if self.rate_type == \"Per night\"\n self.number_of_guests = self.max_number_of_guests = nil\n end\n\n if self.rate == \"Rate Amount\"\n self.discount_type = self.discount_amount = nil\n elsif self.rate == \"Discount\"\n self.net_rate = self.commission_percent = nil\n end\n\n super\n end",
"def reset_cleared_default_fields\n @cleared_default_fields = {}\n end",
"def reset_fields\n self.outpost_queued = false\n # outpost_prevent is set and reset at end of previous turn\n # pirate_coins persists turn after turn\n self.gained_last_turn = []\n self.bought_victory = false\n self.played_treasure = false\n self.played_crossroads = false\n self.played_fools_gold = false\n save!\n end",
"def clear_fields\n self.password=nil\n self.username=nil\n self.role=nil\n end",
"def sanitize_input\n\t\t# to remove whitespace, use \n\t\t# self.<fieldname>.strip!\n\t\tself.homephone = self.homephone.gsub(/\\D/,'') if !self.homephone.blank?\n\t\tself.workphone = self.workphone.gsub(/\\D/,'') if !self.workphone.blank?\n\t\tself.cellphone = self.cellphone.gsub(/\\D/,'') if !self.cellphone.blank?\n\t\tself.fax = self.fax.gsub(/\\D/,'') if !self.fax.blank?\n\t\tself.prefcontactmethod = :Email if self.prefcontactmethod.blank?\n #\t\tself.email = self.email.downcase if self.email.present?\n\tend",
"def activerecord_persist\n record.save(validate: false)\n end",
"def before_import_save(record)\n self.allow_blank_password = true\n self.allow_blank_email = true\n end",
"def clear\n @field.each_index { |i| @field[i] = 0 }\n end",
"def fields=(val)\n @fields = val\n @fields = nil if @fields && @fields.empty?\n end",
"def cleared_default_fields\n @cleared_default_fields || {}\n end",
"def clear\r\n self.value = \"\"\r\n end",
"def before_save\n deserialized_values.each{|k,v| @values[k] = serialize_value(k, v)}\n super\n end",
"def reset_fields\n self.sender_doc_id_version = nil\n self.receiver_doc_id_version = nil\n self.project_doc_id_version = nil\n self.submission_receiver_doc_id = nil\n self.submission_project_doc_id = nil\n self.response_sender_doc_id = nil\n self.response_project_doc_id = nil\n self.plnd_submission = nil\n self.actl_submission = nil\n self.xpcd_response = nil\n self.actl_response = nil\n self.response_status = nil\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.age = @age.text.strip.chomp\n self.email = @email.text.strip.chomp\n self.github = @github.text.strip.chomp\n self.twitter = @twitter.text.strip.chomp\n self.fun_fact = @fun_fact.text.strip.chomp\n puts self.first_name\n puts self.last_name\n puts self.age\n\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def on_data_changed\n # Default column settings taken from\n defaults_hash = config[:owner].class.meta_columns.inject({}){ |r, c| r.merge!(c[:name] => c[:default_value]) }\n stripped_columns = data_class.all_columns.map do |c|\n # reject all keys that are 1) same as defaults\n c.reject{ |k,v| defaults_hash[k.to_sym].to_s == v.to_s }\n end\n store_data(stripped_columns)\n end",
"def reset_property_values\n write_attribute(:property_values, {})\n end",
"def custom_field_values_delete=(values)\n send :custom_field_values=, values, '-'\n end",
"def export_none\n @exported_fields = Set.new\n end",
"def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end",
"def remove_blank_contacts\n self.details = details.select { |cd| !cd.value.blank? }\n end",
"def partially_valid_clear\n @partially_valid_attributes = []\n end",
"def reset!\n self.entered_at = nil\n self.started_at = nil\n self.finished_at = nil\n self.status = \"\"\n\n self.save!(validate: false)\n end",
"def nil_address\n self.address_line1 = nil\n self.address_line2 = nil\n self.locality = nil\n self.county = nil\n self.country = nil\n self.postcode = nil\n end",
"def nullify_transactions\n device_transactions.update_all(quotation_id: nil, quotation_title: nil, quotation_description: nil, quotation_price: nil, quotation_quantity: nil, quotation_notes: nil)\n end",
"def strip_columns\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = self[field].strip\n end\n end",
"def test_optional_fields\n @event.event_finish = nil\n fields = ['event_start','entry_age_limit', 'internal_note', 'entry_fee_note', 'prize_info_note']\n fields = fields + ['event_finish','entry_deadline','tickets_note', 'general_note']\n \n for field in fields\n puts \"***SETTING TO NIL:#{field}\"\n @event.send(field << '=' , nil)\n assert @event.save\n end\n end",
"def clear_original_attributes(options = {})\n if !(options[:only] or options[:except]) || !@original_attributes\n return @original_attributes = nil\n end\n \n attributes_to_clear = if options[:only]\n Array(options[:only]).map(&:to_s)\n elsif options[:except]\n except = Array(options[:except]).map(&:to_s)\n self.class.column_names.reject { |c| except.include?(c) }\n end\n \n attributes_to_clear.each do |attribute|\n @original_attributes[attribute] = @attributes[attribute]\n end\n end",
"def _before_validation\n serialize_deserialized_values\n super\n end",
"def nullify_keys(records)\n if (user = acting_user)\n records.each { |r| r.user_changes!(user, @reflection.primary_key_name => nil) if r.is_a?(Hobo::Model) }\n end\n\n # Normal ActiveRecord implementatin\n ids = quoted_record_ids(records)\n @reflection.klass.update_all(\n \"#{@reflection.primary_key_name} = NULL\", \n \"#{@reflection.primary_key_name} = #{@owner.quoted_id} AND #{@reflection.klass.primary_key} IN (#{ids})\"\n )\n end",
"def remove_blank_attributes(attributes)\n attributes.delete_if { |key, value| clean_attribute(value) }\n end",
"def clear_back_office_data\n @flbt_type = nil\n @version = nil\n @submitted_date = nil\n @effective_date = nil\n @filing_date = nil\n @ads_included = nil\n @ads_amount = nil\n @number_of_buyers = nil\n end",
"def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end",
"def empty_lines_to_nulls\n job.log 'replace empty strings by nulls?'\n column_id = column_name.to_sym\n column_type = nil\n db.schema(table_name).each do |colid, coldef|\n if colid == column_id\n column_type = coldef[:type]\n end\n end\n if column_type != nil && column_type == :string\n #TODO: @capture_exceptions\n job.log 'string column found, replacing'\n QueryBatcher.new(\n db, \n job, \n create_seq_field = true\n ).execute_update(\n %Q{\n UPDATE #{qualified_table_name}\n SET #{column_name}=NULL\n WHERE #{column_name}=''\n },\n schema, table_name\n )\n else\n job.log 'no string column found, nothing replaced'\n end\n end",
"def clean_costs\n self.cost = nil\n save\n end",
"def save_self(safe = true)\n super && embedments.values.each do |e|\n e.loaded?(self) && Array(e.get!(self)).each { |r| r.original_attributes.clear }\n end\n end",
"def aggregate_treat_undefined_attributes_as_default_value?; end"
] |
[
"0.7359445",
"0.7180945",
"0.7000423",
"0.6892833",
"0.687399",
"0.6728838",
"0.66691464",
"0.66640687",
"0.6632706",
"0.65243804",
"0.6440418",
"0.6424094",
"0.6414484",
"0.64028084",
"0.6357682",
"0.6353168",
"0.63478416",
"0.6319233",
"0.62338644",
"0.62305874",
"0.61943305",
"0.6166108",
"0.6148695",
"0.61118597",
"0.6099432",
"0.6093641",
"0.60727876",
"0.6053574",
"0.60481155",
"0.60481155",
"0.6039732",
"0.6019441",
"0.60160303",
"0.59908456",
"0.597137",
"0.5966214",
"0.5964362",
"0.5951438",
"0.5929743",
"0.5924862",
"0.59245",
"0.59028554",
"0.59020466",
"0.5896243",
"0.5879658",
"0.5877188",
"0.5877188",
"0.58709604",
"0.58560324",
"0.58458924",
"0.5826524",
"0.58142495",
"0.58046174",
"0.58038",
"0.5797188",
"0.5796747",
"0.57934785",
"0.5783671",
"0.57816",
"0.57761705",
"0.5761984",
"0.5755404",
"0.57549685",
"0.5754195",
"0.5747486",
"0.57055527",
"0.56943244",
"0.56718427",
"0.566822",
"0.5667036",
"0.56606704",
"0.56580895",
"0.56577194",
"0.56451005",
"0.5632371",
"0.5624196",
"0.5609348",
"0.56079185",
"0.5605615",
"0.56031746",
"0.5587862",
"0.558599",
"0.5579535",
"0.55715096",
"0.5570057",
"0.5559358",
"0.55551004",
"0.55465746",
"0.5545786",
"0.55456805",
"0.5543985",
"0.5531298",
"0.5504441",
"0.55038327",
"0.5503783",
"0.54939246",
"0.5493297",
"0.54914653",
"0.5486916",
"0.54829067"
] |
0.55892605
|
80
|
OVERRIDE: Add custom method to make Bulkrax and ScoobySnacks more compatible
|
def null_controlled_fields!(attrs)
::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|
# do not null fields that are not being changed
next unless attrs.keys.include?("#{field_name}_attributes")
object.public_send("#{field_name}=", [])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def snat_pool\n super\n end",
"def sitemaps; end",
"def each\n snacks.each do |snack|\n yield snack\n end\n end",
"def private; end",
"def schubert; end",
"def snacks\n\n @snacks = Spree::Product.limit(5).order('id desc')\n @snacks.sort_by! { |x| x[:name].downcase }\n end",
"def shard; end",
"def generic_traps_v2\n super\n end",
"def strategy; end",
"def prepareForReuse; end",
"def custom; end",
"def custom; end",
"def shipped\n \n end",
"def bi_service\n end",
"def snat_type\n super\n end",
"def call_squadron; end",
"def process_fix\n super\n end",
"def method_731(base); end",
"def database_sync_api\n snacks = Suggestion.all\n\n snacks.each do |snack|\n if !api_snack_checker?(snack.name)\n data_to_api(snack.name, snack.location, snack.optional)\n end\n end\n end",
"def overload; end",
"def fetch(short)\n raise NotImplementedError\n end",
"def starship; end",
"def smux_subagent\n super\n end",
"def processor; end",
"def use(*)\n super\n end",
"def perform_raw; end",
"def implementation; end",
"def implementation; end",
"def overrides; end",
"def quack_it(duck)\n duck.quack\nend",
"def skier_quest; end",
"def sell_pending\n end",
"def generic_traps\n super\n end",
"def pickup!\n raise NotImplementedError, \"Subclasses must implemenet :pickup!\"\n end",
"def bunny(n)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def software_hotfix\n super\n end",
"def set_snat_automap\n super\n end",
"def sn\n end",
"def across_service_state\n super\n end",
"def internship_passed; end",
"def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def bunny(n)\n raise NotImplementedError, \"Method not implemented\"\nend",
"def call_quack(duck)\n duck.quack\nend",
"def run_bulk; end",
"def jack_handey; end",
"def across_pool_state\n super\n end",
"def call\n # implement in subclasses\n end",
"def weber; end",
"def backtrack(stack)\n item = super(stack)\n size = item[:booking]\n @bookings.push(size)\n @all_moves[@last_index_tried] += size\n item\n end",
"def common\n \n end",
"def last_hop_pool\n super\n end",
"def run\n super\n\n # Make sure the key is set\n raise \"API KEY MISSING: shodan_api_key\" unless $intrigue_config[\"shodan_api_key\"]\n\n @client = Client::Search::Shodan::ApiClient.new($intrigue_config[\"shodan_api_key\"])\n response = @client.search(_get_entity_attribute \"name\")\n\n # check to make sure we got a response.\n raise \"ERROR: No response\" unless response\n\n # Check to make sure we got results\n if response[\"matches\"]\n\n @task_log.log \"Found #{response[\"matches\"].count} matches\"\n\n # Go through the results\n response[\"matches\"].each do |r|\n\n @task_log.log \"* SHODAN Record *\"\n\n #updated_at = DateTime.new(r[\"updated\"])\n updated_at = DateTime.now\n\n #\n # Create a host record\n #\n @task_log.log \"IP: #{r[\"ip\"]}\"\n host = _create_entity(\"IpAddress\",{\n :name => \"#{r[\"ip\"]}\",\n :age => \"#{updated_at}\"\n }) if r[\"ip\"]\n\n #\n # Create a DNS record for all hostnames\n #\n r[\"hostnames\"].each do |h|\n @task_log.log \"Hostname: #{h}\"\n _create_entity(\"DnsRecord\",{ :name => \"#{h}\", :age => \"#{updated_at}\" })\n end\n\n #\n # Create a netsvc\n #\n @task_log.log \"Port: #{r[\"port\"]}\"\n\n port = _create_entity(\"NetSvc\",{\n :name => \"#{host.attributes[:name]}:#{r[\"port\"]}/tcp\",\n :proto => \"tcp\",\n :port_num => r[\"port\"],\n :fingerprint => r[\"data\"],\n :age => \"#{updated_at}\"\n }) if r[\"port\"]\n\n #\n # Create an organization\n #\n @task_log.log \"Org: #{r[\"org\"]}\"\n org = _create_entity(\"Organization\",{\n :name => \"#{r[\"org\"]}\",\n :age => \"#{updated_at}\"\n }) if r[\"org\"]\n\n #\n # Create a PhysicalLocation\n #\n @task_log.log \"Location: #{r[\"postal_code\"]}\"\n location = _create_entity(\"PhysicalLocation\",{\n :name => \"#{r[\"latitude\"]} / #{r[\"longitude\"]}\",\n :zip => \"#{r[\"postal_code\"]}\",\n :state => \"#{r[\"region_name\"]}\",\n :country => \"#{r[\"country_name\"]}\",\n :latitude => \"#{r[\"latitude\"]}\",\n :longitude => \"#{r[\"longitude\"]}\",\n :age => \"#{updated_at}\"\n }) if r[\"country_name\"]\n\n\n @task_log.log \"Port: #{r[\"port\"]}\"\n @task_log.log \"Port Data: #{r[\"data\"]}\"\n @task_log.log \"Country: #{r[\"country_name\"]}\"\n @task_log.log \"Country Code: #{r[\"country_code\"]}\"\n @task_log.log \"Region Name: #{r[\"region_name\"]}\"\n @task_log.log \"Area Code: #{r[\"area_code\"]}\"\n @task_log.log \"DMA Code: #{r[\"dma_code\"]}\"\n @task_log.log \"Postal Code: #{r[\"postal_code\"]}\"\n @task_log.log \"Org: #{r[\"org\"]}\"\n\n end\n end\n end",
"def get_snacks_list\n @complete_snacks_list = Spree::Product.select('id, name').limit(10).order(\"updated_at desc\")\n end",
"def bridge; end",
"def bridge; end",
"def bridge; end",
"def spice; end",
"def perform\n build_recipes # this returns array of recipes\n self # return the scrapper\n end",
"def probers; end",
"def kgio_autopush?()\n #This is a stub, used for indexing\n end",
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def set_generic_traps_v2\n super\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def snack_queue\n #This will fetch the undelivered orders by filtering them through state: :confirm ONLY.\n @sub_items = Spree::Order.get_line_items(current_user.id)\n params_subscription_id = params[:subscription_id]\n user_id = current_user.id\n\n\n @my_subscriptions =current_user.all_subscriptions\n\n #@my_subscriptions.all\n\n if @my_subscriptions.present?\n all_subscriptions = Subscription.all\n\n if params_subscription_id.present?\n @first_subscription = UserSubscription.where(id: params_subscription_id, user_id: user_id).first\n redirect_to spree.snack_queue_orders_path and return if @first_subscription.blank?\n else\n @first_subscription = @my_subscriptions.first\n end\n\n @subscription_list = {}\n\n all_subscriptions.each do |a|\n i = 0\n @my_subscriptions.each do |s|\n if a.id == s.subscription_id\n i = i + 1\n @current_counter = i if @first_subscription.id == s.id\n sub_row = s.subscription.try(:subscription_type)+ ' ' + i.to_s\n @subscription_list.merge!(sub_row => s.id)\n end\n end\n end\n\n @first_sub_carts = Cart.create_carts_for_orders(@first_subscription)\n @first_sub_cart_ids = Cart.collect_cart_ids(@first_sub_carts)\n @undelivered_order_ids = @first_subscription.get_undelivered_order_ids\n @snacks = Spree::Product.select('id, name')\n @subscription_name = Subscription.where(id: @first_subscription.subscription_id).first.subscription_type\n else\n\n end\n end",
"def third_party_processors; end",
"def repair!\n raise NotImplementedError\n end",
"def run\n super\n\n #\n # This module currently uses the Free API (rate limited / response limited)\n # https://freeapi.robtex.com/ipquery/#{search_ip}\n #\n # Note that a paid version (free up to 10k queries / month) of the API is available at:\n # https://market.mashape.com/robtex/robtex\n #\n\n # Check Robtex API & create entities from returned JSON\n search_ip = _get_entity_name\n search_uri = \"https://freeapi.robtex.com/ipquery/#{search_ip}\"\n\n begin\n details = JSON.parse(http_get_body(search_uri))\n _log \"Got details: #{details}\"\n\n #status\n # Should be \"ok\"\n unless details[\"status\"] == \"ok\"\n _log_error \"Unable to continue\"\n return\n end\n\n #act\n # Active (forward) DNS\n if details[\"act\"]\n details[\"act\"].each do |forward_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => forward_lookup[\"o\"],\n \"time\" => \"#{Time.at(forward_lookup[\"t\"])}\"\n }\n end\n end\n\n #pas\n # Passive (reverse) DNS\n if details[\"pas\"]\n details[\"pas\"].each do |reverse_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => reverse_lookup[\"o\"],\n \"time\" => \"#{Time.at(reverse_lookup[\"t\"])}\"\n }\n end\n end\n\n #pash\n # Passive DNS history\n # TODO\n\n #acth\n # Active DNS history\n # TODO\n\n #as\n # Autonomous System Number\n if details[\"as\"]\n _create_entity \"AsNumber\",{\n \"name\" => \"AS#{details[\"as\"]}\",\n \"as_name\" => details[\"asname\"],\n \"as_desc\" => details[\"asdesc\"]\n }\n end\n\n # Netblock\n #\n if details[\"bgproute\"]\n _create_entity \"NetBlock\",{\"name\" => \"#{details[\"bgproute\"]}\"}\n end\n\n rescue JSON::ParserError => e\n _log_error \"Unable to get parsable response from #{search_uri}: #{e}\"\n rescue StandardError => e\n _log_error \"Error grabbing robtex details: #{e}\"\n end\n\n\n end",
"def __send__(*rest) end",
"def api_sync_database\n snacks = api_parse_list\n\n snacks.each do |snack|\n Suggestion.create(name: snack['name'],\n location: snack['purchaseLocations'],\n optional: snack['optional'])\n end\n end",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def special\n override\n end",
"def buzzword; end",
"def buzzword; end",
"def include_checksum_state\n super\n end",
"def bark \n return \"Generic bark\"\n end",
"def enable_pending_cops; end",
"def hotfix_information\n super\n end",
"def offer\n end",
"def offer\n end",
"def offer\n end",
"def bet(chips)\n\n end",
"def call(*)\n raise NotImplementedError\n end",
"def _fetch(*)\n fail NotImplementedError\n end",
"def internal; end",
"def list_snacks\n snacks = Snack.all\n snacks.each do |snack|\n puts \"#{snack.name}\"\n snack.machines.each do |machine|\n puts \"- #{machine.serial_number} in #{machine.building.name}\"\n end\n end\nend",
"def vendor; end",
"def prapor_quest; end",
"def make_it_quack(duck)\n duck.quack\nend",
"def run\n super\n\n # Make sure the key is set\n raise \"API KEY MISSING: bing_api_key\" unless $intrigue_config[\"bing_api_key\"]\n\n entity_name = _get_entity_attribute \"name\"\n\n # Attach to the google service & search\n bing = Client::Search::Bing::SearchService.new($intrigue_config['bing_api_key'],50,'Web',{:Adult => 'Off'})\n\n results = bing.search(entity_name)\n results.first[:Web].each do |result|\n\n # a result will look like:\n #\n # {:__metadata=>\n # {:uri=>\"https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/ExpandableSearchResultSet(guid'3033f6e3-d175-418c-a201-4a0c2c643384')/Web?$skip=0&$top=1\", :type=>\"WebResult\"},\n # :ID=>\"d30722c1-3fab-4ad6-90b1-aa136224afe4\",\n # :Title=>\"Speedtest.net by Ookla - The Global Broadband Speed Test\",\n # :Description=>\"Test your Internet connection bandwidth to locations around the world with this interactive broadband speed test from Ookla\",\n # :DisplayUrl=>\"www.speedtest.net\",\n # :Url=>\"http://www.speedtest.net/\"}\n #\n\n ###\n ### SECURITY - take care, result might include malicious code?\n ###\n\n # Create the specific page\n _create_entity(\"Uri\", { :name => result[:Url],\n :uri => result[:Url],\n :description => result[:Description],\n :title => result[:Title],\n :source => \"Bing\"\n })\n\n # Create a domain\n dns_name = result[:Url].split(\"/\")[2]\n if Regexp.new(entity_name).match dns_name\n _create_entity(\"DnsRecord\", { :name => dns_name })\n end\n\n ###\n ### XXX - this actually picks up a lot more than it should. Tighten\n ### this up when there are cycles. Thinking this needs to be stuck\n ### in a library somewhere too\n ###\n\n # Handle Twitter search results\n if result[:Url] =~ /https?:\\/\\/twitter.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"twitter.com\",\n :name => account_name,\n :uri => \"http://www.twitter.com/#{account_name}\",\n :type => \"full\"\n })\n\n # Handle Facebook public profile results\n elsif result[:Url] =~ /https?:\\/\\/www.facebook.com\\/(public|pages)\\/.*$/\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"facebook.com\",\n :name => account_name,\n :uri => \"#{result[:Url]}\",\n :type => \"public\"\n })\n\n # Handle Facebook search results\n elsif result[:Url] =~ /https?:\\/\\/www.facebook.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"facebook.com\",\n :name => account_name,\n :uri => \"http://www.facebook.com/#{account_name}\",\n :type => \"full\"\n })\n\n # Handle LinkedIn public profiles\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/in\\/pub\\/.*$/\n account_name = result[:Url].split(\"/\")[5]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :type => \"public\"\n })\n\n # Handle LinkedIn public directory search results\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/pub\\/dir\\/.*$/\n account_name = \"#{result[:Url].split(\"/\")[5]} #{result[:Url].split(\"/\")[6]}\"\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"public\"\n })\n\n # Handle LinkedIn world-wide directory results\n elsif result[:Url] =~ /^http:\\/\\/[\\w]*.linkedin.com\\/pub\\/.*$/\n\n # Parses these URIs:\n # - http://za.linkedin.com/pub/some-one/36/57b/514\n # - http://uk.linkedin.com/pub/some-one/78/8b/151\n\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => \"#{result[:Url]}\",\n :type => \"public\" })\n\n # Handle LinkedIn profile search results\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/in\\/.*$/\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => \"http://www.linkedin.com/in/#{account_name}\",\n :type => \"public\" })\n\n # Handle Google Plus search results\n elsif result[:Url] =~ /https?:\\/\\/plus.google.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"google.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"full\" })\n\n # Handle Hackerone search results\n elsif result[:Url] =~ /https?:\\/\\/hackerone.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"hackerone.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"full\" }) unless account_name == \"reports\"\n\n # Check for Phone Number\n elsif result[:Description].match(/(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}/)\n\n # Grab all matches\n matches = result[:Description].scan(/((\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})/)\n matches.each do |match|\n _create_entity(\"PhoneNumber\", { :name => \"#{match[0]}\" })\n end\n\n\n # Check for Email Address\n elsif result[:Description].match(/\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i)\n\n # Grab all matches\n matches = result[:Description].scan(/((\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})/)\n matches.each do |match|\n _create_entity(\"EmailAddress\", { :name => \"#{match[0]}\" })\n end\n\n end\n\n end # end results.each\n end",
"def spouse; end",
"def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end",
"def call\n raise NotImplementedError\n end",
"def push(_hex)\n raise Sibit::NotSupportedError, 'Not implemented yet'\n end",
"def pull; end",
"def sos_papel?() raise NotImplementedError end",
"def singular_siegler; end",
"def SS2_7 args\r\n\r\nend"
] |
[
"0.57277834",
"0.56490725",
"0.5329209",
"0.5264472",
"0.5261022",
"0.5207125",
"0.5131607",
"0.5113928",
"0.5109255",
"0.50845385",
"0.5049509",
"0.5049509",
"0.5028065",
"0.49853888",
"0.49540144",
"0.4947893",
"0.49205974",
"0.4917866",
"0.4896474",
"0.48816085",
"0.48741207",
"0.4853251",
"0.4849653",
"0.48345593",
"0.48273867",
"0.48236075",
"0.48212713",
"0.48212713",
"0.48180485",
"0.4793005",
"0.47866037",
"0.47809592",
"0.47723785",
"0.4771068",
"0.47700733",
"0.47689632",
"0.47676158",
"0.47527865",
"0.4751655",
"0.4751401",
"0.4748591",
"0.47436893",
"0.47352645",
"0.47251436",
"0.47240642",
"0.47223294",
"0.47123846",
"0.47068024",
"0.47011998",
"0.4693207",
"0.4689943",
"0.46646243",
"0.46622548",
"0.46570262",
"0.46570262",
"0.46570262",
"0.46541005",
"0.46503866",
"0.4645097",
"0.46390134",
"0.46265197",
"0.46155745",
"0.46137354",
"0.46137354",
"0.46137354",
"0.46137354",
"0.46066612",
"0.4605151",
"0.45932028",
"0.45921147",
"0.45892465",
"0.45886087",
"0.45814908",
"0.45814908",
"0.45777646",
"0.45709246",
"0.45709246",
"0.45677873",
"0.45658752",
"0.45656994",
"0.4563123",
"0.4557623",
"0.4557623",
"0.4557623",
"0.45570132",
"0.45561415",
"0.4555293",
"0.4554472",
"0.45490748",
"0.45476758",
"0.45476174",
"0.45365062",
"0.45337898",
"0.45320097",
"0.45284092",
"0.4517711",
"0.4512071",
"0.45114678",
"0.4507625",
"0.45066452",
"0.45033842"
] |
0.0
|
-1
|
GET /hacks/1 GET /hacks/1.json
|
def show
@hack = Hack.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @hack }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hacker }\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hack }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def create\n @hack = Hack.new(params[:hack])\n\n respond_to do |format|\n if @hack.save\n format.html { redirect_to @hack, notice: 'Hack was successfully created.' }\n format.json { render json: @hack, status: :created, location: @hack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def show\n @hack = Hack.find(params[:id])\n @hacks = Hack.all\n @voters = Voter.all\n @departments = ['Analytics','Rails','WEB TEAM','Clients','Core Services','Infrastructure','Other','Product','UX']\n @vote_directions = Vote.select(\"id AS x,direction AS y\").order(\"created_at\").limit(40).to_json\n @vote_times = Vote.select(\"created_at\").order(\"created_at\").to_json\n\n respond_to do |format|\n format.html # show.html.erb}\n format.json { render json: @hack }\n end\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @hackathons = Hackathon.all\n end",
"def index\n @hackathons = Hackathon.all\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end",
"def show\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @need_help}\n end\n end",
"def show\n @hackathons = @idea.hacker == current_hacker ? Hackathon.all : []\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def show\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hacker }\n end\n end",
"def set_hacker\n @hacker = Hacker.find(params[:id])\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n format.html { redirect_to @hacker, notice: 'Hacker was successfully created.' }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hack_meets = @hack_member.hack_meets.order(:hack_date)\n end",
"def show\n\n @hacker = User.find(params[:hacker_id]) if params[:hacker_id]\n\n if params['id']\n # show in context of specific event\n @event = Event.find(params[:id]) if params[:id]\n @team = Team.joins(:users).where(:users => {:id => params['id']}).first\n # @hacks = Hack.where(\"team_id = ?\", @team.id)\n else\n # show all events if no event specified\n @attendances = Attendance.where(\"user_id = ?\", params[:hacker_id])\n # select * from hacks inner join teams on hacks.team_id = teams.id \n # inner join affiliations on teams.id = affiliations.team_id \n # inner join users on users.id = affiliations.user_id \n # where users.id = 3;\n @hacks = Hack.joins(:team => :users).where('users.id = ?', params[:hacker_id]) \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hacker }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def getdifficulty\n @api.request 'getdifficulty'\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def update\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to @hacker, notice: 'Hacker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @problems = Problem.all\n\n render json: @problems\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def show\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end",
"def index\n @hack_tips = HackTip.all\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trick }\n end\n end",
"def index \n render :json => Project.find(11).bug_tracker.bugs\n end",
"def show\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monkey }\n end\n end",
"def show\n @help = Help.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @help }\n end\n end",
"def show\n (kick and return) if not is_team?\n\n if not is_god?\n @puzzle = Puzzle.where('internal_name = ?', params[:id]).first\n if @puzzle.nil? or not is_unlocked?(@puzzle)\n raise ActionController::RoutingError.new('Puzzle not found') \n end\n render 'huntshow' and return\n end\n\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end",
"def show\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @witch }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :no_content }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @need_helps = NeedHelp.all\n\n respond_to do |format|\n format.json {render :json => @need_helps.to_json(:include => [:need_help_category,\n :user => {:include => :street}])}\n end\n end",
"def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end",
"def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end",
"def show\n # Find the challenge in database to see if it exsits.\n @challenge = Challenge.find(params[:id])\n\n if @challenge\n # Restructure challenge and return as JSON.\n @challenge = restructure_challenge(@challenge)\n render json: {challenge: @challenge}\n else\n # Return JSON with error message.\n error = \"Challenge with that id does not exsits\"\n render json: {error: error}\n end\n end",
"def show\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def getdifficulty\n request :getdifficulty\n end",
"def difficulty\n request('getdifficulty')\n end",
"def index\n @users = User.where(:listed => 1)\n if current_closed_challenge.present?\n @entries = Entry.where(:challenge_id => current_closed_challenge.id).limit(3)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Entry.all }\n end\n else\n respond_to do |format|\n format.html { render \"challenges/about\" }\n format.json { render json: Entry.all }\n end\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end",
"def show\n story = Story.find(params[:id])\n render json: story\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @problem = Problem.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @problem }\n end\n end",
"def show\n @bug_list = BugList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_list }\n end\n end",
"def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end",
"def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def show\n @bug = Bug.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end",
"def show\n @hit = Hit.find(params[:id])\n if @hit.study.hidden == false or (admin? or lab_user?)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hit }\n end\n else\n render :nothing => true\n end\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end",
"def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end",
"def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def show\n @patches = Patch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patch }\n end\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def show\n @joy = Joy.find(params[:id])\n render json: @joy\n end",
"def show\n @shorty = Shorty.per_user(current_user).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shorty }\n end\n end",
"def index\n @event = Event.find(params[:id])\n\n if params[:tag] && params[:id]\n\n @hackers = User.tagged_with(params[:tag]).joins(:events).where(:attendances => {:event_id => params[:id]})\n \n # used only for the register / unregister button\n @attendances = Attendance.where(\"user_id = ?\", current_user.id)\n \n elsif params[:id]\n\n # join hackers and users and get hackers from the specified event\n @hackers = User.joins(:events).where(:attendances => {:event_id => params[:id]})\n \n # used only for the register / unregister button\n @attendances = Attendance.where(\"user_id = ?\", current_user.id) if current_user \n \n elsif params[:tag] and not params[:id]\n @hackers = User.tagged_with(params[:tag])\n else\n @hackers = Hacker.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hackers }\n end\n end",
"def hardhats_only\n @tools = Tool.hardhats.by_barcode.paginate(:page => params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # hardhats.html.erb\n format.json { render json: @tools }\n end\n end",
"def show\n render json: @messy\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n cookies[:auth_token] = @hacker.auth_token\n @hacker.create_initial_data\n Notifier.account_created(@hacker).deliver\n format.html { redirect_to entries_url, notice: \"Hacker #{@hacker.email} was successfully created.\" }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @enzymes = Enzyme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enzymes }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_bug }\n end\n end",
"def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def puzzles\n render json: {\n puzzles: HastePuzzle.random_level(100)\n }\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def show\n render json: @todo\n end",
"def show\n render json: @todo\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hacker }\n end\n end"
] |
[
"0.70416176",
"0.66230714",
"0.6590241",
"0.6540019",
"0.6310924",
"0.6310924",
"0.6264245",
"0.624627",
"0.624627",
"0.61146516",
"0.59942466",
"0.59170043",
"0.5821667",
"0.5821667",
"0.5814296",
"0.5772688",
"0.57704675",
"0.5751515",
"0.5737273",
"0.5715793",
"0.5705145",
"0.56751513",
"0.56573",
"0.56113046",
"0.5497745",
"0.5495211",
"0.5445618",
"0.54403675",
"0.5436401",
"0.54284257",
"0.54220665",
"0.54180485",
"0.5406801",
"0.5395431",
"0.53898716",
"0.5384775",
"0.5384019",
"0.53665096",
"0.535084",
"0.53469294",
"0.53462",
"0.5328718",
"0.5325019",
"0.5323281",
"0.53226495",
"0.5320321",
"0.5319445",
"0.53177494",
"0.52961934",
"0.5294967",
"0.5280523",
"0.5268983",
"0.5254808",
"0.5252861",
"0.52522504",
"0.52521145",
"0.52521145",
"0.5251456",
"0.52458674",
"0.5244933",
"0.52421343",
"0.52399725",
"0.5235628",
"0.5227996",
"0.522577",
"0.52153623",
"0.52104294",
"0.52031946",
"0.52031946",
"0.5186603",
"0.5186603",
"0.51747733",
"0.51745987",
"0.5166036",
"0.5156315",
"0.5155434",
"0.51548547",
"0.51548547",
"0.5145009",
"0.5139629",
"0.51291883",
"0.5121188",
"0.511143",
"0.5111294",
"0.51111805",
"0.5109486",
"0.51084435",
"0.5100493",
"0.5094824",
"0.5085554",
"0.5076391",
"0.5074843",
"0.5074843",
"0.5069043",
"0.50643855",
"0.50580996",
"0.5048055",
"0.5046687",
"0.5046687",
"0.5042887"
] |
0.7400066
|
0
|
GET /hacks/new GET /hacks/new.json
|
def new
@hack = Hack.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @hack }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def create\n @hack = Hack.new(params[:hack])\n\n respond_to do |format|\n if @hack.save\n format.html { redirect_to @hack, notice: 'Hack was successfully created.' }\n format.json { render json: @hack, status: :created, location: @hack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hacker }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end",
"def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end",
"def new\n @fix_upgrade = FixUpgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fix_upgrade }\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 @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n format.html { redirect_to @hacker, notice: 'Hacker was successfully created.' }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def new\n @hackplatformrelation = Hackplatformrelation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end",
"def new\n @witch = Witch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @witch }\n end\n end",
"def new\n @help = Help.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @help }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @bug_list = BugList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_list }\n end\n end",
"def new\n @kickoff = Kickoff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kickoff }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end",
"def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end",
"def new\n @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 @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @solution = @idea.solutions.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 @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 @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 @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end",
"def new\n @useful_link = UsefulLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @useful_link }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n (kick and return) if not is_god?\n @team = Team.new\n @mode = :new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n cookies[:auth_token] = @hacker.auth_token\n @hacker.create_initial_data\n Notifier.account_created(@hacker).deliver\n format.html { redirect_to entries_url, notice: \"Hacker #{@hacker.email} was successfully created.\" }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @hit = Hit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hit }\n end\n end",
"def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end",
"def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @hack_tag_follow = HackTagFollow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hack_tag_follow }\n end\n end",
"def new\n @go_slim = GoSlim.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def show\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end",
"def new\n @fix_issue = FixIssue.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fix_issue }\n end\n end",
"def new\n @shorty = Shorty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shorty }\n end\n end",
"def new\n @mistake = Mistake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mistake }\n end\n end",
"def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\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 respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @secret_record }\n end\n end",
"def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end",
"def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end",
"def new\n @kitty = Kitty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kitty }\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shift }\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 @kolegiji = Kolegiji.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegiji }\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 @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 @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def create\n @hack_tip = HackTip.new(hack_tip_params)\n\n respond_to do |format|\n if @hack_tip.save\n format.html { redirect_to @hack_tip, notice: 'Hack tip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hack_tip }\n else\n format.html { render action: 'new' }\n format.json { render json: @hack_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @knowledge = Knowledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @good }\n end\n end",
"def new\n @try = Try.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @try }\n end\n end",
"def new\n @challenge = Challenge.new\n add_breadcrumb 'new', @challenge\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @duck = Duck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @duck }\n end\n end",
"def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end",
"def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end",
"def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end",
"def new\n @api_haiku = Api::Haiku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_haiku.to_json(except: [:id, :created_at, :slug, :updated_at]) }\n end\n end",
"def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @fight = Fight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\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 @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 @goody = Goody.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goody }\n end\n end",
"def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n @cool = Cool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cool }\n end\n end",
"def new\n @story = Story.new\n\t\t@title = \"Nowy news\"\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 @thought = Thought.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thought }\n end\n end",
"def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end"
] |
[
"0.8059126",
"0.77401054",
"0.77401054",
"0.6790309",
"0.6655544",
"0.6633469",
"0.657953",
"0.6504488",
"0.64509076",
"0.6442616",
"0.6442448",
"0.64174134",
"0.6407759",
"0.6379512",
"0.63743067",
"0.63493705",
"0.63493705",
"0.63412446",
"0.6297349",
"0.629451",
"0.6217404",
"0.6211488",
"0.6210474",
"0.61997485",
"0.6198615",
"0.6192225",
"0.61920536",
"0.6187607",
"0.6170961",
"0.6170961",
"0.6170686",
"0.61705995",
"0.61469406",
"0.6143487",
"0.61423725",
"0.6125385",
"0.6109063",
"0.6109063",
"0.6105804",
"0.61011106",
"0.6098249",
"0.6095256",
"0.6091222",
"0.6090886",
"0.6076095",
"0.6069514",
"0.6068387",
"0.6068387",
"0.60652435",
"0.60643023",
"0.60628825",
"0.60619503",
"0.60576516",
"0.60531336",
"0.6042868",
"0.60421497",
"0.60421497",
"0.60421497",
"0.60421497",
"0.60417044",
"0.6037861",
"0.60355675",
"0.60289377",
"0.602822",
"0.60211784",
"0.60179776",
"0.6001904",
"0.6001904",
"0.6001904",
"0.6001904",
"0.60018957",
"0.60011417",
"0.60011417",
"0.60011417",
"0.60011417",
"0.60004675",
"0.5999287",
"0.59909284",
"0.59842956",
"0.5981618",
"0.5980709",
"0.5979621",
"0.5976872",
"0.5967236",
"0.5966297",
"0.5964225",
"0.5962781",
"0.5962781",
"0.59610355",
"0.5958525",
"0.5958405",
"0.5956379",
"0.5952507",
"0.59517074",
"0.59516865",
"0.5943248",
"0.59421813",
"0.5941833",
"0.5939281",
"0.59368443"
] |
0.8019836
|
1
|
POST /hacks POST /hacks.json
|
def create
@hack = Hack.new(params[:hack])
#logger.info "event_name: ======="
event_name = params[:event_name]
#logger.info "event_name: " + event_name unless event_name.nil?
event = Event.find_by_name_caseinsensitive(event_name)
if(event.nil?)
logger.info "event not found, lets's create new one "
event = Event.create()
event.name = event_name
event.eventdate = Time.new
event.save
end
@hack.event = event
respond_to do |format|
if @hack.save
emailaddresses = params[:hack_team_emails]
logger.info "after new create hack, send team emails: " + emailaddresses
invite_team_members(emailaddresses, @hack)
format.html { redirect_to @hack, :notice => 'Hack was successfully created.' }
format.json { render :json => @hack, :status => :created, :location => @hack }
else
format.html { render :action => "new" }
format.json { render :json => @hack.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @hack = Hack.new(params[:hack])\n\n respond_to do |format|\n if @hack.save\n format.html { redirect_to @hack, notice: 'Hack was successfully created.' }\n format.json { render json: @hack, status: :created, location: @hack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n format.html { redirect_to @hacker, notice: 'Hacker was successfully created.' }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n cookies[:auth_token] = @hacker.auth_token\n @hacker.create_initial_data\n Notifier.account_created(@hacker).deliver\n format.html { redirect_to entries_url, notice: \"Hacker #{@hacker.email} was successfully created.\" }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hack_params\n params.require(:hack).permit(:description, :image)\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n format.html { redirect_to(@hacker, :notice => 'Hacker was successfully created.') }\n format.xml { render :xml => @hacker, :status => :created, :location => @hacker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hacker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hack }\n end\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end",
"def create\n @friends = params[:friends] || []\n @hack = Hack.new(params[:hack])\n @hack.sort_rand = Random.rand\n @hack.event_id = @event.id\n\n if !@hack.save\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n return\n end\n\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = @current_user\n assoc.confirmed = true\n assoc.save!\n @friends.each do |friend_id|\n friend = User.get_or_create_by_fbid(friend_id, @api);\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = friend\n assoc.confirmed = true\n assoc.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @event, :notices => ['Hack was successfully created.'] }\n format.json { render :json => @hack, :status => :created, :location => [@event, @hack] }\n end\n end",
"def create\n @hack_tip = HackTip.new(hack_tip_params)\n\n respond_to do |format|\n if @hack_tip.save\n format.html { redirect_to @hack_tip, notice: 'Hack tip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hack_tip }\n else\n format.html { render action: 'new' }\n format.json { render json: @hack_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end",
"def set_hacker\n @hacker = Hacker.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hack_member = HackMember.new(hack_member_params)\n\n respond_to do |format|\n if @hack_member.save\n format.html { redirect_to @hack_member, notice: 'Hack member was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hack_member }\n else\n format.html { render action: 'new' }\n format.json { render json: @hack_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea = current_hacker.create_idea idea_params\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to @idea, notice: 'Idea was successfully created.' }\n format.json { render :show, status: :created, location: @idea }\n else\n format.html { render :new }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to @hacker, notice: 'Hacker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def create\n @hackathon = Hackathon.new(hackathon_params)\n\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully created.' }\n format.json { render :show, status: :created, location: @hackathon }\n else\n format.html { render :new }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :ok }\n end\n end",
"def show\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hacker }\n end\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end",
"def create\n @hackathon = current_user.hackathons.build(hackathon_params) #Hackathon.new(hackathon_params)\n\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to hackathons_path, notice: 'Hackathon was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def hack_tip_params\n params.require(:hack_tip).permit(:title, :description, :user_id)\n end",
"def create\n respond_to do |format|\n if @tips_trick.save\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully created.' }\n format.json { render json: @tips_trick, status: :created, location: @tips_trick }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hackathon_params\n params.require(:hackathon).permit(:name, :subdomain, :about, :tagline, :location, :logo, :header, :start, :end, :hs_hackers_allowed, :mlh_sanctioned, :user_id)\n end",
"def create\n hackers = Hacker.where( :email => params[:email] )\n if hackers.empty?\n @hacker = Hacker.new({\n name=> params[:name],\n email=> params[:email],\n access_token=> params[:access_token],\n image_url=> params[:image_url],\n fb_id=> params[:fb_id]\n })\n if @hacker.save\n session[:user_id] = @hacker.id\n current_hacker = @hacker\n #render :text => \"Added Hacker: \" + @hacker.id.to_s + \" Session: \" + session[:user_id].to_s\n else\n render :text => @hacker.errors.full_messages\n end\n else\n session[:user_id] = hackers[0].id\n current_hacker = hackers[0]\n current_hacker.access_token = params[:access_token]\n current_hacker.save\n redirect_to index_path\n #render :text => session[:user_id].to_s\n #session[:user_id] = hackers[0].id\n# render :text => \"Already have the hacker, Session: \" + session[:user_id].to_s\n end\n end",
"def puzzles\n render json: @user.next_infinity_puzzle_set(\n params[:difficulty],\n params[:after_puzzle_id]\n )\n end",
"def challenge\n skip_authorization\n render(json: { message: \"Ruby on Rails Challenge 20200810\" }, status: 200)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end",
"def hackathon_params\n params.require(:hackathon).permit(:name, :date, :location, :highschool, :logo, :site)\n end",
"def create\n @need_help = NeedHelp.new(params[:need_help])\n\n respond_to do |format|\n if @need_help.save\n format.json {render json: @need_help, status: :created, location: @need_help}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n kick and return if not is_god?\n @puzzle = Puzzle.new(params[:puzzle])\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.save\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully created.' }\n format.json { render json: @puzzle, status: :created, location: @puzzle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hacker_params\n params.fetch(:hacker, {})\n end",
"def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def hackathon_params\n params.require(:hackathon).permit(:title, :topic, :description, :owner, :number_of_participants, :start_date, :end_date, :hackathon_venue, :user_id, :is_private, :twitter_link, :avatar)\n # params.fetch(:hackathon, {})\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end",
"def update\n \n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to(@hacker, :notice => 'Hacker was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hacker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :no_content }\n end\n end",
"def post_to_fancyhands\n post_to_fancyhands_now\n end",
"def create\n @sudoku = Sudoku.new(sudoku_params)\n @sudoku.gaps = Sudoku.generate_gaps\n respond_to do |format|\n if @sudoku.save\n format.html { redirect_to @sudoku }\n format.json { render :show, status: :created, location: @sudoku }\n else\n format.html { render :new }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def create\n @trick = Trick.new(params[:trick])\n\n respond_to do |format|\n if @trick.save\n format.html { redirect_to @trick, notice: 'Trick was successfully created.' }\n format.json { render json: @trick, status: :created, location: @trick }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hack = Hack.find(params[:id])\n @hacks = Hack.all\n @voters = Voter.all\n @departments = ['Analytics','Rails','WEB TEAM','Clients','Core Services','Infrastructure','Other','Product','UX']\n @vote_directions = Vote.select(\"id AS x,direction AS y\").order(\"created_at\").limit(40).to_json\n @vote_times = Vote.select(\"created_at\").order(\"created_at\").to_json\n\n respond_to do |format|\n format.html # show.html.erb}\n format.json { render json: @hack }\n end\n end",
"def create\n @users_hacktag = UsersHacktag.new(params[:users_hacktag])\n\n respond_to do |format|\n if @users_hacktag.save\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully created.') }\n format.xml { render :xml => @users_hacktag, :status => :created, :location => @users_hacktag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def puzzles\n render json: {\n puzzles: HastePuzzle.random_level(100)\n }\n end",
"def puzzle_solved\n if @user.present?\n solved_puzzle = @user.solved_infinity_puzzles.find_by(\n solved_puzzle_params\n )\n if solved_puzzle.present?\n solved_puzzle.touch\n else\n @user.solved_infinity_puzzles.create!(solved_puzzle_params)\n end\n render json: { n: @user.solved_infinity_puzzles.count }\n else\n render json: {}\n end\n end",
"def bug_params\n params.require(:bug).permit(:content, :story_id)\n end",
"def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend",
"def create\n @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_puzzle(params)\n difficulty = params[:difficulty] || \"medium\"\n case difficulty\n when \"medium\"\n blanks = rand(49..51)\n when \"hard\"\n blanks = rand(52..54)\n when \"veryhard\"\n blanks = rand(55..57)\n when \"easy\"\n blanks = rand(45..48)\n when \"veryeasy\"\n blanks = rand(40..44)\n end\n c = Sudoku.make(blanks)\n @puzzle = c[0]\n @solution = c[1]\n \n # Returns json object with array representing puzzle \n return JSON.generate({puzzle: @puzzle.puzzle}) \n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hacker }\n end\n end",
"def create\n @junk = Junk.new(junk_params)\n\n respond_to do |format|\n if @junk.save\n format.html { redirect_to @junk, notice: 'Junk was successfully created.' }\n format.json { render :show, status: :created, location: @junk }\n else\n format.html { render :new }\n format.json { render json: @junk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n streak, success = jsonapi_create.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @monkey = Monkey.new(params[:monkey])\n\n respond_to do |format|\n if @monkey.save\n format.html { redirect_to @monkey, notice: 'Monkey was successfully created.' }\n format.json { render json: @monkey, status: :created, location: @monkey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hack_member_params\n params.require(:hack_member).permit(:title, :initials, :first_name, :surname, :tel_home, :tel_office, :tel_cell, :email, :email_ok, :email_issues, :non_hacker, :comments, :contact_via_id, :group_with_id, :hack_attendances_count)\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n is_private = params[:is_private]\n custom_count = params[:total_count]\n \n @hackathon = Hackathon.new(hackathon_params)\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully created.' }\n format.json { render :show, status: :created, location: @hackathon }\n else\n format.html { render :new }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n \n list = custom_count.split(\",\")\n list.each_slice(2){ |x| \n customtable = CustomeTable.new()\n customtable.question = params[\"cus_field\"+x[0].to_s]\n customtable.answer = params[\"cus_field\"+x[1].to_s]\n customtable.identifier_id = @hackathon.id\n customtable.identifier = @hackathon\n customtable.save!\n } \n\n end",
"def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend",
"def solve(hacker, user = nil)\n hacker.earnings.create({\n :user => user,\n :points => self.points,\n :quest => self,\n :chronicle_text => self.title\n })\n end",
"def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @twizzle = Twizzle.new(twizzle_params)\n\n respond_to do |format|\n if @twizzle.save\n format.html { redirect_to @twizzle, notice: 'Twizzle was successfully created.' }\n format.json { render :show, status: :created, location: @twizzle }\n else\n format.html { render :new }\n format.json { render json: @twizzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_mod\n if params[:title] != nil && params[:content] != nil && params[:subId] != nil && params[:userId] != nil && params[:groupId] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n @question.subId = params[:subId].to_i\n @question.userId = params[:userId].to_i\n @question.groupId = params[:groupId].to_i\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/createQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully created\"\n redirect_to questions_path\n\n end\n end",
"def create\n # Build a ticket associated with the current user and fill with strong parameters\n @ticket = current_user.help_requests.build(ticket_params)\n # New Hash\n add_info = {}\n # New Nested Array\n add_info[:tagged_users] = []\n # Scan for tagged users in the report:\n @ticket.desc.scan(USER_TAG_REGEX) do |name|\n # Find a tagged user in the database\n user = User.find_by_name(name)\n # Add the tagged user to the hash of tagged users\n add_info[:tagged_users] << user.name unless user == nil\n end\n # Save a JSON representation of the add_info hash to the record\n @ticket.addinfo = JSON.generate(add_info)\n # Save the new record in the database\n @ticket.save\n # Send the user to their homepage\n redirect_to me_path\n end",
"def create\n (kick and return) if not is_god?\n if (params[:team].has_key? :pass_hash) and (params.has_key? :do_hash)\n clear_pass = params[:team][:pass_hash]\n hash = Digest::SHA1.base64digest clear_pass\n params[:team][:pass_hash] = hash\n end\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def respides\n n = Problem.where(source: params[:source]).count\n spider = get_spider(params[:source])\n problems = spider.spide_problems(n)\n problems.each do |problem| \n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).limit(10).order(:id).reverse_order\n render json: @problems\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def create\n\n ### This one works. \n # @work = Work.friendly.find(params[:work_id])\n # @suggestion = @work.suggesteds.build(suggestion_params)\n # @suggestion.suggester_ip = request.remote_ip\n # @suggestion.user = current_user if current_user\n # respond_to do |format|\n # if @suggestion.save\n # format.html { redirect_to @work\n # flash[:success] = \"Your tag suggestion has been added!\" }\n # format.json { render json: @suggestion, status: :created, location: @suggestion } \n # else\n # format.html { redirect_to @work\n # flash[:warning] = \"Suggesting the suggestion failed. Probably either because you had weird characters in there, or the suggestion exists already.\" }\n # format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n # end\n # end\n\n # This one parses the incoming suggestion(s). AND IT WORKS TOO. \n @work = Work.friendly.find(params[:work_id])\n suggestions = params[:suggested][:suggestion].split(',')\n @i = 0\n if current_user\n @current_user_id = current_user.id \n else \n @current_user_id = nil \n end\n\n suggestions.each do |s, index|\n new_suggestion = @work.suggesteds.build(\n suggester_ip: request.remote_ip,\n user_id: @current_user_id,\n suggestion: s)\n if new_suggestion.save\n @i += 1\n end \n if @i == suggestions.count\n @suggestions_saved = true\n else \n @suggestions_saved = false\n end\n end\n respond_to do |format|\n if @suggestions_saved\n format.html { redirect_to @work \n flash[:info] = \"Success.\"}\n format.json { }\n else\n format.html { redirect_to @work \n flash[:danger] = \"Suggested tags must be unique.\"}\n format.json { }\n end\n end \n end",
"def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end",
"def destroy\n @hack_tip.destroy\n respond_to do |format|\n format.html { redirect_to hack_tips_url }\n format.json { head :no_content }\n end\n end",
"def create\n category = params[:text].scan(/#(\\w+)/).flatten\n\n idea = Idea.create!(\n content: params[:text],\n category: category,\n user: User.find_by(uid: params[:user_id]),\n channel: params[:channel_name],\n stage: \"seed\"\n )\n json = {\n \"text\": \"#{idea.content}\",\n \"attachments\": [\n {\n \"text\": \"#{idea.user.firstname} just logged a new idea!\",\n \"fallback\": \"You are unable to choose a game\",\n \"callback_id\": \"wopr_game\",\n \"color\": \"#3AA3E3\",\n \"attachment_type\": \"default\",\n \"actions\": [\n {\n \"name\": \"game\",\n \"text\": \"endorse\",\n \"type\": \"button\",\n \"value\": \"chess\"\n },\n {\n \"name\": \"game\",\n \"text\": \"Suggest\",\n \"type\": \"button\",\n \"value\": \"maze\"\n },\n ]\n }\n ]\n }\n\n render json: json\n end",
"def create\n @patch = Patch.new(params[:patch])\n\n respond_to do |format|\n if @patch.save\n format.html { redirect_to @patch, notice: 'Patch was successfully created.' }\n format.json { render json: @patch, status: :created, location: @patch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n idea_hash = params[:idea]\n idea_hash[:idea_actions] = idea_hash[:idea_actions].blank? ? [] : idea_hash[:idea_actions].map { | action_attrs | IdeaAction.new(action_attrs.merge(member: current_member)) }\n idea_hash[:talks] = idea_hash[:talks].blank? ? [] : idea_hash[:talks].map { | talk_attrs | Talk.find(talk_attrs[:id]) }\n\n @idea = Idea.new(idea_hash)\n @idea.member = member\n\n respond_to do |format|\n if @idea.save\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hack_tag_follow = HackTagFollow.new(params[:hack_tag_follow])\n\n respond_to do |format|\n if @hack_tag_follow.save\n format.html { redirect_to(new_hack_tag_follow_path, :notice => 'Hack tag follow was successfully created.') }\n format.xml { render :xml => @hack_tag_follow, :status => :created, :location => @hack_tag_follow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hack_tag_follow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @hack_tips = HackTip.all\n end",
"def create\n @switt = Switt.new(switt_params)\n\n respond_to do |format|\n if verify_recaptcha(model: @switt) && @switt.save\n format.html { redirect_to @switt, notice: 'Switt was successfully created.' }\n format.json { render :show, status: :created, location: @switt }\n else\n format.html { render :new }\n format.json { render json: @switt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n busy_shifts = params[:busy_shift]\n if busy_shifts\n busy_shifts[:day].length.times do |index|\n day = busy_shifts[:day][index]\n start_time = busy_shifts[:start_time][index]\n end_time = busy_shifts[:end_time][index]\n @busy_shifts = current_user.busy_shifts.create(:day => day, :start_time => start_time, :end_time => end_time)\n end\n render json: current_user.busy_shifts\n else\n render json: {errors: \"Could not create busy shifts there was a error\"}\n end\n end",
"def update_infos\n skip_authorization\n respond_to do |format|\n format.json do\n render json: hashing_infos\n end\n end\n end",
"def create\n @csrfattack = Csrfattack.new(csrfattack_params)\n\n respond_to do |format|\n if @csrfattack.save\n format.html { redirect_to @csrfattack, notice: 'Csrfattack was successfully created.' }\n format.json { render :show, status: :created, location: @csrfattack }\n else\n format.html { render :new }\n format.json { render json: @csrfattack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puzzles\n render json: {\n # This uses the same puzzle pool as Haste mode\n puzzles: HastePuzzle.random_level(100).as_json(lichess_puzzle_id: true)\n }\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 create\n @settlebuddy_support = SettlebuddySupport.new(settlebuddy_support_params)\n\n respond_to do |format|\n if @settlebuddy_support.save\n format.html { redirect_to @settlebuddy_support, notice: 'Settlebuddy support was successfully created.' }\n format.json { render :show, status: :created, location: @settlebuddy_support }\n else\n format.html { render :new }\n format.json { render json: @settlebuddy_support.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end",
"def safeguarded_json\n # Make sure this is actually JSON\n hash = JSON.parse(params[:json])\n\n # Refuse to handle more than 12 chickens at once. What are you, a factory farmer??\n raise \"Too many birds\" if hash.size > 12\n\n return params[:json]\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def post!\n request! :post\n end",
"def twizzle_params\n params.require(:twizzle).permit(:user_id, :content)\n end",
"def create\n @user_trick = UserTrick.find_or_create_by(user_trick_params)\n\n respond_to do |format|\n if @user_trick.save\n format.html { redirect_to @user_trick, notice: \"User trick was successfully created.\" }\n format.json { render :show, status: :created, location: @user_trick }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def initial_test_pack\n user = User.where({admin: true}).first\n user.problems.each do |problem|\n self.requests.create(user_id: self.id, problem_id: problem.id)\n end\n end",
"def patches\n \"https://raw.github.com/gist/1347323/flusspferd-cmake_find_spidermonkey1.8.5.patch\"\n \"https://raw.github.com/gist/49c4e09a8285d4d2c4d0/flusspferd-git_to_https_submodules.patch\"\n end"
] |
[
"0.68881834",
"0.66280633",
"0.62280065",
"0.61810607",
"0.60406166",
"0.59946245",
"0.5958912",
"0.5920991",
"0.58166856",
"0.58166856",
"0.57151634",
"0.57151634",
"0.5638459",
"0.56355447",
"0.5546912",
"0.5462803",
"0.53735363",
"0.53677434",
"0.5311316",
"0.52749044",
"0.5269706",
"0.5266606",
"0.5262406",
"0.5180898",
"0.51741046",
"0.517205",
"0.5130355",
"0.51073176",
"0.5061501",
"0.50496525",
"0.5024347",
"0.5014107",
"0.49710676",
"0.4955978",
"0.49499246",
"0.4943856",
"0.49383843",
"0.4919671",
"0.4913697",
"0.4893757",
"0.4880945",
"0.4863293",
"0.48596388",
"0.48452362",
"0.48380348",
"0.4825986",
"0.4814603",
"0.47694942",
"0.47518685",
"0.47323823",
"0.47296017",
"0.47214082",
"0.46884277",
"0.46710798",
"0.4666626",
"0.46662247",
"0.46591842",
"0.4650168",
"0.46500972",
"0.46374065",
"0.46237248",
"0.46031258",
"0.46025124",
"0.4585922",
"0.45843095",
"0.45813778",
"0.4552857",
"0.45519647",
"0.45433676",
"0.45433676",
"0.45406204",
"0.45336467",
"0.45249495",
"0.4524091",
"0.4513859",
"0.45113623",
"0.45108944",
"0.45108098",
"0.45040834",
"0.4503642",
"0.4501572",
"0.45007",
"0.44970617",
"0.4492023",
"0.44885206",
"0.44884345",
"0.44847915",
"0.44840148",
"0.44743562",
"0.44661486",
"0.4465427",
"0.44649655",
"0.44582957",
"0.4452337",
"0.44468918",
"0.44362003",
"0.44270888",
"0.44211295",
"0.44156352",
"0.4408022"
] |
0.53665185
|
18
|
PUT /hacks/1 PUT /hacks/1.json
|
def update
@hack = Hack.find(params[:id])
respond_to do |format|
if @hack.update_attributes(params[:hack])
format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @hack.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to @hacker, notice: 'Hacker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def set_hack\n @hack = Hack.find(params[:id])\n end",
"def update\n \n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to(@hacker, :notice => 'Hacker was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hacker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hack = Hack.new(params[:hack])\n\n respond_to do |format|\n if @hack.save\n format.html { redirect_to @hack, notice: 'Hack was successfully created.' }\n format.json { render json: @hack, status: :created, location: @hack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\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 @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def update\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n if @need_help.update_attributes(params[:need_help])\n format.json {head :no_content}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end",
"def set_hacker\n @hacker = Hacker.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @hack_member.update(hack_member_params)\n format.html { redirect_to @hack_member, notice: 'Hack member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hack_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end",
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end",
"def set_hackathon\n @hackathon = Hackathon.find(params[:id])\n end",
"def show\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hack }\n end\n end",
"def hack_params\n params.require(:hack).permit(:description, :image)\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 patch!\n request! :patch\n end",
"def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n format.html { redirect_to @hacker, notice: 'Hacker was successfully created.' }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @story = Story.find(params[:id])\n #@story = Story.friendly.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @users_hacktag = UsersHacktag.find(params[:id])\n\n respond_to do |format|\n if @users_hacktag.update_attributes(params[:users_hacktag])\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hack_member\n @hack_member = HackMember.find(params[:id])\n end",
"def update\n @problem = Problem.find(params[:id])\n\n if @problem.update(problem_params)\n head :no_content\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end",
"def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end",
"def update\n @shorty = Shorty.find(params[:id])\n\n respond_to do |format|\n if @shorty.update_attributes(params[:shorty])\n format.html { redirect_to @shorty, notice: 'Shorty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shorty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end",
"def update\n if @secret.update_attributes(secret_params)\n head :no_content\n else\n render json: @secret.errors, status: :unprocessable_entity\n end\n end",
"def update_infos\n skip_authorization\n respond_to do |format|\n format.json do\n render json: hashing_infos\n end\n end\n end",
"def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\n :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: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n\n respond_to do |format|\n if @exercise_instruction.update_attributes(params[:exercise_instruction])\n format.html { redirect_to @exercise_instruction.exercise, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_instruction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end",
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @story.update(story_params)\n head :no_content\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hack }\n end\n end",
"def update\n @user = User.find(session[:id])\n\n if (nil != @user)\n @user.difficulty = params[:id]\n end\n\n respond_to do |format|\n if @user.save\n format.html { head :no_content }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.linked_puzzles.clear\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.update_attributes(params[:puzzle])\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end",
"def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bits_1.update(bits_1_params)\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Put.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n begin\n response = http.start {|http| http.request(request) }\n rescue\n puts url\n end\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def show\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hacker }\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def update\n @story = Story.find(params[:id])\n \n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Zmiany zostały zapisane.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :ok }\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n if @witch.update_attributes(params[:witch])\n format.html { redirect_to @witch, notice: 'Witch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @witch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @problem = Problem.find_by_shortname(params[:id])\n create_tags\n respond_to do |format|\n if @problem.update_attributes(problem_params)\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shouji.update(shouji_params)\n format.html { redirect_to @shouji, notice: 'Shouji was successfully updated.' }\n format.json { render :show, status: :ok, location: @shouji }\n else\n format.html { render :edit }\n format.json { render json: @shouji.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: I18n.t('exercises.updated') }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_addon_definition_with_http_info(moid, kubernetes_addon_definition, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_addon_definition ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_addon_definition\"\n end\n # verify the required parameter 'kubernetes_addon_definition' is set\n if @api_client.config.client_side_validation && kubernetes_addon_definition.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_addon_definition' when calling KubernetesApi.patch_kubernetes_addon_definition\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/AddonDefinitions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_addon_definition)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesAddonDefinition'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_addon_definition\",\n :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: KubernetesApi#patch_kubernetes_addon_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mistake = Mistake.find(params[:id])\n\n respond_to do |format|\n if @mistake.update_attributes(params[:mistake])\n format.html { redirect_to @mistake, notice: 'Mistake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mistake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hack_tip\n @hack_tip = HackTip.find(params[:id])\n end"
] |
[
"0.7111815",
"0.68478435",
"0.6722511",
"0.659202",
"0.659202",
"0.6347484",
"0.60263634",
"0.59213746",
"0.5888474",
"0.5802053",
"0.579233",
"0.57616717",
"0.57616717",
"0.565767",
"0.5615698",
"0.556979",
"0.55583864",
"0.5544215",
"0.5538186",
"0.55355215",
"0.55355215",
"0.55207795",
"0.5519108",
"0.54928255",
"0.546256",
"0.5459091",
"0.5455543",
"0.5453031",
"0.54329836",
"0.540556",
"0.5363839",
"0.5340639",
"0.53388375",
"0.5333087",
"0.53246784",
"0.53157234",
"0.5315419",
"0.5314419",
"0.52939194",
"0.5291692",
"0.5288378",
"0.5272371",
"0.525266",
"0.5251761",
"0.52424383",
"0.5240295",
"0.5226068",
"0.5225744",
"0.5223458",
"0.52229655",
"0.5214599",
"0.5199282",
"0.51972234",
"0.51972234",
"0.51972234",
"0.51926965",
"0.51893026",
"0.5179615",
"0.5173899",
"0.5172709",
"0.5169827",
"0.51679736",
"0.5165562",
"0.51618403",
"0.51445824",
"0.5140774",
"0.51294494",
"0.51294494",
"0.51253074",
"0.51115316",
"0.5106686",
"0.509588",
"0.5090478",
"0.5088603",
"0.50843245",
"0.5082061",
"0.5078759",
"0.5076298",
"0.50753516",
"0.50734353",
"0.5069473",
"0.50652087",
"0.5062982",
"0.5061793",
"0.506178",
"0.5060074",
"0.5059746",
"0.5053785",
"0.50486296",
"0.5045964",
"0.5039747",
"0.5039747",
"0.50382346",
"0.50382346",
"0.5037467",
"0.5034454",
"0.5034069",
"0.5031974",
"0.50197095",
"0.50177705"
] |
0.7141757
|
0
|
DELETE /hacks/1 DELETE /hacks/1.json
|
def destroy
@hack = Hack.find(params[:id])
@hack.destroy
respond_to do |format|
format.html { redirect_to hacks_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to(hackers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to event_url(@event) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hack_tip.destroy\n respond_to do |format|\n format.html { redirect_to hack_tips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @hackathon.destroy\n respond_to do |format|\n format.html { redirect_to hackathons_url, notice: 'Hackathon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hack_member.destroy\n respond_to do |format|\n format.html { redirect_to hack_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kickoff = Kickoff.find(params[:id])\n @kickoff.destroy\n\n respond_to do |format|\n format.html { redirect_to kickoffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @need_help = NeedHelp.find(params[:id])\n @need_help.destroy\n\n respond_to do |format|\n format.json {head :no_content}\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to monkeys_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @shorty = Shorty.find(params[:id])\n @shorty.destroy\n\n respond_to do |format|\n format.html { redirect_to shorties_url }\n format.json { head :ok }\n end\n end",
"def delete!\n request! :delete\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @hackathon.destroy\n if current_user.admin?\n redirect_to current_user\n else\n respond_to do |format|\n format.html { redirect_to hackathons_url, notice: 'Hackathon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\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_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n hack = @comment.hack\n @comment.destroy\n redirect_to hack_path(hack.id)\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n @hackplatformrelation.destroy\n\n respond_to do |format|\n format.html { redirect_to hackplatformrelations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\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 @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @trick = Trick.find(params[:id])\n @trick.destroy\n\n respond_to do |format|\n format.html { redirect_to tricks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duck.destroy\n\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @drone_attack = DroneAttack.find(params[:id])\n @drone_attack.destroy\n\n respond_to do |format|\n format.html { redirect_to drone_attacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duck.destroy\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @enzyme = Enzyme.find(params[:id])\n @enzyme.destroy\n\n respond_to do |format|\n format.html { redirect_to enzymes_url }\n format.json { head :no_content }\n end\n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_hacktag = UsersHacktag.find(params[:id])\n @users_hacktag.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_hacktags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end",
"def delete\n api_client.delete(url)\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 @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heart_beat.destroy\n respond_to do |format|\n format.html { redirect_to heart_beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @scratcher = Scratcher.find(params[:id])\n @scratcher.destroy\n\n head :no_content\n end",
"def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end",
"def destroy\n @api_haiku = Api::Haiku.find(params[:id])\n @api_haiku.destroy\n\n respond_to do |format|\n format.html { redirect_to api_haikus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scratch = Scratch.find(params[:id])\n @scratch.destroy\n\n respond_to do |format|\n format.html { redirect_to(scratches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shorturl.destroy\n respond_to do |format|\n format.html { redirect_to shorturls_url, notice: 'Shorturl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge ||= Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\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 delete(path, opts = {})\n request(:delete, path, opts).body\n end",
"def destroy\n @crash_test = CrashTest.find(params[:id])\n @crash_test.destroy\n\n respond_to do |format|\n format.html { redirect_to crash_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\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",
"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 delete_short_url_object_for(params[:id])\n respond_to do |format|\n format.html { redirect_to short_urls_url, notice: 'Short url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @guide = Guide.find(params[:id])\n @guide.destroy\n respond_to do |format|\n format.html { redirect_to guides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @help = Help.find(params[:id])\n @help.destroy\n\n respond_to do |format|\n format.html { redirect_to helps_url }\n format.json { head :no_content }\n end\n end",
"def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fix_upgrade = FixUpgrade.find(params[:id])\n @fix_upgrade.destroy\n\n respond_to do |format|\n format.html { redirect_to fix_upgrades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hack_tag_follow = HackTagFollow.find(params[:id])\n @hack_tag_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(hack_tag_follows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dummy = Dummy.find(params[:id])\n @dummy.destroy\n\n respond_to do |format|\n format.html { redirect_to dummies_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kolegiji = Kolegiji.find(params[:id])\n @kolegiji.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end"
] |
[
"0.7742959",
"0.7297151",
"0.7268553",
"0.690549",
"0.66731745",
"0.65752196",
"0.655937",
"0.654154",
"0.6390018",
"0.632456",
"0.627344",
"0.62694347",
"0.62603915",
"0.6252997",
"0.62400734",
"0.6210805",
"0.6210805",
"0.6210805",
"0.6210805",
"0.62079275",
"0.6195012",
"0.61925673",
"0.61918026",
"0.618937",
"0.617795",
"0.6161077",
"0.614779",
"0.6144738",
"0.6144669",
"0.6143476",
"0.61408365",
"0.61338955",
"0.61263496",
"0.61221504",
"0.6113552",
"0.6105001",
"0.61029553",
"0.6100372",
"0.60818356",
"0.6081306",
"0.6076013",
"0.60736704",
"0.60736704",
"0.6071671",
"0.6062381",
"0.6059722",
"0.6058404",
"0.6047723",
"0.6047474",
"0.60433936",
"0.60433936",
"0.6040519",
"0.60387915",
"0.6025804",
"0.60154486",
"0.60134053",
"0.6011525",
"0.6011021",
"0.60077214",
"0.60036206",
"0.59967583",
"0.5993705",
"0.5993037",
"0.5990681",
"0.5986036",
"0.5981927",
"0.5980859",
"0.59808224",
"0.5979887",
"0.59788543",
"0.5976635",
"0.59744745",
"0.59727156",
"0.59703696",
"0.5965983",
"0.5964284",
"0.5963268",
"0.59631336",
"0.59621125",
"0.59579575",
"0.59579575",
"0.59579575",
"0.59579575",
"0.5957217",
"0.59472406",
"0.5942632",
"0.59411633",
"0.59396815",
"0.59381205",
"0.59371394",
"0.5929589",
"0.5920687",
"0.5920141",
"0.591878",
"0.59182477",
"0.59182477",
"0.5918082",
"0.5915118",
"0.5912287",
"0.59120804"
] |
0.77715
|
0
|
recipes create when user adds a recipe, we know who added that recipe have authentication save user inputted info user_id fk on recipes table (MIGRATION) figure out who is logged in and add their id to the recipe that's getting made
|
def show
# accept the params
# go to the db and get the correct recipe for that param
p params[:id]
@recipe = Recipe.find_by(id: params[:id])
@ingredients = @recipe.ingredients.split(", ").map {|ingredient| ingredient.capitalize}
# send this to the view
# show that data to the user
render 'show.json.jb'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_recipe_connection(recipe_id)\n if user.recipes.where(id: recipe_id) == Recipe.all.where(id: recipe_id)\n recipe_finder(recipe_id)\n else\n UserRecipe.create(name: self.user.name, user_id: self.user.id, recipe_id: recipe_id)\n recipe_finder(recipe_id)\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"def create\n\t\t@recipe = Recipe.new(recipe_params)\n\n\t\t@user = User.find(session[:user_id])\n\t\t@recipe.user_id = @user.id\n\t\t@recipe.save\n\t\t# if @recipe.valid?\n\t\t# \t@recipe.save\n\t\t# \tredirect_to recipe_path(@recipe)\n\n\t\tif @recipe.save\n\t\t\tredirect_to recipe_path(@recipe)\n\t\telse\n\t\t\tredirect_to recipes_path\n\t\tend\t\t\n\tend",
"def create\n new_recipe = Recipe.create(recipe_params)\n redirect_to user_recipes_path(new_recipe.user)\n end",
"def create\n puts recipe_params[:ingredients], recipe_params[:recipe], recipe_params[:user_id]\n recipe = Recipe.create(recipe_params[:recipe])\n if(recipe.valid?)\n Ingredient.create_and_assign(recipe_params[:ingredients], recipe.id)\n newUR = UserRecipe.create(recipe_id: recipe.id, user_id: recipe_params[:user_id])\n render json: UserRecipeSerializer.new(newUR).to_serialized_json\n else\n render json: recipe.errors.full_messages\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id=current_user.id\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id = current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id = current_user.id\n @recipe.owner = current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n if !params[:user_id].blank?\n user = User.find(params[:user_id])\n user_recipe = UserRecipe.create(params[:foobar], user)\n user_recipe.save\n respond_to do |format|\n format.json do\n render :json => \"{ \\\"msg\\\": \\\"Recipe saved!\\\" }\"\n end\n end\n else\n respond_to do |format|\n format.json do\n render :json => \"{ \\\"msg\\\": \\\"You are not logged in\\\" }\"\n end\n end\n end\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n \n if @recipe.save\n redirect_to @recipe, notice: \"Successfully created new recipe\"\n else\n render 'new'\n end\n end",
"def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end",
"def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.user = current_user\n\n \n\n respond_to do |format|\n if @recipe.save\n recipe_ingredient_group = @recipe.recipe_ingredient_groups.new\n recipe_ingredient_group.name = \"Main ingredients\"\n recipe_ingredient_group.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id = current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'レシピが登録されました。' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.chef = current_user #must log in to be able to create a recipe\n \n if @recipe.save\n flash[:success] = \"Your recipe was created successfully!\"\n redirect_to recipes_path\n else\n render :new\n end\n \n end",
"def create\n @user=User.find(session[:user])\n params[:recipe][:user_id]=session[:user]\n params[:recipe][:user_name]=@user.name\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to(recipes_path, :notice => 'Recipe was successfully created.') }\n format.xml { render :xml => recipes_path, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_recipe_user\n @recipe_user = RecipeUser.find(params[:id])\n end",
"def create_new_recipe3 user, params\n recipe = Recipe.new(name: params[\"recipe_name\"], create_time: Time.now.to_i, user_id: user.id, user_name: user.name)\n recipe.picture = params[\"recipe_url\"] if params[\"recipe_url\"] != nil\n raise Error::RecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n ingredients = params[\"ingredients\"]\n ingredients.each { |ingredient| Ingredient.create(name: ingredient[\"name\"], amount: ingredient[\"amount\"], recipe_id: recipe.id)}\n\n steps = params[\"steps\"]\n steps.length.times { |i| Step.create(index: i+1, content: steps[i], recipe_id: recipe.id)}\n\n recipe\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to edit_recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"def create\n #Rails 4 forces us to use STRONG PARAMETERS to white list which submitted parameters should be accepted for security reasons. We'll do it by creating a private method down. \n @recipe = Recipe.new(recipe_params)\n #We need to insert CHEF ID as we did not define in RECIPE_PARAMS method and it is required inside white list. \n @recipe.chef = current_user\n if @recipe.save\n #To show a flash message\n flash[:success] = \"Your recipe was created successfully!\"\n redirect_to recipes_path\n else\n #If it fails, we want it to render the form again\n render :new\n end\n \n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"def create\n \tset_tag_list\n\n @recipe = @current_user.recipes.build(params[:recipe])\n @recipe.status = @recipe.get_status\n item_client_ip(@recipe)\n # @recipe.is_draft = params[:is_draft]\n # @recipe.is_draft = @recipe.get_is_draft\n # @recipe.published_at = @recipe.get_published_at\n \n ActiveRecord::Base.transaction do \n\t\t\tif @recipe.save\n\t\t\t\t# @recipe.tag_list = params[:tags].strip if params[:tags] && !params[:tags].strip.blank?\n\t\t\t\treg_homepage(@recipe)\n\t\t\t\tafter_create_ok\n\t\t\telse\n\t\t\t\tafter_create_error\n\t\t\tend\n\t\tend\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @btnText = \"Create Recipe\"\n @obj = @recipe\n if(@recipe.save)\n redirect_to current_user\n else\n flash.now.alert = \"Form Error\"\n render 'shared/form'\n end\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @btnText = \"Create Recipe\"\n @obj = @recipe\n if(@recipe.save)\n redirect_to current_user\n else\n flash.now.alert = \"Form Error\"\n render 'shared/form'\n end\n end",
"def create\n\n @recipe = current_user.recipes.new(params[:recipe])\n @user = current_user\n @dish = Dish.find(@recipe.dish_id)\n @winner = Recipe.where(\"dish_id = ? AND king = ?\", @recipe.dish_id, true).first\n\n respond_to do |format|\n if @recipe.save\n RecipeMailer.create_recipe(@user, @recipe, @winner, @dish).deliver\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_database(recipe)\n\t\t# Parsing the recipe line\n\t\trecipe_db = Recipe.new(\n\t\t\ttitle: recipe[\"recipe\"][\"label\"].to_s,\n\t\t\timage: recipe[\"recipe\"][\"image\"].to_s,\n\t\t\tdescription: recipe[\"recipe\"][\"source\"].to_s,\n\t\t\tuser_id: 1\n\t\t\t)\n\t\trecipe_db.save\n\t\tputs recipe_db.errors.messages\n\t\tputs \"ID: #{recipe_db.id}\"\n\t\tputs \"TITLE: #{recipe_db.title}\"\n\t\tputs \"IMAGE: #{recipe_db.image}\"\n\t\t# Parsing the ingredients line\n\t\trecipe[\"recipe\"][\"ingredientLines\"].each do |ingredient|\n\t\t\t# Retrieving the ingredient\n\t\t\tingredient_db = Ingredient.create(\n\t\t\t\tname: ingredient,\n\t\t\t\trecipe_id: recipe_db.id\n\t\t\t\t)\n\t\t\trecipe_db.ingredients << ingredient_db\n\t\tend\n\n\t\trecipe_db\n\tend",
"def create\n begin\n ActiveRecord::Base.transaction do\n @recipe = Recipe.find_or_create_by!(trusted_params)\n @ingredient = Ingredient.find_or_create_by!(ingredient: params[:recipe][:ingredient])\n\n new_ingredient_recipe = IngredientRecipe.new(\n ingredient_id: @ingredient.id,\n recipe_id: @recipe.id,\n )\n new_ingredient_recipe.save!\n \n redirect_to @recipe, notice: \"Recipe was successfully created.\"\n end\n rescue\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n authorize! :create, Recipe\n \n @recipe = Recipe.new(recipe_params)\n @recipe.author = current_user\n @recipe.modifier = current_user\n \n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: t('.success') }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_recipe2 user_id, user_name, params\n recipe = Recipe.new\n recipe.name = params[:recipe_name]\n recipe.create_time = Time.now().to_i\n recipe.user_id = user_id\n recipe.user_name = user_name\n recipe.picture = \"uploads/user#{user_id}recipe#{recipe.create_time}.jpg\" if params[:recipe_file] != nil\n raise Error::CreateRecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n threads = []\n if params[:recipe_file] != nil\n threads << Thread.new { File.open(\"public/#{recipe.picture}\", \"wb\") { |file| file.write params[:recipe_file][:tempfile].read } }\n end\n\n ingredients = JSON.parse params[:ingredients]\n ingredients.length.times do |i|\n Ingredient.create(name: ingredients[i][\"name\"], recipe_id: recipe.id, amount: ingredients[i][\"amount\"])\n end\n\n steps = params[:steps].to_i\n steps_text = JSON.parse params[:steps_text]\n steps.times do |i|\n step = Step.new(recipe_id: recipe.id, index: i+1, content: steps_text[i])\n if (params[\"steps_file#{i+1}\"] != nil)\n step.picture = \"uploads/recipe#{recipe.id}step#{i+1}.jpg\"\n threads << Thread.new { File.open(\"public/#{step.picture}\", \"wb\") { |file| file.write params[\"steps_file#{i+1}\"][:tempfile].read } }\n end\n step.save\n end\n\n recipe\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user = current_user\n @recipe.city = current_user.city\n @recipe.address = current_user.address\n @recipe.zipcode = current_user.zipcode\n \n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n @errors = process_ingredient_inputs(params, @recipe)\n @errors = [\"You must include at least one ingredient in your recipe\"] if @recipe.recipe_ingredients.empty?\n if(! @errors.empty?) then\n\t\t# reshow\n\t\t@errors.each{ |msg| @recipe.errors[:base] << msg } \n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\tend\n\t\treturn\n\tend\n\t@recipe.entered_by_id = @current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to(@recipe, :notice => 'Recipe was successfully created.') }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_to_favourites\n \n #pull out whichever recipe you are clicking on\n yummly_id = params[:yummly_id]\n recipe = Yummly.find(yummly_id)\n\n # make new instance of that recipe\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n UserFavouriteRecipe.create(recipe_id: r.id, user_id: current_user.id, yummly_id: yummly_id)\n\n redirect_to recipes_url, notice: \"Added recipe from your list of favourite recipes\"\n\n end",
"def create\n recipe_id = ingredient_params[:recipe_id]\n authorize Recipe.find(recipe_id), :update?\n parent_id = params[:parent_id]\n piece_type = params[:ingredient][:piece_type]\n piece_id = case piece_type\n when 'Loadout'\n loadout_kind = params[:ingredient][:loadout_kind]\n params[:ingredient][loadout_kind.downcase + '_id']\n when 'Character'\n params[:ingredient][:character_id]\n when 'Respawn'\n params[:ingredient][:respawn_id]\n end\n ingredient = Ingredient.create(recipe_id: recipe_id,\n piece_id: piece_id,\n piece_type: piece_type,\n parent_id: parent_id)\n redirect_back fallback_location: root_path\n end",
"def new\n @recipe = current_user.recipes.build\n end",
"def add_ingredientusers(ingredients)\n ingredients.each {|ingredient| IngredientUser.create(user_id: self.id, ingredient_id: ingredient.id)}\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 setup_data\n user = create(:user)\n another_user = create(:user)\n recipe_type = create(:recipe_type)\n another_recipe_type = create(:recipe_type)\n cuisine = create(:cuisine)\n torta_morango = create(:recipe, title: 'Torta de Morango', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Morango, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Limão', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Limão, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Abacate', difficulty: 'Médio',\n recipe_type: another_recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Abacate, farinha, ovos, decoracoes',\n cook_method: 'Misture tudo, coloque no forno, e apos retirar decore a torta',\n user: another_user)\n sobremesas = create(:list, name: 'Sobremesas', user: user)\n create(:list_recipe, list: sobremesas, recipe: torta_morango)\n login_as(user, scope: :user)\n end",
"def create \n @recipe = Recipe.new(recipe_params)\n @recipe.author = @current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n authorize @recipe\n @recipe.user = current_user if current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n if @recipe.user.email == current_user.email\n @owner = true\n end\n end",
"def create\n \n if params[\"donor\"]\n @recipe = Recipe.find(params[\"donor\"]).clone_with_ingredients(params[\"recipe\"])\n @recipe.user = current_user\n\n else\n @recipe = Recipe.new(params[\"recipe\"])\n end\n\n @recipe.user = current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_ingredient(recipe_id, ingredients)\n\t\t\t\tdestroy_ingredients = RecipeIngredient.where(recipe_id: recipe_id)\n\t\t\t\tif !destroy_ingredients.blank? \n\t\t\t\t\tdestroy_ingredients.delete_all \n\t\t\t\tend\n\t\t\t\tingredients.each do |recipe_ingredient|\n\t\t\t\t\tingredient = RecipeIngredient.new\n\t\t\t\t\tingredient.recipe_id = recipe_id\n\t\t\t\t\tingredient.ingredient = recipe_ingredient\n\t\t\t\t\tingredient.save!\n\t\t\t\tend\n\t\t\tend",
"def add_recipe(recipe)\n @recipes.push(recipe)\n save\n end",
"def create\n @favourites_recipe = FavouritesRecipe.new\n @favourites_recipe.user_id = current_user.id\n @favourites_recipe.recipe_id = params[:recipe_id]\n respond_to do |format|\n if @favourites_recipe.save\n format.html { redirect_to @favourites_recipe, notice: 'Favourites recipe was successfully created.' }\n format.json { render :show, status: :created, location: @favourites_recipe }\n else\n format.html { render :new }\n format.json { render json: @favourites_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_user = RecipeUser.new(recipe_user_params)\n\n respond_to do |format|\n if @recipe_user.save\n format.html { redirect_to @recipe_user, notice: 'Recipe user was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_user }\n else\n format.html { render :new }\n format.json { render json: @recipe_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_user_params\n params.require(:recipe_user).permit(:recipe_id, :user_id)\n end",
"def add_recipe(recipe)\n if database.has_key? recipe[0]\n puts('Recipe already in Database.')\n else\n ingredients_list = []\n recipe[1..-1].each do |ingredient|\n if database.has_key? ingredient\n temp = database[ingredient]\n ingredients_list.push(temp)\n else\n puts('Missing ingredient(s)')\n break\n end\n end\n temp = Recipe.new(recipe[0], ingredients_list)\n database[temp.name] = temp\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_recipes\n @recipes = @user.savedrecipe.recipe\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingredient_add_helper(recipe_id)\n added_ingredient = prompt.ask(\"What ingredient would you like to add\")\n new_recipe_ingredient_arr = user.recipes.where(id: recipe_id)[0].ingredient.split(\", \") << added_ingredient\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @recipe.user = current_user\n @recipe.save\n @measurs = Array.new\n @ingrs = Array.new\n @tgs = Array.new\n #ovo bi trebalo unutar sebe prikupiti sastojke i mjere\n parse_ingredients\n parse_tags\n @recipe.measurements = @measurs\n @recipe.ingredients = @ingrs\n @recipe.recipe_tags = @tgs\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\trecipe_list = RecipeList.create\n\t@user.recipe_list = recipe_list\n respond_to do |format|\n if @user.save\n format.html { redirect_to(root_url, :notice => 'Registration successful') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add\n if user_signed_in?\n recipe = Recipe.find(params[:id])\n plan = Plan.create(user_id: current_user.id, recipe_id: recipe.id)\n\n redirect_to '/'\n else\n redirect_to '/users/sign_in'\n end\n end",
"def create\n @user = current_user\n @beer = @user.beers.new(beer_params)\n \n @recipe = Recipe.find(params[:recipe_id])\n\n if @beer.save\n @recipe.beer = @beer\n\n redirect_to user_beers_path(@user), notice: 'Beer was successfully created!' \n else\n render 'new' \n end\n \n end",
"def create\n @recipe = Recipe.new(recipe_params)\n # if params[:add_ingredient]\n # @recipe.ingredients.build\n # end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def command_newRecipe(name, ingredients)\n bool = @database.add_recipe(name, ingredients)\n if bool == false\n puts \"Recipe already in database or ingredients not in database\"\n end\n @dbChanged = true\n end",
"def create\n if recipe_ingredient_params[:ingredients_list]\n fill_form_from_ingredients_list\n elsif recipe_params[:url] && !ingredient_params[:product_name]\n fill_form_from_url\n else\n @recipe = Recipe.new(recipe_params)\n @recipe.country_consumption = Country.find_or_create(recipe_name_params[:country_consumption_name])\n @recipe.user = current_user\n \n if ingredient_params[:product_name]\n ingredients = ingredient_params.values.transpose.map { |s| Hash[ingredient_params.keys.zip(s)] }\n ingredients.each do |ingredient|\n weight, item_name = Ingredient.parse(ingredient[\"item_name\"])\n if ingredient[\"product_name\"].length > 0 and not ingredient[\"product_name\"] == \"None\"\n @ingredient = Ingredient.new({:weight => ingredient[\"weight\"]})\n @ingredient.description = ingredient[\"item_name\"]\n @ingredient.product = Product.find_or_create(ingredient[\"product_name\"])\n @ingredient.country_origin = Country.find_or_create(ingredient[\"country_origin_name\"])\n @recipe.ingredients << @ingredient\n \n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = @ingredient.product\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n elsif item_name.length > 0\n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = Product.find_by(name: \"None\")\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n end\n end\n end\n \n save\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.recipe_id = params[:recipe_id].to_i\n @comment.user_id = params[:user_id].to_i\n @recipe = Recipe.find(@comment.recipe_id)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @recipe, notice: 'Comment was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :instructions, :image, :user_id)\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 create\n\n @healthlabels = Healthlabel.all;\n @dietlabels = Dietlabel.all;\n\n #create the new preference with the preference parameters we accept\n @preference = Preference.new(preference_params)\n #create the new user with the user parameters we accpet\n @user = User.new(user_params)\n\n #assign the current preference to the user\n @user.preference = @preference\n\n #create a blank recipe table entry for the user to save recipes to\n @user.savedrecipe = Savedrecipe.new\n #assign the default user role if not in user\n if @user.role == nil\n @user.role = 1;\n end\n\n respond_to do |format|\n if @user.save\n\n format.html { redirect_to new_session_path, notice: 'User was successfully created.' }\n\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\n end\n\n end\n end",
"def create\n @recipe = current_user.recipes.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha creado de forma exitosa.'} #ajax\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al crear la receta.'} #ajax\n end\n end\n end",
"def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end",
"def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end",
"def create\n @userc = User.new\n @userc.email = params[:email]\n @userc.password = params[:password]\n @userc.name = params[:name]\n @userc.last_name = params[:last_name]\n @userc.rut = params[:rut]\n @userc.save\n @userc.add_role :cook\n @userc.remove_role :admin\n\n if @userc.save\n @admin_cook_account = AdminCookAccount.new\n if current_user.has_role? :admin\n @admin_cook_account.id_admin = @user.id\n elsif current_user.has_role? :branch_leader\n @admin_cook_account.id_admin = @admin.id\n end\n @admin_cook_account.id_cook = @userc.id\n @admin_cook_account.branch_id = params[:branch_id]\n @admin_cook_account.save\n redirect_to admin_cooks_path\n else\n redirect_to admin_cooks_path, alert: \"Error\"\n end\n \n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n \n end",
"def generate_shopping_list\n\n #pull out whichever recipe you are clicking on\n recipe = Yummly.find(params[:yummly_id])\n\n # create a recipe for the database for future use\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n #create new shopping list for each recipe\n s = ShoppingList.create(\n name: recipe.name, \n yummly_id: params[:yummly_id],\n user_id: current_user.id,\n recipe_id: r.id)\n\n #find recipe and ingredient name from yummly\n recipe.ingredients.each do |ingredient|\n ShoppingListItem.create(done: nil, shopping_list_id: s.id, ingredient_name: ingredient, ingredient_quantity: nil, ingredient_quantity_unit: nil)\n end\n\n redirect_to recipes_url, notice: \"Added recipe to your shopping lists\"\n\n end",
"def create\n\n @recipe = current_user.recipes.build(recipe_params)\n\n if params[:recipe][:measurements_attributes]\n # try to save ingredient unique, check if name exists in db\n params[:recipe][:measurements_attributes].keys.each_with_index do |k, i|\n ing_name = params[:recipe][:measurements_attributes][k][:ingredient_attributes][:name]\n if Ingredient.find_by(name: ing_name, concentrate_recipe_id: nil)\n ingredient = Ingredient.find_by(name: ing_name, concentrate_recipe_id: nil)\n @recipe.measurements[i].ingredient = ingredient\n\n elsif Ingredient.find_by(name: ing_name)\n ingredient = Ingredient.find_by(name: ing_name)\n @recipe.measurements[i].ingredient = ingredient\n end\n end\n end\n\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n\t\tparams.inspect\n\t\tparams[:user][:email] = params[:user][:email].downcase\n\t\tparams.inspect\n\t\tuser = User.find_by(email: params[:user][:email])\n\n\t\tif user && user.authenticate(params[:user][:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to recipes_path\n\t\telse\n\t\t\tflash[:danger]= \"Invalid login credentials.\"\t\n\t\t\tredirect_to login_path\n\n\n\t\tend\n\tend",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def add_initial_user\n initial_user = Member.where(:email => \"administrator@administrator.com\").first\n \n unless initial_user\n # Create an initial position.\n position = Position.new\n position.name = \"Administrator\"\n position.pos_type = \"Administrator\"\n position.save\n \n # Create an initial division.\n division = Division.new\n division.name = \"Administrator\"\n division.save\n \n # Find initial position and division created.\n # Id´s will be used to crete initial user.\n position = Position.where(:name => \"Administrator\").first\n division = Division.where(:name => \"Administrator\").first\n \n # Create an initial user with position and divison created above.\n member = Member.new\n member.name = \"Administrator\"\n member.email = \"administrator@administrator.com\"\n member.password = \"administrator\"\n member.major = \"NONE\"\n member.grad_year = 9999\n member.member_since = 9999\n member.hometown = \"NONE\"\n member.position_id = position.id\n member.division_id = division.id\n member.save\n end\n end",
"def index\n @recipes = Recipe.all\n @recipe = Recipe.new\n @user = User.find_by_id(current_user.id)\n end",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless logged_in?\n render :file => 'public/401', :status => :unauthorized, :layout => false and return\n end\n\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to Item.find(@recipe.item_id), notice: 'Ingredient was successfully added to the recipe.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n flash.now[:error] = 'Unable to save ingredient'\n format.html { redirect_to new_recipe_ingredient_path }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:user_id, :title, :image_url, :description, :cuisine_id, :category_id, :cook_time, :serving_num, :instruction, :ingredients_attributes => [:id, :recipe_id, :quantity, :unit, :item_id, :_destroy, :item_attributes => [:name]])\n end",
"def correct_user\n @recipe = current_user.recipes.find_by(id: params[:id])\n unless @recipe\n redirect_to root_url, alert:\"不正なアクセスです。\"\n end\n end",
"def add_recipe(recipe)\n raise \"[#{self}] duplicate recipe #{recipe.recipe_id} defined.\" if @recipes.has_key?(recipe.recipe_id)\n\n @recipes[recipe.recipe_id] = recipe\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingredient_logic(ingredient)\n if all_ingredients.include?(ingredient)\n new_recipe_ingredient = ingredient_instance(ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n else\n new_recipe_ingredient = Ingredient.create(name: ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n end\n end",
"def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"def create\n recipe = Recipe.find(params[:id])\n @favorite = current_user.add_to_favorite(recipe.id)\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to :back, notice: 'Favorite was successfully created.' }\n format.json { render :show, status: :created, location: @favorite }\n else\n format.html { render :new }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n load_recipe(@current_user)\n# new_recipe = @current_user.recipes.build(params[:recipe])\n if params[:recipe][:privacy].nil?\n params[:recipe][:privacy] = @recipe.privacy\n end\n # for love recipes\n current_roles = @recipe.roles || ''\n if (params[:recipe][:privacy] == '10' && params[:recipe][:from_type] == '1' && @recipe.is_draft == '0' && time_iso_format(@recipe.published_at) >= '2009-08-01 00:00:00')\n unless(current_roles.include?('21'))\n params[:recipe][:roles] = '21 ' + current_roles\n#### begin\n#### CACHE.delete('overview_love_recipes_set')\n#### CACHE.delete('overview_love_users_set')\n#### rescue Memcached::NotFound\n#### end\n end\n else\n if(current_roles.include?('21'))\n params[:recipe][:roles] = current_roles.gsub('21', '')\n#### begin\n#### CACHE.delete('overview_love_recipes_set')\n#### CACHE.delete('overview_love_users_set')\n#### rescue Memcached::NotFound\n#### end\n end\n end\n # end\n \n new_recipe = @recipe.user.recipes.build(params[:recipe])\n # new_recipe.cover_photo_id = @recipe.cover_photo_id\n # new_recipe.published_at = @recipe.published_at\n # new_recipe.status = new_recipe.get_status\n # new_recipe.is_draft = new_recipe.get_is_draft\n # new_recipe.published_at = new_recipe.get_published_at\n \n # params[:recipe][:status] = new_recipe.status\n # params[:recipe][:is_draft] = new_recipe.is_draft\n # params[:recipe][:published_at] = new_recipe.published_at\n params[:recipe][:original_updated_at] = Time.now if @recipe.user == @current_user\n params[:recipe][:status] = new_recipe.get_status\n\t\t\n\t\tset_tag_list\n \n ActiveRecord::Base.transaction do\n\t\t if @recipe.update_attributes(params[:recipe])\n\t\t \t# @recipe.tag_list = params[:tags].strip if params[:tags] && params[:tags].strip != @recipe.tag_list\n\t\t\t\treg_homepage(@recipe, 'update')\n#### begin\n#### CACHE.delete('overview_recipes_set')\n#### CACHE.delete('overview_tags_set')\n#### rescue Memcached::NotFound\n#### end\n\t\t\t\tafter_update_ok\n\t\t else\n\t\t\t\tafter_update_error\n\t\t end\n\t end\n end",
"def create\n\t\tif Recipe.find_by({api_id: params[:api_id]})\n\t\t\tflash[:error] = \"Recipe '#{params[:name]}' already exists in your saved recipes.\"\n\t\telse\n\t\t\t@recipe = Recipe.new(recipe_params)\n\t\t\tif @recipe.save\n\t\t\t\tids = params[:inventories].split(\",\")\n\t\t\t\tfor index in 0...ids.length\n\t\t\t\t\t@recipe.inventories << Inventory.where({id: ids[index].to_i})\n\t\t\t\tend\n\n\t\t\t\trender json: @recipe\n\t\t\telse\n\t\t\t\trender status: 400, nothing: true\n\t\t\tend\n\t\tend\n\tend",
"def set_up_user\n\n # TRANSACTION??\n\n #Deleting all notebooks for the user also deletes all their notes\n Notebook.destroy_all(author_id: self.id)\n\n new_notebook = Notebook.create!(author_id: self.id, title:\"First Notebook\")\n\n # Create extra note giving them instructions on Twitter features\n if self.provider == \"twitter\"\n Note.create!(author_id: self.id,\n title: \"Twitter Instructions\",\n body: \"Thank you for creating an account using Twitter! \" +\n \"As a Twitter user, you can post new tweets, and convert \" +\n \"notes into Tweets! To post a new tweet, click the Twitter \" +\n \"logo on the sidebar. To tweet a note, highlight the text of the note you want to tweet, \" +\n \"and click the Twitter logo on the toolbar. If no text is highlighted, \" +\n \"the first 140 characters will be used as the tweet. Happy tweeting!\",\n notebook_id: new_notebook.id)\n end\n\n Note.create!(author_id: self.id,\n title:\"Instructions\",\n body:\"Add a Note by clicking the plus sign in the top left. \" +\n \"Notes can be edited in the text editor, and deleted by clicking the garbage can\",\n notebook_id: new_notebook.id)\n\n Note.create!(author_id: self.id,\n title:\"Welcome to FeatherNote!\",\n body:\"FeatherNote allows you to store meaningful notes in order to simplify your life!\",\n notebook_id: new_notebook.id)\n\n end",
"def saved_recipe_params\n params.require(:saved_recipe).permit(:user_id, :recipe_id)\n end",
"def create\n @recipe = Recipe.new(recipe_params) #see method recipe_params\n\n if @recipe.save\n redirect_to @recipe #takes user back to the show recipe page after they have created a new recipe\n else\n flash[:recipe] = @recipe\n flash[:errors] = @recipe.errors.messages\n redirect_to new_recipe_path #new_recipe prefix from resources\n end\n end",
"def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end",
"def create\n @meal_recipe = MealRecipe.new(meal_recipe_params)\n \n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal = @meal_recipe.meal\n # @day = @meal.day\n @meal_ingredient = MealIngredient.new\n # @leftover = Leftover.user(current_user).includes(:meal_recipe)\n \n if @meal_recipe.recipe.present?\n @meal_recipe.portions = @meal_recipe.recipe.portions\n end\n\n respond_to do |format|\n \n if @meal_recipe.recipe.present? && @meal_recipe.save\n create_meal_ingredients_for_recipe(@meal_recipe)\n format.turbo_stream\n format.html { redirect_to @meal_plan, notice: \"Meal recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n else\n format.html { redirect_to @meal_plan, notice: \"Meal recipe not added, please select recipe from list\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n end\n end\n end",
"def create\n\t\t\t\trecipe = Recipe.new(recipe_params)\n\t\t\t\tingredients = params[:ingredients]\n\t\t\t\ttags = params[:tags]\n\t\t\t\t\n\t\t\t\tif recipe.save\n\t\t\t\t\tif !ingredients.blank?\n\t\t\t\t\t\tredirect_to api_v1_recipe_ingredients_url(recipe_id: recipe.id, ingredients: ingredients, tags: tags)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Recipe not saved', data: recipe.errors}, status: :unprocessable_entity\n\t\t\t\tend\n\t\t\tend",
"def create\n @chef = Chef.new(chef_params)\n if @chef.save\n flash[:success] = \"Your account is registered successfully\"\n #And we need to create a session\n session[:chef_id] = @chef.id\n redirect_to recipes_path\n else\n render 'new'\n end\n end",
"def add_new_client\n @role = Role.where(:role => 'Client').pluck(:id);\n @user = User.new\n end",
"def add_recipe\n recipe = Recipe.find_by_id(params[:id])\n\n recipe.ingredients.each do |ingredient|\n listItem = ingredient_to_list_item(ingredient)\n listItem.quantity = listItem.quantity.to_f * params[:scale].to_f #if something has been scaled\n\n if logged_in?\n listItem.user = current_user\n listItem.save\n else\n session[:list_items] ||= {id: 0}\n listItem.id = session[:list_items][:id]\n session[:list_items][listItem.id] = listItem\n session[:list_items][:id] += 1\n end\n end\n\n respond_to do |format|\n format.html do\n redirect_to :shopping_list\n end\n format.json do\n render json: true\n end\n end\n end",
"def create_recipe_profile(recipe_object)\n taste_profile = RecipeTasteProfile.create!(taste_counts(recipe_object))\n taste_profile.update_attributes(recipe_id: recipe_object.id)\n return taste_profile\n end",
"def create\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.save_recipe_to_db(aws_params)\n msg = {:notice => \"Recipe created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:user_id, :title, :description, :cook_time, :recipe_img, :tag_list,\n ingredients_attributes: [:id, :recipe_id, :name, :quantity, :_destroy],\n steps_attributes: [:id, :recipe_id, :step_number, :description, :step_img, :_destroy])\n end",
"def update_users_ingredients(ingredient_name_or_id, attributes)\n ingr = Ingredient.find_or_create_by_name_or_id(ingredient_name_or_id, self.kitchen_id)\n return nil if ingr.nil?\n\n user_ingr = users_ingredients.find_by_ingredient_id(ingr.id)\n if user_ingr.nil?\n user_ingr = users_ingredients.create(:ingredient_id => ingr.id)\n end\n user_ingr.update_attributes!(attributes)\n return user_ingr\n end"
] |
[
"0.7460179",
"0.7274224",
"0.7256458",
"0.7131675",
"0.7107879",
"0.70410264",
"0.6984449",
"0.69218016",
"0.6892945",
"0.68910486",
"0.6879346",
"0.6873885",
"0.68526244",
"0.6821334",
"0.68186754",
"0.6794784",
"0.6785803",
"0.67701733",
"0.67528045",
"0.67021084",
"0.669371",
"0.66791475",
"0.66655016",
"0.6593765",
"0.6485532",
"0.6485532",
"0.6475514",
"0.6448593",
"0.64460266",
"0.6425679",
"0.6417091",
"0.6389963",
"0.63809675",
"0.6379909",
"0.63455015",
"0.63365954",
"0.63221645",
"0.63145167",
"0.63025784",
"0.62935865",
"0.6278505",
"0.6273497",
"0.6261268",
"0.6257173",
"0.6256349",
"0.620198",
"0.6200568",
"0.61667985",
"0.61636895",
"0.6141374",
"0.6120188",
"0.61179256",
"0.60665005",
"0.60616136",
"0.6051115",
"0.60494596",
"0.60265404",
"0.6018331",
"0.59975237",
"0.5980896",
"0.59673834",
"0.59582853",
"0.5956648",
"0.5941749",
"0.5910908",
"0.5910663",
"0.58982885",
"0.58951986",
"0.58905953",
"0.5882707",
"0.58798754",
"0.5868423",
"0.5838928",
"0.58355075",
"0.5835018",
"0.5799634",
"0.5796153",
"0.5793082",
"0.5788263",
"0.5782122",
"0.57609046",
"0.5759573",
"0.5757319",
"0.5750993",
"0.5705359",
"0.56802094",
"0.56728053",
"0.56695455",
"0.5661674",
"0.56535417",
"0.5651994",
"0.56515646",
"0.5649716",
"0.56445056",
"0.5643004",
"0.56338453",
"0.5624521",
"0.5615812",
"0.5612939",
"0.5607558",
"0.56021065"
] |
0.0
|
-1
|
Show news content + 2 GT links "next" and "previous"
|
def show
@news = News.find(params[:id])
@next = News.where("publication_date <= ? AND id != ?", @news.publication_date, @news.id).order("publication_date DESC").first;
@previous = News.where("publication_date >= ? AND id != ?", @news.publication_date, @news.id).order("publication_date DESC").last;
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @previous_blog = @blog.previous\n @next_blog = @blog.next\n end",
"def publish_front_page\n\t\tfirst = (@current_page - 1) * 3\n\t\tlast = (first + 3) - 1\n\t\tpage = first..last\n\t\t@post[page].each do |each_post|\n\t\t\tputs \"#{each_post.title} #{each_post.date}\"\n\t\t\tputs \"#{each_post.text}\"\n\t\t\tputs \"------------------------------------\" \n\t\tend\n\t \tputs \"next >\"\n\tend",
"def next_and_previous_links_listitems(work, chapter)\n links = next_and_previous_links(work, chapter)\n links.collect {|link| \"<li>\" + link + \"</li>\\n\"}\n end",
"def top_news_sources\n\n end",
"def next_page\n # The only difference from the default here is we renamed the link to \"More\"\n # and added a custom class, twitter_pagination\n previous_or_next_page(@collection.next_page, '<div class=\"hover-move\"><img src=\"assets/next.png\" alt=\"next\"/></div><img src=\"assets/barre.png\"/>', 'next_pagination') if @collection.next_page\n end",
"def show_pagination\n previous_link = ''\n next_link = ''\n page_num_links = ''\n\n if show_current_page > 1\n previous_page = show_current_page - 1\n previous_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{previous_page.to_s})\") + '\">« Previous</a></li>'\n else\n previous_link = '<li class=\"disabled\"><a href=\"\">« Previous</a></li>'\n end\n\n if (show_current_page * show_results_per_page) < show_total_hits\n next_page = show_current_page + 1\n next_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{next_page.to_s})\") +'\">Next »</a></li>'\n else\n next_link = '<li class=\"disabled\"><a href=\"\">Next »</a></li>'\n end\n\n if show_current_page >= 4\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(1)\") + '\">1</a></li>'\n end\n if show_current_page >= 5\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n # show links to the two pages the the left and right (where applicable)\n bottom_page = show_current_page - 2\n if bottom_page <= 0\n bottom_page = 1\n end\n top_page = show_current_page + 2\n if top_page >= show_total_pages\n top_page = show_total_pages\n end\n (bottom_page..top_page).each do |i|\n unless i == show_current_page\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{i.to_s})\") + '\">' + i.to_s + '</a></li>'\n else\n page_num_links << '<li class=\"disabled\"><a href=\"\">' + i.to_s + '</a></li>'\n end\n end\n\n if show_total_pages >= (show_current_page + 3)\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n pagination_links = previous_link + next_link + page_num_links\n return pagination_links.html_safe\n end",
"def next_page; link 'next' end",
"def next_and_previous_links(work, chapter)\n if logged_in? && current_user.is_author_of?(work)\n number_of_chapters = work.chapters.in_order.size \n chapter_position = work.chapters.in_order.index(chapter)\n else\n number_of_chapters = work.chapters.posted.in_order.size \n chapter_position = work.chapters.posted.in_order.index(chapter)\n end\n links = []\n \n links << link_to_chapter(\"First Chapter\", work, 0)\n links << (chapter_position == 0 ? \n \"Previous Chapter\" : \n link_to_chapter(\"Previous Chapter\", work, chapter_position-1))\n links << (chapter_position == (number_of_chapters - 1) ? \n \"Next Chapter\" : \n link_to_chapter(\"Next Chapter\", work, chapter_position+1))\n links << link_to_chapter(\"Last Chapter\", work, number_of_chapters-1)\n end",
"def show\n @next_artwork = get_next\n @previous_artwork = get_previous\n @fbLink = \"http://helenafogelberg.se/artworks/{@artwork.id}\"\n end",
"def view_last_news_helper\n out = ''\n @news = Newse.joins(:city).where('cities.subdomain' => request.subdomain).order('created_at desc').limit(8)\n if !@news.empty?\n @news.each do |news|\n out += \"<li>\"\n out += \"<em class='date'>#{news.created_at}</em>\"\n out += \"#{link_to news.name, {:controller => :tidings, :action=>:show, :id => news.id, :subdomain => request.subdomain}}\"\n out += \"</li>\"\n end\n else\n out += \"<li>Извините, новостей не добавлено!\"\n out += \"</li>\"\n end\n out.html_safe\n end",
"def show\n @story = Story.includes(:comments).find(params[:id])\n @next = ((@story == Story.last) ? Story : Story.where(['id > ?', params[:id]])).where(:aprooved => true).first.id\n @prev = ((@story == Story.first) ? Story : Story.where(['id < ?', params[:id]])).where(:aprooved => true).last.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def next_page\n @page.link_with(:text => /Next/)\n end",
"def get_next_page\n nextlink = @doc.search(\"//p[@class='nextprev']/a[@rel='nofollow next']\")\n nextlink.map! { |link| \"#{link['href']}\" }\n stringlink = nextlink[0]\n @doc = open(stringlink) { |f| Hpricot(f) }\n get_links\n end",
"def index\n limit = 3\n @articles = Article.published.order('published_at DESC').limit(limit+1).all\n\n if @articles.size == limit+1\n @articles.pop\n @show_more_link = true\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n extract_nxt_prv(@article)\n end",
"def show\n # @article = Article.find_by_id(params[:id])\n # @prev_article = @article.previous == nil ? 0 : @article.previous\n # @next_article = @article.next == nil ? 0 : @article.next\n # @comments = @article.comment_threads.all\n # @teams = Team.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viewer }\n end\n end",
"def index\n # => @news = News.aktiv\n @news = News.aktiv.page(params[:page]).per(Strangecms::Newz::Config[:news_per_page])\n @title = @seite.use_titel ? @seite.titel : @seite.name\n @headline = @seite.use_headline ? @seite.headline : @seite.name\n @paginator_needed = (News.aktiv.count > Strangecms::Newz::Config[:news_per_page]) ? true : false\n render :template => 'base/seite'\n end",
"def index\n @numberOfItem = 8\n @pageNumber = 1\n if params.has_key?(:p)\n @pageNumber = params[\"p\"].to_f\n end\n @lastPage = New.all.length / @numberOfItem + 1\n if @pageNumber == @lastPage\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(New.all.length - (@pageNumber-1)*@numberOfItem)\n else\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(@numberOfItem) \n end\n end",
"def previous\n @news_item = @news_item.previous_version\n show\n end",
"def links_feed\n end",
"def latest_topics_rss\r\n @title = \"The Latest Discussions\"\r\n @topics = Topic.paginate_all(20, @cobrand)\r\n render :template => \"common/topics_rss\", :layout => false\r\n end",
"def show\n @author = Author.find(params[:id])\n\n @all_articles = @author.articles.joins(:views, :content_source).where([\"article_age = ? AND content_sources.code != ?\", 30,\"R\"])\n\n @non_inews = @all_articles.joins(:content_source).where([\"content_sources.code = ? AND site_id != ?\",\"I\",1])\n @inews = @all_articles.internet_news\n\n @top_articles = @all_articles.joins(:views).where([\"article_age = ?\",30]).order(\"pageviews DESC\").limit(10)\n @bottom_articles = @all_articles.joins(:views).order(\"pageviews ASC\").limit(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author }\n end\n\n\n\n\n\n\n end",
"def index\n @news = News.page(params[:page]).per(6)\n @page_title = \"LAschool news\"\n end",
"def prev; pager.page(page - 1); end",
"def news_to_html(news)\n return H.article(:class => \"deleted\") {\n \"[deleted news]\"\n } if news.del\n domain = news.domain\n news = {}.merge(news.to_h) # Copy the object so we can modify it as we wish.\n news[\"url\"] = \"/news/#{news[\"id\"]}\" if !domain\n upclass = \"uparrow\"\n downclass = \"downarrow\"\n if news[\"voted\"] == :up\n upclass << \" voted\"\n downclass << \" disabled\"\n elsif news[\"voted\"] == :down\n downclass << \" voted\"\n upclass << \" disabled\"\n end\n H.article(\"data-news-id\" => news[\"id\"], \"data-type\" => news['type']) {\n H.a(:href => \"#up\", :class => upclass) {\n \"▲\"\n }+\" \"+\n H.h2 {\n H.a(:href=>news[\"url\"], :rel => \"nofollow\") {\n H.entities news[\"title\"]\n }\n }+\" \"+\n H.address {\n if domain\n \"at \"+H.entities(domain)\n else \"\" end +\n if news['category_id'] && (category = Category.find(news['category_id']))\n category_code = category.code\n H.a(href: \"/f/#{category_code}\") { category_code }\n else \"\" end +\n if ($user and $user.id.to_i == news['user_id'].to_i and\n news['ctime'].to_i > (Time.now.to_i - NewsEditTime))\n \" \" + H.a(:href => \"/editnews/#{news[\"id\"]}\") {\n \"[edit]\"\n }\n else \"\" end\n }+\n H.a(:href => \"#down\", :class => downclass) {\n \"▼\"\n }+\n H.p {\n H.span(:class => :upvotes) { news[\"up\"] } + \" up and \" +\n H.span(:class => :downvotes) { news[\"down\"] } + \" down, posted by \" +\n H.username {\n H.a(:href=>\"/user/\"+URI.encode(news[\"user_email\"])) {\n H.entities news[\"user_email\"]\n }\n }+\" \"+str_elapsed(news[\"ctime\"].to_i)+\" \"+\n H.a(:href => \"/news/#{news[\"id\"]}\") {\n comments_number = news[\"comments\"].to_i\n if comments_number != 0\n \"#{news[\"comments\"] + ' comment'}\" + \"#{'s' if comments_number>1}\"\n else\n \"discuss\"\n end\n }+\n if $user and user_is_admin?($user)\n \" - \"+H.a(:href => \"/editnews/#{news[\"id\"]}\") { \"edit\" }+\" - \"+H.a(:href => \"http://twitter.com/intent/tweet?url=#{SiteUrl}/news/#{news[\"id\"]}&text=\"+URI.encode(news[\"title\"])+\" - \") { \"tweet\" }\n else \"\" end\n }+\n if params and params[:debug] and $user and user_is_admin?($user)\n \"id: \"+news[\"id\"].to_s+\" \"+\n \"score: \"+news[\"score\"].to_s+\" \"+\n \"rank: \"+compute_news_rank(news).to_s+\" \"+\n \"zset_rank: \"+$r.zscore(\"news.top\",news[\"id\"]).to_s\n else \"\" end\n }+\"\\n\"\nend",
"def index\n build_breadcrumbs\n @news = collection\n end",
"def news_links\n visit \"http://hk.apple.nextmedia.com/\"\n\n links = doc.css(\"#article_ddl option\").collect do |option|\n link = Link.new\n link.title = option.text\n link.url = option[\"value\"]\n link\n end.reject { |l| l.url.nil? }\n links\n end",
"def show\n @article = Article.find(params[:id]) rescue (return redirect_to(root_path))\n @previous_id = Article.where(\"category_id = ? AND id > ?\", \n @article.category_id, @article.id)\n .where(:published => true).minimum(:id)\n @next_id = Article.where(\"category_id = ? AND id < ?\",\n @article.category_id, @article.id)\n .where(:published => true).maximum(:id)\n\n if @article.category_id != nil\n @recommend_articles = Article.where(:category_id => @article.category_id)\n .where(:published => true)\n .where('id <> ?', @article.id)\n .order(Settings.random_query)\n .first(12)\n else\n @recommend_articles = Article.where(:published => true)\n .where('id <> ?', @article.id)\n .order(Settings.random_query)\n .first(12)\n end\n @pages = @article.sorted_pages\n params[:category] = @article.category_id\n @cat_id = @article.category.parent_id || @article.category.id\n end",
"def show\n @page_title = @news.title\n @page_description = @news.description\n end",
"def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end",
"def news\n do_scrape\n @posts = UbuEntry.all(:order => \"id DESC\", :limit => 400)\n render :layout => false, :content_type => Mime::RSS\n end",
"def navlistbar_news_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/news/\").a.innerText(\"/News/\"), __method__)\n end",
"def setup_next_and_previous_documents\n if current_search_session_from_browse_category?\n setup_next_and_previous_documents_from_browse_category if current_browse_category\n elsif current_search_session_from_page? || current_search_session_from_home_page?\n # TODO: figure out how to construct previous/next documents\n else\n super\n end\n end",
"def setup_next_and_previous_documents\n if current_search_session_from_browse_category?\n setup_next_and_previous_documents_from_browse_category if current_browse_category\n elsif current_search_session_from_page? || current_search_session_from_home_page?\n # TODO: figure out how to construct previous/next documents\n else\n super\n end\n end",
"def normal_news_link\n normal_link(\"news_#{@news.news_type}\") if @news\n\tend",
"def list_items(o)\n aux = \"\"\n o[:start] = 0 if o[:start] < 0\n items,count = o[:get].call(o[:start],o[:perpage])\n items.each{|n|\n aux << o[:render].call(n)\n }\n last_displayed = o[:start]+o[:perpage]\n if last_displayed < count\n nextpage = o[:link].sub(\"$\",\n (o[:start]+o[:perpage]).to_s)\n aux << H.a(:href => nextpage,:class=> \"more\") {\"[more]\"}\n end\n aux\nend",
"def navigation_buttons(next_url)\n options = {\n :'data-role' => \"controlgroup\",\n :'data-type' => \"horizontal\",\n :class => \"chart-navigation\"\n }\n content_tag(:div, link_to_previous + link_to_next(next_url), options)\n end",
"def show\n @update = Update.with_preloads.where(permalink: params[:id]).take!\n @previous = Update.where('created_at < ?', @update.created_at).order('created_at DESC').first\n @next = Update.where('created_at > ?', @update.created_at).order('created_at ASC').first\n @page_title = @update.title\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @update }\n end\n end",
"def newsfeed_feed_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\").a.at(0).innerText(\"/the feed/\"), __method__)\n end",
"def show\n @news = News.find(params[:id])\n fresh_when(:etag => [@news])\n \n drop_breadcrumb(\"价值微信\", news_index_path)\n drop_breadcrumb(\"查看\")\n end",
"def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end",
"def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\nend",
"def show\n articleId = params[:id]\n @hasNext = (articleId != getNext(articleId))\n @hasPrevious = (articleId != getPrevious(articleId))\n end",
"def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend",
"def next_comic\r\n \tif sorted_articles.index(item) == 0\r\n\t\t\t# apply the inactive html and css\r\n\t\t\t'<h7 id=\"next-comic\" title=\"This is the most recent comic.\" class=\"comic-viewer-inactive\">next ▸</h7>'\r\n\t\telse\r\n\t\t\tnxt = sorted_articles.index(item) - 1\r\n\t\t\tlink_to('next ▸', sorted_articles[nxt].reps[0], :id => \"next-comic\", :title => \"View the next comic.\")\r\n\t\tend\r\n end",
"def index\n @collection = News.federal.page_for_visitors current_page\n end",
"def getFirst\n first = \"\" \n if (@currentPage.to_i > 2)\n first = \"<a href=\\\"/pubmed/searchPubmed?method=get&term=#{@keywords}&page=1&resultsPerPage=#{@resultsPerPage}\\\" class=\\\"prev_page\\\">| « First</a>\"\n end \n first\n end",
"def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end",
"def index\n @news_feeds = NewsFeed.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def show\n @blogs = Blog.all.includes(:categorium, :user).where.not(id: @blog.id).order('created_at DESC')\n @previous = @blogs.where(\"id < ?\", @blog.id).last\n @next = @blogs.where(\"id > ?\", @blog.id).first\n @relacionados = @blogs.limit(3)\n @popular = @blogs.limit(4)\n @title = @blog.seo_title\n @meta = @blog.seo_meta\n @image_facebook = @blog.attachment.url\n end",
"def pagination_links(objects, count = 100)\n will_paginate(objects, {\n :per_page => count,\n :next_label => _('Next') + ' »', \n :prev_label => '« ' + _('Previous')\n })\n end",
"def index\n @news = News.all.last_created.paginate(:page => params[:page], :per_page => 15)\n fresh_when(:etag => [@news])\n drop_breadcrumb(\"价值微信\")\n end",
"def news(url)\n visit url\n\n document = Document.new\n document.source = name\n document.title = doc.search(\"#articleContent h1\").text.strip\n document.url = url\n document.html = html\n document.content = page.evaluate_script(\"HongKongNews.getInnerText('#masterContent')\")\n document.image_url = doc.search(\"//meta[@property='og:image']/@content\").first.text rescue nil\n document\n end",
"def page_link1(page, text, attributes = {})\n @template.link_to_remote(text, { \n :url => url_for(page).sub(/(\\w+)\\/[^\\?]+\\?/, \"\\\\1?\"),\n :method => :get,\n :loading => \"$('paging').show()\",\n :success => \"$('paging').hide()\"\n }.merge(@remote))\n end",
"def links; end",
"def links; end",
"def prev_page\n\t\t\tFeed.parse_url(prev_page_url,@browser)\n\t\tend",
"def get_next_article(url)\n uri = URI(URI::Parser.new.escape(url))\n response = Net::HTTP.get(uri)\n\n doc = Nokogiri::HTML.parse(response)\n\n #article = doc.at('a:contains(\"Article suivant\")')\n article = doc.at('a:contains(\"Nächster Artikel\")')\n article['href']\nend",
"def list_items(o)\n aux = \"\"\n o[:start] = 0 if o[:start] < 0\n items,count = o[:get].call(o[:start],o[:perpage])\n items.each{|n|\n aux << o[:render].call(n)\n }\n last_displayed = o[:start]+o[:perpage]\n if last_displayed < count\n nextpage = o[:link].sub(\"$\",\n (o[:start]+o[:perpage]).to_s)\n aux << H.a(:href => nextpage,:class=> \"more\") {\"[more]\"}\n end\n aux\n end",
"def links\n construct_html(self.items)\n end",
"def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend",
"def index\n @news = New.order('created_at DESC').page params[:page]\n end",
"def news_recent_link\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/ctl00_content_newsPage_fragment_15369_ctl01_ctl00_delayer_ctl01_btnSortByMostRecent/\"), __method__)\n end",
"def next_page; end",
"def index\n \t#display text and links \n end",
"def show_more\n if params[:tab_type]\n # get articles of selected tab\n get_tab_articles\n # generate show more lind for selected tab\n @more_link_path = more_articles_path(tab_type: params[:tab_type], page: @articles.next_page)\n elsif params[:articles_type] == Article::List::Type::SEARCH\n # get rest of search result\n search\n elsif params[:articles_type] == Article::List::Type::TAG\n articles_by_tag\n elsif params[:articles_type]\n # get user's articles\n get_user_articles\n if params[:articles_type] != Article::List::Type::SEARCH\n # generate show more link for selected user's articles\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: params[:articles_type])\n end\n end\n end",
"def index\n @newsletters = Newsletter.order( created_at: :desc )\n\n set_meta_tags og: {\n title: '뉴스레터',\n description: \"1주간의 루비와 레일스 관련기사를 공개 모집하여 발송하는 신개념의 뉴스레터\",\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('newsletter.png'),\n url: newsletters_url\n }, title: '뉴스레터'\n\n end",
"def show\n @post = Post.find(params[:id])\n\n #TODO:前後の記事へのポインタ\n all=Post.all\n index=all.rindex(@post)\n if index!=0 \n @prev_id=all[index-1].id\n @prev_title=all[index-1].title\n end\n if index+1 != all.count \n @next_id=all[index+1].id \n @next_title=all[index+1].title\n end\n\n @enabled_article_js = cookies[:enabled_article_js]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def next_page\n @links['next']\n end",
"def previous_posts_link( label = nil )\n get_previous_posts_link( label )\n end",
"def show\n\t@id = params[:id]\n\t@posts = Post.all\n\tif params[:id].to_i != @posts.length\n\t\tnext_id = (params[:id].to_i + 1).to_s\n\telse\n\t\tnext_id = params[:id]\n\tend\n\tif params[:id].to_i != 1\n\t\tprev_id = (params[:id].to_i - 1).to_s\n\telse\n\t\tprev_id = params[:id]\n\tend\n\t\n\t@title=Post.find(params[:id]).title\n\t@metadescription = Post.find(params[:id]).title\n\t\n\t@previous_post = Post.find(prev_id)\n @post = Post.find(params[:id])\n\t@next_post = Post.find(next_id)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def neat_pages_navigation(options={})\n NeatPages::Helpers::Navigation.new(pagination, request).generate\n end",
"def create_front_page_paginada\n\t\tsystem 'clear'\n\t\t@num_pages = @post_list2.length\n\t\t@post_list2[(\"#{@position}\").to_i].each_with_index do |post,index|\n\t\t\t\n\t\t\t\tif post.sponsored == true\n\t\t\t\t\tputs \"*****Post #{post.title} #{index}*****\"\n\t\t\t\telse\n\t\t\t\t\tputs \"Post #{post.title} #{index}\"\n\t\t\t\tend\n\t\t\t\tputs \"#{post.text}\"\n\t\t\t\tputs \"#{post.creation_date}\"\n\t\t\t\tputs \"-----------------------\"\n\t\tend\t\t\n\n\t\tif @position > 0 && @position < @num_pages\n\t\t\tback_pages = (1..@position).to_a\n\t\t\tputs \"back\"\n\t\t\tback_pages.each { |pg| puts pg}\t\t\n\t\tend\n\t\tif @position < (@num_pages - 1)\n\t\t\tnext_pages = (@position+2..@num_pages).to_a\n\t\t\tputs \"next\"\n\t\t\tnext_pages.each { |pg| print \"#{pg} \" }\n\t\tend\n\n\t\t\tanswer = gets.chomp\n\t\t\tif answer == \"back\" && @position != 0\n\t\t\t\t@position-=1\n\t\t\t\tcreate_front_page_paginada\n\t\t\telsif answer == \"back\" && @position == 0\n\t\t\t\tcreate_front_page_paginada\n\n\t\t\telsif answer == \"next\" && @position == @num_pages-1\n\t\t\t\tcreate_front_page_paginada\n\t\t\telsif answer == \"next\" && @position != @num_pages-1\n\t\t\t\t@position+=1\n\t\t\t\tcreate_front_page_paginada\n\t\t\telse\n\t\t\t\tputs \"ERROR --> ENTER VALID ANSWER\"\n\t\t\t\tcreate_front_page_paginada\n\t\t\tend\n\tend",
"def show\n @entries = @slideshow.entries.recent.limit(12)\n\n @active_feeds = @slideshow.feeds.order(title: :asc)\n @available_feeds = Feed.where.not(id: @slideshow.feed_ids).order(title: :asc)\n end",
"def show\n\n set_meta_tags og: {\n title: @newsletter.title,\n description: truncate(@newsletter.greeting, :length => 300, :separator => /\\w/, :omission => \"…\"),\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('newsletter.png'),\n url: preview_newsletter_url(@newsletter)\n }, title: @newsletter.title\n\n end",
"def news(options = { results: 1 })\n response = get_response(results: options[:results], name: @name)\n\n response[:news].collect do |b|\n Blog.new(name: b[:name], site: b[:site], url: b[:url])\n end\n end",
"def index\n @torrent_links = TorrentLink.all\n @title = 'Обзор торрент ссылок'\n end",
"def pagination_links(pager)\n links = Array.new\n links.push(link_to \"prev\", pager.prev_page, remote: true) if pager.after_start\n links.push(link_to \"next\", pager.next_page, remote: true) if pager.before_end\n raw \"#{pager.sequence} of #{pluralize(pager.total, \"match\")}#{links.size > 0 ? \": \" : \"\"}#{links.join(\", \")}\"\n end",
"def display_news\n system(\"clear\")\n puts \"\\n Daily Prophet News\"\n\n news= News.items\n\n puts \"\\n\"\n \n news.each.with_index(1) do |news_item, index|\n puts \"#{index}. #{news_item.title} - #{news_item.date}\"\n end\n\n read_news \n end",
"def showData\n $page = $page +\n \"<dl>\\n\" +\n \" <dt>events\\n\" +\n \" <dd>\" + $events + \"\\n\" +\n \"</dl>\\n\"\nend",
"def index\n\n @upcoming_events = Event.upcoming.paginate(page: params[:page])\n @upcoming_header = 'Upcoming Events'\n\n @prev_events = Event.prev.paginate(page: params[:page])\n @prev_header = 'Previous Events'\n \n end",
"def index\n @api_v1_news_links = Api::V1::NewsLink.all\n end",
"def create_nav_link(link_content, page, system, sort, current)\n if !current\n tag = \"<span class=\\\"page_link\\\">\"\n link = link_to_remote link_content.to_s, \n :url => paginate_url(:tags => @tags.join('+'), \n :media_to_search => @media_to_search.join('+'),\n :paginate_system => system,\n :per_page => 8,\n :sort_by => sort,\n :page => page.to_s),\n :html=> {:href => paginate_path(:tags => @tags.join('+'), \n :media_to_search => @media_to_search.join('+'),\n :paginate_system => system,\n :per_page => 8,\n :sort_by => sort,\n :page => page.to_s)}\n else \n tag = \"<span class=\\\"page_link_current\\\">\" \n link = link_content.to_s\n end\n tag << link\n tag << \"</span>\"\n tag\n end",
"def news_popular_link\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/ctl00_content_newsPage_fragment_15369_ctl01_ctl00_delayer_ctl01_btnSortByMostViewed/\"), __method__)\n end",
"def index\n # @entries = Entry.all\n days_ago = (params[:days_ago] || 0).to_i\n @entries = for_date_offset(days_ago)\n @_date = days_ago.days.ago.to_date\n\n @prev_link = view_context.link_to '<span class=\"tooltiptext\">Previous Day</span><i class=\"fa fa-calendar-minus-o\"></i>'.html_safe, entries_path(:days_ago => days_ago + 1)\n if (days_ago == 0)\n @today_link = view_context.link_to '<i class=\"fa fa-ban\"></i>'.html_safe, entries_path, {:class => \"disabled\"}\n else\n @today_link = view_context.link_to '<span class=\"tooltiptext\">Today</span><i class=\"fa fa-calendar-check-o\"></i>'.html_safe, entries_path\n end\n if (days_ago > 0)\n @next_link = view_context.link_to '<span class=\"tooltiptext\">Next Day</span><i class=\"fa fa-calendar-plus-o\"></i>'.html_safe, entries_path(:days_ago => days_ago - 1)\n else\n @next_link = view_context.link_to '<i class=\"fa fa-ban\"></i>'.html_safe, entries_path, {:class => \"disabled\"}\n end\n\n end",
"def show\n @post_test = PostTest.find(params[:id])\n @post = @post_test.post\n update_view_count(@post)\n posts_as = PostTest.with_school(@school)\n as_next = posts_as.nexts(@post_test.id).last\n as_prev = posts_as.previous(@post_test.id).first\n @next = as_next if as_next\n @prev = as_prev if as_prev\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post_test }\n end\n end",
"def show\n french_scenes = @french_scene.scene.act.play.french_scenes\n french_scenes = french_scenes.sort { |a, b| a.pretty_name <=> b.pretty_name }\n index = french_scenes.index { |fs| fs.id == @french_scene.id }\n\n @next = french_scenes[index + 1]\n if index > 0\n @previous = french_scenes[index-1]\n end\n end",
"def get_more\n @reserve = get_chain\n last_link = @reserve\n count = @page_size / 100\n count = 15 if count < 15\n while(count > 0)\n last_link = get_next_for(last_link)\n count -= 1\n end\n @next_object = get_next_for(last_link)\n set_next_for( last_link , nil )\n self\n end",
"def scrape_appended_links\n File.open('Vanguard News.txt', 'w') do |f|\n f.write Time.now.to_s + \"\\n\"\n @vanguard_links.each do |single_page|\n new_link = HTTParty.get(single_page)\n document = Nokogiri::HTML(new_link.body)\n stop_value_index = document.css('p').find_index { |p| p.text.include?(@stop_sign) }\n # pry.bindings\n f.write '*************************' + \"\\n\"\n f.write document.css('.entry-title').first.text.upcase + \"\\n\"\n f.write document.css('p')[1..(stop_value_index - 1)].text + \"\\n\"\n f.write '*************************' + \"\\n\"\n end\n end\n end",
"def index\n @sources = Source.listing\n\n respond_to do |format|\n format.html { @sources = @sources.paginate(page: params[:page], per_page: params[:per_page]) }\n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n yield :open_graph_tags \n \"#{yield(:title)} » \".html_safe if content_for?(:title) \n Calagator.title \n Calagator.tagline \n \"#{root_path}opensearch.xml\" \n Calagator.title \n stylesheet_link_tag 'application', :media => :all \n yield :css_insert \n javascript_include_tag *mapping_js_includes \n javascript_include_tag 'application' \n yield :javascript_insert \n auto_discovery_link_tag(:atom, events_url(:format => 'atom'), :title => 'Atom: All Events' )\n yield :discovery_insert \n image_path(\"site-icon.png\") \n \"#{controller.controller_name}_#{action_name}\" \n \"#{controller.controller_name}_controller\" \n %w[new create edit update].include?(action_name) ? \"#{controller.controller_name}_change\" : \"\" \n link_to Calagator.title, root_path, id: \"project_title\" \nlink_class[:events]\n link_to \"Events\", events_path \nlink_class[:venues]\n link_to \"Venues\", venues_path \n form_tag search_events_path, :method => :get do \n if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"].include?(\"Safari\") \n @query \n else \n text_field_tag 'query', @query, id: 'search_field', tabindex: 1 \n end \n end \n \n # Pick a subnav \n link_to 'Browse events', root_url,\n :class => subnav_class_for(\"site\", \"index\") \n link_to 'Add an event', new_event_url,\n :class => subnav_class_for(\"events\", \"new\") \n link_to 'Import events', new_source_url,\n :class => subnav_class_for(\"sources\", \"new\") \n \n link_to 'Browse venues', venues_url,\n :class => subnav_class_for(\"venues\", \"index\") \n link_to 'Add a venue', new_venue_url,\n :class => subnav_class_for(\"venues\", \"new\") \n \n \n \n render_flash \n for source in @sources \n cycle 'odd', 'even' \n link_to 'Show', source \n link_to 'Destroy', source, method: :delete, data: {confirm: 'Are you sure?' } \n source_url_link source \n end \n will_paginate @sources \n \n URI.parse(Calagator.url).host \n source_code_version \n \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n yield :open_graph_tags \n \"#{yield(:title)} » \".html_safe if content_for?(:title) \n Calagator.title \n Calagator.tagline \n \"#{root_path}opensearch.xml\" \n Calagator.title \n stylesheet_link_tag 'application', :media => :all \n yield :css_insert \n javascript_include_tag *mapping_js_includes \n javascript_include_tag 'application' \n yield :javascript_insert \n auto_discovery_link_tag(:atom, events_url(:format => 'atom'), :title => 'Atom: All Events' )\n yield :discovery_insert \n image_path(\"site-icon.png\") \n \"#{controller.controller_name}_#{action_name}\" \n \"#{controller.controller_name}_controller\" \n %w[new create edit update].include?(action_name) ? \"#{controller.controller_name}_change\" : \"\" \n link_to Calagator.title, root_path, id: \"project_title\" \nlink_class[:events]\n link_to \"Events\", events_path \nlink_class[:venues]\n link_to \"Venues\", venues_path \n form_tag search_events_path, :method => :get do \n if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"].include?(\"Safari\") \n @query \n else \n text_field_tag 'query', @query, id: 'search_field', tabindex: 1 \n end \n end \n \n # Pick a subnav \n link_to 'Browse events', root_url,\n :class => subnav_class_for(\"site\", \"index\") \n link_to 'Add an event', new_event_url,\n :class => subnav_class_for(\"events\", \"new\") \n link_to 'Import events', new_source_url,\n :class => subnav_class_for(\"sources\", \"new\") \n \n link_to 'Browse venues', venues_url,\n :class => subnav_class_for(\"venues\", \"index\") \n link_to 'Add a venue', new_venue_url,\n :class => subnav_class_for(\"venues\", \"new\") \n \n \n \n render_flash \n for source in @sources \n cycle 'odd', 'even' \n link_to 'Show', source \n link_to 'Destroy', source, method: :delete, data: {confirm: 'Are you sure?' } \n source_url_link source \n end \n will_paginate @sources \n \n URI.parse(Calagator.url).host \n source_code_version \n \n \n\nend\n\n end",
"def previous\n @link = @link.previous_version\n show\n end",
"def index\n @stories = @current_tag ? Story.tagged_with(@current_tag.name) : @current_channel.stories\n @stories = @stories.in_category(@current_category) if @current_category\n @stories = @stories.paginate(:page => params[:page], :per_page => 20)\n\n @feed_title = @current_category ? \"All #{@current_category.name} Stories \" : \"All Stories \"\n @feed_title += @current_tag ? \"Tagged with #{@current_tag.name}\" : \"in #{@current_channel.name} Channel\"\n\n @site_description += ',' + @stories.map(&:title).join(',')\n \n respond_to do |format|\n format.html\n format.atom do \n render :layout => false\n end\n end\n end",
"def navigation (sec)\n chap = sec.chapter\n cfname = name2fn chap.name\n res=\"\"\n next_ref=proc{|n| \"<a href =\\\"#{name2fn n.name}\\\">Next</a>\"}\n prev_ref=proc{|n| \"<a href =\\\"#{name2fn n.name}\\\">Previous</a> \"}\n if sec.secnum == 0\n res<< prev_ref[$chapters[chap.number-1]]unless chap.number==1\n res<< \"<a href = \\\"index.htm\\\">Up</a> \"\n res<< next_ref[$chapters[chap.number+1]]if $chapters[chap.number+1]\n else\n res<< prev_ref[chap.sections[sec.secnum-1]]unless sec.secnum == 1\n res<< \"<a href = \\\"#{cfname}\\\">Up</a> \"\n res<< \"<a href = \\\"index.htm\\\">Top</a> \"\n res<< next_ref[chap.sections[sec.secnum+1]]if chap.sections[sec.secnum+1]\n end\n res<< \"<BR><a href = \\\"theindex.htm\\\">Index</a>\\n\"\n res\nend",
"def link_to_previous_advanced_search(params)\n link_to(parseHistoryShowString(params), parseHistoryQueryString(params))\n end",
"def show_links\r\n links = Document.new(self).get_links\r\n puts \"There are #{links.length} links\"\r\n index = 1\r\n links.each do |l|\r\n puts \"link: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" href: #{l.href}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end",
"def index\n @news = News.order( :created_at => :desc ).page(params[:page])\n end",
"def index\n \t@news = News.all.paginate(page: params[:page], per_page: 5).order(:position, 'created_at DESC')\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n # @page_title=@post.title\n @images = @post.images.all\n @book = @post.book\n @back_url=session[:my_previous_url]\nend",
"def url\n return if article.nil?\n title = article.escaped_full_title\n \"#{wiki.base_url}/w/index.php?title=#{title}&diff=prev&oldid=#{mw_rev_id}\"\n end",
"def show\n @rssnew = Rssnews.find(params[:id])\n @rssnew.hit!\n redirect_norel @rssnew.link\n end"
] |
[
"0.64494765",
"0.63321674",
"0.6331142",
"0.6284424",
"0.6270019",
"0.6252723",
"0.6249508",
"0.62449545",
"0.6211686",
"0.619979",
"0.60810107",
"0.6050475",
"0.5995736",
"0.5990199",
"0.5949574",
"0.59228194",
"0.5919695",
"0.59050727",
"0.5903859",
"0.5888443",
"0.58654964",
"0.58444154",
"0.5833961",
"0.58311784",
"0.58148605",
"0.5793299",
"0.5788607",
"0.57848465",
"0.5774434",
"0.5773945",
"0.5773061",
"0.57645357",
"0.5752578",
"0.5752578",
"0.57447994",
"0.57286686",
"0.57276094",
"0.5727298",
"0.572098",
"0.572001",
"0.57108164",
"0.5701236",
"0.5700542",
"0.56967825",
"0.5687445",
"0.5665304",
"0.5646591",
"0.5644039",
"0.5640851",
"0.56377155",
"0.56358707",
"0.56303614",
"0.56243",
"0.5614554",
"0.560463",
"0.560463",
"0.56030685",
"0.5597766",
"0.55958694",
"0.55894715",
"0.556914",
"0.5564974",
"0.5561789",
"0.55584097",
"0.55567485",
"0.55412287",
"0.55367804",
"0.5532633",
"0.55315197",
"0.55309576",
"0.55289847",
"0.552528",
"0.551273",
"0.55106217",
"0.55103564",
"0.55031127",
"0.5496496",
"0.54924214",
"0.54895216",
"0.548866",
"0.54825854",
"0.54736793",
"0.5470977",
"0.54707414",
"0.54699326",
"0.5463624",
"0.5463316",
"0.54595935",
"0.54537016",
"0.54534835",
"0.54525226",
"0.54520386",
"0.5450304",
"0.54500574",
"0.54470205",
"0.54463744",
"0.54406446",
"0.5438993",
"0.5437852",
"0.5437248"
] |
0.6763704
|
0
|
Method to do basic validations like is this a valid file to even accept for any future transactions ==== Returns: true if the file is valid and false otherwise
|
def is_valid?
raise "Not Implemented. Class #{self.class.name} doesn't implement is_valid?"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_file(file)\n end",
"def valid?\n return false if @file_id.nil?\n true\n end",
"def validate_file(filename)\n return true\nend",
"def valid?\n ensure_file_open!\n\n ['Makefile', 'submission/', 'tests/'].all? { |entry| @file.find_entry(entry).present? }\n end",
"def should_validate?(_filename)\n raise NotImplementedError\n end",
"def attached_file_valid?\n return false if file.nil?\n file_attacher.validate\n file_attacher.errors.each { |e|\n errors.add(:file, :invalid, message: e)\n }.empty?\n end",
"def valid?\n File.exist?(fullpath)\n end",
"def valid?\n File.exist?(path) && File.readable?(path)\n end",
"def validate\n @errors = []\n methods.grep(/^validate_/).each { |m| method(m).call }\n @errors.each { |e| e.file = @file }\n valid?\n end",
"def valid_file\n\n filename = self.file.original_filename\n content_type = self.file.content_type\n\n #The upload should be nonempty.\n if filename == nil\n errors.add(:base, \"Please enter an image filename\")\n return false\n end\n\n #The upload should have file suffix.\n unless filename =~ /\\.(jpg)|(jpeg)|(png)|(gif)$/i\n errors.add(:base, \"Please use image file with a filename suffix\")\n return false\n end\n\n #The file should be an image file.\n unless content_type =~ /^image/\n errors.add(:content_type, \"is not a recognized format\")\n return false\n end\n return true\n end",
"def validate_input_files\n file_validation = FileValidation.new(input_files)\n raise_error(file_validation.errors) unless file_validation.files_exist? \n raise_error(file_validation.errors) unless file_validation.files_are_ascii?\n true\n end",
"def valid_file\n\n filename = self.file.original_filename\n content_type = self.file.content_type\n\n #The upload should be nonempty.\n if filename == nil\n errors.add_to_base(\"Please enter an image filename\")\n return false\n end\n\n #The upload should have file suffix\n unless filename =~ /\\.(jpg)|(jpeg)|(png)|(gif)$/i\n errors.add_to_base(\"Please use image file with a filename suffix\")\n return false\n end\n\n #The file should be an image file.\n unless content_type =~ /^image/\n errors.add(:content_type, \"is not a recognized format\")\n return false\n end\n return true\n end",
"def validFile? filename\n if !filename.kind_of? String\n return false\n elsif File.exists? filename\n return File.readable? filename\n else\n return false\n end\nend",
"def validate_file(file)\n if file.respond_to? :read\n src = file.read\n else\n src = read_local_file(file)\n end \n\n return validate_text(src)\n end",
"def valid_file?\n if @image.size.zero?\n errors.add_to_base(\"Please enter an image filename\")\n return false\n end\n unless @image.content_type =~ /^image/\n errors.add(:image, \"is not a recognized format\")\n return false\n end\n if @image.size > 1.megabyte\n errors.add(:image, \"can't be bigger than 1 megabyte\")\n return false\n end\n return true\n end",
"def valid_file\n @file.present? && @file.content_type == 'text/csv'\n end",
"def file_valid?(file)\n mime = MIME::Types.type_for(file).first\n !mime.nil? && ACCEPTED_MIMES.include?(mime.content_type)\n end",
"def validate_file(file_path)\n if file_path.respond_to? :read\n src = file_path.read\n else\n src = read_local_file(file_path)\n end \n # we force the :post mode otherwise it fails for\n # big files\n return validate_text(src, :post)\n end",
"def validates?\n doc = Nokogiri::XML(File.read(@filename))\n\n schema_version = PROIEL::PROIELXML::Schema.check_schema_version_of_xml_file(@filename)\n\n schema = PROIEL::PROIELXML::Schema.load_proiel_xml_schema(schema_version)\n r = schema.validate(doc)\n\n if r.empty?\n true\n else\n @errors += r.map { |e| \"Line #{e.line}: #{e.message}\" }\n\n false\n end\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"connector.FileMessage\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"connector.FileMessage\"])\n return false unless object_type_validator.valid?(@object_type)\n msg_type_validator = EnumAttributeValidator.new('String', [\"OpenFile\", \"FileContent\", \"CloseFile\", \"DeleteFile\", \"ListDir\", \"\", \"PopulateRemoteTemplateFile\", \"GetFreeSpace\"])\n return false unless msg_type_validator.valid?(@msg_type)\n true\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"DOCUMENT\", \"FAX\", \"RECORDING\"]\n if @system_type && !allowed_values.include?(@system_type)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"SINGLE_PUT\", \"MULTIPART_POST\"]\n if @upload_method && !allowed_values.include?(@upload_method)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"NONE\", \"LIMITED\", \"PUBLIC\"]\n if @sharing_status && !allowed_values.include?(@sharing_status)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def filecheck\n return file.nil? ? false : File.exist?(file)\n end",
"def valid_file?(file,type)\n\tif type == \"csv\"\n\t\tif file.nil?\n\t\t\tputs \"Please provide a source .csv file\"\n\t\t\texit 0\n\t\tend\n\tend\n\tif !File.exists?(file)\n\t\tputs \"#{file} doesn't seem to exist. Please check\\nyour file path and try again.\"\n\t\texit 0\n\tend\n\ttrue\nend",
"def validate\n @files.each {|fn| check_file fn}\n end",
"def validate_file(file_path)\n if file_path.respond_to? :read\n src = file_path.read\n else\n src = read_local_file(file_path)\n end\n return validate_text(src)\n end",
"def validate_file_input\n if params[:input_data].present?\n check_format(params[:input_data])\n else\n\t\t\traise_error NO_FILE_PROVIDED\n\t\tend\n end",
"def validate_import_file(data)\n\t\tbegin\n\t\t\timport_filetype_detect(data)\n\t\trescue DBImportError\n\t\t\treturn false\n\t\tend\n\t\treturn true\n\tend",
"def validate\n @has_validated = true\n\n unless File.exist?(@commits_path)\n @errors.push(\"#{File.basename(@commits_path)}: does not exist\")\n end\n\n unless File.exist?(@data_path)\n @errors.push(\"#{File.basename(@data_path)}: does not exist\")\n end\n\n # Stop as further validations need to read the files.\n return if @errors.any?\n\n begin\n data_file.peek\n rescue StopIteration\n @errors.push(\"#{File.basename(@data_path)}: has no data to import\")\n return\n end\n\n DataValidator.call(self).each do |error|\n @errors.push(\"#{File.basename(@data_path)}: #{error}\")\n end\n\n CommitsValidator.call(self).each do |error|\n @errors.push(\"#{File.basename(@commits_path)}: #{error}\")\n end\n\n nil\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n create_update_rules.each do |rule|\n return false if !rule.file_exists || !rule.pattern_exists\n end\n\n true\n end",
"def valid_file?(file)\n case file\n when 'exclude.exclude', 'include.include',\n 'include_exclude.exclude', 'include_exclude.include',\n 'env_exclude.env.exclude', 'env_include.env.include',\n 'include_env_exclude.include', 'include_env_exclude.env.exclude',\n 'include_exclude_env_include.exclude',\n 'include_exclude_env_exclude.include',\n 'include_env_include_env_exclude.env.exclude',\n 'exclude_env_include.exclude',\n 'exclude_env_include.env.include',\n /^include_env_include\\..*include$/,\n /^include_exclude_env_include\\..*include$/,\n /^include_exclude_env_exclude\\..*exclude$/,\n /^include_env_include_env_exclude\\..*include$/,\n /^exclude_env_exclude\\..*exclude$/,\n /^env_include_env_exclude\\.env\\./,\n /^exclude_env_include_env_exclude\\.(env\\.|exclude$)/,\n /^include_exclude_env_include_env_exclude\\./,\n /^env_symbol\\..*include$/\n return true\n when /^default\\./, /^exclude\\./, /^include\\./,\n /^env_exclude\\./, /^env_include\\./, /^include_env_include\\./,\n /^include_env_exclude\\./, /^include_exclude_env_include\\./,\n /^include_exclude_env_exclude\\./, /^exclude_env_include\\./,\n /^include_env_include_env_exclude\\./, /^exclude_env_exclude\\./,\n /^env_include_env_exclude\\./, /^exclude_env_include_env_exclude/,\n /^env_symbol\\./\n return false\n end\n\n # Raise an error if the file was not handled by existing logic.\n raise \"Invalid file (#{file}) specified in #{__method__}.\"\n end",
"def filecheck\n file.nil? ? false : File.exist?(file)\n end",
"def valid?\n @data && reader.valid_header? && metadata != :invalid\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end"
] |
[
"0.7921186",
"0.77443755",
"0.7637357",
"0.7519518",
"0.745484",
"0.74079746",
"0.7294285",
"0.7247295",
"0.7231445",
"0.7216679",
"0.7203188",
"0.7202431",
"0.71676624",
"0.70958686",
"0.70870155",
"0.69900745",
"0.69497937",
"0.6912684",
"0.6863525",
"0.68626726",
"0.68494684",
"0.68463",
"0.6838455",
"0.6830213",
"0.67850465",
"0.6777561",
"0.67692333",
"0.67633665",
"0.67621136",
"0.67621136",
"0.67621136",
"0.67621136",
"0.67621136",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6746789",
"0.6739589",
"0.67225975",
"0.6715888",
"0.6710033",
"0.6688503",
"0.66738605",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347",
"0.6673347"
] |
0.0
|
-1
|
Method to infer the language(s) of the caption by inspecting the file depending on the type of the caption file ==== Returns The ISO 6391 Letter Language codes
|
def infer_languages
raise "Not Implemented. Class #{self.class.name} doesn't implement infer_languages"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file_language_by_file_extension s_file_path, msgcs\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_file_path\n kibuvits_typecheck bn, Kibuvits_msgc_stack, msgcs\n end # if\n ar_tokens=Kibuvits_str.ar_bisect(s_file_path.reverse, '.')\n s_file_extension=ar_tokens[0].reverse.downcase\n s_file_language=\"undetermined\"\n case s_file_extension\n when \"js\"\n s_file_language=\"JavaScript\"\n when \"rb\"\n s_file_language=\"Ruby\"\n when \"php\"\n s_file_language=\"PHP\"\n when \"h\"\n s_file_language=\"C\"\n when \"hpp\"\n s_file_language=\"C++\"\n when \"c\"\n s_file_language=\"C\"\n when \"cpp\"\n s_file_language=\"C++\"\n when \"hs\"\n s_file_language=\"Haskell\"\n when \"java\"\n s_file_language=\"Java\"\n when \"scala\"\n s_file_language=\"Scala\"\n when \"html\"\n s_file_language=\"HTML\"\n when \"xml\"\n s_file_language=\"XML\"\n when \"bash\"\n s_file_language=\"Bash\"\n else\n msgcs.cre \"Either the file extension is not supported or \"+\n \"the file extension extraction failed.\\n\"+\n \"File extension candidate is: \"+s_file_extension, 1.to_s\n msgcs.last[\"Estonian\"]=\"Faililaiend on kas toetamata või ei õnnestunud \"+\n \"faililaiendit eraldada. \\n\"+\n \"Faililaiendi kandidaat on:\"+s_file_extension\n end # case\n return s_file_language\n end",
"def what_language? filename\n test = filename.partition(\".\").last\n case test\n when \"rb\", \"ru\", \"erb\", \"slim\", \"haml\"\n \"Ruby\"\n when \"py\"\n \"Python\"\n when \"java\", \"jsp\", \"jsf\"\n \"Java\"\n when \"cpp\"\n \"C++\"\n when \"m\"\n \"Obj-C\"\n when \"c\"\n \"C\"\n when \"js\", \"coffee\"\n \"Javascript\"\n when \"html\"\n \"Html\"\n when \"cs\"\n \"C#\"\n when \"css\", \"scss\", \"less\"\n \"CSS\"\n when \"php\"\n \"PHP\"\n when \"md\"\n \"Readme\"\n when \"hs\"\n \"Haskell\"\n when \"pm\", \"pl\"\n \"Perl\"\n when \".sh\"\n \"Bash/Shell\"\n else\n \"Other\"\n end\nend",
"def detectLang(path)\n # The language detector is not doing well for subs, so we will just always assume english...\n return 'en'\n\n lang = $languageDetector.language_iso(getCleanText(path))\n if (lang != nil)\n return lang.to_s()\n end\n\n return UNKNOWN_LANG\nend",
"def find_language\r\n #Find the language based on the path\r\n PropertyFileAttributes::LOCALES.each do |l|\r\n if @filename.index(l)\r\n @language = l\r\n end\r\n end\r\n #If the language is not indicated assume it is English\r\n if @language == nil\r\n @language = PropertyFileAttributes::LOCALES[0] #\"Default\"\r\n end\r\n end",
"def language()\r\n\t\treturn \"java\" if (@file =~ /java\\Z/ )\r\n\t\treturn \"cpp\" if ( (@file =~ /cpp\\Z/) || (@file =~ /cc\\Z/) || (@file =~ /h\\Z/) || (@file =~ /hpp\\Z/) )\r\n\tend",
"def language_of_text\n @descriptive_detail.language_of_text || @default_language_of_text\n end",
"def language\n return 'en' if code == \"ind2:0\"\n \n return 'se' if code == \"ind2:4\"\n\n return nil\n end",
"def extract_code_language(attr); end",
"def language\n case \n when self.ENU || self.ENG then \"ENG\"\n when self.SPM || self.SPE then \"SPE\"\n when self.FRC || self.FRF then \"FRF\"\n when self.ITI then \"ITI\"\n when self.DUN then \"DUN\"\n when self.GED then \"GED\"\n end\n end",
"def get_lang_from_path\n case File.extname(@path).downcase\n when '.rb'\n 'ruby'\n when '.js'\n 'javascript'\n when '.php'\n 'php'\n else\n nil\n end\n end",
"def all_languages\n Dir.entries(metadata_path)\n .select { |f| File.directory? File.join(metadata_path, f) }\n .reject { |f| f.start_with?('.') }\n .sort { |x, y| x <=> y }\n end",
"def extract_code_language!(attr); end",
"def get_language_from_code code\n ISO_639.find(code).english_name if not(code.nil?)\n end",
"def lang_files\n @@languages\n end",
"def get_iso_lang(language)\n best_match = [\"ZXX\", language.length]\n n_lang = normalize(language.chomp)\n\n if @@clean_iso_table.include?(n_lang)\n best_match = [@@clean_iso_table[n_lang], 0]\n\n #Hard Codes to match ISO conventions to SCOLA conventions\n elsif n_lang == \"mandarin\"\n best_match = [\"cmn\", 0]\n elsif n_lang == \"farsi\"\n best_match = [\"fas\", 0]\n elsif n_lang == \"swahili\"\n best_match= [\"swa\", 0]\n elsif n_lang == \"southern vietnamese\"\n best_match = [\"vie\", 0]\n elsif n_lang == \"malay\"\n best_match = [\"zlm\", 0]\n elsif n_lang == \"greek\"\n best_match = [\"ell\", 0]\n elsif n_lang == \"nepali\"\n best_match = [\"npi\", 0]\n elsif n_lang == \"iraqi\"\n best_match = [\"acm\", 0]\n elsif n_lang == \"ilocando\"\n best_match = [\"ilo\", 0]\n elsif n_lang == \"saraiki\"\n best_match = [\"skr\", 0]\n elsif n_lang == \"sorani\"\n best_match = [\"ckb\", 0]\n elsif n_lang == \"yakutian\"\n best_match = [\"sah\", 0]\n elsif n_lang == \"luganda\"\n best_match = [\"lug\", 0] \n elsif n_lang == \"arabic yemeni\"\n best_match = [\"ara\", 0]\n\n end\n\n return best_match\n end",
"def filenames_for_current_locale; end",
"def polyglossia_default_language(language_code_3_chars)\n {\n 'ara' => 'arabic',\n 'frs' => 'farsi',\n 'kan' => 'kannada',\n 'mal' => 'malayalam',\n 'pun' => 'punjabi',\n }[language_code_3_chars]\n end",
"def languages\n @bio.fetch('Languages')\n end",
"def language\n if ladnn?\n ['zxx'] # MARC code for 'No linguistic content'\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:language)\n end\n end",
"def language_for_code(code)\n # ISO_639 maps -1 and -2. LanguageList maps -3.\n ISO_639.find(code)&.english_name || LanguageList::LanguageInfo.find(code)&.name\n end",
"def country_to_culture\n @country_to_culture ||= begin\n result = {}\n glob(\"history/countries/*.txt\").each do |path|\n tag = path.basename.to_s[0,3]\n node = parse(path)\n result[tag] = node[\"primary_culture\"]\n end\n result\n end\n end",
"def altcode \n all_altcode = []\n project_files.each{|file| all_altcode.concat(file.alternative_codes)}\n all_altcode\n end",
"def test_identify_language_from_filename\n filename = 'one.fp'\n femp = Locale.new('femp', 'fp', 'fpt')\n curriculum.add(femp, %w(one two))\n assert_equal 'femp', curriculum.identify_language('femp.fp')\n end",
"def language_name_of_text\n if self.language_of_text\n self.language_of_text.human\n end\n end",
"def mozart_italian; end",
"def language_code\n @language_code ||= code_parts[0]\n end",
"def language_metadata\n \"lang/#{RUBY_ENGINE}##{RUBY_ENGINE_VERSION} md/#{RUBY_VERSION}\"\n end",
"def lang; end",
"def lang; end",
"def lang; end",
"def lang; end",
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def extlang\n return nil unless @language\n decompose_language unless @primary\n @extlang\n end",
"def display_language\n default = I18n.locale.try {|l| l.to_s.gsub(/\\-.*$/, '')} || \"en\"\n\n this_doc = self.language_obj.try(:iso_639_1)\n\n return nil if this_doc == default\n\n self.language_str\n end",
"def languages\n documents.collect(&:sections).flatten.collect(&:examples).flatten.map(&:language).compact.uniq\n end",
"def key_lang\n if @is_result\n @lang[0, @lang.length - RESULT_SUFFIX_LENGTH]\n else\n @lang\n end\n end",
"def language(options = {})\n Babel.guess(self, options)\n end",
"def detect_lang_in_codeblock_attributes(pre_html_attrs, code_html_attrs); end",
"def pbGetLanguage()\n case System.user_language[0..1]\n when \"ja\" then return 1 # Japanese\n when \"en\" then return 2 # English\n when \"fr\" then return 3 # French\n when \"it\" then return 4 # Italian\n when \"de\" then return 5 # German\n when \"es\" then return 7 # Spanish\n when \"ko\" then return 8 # Korean\n end\n return 2 # Use 'English' by default\nend",
"def set_win_lang_codes(lcode)\n lcode[0x0436] = 'af;Afrikaans'\n lcode[0x041C] = 'sq;Albanian'\n lcode[0x0001] = 'ar;Arabic'\n lcode[0x0401] = 'ar-sa;Arabic (Saudi Arabia)'\n lcode[0x0801] = 'ar-iq;Arabic (Iraq)'\n lcode[0x0C01] = 'ar-eg;Arabic (Egypt)'\n lcode[0x1001] = 'ar-ly;Arabic (Libya)'\n lcode[0x1401] = 'ar-dz;Arabic (Algeria)'\n lcode[0x1801] = 'ar-ma;Arabic (Morocco)'\n lcode[0x1C01] = 'ar-tn;Arabic (Tunisia)'\n lcode[0x2001] = 'ar-om;Arabic (Oman)'\n lcode[0x2401] = 'ar-ye;Arabic (Yemen)'\n lcode[0x2801] = 'ar-sy;Arabic (Syria)'\n lcode[0x2C01] = 'ar-jo;Arabic (Jordan)'\n lcode[0x3001] = 'ar-lb;Arabic (Lebanon)'\n lcode[0x3401] = 'ar-kw;Arabic (Kuwait)'\n lcode[0x3801] = 'ar-ae;Arabic (you.A.E.)'\n lcode[0x3C01] = 'ar-bh;Arabic (Bahrain)'\n lcode[0x4001] = 'ar-qa;Arabic (Qatar)'\n lcode[0x042D] = 'eu;Basque'\n lcode[0x0402] = 'bg;Bulgarian'\n lcode[0x0423] = 'be;Belarusian'\n lcode[0x0403] = 'ca;Catalan'\n lcode[0x0004] = 'zh;Chinese'\n lcode[0x0404] = 'zh-tw;Chinese (Taiwan)'\n lcode[0x0804] = 'zh-cn;Chinese (China)'\n lcode[0x0C04] = 'zh-hk;Chinese (Hong Kong SAR)'\n lcode[0x1004] = 'zh-sg;Chinese (Singapore)'\n lcode[0x041A] = 'hr;Croatian'\n lcode[0x0405] = 'cs;Czech'\n lcode[0x0406] = 'da;Danish' #changed from \"the\"\n lcode[0x0413] = 'nl;Dutch (Netherlands)'\n lcode[0x0813] = 'nl-be;Dutch (Belgium)'\n lcode[0x0009] = 'en;English'\n lcode[0x0409] = 'en-us;English (United States)'\n lcode[0x0809] = 'en-gb;English (United Kingdom)'\n lcode[0x0C09] = 'en-au;English (Australia)'\n lcode[0x1009] = 'en-ca;English (Canada)'\n lcode[0x1409] = 'en-nz;English (New Zealand)'\n lcode[0x1809] = 'en-ie;English (Ireland)'\n lcode[0x1C09] = 'en-za;English (South Africa)'\n lcode[0x2009] = 'en-jm;English (Jamaica)'\n lcode[0x2809] = 'en-bz;English (Belize)'\n lcode[0x2C09] = 'en-tt;English (Trinidad)'\n lcode[0x0425] = 'et;Estonian'\n lcode[0x0438] = 'fo;Faeroese'\n lcode[0x0429] = 'fa;Farsi'\n lcode[0x040B] = 'fi;Finnish'\n lcode[0x040C] = 'fr;French (France)'\n lcode[0x080C] = 'fr-be;French (Belgium)'\n lcode[0x0C0C] = 'fr-ca;French (Canada)'\n lcode[0x100C] = 'fr-ch;French (Switzerland)'\n lcode[0x140C] = 'fr-lu;French (Luxembourg)'\n lcode[0x043C] = 'gd;Gaelic'\n lcode[0x0407] = 'de;German (Germany)'\n lcode[0x0807] = 'de-ch;German (Switzerland)'\n lcode[0x0C07] = 'de-at;German (Austria)'\n lcode[0x1007] = 'de-lu;German (Luxembourg)'\n lcode[0x1407] = 'de-li;German (Liechtenstein)'\n lcode[0x0408] = 'el;Greek'\n lcode[0x040D] = 'he;Hebrew'\n lcode[0x0439] = 'hi;Hindi'\n lcode[0x040E] = 'hu;Hungarian'\n lcode[0x040F] = 'is;Icelandic'\n lcode[0x0421] = 'in;Indonesian'\n lcode[0x0410] = 'it;Italian (Italy)'\n lcode[0x0810] = 'it-ch;Italian (Switzerland)'\n lcode[0x0411] = 'ja;Japanese'\n lcode[0x0412] = 'ko;Korean'\n lcode[0x0426] = 'lv;Latvian'\n lcode[0x0427] = 'lt;Lithuanian'\n lcode[0x042F] = 'mk;FYRO Macedonian'\n lcode[0x043E] = 'ms;Malay (Malaysia)'\n lcode[0x043A] = 'mt;Maltese'\n lcode[0x0414] = 'no;Norwegian (Bokmal)'\n lcode[0x0814] = 'no;Norwegian (Nynorsk)'\n lcode[0x0415] = 'pl;Polish'\n lcode[0x0416] = 'pt-br;Portuguese (Brazil)'\n lcode[0x0816] = 'pt;Portuguese (Portugal)'\n lcode[0x0417] = 'rm;Rhaeto-Romanic'\n lcode[0x0418] = 'ro;Romanian'\n lcode[0x0818] = 'ro-mo;Romanian (Moldova)'\n lcode[0x0419] = 'ru;Russian'\n lcode[0x0819] = 'ru-mo;Russian (Moldova)'\n lcode[0x0C1A] = 'sr;Serbian (Cyrillic)'\n lcode[0x081A] = 'sr;Serbian (Latin)'\n lcode[0x041B] = 'sk;Slovak'\n lcode[0x0424] = 'sl;Slovenian'\n lcode[0x042E] = 'sb;Sorbian'\n lcode[0x040A] = 'es;Spanish (Traditional Sort)'\n lcode[0x080A] = 'es-mx;Spanish (Mexico)'\n lcode[0x0C0A] = 'es;Spanish (International Sort)'\n lcode[0x100A] = 'es-gt;Spanish (Guatemala)'\n lcode[0x140A] = 'es-cr;Spanish (Costa Rica)'\n lcode[0x180A] = 'es-pa;Spanish (Panama)'\n lcode[0x1C0A] = 'es-do;Spanish (Dominican Republic)'\n lcode[0x200A] = 'es-ve;Spanish (Venezuela)'\n lcode[0x240A] = 'es-co;Spanish (Colombia)'\n lcode[0x280A] = 'es-pe;Spanish (Peru)'\n lcode[0x2C0A] = 'es-ar;Spanish (Argentina)'\n lcode[0x300A] = 'es-ec;Spanish (Ecuador)'\n lcode[0x340A] = 'es-cl;Spanish (Chile)'\n lcode[0x380A] = 'es-uy;Spanish (Uruguay)'\n lcode[0x3C0A] = 'es-py;Spanish (Paraguay)'\n lcode[0x400A] = 'es-bo;Spanish (Bolivia)'\n lcode[0x440A] = 'es-sv;Spanish (El Salvador)'\n lcode[0x480A] = 'es-hn;Spanish (Honduras)'\n lcode[0x4C0A] = 'es-ni;Spanish (Nicaragua)'\n lcode[0x500A] = 'es-pr;Spanish (Puerto Rico)'\n lcode[0x0430] = 'sx;Sutu'\n lcode[0x041D] = 'sv;Swedish'\n lcode[0x081D] = 'sv-fi;Swedish (Finland)'\n lcode[0x041E] = 'th;Thai'\n lcode[0x0431] = 'ts;Tsonga'\n lcode[0x0432] = 'tn;Tswana'\n lcode[0x041F] = 'tr;Turkish'\n lcode[0x0422] = 'uk;Ukrainian'\n lcode[0x0420] = 'ur;Urdu' #changed from \"your\"\n lcode[0x042A] = 'vi;Vietnamese'\n lcode[0x0434] = 'xh;Xhosa'\n lcode[0x043D] = 'ji;Yiddish'\n lcode[0x0435] = 'zu;Zulu'\nend",
"def article_lang_display(text)\n\n\t\ttext.split(\"$$\").each_cons(2) do |lang, content|\n\n\t\t\tif lang.eql?('en') and I18n.locale == :en\n\t\t\t\ten_text = content\n\t\t\t\treturn creole(en_text)\n\t\t\telsif lang.eql?('es') and I18n.locale == :es\n\t\t\t\tes_text = content\n\t\t\t\treturn creole(es_text)\n\t\t\tend\n\t\tend\n\tend",
"def language_code_of_text\n if self.language_of_text\n self.language_of_text.code\n end\n end",
"def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es es-PR so fr].include?(lang)\n lang\n end",
"def languages\n ['HTML', 'Javascript', 'CSS', 'PHP', 'ERB', 'Ruby', 'Objective-C']\n end",
"def se_type?(files)\n files.each do |f|\n if /3_BC\\d+/.match(f)\n return \"BC\"\n elsif /_F5-P2/.match(f)\n return \"PE\"\n elsif /_R3/.match(f)\n return \"MP\"\n end\n end\n \"FR\"\n end",
"def get_lang_from_headers\n\t\t\t@env['HTTP_ACCEPT_LANGUAGE'].to_s[0, 2]\n\t\tend",
"def language\n @language ||= LanguageDetector.new\n end",
"def lang(orig); end",
"def detect_language\n self.language = LanguageDetector.new(self).detect\n end",
"def get_english_meaning(file_name, emote)\n emoticons = load_library(file_name)\n if emoticons[\"get_emoticon\"][emote]\n return emoticons[\"get_emoticon\"][emote]\n else\n return \"Sorry, that emoticon was not found\"\n end\nend",
"def language_name(code)\n if configatron.locales.include?(code)\n t(:locale_name, :locale => code)\n else\n (entry = ISO_639.find(code.to_s)) ? entry.english_name : code.to_s\n end\n end",
"def iso_639\n iso_639_1 || iso_639_2t || iso_639_2b || iso_639_3\n end",
"def get_language_filename( source, use_locale = false )\n before_substring = source.slice(0,(source.rindex(\".\") ))\n after_substring = source.slice(source.rindex(\".\"), (source.size - before_substring.size) )\n if use_locale\n return \"#{before_substring}-#{GettextLocalize.locale.to_s}#{after_substring}\"\n else\n return \"#{before_substring}-#{GettextLocalize.locale.to_s[0,2]}#{after_substring}\"\n end\n end",
"def language_iso_639_3\n language_obj.try {|l| l.iso_639_3 }\n end",
"def language \n \"language\" \n end",
"def video_previews_in_all_languages\n previews = []\n (videos[:list][:es] + [videos[:featured][:es]]).compact.each do |video|\n filename = video.sub(/#{Pathname.new(video).extname}$/, '')\n video_filename_without_extension = filename.gsub(/_(#{Document::LANGUAGES.join('|')})$/, '')\n previews << \"#{class_multimedia_path}#{video_filename_without_extension}.jpg\"\n Document::LANGUAGES.each do |l|\n previews<< \"#{class_multimedia_path}#{video_filename_without_extension}_#{l}.jpg\"\n end\n end\n return previews\n end",
"def lang\n language = \"#{@lang}\".strip.downcase\n { #Aliases to languages names\n \"eng\" => [\"en\",\"en-us\",\"english\"],\n \"ita\" => [\"it\"],\n \"por\" => [\"pt\",\"pt-br\",\"portuguese\"],\n \"spa\" => [\"sp\"]\n }.each do |value,names|\n return \" -l #{value} \" if names.include? language\n end\n return \" -l #{language} \" if language.size > 0\n \"\"\n rescue\n \"\"\n end",
"def getcodes\r\n result = SUPPORTED_LANG_CODES\r\n end",
"def get_english_meaning(file_path, emoticon)\n emoji_library = load_library(file_path)\n emoji_equivalent = emoji_library[\"get_meaning\"][emoticon]\n return \"Sorry, that emoticon was not found\" if emoji_equivalent.nil?\n emoji_equivalent\nend",
"def map_language(value)\n #changing to a string value since I am returning only one value\n language = case\n when value.is_a?(Array) then value\n when value.is_a?(String) then [value]\n else raise ArgumentError.new(\"Expecting #{value} to be an Array or String\")\n end\n\n iso_lang_code = \"\"\n\n language.each{|lan|\n lan.downcase!\n iso = ISO_639.search(lan)\n #returns an array of arrays\n iso.each_index{|la|\n iso[la].each{|l|\n #if code is found in language array of arrays\n if l == lan\n #the ISO English equivalent of the code or the language\n #always in the 4th position of the array\n iso_lang_code = iso[la][3]\n break\n end\n }\n\n }\n break if !iso_lang_code.empty?\n }\n iso_lang_code\n\n end",
"def la\n return @la if defined?(@la)\n\n @la ||= @work.language.join(\", \")\n end",
"def languages_as_uri\n languages.pluck(:name).map do |language|\n ControlledVocabulary.era.language.from_value(language)\n end\n end",
"def language_codes_for_select\n configuration(:languages).collect { |language|\n language[:language_code]\n }\n end",
"def all_languages\n project_file = XCProjectFile.new(@xcode_proj_path)\n project_file.project[\"knownRegions\"].select { |r| r != \"Base\" }\n end",
"def all_languages\n project_file = XCProjectFile.new(@xcode_proj_path)\n project_file.project[\"knownRegions\"].select { |r| r != \"Base\" }\n end",
"def languages\n grouped_language_files.map do |language, stats|\n additions = summarize(stats, :additions)\n deletions = summarize(stats, :deletions)\n net = summarize(stats, :net)\n LanguageSummary.new(language, additions, deletions, net, added_files, deleted_files, modified_files)\n end\n end",
"def most_common_language\n self.repos.collect { |repo| repo.language }.mode\n end",
"def languages\n value.document.fetch(\"#{value.key}_lang\", [])\n end",
"def language_iso_639_1\n language_obj.try { |l| l.iso_639_1 }\n end",
"def get_english_meaning(path, symbol)\n each_emoticon = load_library(path)\n \n each_emoticon.each do |name, value|\n \n if each_emoticon[name][:japanese] == symbol\n return name\n end \n \n end\n \n \"Sorry, that emoticon was not found\"\nend",
"def languages(candidate)\n candidate[:languages].include?('Python') ||\n candidate[:languages].include?('Ruby')\nend",
"def country_to_language(country_code)\n\n # sources:\n # http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains\n # http://www.w3.org/WAI/ER/IG/ert/iso639.htm\n # http://msdn.microsoft.com/en-us/library/ms693062%28v=vs.85%29.aspx\n\n # country_code => language_code\n mappings = {\n # English\n :au => :en,\n :ca => :en,\n :eu => :en,\n :ie => :en,\n :nz => :en,\n :sg => :en,\n :uk => :en,\n :us => :en,\n\n # French\n :cd => :fr,\n :cg => :fr,\n :cm => :fr,\n :fr => :fr,\n :mg => :fr,\n\n # German\n :at => :de,\n :ch => :de,\n :de => :de,\n :li => :de,\n :lu => :de,\n\n # Portuguese\n :ao => :pt,\n :br => :pt,\n :mz => :pt,\n :pt => :pt,\n\n # Spanish\n :ar => :es,\n :cl => :es,\n :co => :es,\n :cu => :es,\n :es => :es,\n :mx => :es,\n\n # All other languages\n :bg => :bg,\n :by => :be,\n :cn => :zh,\n :cz => :cs,\n :dk => :da,\n :ee => :et,\n :fi => :fi,\n :gr => :el,\n :hr => :hr,\n :hu => :hu,\n :il => :he,\n :in => :hi,\n :is => :is,\n :it => :it,\n :jp => :ja,\n :kr => :ko,\n :lt => :lt,\n :lv => :lv,\n :mn => :mn,\n :nl => :nl,\n :no => :no,\n :pl => :pl,\n :ro => :ro,\n :rs => :sr,\n :ru => :ru,\n :se => :sv,\n :si => :sl,\n :sk => :sk,\n :th => :th,\n :tr => :tr,\n :ua => :uk,\n :vn => :vi,\n }\n\n if mappings.has_key?(country_code.to_sym)\n mappings[country_code.to_sym].to_s\n else\n # fall back for all other missing mappings\n I18n.default_locale.to_s\n end\n\n end",
"def locale_of(filename)\n locale = (filename =~ extension_regex ? $1 : nil)\n locale ? locale.gsub(/^\\./, '').to_sym : nil\n end",
"def official_language_code(language_code)\n {\n cs: \"zh-CN\",\n ct: \"zh-TW\",\n sp: \"es\",\n jp: \"ja\",\n }[language_code] || language_code\n end",
"def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end",
"def lang_confidence(text)\n [detect(text)[\"responseData\"][\"language\"], detect(text)[\"responseData\"][\"confidence\"]]\n end",
"def language_from_008(forbid_discontinued: false)\n code = self['008']&.value&.slice(35..37)\n return nil unless code\n language = self.class.lang_code_map[code]\n\n # try for a discontinued language code when needed and\n # allowed\n unless language || forbid_discontinued\n language = self.class.lang_code_map[\"-#{code}\"]\n end\n\n [code, language]\n end",
"def language\n tag = self.languages.first\n return tag ? tag.name : nil\n end",
"def human\n I18n.t(language, scope: :languages)\n end",
"def decompose_language\n @primary, @extlang = @language.split(HYPHEN_SPLITTER, 2)\n nil\n end",
"def localize_language( iso639 )\n begin\n known_languages.find{ |x,y,z| x == iso639 }[2]\n rescue Exception => e\n _('Unknown language')\n end\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end",
"def localization\n return nil unless length >= 4\n return nil unless self[3].comment.last.include?('ALCATEL ')\n return nil unless self[3].comment.length >= 5\n\n self[3].comment[3]\n end",
"def pbGetLanguage()\n getUserDefaultLangID=Win32API.new(\"kernel32\",\"GetUserDefaultLangID\",\"\",\"i\") rescue nil\n ret=0\n if getUserDefaultLangID\n ret=getUserDefaultLangID.call()&0x3FF\n end\n if ret==0 # Unknown\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\Desktop\\\\ResourceLocale\",\"\",0)\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\International\",\"Locale\",\"0\").to_i(16) if ret==0\n ret=ret&0x3FF\n return 0 if ret==0 # Unknown\n end\n return 1 if ret==0x11 # Japanese\n return 2 if ret==0x09 # English\n return 3 if ret==0x0C # French\n return 4 if ret==0x10 # Italian\n return 5 if ret==0x07 # German\n return 7 if ret==0x0A # Spanish\n return 8 if ret==0x12 # Korean\n return 2 # Use 'English' by default\nend",
"def getlist\r\n result = SUPPORTED_LANG_LIST\r\n end",
"def code_type()\n path = @opts[:file]\n if path.end_with? '.rb'\n :ruby\n elsif path.end_with? '.xml'\n :xml\n else\n :text\n end\n end",
"def read_languages_from_file(data_file)\n File.open(data_file, 'rb') do |fin|\n until fin.eof\n label, outputs = Marshal.load(fin)\n yield label, outputs\n end\n end\nend",
"def language\n @language ||= if %W[rbx maglev].any? { |name| engine == name }\n CPlusPlus\n elsif platform =~ /java/\n Java\n else\n C\n end\n end",
"def parser_type_for_filename(filename)\n case (File.extname(filename)[1..-1] || \"\").downcase\n when \"c\", \"cpp\", \"cxx\"\n :c\n else # when \"rb\", \"rbx\", \"erb\"\n parser_type == :ruby18 ? :ruby18 : :ruby\n end\n end",
"def get_english_meaning(file_path, emoticon)\n library = load_library(file_path)\n return_value = library[\"get_meaning\"][emoticon]\n return_value ? return_value : \"Sorry, that emoticon was not found\"\nend",
"def init_linguistics\n Linguistics::use(:en)\nend",
"def addl_languages_names\n self.dig_for_array(\"addlLanguageNames\")\n end",
"def language_from_kaf(input)\n parser = Oga::XML::PullParser.new(input)\n language = nil\n\n parser.parse do |node|\n if node.is_a?(Oga::XML::Element) and node.name == 'KAF'\n language = node.get('xml:lang')\n break\n end\n end\n\n # Make sure nobody can _somehow_ inject a language such as \"../../foo\".\n unless language =~ /\\A[a-zA-Z\\-_]+\\z/\n raise Core::UnsupportedLanguageError, language\n end\n\n language\n end",
"def language\n self\n end",
"def language_codes_for_select\n configuration(:languages).collect{ |language|\n language[:language_code]\n }\n end",
"def language_from_kaf(input)\n document = Nokogiri::XML(input)\n language = document.xpath('KAF/@xml:lang')[0]\n\n return language ? language.to_s : nil\n end"
] |
[
"0.6632015",
"0.6442927",
"0.64024466",
"0.6279754",
"0.6107243",
"0.6085391",
"0.6055107",
"0.5922786",
"0.5920917",
"0.5877072",
"0.5829107",
"0.58077836",
"0.5806559",
"0.5780551",
"0.5761174",
"0.5725719",
"0.57174224",
"0.57023156",
"0.5692218",
"0.5669612",
"0.565673",
"0.5653226",
"0.56474113",
"0.56458896",
"0.564488",
"0.5638555",
"0.5627094",
"0.559715",
"0.559715",
"0.559715",
"0.559715",
"0.55932623",
"0.55932623",
"0.55932623",
"0.55932623",
"0.5592736",
"0.5564579",
"0.55503994",
"0.5502634",
"0.54328495",
"0.54314065",
"0.5425554",
"0.5407506",
"0.5398556",
"0.5392761",
"0.5389176",
"0.5388522",
"0.53459954",
"0.53340167",
"0.5324019",
"0.53181106",
"0.5317023",
"0.5315533",
"0.53058857",
"0.5297892",
"0.5296153",
"0.52806044",
"0.5260715",
"0.5257611",
"0.5251182",
"0.5249663",
"0.52321106",
"0.52291125",
"0.52249914",
"0.52233267",
"0.5217626",
"0.521286",
"0.521286",
"0.5203892",
"0.5203756",
"0.51960224",
"0.5190588",
"0.5181986",
"0.5178124",
"0.51750493",
"0.517329",
"0.51702446",
"0.5169803",
"0.5168077",
"0.5167128",
"0.5167081",
"0.5165679",
"0.5148602",
"0.51470983",
"0.51468796",
"0.51468796",
"0.51468796",
"0.5145325",
"0.5143122",
"0.5137911",
"0.5131416",
"0.5131093",
"0.5130412",
"0.5123886",
"0.5116403",
"0.5114173",
"0.51119816",
"0.51111805",
"0.5106346",
"0.5105938",
"0.5104065"
] |
0.0
|
-1
|
Method to set a translation engine +translator+ Instance of translation engine. Refer to `engines/aws` for example ==== Raises `InvalidInputException` when the argument `translator` is not an instance of Translator class
|
def set_translator(translator)
if translator && !(translator.is_a? Translator)
raise InvalidInputException.new("Argument is not an instance of Translator")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_translator\n @translator = Translator.find(params[:id])\n end",
"def set_translator\n @translator = Translator.find(params[:id])\n end",
"def translator\n @translator ||= Translator.new\n end",
"def configure(&block)\n unless provider\n raise 'Translation provider not selected yet. Use `Lit::CloudTranslation' \\\n '.provider = PROVIDER_KLASS` before calling #configure.'\n end\n provider.tap do |p|\n p.configure(&block)\n end\n end",
"def set_translatorused\n @translatorused = Translatorused.find(params[:id])\n end",
"def add_translator( type, &block ) # :yields: type, value\n @translators[ type_name( type ) ] = block\n end",
"def create_engine(params={})\n text = parameters(params, :text)\n opts = engine_options(params)\n\n ::Maruku.new(text, opts)\n end",
"def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end",
"def set_translator\n user = User.find params[:id]\n if user.account.translator?\n user.account.update(account_type: \"free\")\n else\n user.account.update(account_type: \"translator\")\n end\n redirect_to \"/yonetim/user/#{user.id}\"\n end",
"def set_translation\n @translation = Translation.find(params[:id])\n end",
"def set_translation\n if params[:locale].blank? && session[:current_locale].present?\n ::I18n.locale = session[:current_locale]\n elsif params[:locale].present? && ::I18n.available_locales.include?(params[:locale].to_sym)\n session[:current_locale] = ::I18n.locale = params[:locale]\n elsif current_alchemy_user && current_alchemy_user.respond_to?(:language) && current_alchemy_user.language.present?\n ::I18n.locale = current_alchemy_user.language\n else\n ::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale\n end\n end",
"def set_example_translation\n @example_translation = ExampleTranslation.find(params[:id])\n end",
"def set_translation(locale, translation, value)\n SimpleTranslationEngine.set_translation(locale, \"alert_#{self.id}_#{translation}\", value)\n end",
"def engine=(new_engine)\n case new_engine\n when String, Symbol\n require \"vendor/multi_json/engines/#{new_engine}\"\n @engine = MultiJson::Engines.const_get(\"#{new_engine.to_s.split('_').map{|s| s.capitalize}.join('')}\")\n when Class\n @engine = new_engine\n else\n raise \"Did not recognize your engine specification. Please specify either a symbol or a class.\"\n end\n end",
"def transcoder\n @transcoder ||= Aws::ElasticTranscoder::Client.new(\n region: Rails.application.secrets.aws_region\n )\n end",
"def set_translation\n @translation = Translation.find(params[:id])\n end",
"def set_language\n params[:lang] ||= 'en'\n Localization.use params[:lang]\n end",
"def engine(new_engine = nil)\n @engine = new_engine if new_engine\n @engine\n end",
"def translation=(translation)\n @translation.set(translation)\n @transform_dirty = true\n translation\n end",
"def command_translator_class\n return Translator::CommandTranslator\n end",
"def set_application(app)\n self.application = app\n translations.values.each do |locale_translations|\n locale_translations.each do |translation|\n translation.translation_key = self\n translation.language = self.application.language(translation.locale)\n end\n end\n self\n end",
"def set_rus_translation\n @rus_translation = RusTranslation.find(params[:id])\n end",
"def set_service_translation\r\n @service_translation = ServiceTranslation.find(params[:id])\r\n end",
"def engine_adapter=(name_or_adapter_or_class)\n self._engine_adapter = interpret_adapter(name_or_adapter_or_class)\n end",
"def translate(settings); end",
"def create_translation(other)\n end",
"def translate_input_text\n if self.language\n self.output_text = self.language.translate(self.input_text)\n else\n self.output_text = self.input_text\n end\n end",
"def translator_for(t_key, template = nil, parameters = nil)\n o_translator = translators[t_key]\n if template\n translator = Translator.new(template,\n :parameters => parameters)\n if o_translator\n o_translator.flagged.each do |i|\n translator.flag_ref(i)\n end\n end\n translators[t_key] = translator\n o_translator = translator\n else\n unless o_translator\n o_translator = Translator.new({},\n :parameters => {})\n end\n end\n o_translator\n end",
"def set_translation_target(opts)\n opts = check_params(opts,[:targets])\n super(opts)\n end",
"def engine\n options[:engine] || self.class.engine\n end",
"def set_actor_language\n @actor_language = ActorLanguage.find(params[:id])\n end",
"def set_engine\n @engine = Engine.find(params[:id])\n end",
"def set_engine\n @engine = Engine.find(params[:id])\n end",
"def backend=(backend)\n @backend = backend&.to_sym\n set_encoder\n end",
"def set_engine\n @engine = ::EngineMaster.find(params[:id])\n end",
"def create\n @translator = Translator.new(translator_params)\n\n respond_to do |format|\n if @translator.save\n format.html { redirect_to @translator, notice: 'Translator was successfully created' }\n format.json { render :show, status: :created, location: @translator }\n else\n format.html { render :new }\n format.json { render json: @translator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def translate\n translate_matches\n add_meta_charset\n set_encoding\n end",
"def set_language\r\n @language = Language.find(params[:id]) rescue Language.find(params[:language_id])\r\n end",
"def transformation=(transform)\n end",
"def to(lang)\n @target_lang = lang\n return self\n end",
"def set_backend(val)\n end",
"def translate\n self.translations.destroy\n\n if auto_translate\n google_translate\n bing_translate\n end\n end",
"def command_translate\n command :translate do |c|\n c.syntax = 'budik translate [options]'\n c.summary = @str_translate.summary\n c.description = @str_translate.description\n c.action { |args, _opts| Command.new(:translate, args) }\n end\n end",
"def engine(value = nil)\n if value.nil?\n @engine\n else\n @engine = value\n end\n end",
"def set_language\n self.language = I18n.locale.to_s unless self.language.present?\n end",
"def serialise_using(translator, options = {})\n payload = {\n self.class.element_name => @attributes.dup\n }\n translator.serialise(payload, options)\n end",
"def get_text_encoder\n case @config['text_encoder']\n when 'BasicArabicEncoder'\n Encoders::BasicArabicEncoder.new(@config['text_cleaner'])\n when 'ArabicEncoderWithStartSymbol'\n Encoders::ArabicEncoderWithStartSymbol.new(@config['text_cleaner'])\n else\n raise Exception.new(\n 'text_encoder not found: ' + @config['text_encoder'].to_s\n )\n end\n end",
"def store_translations(locale, data, options = {})\n raise NotImplementedError\n end",
"def switch_to(text_domain, locale)\n @store[text_domain] ||= {}\n @store[text_domain][locale] ||= {}\n @store[text_domain][locale][\"\"] = false # ignore gettext meta key when translating\n @current = @store[text_domain][locale]\n end",
"def language=(lang, options = {})\n Babel.learn(lang, self, options)\n end",
"def default_engine=(engine)\n engine = engine.to_s\n if !self.supported_engines.include?(engine)\n raise \"The selected WIKI engine '#{engine}' is invalid! Supported engines: #{supported_engines.keys.inspect}\"\n elsif supported_engines[engine]\n @@default_engine = engine\n elsif supported_engines.values.compact.any?\n @@default_engine = supported_engines.values.first\n else\n raise \"The selected WIKI default engine '#{engine}' is missing! \" + \n \"Please install required GEM or library or switch to another engine. \" + \n \"Available engines: #{available_engine_names.inspect}\" \n end\n end",
"def bind_engine(storage)\n RuoteKit.engine = Ruote::Engine.new(storage)\n end",
"def set_search_engine\n set_engine_callback(SearchService)\n end",
"def translate_exception(e)\n exception_translator.register_exception e\n end",
"def use_grammar(aGrammar)\n @grammar = aGrammar\n end",
"def translator(string)\n if string == \"en\"\n p \"Hello World\"\n elsif string == \"de\"\n p \"Hallo Welt\"\n elsif string == \"es\"\n p \"Hola Mundo\"\n else\n p \"Not coded to accept other languages at this time.\"\n end\nend",
"def set_locale\n session[:locale] = params[:locale] if params[:locale]\n I18n.locale = session[:locale] || I18n.default_locale\n locale_path = \"#{LOCALES_DIRECTORY}#{I18n.locale}.yml\"\n unless I18n.load_path.include? locale_path\n I18n.load_path << locale_path\n I18n.backend.send(:init_translations)\n end\n rescue Exception => err\n logger.error err\n flash.now[:notice] = \"#{I18n.locale} translation not available\"\n I18n.load_path -= [locale_path]\n I18n.locale = session[:locale] = I18n.default_locale\n end",
"def setTransform(transform)\n # Pass through\n @target.transform = transform\n end",
"def initialize(engine = default_engine)\n @engine = engine\n end",
"def set_language\n I18n.locale = params[:locale] || I18n.default_locale\n @lang = Wzs::Multilang::get_language(I18n.locale)\n end",
"def add_translation(text, lang_code)\n translation = Translation.create(:text => text, :lang_code => lang_code)\n\n translations << translation\n end",
"def set_language\n @language = Language.find(params[:id])\n end",
"def set_language\n @language = Language.find(params[:id])\n end",
"def engine engine = nil, *args\n if engine && configurable?\n @engine = engine_supported?(engine)\n @engine_args = args\n @ext = guess_extension(@engine)\n end\n @setup[:engine] ||= @engine ||\n (@controller.ctrl.slice.view.engine if @controller) ||\n Presto.view.engine\n end",
"def translatorused_params\n params.require(:translatorused).permit(:code, :text)\n end",
"def engine\n return @engine if @engine\n self.engine = self.default_engine\n @engine\n end",
"def store_translations(locale, data, options = T.unsafe(nil)); end",
"def set_language_dialect\n @language_dialect = LanguageDialect.find(params[:id])\n end",
"def translate(locale, key, options = T.unsafe(nil)); end",
"def set_engine\n @engine = Engine.owner(current_user).find(params[:id])\n end",
"def input=(input_text)\n engine.input = input_text\n end",
"def setSpeech _obj, _args\n \"_obj setSpeech _args;\" \n end",
"def set_createdtranslation\n @createdtranslation = Createdtranslation.find(params[:id])\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def set_transformer\n @transformer = Transformer.find(params[:id])\n end",
"def set_Language(value)\n set_input(\"Language\", value)\n end",
"def set_Language(value)\n set_input(\"Language\", value)\n end",
"def set_Language(value)\n set_input(\"Language\", value)\n end",
"def set_Language(value)\n set_input(\"Language\", value)\n end",
"def set_Language(value)\n set_input(\"Language\", value)\n end",
"def translate(args)\n Config.instance.translate(args.first)\n end",
"def initialize(**args)\n @language = args[:language] || throw(ArgumentError)\n end",
"def register(name, &block)\n transformations[name] = block\n end",
"def translate(eng_word) # here call to Max's ending code\n Multitran.translate(eng_word)\n end",
"def translation_target\n super\n end",
"def translate(tx, ty = nil)\n ty ||= tx\n begin\n @transforms << [:translate, [Float(tx), Float(ty)]]\n rescue ArgumentError\n raise ArgumentError, \"arguments must be convertable to float (got #{tx.class}, #{ty.class})\"\n end\n yield(self) if block_given?\n self\n end",
"def addTransformer(transformer)\n @transformer.add(transformer)\n self\n end",
"def translate!(key, **options); end",
"def translate(key, **options); end",
"def translate(key, **options); end",
"def set_language\n @o_single = Language.find(params[:id])\n end",
"def set_text_node_translation(text_node, language, new_translation)\r\n text_node.xpath(\"./Translation\").each do |translation_node|\r\n if translation_node[\"Language\"] == language\r\n #Remove old translation\r\n translation_node.child.remove if translation_node.child\r\n\r\n translation_node.add_child(Nokogiri::XML::Text.new(new_translation, @xml_doc))\r\n end\r\n end\r\n end",
"def set_page_translation\n @page_translation = PageTranslation.find(params[:id])\n end",
"def set_definition_translation\n @definition_translation = DefinitionTranslation.find(params[:id])\n end",
"def encrypt_with(name, &block)\n @encryptor = get_class_from_scope(Encryptor, name).new(&block)\n end",
"def translate(keyword, language)\n if LOCALES[language.to_sym].nil?\n translations = LOCALES[:en]\n else\n translations = LOCALES[language.to_sym]\n end\n return translations[keyword]\nend",
"def translate!(text, *languages)\n languages = Translations.keys unless languages.any?\n languages = languages.flatten.map!(&:to_sym)\n languages.delete :en # remove :en translation from everywhere\n languages.push :en # to push it as the last one\n languages.each do |lang|\n Translations[lang] && Translations[lang].call(text)\n end\n text\n end",
"def set_langue\n @langue = Langue.find(params[:id])\n end",
"def set_language\n @language = Language.find(params[:id])\n end",
"def set_language\n @language = Language.find(params[:id])\n end"
] |
[
"0.6233308",
"0.6233308",
"0.60803765",
"0.55349505",
"0.5384758",
"0.5176296",
"0.5095139",
"0.49945453",
"0.49788138",
"0.49754748",
"0.494479",
"0.49301872",
"0.4921156",
"0.4905077",
"0.48527458",
"0.4826315",
"0.48260474",
"0.48055702",
"0.478637",
"0.47804967",
"0.47587115",
"0.47501758",
"0.47453117",
"0.47374818",
"0.4729984",
"0.47000852",
"0.46982965",
"0.4690401",
"0.46807107",
"0.46592608",
"0.4652556",
"0.46342862",
"0.46342862",
"0.46009153",
"0.4584084",
"0.45575988",
"0.45472685",
"0.4525964",
"0.4508935",
"0.44948778",
"0.44847474",
"0.4470795",
"0.4449784",
"0.4447618",
"0.44413695",
"0.44402227",
"0.44338956",
"0.4431386",
"0.44159397",
"0.44139874",
"0.4412835",
"0.44112206",
"0.44057518",
"0.43977177",
"0.4391565",
"0.43804133",
"0.43803713",
"0.43789783",
"0.43789694",
"0.4370534",
"0.43657595",
"0.435683",
"0.435683",
"0.43496928",
"0.4346176",
"0.4326288",
"0.43196002",
"0.43098402",
"0.4306614",
"0.43052503",
"0.43035367",
"0.4296583",
"0.42942747",
"0.42915004",
"0.4290631",
"0.42819375",
"0.42817923",
"0.42817923",
"0.42800096",
"0.42800096",
"0.42795083",
"0.4276427",
"0.42754263",
"0.4271139",
"0.42564335",
"0.42548296",
"0.424682",
"0.42465508",
"0.42427614",
"0.42427614",
"0.42415932",
"0.42380205",
"0.4237102",
"0.42361525",
"0.42357275",
"0.4234746",
"0.4232956",
"0.42317724",
"0.4230691",
"0.4230691"
] |
0.7462785
|
0
|
Method to translate the caption from one language to another +src_lang+ can be inferred using infer_language method +target_lang+ Target 2 letter ISO language code to which the source needs to be translated in to. +output_file+ Output file. Can be a fully qualified path or just file name ==== Raises InvalidInputException shall be raised if 1. The input file doesn't exist or is unreadable or is invalid caption 2. The output file can't be written 3. The target_lang is not a valid ISO 6391 Letter Language code
|
def translate(src_lang, target_lang, output_file)
# Check if a non empty output file is present and error out to avoid
# the danger or overwriting some important file !!
if File.exists?(output_file) && File.size(output_file) > 0
raise InvalidInputException.new("Output file #{output_file} is not empty.")
else
# Just open the file in writable mode and close it just to ensure that
# we can write the output file
File.open(output_file, "w") {|f|
}
end
# Check if the file is writable ?
unless File.writable?(output_file)
raise InvalidInputException.new("Output file #{output_file} not writable.")
end
# Further checks can be done only in caption specific implementations
# or translation engine specific implementation
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end",
"def myDeepl_translate(text, source_lang, target_lang)\n begin\n source = source_lang.to_s.upcase\n target = target_lang.to_s.upcase\n ret = DeepL.translate(text, source, target).to_s\n ret.chomp!(\".\") # Українська translation has often a dot in the end\n ret.sub!(/\"/, \"\") # Українська translation has sometimes double quote in the beginning\n ret.sub!(/。/, \"\") # one time seen, 日本語 translation added japanese dot in the end\n # puts \"translate #{source} \\”#{text}\\\" -> #{target} \\\"#{ret}\\\"\"\n return ret\n rescue DeepL::Exceptions::Error => exc\n puts \"DeepL translation failed #{exc.class} #{exc.message}\"\n end\n return nil\n end",
"def translate_input_text\n if self.language\n self.output_text = self.language.translate(self.input_text)\n else\n self.output_text = self.input_text\n end\n end",
"def translated_msg(translate, message, src_lang, target_lang)\n return message unless translate \n use_src = nil \n if (src_lang.nil? || src_lang.empty?)\n # We don't need to infer again and again\n begin\n @inferred_src_lang ||= infer_languages.first\n rescue StandardError => e \n raise LangDetectionFailureException.new(\"Failed to infer language due to #{e.message}\")\n end\n use_src = @inferred_src_lang\n else\n use_src = src_lang\n end\n return message if use_src.eql?(target_lang)\n @translator.translate(message, use_src, target_lang)\n end",
"def transform_to(types, src_lang, target_lang, output_dir)\n if (types - supported_transformations).size != 0\n raise InvalidInputException.new(\"Unknown types provided for conversion in input #{types}\")\n end\n unless File.directory?(output_dir)\n FileUtils.mkdir_p(output_dir)\n end\n # Basic validations\n if types.include?(TYPE_SCC)\n if target_lang && !target_lang.eql?(\"en\")\n raise InvalidInputException.new(\"SCC can be generated only in en. #{target_lang} is unsupported\")\n end\n end\n end",
"def translate_file(inp, literal=false)\n pn = Pathname.new(inp)\n # check file exists\n if pn.exist?\n # open and read\n text = File.open(inp).read\n ruleset = text.gsub(/\\r\\n?/, \"\\n\").split(\"\\n\") # split into rules\n out = \"\"\n # feed rules into converter and put output into variable\n ruleset.each { |rule| out << \"#{Phomo2Sce.new(rule).to_sce(literal)}\\n\" }\n out # return translated file\n else\n puts \"Error! Could not find file with path #{inp}\"\n end\nend",
"def convert_local_file input_file, output_filename, output_format\n begin\n\n raise('input file not specified') if input_file.empty?\n raise('output file not specified') if output_filename.empty?\n raise('output format not specified') if output_format.empty?\n\n str_uri = $product_uri + '/words/convert?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file, str_signed_uri)\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n return valid_output unless valid_output.empty?\n\n output_path = $out_put_location + output_filename\n Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)\n ''\n rescue Exception => e\n print e\n end\n end",
"def translate q, target=@target_lang, source=@source_lang\n return \"[#{source}->#{target}]#{q.to_s}\"\n end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def convert_local_file input_file,output_filename,output_format\n begin\n \n if input_file == \"\"\n raise(\"input file not specified\")\n end \n \n if output_filename == \"\"\n raise(\"output file not specified\")\n end\n \n if output_format == \"\"\n raise(\"output format not specified\")\n end\n \n str_uri = $productURI + \"/words/convert?format=\" + output_format\n str_signed_uri = Common::Utils.sign(str_uri)\n \n response_stream = Common::Utils.uploadFileBinary(input_file, str_signed_uri) \n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\"\n \n if output_format == \"html\"\n saveformat = \"zip\"\n else\n saveformat = output_format\n end\n \n if output_filename == \"\"\n output_filename = Utils::get_filename(input_file) + \".\" + saveformat\n end\n \n output_path = $OutPutLocation + output_filename\n Common::Utils.saveFile(response_stream,output_path)\n return \"\"\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"def convert(output_file, *opt)\n options = {}\n options.merge!(opt.pop) if !opt.empty? && opt.last.is_a?(Hash)\n\n converted = CaptionFile.open(output_file, options.merge(mode: 'w'))\n\n converted.print_header\n each_frame{|frame| converted.print_frame(frame)}\n converted.print_footer\n\n converted.close\n end",
"def convert_file filename, content, in_dir, out_dir, language\n # Convert the file\n converter = AutoHeathen::Converter.new( { logger: logger } )\n action = converter.get_action content.content_type\n logger.debug \" convert: #{File.basename(filename)}, content_type: #{content.content_type}, action: #{action}\"\n start_time = Time.now\n outfile, data = converter.convert action, language, filename, content\n logger.debug \" conversion took %0.2f s\"%[Time.now-start_time]\n\n # Save the file\n outfile = to_outfile in_dir, filename, out_dir, outfile\n logger.info \" writing file: #{outfile}\"\n File.open outfile, \"wb\" do |f|\n f.write data\n end\nend",
"def ensure_source_processed(translated_filename)\n return unless $SOURCE.empty?\n\n source_filename = File.dirname(translated_filename) + '/en.yml'\n source_contents = File.read(source_filename)\n original_source = YAML.safe_load(source_contents)\n convert_source('', original_source['en'])\nend",
"def convert_to_po( source_file_h = nil, base_file = nil, fuzzy_list = nil )\n return false unless english_header?\n\n # What we actually do depends on what was setup for us.\n # If source_file_h is nil and po_locale is nil, we are xgettext.\n # If source_file_h is nil and we have po_locale, we are msginit.\n # If we have a source_file_h, then we are msgunfmt.\n action = :msgunfmt\n action = :msginit if source_file_h.nil? && po_locale\n action = :xgettext if source_file_h.nil? && po_locale.nil?\n\n # lang_en serves as the master reference for all output, especially\n # comments and metadata.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n\n # untranslated_items serves as the source for *untranslated* strings.\n # This differs from lang_en in that we may overwrite some of the\n # lang_en strings from the base_file, later. This can help when\n # translating, e.g., regional formats.\n untranslated_items = lang_en.items.clone\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n untranslated_items.merge!(lang_base.items)\n end\n\n # We will use lang_source if we have a source_file_h, i.e., msgunfmt,\n # as the source for *translated* strings.\n if source_file_h\n lang_source = PoHeaderFile.new(source_file_h)\n return false unless lang_source.source_file\n else\n lang_source = nil\n end\n\n\n # If we were given a fuzzy_list and we have a source_file, then\n # we have to mark appropriate items as fuzzy.\n if fuzzy_list && fuzzy_list.count > 0 && lang_source\n untranslated_items.each do |key, value|\n if fuzzy_list.include?(key)\n value.each_value do |v|\n v[:fuzzy] = true\n end\n end\n\n end\n end\n\n # The information in the PO header can come from a few different sources\n # depending on what we're doing.\n header_plural_forms = nil\n header_pot_line = nil\n header_translate_to = nil\n\n if action == :xgettext\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_en.plural_count}; plural=#{lang_en.plural_form}\"\n header_pot_line = \"POT-Creation-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_en.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n\n end\n if action == :msginit\n header_plural_forms = \"Plural-Forms: #{known_locales[po_locale.to_sym][:plural_form]}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = po_locale\n end\n if action == :msgunfmt\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_source.plural_count}; plural=#{lang_source.plural_form}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_source.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n end\n\n header_plural_count = header_plural_forms.match(/nplurals=(.*?);/i)[1].to_i - 1\n\n # We'll use this closure to perform a repetitive task in the report.\n item_output = lambda do | label, string |\n result = ''\n if string.lines.count > 1\n result << \"#{label} \\\"\\\"\\n\"\n result << \"#{string}\\n\"\n else\n result << \"#{label} #{string}\\n\"\n end\n result\n end\n\n\n report = <<-HEREDOC\nmsgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Language: #{header_translate_to}\\\\n\"\n\"#{header_plural_forms}\\\\n\"\n\"X-Generator: HTML Tidy #{File.basename($0)}\\\\n\"\n\"Project-Id-Version: \\\\n\"\n\"#{header_pot_line}\\\\n\"\n\"Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\\\n\"\n\"Language-Team: \\\\n\"\n\n HEREDOC\n\n untranslated_items.delete(:TIDY_LANGUAGE)\n untranslated_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n untranslated_items.each do |key, value|\n\n if value['0'][:comment]\n value['0'][:comment].each_line { |line| report << \"#. #{line.strip}\\n\"}\n end\n\n attribs = []\n attribs << 'fuzzy' if value['0'][:fuzzy] && action == :msgunfmt\n attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) }\n if attribs.count > 0\n report << \"#, #{attribs.join(', ')}\\n\"\n end\n\n report << \"msgctxt \\\"#{key.to_s}\\\"\\n\"\n\n # Handle the untranslated strings, with the possibility that there\n # are two forms. PO/POT is English-based and supports only a singular\n # and plural form.\n value.each_value do | subitem |\n label = subitem[:case] == '0' ? 'msgid' : 'msgid_plural'\n report << item_output.(label, subitem[:string])\n end\n\n # Handle translated strings, with the possibility that there\n # are multiple plural forms for them.\n en_is_singular = value.count == 1\n\n if lang_source && lang_source.items[key]\n # Print translated strings.\n if en_is_singular\n report << item_output.( 'msgstr', lang_source.items[key]['0'][:string])\n else\n # Print available plural forms and write blanks for the rest.\n (0..header_plural_count).each do |i|\n if lang_source.items[key].has_key?(i.to_s)\n report << item_output.( \"msgstr[#{i}]\", lang_source.items[key][i.to_s][:string])\n else\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n else\n # Print empty translated strings.\n if en_is_singular\n report << \"msgstr \\\"\\\"\\n\"\n else\n (0..header_plural_count).each do |i|\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n\n report << \"\\n\"\n end # do\n\n if emacs_footer\n report << <<-HEREDOC\n# Local Variables:\n# mode: po\n# eval: (add-hook 'po-subedit-mode-hook '(lambda () (setq fill-column 78)))\n# End:\n HEREDOC\n end\n\n output_file = action == :xgettext ? 'tidy.pot' : \"language_#{header_translate_to}.po\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') { |f| f.write(report) }\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new file to #{File.expand_path(output_file)}\"\n true\n end",
"def get_translation(lang_code)\n # format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country lang_code\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language lang_code_cut\n return nil\n end\n\n # check if original text is in the new language\n unless original_text.nil?\n lang_code_original_cut = TranslationsHelper.cut_country original_text.lang_code\n\n if original_text.lang_code == lang_code\n return original_text.text\n elsif original_text.lang_code == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n elsif lang_code_original_cut == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_into_lang_code(lang_code)\n else\n add_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n\n return translate_into_lang_code(lang_code)\n else\n return trans.text\n end\n end",
"def translate_file(filename)\n f = File.read(filename)\n f = translate_title(f)\n f = translate_body(f)\n f = update_category(f)\n f\n end",
"def translate_into_lang_code(lang_code)\n unless lang_code.nil?\n # if the text is a speaking business card don't translate\n if original_text.text.start_with?('BEGIN:VCARD')\n text = original_text.text\n add_translation(text, lang_code)\n else\n require 'bing_translator'\n\n original_translation_code = TranslationsHelper.cut_country original_text.lang_code\n to_translation_code = TranslationsHelper.cut_country lang_code\n\n translator = BingTranslator.new(BING_CLIENT_ID_DEV, BING_CLIENT_SECRET_DEV)\n\n text = translator.translate original_text.text, :from => original_translation_code, :to => to_translation_code\n add_translation(text, lang_code)\n end\n\n return text\n end\n end",
"def create(projectid, file, filename, target_langs, options = {})\n payload = File.open(file, 'r')\n encoding = payload.external_encoding.to_s\n\n options[:targetLangs] = target_langs\n\n headers = {\n memsource: options.to_json,\n content_type: 'application/octet-stream',\n content_disposition: \"filename\\*=#{encoding}''#{filename}\"\n }\n\n path = \"#{Project::PATH}/#{projectid}/#{PATH}\"\n\n post(path, payload, headers: headers)\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def reversed_translation(from_lang, inter_lang, translation_service)\n translation = @translator.translate(translation_service, @translation_file.input_text, inter_lang, from_lang)\n doubled_translation = @translator.translate(translation_service, translation, from_lang, inter_lang)\n save_to_file(doubled_translation, \"reversed_#{inter_lang}_#{translation_service}\")\n end",
"def convert_local_file input_file,output_filename,output_format\n begin\n \n if input_file == ''\n raise('input file not specified')\n end \n \n if output_filename == ''\n raise('output file not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n if not File.exist?(input_file)\n raise(\"input file doesn't exist.\")\n end\n \n \n \n str_uri = $product_uri + '/pdf/convert?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file, str_signed_uri) \n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == ''\n \n if output_format == 'html'\n save_format = 'zip'\n else\n save_format = output_format\n end\n \n if output_filename == ''\n output_filename = Utils::get_filename(input_file) + '.' + save_format\n end\n \n output_path = $out_put_location + output_filename\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"def translate(source_copy)\n sentences = source_copy.split(\".\")\n words = sentences.map { |s| s.split(\" \") }\n currency_indexes = words.flatten.each_with_index.select { |w, i| w.match(/[#{currencies}]/) }.map { |_, i| i }\n to_return = if words.flatten.count == 1\n pseudo_word\n elsif sentences.count == 1\n pseudo_phrase(words.flatten.count)\n else\n pseudo_paragraph(words.map { |s| s.count })\n end\n add_currencies(to_return, currency_indexes)\n end",
"def transl8 (input,lang) #method to translate incoming text\n translate = Google::Cloud::Translate.new\n detection = translate.detect input.to_s\n #puts input + \"Looks like you're speak in #{detection.language}\"\n #puts \"Confidence: #{detection.confidence}\"\n #translation = translate.translate \"Hello world!\", to: \"la\"\n translation = translate.translate input.to_s, to: lang.to_s\n return \"In #{lang} that's \" + translation\nend",
"def to(lang)\n @target_lang = lang\n return self\n end",
"def gettext(username, password, input_text, output_code)\r\n default_src = 'en'\r\n default_action = 'translateREST'\r\n new_text = ''\r\n new_text = input_text\r\n new_text.gsub!(\"(\",\"<(\")\r\n new_text.gsub!(\")\",\")>\")\r\n new_array = new_text.split(/[<>]/)\r\n chash = Hash.new\r\n for i in 0..new_array.length-1\r\n if new_array[i][0..0] == \"(\"\r\n old_value = new_array[i]\r\n new_array[i] = \"!\"+i.to_s+\"!\"\r\n chash[new_array[i]] = old_value\r\n end\r\n end\r\n input_text = new_array.join\r\n # added new logic to split the file\r\n if input_text.length > 500 and not input_text.index(\"$-\")\r\n for i in 0..input_text.length/500-1\r\n x = input_text[0..500*(i+1)].rindex(/\\n/)\r\n input_text.insert(x+1, '$-')\r\n end\r\n end \r\n input_text = URI.escape(input_text)\r\n input_array = Array.new\r\n if input_text.index(\"$-\")\r\n input_array = input_text.split(\"$-\")\r\n else\r\n input_array[0] = input_text\r\n end\r\n # end of splitter logic\r\n result_all = \"\"\r\n for i in 0..input_array.length-1\r\n begin\r\n sleep 3 if i > 0\r\n raise UnSupportedLanguage unless SUPPORTED_LANG_CODES.include?(output_code)\r\n site_url = 'www.syslang.com'\r\n uri_method = '/frengly/controller?'\r\n uri_string = 'action='+default_action+'&src='+default_src+'&dest='+output_code+'&text='+input_array[i]+'&username='+username+'&password='+password\r\n response = Net::HTTP.get_response(site_url, uri_method + uri_string)\r\n if response.code == \"200\"\r\n xml_data = response.body\r\n data = XmlSimple.xml_in(xml_data)\r\n result = data[\"translation\"][0]\r\n chash.each {|key, value| result.gsub!(key, value) }\r\n result_all << result\r\n else\r\n puts response.body\r\n raise StandardError, response.body\r\n end\r\n rescue UnSupportedLanguage\r\n raise UnSupportedLanguage.new\r\n rescue => err_msg\r\n puts \"#{err_msg}\"\r\n end\r\n end\r\n result_all\r\n end",
"def convert_one(*args)\n raise \"x2t file is not found in #{@bin_path} path\" unless x2t_exist?\n output_file_path = \"#{@convert_to}/#{File.basename(args.first[:input_file], '.*')}.\" + args.first[:format_to]\n convert_file(args.first[:input_file], output_file_path, false)\n output_file_path\n end",
"def convert_to_h( file, base_file )\n\n po_content = PoPoFile.new(file)\n return false unless po_content.source_file && english_header? && header_template?\n\n # We will use English to ensure that no English strings are\n # included in the translation.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n filter_items = lang_en.items.clone\n\n # We will also filter out items that are already the same\n # in the base language, in order to keep Tidy small. It's\n # actually possible to miss some English strings if, for\n # some reason, the PO has English strings that the base\n # language does not, but severity * likelihood == unimportant.\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n filter_items.merge!(lang_base.items)\n end\n\n # We will hard code these into the generated file.\n filter_items.delete(:TIDY_LANGUAGE)\n filter_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n\n # Eliminate PO items if they match inherited items (in the filter), or\n # if they're not included in English (i.e., entries not used by Tidy).\n # We are comparing _complete entries_ right here, with the PO as the\n # official source. Therefore all plurals are accounted for, #IF groups,\n # and comments.\n po_content.items.reject! do |key, value|\n ( (filter_items.has_key?(key) && filter_items[key] == value) ) || !filter_items.has_key?(key)\n end\n\n # #if groups and comments:\n # We need to know which translated items belong in #if groups. Since we\n # don't store this metadata in the PO, find out which #if groups they\n # belong to from the original language_en.h.\n # Additionally we will only use comments from language_en.h. Besides\n # preventing us from having to format them, we ensure that only the\n # canonical comments are put into the H file in the event of changes.\n # Additionally only include comments if enabled.\n # Finally add fuzzy notes to comments if the PO item is fuzzy.\n po_content.items.each do |key, value|\n value.each_value do |item_entry|\n item_entry[:if_group] = lang_en.items[key]['0'][:if_group]\n item_entry[:comment] = force_comments ? lang_en.items[key]['0'][:comment] : nil\n item_entry[:comment] = \"(fuzzy) #{item_entry[:comment]}\" if item_entry[:fuzzy]\n end\n end\n\n\n # Gather some information to format this nicely, and perform\n # UTF escaping if necessary.\n longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST.\n longest_value = 10 # reasonable default in case no single-line strings are found.\n po_content.items.each do |key, value|\n longest_key = key.length if key.length > longest_key\n value.each_value do |value_inner|\n # If we're not plaintext then escape UTF sequences.\n unless plaintext\n value_inner[:string].gsub!(/[^\\u0000-\\u007e][0-9a-fA-F]?/) do |c|\n esc = c[0].bytes.map{ |b| '\\\\x' + b.to_s(16) }.join('')\n if c[1]\n esc += '\"\"' + c[1]\n end\n esc\n end\n end\n length = value_inner[:string].length\n longest_value = length if length > longest_value && !value_inner[:string].start_with?(\"\\n\")\n end\n end\n\n # Manually build the first line with the proper language code.\n report_body = \" {/* Specify the ll or ll_cc language code here. */\\n\"\n report_body << \" #{'TIDY_LANGUAGE,'.ljust(longest_key+2)}0, \\\"#{po_content.language}\\\"\\n\"\n report_body << \" },\\n\"\n\n # Generate the main header body. Although it's a machine-generated\n # document we still care that it's pretty-printed and readable. In\n # this respect we have four output formats: single line values;\n # single line values with developer comment; multiline values; and\n # multiline values with developer comment.\n if_group = nil\n po_content.items.each do |item_key, item_value|\n item_group = item_value[item_value.keys[0]][:if_group]\n unless item_group == if_group\n # The current if grouping has changed.\n unless if_group.nil?\n # Close current group.\n report_body << \"#endif /* #{if_group} */\\n\\n\"\n end\n if_group = item_group\n unless if_group.nil?\n # Open new group.\n report_body << \"\\n#if #{if_group}\\n\"\n end\n end\n\n # Handle each entry individually.\n item_value.each_value do |entry_value|\n if entry_value[:string].start_with?(\"\\n\")\n # Format a multiline value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n else\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n end\n entry_value[:string].lines.each do |line|\n report_body << \" #{line}\"\n end\n report_body << \"\\n },\\n\"\n else\n # Format a single line value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string]}\\n\"\n report_body << \" },\\n\"\n else\n # known issue: ljust doesn't work for certain unicode characters, so no pretty-printing, e.g., Chinese.\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string].ljust(longest_value+2)} },\\n\"\n end\n end\n end\n end # po_content.items.each\n\n # Close off current if_group if any, because there will\n # not be another state change to do so.\n unless if_group.nil?\n report_body << \"#endif /* #{if_group} */\\n\"\n end\n\n # Force the final closing line manually; can't count on PO. We\n # could add this to the template, but let's give it the same\n # pretty-printing as the other items.\n report_body_last = \" {/* This MUST be present and last. */\\n\"\n report_body_last << \" #{'TIDY_MESSAGE_TYPE_LAST,'.ljust(longest_key+2)}0, NULL\\n\"\n report_body_last << \" }\\n\"\n\n # We are going to use an external ERB template to build the report file.\n # Although it's trivial to hard-code all of the required text into this\n # method directly, it will be more convenient to keep an external file\n # synchronized with changes to language_en.h if we make changes.\n header_file = File.open(@@header_template) { |f| f.read }\n report = ERB.new(header_file).result(binding) # will use in-context vars.\n\n # Save\n output_file = \"language_#{po_content.language}.h\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') do |f|\n f.write \"\\uFEFF\" if plaintext # MSVC requires a BOM.\n f.write(report)\n end\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new header file to #{File.expand_path(output_file)}\"\n true\n end",
"def translate_name_into_lang_code(lang_code)\n unless lang_code.nil? and original_name.nil?\n original_name_translation_code = TranslationsHelper.cut_country(original_name.lang_code)\n to_name_translation_code = TranslationsHelper.cut_country(lang_code)\n\n translator = BingTranslator.new(BING_CLIENT_ID_DEV, BING_CLIENT_SECRET_DEV)\n\n text = translator.translate(original_name.text, :from => original_name_translation_code, :to => to_name_translation_code)\n add_name_translation(text, lang_code)\n\n text\n end\n end",
"def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end",
"def parse_lang_file\n # Open .lang file and parse it, then copy \n # its full grammatical expression.\n File.open(@lang_file, \"r:UTF-8\") do |file|\n lines_count = 1\n current = :none\n\n # Evaluating lines\n while (line = file.gets)\n # Parsing .lang file\n case line\n when /(^\\s*$)|(^\\s*#.*$)/\n # Ignore blank lines or comments\n \n when /^\\s*symbols\\s*for\\s*(\\w*)?\\s*(\\w+)\\s*:\\s*(#.*)?$/\n # Create new symbol set\n captured = line.scan(/\\s*(\\w+)\\s*:/)\n current_binding = captured[0][0]\n @bindings[current_binding] = ConlangWordGenerator::SymbolSet.new\n current = :symbols\n\n when /^\\s*expression\\s*:\\s*(#.*)?$/\n # Start of grammatical expression\n current = :expression\n\n when /^\\s*replacements\\s*:\\s*(#.*)?$/\n # Start of list of replacements\n current = :replacements\n\n when /^\\s*(\\S+)\\s*[:=]\\s*(\\S+)\\s*(#.*)?$/\n # Add bindings\n case current\n when :symbols\n #Add a symbol to the current SymbolSet's binding\n @bindings[current_binding].add_pair($1, $2.to_i)\n when :replacements\n @replacements[$1] = $2\n else\n raise LangSyntaxError, \"Runtime error when evaluating \" +\n \"\\\"#{@lang_file}\\\" at binding line #{lines_count}.\"\n end\n else\n if current == :expression\n # Copying expression\n @full_expression += line.strip\n else\n raise LangSyntaxError, \"Runtime error when evaluating \" +\n \"\\\"#{@lang_file}\\\" at line #{lines_count}.\"\n end\n end\n\n #Counting lines\n lines_count += 1\n end\n end\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def get_name_translation(lang_code)\n #format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country(lang_code)\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language(lang_code_cut)\n return nil\n end\n\n # check if original text is in the new language\n unless original_name.nil?\n lang_code_original_cut = TranslationsHelper.cut_country(original_name.lang_code)\n\n if original_name.lang_code == lang_code\n return original_name.text\n elsif original_name.lang_code == lang_code_cut\n add_name_translation(original_name.text, lang_code)\n return original_name.text\n elsif lang_code_original_cut == lang_code_cut\n add_name_translation(original_name.text, lang_code)\n return original_name.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = name_translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = name_translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_name_into_lang_code(lang_code)\n else\n add_name_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n else\n trans.text\n end\n end",
"def original_to_translation(language, original)\n\t\t\t\t\t\tload_cache(language)\n\t\t\t\t\t\treturn @o2t[language.to_sym][original.to_s]\n\t\t\t\t\tend",
"def test_identify_language_from_filename\n filename = 'one.fp'\n femp = Locale.new('femp', 'fp', 'fpt')\n curriculum.add(femp, %w(one two))\n assert_equal 'femp', curriculum.identify_language('femp.fp')\n end",
"def translate(*args, **opts); end",
"def prepare_label_for_translator(label)\n validate_language_rule\n \n substitution_value = \"\" \n substitution_value << sanitized_name if allowed_in_translation?\n substitution_value << \" \" unless substitution_value.blank?\n substitution_value << language_rule.default_transform(self, piped_params)\n \n label.gsub(full_name, substitution_value) \n end",
"def sourceToTarget(source_file)\n\t\tsrc_ext = File.extname source_file\n\t\ttarg_ext = case src_ext\n\t\t\twhen '.mli' \n\t\t\t\t'.cmi'\n\t\t\twhen '.ml' \n\t\t\t\tcase @compiler \n\t\t\t\t\twhen @@byteCodeCompiler\n\t\t\t\t\t\t'.cmo'\n\t\t\t\t\twhen @@machineCodeCompiler\n\t\t\t\t\t\t'.cmx'\n\t\t\t\tend\n\t\t\telse \n\t\t\t\tputs \"ERROR couldn't deduce dependency ext: \" + source_file\n\t\t\t\treturn 'ERROR'\n\t\tend\n\t\treturn changeExt(source_file, targ_ext)\n\tend",
"def targetToSource(target_file)\n\t\ttarget_ext = File.extname(target_file)\n\t\tsource_ext = case target_ext\n\t\t\twhen '.cmo' then '.ml'\n\t\t\twhen '.cmx' then '.ml'\n\t\t\twhen '.cmi' then '.mli'\n\t\t\telse puts \"ERROR couldn't deduce dependency ext: \" + target_ext\n\t\tend\n\t\treturn changeExt(target_file, source_ext)\n\tend",
"def translation_of(text, options)\n src = options[:from]\n dst = options[:to]\n raise \":from and :to are mandatory in method translation_of\" if src.nil? || dst.nil?\n\n diconame = \"#{src}_#{dst}\".to_sym\n dico = @dicts[diconame]\n if dico.is_a? String\n dico = [ dico ]\n end\n if @data[diconame].nil? && dico\n dico.each do |name|\n dico_name_ext = \"#{src}_#{dst}_dict_#{name}\"\n data = load_dictionnary(dico_name_ext).symbolize_keys\n if @data[diconame].nil?\n @data[diconame] = data[diconame]\n else\n @data[diconame].merge! data[diconame]\n end\n end\n end\n tn = @data[diconame][text] if @data[diconame]\n if tn.nil? && google?\n tn = @tr.translate :text => text, :from => src, :to => dst\n end\n if tn.nil? || tn.empty? || tn == text\n tn = text\n if @strict\n tn = \"NT - #{text}\"\n end\n end\n tn\n end",
"def convert(output, args={})\n tokens = [\"convert\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{args[:annotate].to_s}\" if args[:annotate]\n tokens << \" #{output}\"\n tokens = convert_to_command(tokens)\n success = run(tokens)[1]\n success\n end",
"def create(name, source_lang, target_langs, options = {})\n options[:name] = name\n options[:sourceLang] = source_lang\n options[:targetLangs] = target_langs\n post(PATH, options)\n end",
"def update!(**args)\n @source_language_code = args[:source_language_code] if args.key?(:source_language_code)\n @target_language_code = args[:target_language_code] if args.key?(:target_language_code)\n end",
"def localize(ios, src)\n index = 0\n lngs = []\n ios << \"\\ncase ctx.best_language \"\n code = StringIO.new\n while index = src.index(/<[a-z]{2}>/, index)\n lngs << (lng = src[index + 1, 2].to_sym)\n if end_index = src.index(/<\\/#{lng}>/, index += 4)\n code << \"\\nwhen #{lng.inspect} then\"\n compile(code, src[index...end_index])\n index = end_index + 5\n end\n end\n ios << \"#{lngs.inspect.gsub(/ /, '')}#{code.string}\\nend\"\n end",
"def assert_file_named_correctly!(file, translations); end",
"def translator(file)\n #Opens the file\n text = File.read(file)\n #Check the content for any non vocals -> adds an o and the non vocal instead\n replace = text.gsub!(/([bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ])/, '\\1o\\1')\n #Replace the original content with translated content\n File.open(file, \"w\") {|z| z.puts replace}\nend",
"def create_translation(other)\n end",
"def basic_transform (filenameIn,filenameOut)\r\n @inputFilename = filenameIn\r\n @outputFilename = filenameOut\r\n self.with_document_do(filenameIn) { |doc| \r\n File.open(filenameOut,'w'){ |target| \r\n @output = target\r\n self.apply doc\r\n }\r\n }\r\n end",
"def translate(input, options = {})\n locale = options['locale'] || self.current_locale\n scope = options.delete('scope')\n key = scope.present? ? \"#{scope.gsub('.', '_')}_#{input}\" : input\n\n key = \"#{key}_#{pluralize_prefix(options['count'])}\" if options['count']\n\n values = find_values_by_key(key)\n\n # FIXME: important to check if the returned value is nil (instead of nil + false)\n # false being reserved for an existing key but without provided translation)\n if (translation = values[locale.to_s]).present?\n _translate(translation, options)\n elsif output = I18n.t(input, scope: scope&.split('.'), locale: locale, default: nil)\n output\n else\n Locomotive::Common::Logger.warn \"Missing translation '#{input}' for the '#{locale}' locale\".yellow\n ActiveSupport::Notifications.instrument('steam.missing_translation', input: input, locale: locale)\n input\n end\n end",
"def clean_from_lang(inputpath, keep_lang, outputpath)\n\n input_file = File.read(inputpath)\n\n File.open(outputpath, \"wb\") do |outputFile|\n #Go through the ontology file line by line\n input_file.each_line do |line|\n\n # Remove all lines that have a xml:lang different from keep_lang\n regex_get_lang = line.scan(/<.* xml:lang=\"([a-z]*)\">(.*?)<\\/.*>/)\n if regex_get_lang.any?\n if regex_get_lang[0][0] != keep_lang\n line = \"\"\n end\n end\n\n outputFile.write(line)\n end\n end\n\nend",
"def run(input)\n if !input or input.strip.empty?\n raise ArgumentError, 'No input specified'\n end\n\n language = language_from_kaf(input)\n\n unless LANGUAGE_ENDPOINTS[language]\n raise Core::UnsupportedLanguageError, language\n end\n\n endpoint = uri_for_language(language)\n input_io = StringIO.new(input)\n reader = Java::java.io.InputStreamReader.new(input_io.to_inputstream)\n document = Java::ixa.kaflib.KAFDocument.create_from_stream(reader)\n annotator = new_annotator\n\n annotator.disambiguateNEsToKAF(document, endpoint)\n\n return document.to_string\n end",
"def current_language=(new_lang)\n if loaded_languages.include? new_lang.to_sym\n @@current_language = new_lang.to_sym\n else\n raise LangFileNotLoaded.new(new_lang, loaded_languages)\n end\n end",
"def current_language=(new_lang)\n if loaded_languages.include? new_lang.to_sym\n @@current_language = new_lang.to_sym\n else\n raise LangFileNotLoaded.new(new_lang, loaded_languages)\n end\n end",
"def from(lang)\n @source_lang = lang\n return self\n end",
"def translate(eng_word) # here call to Max's ending code\n Multitran.translate(eng_word)\n end",
"def get_language_filename( source, use_locale = false )\n before_substring = source.slice(0,(source.rindex(\".\") ))\n after_substring = source.slice(source.rindex(\".\"), (source.size - before_substring.size) )\n if use_locale\n return \"#{before_substring}-#{GettextLocalize.locale.to_s}#{after_substring}\"\n else\n return \"#{before_substring}-#{GettextLocalize.locale.to_s[0,2]}#{after_substring}\"\n end\n end",
"def translate(file)\n \n basename = File.basename(file)\n candidates = []\n test_filename = nil\n case file\n when %r:^app/controllers/:\n test_filename = file.sub('.rb', '_test.rb').sub('app/controllers', 'test/functional')\n when %r:^app/models/:\n test_filename = \"test/unit/#{basename.sub('.rb', '_test.rb')}\"\n when %r:^app/views/:\n file = file.sub('app/views/', '')\n directory = file.split('/')[0..-2].compact.join('/')\n test_filename = \"test/functional/#{directory}_controller_test.rb\"\n when %r:^test/:\n test_filename = file\n when %r:^lib/:\n # map libs to units\n test_filename = \"test/unit/#{file.sub('lib/', '').sub('.rb', '_test.rb')}\"\n when 'config/routes.rb'\n test_filename = \"test/functional/#{basename.sub('.rb', '_test.rb')}\"\n #candidates << 'controllers' << 'helpers' << 'views'\n when 'config/database.yml', 'db/schema.rb'\n #candidates << 'models'\n else\n #\n end\n if test_filename and file_verified?(test_filename)\n candidates << test_filename\n end\n if candidates == []\n puts \"=> NOTICE: could not find test file for: #{file}\" if Bolt.verbose?\n end\n # puts candidates.inspect\n candidates\n end",
"def translate(file)\n \n basename = File.basename(file)\n candidates = []\n test_filename = nil\n case file\n when %r:^app/controllers/:\n test_filename = file.sub('.rb', '_test.rb').sub('app/controllers', 'test/functional')\n when %r:^app/models/:\n test_filename = \"test/unit/#{basename.sub('.rb', '_test.rb')}\"\n when %r:^app/views/:\n file = file.sub('app/views/', '')\n directory = file.split('/')[0..-2].compact.join('/')\n test_filename = \"test/functional/#{directory}_controller_test.rb\"\n when %r:^test/:\n test_filename = file\n when %r:^lib/:\n # map libs to units\n test_filename = \"test/unit/#{file.sub('lib/', '').sub('.rb', '_test.rb')}\"\n when 'config/routes.rb'\n test_filename = \"test/functional/#{basename.sub('.rb', '_test.rb')}\"\n #candidates << 'controllers' << 'helpers' << 'views'\n when 'config/database.yml', 'db/schema.rb'\n #candidates << 'models'\n else\n #\n end\n if test_filename and file_verified?(test_filename)\n candidates << test_filename\n end\n if candidates == []\n puts \"=> NOTICE: could not find test file for: #{file}\"\n end\n # puts candidates.inspect\n candidates\n end",
"def translate_and_write_page(source_page, tos, from, overwrite)\n if File.exist?(source_page)\n STDERR.puts \"Translating: #{source_page}\"\n else\n STDERR.puts \"Could not find file: #{source_page}\"\n return\n end\n \n if !translate_file?(source_page)\n STDERR.puts \"Not translating file: #{source_page}\"\n return\n end\n \n text = IO.read(source_page)\n \n begins_with_html = text['<html>']\n \n # Pull out all the code blocks so Google doesn't mess with those\n pattern = /\\<\\%.+\\%\\>/\n holder = '{{---}}'\n replacements = text.scan(pattern)\n text.gsub!(pattern, holder)\n \n # Pull out all the new lines so Google doesn't mess with those\n pattern = /\\n/\n newline_holder = '<brr />'\n newline_replacements = text.scan(pattern)\n text.gsub!(pattern, newline_holder)\n \n # Send to Google for translations\n translations = Babelphish::Translator.multiple_translate(text, tos, from)\n \n # Put the code back\n translations.each_key do |locale|\n replacements.each do |r|\n if translations[locale]\n translations[locale].sub!(holder, r)\n else\n STDERR.puts \"Unable to location translation for: #{locale} (From was #{from}. If they match then no translation was generated).\"\n end\n end\n end\n \n # Put the newlines back in\n translations.each_key do |locale|\n newline_replacements.each do |r|\n if translations[locale]\n translations[locale].sub!(newline_holder, r)\n if translations[locale]['<html>']\n # Google translate can insert '<html>' at the beginning of the result. Remove it.\n translations[locale]['<html>']= '' unless begins_with_html\n end\n end\n end\n end\n \n # Write the new file\n translations.each_key do |locale|\n translated_filename = get_translated_file(source_page, locale)\n if (locale != from) && (overwrite || !File.exists?(translated_filename))\n File.open(translated_filename, 'w') { |f| f.write(translations[locale]) }\n end\n end\n\n end",
"def translate(args)\n Config.instance.translate(args.first)\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def deliver(iSrcFileName, iDstFileName, iFormatConf, iMetadata)\n # TODO: Implement it using an external tool, and make regression testing\n lTranslatedParams = []\n iParams.each do |iParam, iValue|\n case iParam\n when :SampleRate\n lTranslatedParams << \"Sample rate: #{iValue} Hz\"\n when :BitRate\n lTranslatedParams << \"Bit rate: #{iValue} kbps\"\n else\n log_warn \"Unknown MP3 format parameter: #{iParam} (value #{iValue.inspect}). Ignoring it.\"\n end\n end\n puts \"Convert file #{iSrcFileName} into file #{iDstFileName} in MP3 format with following parameters: #{lTranslatedParams.join(', ')}\"\n puts 'Press Enter when done.'\n $stdin.gets\n end",
"def translate_translate_text project_id:, text:, language_code:\n # [START translate_translate_text]\n # project_id = \"Your Google Cloud project ID\"\n # text = \"The text you would like to translate\"\n # language_code = \"The ISO 639-1 code of language to translate to, eg. 'en'\"\n\n require \"google/cloud/translate\"\n\n translate = Google::Cloud::Translate.translation_v2_service project_id: project_id\n translation = translate.translate text, to: language_code\n\n puts \"Translated '#{text}' to '#{translation.text.inspect}'\"\n puts \"Original language: #{translation.from} translated to: #{translation.to}\"\n # [END translate_translate_text]\nend",
"def run(input)\n lang = language_from_kaf(input)\n model = File.join(models, \"#{lang}.bin\")\n\n raise(Core::UnsupportedLanguageError, lang) unless File.file?(model)\n\n kaf = new_kaf_document(input)\n properties = build_properties(lang, model)\n annotator = Java::eus.ixa.ixa.pipe.nerc.Annotate.new(properties)\n\n annotator.annotate_kaf(enable_time, kaf)\n end",
"def fill_file_ios(language, translations)\n translations[:filename] = language.to_s.downcase + \".lproj/\" + \"Localizable.strings\"\n file = translations[:file]\n\n # Header\n file.puts \"/*\"\n file.puts \" Localizable.strings\"\n file.puts \" \" + @project.name\n file.puts \"\"\n file.puts \" Created on Translate Community on \" + Time.new.strftime(\"%d.%m.%y\")\n file.puts \"*/\"\n file.puts \"\"\n\n # Content\n translations.each do |key, value|\n unless key == :file or key == :filename\n file.puts \"\\\"\" + key.gsub(/[^\\\\]\"|^\"/) { |s| (s.size > 1 ? s.first : \"\") + \"\\\\\\\"\"} + \"\\\" = \\\"\" + value[:value].gsub(/[^\\\\]\"|^\"/) {|s| (s.size > 1 ? s.first : \"\") + \"\\\\\\\"\"} + \"\\\";\"\n end\n end\n\n file.close\n end",
"def update(target, *source_paths)\n patterns = Parser.new(*source_paths).patterns[:simple]\n LocaleFile.new(target).update(patterns)\n end",
"def convert\n \n # People might forget the trailing slash\n @options[:output_dir] = @options[:output_dir] + \"/\" unless @options[:output_dir].end_with?(\"/\")\n \n # Make sure that the output directory exits\n if !File.directory? @options[:output_dir] \n $LOG.info(\"Creating output directory #{@options[:output_dir]}...\")\n Dir.mkdir(@options[:output_dir])\n end\n \n # Array for storing ESE file pointers\n source_ese_files = []\n \n # If source ESE files are provided in batch mode (in a text file) ...\n unless @options[:batch_file] == nil\n # .. read the file line by line and extract the file location\n File.open(@options[:batch_file], \"r\") do |batch_file| \n # each line should point to a file path\n while path = batch_file.gets\n source_ese_files << path.chomp\n end\n end\n else\n # .. just take the source files provided on the command line\n source_ese_files = @files2convert\n end\n\n $LOG.info(\"Converting #{source_ese_files.size} ESE XML files to EDM RDF/XML...\")\n \n converted_files = []\n # Convert each ESE file individually\n source_ese_files.each do |source_file|\n \n unless File.exists?(source_file)\n $LOG.error(\"Cannot access source file #{source_file}. Exiting conversion process.\")\n return\n end\n \n # convert the file\n converted_file = transform(source_file, @options[:stylesheet], @options[:output_dir], @options[:base_uri], @options[:pretty_print])\n converted_files << converted_file\n \n end\n \n $LOG.info(\"*** Finished RDF/XML conversion *** Transformed #{source_ese_files.size} ESE XML files to EDM RDF/XML.\")\n \n # create an N-Triples dump if requested so\n if @options[:dump]\n \n $LOG.info(\"Merging created RDF/XML files into N-TRIPLES dump file: #{@options[:nt_dump_file]} ...\")\n \n create_NT_dump(converted_files, @options[:output_dir], @options[:nt_dump_file])\n \n $LOG.info(\"*** Finished N-TRIPLES dumping *** Dumped #{source_ese_files.size} RDF/XML files into #{@options[:nt_dump_file]}\")\n \n end\n \n end",
"def convert(phraseapp_file_format)\n case phraseapp_file_format\n when \"nested_json\"\n \"json\"\n when \"yml\"\n \"yml\"\n else\n raise ArugmentError.new(\"Unsupported type: #{phraseapp_file_format}\")\n end\n end",
"def modify(source, target, modify_parameters = {})\n raise ArgumentError, \"Source and Target are the same file: #{target}\" if source == target\n source = check_source(source)\n raise Exceptions::FileAlreadyExistsError, \"Target exists: #{target}\" if File.exist? target\n raise Exceptions::InvalidTargetMediaTypeError, 'Cannot convert to .wac' if File.extname(target) == '.wac'\n\n target = target.to_s if target.is_a?(Pathname)\n\n source_info = info(source)\n\n check_offsets(source_info, @audio_defaults.min_duration_seconds, @audio_defaults.max_duration_seconds, modify_parameters)\n check_sample_rate(target, modify_parameters, source_info)\n\n modify_worker(source_info, source, target, modify_parameters)\n end",
"def create\n @user = current_user\n @project = Project.find(params[:project_id])\n @preferedlang = Language.find_by_id(@project.source_lang_id)\n @slanguages = Language.where(\"id != ?\", @preferedlang.id).order('iso_code asc') \n @slanguages.unshift(@preferedlang)\n #from railsrecipes recipe 22 - refactor\n # @user = current_user\n\n\n @mostpopulartarlang = Language.find_by_id(@project.translations.maximum(\"source_lang_id\"))\n if @mostpopulartarlang\n @tlanguages = Language.where(\"id != ?\", @mostpopulartarlang.id).order('iso_code asc')\n @tlanguages.unshift(@mostpopulartarlang)\n else\n @tlanguages = Language.order('iso_code desc')\n end\n\n\n @translation = @project.translations.build(params[:translation])\n @translation.owner_id = @user.id\n\n# @project = Project.find(params[:id])\n\n# @translation = Translation.new(params[:translation])\n# @translation.owner_id = current_user.id\n# @translation.project_id = Project.find_by_id(params[:project_id]).id\n # @user = User.find(params[:user_id])\n # @project = Project.find(params[:project_id])\n # @translation = Translation.new(params[:translation])\n # @project = current_user.projects.build\n # @translation = @project.translations.build\n # @user = current_user\n # @project = Project.find_by_user_id(@user)\n # @translation = @project.translations.build(params[:translation])\n @languages = Language.all(:order => 'iso_code')\n # #process information from checkbox\n\n if @translation.save\n flash[:notice] = \"Translation was successfully created\"\n # redirect_to user_project_translations_path(@user, @project)\n redirect_to user_project_path(current_user, @project)\n else\n render 'new'\n end\nend",
"def add_key i18n_prj, input, select_from_translations\n v, quote = input.unquote\n\n if select_from_translations\n items = i18n_prj.potential_i18n_keys v\n if items.empty?\n TextMate::UI.tool_tip \"Can not find tranlation key\"\n else\n k = TextMate::UI.request_item \\\n :title => \"Select Translation Key\",\n :prompt => 'Select Translation Key',\n :items => items\n if !k\n TextMate::UI.tool_tip \"Canceled\"\n end\n end\n return input if !k\n else # new translation if needed\n v.gsub! '.', ''\n k = v[0..0].downcase + v[1..-1].underscore\n full_k = \"#{i18n_prj.key_prefix}.#{k}\"\n if i18n_prj.no_translation(full_k)\n new_k = TextMate::UI.request_string \\\n :default => full_k,\n :title => \"New Translation Key\"\n return input if new_k.nil? or new_k.empty?\n if new_k != full_k\n full_k = new_k\n k = new_k\n else\n k = '.' + k\n end\n insert_translation i18n_prj.en_yml_path, full_k, v\n else\n TextMate::UI.tool_tip \"Translation key '#{full_k}' exists\"\n k = '.' + k\n end\n end\n\n # snippet\n file_type = i18n_prj.file_type\n if quote or file_type == 'rb'\n %Q|t(#{k.inspect})|\n else\n case file_type\n when 'slim'; quote ? %Q|t(#{k.inspect})| : %Q|= t(#{k.inspect})|\n when 'haml'; quote ? %Q|t(#{k.inspect})| : %Q|= t(#{k.inspect})|\n else %Q|<%= t #{k.inspect} %>|\n end\n end\nend",
"def translation\n @translation ||= Mongify::Translation.parse(@translation_file)\n end",
"def translate(text:, from: nil, to:, **opts) # rubocop:disable Lint/UnusedMethodArgument, Metrics/LineLength\n raise NotImplementedError\n end",
"def rgettext(targetfiles = nil, out = STDOUT)\n RGetText.run(targetfiles, out)\n self\n end",
"def speakIntoFiles(spanishText, germanText, englishText)\n @spanishText = spanishText\n @germanText = germanText\n @englishText = englishText\n\n\n readingSpeedES = 140\n readingSpeedDE = 180\n readingSpeedEN = 140\n\n spanishVoice = \"Jorge\"\n germanVoice = \"Markus\"\n englishVoice =\"Susan\"\n\n # we set the character length of the file name\n # languageFileDE = \"#{germanText[0,55]}\"\n languageFileES = \"#{spanishText[0,20].chomp}\"\n languageFileEN = \"#{englishText[0,20].chomp}\"\n languageFileDE = \"#{germanText[0,20].chomp}\"\nputs `say -v #{spanishVoice} -r #{readingSpeedES} \"#{spanishText}\" -o \"#{languageFileES}\".aif`\nputs `say -v #{germanVoice} -r #{readingSpeedDE} \"#{germanText}\" -o \"#{languageFileDE}\".aif`\nputs `say -v #{englishVoice} -r #{readingSpeedEN} \"#{englishText}\" -o \"#{languageFileEN}\".aif`\nend",
"def translate(overwrite_user_edited_translations = false, translate_to = nil)\n translate_to ||= MuckContents.configuration.translate_to\n return if translate_to.blank?\n \n title_translations = Babelphish::Translator.multiple_translate(self.title, translate_to, self.locale)\n body_translations = Babelphish::Translator.multiple_translate(self.body, translate_to, self.locale)\n existing_translations = {}\n self.content_translations.each do |translation|\n existing_translations[translation.locale] = translation\n end\n \n translate_to.each do |language|\n if translation = existing_translations[language]\n if !translation.user_edited || overwrite_user_edited_translations\n translation.update_attributes!(:title => title_translations[language],\n :body => body_translations[language])\n end\n else\n self.content_translations.create!(:title => title_translations[language],\n :body => body_translations[language],\n :locale => language)\n end\n end\n end",
"def translate(input)\n\tinputArray = input.downcase.split(\" \")\n\tanswerArray = []\n\tvowelList = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"]\n\tcurrentWordNum = 0\n\tcurrentLetterNum = 0\n\tnumberOfWords = inputArray.length - 1\n\tcurrentWordStr = inputArray[currentWordNum].to_s\n\tcurrentWordLength = currentWordStr.length - 1\n\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\twhile currentWordNum <= numberOfWords\n\n\t\twhile currentLetterNum <= currentWordLength\n\n\t\t\t#if vowelList.include? currentLetterStr == true\n\t\t\tif currentLetterStr.among?vowelList\n\n\t\t\t\tpreviousLetterNum = currentLetterNum - 1\n\t\t\t\tpreviousLetterStr = inputArray[currentWordNum][previousLetterNum].to_s\n\n\t\t\t\tif currentLetterNum == 0\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = currentWordStr + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telsif previousLetterStr == \"q\"\n\t\t\t\t\t#quiet = ietquay\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\ttempLetterNum = currentLetterNum + 1\n\t\t\t\t\tnewWordPrefix = currentWordStr[tempLetterNum..currentWordLength]\n\t\t\t\t\t\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..currentLetterNum]\n\n\t\t\t\t\tputs \"newWordPrefix = \" + newWordPrefix\n\t\t\t\t\tputs \"newWordSuffix = \" + newWordSuffix\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telse\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordPrefix = currentWordStr[currentLetterNum..currentWordLength]\n\t\t\t\t\ttempLetterNum = currentLetterNum - 1\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..tempLetterNum]\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\t\t\t\tend\n\n\t\t\telse\n\n\t\t\t\tcurrentLetterNum = currentLetterNum + 1\n\t\t\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\t\t\tend\n\n\t\tend\n\n\t\tcurrentWordNum = currentWordNum + 1\n\n\t\tif currentWordNum > numberOfWords\n\t\t\tbreak\n\t\tend\n\n\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t# puts \"currentWordStr = \" + currentWordStr.to_s\n\n\t\tcurrentWordLength = currentWordStr.length - 1\n\t\t# puts \"currentWordLength = \" + currentWordLength.to_s\n\t\tcurrentLetterNum = 0\n\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\tend\n\n\tanswer = answerArray.join(' ')\n\tputs answer\n\treturn answer\nend",
"def translate(word)\n\n @word_to_translate = word.split(/ /)\n @whole_sentence = []\n @vowels = \"aeiouy\"\n @output = \"\"\n\n#Première boucle pour récupérer tous les mots dans un array\n @word_to_translate.each do |x|\n @whole_sentence << x\n end\n\n#Ensuite je boucle sur chaque mot de cet array\n#Et j'effectue des tests sur les premières lettres\n\n# Plusieurs cas\n# 1- le mot commence par une voyelle donc\n# on rajoute juste ay à la fin\n# 2 - La 1ère lettre est un Q suivi de U\n#2bis ou SQU alors je considère également le tout comme une consonne\n# 3 - Trois consonnes\n# 4 - Deux consonnes\n# 5 - Une consonne\n\n#C'est très compliqué pour rien\n#Il aurait mieux fallu faire des cas\n\n\n@whole_sentence.each do |word_to_translate|\n\n @first_char = word_to_translate[0]\n @second_char = word_to_translate[1]\n @third_char = word_to_translate[2]\n @text_length = word_to_translate.length\n @new_word = word_to_translate\n @qu = @first_char + @second_char + @third_char\n if @vowels.include?(@first_char)\n #Ici on commence par une voyelle\n\n elsif @qu.include?(\"qu\")\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n\n @index = @new_word.index(\"q\")\n if @index >=1\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[@index+2..-1]\n else\n @new_word = @new_word[@index+2..-1]\n end\n\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char)|| @vowels.include?(@third_char))\n\n#Ici on commence par trois consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[3..-1]\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char))\n\n#Ici on commence par deux consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word = @new_word[2..-1]\n\n\nelse\n @new_word[@text_length] = @first_char\n @new_word = @new_word[1..-1]\n #Ici on commence par une consonne\n\nend\n\n@new_word += \"ay\"\n@output += @new_word + \" \"\nend\n\nreturn @output.chomp(\" \")\n#return @index\nend",
"def convertFile(inputName, outputName)\n # output file\n outputFile = File.open(outputName, \"w\")\n\n # input file\n File.open(inputName, \"r\") do |inputFile|\n pattern = /^(\\S+?,){#{READ_FORM_INDEX}}/\n while line = inputFile.gets\n startIndex = line[pattern].size\n endIndex = line.index(',', startIndex)\n\n x = startIndex\n while x < endIndex do\n kata = line[x,2]\n if $kataHira[kata]\n line[x,2] = $kataHira[kata]\n else\n puts \"line: #{inputFile.lineno}, unkown katakana: #{kata}\"\n end\n x += 2\n end\n\n outputFile.puts line\n end\n end\n\n outputFile.close\nend",
"def convert_msg filename, in_dir, out_dir\n new_filename = to_outfile in_dir, filename, out_dir, filename.gsub( /.msg$/, '.eml' )\n rv = Heathen::Executioner.new(logger).execute( \"#{File.dirname __FILE__}/msgconvert.pl\", filename, new_filename )\n raise \"Cannot run msgconvert.pl (see README.md for installation instructions\" if rv != 0\n raise \"Failed to convert #{filename} to .eml\" unless File.exist? new_filename\n new_filename\nend",
"def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end",
"def translate(input_word)\n input_word.gsub(self.match_word, self.replacement_word)\n end",
"def alb_convert data_type, target, model_script=nil\n case data_type \n when 'ltspice'\n cdraw2target target, 'cdraw', File.expand_path(target), model_script\n if target == 'qucs'\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'eeschema'\n Dir.chdir('eeschema'){\n eeschema2alb_back\n }\n elsif target == 'xschem'\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n end\n when 'eeschema'\n alb2eeschema 'cdraw', File.expand_path('eeschema')\n if target == 'qucs'\n eeschema2qucs 'eeschema', File.expand_path('qucs')\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'xschem'\n eeschema2xschem 'eeschema', File.expand_path('xschem')\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n elsif target == 'ltspice'\n eeschema2cdraw 'eeschema', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'xschem'\n if target == 'qucs'\n xschem2qucs 'cdraw', File.expand_path('qucs')\n elsif target == 'xschem'\n alb2xschem 'cdraw', File.expand_path('xschem')\n elsif target == 'eeschema'\n xschem2eeschema 'cdraw', File.expand_path('eeschema')\n elsif target == 'ltspice'\n alb2xschem 'cdraw', File.expand_path('xschem')\n xschem2cdraw 'xschem', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'qucs'\n if target == 'qucs'\n alb2qucs 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'eeschema'\n qucs2eeschema 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'xschem'\n qucs2xschem 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'ltspice'\n qucs2cdraw nil, self.project.name, File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n end\n end",
"def fix(input)\n data = open(input, \"r\").read\n data.gsub! \"≤\", \"\\\\leq\"\n data.gsub! \"×\", \"\\\\times\"\n data.gsub! \"≠\", \"\\\\neq\"\n\n translators = data.split(\"\\n\")[-1].strip()[3..-1].split(\", \")\n translators.each do |t|\n TRANSLATOR_POINT[t] = (TRANSLATOR_POINT[t] or 0.0) + 1.0 / translators.length\n end\n\n data = data.split(\"\\n\")[0..-2].join(\"\\n\")\n data += \"\\n<p class=\\\"math\\\" style=\\\"text-align:right;font-style:italic\\\">Орчуулсан: #{translators.join(\", \")}</p>\"\n print \"Converting to HTML: #{input} Translated by: #{translators.join(\", \")}\\n\"\n\n open(\".temp.md\", \"w+\") { |f| f.write(data) }\nend",
"def to_mp3(filename, params={})\n text = params[:text] || self\n raise \"to_mp3 language option still not implemented\" if params[:language]\n #system(\"echo \\\"#{text.to_s}\\\" | text2wave | lame --alt-preset cbr 16 -a --resample 11 --lowpass 5 --athtype 2 -X3 - > #{filename} 2> /dev/null\")\n system(\"echo \\\"#{text.to_s}\\\" | text2wave -eval \\\"(voice_nitech_us_slt_arctic_hts)\\\" | lame --alt-preset cbr 16 -a --resample 11 --lowpass 5 -X3 - > #{filename} 2> /dev/null\")\n end",
"def translate(lang_from = @lang_from, lang_to = @lang_to, words)\n return [] if words.size == 0\n all_translated = [] #array of all translated words\n words.each_slice(800) do |slice| #slice into 1000 words doing >1000 runs into problems\n words_string = slice.join(\"&text=\")\n uri = \"https://translate.yandex.net/api/v1.5/tr.json/translate?key=APIkey&lang=FROM-TO&text=WORD\"\n uri = uri.sub(\"WORD\",words_string).sub(\"FROM\", lang_from).sub(\"TO\", lang_to).sub(\"APIkey\", @key)\n uri = URI.escape(uri) #escape unsafe characters in uri\n begin\n #puts uri\n #puts '****************************'\n json = open(uri).read #open uri of yandex translation\n rescue => e\n puts e.message\n end\n translated = JSON.parse(json)[\"text\"]\n #should probably check to make sure translated != nil\n if translated.nil?\n puts \"PROBLEM TRANSLATING - returned nil (URI may be too long)\"\n else\n all_translated += translated\n end\n end\n all_translated #return array of all translations\n end",
"def translation_target\n super\n end",
"def set_translated_file\n @translated_file = TranslatedFile.find(params[:id])\n end",
"def localized_image_filename (source)\n localized_filename = get_language_filename( source, true )\n language_filename = get_language_filename( source, false )\n if language_image_exists?(localized_filename)\n return localized_filename\n elsif language_image_exists?(language_filename)\n return language_filename\n else\n return source\n end\n end",
"def explicit_transcode(filename, from_encoding, to_encoding)\n puts ''\n puts `file test_files/#{filename}`\n puts \"transcoding from #{from_encoding.name} to #{to_encoding.name}\"\n\n file_str = read_file(filename)\n encoded_str = file_str.force_encoding(from_encoding).encode!(Encoding::UTF_8, from_encoding)\n\n puts encoded_str\n puts 'valid encoding: ' + encoded_str.valid_encoding?.to_s\n puts ''\nend",
"def parse( language, target=[] )\n file = file_name(language)\n content = File.open( file, 'r' ).read.gsub( /\\\"\\n\\\"/, '' )\n puts \"Parsing \\\"#{file}\\\" ...\"\n content.each_line do |line|\n parse_line( line, target ) unless line.first == '#'\n end\n target.shift # remove po header\n \n return target\n rescue Errno::ENOENT\n puts \"Can not found \\\"#{file}\\\", parsing skipped.\"\n return []\n end",
"def to_deepl_target_locale(locale)\n loc, sub = locale.to_s.split('-')\n if SPECIFIC_TARGETS.include?(loc)\n # Must see how the deepl api evolves, so this could be an error in the future\n warn_deprecated I18n.t('i18n_tasks.deepl_translate.errors.specific_target_missing') unless sub\n locale.to_s.upcase\n else\n loc.upcase\n end\n end",
"def lang(orig); end",
"def load_language(lang)\n puts \"Loading current translations for language #{lang}\"\n system(\n 'curl -X GET ' \\\n \"'https://translation.io/api/v1/segments.json?target_language=#{lang}' \" \\\n \"-H 'x-api-key: #{$API_KEY}' > ,full-list\"\n )\n current_translations_file_contents = File.read(',full-list')\n current_translations_json = JSON.parse(current_translations_file_contents)\n\n if current_translations_json.key?('errors')\n puts 'Error:'\n puts current_translations_json['errors']\n exit 1\n end\n\n # Initialize hash in CURRENT_TRANSLATIONS for this new language\n $CURRENT_TRANSLATIONS[lang] = {}\n\n # Reorganize so that $CURRENT_TRANSLATIONS[lang][key] contains segment\n # information that translations.io provides:\n # id, key, target_language, target, etc.\n current_translations_json['segments'].each do |segment|\n # Work around bug in Rubocop\n if segment['target_language'] != lang\n STDERR.puts \"Error: Expected language #{lang} in segment #{segment}\"\n exit 1\n end\n $CURRENT_TRANSLATIONS[lang][segment['key']] = segment\n end\nend",
"def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)\r\n if src_in_local\r\n res = @storage_api.upload_file(\"/\", src)\r\n if res.uploaded.length != 1 || res.errors.length != 0\r\n fail ApiError.new('Unable to upload file')\r\n end\r\n file_in_storage = res.uploaded[0]\r\n else\r\n file_in_storage = src\r\n end\r\n\r\n out_file = File.basename(dst)\r\n out_file = dst unless dst_in_local\r\n\r\n input_format = 'html'\r\n input_format = get_input_format(src) unless is_url\r\n\r\n output_format = File.extname(dst).strip.downcase[1..-1]\r\n\r\n if output_format == 'jpg'\r\n output_format = 'jpeg'\r\n elsif output_format == 'mht'\r\n output_format = 'mhtml'\r\n elsif output_format == 'tif'\r\n output_format = 'tiff'\r\n end\r\n\r\n local_var_path = \"/html/conversion/{from}-{to}\".sub('{' + 'from' + '}', input_format.to_s).sub('{' + 'to' + '}', output_format.to_s)\r\n\r\n post_body = {}\r\n post_body[:'inputPath'] = file_in_storage.to_s\r\n post_body[:'outputFile'] = out_file.to_s\r\n post_body[:'storageName'] = storage_name.to_s\r\n\r\n unless options.nil?\r\n post_body[:'options'] = {}\r\n post_body[:'options'][:'width'] = options[:'width'] unless options[:'width'].nil?\r\n post_body[:'options'][:'height'] = options[:'height'] unless options[:'height'].nil?\r\n post_body[:'options'][:'leftMargin'] = options[:'left_margin'] unless options[:'left_margin'].nil?\r\n post_body[:'options'][:'rightMargin'] = options[:'right_margin'] unless options[:'right_margin'].nil?\r\n post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?\r\n post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?\r\n post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?\r\n post_body[:'options'][:'background'] = options[:'background'] unless options[:'background'].nil?\r\n post_body[:'options'][:'jpegquality'] = options[:'jpeg_quality'] unless options[:'jpeg_quality'].nil?\r\n post_body[:'options'][:'usegit'] = options[:'use_git'] unless options[:'use_git'].nil?\r\n post_body[:'options'][:'error_threshold'] = options[:'error_threshold'] unless options[:'error_threshold'].nil?\r\n post_body[:'options'][:'max_iterations'] = options[:'max_iterations'] unless options[:'max_iterations'].nil?\r\n post_body[:'options'][:'colors_limit'] = options[:'colors_limit'] unless options[:'colors_limit'].nil?\r\n post_body[:'options'][:'line_width'] = options[:'line_width'] unless options[:'line_width'].nil?\r\n end\r\n\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :return_type => 'OperationResult')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: Create task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n\r\n if status_code != 200\r\n fail ApiError.new('Conversion failed')\r\n end\r\n\r\n while true\r\n data, status_code, headers = get_status(data.id)\r\n fail ApiError.new('Conversion failed') if data.code != 200 or data.status == 'faulted' or data.status == 'canceled'\r\n break if data.status == 'completed'\r\n sleep 3\r\n end\r\n\r\n if dst_in_local\r\n out_folder = File.dirname(dst)\r\n d = @storage_api.download_file(data.file)\r\n out_name = out_folder + '/' + File.basename(data.file)\r\n File.rename(d, out_name)\r\n data.file = out_name\r\n end\r\n\r\n data\r\n end",
"def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end",
"def main(args)\n cli_options = parse_args(args)\n if cli_options[:filepath] == nil\n puts \"must include a file path\"\n exit 1\n end\n\n parsed = nil\n\n begin\n parsed = parse_tm(File.read(cli_options[:filepath]))\n rescue Errno::ENOENT => e\n $stderr.puts \"File '#{cli_options[:filepath]}' not found: #{e}\"\n end\n\n options = { :output => 'tex', :expand_aliases => true, :duration => 500, :filepath => nil, :template => nil }\n .merge(parsed[:options].delete_if { |k, v| v.nil? })\n .merge(cli_options.delete_if { |k, v| v.nil? })\n\n puts \"options: \" + options.inspect\n\n parsed[:description] = transform(parsed[:description], options)\n\n if options[:template] != nil\n output = output_begin(parsed, options)\n run(parsed) do |state|\n output = output_stream(output, parsed, options, state)\n end\n output_end(output, parsed, options)\n else\n File.write(\n options.filepath + '.tex',\n generate_template(parsed[:description], options)\n )\n end\n\nend",
"def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end",
"def change_sequence_format(path_to_sequence, input_sequence_format, output_sequence_format)\n biosequence = biosequence_from_file(path_to_sequence, input_sequence_format)\n case output_sequence_format\n when :genbank\n output_suffix = \"gbk\"\n when :embl\n output_suffix = \"embl\"\n when :fasta\n output_suffix = \"fas\"\n end\n output_filepath = \"#{File.dirname(path_to_sequence)}/#{file_prefix_from_filepath(path_to_sequence)}.#{output_suffix}\"\n file_from_biosequence(output_filepath, output_sequence_format, biosequence)\nend"
] |
[
"0.62928003",
"0.61206913",
"0.6045052",
"0.6026681",
"0.59488124",
"0.571821",
"0.5589105",
"0.5477882",
"0.538116",
"0.52734816",
"0.5264656",
"0.5199831",
"0.5198509",
"0.5108316",
"0.5067594",
"0.50415075",
"0.49992803",
"0.49937707",
"0.49720055",
"0.4959468",
"0.49559638",
"0.49112222",
"0.4880805",
"0.4878506",
"0.48552483",
"0.48466423",
"0.48451206",
"0.48434642",
"0.4837271",
"0.48243326",
"0.4799058",
"0.47840947",
"0.47726077",
"0.4759503",
"0.47539955",
"0.469903",
"0.469839",
"0.46963608",
"0.46670976",
"0.46469676",
"0.46433073",
"0.46410048",
"0.4635614",
"0.4634884",
"0.4631431",
"0.461994",
"0.4615018",
"0.45848107",
"0.4575339",
"0.45696005",
"0.45491675",
"0.4542868",
"0.4536343",
"0.4536343",
"0.45165253",
"0.45110723",
"0.45085847",
"0.44884473",
"0.4469975",
"0.44573653",
"0.44572988",
"0.44565812",
"0.44497597",
"0.4440079",
"0.44389212",
"0.44294608",
"0.4415098",
"0.44003576",
"0.43991625",
"0.43952096",
"0.43937957",
"0.43302712",
"0.43293113",
"0.4326526",
"0.43198845",
"0.4317204",
"0.4311424",
"0.43105912",
"0.4304367",
"0.43012616",
"0.429733",
"0.42972326",
"0.4275702",
"0.4268189",
"0.426712",
"0.42563275",
"0.4255648",
"0.42279565",
"0.4226611",
"0.42255118",
"0.4225172",
"0.42247346",
"0.4216792",
"0.42131892",
"0.42120123",
"0.41983533",
"0.41928786",
"0.4187265",
"0.4184485",
"0.41757295"
] |
0.827195
|
0
|
Method to convert from one caption type to other types. If the src_lang is not provided then all source languages will be converted to target types. For example, if a ttml file has "en" and "es" and target_type is vtt and no src_lang is provided 2 vtt files would be created one per language in the source. if a target_lang is provided then one of the lang from source would be picked for creating the output file with target_lang If no target_lang is provided, no translations are applied. output_file is created using without any need for any language translation services. Hence doesn't incur any cost !! Note: +src_lang+ makes sense only for caption types that can hold multi lingual captions like dfxp and ttml. For other caption sources this field is ignored +types+ An array of Valid input caption type(s). Refer to `CaptionType` +src_lang+ can be inferred using infer_language method +target_lang+ Target 2 letter ISO language code to which the source needs to be translated in to. +output_dir+ Output Directory. Generated files would be dumped here ==== Raises InvalidInputException shall be raised if 1. The input file doesn't exist or is unreadable or is invalid caption 2. The output dir doesn't exist 3. Invalid lang codes for a given caption type 4. Unsupported type to which conversion is requested for
|
def transform_to(types, src_lang, target_lang, output_dir)
if (types - supported_transformations).size != 0
raise InvalidInputException.new("Unknown types provided for conversion in input #{types}")
end
unless File.directory?(output_dir)
FileUtils.mkdir_p(output_dir)
end
# Basic validations
if types.include?(TYPE_SCC)
if target_lang && !target_lang.eql?("en")
raise InvalidInputException.new("SCC can be generated only in en. #{target_lang} is unsupported")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translate(src_lang, target_lang, output_file)\n # Check if a non empty output file is present and error out to avoid\n # the danger or overwriting some important file !!\n if File.exists?(output_file) && File.size(output_file) > 0\n raise InvalidInputException.new(\"Output file #{output_file} is not empty.\")\n else\n # Just open the file in writable mode and close it just to ensure that\n # we can write the output file\n File.open(output_file, \"w\") {|f|\n }\n end\n # Check if the file is writable ?\n unless File.writable?(output_file)\n raise InvalidInputException.new(\"Output file #{output_file} not writable.\")\n end\n # Further checks can be done only in caption specific implementations\n # or translation engine specific implementation\n end",
"def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end",
"def convert_one(*args)\n raise \"x2t file is not found in #{@bin_path} path\" unless x2t_exist?\n output_file_path = \"#{@convert_to}/#{File.basename(args.first[:input_file], '.*')}.\" + args.first[:format_to]\n convert_file(args.first[:input_file], output_file_path, false)\n output_file_path\n end",
"def alb_convert data_type, target, model_script=nil\n case data_type \n when 'ltspice'\n cdraw2target target, 'cdraw', File.expand_path(target), model_script\n if target == 'qucs'\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'eeschema'\n Dir.chdir('eeschema'){\n eeschema2alb_back\n }\n elsif target == 'xschem'\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n end\n when 'eeschema'\n alb2eeschema 'cdraw', File.expand_path('eeschema')\n if target == 'qucs'\n eeschema2qucs 'eeschema', File.expand_path('qucs')\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'xschem'\n eeschema2xschem 'eeschema', File.expand_path('xschem')\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n elsif target == 'ltspice'\n eeschema2cdraw 'eeschema', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'xschem'\n if target == 'qucs'\n xschem2qucs 'cdraw', File.expand_path('qucs')\n elsif target == 'xschem'\n alb2xschem 'cdraw', File.expand_path('xschem')\n elsif target == 'eeschema'\n xschem2eeschema 'cdraw', File.expand_path('eeschema')\n elsif target == 'ltspice'\n alb2xschem 'cdraw', File.expand_path('xschem')\n xschem2cdraw 'xschem', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'qucs'\n if target == 'qucs'\n alb2qucs 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'eeschema'\n qucs2eeschema 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'xschem'\n qucs2xschem 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'ltspice'\n qucs2cdraw nil, self.project.name, File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n end\n end",
"def filetype_conversion(options)\n @transform_tasks.push(\n add_transform_task('output', options)\n )\n self\n end",
"def convert_file filename, content, in_dir, out_dir, language\n # Convert the file\n converter = AutoHeathen::Converter.new( { logger: logger } )\n action = converter.get_action content.content_type\n logger.debug \" convert: #{File.basename(filename)}, content_type: #{content.content_type}, action: #{action}\"\n start_time = Time.now\n outfile, data = converter.convert action, language, filename, content\n logger.debug \" conversion took %0.2f s\"%[Time.now-start_time]\n\n # Save the file\n outfile = to_outfile in_dir, filename, out_dir, outfile\n logger.info \" writing file: #{outfile}\"\n File.open outfile, \"wb\" do |f|\n f.write data\n end\nend",
"def convert(target_type_method, source_type, source, source_name=nil, source_options=nil, notification_url=nil)\n \n if !@@_target_type_options.has_key?(target_type_method)\n raise \"Invalid Target Type.\"\n end \n \n @@_target_type =@@_target_type_options[target_type_method]\n\n if !@@_source_type_options.has_key?(source_type)\n raise \"Invalid Source Type.\"\n end\n \n @@_source_type = source_type\n\n if @@_source_type == SOURCE_TYPE_FILE_BASE64 or @@_source_type == SOURCE_TYPE_FILE_PATH\n if source_name === nil || source_name.length < 1\n raise \"Invalid Source Name.\"\n end\n end\n \n if @@_source_type == SOURCE_TYPE_FILE_PATH\n if !File.exist?(source)\n raise \"File not found:\"+source\n end\n require 'base64'\n source = Base64.encode64(open(source) { |io| io.read });\n end\n \n data={\"apiKey\"=>@@_api_key,\n \"targetType\"=>@@_target_type_options[target_type_method],\n \"targetMethod\" => target_type_method,\n \"testMode\" =>@@_test_mode,\n \"notificationUrl\" => notification_url\n }\n\n if @@_source_type == SOURCE_TYPE_URL\n data['sourceUrl'] = source\n else \n file={\"file\"=>{ \"fileName\"=>source_name, \"fileData\"=>source }}\n data=data.merge(file)\n end\n\n if source_options != nil\n data['format'] = source_options\n end\n \n response = api_call('queue-insert',data)\n response_array = xml_to_array(response)\n \n if response_array['queue_answer']['status']['code'] == '0' \n @@hash = response_array['queue_answer']['params']['hash'];\n @@download_url = response_array['queue_answer']['params']['downloadUrl'];\n end\n @@_url =URL;\n return response;\n end",
"def create(name, source_lang, target_langs, options = {})\n options[:name] = name\n options[:sourceLang] = source_lang\n options[:targetLangs] = target_langs\n post(PATH, options)\n end",
"def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end",
"def from(lang)\n @source_lang = lang\n return self\n end",
"def create_output_type( source, source_audio, signature_context)\n create_output_type2( source, source_audio, signature_context)\n final_report(Final_report_context.new(\n\t@image_sequence.n_sequence_frames, @fps, @options.transition_and_timing, @options.keep, @image_sequence.framecount, \n @options.three_D ? source[0] : source, @workdir ))\n cleanup_workdir( @options.keep )\n done_message\n end",
"def translated_msg(translate, message, src_lang, target_lang)\n return message unless translate \n use_src = nil \n if (src_lang.nil? || src_lang.empty?)\n # We don't need to infer again and again\n begin\n @inferred_src_lang ||= infer_languages.first\n rescue StandardError => e \n raise LangDetectionFailureException.new(\"Failed to infer language due to #{e.message}\")\n end\n use_src = @inferred_src_lang\n else\n use_src = src_lang\n end\n return message if use_src.eql?(target_lang)\n @translator.translate(message, use_src, target_lang)\n end",
"def myDeepl_translate(text, source_lang, target_lang)\n begin\n source = source_lang.to_s.upcase\n target = target_lang.to_s.upcase\n ret = DeepL.translate(text, source, target).to_s\n ret.chomp!(\".\") # Українська translation has often a dot in the end\n ret.sub!(/\"/, \"\") # Українська translation has sometimes double quote in the beginning\n ret.sub!(/。/, \"\") # one time seen, 日本語 translation added japanese dot in the end\n # puts \"translate #{source} \\”#{text}\\\" -> #{target} \\\"#{ret}\\\"\"\n return ret\n rescue DeepL::Exceptions::Error => exc\n puts \"DeepL translation failed #{exc.class} #{exc.message}\"\n end\n return nil\n end",
"def convert(type)\n case type\n when 'tests' then @test_tool.convert\n when 'coverage' then @coverage_tool.convert\n when 'all'\n @test_tool.convert\n @coverage_tool.convert\n end\n end",
"def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)\r\n if src_in_local\r\n res = @storage_api.upload_file(\"/\", src)\r\n if res.uploaded.length != 1 || res.errors.length != 0\r\n fail ApiError.new('Unable to upload file')\r\n end\r\n file_in_storage = res.uploaded[0]\r\n else\r\n file_in_storage = src\r\n end\r\n\r\n out_file = File.basename(dst)\r\n out_file = dst unless dst_in_local\r\n\r\n input_format = 'html'\r\n input_format = get_input_format(src) unless is_url\r\n\r\n output_format = File.extname(dst).strip.downcase[1..-1]\r\n\r\n if output_format == 'jpg'\r\n output_format = 'jpeg'\r\n elsif output_format == 'mht'\r\n output_format = 'mhtml'\r\n elsif output_format == 'tif'\r\n output_format = 'tiff'\r\n end\r\n\r\n local_var_path = \"/html/conversion/{from}-{to}\".sub('{' + 'from' + '}', input_format.to_s).sub('{' + 'to' + '}', output_format.to_s)\r\n\r\n post_body = {}\r\n post_body[:'inputPath'] = file_in_storage.to_s\r\n post_body[:'outputFile'] = out_file.to_s\r\n post_body[:'storageName'] = storage_name.to_s\r\n\r\n unless options.nil?\r\n post_body[:'options'] = {}\r\n post_body[:'options'][:'width'] = options[:'width'] unless options[:'width'].nil?\r\n post_body[:'options'][:'height'] = options[:'height'] unless options[:'height'].nil?\r\n post_body[:'options'][:'leftMargin'] = options[:'left_margin'] unless options[:'left_margin'].nil?\r\n post_body[:'options'][:'rightMargin'] = options[:'right_margin'] unless options[:'right_margin'].nil?\r\n post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?\r\n post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?\r\n post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?\r\n post_body[:'options'][:'background'] = options[:'background'] unless options[:'background'].nil?\r\n post_body[:'options'][:'jpegquality'] = options[:'jpeg_quality'] unless options[:'jpeg_quality'].nil?\r\n post_body[:'options'][:'usegit'] = options[:'use_git'] unless options[:'use_git'].nil?\r\n post_body[:'options'][:'error_threshold'] = options[:'error_threshold'] unless options[:'error_threshold'].nil?\r\n post_body[:'options'][:'max_iterations'] = options[:'max_iterations'] unless options[:'max_iterations'].nil?\r\n post_body[:'options'][:'colors_limit'] = options[:'colors_limit'] unless options[:'colors_limit'].nil?\r\n post_body[:'options'][:'line_width'] = options[:'line_width'] unless options[:'line_width'].nil?\r\n end\r\n\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :return_type => 'OperationResult')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: Create task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n\r\n if status_code != 200\r\n fail ApiError.new('Conversion failed')\r\n end\r\n\r\n while true\r\n data, status_code, headers = get_status(data.id)\r\n fail ApiError.new('Conversion failed') if data.code != 200 or data.status == 'faulted' or data.status == 'canceled'\r\n break if data.status == 'completed'\r\n sleep 3\r\n end\r\n\r\n if dst_in_local\r\n out_folder = File.dirname(dst)\r\n d = @storage_api.download_file(data.file)\r\n out_name = out_folder + '/' + File.basename(data.file)\r\n File.rename(d, out_name)\r\n data.file = out_name\r\n end\r\n\r\n data\r\n end",
"def to(lang)\n @target_lang = lang\n return self\n end",
"def test_conversions\n File.unstub(:exist?)\n formats = supported_formats\n presets['formats']['formats'] = formats\n\n formats.each do |input_format|\n output = tested \"formats rms.#{input_format}\"\n\n sources = output.css('source')\n formats.each do |output_format|\n mime = MIME::Types.type_for(output_format).first.to_s\n assert(sources.any? { |source| source['type'] == mime },\n \"Failed to generate a source with type #{mime}\")\n end\n end\n\n files = Dir.entries(temp_dir('generated'))\n\n formats.each do |format|\n assert_equal(\n formats.length, files.count { |f| File.extname(f) == '.' + format }\n )\n end\n end",
"def convert(opts = {})\n start_time = Time.now\n logger.info \"Starting conversion process at #{start_time}\"\n if opts[:id]\n convert_work(opts[:id])\n elsif opts[:file]\n convert_from_file(opts[:file])\n elsif opts[:lists]\n create_lists\n else\n convert_class\n end\n end_time = Time.now\n elapsed_time = end_time - start_time\n logger.info \"Finished conversion process at #{end_time}\"\n logger.info \"Elapsed time: #{elapsed_time}\"\n end",
"def convert\n \n # People might forget the trailing slash\n @options[:output_dir] = @options[:output_dir] + \"/\" unless @options[:output_dir].end_with?(\"/\")\n \n # Make sure that the output directory exits\n if !File.directory? @options[:output_dir] \n $LOG.info(\"Creating output directory #{@options[:output_dir]}...\")\n Dir.mkdir(@options[:output_dir])\n end\n \n # Array for storing ESE file pointers\n source_ese_files = []\n \n # If source ESE files are provided in batch mode (in a text file) ...\n unless @options[:batch_file] == nil\n # .. read the file line by line and extract the file location\n File.open(@options[:batch_file], \"r\") do |batch_file| \n # each line should point to a file path\n while path = batch_file.gets\n source_ese_files << path.chomp\n end\n end\n else\n # .. just take the source files provided on the command line\n source_ese_files = @files2convert\n end\n\n $LOG.info(\"Converting #{source_ese_files.size} ESE XML files to EDM RDF/XML...\")\n \n converted_files = []\n # Convert each ESE file individually\n source_ese_files.each do |source_file|\n \n unless File.exists?(source_file)\n $LOG.error(\"Cannot access source file #{source_file}. Exiting conversion process.\")\n return\n end\n \n # convert the file\n converted_file = transform(source_file, @options[:stylesheet], @options[:output_dir], @options[:base_uri], @options[:pretty_print])\n converted_files << converted_file\n \n end\n \n $LOG.info(\"*** Finished RDF/XML conversion *** Transformed #{source_ese_files.size} ESE XML files to EDM RDF/XML.\")\n \n # create an N-Triples dump if requested so\n if @options[:dump]\n \n $LOG.info(\"Merging created RDF/XML files into N-TRIPLES dump file: #{@options[:nt_dump_file]} ...\")\n \n create_NT_dump(converted_files, @options[:output_dir], @options[:nt_dump_file])\n \n $LOG.info(\"*** Finished N-TRIPLES dumping *** Dumped #{source_ese_files.size} RDF/XML files into #{@options[:nt_dump_file]}\")\n \n end\n \n end",
"def call(source, format, **opts)\n return unless source\n return to_json(source) if format == :json\n return to_yaml(source) if format == :yaml\n return to_form(source) if format == :form\n return to_text(source) if format == :text\n\n to_multipart(source, **opts)\n end",
"def convert(phraseapp_file_format)\n case phraseapp_file_format\n when \"nested_json\"\n \"json\"\n when \"yml\"\n \"yml\"\n else\n raise ArugmentError.new(\"Unsupported type: #{phraseapp_file_format}\")\n end\n end",
"def convert_to_po( source_file_h = nil, base_file = nil, fuzzy_list = nil )\n return false unless english_header?\n\n # What we actually do depends on what was setup for us.\n # If source_file_h is nil and po_locale is nil, we are xgettext.\n # If source_file_h is nil and we have po_locale, we are msginit.\n # If we have a source_file_h, then we are msgunfmt.\n action = :msgunfmt\n action = :msginit if source_file_h.nil? && po_locale\n action = :xgettext if source_file_h.nil? && po_locale.nil?\n\n # lang_en serves as the master reference for all output, especially\n # comments and metadata.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n\n # untranslated_items serves as the source for *untranslated* strings.\n # This differs from lang_en in that we may overwrite some of the\n # lang_en strings from the base_file, later. This can help when\n # translating, e.g., regional formats.\n untranslated_items = lang_en.items.clone\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n untranslated_items.merge!(lang_base.items)\n end\n\n # We will use lang_source if we have a source_file_h, i.e., msgunfmt,\n # as the source for *translated* strings.\n if source_file_h\n lang_source = PoHeaderFile.new(source_file_h)\n return false unless lang_source.source_file\n else\n lang_source = nil\n end\n\n\n # If we were given a fuzzy_list and we have a source_file, then\n # we have to mark appropriate items as fuzzy.\n if fuzzy_list && fuzzy_list.count > 0 && lang_source\n untranslated_items.each do |key, value|\n if fuzzy_list.include?(key)\n value.each_value do |v|\n v[:fuzzy] = true\n end\n end\n\n end\n end\n\n # The information in the PO header can come from a few different sources\n # depending on what we're doing.\n header_plural_forms = nil\n header_pot_line = nil\n header_translate_to = nil\n\n if action == :xgettext\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_en.plural_count}; plural=#{lang_en.plural_form}\"\n header_pot_line = \"POT-Creation-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_en.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n\n end\n if action == :msginit\n header_plural_forms = \"Plural-Forms: #{known_locales[po_locale.to_sym][:plural_form]}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = po_locale\n end\n if action == :msgunfmt\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_source.plural_count}; plural=#{lang_source.plural_form}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_source.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n end\n\n header_plural_count = header_plural_forms.match(/nplurals=(.*?);/i)[1].to_i - 1\n\n # We'll use this closure to perform a repetitive task in the report.\n item_output = lambda do | label, string |\n result = ''\n if string.lines.count > 1\n result << \"#{label} \\\"\\\"\\n\"\n result << \"#{string}\\n\"\n else\n result << \"#{label} #{string}\\n\"\n end\n result\n end\n\n\n report = <<-HEREDOC\nmsgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Language: #{header_translate_to}\\\\n\"\n\"#{header_plural_forms}\\\\n\"\n\"X-Generator: HTML Tidy #{File.basename($0)}\\\\n\"\n\"Project-Id-Version: \\\\n\"\n\"#{header_pot_line}\\\\n\"\n\"Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\\\n\"\n\"Language-Team: \\\\n\"\n\n HEREDOC\n\n untranslated_items.delete(:TIDY_LANGUAGE)\n untranslated_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n untranslated_items.each do |key, value|\n\n if value['0'][:comment]\n value['0'][:comment].each_line { |line| report << \"#. #{line.strip}\\n\"}\n end\n\n attribs = []\n attribs << 'fuzzy' if value['0'][:fuzzy] && action == :msgunfmt\n attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) }\n if attribs.count > 0\n report << \"#, #{attribs.join(', ')}\\n\"\n end\n\n report << \"msgctxt \\\"#{key.to_s}\\\"\\n\"\n\n # Handle the untranslated strings, with the possibility that there\n # are two forms. PO/POT is English-based and supports only a singular\n # and plural form.\n value.each_value do | subitem |\n label = subitem[:case] == '0' ? 'msgid' : 'msgid_plural'\n report << item_output.(label, subitem[:string])\n end\n\n # Handle translated strings, with the possibility that there\n # are multiple plural forms for them.\n en_is_singular = value.count == 1\n\n if lang_source && lang_source.items[key]\n # Print translated strings.\n if en_is_singular\n report << item_output.( 'msgstr', lang_source.items[key]['0'][:string])\n else\n # Print available plural forms and write blanks for the rest.\n (0..header_plural_count).each do |i|\n if lang_source.items[key].has_key?(i.to_s)\n report << item_output.( \"msgstr[#{i}]\", lang_source.items[key][i.to_s][:string])\n else\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n else\n # Print empty translated strings.\n if en_is_singular\n report << \"msgstr \\\"\\\"\\n\"\n else\n (0..header_plural_count).each do |i|\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n\n report << \"\\n\"\n end # do\n\n if emacs_footer\n report << <<-HEREDOC\n# Local Variables:\n# mode: po\n# eval: (add-hook 'po-subedit-mode-hook '(lambda () (setq fill-column 78)))\n# End:\n HEREDOC\n end\n\n output_file = action == :xgettext ? 'tidy.pot' : \"language_#{header_translate_to}.po\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') { |f| f.write(report) }\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new file to #{File.expand_path(output_file)}\"\n true\n end",
"def process_template name, src, type, called_from = nil, file_name = nil\n case type\n when :erb\n result = ErbTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :haml\n result = HamlTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :erubis\n result = ErubisTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :slim\n result = SlimTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n else\n abort \"Unknown template type: #{type} (#{name})\"\n end\n\n # Each template which is rendered is stored separately\n # with a new name.\n if called_from\n name = (\"#{name}.#{called_from}\").to_sym\n end\n\n @tracker.templates[name].src = result\n @tracker.templates[name].type = type\n end",
"def convert\n puts \"\\n--------------------------------\"\n puts \"Transforming #{File.extname(@file)} file to .#{@type} format...\"\n \n runHardklor if @hardklor && @file.downcase.include?(\".mzxml\")\n \n if @type == \"mgf\" || @type == \"ms2\"\n Ms::Msrun.open(@file) do |ms|\n file = @file.chomp(File.extname(@file)) + \"_#{@run}.#{@type}\"\n File.open(file, 'w') do |f|\n f.puts eval(\"ms.to_#{@type}\")\n end\n end\n else\n # If ms-msrun can't do it, then this might. Do something here to include run number. Doesn't work with Refiner, so\n # this is probably pointless to even have.\n #\n # And why do we run our own code to transform mzML instead of TPP?\n # 1) Prince said so\n # 2) I hate the TPP. The people who put that together don't deserve to be called programmers. I mean, come on! Methods\n # should never be longer than 100 lines of code, yet they've got methods that are over 1000 lines of code! Ack! It\n # just makes my skin crawl!\n system(\"/usr/local/src/tpp-4.3.1/build/linux/MzXML2Search -#{@type} #{@file}\")\n end\n end",
"def caption_by_lang(lang_name)\n @@cached_caption_by_lang ||= {}\n\n begin\n @@cached_caption_by_lang[self[:id]] = {}\n\n captions.each {|c| @@cached_caption_by_lang[self[:id]][Language.find(c.language_id).name] = c}\n end if !ActiveRecord::Base.instance_cached? or @@cached_caption_by_lang[self[:id]].nil?\n \n caption = @@cached_caption_by_lang[self[:id]][lang_name]\n caption.nil? ? Caption.new(:name => Caption.missing_msg('unknown', \"Label.id=#{self[:id]};Language.name=#{lang_name}\")) : caption\n end",
"def convert_to_h( file, base_file )\n\n po_content = PoPoFile.new(file)\n return false unless po_content.source_file && english_header? && header_template?\n\n # We will use English to ensure that no English strings are\n # included in the translation.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n filter_items = lang_en.items.clone\n\n # We will also filter out items that are already the same\n # in the base language, in order to keep Tidy small. It's\n # actually possible to miss some English strings if, for\n # some reason, the PO has English strings that the base\n # language does not, but severity * likelihood == unimportant.\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n filter_items.merge!(lang_base.items)\n end\n\n # We will hard code these into the generated file.\n filter_items.delete(:TIDY_LANGUAGE)\n filter_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n\n # Eliminate PO items if they match inherited items (in the filter), or\n # if they're not included in English (i.e., entries not used by Tidy).\n # We are comparing _complete entries_ right here, with the PO as the\n # official source. Therefore all plurals are accounted for, #IF groups,\n # and comments.\n po_content.items.reject! do |key, value|\n ( (filter_items.has_key?(key) && filter_items[key] == value) ) || !filter_items.has_key?(key)\n end\n\n # #if groups and comments:\n # We need to know which translated items belong in #if groups. Since we\n # don't store this metadata in the PO, find out which #if groups they\n # belong to from the original language_en.h.\n # Additionally we will only use comments from language_en.h. Besides\n # preventing us from having to format them, we ensure that only the\n # canonical comments are put into the H file in the event of changes.\n # Additionally only include comments if enabled.\n # Finally add fuzzy notes to comments if the PO item is fuzzy.\n po_content.items.each do |key, value|\n value.each_value do |item_entry|\n item_entry[:if_group] = lang_en.items[key]['0'][:if_group]\n item_entry[:comment] = force_comments ? lang_en.items[key]['0'][:comment] : nil\n item_entry[:comment] = \"(fuzzy) #{item_entry[:comment]}\" if item_entry[:fuzzy]\n end\n end\n\n\n # Gather some information to format this nicely, and perform\n # UTF escaping if necessary.\n longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST.\n longest_value = 10 # reasonable default in case no single-line strings are found.\n po_content.items.each do |key, value|\n longest_key = key.length if key.length > longest_key\n value.each_value do |value_inner|\n # If we're not plaintext then escape UTF sequences.\n unless plaintext\n value_inner[:string].gsub!(/[^\\u0000-\\u007e][0-9a-fA-F]?/) do |c|\n esc = c[0].bytes.map{ |b| '\\\\x' + b.to_s(16) }.join('')\n if c[1]\n esc += '\"\"' + c[1]\n end\n esc\n end\n end\n length = value_inner[:string].length\n longest_value = length if length > longest_value && !value_inner[:string].start_with?(\"\\n\")\n end\n end\n\n # Manually build the first line with the proper language code.\n report_body = \" {/* Specify the ll or ll_cc language code here. */\\n\"\n report_body << \" #{'TIDY_LANGUAGE,'.ljust(longest_key+2)}0, \\\"#{po_content.language}\\\"\\n\"\n report_body << \" },\\n\"\n\n # Generate the main header body. Although it's a machine-generated\n # document we still care that it's pretty-printed and readable. In\n # this respect we have four output formats: single line values;\n # single line values with developer comment; multiline values; and\n # multiline values with developer comment.\n if_group = nil\n po_content.items.each do |item_key, item_value|\n item_group = item_value[item_value.keys[0]][:if_group]\n unless item_group == if_group\n # The current if grouping has changed.\n unless if_group.nil?\n # Close current group.\n report_body << \"#endif /* #{if_group} */\\n\\n\"\n end\n if_group = item_group\n unless if_group.nil?\n # Open new group.\n report_body << \"\\n#if #{if_group}\\n\"\n end\n end\n\n # Handle each entry individually.\n item_value.each_value do |entry_value|\n if entry_value[:string].start_with?(\"\\n\")\n # Format a multiline value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n else\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n end\n entry_value[:string].lines.each do |line|\n report_body << \" #{line}\"\n end\n report_body << \"\\n },\\n\"\n else\n # Format a single line value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string]}\\n\"\n report_body << \" },\\n\"\n else\n # known issue: ljust doesn't work for certain unicode characters, so no pretty-printing, e.g., Chinese.\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string].ljust(longest_value+2)} },\\n\"\n end\n end\n end\n end # po_content.items.each\n\n # Close off current if_group if any, because there will\n # not be another state change to do so.\n unless if_group.nil?\n report_body << \"#endif /* #{if_group} */\\n\"\n end\n\n # Force the final closing line manually; can't count on PO. We\n # could add this to the template, but let's give it the same\n # pretty-printing as the other items.\n report_body_last = \" {/* This MUST be present and last. */\\n\"\n report_body_last << \" #{'TIDY_MESSAGE_TYPE_LAST,'.ljust(longest_key+2)}0, NULL\\n\"\n report_body_last << \" }\\n\"\n\n # We are going to use an external ERB template to build the report file.\n # Although it's trivial to hard-code all of the required text into this\n # method directly, it will be more convenient to keep an external file\n # synchronized with changes to language_en.h if we make changes.\n header_file = File.open(@@header_template) { |f| f.read }\n report = ERB.new(header_file).result(binding) # will use in-context vars.\n\n # Save\n output_file = \"language_#{po_content.language}.h\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') do |f|\n f.write \"\\uFEFF\" if plaintext # MSVC requires a BOM.\n f.write(report)\n end\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new header file to #{File.expand_path(output_file)}\"\n true\n end",
"def convert(*args)\n @options += args if args\n outputfile = @options.map{ |x| x[:output] }.compact\n tmp_file = Tempfile.new('pandoc-conversion')\n @options += [{ output: tmp_file.path }] if outputfile.empty?\n @option_string = prepare_options(@options)\n begin\n run_pandoc\n IO.binread(tmp_file)\n ensure\n tmp_file.close\n tmp_file.unlink\n end\n end",
"def sourceToTarget(source_file)\n\t\tsrc_ext = File.extname source_file\n\t\ttarg_ext = case src_ext\n\t\t\twhen '.mli' \n\t\t\t\t'.cmi'\n\t\t\twhen '.ml' \n\t\t\t\tcase @compiler \n\t\t\t\t\twhen @@byteCodeCompiler\n\t\t\t\t\t\t'.cmo'\n\t\t\t\t\twhen @@machineCodeCompiler\n\t\t\t\t\t\t'.cmx'\n\t\t\t\tend\n\t\t\telse \n\t\t\t\tputs \"ERROR couldn't deduce dependency ext: \" + source_file\n\t\t\t\treturn 'ERROR'\n\t\tend\n\t\treturn changeExt(source_file, targ_ext)\n\tend",
"def convert( content:, action:, language:'en' )\n params = {}\n response = nil\n with_tempfile(content) do |io|\n params[:file] = io\n params[:action] = action\n params[:language] = language if language\n params[:backtrace] = @backtrace if @backtrace\n response = send_request :post, \"convert\", params, :binary\n end\n response\n end",
"def convert(name = @csv_filename)\n rowIndex = 0\n excludedCols = []\n defaultCol = 0\n\n CSV.foreach(name, :quote_char => '\"', :col_sep => @csv_separator, :row_sep => :auto) do |row|\n\n if rowIndex == 0\n #check there's at least two columns\n return unless row.count > 1\n else\n #skip empty lines (or sections)\n next if row == nil or row[@keys_column].nil?\n end\n\n # go through columns\n row.size.times do |i|\n next if excludedCols.include? i\n\n #header\n if rowIndex == 0\n # defaultCol can be the keyValue\n defaultCol = i if self.default_lang == row[i]\n # ignore all headers not listed in langs to create files\n (excludedCols << i and next) unless @langs.has_key?(row[i])\n\n language = Language.new(row[i])\n if @langs[row[i]].is_a?(Array)\n @langs[row[i]].each do |id|\n language.add_language_id(id.to_s)\n end\n else\n language.add_language_id(@langs[row[i]].to_s)\n end\n @languages[i] = language\n elsif !@state_column || (row[@state_column].nil? || row[@state_column] == '' || !@excluded_states.include?(row[@state_column]))\n key = row[@keys_column]\n comment = @comments_column ? row[@comments_column] : nil\n key.strip! if @stripping\n default_value = self.default_lang ? row[defaultCol] : nil\n value = self.process_value(row[i], default_value)\n @comments[key] = comment\n @languages[i].add_content_pair(key, value)\n end\n end\n\n rowIndex += 1\n end\n\n write_content\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def convert(output_file, *opt)\n options = {}\n options.merge!(opt.pop) if !opt.empty? && opt.last.is_a?(Hash)\n\n converted = CaptionFile.open(output_file, options.merge(mode: 'w'))\n\n converted.print_header\n each_frame{|frame| converted.print_frame(frame)}\n converted.print_footer\n\n converted.close\n end",
"def create\n @screen = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n @languages = Language.find(:all).sort_by{|l| l.name }\n \n @label = Label.new(params[:label])\n\n if @label.save\n @captions = params[:captions]\n @captions.each do |language_id, caption_name|\n Caption.create(\n :label_id => @label.id,\n :language_id => language_id,\n :name => caption_name\n )\n end\n end\n end",
"def vectorize(src, dst, src_in_local, dst_in_local, options=nil, storage_name=nil)\r\n input_format = get_input_format(src)\r\n output_format = File.extname(dst).strip.downcase[1..-1]\r\n fail ApiError.new('Input format must be bmp, jpeg, gif, tiff, png') unless %w[bmp jpeg gif tiff png].include? input_format\r\n fail ApiError.new('Output format must be SVG') if output_format != 'svg'\r\n convert(src, dst, src_in_local, dst_in_local, false, options, storage_name)\r\n end",
"def convert(output, args={})\n tokens = [\"convert\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{args[:annotate].to_s}\" if args[:annotate]\n tokens << \" #{output}\"\n tokens = convert_to_command(tokens)\n success = run(tokens)[1]\n success\n end",
"def convert(src_node, dst_node, dst_top)\n @logger&.info { \"Converting #{src_node.pathname} and store result under #{dst_node.parent.pathname}\" }\n\n # merge the common api opts with node specific\n api_opts = DEFAULT_ADOC_API_OPTS.dup\n api_opts.merge!(@config_opts.fetch(:adoc_api_opts, {}))\n api_opts.merge!(src_node.api_options(src_node, dst_node, dst_top)) if src_node.respond_to?(:api_options)\n\n # use a new logger instance for each conversion\n adoc_logger = Giblish::AsciidoctorLogger.new(@logger, @adoc_log_level)\n\n begin\n doc_src = src_node.adoc_source(src_node, dst_node, dst_top)\n\n node_attr = src_node.respond_to?(:document_attributes) ?\n src_node.document_attributes(src_node, dst_node, dst_top) : {}\n doc_attr = resolve_doc_attributes(doc_src, node_attr)\n # piggy-back our own info on the doc attributes hash so that\n # asciidoctor extensions can use this info later on\n doc_attr[\"giblish-info\"] = {\n src_node: src_node,\n dst_node: dst_node,\n dst_top: dst_top\n }\n\n # load the source to enable access to doc attributes and properties\n #\n # NOTE: 'parse' is set to false to prevent preprocessor extensions to be run as part\n # of loading the document. We want them to run during the 'convert' call later when\n # doc attribs have been amended.\n #\n # NOTE2: by trial-and-error, it seems that some document attributes must be set when\n # calling 'load' and not added after the call and before the 'convert' call to have\n # the expected effect (e.g. idprefix).\n doc = Asciidoctor.load(doc_src, api_opts.merge(\n {\n attributes: doc_attr,\n parse: false,\n logger: adoc_logger\n }\n ))\n\n # update the destination node with the correct file suffix. This is dependent\n # on the type of conversion performed\n dst_node.name = dst_node.name.sub_ext(doc.attributes[\"outfilesuffix\"])\n d = dst_node.pathname\n\n # make sure the dst dir exists\n d.dirname.mkpath\n\n # do the conversion and write the converted doc to file\n output = doc.convert(api_opts)\n doc.write(output, d.to_s)\n\n # give the user the opportunity to eg store the result of the conversion\n # as data in the destination node\n @conv_cb[:success]&.call(src_node, dst_node, dst_top, doc, adoc_logger.in_mem_storage.string)\n true\n rescue => ex\n @logger&.error { \"Conversion failed for #{src_node.pathname}\" }\n @logger&.error { ex.message }\n @logger&.error { ex.backtrace }\n @conv_cb[:failure]&.call(src_node, dst_node, dst_top, ex, adoc_logger.in_mem_storage.string)\n false\n end\n end",
"def make\n src = @file\n filename = [@basename, @format ? \".#{@format}\" : \"\"].join\n dst = TempfileFactory.new.generate(filename)\n\n begin\n parameters = []\n parameters << source_file_options\n parameters << \":source\"\n parameters << transformation_command\n parameters << convert_options\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n\n frame = animated? ? \"\" : \"[#{@frame_index}]\"\n convert(\n parameters,\n source: \"#{File.expand_path(src.path)}#{frame}\",\n dest: File.expand_path(dst.path)\n )\n rescue Terrapin::ExitStatusError => e\n if @whiny\n message = \"There was an error processing the thumbnail for #{@basename}:\\n\" + e.message\n raise Paperclip::Error, message\n end\n rescue Terrapin::CommandNotFoundError => e\n raise Paperclip::Errors::CommandNotFoundError.new(\"Could not run the `convert` command. Please install ImageMagick.\")\n end\n\n dst\n end",
"def convert_single_before_context\n include_context 'tmp dirs'\n before(:context) do\n from = yield(Source.new @src)\n @asciidoctor_out = convert_single from, @dest,\n asciidoctor: true\n # Convert a second time with the legacy `AsciiDoc` tool and stick the\n # result into the `asciidoc` directory. We will compare the results of\n # this conversion with the results of the `Asciidoctor` conversion.\n @asciidoc_out = convert_single from, \"#{@dest}/asciidoc\",\n asciidoctor: false\n end\n include_examples 'convert single'\n end",
"def copy_and_convert_files_to(dest_dir, source_type, dest_type = nil, quality = nil, size = nil)\n\t\treturn false if !dir?\n\t\tdest_file_type = dest_type || source_type\n\t\tfiles = @path.files(file_type: source_type)\n\t\tfiles.each do |source_file|\n\t\t\tdest_file = Item.new(Path.new(\"#{dest_dir.path}/#{source_file.filename}.#{dest_file_type}\"))\n\t\t\treturn false if !source_file.copy_and_convert_to(dest_file, quality, size)\n\t\tend\n\n\t\treturn true\n\tend",
"def translate( type, value )\n unless value.nil?\n # FIXME: this is a hack to support Sequel\n if type && %w{ datetime timestamp }.include?(type.downcase)\n @translators[ type_name( type ) ].call( type, value.to_s )\n else\n @translators[ type_name( type ) ].call( type, value )\n end\n end\n end",
"def convert_image_image_format_convert_with_http_info(format1, format2, input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertImageApi.convert_image_image_format_convert ...'\n end\n # verify the required parameter 'format1' is set\n if @api_client.config.client_side_validation && format1.nil?\n fail ArgumentError, \"Missing the required parameter 'format1' when calling ConvertImageApi.convert_image_image_format_convert\"\n end\n # verify the required parameter 'format2' is set\n if @api_client.config.client_side_validation && format2.nil?\n fail ArgumentError, \"Missing the required parameter 'format2' when calling ConvertImageApi.convert_image_image_format_convert\"\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertImageApi.convert_image_image_format_convert\"\n end\n # resource path\n local_var_path = '/convert/image/{format1}/to/{format2}'.sub('{' + 'format1' + '}', format1.to_s).sub('{' + 'format2' + '}', format2.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertImageApi#convert_image_image_format_convert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @source_language_code = args[:source_language_code] if args.key?(:source_language_code)\n @target_language_code = args[:target_language_code] if args.key?(:target_language_code)\n end",
"def convert_local_file input_file, output_filename, output_format\n begin\n\n raise('input file not specified') if input_file.empty?\n raise('output file not specified') if output_filename.empty?\n raise('output format not specified') if output_format.empty?\n\n str_uri = $product_uri + '/words/convert?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file, str_signed_uri)\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n return valid_output unless valid_output.empty?\n\n output_path = $out_put_location + output_filename\n Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)\n ''\n rescue Exception => e\n print e\n end\n end",
"def copy\n FileUtils.mkdir_p output_folder unless Dir.exists? output_folder\n \n infos = {}\n @converted_files.each do |format, input_path|\n output_path = output_path(format)\n # se il percorso del file è uguale a quello vecchio è lo stesso file; per cui non copio\n # (è un caso che si verifica p.e. nel caso di un errore nel Composer, che ripristina il file vecchio)\n FileUtils.cp input_path, output_path if input_path != output_path\n\n model.send :\"#{format}_duration=\", \n if durations?\n durations[format]\n else\n info = Info.new(output_path)\n infos[format] = info\n info.duration\n end\n end\n\n extract_versions(infos)\n\n model.converted = true\n model.send :\"rename_#{column}=\", true\n model.send :\"#{column}=\", processed_original_filename_without_extension\n model[column] = processed_original_filename_without_extension\n model.save!\n\n model.send :\"rename_#{column}=\", nil\n model.skip_conversion = nil\n model.send :\"reload_#{column}\"\n\n true\n end",
"def convert_image_image_format_convert(format1, format2, input_file, opts = {})\n data, _status_code, _headers = convert_image_image_format_convert_with_http_info(format1, format2, input_file, opts)\n data\n end",
"def makeformats\n\n checktestversion\n\n report(\"using search method '#{Kpse.searchmethod}'\")\n if getvariable('fast') then\n report('using existing database')\n else\n report('updating file database')\n Kpse.update # obsolete here\n end\n # goody\n if getvariable('texformats') == 'standard' then\n setvariable('texformats',[getvariable('interface')]) unless getvariable('interface').empty?\n end\n # prepare\n texformats = validtexformat(getarrayvariable('texformats'))\n mpsformats = validmpsformat(getarrayvariable('mpsformats'))\n texengine = validtexengine(getvariable('texengine'))\n mpsengine = validmpsengine(getvariable('mpsengine'))\n # save current path\n savedpath = Dir.getwd\n # generate tex formats\n unless texformats || mpsformats then\n report('provide valid format (name.tex, name.mp, ...) or format id (metafun, en, nl, ...)')\n setvariable('error','no format specified')\n end\n if texformats && texengine then\n report(\"using tex engine #{texengine}\")\n texformatpath = if getvariable('local') then '.' else Kpse.formatpath(texengine,true) end\n # can be empty, to do\n report(\"using tex format path #{texformatpath}\")\n Dir.chdir(texformatpath) rescue false\n if FileTest.writable?(texformatpath) then\n # from now on we no longer support this; we load\n # all patterns and if someone wants another\n # interface language ... cook up a fmt or usr file\n #\n # if texformats.length > 0 then\n # makeuserfile\n # makeresponsefile\n # end\n texformats.each do |texformat|\n report(\"generating tex format #{texformat}\")\n progname = validprogname([getvariable('progname'),texformat,texengine])\n runcommand([quoted(texengine),prognameflag(progname),iniflag,prefixed(texformat,texengine),texmakeextras(texformat)])\n end\n else\n report(\"unable to make format due to lack of permissions\")\n texformatpath = ''\n setvariable('error','no permissions to write')\n end\n if not mpsformats then\n # we want metafun to be in sync\n setvariable('mpsformats',defaultmpsformats)\n mpsformats = validmpsformat(getarrayvariable('mpsformats'))\n end\n else\n texformatpath = ''\n end\n # generate mps formats\n if mpsformats && mpsengine then\n report(\"using mp engine #{mpsengine}\")\n mpsformatpath = if getvariable('local') then '.' else Kpse.formatpath(mpsengine,false) end\n report(\"using mps format path #{mpsformatpath}\")\n Dir.chdir(mpsformatpath) rescue false\n if FileTest.writable?(mpsformatpath) then\n mpsformats.each do |mpsformat|\n report(\"generating mps format #{mpsformat}\")\n progname = validprogname([getvariable('progname'),mpsformat,mpsengine])\n if not runcommand([quoted(mpsengine),prognameflag(progname),iniflag,runoptions(mpsengine),mpsformat,mpsmakeextras(mpsformat)]) then\n setvariable('error','no format made')\n end\n end\n else\n report(\"unable to make format due to lack of permissions\")\n mpsformatpath = ''\n setvariable('error','file permission problem')\n end\n else\n mpsformatpath = ''\n end\n # check for problems\n report(\"\")\n report(\"tex engine path: #{texformatpath}\") unless texformatpath.empty?\n report(\"mps engine path: #{mpsformatpath}\") unless mpsformatpath.empty?\n report(\"\")\n [['fmt','tex'],['mem','mps']].each do |f|\n [[texformatpath,'global'],[mpsformatpath,'global'],[savedpath,'current']].each do |p|\n begin\n Dir.chdir(p[0])\n rescue\n else\n Dir.glob(\"*.#{f[0]}\").each do |file|\n report(\"#{f[1]}: #{filestate(file)} > #{File.expand_path(file)} (#{File.size(file)})\")\n end\n end\n end\n end\n # to be sure, go back to current path\n begin\n Dir.chdir(savedpath)\n rescue\n end\n # finalize\n cleanup\n report(\"\")\n reportruntime\n end",
"def load_source\n case File.extname(config[:source])\n when '.json'\n Yajl.load(File.open(config[:source]))\n when '.yml'\n YAML.load(File.open(config[:source]))\n else\n raise 'unknown source file extension'\n end\n end",
"def ensure_source_processed(translated_filename)\n return unless $SOURCE.empty?\n\n source_filename = File.dirname(translated_filename) + '/en.yml'\n source_contents = File.read(source_filename)\n original_source = YAML.safe_load(source_contents)\n convert_source('', original_source['en'])\nend",
"def translate_input_text\n if self.language\n self.output_text = self.language.translate(self.input_text)\n else\n self.output_text = self.input_text\n end\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def set_type\n if self.mp3.present?\n self.type = \"Audio::UploadedAudio\"\n\n elsif self.enco_number.present? && self.enco_date.present?\n self.type = \"Audio::EncoAudio\"\n\n elsif self.external_url.present?\n self.type = \"Audio::DirectAudio\"\n\n end\n end",
"def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n\n begin\n parameters = []\n parameters << source_file_options\n parameters << \":source\"\n parameters << transformation_command\n parameters << convert_options\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n\n success = Paperclip.run(\"convert\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Exception => e\n error_details = \"#{e.class}: #{e}\"\n error_details += \"\\n#{e.backtrace.join(\"\\n\")}\" if e.backtrace\n\n p \"ERROR: #{error_details}\"\n \n raise \"There was an error processing the thumbnail for #{@basename}\" if @whiny\n end\n\n dst\n end",
"def convert_local_file input_file,output_filename,output_format\n begin\n \n if input_file == \"\"\n raise(\"input file not specified\")\n end \n \n if output_filename == \"\"\n raise(\"output file not specified\")\n end\n \n if output_format == \"\"\n raise(\"output format not specified\")\n end\n \n str_uri = $productURI + \"/words/convert?format=\" + output_format\n str_signed_uri = Common::Utils.sign(str_uri)\n \n response_stream = Common::Utils.uploadFileBinary(input_file, str_signed_uri) \n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\"\n \n if output_format == \"html\"\n saveformat = \"zip\"\n else\n saveformat = output_format\n end\n \n if output_filename == \"\"\n output_filename = Utils::get_filename(input_file) + \".\" + saveformat\n end\n \n output_path = $OutPutLocation + output_filename\n Common::Utils.saveFile(response_stream,output_path)\n return \"\"\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end",
"def translate(from, to, options={})\n stages = %w{packed unpacked cataloged decoded compressed baked compressed_baked}\n @directories = {}\n @symlinks = {}\n stages.each do |stage|\n @directories[stage.to_sym] = File.expand_path(File.join(to, stage))\n @symlinks[stage.to_sym] = options[:links] + '_' + stage if options[:links]\n end\n do_translate_steps(options).each do |step|\n case step\n when 'pull'\n # TODO DRY this up\n warn \"Pull files from the original archive\" unless options[:quiet]\n clear_stage :packed, options\n pull from, @directories[:packed], force: options[:force], quiet: options[:quiet]\n build_symlink :packed if options[:links] && options[:force]\n when 'unpack'\n warn \"Unpack the files (from Honeywell binary format)\" unless options[:quiet]\n clear_stage :unpacked, options\n clear_stage :cataloged, options\n unpack @directories[:packed], @directories[:unpacked], \n flatten: options[:flatten], strict: options[:strict], fix: options[:fix], \n force: options[:force], quiet: options[:quiet]\n build_symlink :unpacked if options[:links] && options[:force]\n when 'catalog'\n warn \"Catalog the files (using a catalog file)\" unless options[:quiet]\n raise MissingCatalog, \"No catalog specified\" unless options[:catalog]\n clear_stage :cataloged, options\n catalog @directories[:unpacked], @directories[:cataloged], :catalog=>options[:catalog], \n force: options[:force], quiet: options[:quiet]\n build_symlink :cataloged if options[:links]\n when 'decode'\n warn \"Decode the files\" unless options[:quiet]\n from = if File.exists?(@directories[:cataloged])\n @directories[:cataloged]\n else\n @directories[:unpacked]\n end\n clear_stage :decoded, options\n decode from, @directories[:decoded], force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'compress'\n warn \"Compress the files\" unless options[:quiet]\n from = @directories[:decoded]\n clear_stage :compressed, options\n compress @directories[:decoded], @directories[:compressed], \n aggressive: options[:aggressive], link: options[:link],\n force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'bake'\n warn \"Bake the files (i.e. remove metadata)\" unless options[:quiet]\n clear_stage :baked, options\n bake @directories[:compressed], @directories[:baked], force: options[:force], quiet: options[:quiet],\n index: options[:index]\n build_symlink :baked if options[:links] && options[:force]\n when 'tests'\n warn \"Rebuild test cases\" unless options[:quiet]\n cmd = 'bun test build'\n cmd += ' --quiet' if options[:quiet]\n system(cmd)\n else\n raise InvalidStep, \"Unknown step #{step}\"\n end\n end\n end",
"def deliver(iSrcFileName, iDstFileName, iFormatConf, iMetadata)\n # TODO: Implement it using an external tool, and make regression testing\n lTranslatedParams = []\n iParams.each do |iParam, iValue|\n case iParam\n when :SampleRate\n lTranslatedParams << \"Sample rate: #{iValue} Hz\"\n when :BitRate\n lTranslatedParams << \"Bit rate: #{iValue} kbps\"\n else\n log_warn \"Unknown MP3 format parameter: #{iParam} (value #{iValue.inspect}). Ignoring it.\"\n end\n end\n puts \"Convert file #{iSrcFileName} into file #{iDstFileName} in MP3 format with following parameters: #{lTranslatedParams.join(', ')}\"\n puts 'Press Enter when done.'\n $stdin.gets\n end",
"def convert_to(format)\n prepare_for_conversion unless @prepare_for_conversion\n output_path = output_path(format)\n\n log_folder = create_log_folder\n stdout_log, stderr_log = stdout_log(format), stderr_log(format)\n\n Cmd::Conversion.new(temp_path, output_path, format).run! %W(#{stdout_log} a), %W(#{stderr_log} a)\n rescue StandardError => e\n FileUtils.rm_rf output_folder\n raise e\n end",
"def process_file_or_directory(src, dest, ext = nil)\n\n raise 'Source not given' if src.nil? or not File.exists? src\n\n raise 'Destination not given' if dest.nil? or not File.exists? dest\n\n if File.directory? src\n process_directory(src, dest, ext)\n else\n process_file(src, dest)\n end\n end",
"def initialize(source, backend: nil, definition: nil)\n @source = source\n @backend = backend\n @definition = definition || self.class\n @context = Importu::ConverterContext.with_config(config)\n end",
"def internal_convert(\n input, convert_logger, backend, standalone, extra_attributes\n )\n attributes = { 'docdir' => File.dirname(__FILE__) }\n attributes.merge! extra_attributes\n args = internal_convert_args convert_logger, backend, standalone, attributes\n Asciidoctor.convert input, args\nend",
"def import\n read_dict_file(:langA)\n write_database(:langA)\n\n read_dict_file(:langB)\n write_database(:langB)\n end",
"def guess_source_type\n\t\ttable = \"\"\n\t\tif @data_source == \"uniteu\"\n\t\t\t@json[:tables].each do |t|\n\t\t\t\tif @file.downcase.match(t)\n\t\t\t\t\ttable << t\n\t\t\t\tend\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\ttype = case File.basename(@file)\n\t\t\t\twhen /^SO/ then table << \"SO\"\n\t\t\t\twhen /^ECStyle/ then table << \"ECStyle\"\n\t\t\t\twhen /^ECCustomer/ then table << \"ECCustomer\"\n\t\t\t\twhen /^CUST/ then table << \"CUST\"\n\t\t\t\twhen /^CatTree/ then table << \"CatTree\"\n\t\t\t\telse table << \"unknown\"\n\t\t\tend\n\t\tend\n\t\ttable\n\tend",
"def source_type\n if source\n if source[:url]\n :url\n elsif source[:git]\n :git\n elsif source[:file]\n :file\n elsif source[:path]\n :path\n end\n else\n :project_local\n end\n end",
"def convert _node, _name = nil, _opts = {}\n \"Well done: You plugged in a converter backend named 'backend_tpl'\"\n end",
"def perform(params_json, id, audio_type)\n params = JSON.parse(params_json, symbolize_names: true)\n u = nil\n ActiveRecord::Base.connection_pool.with_connection do\n u = Caption.find(id)\n u.update(status: 'finished audio conversion')\n end\n\n # TODO\n # Need to handle locale here. What if we want to generate caption\n # for pt-BR, etc. instead of en-US?\n\n auth_file = params[:provider][:auth_file_path]\n\n SpeechToText::GoogleS2T.set_environment(auth_file)\n SpeechToText::GoogleS2T.google_storage(\n \"#{params[:storage_dir]}/#{params[:record_id]}\",\n 'audio',\n audio_type,\n params[:provider][:google_bucket_name]\n )\n operation_name = SpeechToText::GoogleS2T.create_job(\n params[:record_id],\n audio_type,\n params[:provider][:google_bucket_name],\n params[:caption_locale]\n )\n\n ActiveRecord::Base.connection_pool.with_connection do\n u.update(status: \"created job with #{u.service}\")\n end\n\n TTS::GoogleGetJob.perform_async(params.to_json,\n u.id,\n operation_name,\n audio_type)\n end",
"def create(projectid, file, filename, target_langs, options = {})\n payload = File.open(file, 'r')\n encoding = payload.external_encoding.to_s\n\n options[:targetLangs] = target_langs\n\n headers = {\n memsource: options.to_json,\n content_type: 'application/octet-stream',\n content_disposition: \"filename\\*=#{encoding}''#{filename}\"\n }\n\n path = \"#{Project::PATH}/#{projectid}/#{PATH}\"\n\n post(path, payload, headers: headers)\n end",
"def get_not_translated\n language = \"en\"\n language = params[:language] if params[:language]\n lang = []\n @files = {}\n @new_lang = []\n File.read(\"#{Rails.root}/lang/#{language}.rb\").scan(/l.store\\s?[\\'\\\"][^\\'\\\"]+[\\'\\\"]/) do |st|\n st.scan(/[\\'\\\"][^\\'\\\"]+[\\'\\\"]/) do |st2|\n lang << st2.gsub(/[\\'\\\"]/, \"\")\n end\n end\n\n @files_list = Dir.glob(\"#{Rails.root}/app/controllers/*.rb\").collect\n @files_list += Dir.glob(\"#{Rails.root}/app/views/**/*.rhtml\").collect\n @files_list += Dir.glob(\"#{Rails.root}/app/models/*.rb\").collect\n @files_list += Dir.glob(\"#{Rails.root}/app/helpers/*.rb\").collect\n @files_list += Dir.glob(\"#{Rails.root}/lib/**/*.rb\").collect\n for file in @files_list\n File.read(file).scan(/[^\\w\\d]\\_\\([\\'\\\"][^\\'\\\"]+[\\'\\\"]\\)/) do |st|\n st = st.gsub(/.?\\_\\(/, \"\").gsub(/[\\s\\'\\\"\\)\\(]/, \"\")\n @new_lang << st\n @files[st] = file\n end\n end\n\n @new_lang -= lang\n @new_lang = @new_lang.uniq.flatten\n end",
"def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n end",
"def generate_wav_source(source)\n ext = File.extname(source)\n ext_gsubbed = ext.gsub(/\\./, '')\n\n if ext != \".wav\"\n input_options = { type: ext_gsubbed }\n output_options = { type: \"wav\" }\n source_filename_without_extension = File.basename(source, ext)\n output_file_path = File.join File.dirname(source), \"tmp_#{source_filename_without_extension}_#{Time.now.to_i}.wav\"\n converter = Sox::Cmd.new\n converter.add_input source, input_options\n converter.set_output output_file_path, output_options\n converter.run\n output_file_path\n else\n source\n end\n rescue Sox::Error => e\n raise e unless e.message.include?(\"FAIL formats:\")\n raise RuntimeError.new(\"Source file #{source} could not be converted to .wav by Sox (Sox: #{e.message})\")\n end",
"def process_file(src)\n media = \"\"\n # files first\n get_files(src).each do |file|\n next if file =~ /\\/\\._/\n \n # first we check if the file is a tv series\n episode_status, episode_name, episode_season, episode_episode = tv_file(file) if $config[\"series\"][\"process\"] == true\n if episode_status == true\n episode = Episode.new file\n if episode.is_ep?\n episode.status = handle_series episode \n media = episode.class.to_s\n end\n end\n \n # second we check if the file is music\n music_status = music_file(file) if $config[\"music_file\"][\"process\"] == true\n if music_status == true\n music = Music.new file\n if music.is_music?\n music.status = handle_music music \n media = music.class.to_s\n end\n end\n \n # finally we can handle rar's\n handle_rar(file) if file =~ /\\.rar$/ and file !~ /part\\d+\\.rar$/\n handle_rar(file) if file =~ /part01\\.rar$/\n end # get_files\n media\nend",
"def get_translation(lang_code)\n # format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country lang_code\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language lang_code_cut\n return nil\n end\n\n # check if original text is in the new language\n unless original_text.nil?\n lang_code_original_cut = TranslationsHelper.cut_country original_text.lang_code\n\n if original_text.lang_code == lang_code\n return original_text.text\n elsif original_text.lang_code == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n elsif lang_code_original_cut == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_into_lang_code(lang_code)\n else\n add_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n\n return translate_into_lang_code(lang_code)\n else\n return trans.text\n end\n end",
"def parse_lang_file\n # Open .lang file and parse it, then copy \n # its full grammatical expression.\n File.open(@lang_file, \"r:UTF-8\") do |file|\n lines_count = 1\n current = :none\n\n # Evaluating lines\n while (line = file.gets)\n # Parsing .lang file\n case line\n when /(^\\s*$)|(^\\s*#.*$)/\n # Ignore blank lines or comments\n \n when /^\\s*symbols\\s*for\\s*(\\w*)?\\s*(\\w+)\\s*:\\s*(#.*)?$/\n # Create new symbol set\n captured = line.scan(/\\s*(\\w+)\\s*:/)\n current_binding = captured[0][0]\n @bindings[current_binding] = ConlangWordGenerator::SymbolSet.new\n current = :symbols\n\n when /^\\s*expression\\s*:\\s*(#.*)?$/\n # Start of grammatical expression\n current = :expression\n\n when /^\\s*replacements\\s*:\\s*(#.*)?$/\n # Start of list of replacements\n current = :replacements\n\n when /^\\s*(\\S+)\\s*[:=]\\s*(\\S+)\\s*(#.*)?$/\n # Add bindings\n case current\n when :symbols\n #Add a symbol to the current SymbolSet's binding\n @bindings[current_binding].add_pair($1, $2.to_i)\n when :replacements\n @replacements[$1] = $2\n else\n raise LangSyntaxError, \"Runtime error when evaluating \" +\n \"\\\"#{@lang_file}\\\" at binding line #{lines_count}.\"\n end\n else\n if current == :expression\n # Copying expression\n @full_expression += line.strip\n else\n raise LangSyntaxError, \"Runtime error when evaluating \" +\n \"\\\"#{@lang_file}\\\" at line #{lines_count}.\"\n end\n end\n\n #Counting lines\n lines_count += 1\n end\n end\n end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end",
"def create\n @o_single = Language.new(language_params)\n respond_to do |format|\n if @o_single.save\n create_locale_file\n format.html { redirect_to admin_languages_url, notice: t(\"general.successfully_created\") }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def convert input_io, options={}\n @exception = nil\n #1\n iam \"Retrieving cookies... \", false do\n response = self.class.get '/tools/webfont-generator'\n @cookies = (response.headers.get_fields(\"Set-Cookie\") || []).join(\";\")\n fail \"Failed to retrieve cookies\" if @cookies.empty? \n self.class.headers({\"Cookie\" => @cookies})\n @@headers_set = true\n response\n end unless @@headers_set\n\n #2\n iam \"Uploading font... \" do\n response = self.class.post '/uploadify/fontfacegen_uploadify.php', :query => {\n \"Filedata\" => File.new(input_io)\n }\n @path_data = response.body\n @id, @original_filename = @path_data.split(\"|\")\n fail \"Failed to upload the file. Is it a valid font?\" if @id.nil? || @original_filename.nil?\n response\n end\n\n #3\n iam \"Confirming upload... \" do\n response = self.class.post \"/tools/insert\", :query => {\n \"original_filename\" => @original_filename,\n \"path_data\" => @path_data\n }\n json = JSON.parse response.body\n fail (json[\"message\"] || \"Failed to confirm the upload. Is it a valid font?\") if !json[\"name\"] || !json[\"id\"]\n response\n end\n\n #4\n iam \"Generating webfont... \" do\n custom_options = options.delete :custom_options\n options[:id] = @id\n @params = OptionsSanitizer.sanitize(options, custom_options)\n logger.debug \"HTTP Params:\\n#{@params.collect{|k,v| \"#{k}: #{v.inspect}\" }.join(\"\\n\")}\"\n response = self.class.post \"/tools/generate\", :query => @params\n fail \"Failed to generate webfont kit\" if !response.body.empty?\n response\n end\n\n #5\n counter = 0\n while response = self.class.get(\"/tools/progress/#{@id}\") do \n p = JSON.parse(response.body)[\"progress\"].to_i\n logger.info \"Progress: #{p} \"\n if p == 100\n break\n elsif p == 0\n fail \"Progress timeout\" if (counter += 1) > 10\n end\n sleep 2 \n end\n\n #6\n iam \"Downloading fonts... \", false do\n response = self.class.post \"/tools/download\", :query => @params\n end\n\n #7\n if !options[:output_io]\n filename = response.headers[\"Content-Disposition\"].gsub(/attachment; filename=\\\"(.*)\\\"/,'\\1')\n options[:output_io] = File.new(filename, \"wb\")\n end\n options[:output_io] << response.response.body\n\n end",
"def convert(input, file_path = nil)\n render process parse(input, file_path)\n end",
"def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n \n\n parameters = []\n \n # Add source\n parameters << @convert_options[:input].map { |k,v| \"-#{k.to_s} #{v} \"}\n parameters << \"-f --quiet :source\"\n parameters << @convert_options[:output].map { |k,v| \"-#{k.to_s} #{v} \"}\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n \n Paperclip.log(\"[lame] #{parameters}\")\n begin\n success = Paperclip.run(\"lame\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Cocaine::ExitStatusError => e\n raise PaperclipError, \"error while processing video for #{@basename}: #{e}\" if @whiny\n end\n\n dst\n end",
"def get_flrtvc_name(type,\n target = '',\n name_suffix = '')\n #\n # Log.log_debug('get_flrtvc_name type=' + type.to_s + ' target=' +\n # target.to_s + ' name_suffix=' + name_suffix.to_s)\n case type\n when :temp_dir\n returned = ::File.join(@root_dir,\n 'temp')\n # check it exist\n Utils.check_directory(returned)\n # clean it\n FileUtils.rm_rf Dir.glob(\"#{returned}/*\")\n when :tar_dir\n returned = ::File.join(@root_dir,\n 'tar_dir')\n Utils.check_directory(returned)\n when :tempftp_download\n returned = ::File.join(@root_dir,\n 'tempftp_download')\n Utils.check_directory(returned)\n when :common_efixes\n returned = ::File.join(@root_dir,\n 'common_efixes')\n Utils.check_directory(returned)\n when :efixes\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_#{name_suffix}\")\n when :emgr\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_emgr.txt\")\n when :filesets\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_filesets.txt\")\n when :flrtvc\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_flrtvc.csv\")\n when :lslpp\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_lslpp.txt\")\n when :NIM_dir\n returned = ::File.join(@root_dir,\n \"#{target}_NIM\",\n 'emgr',\n 'ppc')\n Utils.check_directory(returned)\n when :NIM_res\n returned = \"PAA_FLRTVC_#{target}\"\n when :URL\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n \"#{target}_URL.txt\")\n when :YML\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = if name_suffix == 'lppminmax_of_fixes'\n ::File.join(returned,\n \"#{name_suffix}.yml\")\n elsif name_suffix == 'all_listoffixes_per_url'\n ::File.join(returned,\n \"#{name_suffix}.yml\")\n else\n ::File.join(returned,\n \"#{target}_#{name_suffix}.yml\")\n end\n else\n returned = ::File.join(Constants.output_dir,\n 'flrtvc')\n Utils.check_directory(returned)\n returned = ::File.join(returned,\n type + \"_#{target}.txt\")\n end\n # Log.log_debug('get_flrtvc_name returning ' + returned)\n returned\n end",
"def convert!(*args)\n params = args.last.is_a?(Hash) ? args.last : {} # :[] OM NOM NOM\n base_name = compound_template_url ? 'Compound' : self.class.name.demodulize\n driver = case Capybara.current_driver\n when :selenium then 'Web'\n when :ios then 'IOS'\n when :android then 'Android'\n end\n\n convertor = \"TestChamber::Convertor::#{base_name}::#{driver}\"\n\n begin\n conversion_module = convertor.constantize\n rescue NameError => e\n # For the web, we are ok with a generic fallback behavior. Don't raise\n # if it's not overriden.\n unless Capybara.current_driver == :selenium\n e.message << \"\\nCouldn't find the conversion module '#{convertor}'.\"\n raise e\n end\n conversion_module = TestChamber::Convertor::Web\n end\n\n extend conversion_module\n\n # Offers with TPT enabled use a third party SDK. We simulate the ping\n # to the third party (instead of a regular connect) by pinging the fake\n # third party service set up on the TIAB.\n #\n # Mixing in this behavior overrides do_conversion.\n if tpat_enabled\n extend TestChamber::Convertor::TPAT\n end\n\n last_click = click(params)\n # Get the converting app from the last click.\n converting_app = App.new(id: last_click.attribute('publisher_app_id'))\n\n do_conversion!(converting_app, params)\n conversion(converting_app, params)\n end",
"def prepareDirectory( outputfn )\n scriptpath = File.dirname __FILE__\n cf = File.join scriptpath, \"conversion_files\"\n i = 0 \n max = 3\n\n print \"#\"*40, \"\\n\", \"Preparing Directory\\n\", \"#\"*40, \"\\n\\n\"\n\n phasePrint \"Create Base Folder / Check Dependencies\", i+=1, max\n # Make our base directory\n if not Dir.exists? outputfn\n FileUtils.mkdir_p outputfn\n end\n\n # See if our conversion_files folder exists, this is required\n if not Dir.exists? cf \n error \"Missing conversion_files folder:\\n#{cf}\\n\\nThe conversion process cannot continue.\"\n return nil\n end\n\n # Check for the python cache extracted folder\n if not Dir.exists? File.join( cf, \"python27\" ) and $options[:python]\n if not File.exists? cf+\"python27.zip\"\n error \"Missing packaged Python 2.7.8 installation folder or zip in conversion_files, this is required for the \\\"Include Python\\\"//\\\"--python\\\" option.\\n\\nThe conversion process cannot continue.\"\n return nil\n else\n # Extract our python27.zip folder\n phasePrint \"Extracting Python\", i+=0.5, max\n error \"Extracting python27.zip, this may take some time.\\n\\nIt is quicker to extract this by hand into the conversion_files folder using 7-zip or Peazip, as they are capable of using multiple cores.\"\n unzip \"#{cf}python27.zip\", cf\n end\n end\n\n i = i.floor if i.is_a? Float\n phasePrint \"Copying Python to Output Folder\", i+=1, max\n print \" This will take some time\\n\"\n # Copy Python over to the directory\n if not Dir.exists? File.join( outputfn, \"python27\" ) and $options[:python]\n FileUtils.cp_r File.join( cf, \"python27\" ), outputfn\n end\n\n phasePrint \"Initializing File Structure\", i+=1, max\n FileUtils.cp File.join( cf, \"run.bat\" ), outputfn\n\n FileUtils.cp_r File.join( cf, \"includes\" ), outputfn\n\n return File.new( File.join( outputfn, \"run_test.py\" ), \"w+:UTF-8\" )\nend",
"def c src, options = {}\n options = {\n :expand_types => true,\n }.merge options\n self.generate src, options\n end",
"def update\n @screen = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n\n @label = Label.find(params[:id])\n\n @label.update_attributes(params[:label])\n \n if @label.errors.empty?\n @captions = params[:captions]\n @captions.each do |language_id, caption_name|\n caption = Caption.find(:first ,\n :conditions => {\n :captions => { :label_id => @label.id , :language_id => language_id }\n }\n )\n caption.update_attributes(\n :name => caption_name\n )\n end\n end\n end",
"def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end",
"def convert\n return unless answer_type\n\n self.answer = convert_by_answer_type\n check_range\n answer\n end",
"def translate(source_copy)\n sentences = source_copy.split(\".\")\n words = sentences.map { |s| s.split(\" \") }\n currency_indexes = words.flatten.each_with_index.select { |w, i| w.match(/[#{currencies}]/) }.map { |_, i| i }\n to_return = if words.flatten.count == 1\n pseudo_word\n elsif sentences.count == 1\n pseudo_phrase(words.flatten.count)\n else\n pseudo_paragraph(words.map { |s| s.count })\n end\n add_currencies(to_return, currency_indexes)\n end",
"def source(src)\n if src.respond_to?(:getc)\n if src.is_a? String\n if File.exist?(src)\n sourc = File.new(src)\n @lexr[:in] = src\n else\n sourc = StringIO.new(src)\n @lexr[:in] = nil\n end\n end\n @source = sourc\n else\n raise SourceError.new(source = sourc)\n end\n end",
"def execute!\n load_defaults unless @opts\n\n opts.s_files.each do |sname|\n Dir[sname].each { |fname| convert!(fname) }\n end\n end",
"def compose_translation(language, models)\n\n\t\t\t\t\t\t# Convert to array\n\t\t\t\t\t\tif !models.is_a? Array\n\t\t\t\t\t\t\tmodels = [ models ]\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Result\n\t\t\t\t\t\tresult = \"\"\n\t\t\t\t\t\tlast_model = nil\n\t\t\t\t\t\tlast_model_is_category = false\n\n\t\t\t\t\t\tmodels.each do |section_options|\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# Input check\n\t\t\t\t\t\t\tif !section_options.is_a? Hash\n\t\t\t\t\t\t\t\traise \"Incorrect input, expecting hash with :label and :models or :model items.\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif section_options[:models].nil? && !section_options[:model].nil?\n\t\t\t\t\t\t\t\tsection_options[:models] = [ section_options[:model] ]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif section_options[:models].nil? || section_options[:label].nil?\n\t\t\t\t\t\t\t\traise \"Incorrect input, expecting hash with :label and :models or :model items.\"\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# \"Is category\" option\n\t\t\t\t\t\t\tlast_model_is_category = section_options[:is_category] == true\n\n\t\t\t\t\t\t\tsection_options[:models].each do |model|\n\n\t\t\t\t\t\t\t\t# Get part\n\t\t\t\t\t\t\t\tif model.respond_to?(\"#{section_options[:label].to_s}_#{language.to_s}\".to_sym)\n\t\t\t\t\t\t\t\t\tpart = model.send(\"#{section_options[:label].to_s}_#{language.to_s}\".to_sym)\n\t\t\t\t\t\t\t\telsif model.respond_to?(section_options[:label].to_sym)\n\t\t\t\t\t\t\t\t\tpart = model.send(section_options[:label].to_sym)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tpart = nil\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t# Add part to result\n\t\t\t\t\t\t\t\tresult += \"/\" + part.to_url if part\n\n\t\t\t\t\t\t\t\t# Save last model\n\t\t\t\t\t\t\t\tlast_model = model\n\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Truncate correctly\n\t\t\t\t\t\tif !result.blank?\n\t\t\t\t\t\t\tif last_model_is_category || (last_model.hierarchically_ordered? && !last_model.leaf?)\n\t\t\t\t\t\t\t\tresult += \"/\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t#result += \".html\"\n\t\t\t\t\t\t\t\tresult += \"\"\n\t\t\t\t\t\t\tend\t\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\treturn result\t\t\t\t\t\t\n\t\t\t\t\tend",
"def create\n @user = current_user\n @project = Project.find(params[:project_id])\n @preferedlang = Language.find_by_id(@project.source_lang_id)\n @slanguages = Language.where(\"id != ?\", @preferedlang.id).order('iso_code asc') \n @slanguages.unshift(@preferedlang)\n #from railsrecipes recipe 22 - refactor\n # @user = current_user\n\n\n @mostpopulartarlang = Language.find_by_id(@project.translations.maximum(\"source_lang_id\"))\n if @mostpopulartarlang\n @tlanguages = Language.where(\"id != ?\", @mostpopulartarlang.id).order('iso_code asc')\n @tlanguages.unshift(@mostpopulartarlang)\n else\n @tlanguages = Language.order('iso_code desc')\n end\n\n\n @translation = @project.translations.build(params[:translation])\n @translation.owner_id = @user.id\n\n# @project = Project.find(params[:id])\n\n# @translation = Translation.new(params[:translation])\n# @translation.owner_id = current_user.id\n# @translation.project_id = Project.find_by_id(params[:project_id]).id\n # @user = User.find(params[:user_id])\n # @project = Project.find(params[:project_id])\n # @translation = Translation.new(params[:translation])\n # @project = current_user.projects.build\n # @translation = @project.translations.build\n # @user = current_user\n # @project = Project.find_by_user_id(@user)\n # @translation = @project.translations.build(params[:translation])\n @languages = Language.all(:order => 'iso_code')\n # #process information from checkbox\n\n if @translation.save\n flash[:notice] = \"Translation was successfully created\"\n # redirect_to user_project_translations_path(@user, @project)\n redirect_to user_project_path(current_user, @project)\n else\n render 'new'\n end\nend",
"def convert_media_type\n if can?(:>=, \"5\")\n @kit = Kitting::Kit.find_by_kit_number_and_commit_id(params[:kit_number],nil)\n @current_kit_media_type=@kit.kit_media_type\n @media_type_to_convert= Kitting::KitMediaType.find(params[:media_type])\n # if @current_kit_media_type.kit_type == \"configurable\" or @media_type_to_convert.kit_type == \"configurable\"\n # flash[:error] = \"Cannot Convert Kit Media of Configurable/Service Not Available\"\n # redirect_to :back\n # else\n if @media_type_to_convert.kit_type == \"binder\" and @current_kit_media_type.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Kit Media of Same Type(binder-binder) \"\n redirect_to :back\n else\n if @current_kit_media_type.kit_type == \"binder\"\n if @media_type_to_convert.kit_type == \"configurable\"\n @cups_to_delete = Kitting::Cup.where(\"kit_id = ? and id NOT IN (?)\",@kit.id,@kit.cup_parts.select { |cp| cp.status ==true }.map(&:cup_id))\n @cups_to_delete.map(&:destroy)\n if @kit.cups.count <= @media_type_to_convert.compartment\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n cup_count = @kit.cups.count\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,cup_count+cup_size,true, cup_count+1)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" )\n end\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n @cups_to_delete = Kitting::Cup.where(\"kit_id = ? and id NOT IN (?)\",@kit.id,@kit.cup_parts.select { |cp| cp.status ==true }.map(&:cup_id))\n @cups_to_delete.map(&:destroy)\n if @kit.cups.count <= @media_type_to_convert.compartment\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n @kit.create_binder_cups(@kit,cup_size,true)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n #Change Media Type from Configurable to Non-Configurable\n elsif @current_kit_media_type.kit_type == \"configurable\"\n if @media_type_to_convert.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Media Type to Binder\"\n redirect_to :back\n elsif @media_type_to_convert.kit_type == \"non-configurable\"\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n if cup_count <= @media_type_to_convert.compartment\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,@kit.cups.count+cup_size,true,@kit.cups.count+1)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_size = cup_count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"cup_number asc\").last(cup_size)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n ## Change Media Type from Configurable to Configurable\n elsif @media_type_to_convert.kit_type == \"configurable\"\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_count = @kit.cups.where('status = ?',true).count\n if cup_count <= @media_type_to_convert.compartment\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,@kit.cups.count+cup_size,true,@kit.cups.count+1)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_size = cup_count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"cup_number asc\").last(cup_size)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n end\n else\n if @media_type_to_convert.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Media Type to Binder\"\n redirect_to :back\n elsif @media_type_to_convert.kit_type == \"configurable\"\n #CHANGE Media Type from Non-Configurable to Configurable\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n if @kit.cups.count >= @media_type_to_convert.compartment\n # Changing From larger KitMediaType(Larger Kit) Cup Count to Smaller Configurable Kit ..............\n cup_count = @kit.cups.count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"id asc\").last(cup_count)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # Changing From Lesser KitMediaType(Smaller Kit) Cup Count to Larger Configurable Kit (UPGRADING ....)\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_count = @kit.cups.count\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,cup_count+cup_size,true,@kit.cups.count+1)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" )\n end\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # DOWNGRADING ..............\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n if @kit.cups.count >= @media_type_to_convert.compartment\n cup_count = @kit.cups.count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"id asc\").last(cup_count)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # KIT MEDIA TYPE HAVING CUP LESSER THAN THE ORIGINAL KIT MEDIA TYPE (UPGRADING ....)\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n @kit.create_binder_cups(@kit,cup_size,true)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n end\n end\n #end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def translate_csv csv, options\n fields_to_convert = options[:convert]\n fields_to_convert = [fields_to_convert].compact unless fields_to_convert.is_a?(Array)\n\n fields_to_translate = options[:translate]\n fields_to_translate = [fields_to_translate].compact unless fields_to_translate.is_a?(Array)\n to = options[:to] || 'en'\n from_country_code = options[:from]\n from = fields_to_translate.empty? ? nil : language(country(from_country_code))\n translator = self.new(from, to)\n\n items = Morph.from_csv csv, 'Item'\n keys = items.first.class.morph_attributes.select {|x| !x.to_s[/^t_/] }\n\n items.each do |item|\n keys.each do |key|\n translator.translate_value(item, key) if fields_to_translate.include?(key) \n translator.convert_value(item, key) if fields_to_convert.include?(key)\n end\n end\n\n keys = keys.map do |key|\n if fields_to_translate.include?(key) || fields_to_convert.include?(key)\n [\"t_#{key}\", key]\n else\n key\n end\n end.flatten\n\n output = FasterCSV.generate do |csv|\n csv << keys.collect(&:to_s)\n items.each do |item|\n csv << keys.collect { |key| item.respond_to?(key) ? item.send(key) : nil }\n end\n end\n end",
"def process_model src, file_name\n result = ModelProcessor.new(@tracker).process_model src, file_name\n AliasProcessor.new(@tracker).process result if result\n end",
"def process_data(lang, key, data)\n if data.is_a?(Hash)\n data.each do |subkey, subdata|\n subkey_fullname = key + (key == '' ? '' : '.') + subkey\n process_data(lang, subkey_fullname, subdata)\n end\n elsif data.is_a?(String)\n if $CURRENT_TRANSLATIONS[lang].key?(key)\n # Potential change to an existing translation\n this_current_translation = $CURRENT_TRANSLATIONS[lang][key]['target'].rstrip\n new_translation = data.rstrip\n if this_current_translation != new_translation\n # Translation has changed!\n id = $CURRENT_TRANSLATIONS[lang][key]['id']\n puts \"CHANGE TRANSLATION #{lang} KEY \\\"#{key}\\\"\"\n puts \" \\\"#{this_current_translation}\\\"\"\n puts \"=> id: #{id}\"\n puts \" \\\"#{new_translation}\\\"\"\n puts\n if !change_translation(id, new_translation)\n STDERR.puts \"Failed to update #{key} - halting\"\n exit 1\n end\n end\n else\n # Entirely NEW entry.\n new_translation = data\n if !$SOURCE.key?(key)\n STDERR.puts \"Source does not have key #{key}\"\n exit 1\n end\n source = $SOURCE[key]\n puts \"ADD TRANSLATION #{lang} KEY \\\"#{key}\\\":\"\n puts \" \\\"#{source}\\\"\"\n puts ' =>'\n puts \" \\\"#{new_translation}\\\"\"\n puts\n if !post_translation(key, lang, source, new_translation)\n STDERR.puts \"Failed to insert new translation for #{key} - halting\"\n exit 1\n end\n end\n elsif data.nil?\n # Ignore nil values\n else\n # Crash, something went wrong\n STDERR.puts \"Error: Bad class. Value '#{data}' has type #{data.class}\"\n exit 1\n end\nend",
"def start_convert \n puts \"What do you want to convert?\"\n puts \"- [lbs] to kg\\n- [oz] to grams\\n- [gallon] to litre\\n- [quart] to ml\\n- [kg] to lbs\\n- [grams] to ounce\\n- [ml] to quartz\\n- [litre] to gallon\".colorize(:yellow)\n user_input = gets.chomp\n case user_input\n when \"lbs\"\n puts \"Converting lbs to kg\"\n user_convert = gets.chomp\n puts \"#{@convert.lbs_to_kg(user_convert)} kg\"\n when \"oz\"\n puts \"Converting ounce to grams\"\n user_convert = gets.chomp\n puts \"#{@convert.oz_to_g(user_convert)} g\"\n when \"gallon\"\n puts \"Converting gallon to litre\"\n user_convert = gets.chomp\n puts \"#{@convert.gallon_to_litre(user_convert)} litre\"\n when \"quart\"\n puts \"Converting quartz to mililitre\"\n user_convert = gets.chomp\n puts \"#{@convert.quart_to_ml(user_convert)} ml\"\n when \"kg\"\n puts \"Converting kg to lbs\"\n user_convert = gets.chomp\n puts \"#{@convert.kg_to_lbs(user_convert)} pounds\"\n when \"grams\"\n puts \"Converting grams to ounce\"\n user_convert = gets.chomp\n puts \"#{@convert.g_to_oz(user_convert)} oz\"\n when \"ml\"\n puts \"Converting mililitre to quartz\"\n user_convert = gets.chomp\n puts \"#{@convert.ml_to_quartz(user_convert)} quartz\"\n when \"litre\"\n puts \"Converting litre to gallon\"\n user_convert = gets.chomp\n puts \"#{@convert.litre_to_gallon(user_convert)} gallon\"\n when \"end\"\n self.start_main_menu\n else\n puts \"not a valid input\"\n end\n self.start_convert\n end",
"def clean_from_lang(inputpath, keep_lang, outputpath)\n\n input_file = File.read(inputpath)\n\n File.open(outputpath, \"wb\") do |outputFile|\n #Go through the ontology file line by line\n input_file.each_line do |line|\n\n # Remove all lines that have a xml:lang different from keep_lang\n regex_get_lang = line.scan(/<.* xml:lang=\"([a-z]*)\">(.*?)<\\/.*>/)\n if regex_get_lang.any?\n if regex_get_lang[0][0] != keep_lang\n line = \"\"\n end\n end\n\n outputFile.write(line)\n end\n end\n\nend",
"def process(src)\n super\n @format = case src.parser.to_s\n when 'RDoc::Parser::PerlPOD'\n 'perl'\n when 'RDoc::Parser::C'\n 'c'\n when 'RDoc::Parser::Simple'\n 'text'\n else\n 'ruby'\n end\n\n @last_modified = src.last_modified\n @absolute_name = src.absolute_name\n @full_name = src.full_name\n end",
"def convert_image_multipage_image_format_convert(format1, format2, input_file, opts = {})\n data, _status_code, _headers = convert_image_multipage_image_format_convert_with_http_info(format1, format2, input_file, opts)\n data\n end"
] |
[
"0.645276",
"0.51610065",
"0.51556504",
"0.5090777",
"0.50742704",
"0.4923128",
"0.4892049",
"0.48383597",
"0.47344825",
"0.4706987",
"0.46942037",
"0.46891785",
"0.4681737",
"0.46329215",
"0.4613695",
"0.4571641",
"0.45504057",
"0.44888973",
"0.44713172",
"0.4471253",
"0.44690767",
"0.4460537",
"0.44465986",
"0.44454286",
"0.43801206",
"0.4353052",
"0.43443578",
"0.4317415",
"0.42946738",
"0.42916447",
"0.42505676",
"0.42254993",
"0.42248017",
"0.4207719",
"0.42057455",
"0.41985583",
"0.41972128",
"0.41945603",
"0.41780803",
"0.4171818",
"0.41547263",
"0.4153485",
"0.4152961",
"0.41509977",
"0.4127202",
"0.41266394",
"0.41243196",
"0.41241682",
"0.41228765",
"0.41160882",
"0.41088307",
"0.40865412",
"0.40788764",
"0.40566254",
"0.4048506",
"0.4042466",
"0.40310004",
"0.4028799",
"0.4026168",
"0.40235895",
"0.40217233",
"0.4019072",
"0.401501",
"0.40130216",
"0.39923218",
"0.39796615",
"0.39735165",
"0.39618057",
"0.39559984",
"0.39417404",
"0.3928924",
"0.3926987",
"0.3909837",
"0.3906163",
"0.38894576",
"0.3881326",
"0.38805586",
"0.3877678",
"0.38737762",
"0.3870293",
"0.38651294",
"0.38610175",
"0.38540146",
"0.3852559",
"0.38428456",
"0.38364288",
"0.38330868",
"0.38320726",
"0.38260996",
"0.38248476",
"0.38203442",
"0.38173893",
"0.38086724",
"0.38061205",
"0.38050422",
"0.3804506",
"0.38024324",
"0.38014406",
"0.3795192",
"0.3794148"
] |
0.6803488
|
0
|
Method to report on the supported transformations. Each implementor is free to return the types to which it can convert itself to ==== Returns An array of one or more types defined as +TYPE_+ constants here
|
def supported_transformations
raise "Not Implemented. Class #{self.class.name} doesn't implement supported_transformations"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def types\n trans = ChessMoves::Transformations[@type]\n trans ? [@type, trans.first] : [@type]\n end",
"def cast_types; end",
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform\n ]\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def transforms\n @transforms ||= []\n end",
"def transformations; end",
"def types(types); end",
"def transformers\n strong_memoize(:transformers) do\n defined_transformers = self.class.transformers.map(&method(:instantiate))\n\n transformers = []\n transformers << self if respond_to?(:transform)\n transformers.concat(defined_transformers)\n transformers\n end\n end",
"def transforms; end",
"def transforms( inputs, type )\n return inputs.map {|abs| self.transform( abs )}\n end",
"def options_for_supported_types\n Mapping::SUPPORTED_TYPES.map do |type|\n [type.titleize.to_s, type]\n end\n end",
"def presentation_unit_types\n [packing_material.presentation_unit_type] + packing_material.presentation_unit_type.presentation_unit_type_conversions.map(& :presentation_unit_type_to)\n end",
"def transformation\n end",
"def fully_transformable?\n true\n end",
"def valid_types(record)\n Array(record.supported_mime_types)\n rescue NoMethodError\n Array.new\n end",
"def transformer\n convert unless @options.empty?\n end",
"def converted_arrays; end",
"def each_needed_transformation(&block)\n if !block_given?\n return enum_for(:each_needed_transformation)\n end\n\n needed_transformations.each(&block)\n supercall(nil, :each_needed_transformation, &block)\n end",
"def validate_transform( rule, spec )\n warn_nyi( \"transformation validations\" )\n \n case spec.type.name\n \n when \"assignment_transform\", \"append_transform\"\n validate_transform( rule, spec.source )\n validate_transform( rule, spec.destination )\n \n when \"unset_transform\"\n validate_transform( rule, spec.destination )\n \n when \"npath_predicate_exp\"\n validate_transform( rule, spec.npath )\n validate_transform( rule, spec.npred )\n when \"npath_path_exp\", \"npath_branch_exp\"\n validate_transform( rule, spec.tree )\n validate_transform( rule, spec.leaf )\n when \"npath_tclose_exp\"\n validate_transform( rule, spec.npath )\n when \"npath_slot_exp\", \"npath_self_exp\"\n # no op, for now\n \n \n when \"npred_type_exp\"\n spec.define_slot( \"_type_name\", create_name(spec.type_name) )\n when \"npred_slot_exp\"\n # no op, for now\n when \"npred_negation_exp\"\n validate_transform( rule, spec.npred )\n when \"npred_or_exp\", \"npred_and_exp\"\n validate_transform( rule, spec.tree )\n validate_transform( rule, spec.leaf )\n else\n nyi( \"support for transform element [#{spec.type.name}]\", spec )\n end\n \n return spec\n end",
"def argument_types\n @arguments.map(&:type)\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def converters; end",
"def converters; end",
"def converters; end",
"def callables\n signatures = @func.dispatcher.to_type\n signatures.is_a?(Puppet::Pops::Types::PVariantType) ? signatures.types : [signatures]\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def filetype_conversion(options)\n @transform_tasks.push(\n add_transform_task('output', options)\n )\n self\n end",
"def selectable_output_types\n if research_output.plan.template.customize_output_types?\n research_output.plan.template.template_output_types.map do |ot|\n [ot.research_output_type.humanize, ot.research_output_type]\n end\n else\n ResearchOutput::DEFAULT_OUTPUT_TYPES.map { |k| [k.humanize, k] }\n end\n end",
"def types\n @data.keys & TYPES\n end",
"def types=(_arg0); end",
"def target_types\n return @target_types\n end",
"def mixed_types\n types = []\n types << 'MV' if (bib_format == 'MX') || (record.leader[8] == 'a')\n types << 'MW' if %w[d f p t].include?(record.leader[6])\n return types\n end",
"def type\n compile! unless @compiled\n [@type].flatten\n end",
"def converters\n @converters ||= site.converters.select { |c| c.matches(document.extname) }.tap(&:sort!)\n end",
"def generic_supported_types\n [\n # general\n \"num_participants\",\n \"num_assignments\",\n \"num_teams\",\n \"num_reviews\",\n # assignment_teams\n \"total_num_assignment_teams\",\n \"average_num_assignment_teams\",\n \"max_num_assignment_teams\",\n \"min_num_assignment_teams\",\n # assignment_scores\n \"average_assignment_score\",\n \"max_assignment_score\",\n \"min_assignment_score\",\n # assignment_reviews\n \"total_num_assignment_reviews\",\n \"average_num_assignment_reviews\",\n \"max_num_assignment_reviews\",\n \"min_num_assignment_reviews\",\n # team_reviews\n \"total_num_team_reviews\",\n \"average_num_team_reviews\",\n \"max_num_team_reviews\",\n \"min_num_team_reviews\",\n # team_scores\n \"average_team_score\",\n \"max_team_score\",\n \"min_team_score\",\n # review_score\n \"average_review_score\",\n \"max_review_score\",\n \"min_review_score\",\n # review_word_count\n \"total_review_word_count\",\n \"average_review_word_count\",\n \"max_review_word_count\",\n \"min_review_word_count\",\n # character_count\n \"total_review_character_count\",\n \"average_review_character_count\",\n \"max_review_character_count\",\n \"min_review_character_count\"\n ]\n end",
"def types\n @data.flat_map { |iso2, data| data[:valid] }.uniq\n end",
"def types_from_array_records(samples)\n columnar_types = []\n samples.each do |record|\n record.each_with_index {|value,i| (columnar_types[i] ||= []) << guess_type(value) }\n end\n columnar_types.map {|types| merge_types(types) }\n end",
"def transform; end",
"def types\n @types.dup\n end",
"def types\n @types.dup\n end",
"def explain_types; end",
"def magick_formats\n @magick_formats ||= `convert -version`\n .scan(/Delegates.*/)\n .first\n .delete_prefix('Delegates (built-in):')\n .split\n end",
"def possible_types\n @data.flat_map { |iso2, data| data[:possible] }.uniq\n end",
"def needed_types\n self.scan unless @needed_types\n @needed_types\n end",
"def value_types; end",
"def transform\n end",
"def transform(transformation)\n end",
"def registered_types\n end",
"def types\n @stmt.types\n end",
"def get_all_formats(iDirection)\n if (@DataAsText != nil)\n return [ DataObjectSelection.getDataFormat, Wx::DF_TEXT ]\n else\n return [ DataObjectSelection.getDataFormat ]\n end\n end",
"def convert(type)\n case type\n when 'tests' then @test_tool.convert\n when 'coverage' then @coverage_tool.convert\n when 'all'\n @test_tool.convert\n @coverage_tool.convert\n end\n end",
"def can_convert?\n array.is_a?(Array)\n end",
"def can_convert?\n MagicObjects.magic?(object)\n end",
"def expand_transform_accepts(parsed_accepts)\n accepts = []\n parsed_accepts.each do |(type, q)|\n accepts.push([type, q])\n inverted_transformers[type].keys.each do |subtype|\n accepts.push([subtype, q * 0.8])\n end\n end\n accepts\n end",
"def types\n @stmt.types\n end",
"def human_types\n types.map { |type| Core::TYPES_DESC[type] }\n end",
"def collect_types_of_lesson\n [ [\"Обязательное занятие\", \"Primary lesson\"], [\"Электив\", \"Extra\"] ]\n end",
"def respond_to_missing?(method_name, *)\n TransformConfig::TRANSFORMATIONS.include?(method_name.to_s || super)\n end",
"def to_type()\n callables = dispatchers.map do | dispatch |\n t = Puppet::Pops::Types::PCallableType.new()\n # TODO: handle that dispatch.type may be an ArrayType instead of a TupleType\n t2 = dispatch.type\n t.param_types = Puppet::Pops::Types::TypeCalculator.copy_as_tuple(t2)\n # TODO: Function does not have a block type yet\n t\n end\n if callables.size > 1\n # multiple signatures, produce a Variant type of Callable1-n\n t = Puppet::Pops::Types::PVariantType.new()\n t.types = callables\n t\n else\n # single signature, produce single Callable\n callables.pop\n end\n end",
"def resolve_transform_type(type, accept)\n find_best_mime_type_match(accept || '*/*', [type].compact + transformers[type].keys)\n end",
"def supported_hook_type_classes\n supported_hook_types.map do |file|\n file.split('-').map(&:capitalize).join\n end\n end",
"def value_types=(_arg0); end",
"def matching_types(&matcher)\n yield(self) ? [self] : []\n end",
"def types\n respond_to?(:articleType) ? articleType : []\n end",
"def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end",
"def transforms( inputs, type ) #:nodoc:\n nsamples = inputs.size\n result = [1.0]\n (nsamples-1).times do\n result << result[-1] / @factor\n end\n range = (1.0..result[-1])\n result = result.map {|v| range.abscissa( v )}\n return result\n end",
"def types\n @types ||= []\n end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def wrappers\n @known_classes.select {|c| c <= ::Dat::Analysis::Result }\n end",
"def provided_formats\n @target.class_provided_formats\n end",
"def transform_to(types, src_lang, target_lang, output_dir)\n if (types - supported_transformations).size != 0\n raise InvalidInputException.new(\"Unknown types provided for conversion in input #{types}\")\n end\n unless File.directory?(output_dir)\n FileUtils.mkdir_p(output_dir)\n end\n # Basic validations\n if types.include?(TYPE_SCC)\n if target_lang && !target_lang.eql?(\"en\")\n raise InvalidInputException.new(\"SCC can be generated only in en. #{target_lang} is unsupported\")\n end\n end\n end",
"def each_transformation(&block)\n if !block_given?\n return enum_for(:each_transformation)\n end\n\n seen = Set.new\n needed_transformations.each do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_inputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_outputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n\n supercall(nil, :each_transformation, &block)\n end",
"def transform!\n raise NotImplementedError, \"You have to implement #transform! in your transformer\"\n end",
"def flow_types\n return @flow_types\n end",
"def determine_type_all(doc,reference)\n\n type = determine_type_locally(doc,reference)\n type = determine_type_globally(doc,reference) if type.nil?\n return type\n\n end",
"def convertDataTypes\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points] = @Function[:Points].map do |iPoint|\n lNewPointX = nil\n lNewPointY = nil\n if (iPoint[0].is_a?(Rational))\n lNewPointX = iPoint[0]\n elsif (iPoint[0].is_a?(Float))\n lNewPointX = iPoint[0].to_r\n else\n lNewPointX = Rational(iPoint[0])\n end\n if (iPoint[1].is_a?(Rational))\n lNewPointY = iPoint[1]\n elsif (iPoint[1].is_a?(Float))\n lNewPointY = iPoint[1].to_r\n else\n lNewPointY = Rational(iPoint[1])\n end\n next [ lNewPointX, lNewPointY ]\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end",
"def reference_types\n types = []\n\n # Will need the 008[24] and 006[7]\n f8_24 = self['008[24]']\n f6_7 = self['006[7]']\n\n\n\n if (f8_24.include? 'e') || (f6_7.include? 'e')\n types << 'EN'\n end\n\n if f6_7.include? 'd'\n types << 'DI'\n types << 'DR'\n end\n\n if f8_24.include? 'd'\n types << 'DI'\n end\n\n if f8_24.include? 'r'\n types << 'DR'\n end\n\n types << 'EN' if @xv6XX.match? /encyclopedias/i\n types << 'DI' if @xv6XX.match? /dictionaries/i\n types << 'DR' if @xv6XX.match? /directories/i\n\n types.uniq!\n return types\n end",
"def types\n @callers.keys\n end",
"def register_default_translators\n [ \"time\",\n \"timestamp\" ].each { |type| add_translator( type ) { |t, v| Time.parse( v ) } }\n\n add_translator( \"date\" ) { |t,v| Date.parse(v) }\n add_translator( \"datetime\" ) { |t,v| DateTime.parse(v) }\n\n [ \"decimal\",\n \"float\",\n \"numeric\",\n \"double\",\n \"real\",\n \"dec\",\n \"fixed\" ].each { |type| add_translator( type ) { |t,v| v.to_f } }\n\n [ \"integer\",\n \"smallint\",\n \"mediumint\",\n \"int\",\n \"bigint\" ].each { |type| add_translator( type ) { |t,v| v.to_i } }\n\n [ \"bit\",\n \"bool\",\n \"boolean\" ].each do |type|\n add_translator( type ) do |t,v|\n !( v.strip.gsub(/00+/,\"0\") == \"0\" ||\n v.downcase == \"false\" ||\n v.downcase == \"f\" ||\n v.downcase == \"no\" ||\n v.downcase == \"n\" )\n end\n end\n\n add_translator( \"tinyint\" ) do |type, value|\n if type =~ /\\(\\s*1\\s*\\)/\n value.to_i == 1\n else\n value.to_i\n end\n end\n end",
"def type\n params = {}\n constraints = []\n return [\"BIT\", params, constraints] if references[-1].is_unary # It's a unary\n\n # Add a role value constraint\n # REVISIT: Can add join-role-value-constraints here, if we ever provide a way to define them\n if references[-1].to_role && references[-1].to_role.role_value_constraint\n constraints << references[-1].to_role.base_role.role_value_constraint\n end\n\n vt = references[-1].is_self_value ? references[-1].from : references[-1].to\n begin\n params[:length] ||= vt.length if vt.length.to_i != 0\n params[:scale] ||= vt.scale if vt.scale.to_i != 0\n constraints << vt.value_constraint if vt.value_constraint\n last_vt = vt\n vt = vt.supertype\n end while vt\n params[:underlying_type] = last_vt\n return [last_vt.name, params, constraints]\n end",
"def extract_types(doc)\n types = []\n @raw_types.each do |raw_type|\n doc.each_element_with_attribute('name', raw_type, 0,\n '//schema/complexType') do |type_node|\n type = {:name => raw_type, :fields => []}\n ext_node = REXML::XPath.first(type_node, 'complexContent/extension')\n if ext_node\n base_type = ext_node.attribute('base').to_s.gsub(/^.+:/, '')\n type[:base] = base_type\n @raw_types << base_type unless @raw_types.include?(base_type)\n seq_node = REXML::XPath.first(ext_node, 'sequence')\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n seq_node = REXML::XPath.first(type_node, 'sequence')\n if seq_node\n fields = get_element_fields(seq_node)\n process_method_field_types(fields)\n type[:fields] += fields\n end\n types << type\n end\n end\n return types\n end",
"def types(array)\n yield(array)\nend",
"def available_formats\n formats = self.items.collect {|i| i.item_type }\n return formats.compact\n end",
"def get_line_types\n @lines.line_types\n end",
"def collect_report_types()\n [[\"Домашняя работа\", \"homework\"], [\"Работа в классе\", \"classwork\"],\n [\"Лабораторная работа\", \"labwork\"], [\"Контрольная работа\", \"checkpoint\"]]\n end",
"def can_convert?\n klass.is_a?(Class)\n end",
"def types\n must_be_open!\n @columns.map(&:last)\n end",
"def can_convert?(type)\n get_entry(type) ? true : false\n end",
"def type_translation\n @type_translation\n end",
"def get_types(type)\n result = []\n types = TYPE_CONVERSION_TREE[type]\n if types\n result += types\n types.each do |t|\n result |= get_types(t)\n end\n end\n result\n end",
"def to_a\n [ @content_type, @extensions, @encoding, @system, @obsolete, @docs,\n @url, registered? ]\n end",
"def self_types; end"
] |
[
"0.6083852",
"0.58313733",
"0.5753641",
"0.574344",
"0.574344",
"0.574344",
"0.574344",
"0.574344",
"0.56845313",
"0.5650447",
"0.5531124",
"0.5522686",
"0.5522366",
"0.5462688",
"0.5385095",
"0.5371676",
"0.5352404",
"0.5289835",
"0.5285845",
"0.5265506",
"0.5255417",
"0.5235882",
"0.5224059",
"0.52183324",
"0.5190256",
"0.518568",
"0.518568",
"0.518568",
"0.5178664",
"0.5170434",
"0.51568264",
"0.5156234",
"0.51488554",
"0.51141447",
"0.50900525",
"0.5087707",
"0.5082266",
"0.50810814",
"0.50711167",
"0.5061133",
"0.5060746",
"0.5036013",
"0.5034188",
"0.5034188",
"0.5033236",
"0.5029861",
"0.5013216",
"0.50024563",
"0.4983835",
"0.49812064",
"0.49794963",
"0.49743873",
"0.49622238",
"0.49591196",
"0.49587634",
"0.49564916",
"0.49499923",
"0.49447954",
"0.49328247",
"0.49317285",
"0.4922392",
"0.49136135",
"0.4906684",
"0.4903839",
"0.49011084",
"0.48996085",
"0.48990536",
"0.48969212",
"0.48958126",
"0.48949432",
"0.48931235",
"0.48832932",
"0.48832932",
"0.48832932",
"0.48832932",
"0.48832932",
"0.4865016",
"0.486493",
"0.4863518",
"0.4863403",
"0.48614725",
"0.4858781",
"0.48557028",
"0.48417217",
"0.48319983",
"0.4828696",
"0.482857",
"0.48239934",
"0.48101348",
"0.48031732",
"0.4801129",
"0.47936362",
"0.47870442",
"0.47840565",
"0.47751364",
"0.47746897",
"0.4773852",
"0.47715247",
"0.47651872",
"0.47624278"
] |
0.64704716
|
0
|
While the logic of abstracting stuff to callers has it's benefits, sometimes it's required to identify which instance are we specifically operate on. This method returns the instance currently being operated on and returns one of the +TYPE_+ constants defined here Implement this unless and absolutely it's necessary and there is no other easy way to do things ===== Returns the call sign of the instance
|
def callsign
raise "Not Implemented. Class #{self.class.name} doesn't implement callsign"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def call_type\n return !@call_types.empty? ? @call_types[-1] : :instance_method\n end",
"def instance_type; end",
"def self_type; end",
"def self_type; end",
"def self_type; end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type\n (@type || :invoke).to_sym\n end",
"def type\n self.class\n end",
"def current_type\n @type\n end",
"def base_class\n self.is_a?(Instance) ? 'Instance' : 'Work'\n end",
"def type\n self.class::TYPE\n end",
"def cast(object, type)\n CORE.grep(type)[0] || :self\n end",
"def identify\n\n return \"I am a #{self.class}\"\n\n end",
"def return_instance?(type, name)\n return (type == :method && name == :new) ||\n (type == :instance_method && name == :initialize)\n end",
"def receiver_type\n @callable.self_type\n end",
"def type; self._type; end",
"def current\n send current_type\n end",
"def instance_type=(_arg0); end",
"def class\n __getobj__.class\n end",
"def call_type\n return @call_type\n end",
"def instance_type\n get(\"instance_type\")\n end",
"def type\n self_class.to_s.to_sym\n end",
"def type\n return self.class.type # all instances of a class have the same type\n end",
"def singleton_class\n `Opal.get_singleton_class(self)`\n end",
"def instance_of\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n if(object_class(state, t1) == t2) {\n stack_push(Qtrue);\n } else {\n stack_push(Qfalse);\n }\n CODE\n end",
"def class\n object.class\n end",
"def invocation\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n type_a = nil\n __IDENTIFIER20__ = nil\n\n begin\n # at line 952:5: calledclassbyinstance IDENTIFIER '(' ( arguments )? ')'\n @state.following.push( TOKENS_FOLLOWING_calledclassbyinstance_IN_invocation_1614 )\n calledclassbyinstance\n @state.following.pop\n __IDENTIFIER20__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_invocation_1620 )\n # --> action\n\n \t if(@class_called.instance_methods[__IDENTIFIER20__.text].nil?)\n \t raise \"Method #{__IDENTIFIER20__.text} dont exist for instances of class #{@class_called.name} (inside #{@current_class.name}::#{@current_method.name if @current_method})\"\n \t end\n \t @method_called = @class_called.instance_methods[__IDENTIFIER20__.text]\n \t generate('era', nil, @class_called.name, @method_called.starting_fourfold)\n \t \n # <-- action\n match( T__28, TOKENS_FOLLOWING_T__28_IN_invocation_1632 )\n # at line 962:5: ( arguments )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0.between?( IDENTIFIER, INTEGER ) || look_31_0.between?( FLOAT, NULL ) || look_31_0 == T__28 || look_31_0 == T__41 || look_31_0.between?( T__49, T__51 ) )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 962:5: arguments\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_invocation_1638 )\n arguments\n @state.following.pop\n\n end\n match( T__29, TOKENS_FOLLOWING_T__29_IN_invocation_1645 )\n # --> action\n\n \t generate('gsb', @instance_called.address, @class_called.name, @method_called.starting_fourfold)\n \t type_a = @method_called.return_type\n \t @instance_called = nil\n \t @method_called = nil;\n \t @class_called = nil;\n \t \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end\n \n return type_a\n end",
"def calledclassbyinstance\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n t = nil\n\n begin\n # at line 974:5: ( (t= IDENTIFIER | t= 'this' ) '.' )?\n # at line 974:5: ( (t= IDENTIFIER | t= 'this' ) '.' )?\n alt_33 = 2\n look_33_0 = @input.peek( 1 )\n\n if ( look_33_0 == IDENTIFIER )\n look_33_1 = @input.peek( 2 )\n\n if ( look_33_1 == T__40 )\n alt_33 = 1\n end\n elsif ( look_33_0 == T__41 )\n alt_33 = 1\n end\n case alt_33\n when 1\n # at line 974:6: (t= IDENTIFIER | t= 'this' ) '.'\n # at line 974:6: (t= IDENTIFIER | t= 'this' )\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == IDENTIFIER )\n alt_32 = 1\n elsif ( look_32_0 == T__41 )\n alt_32 = 2\n else\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n # at line 974:7: t= IDENTIFIER\n t = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_calledclassbyinstance_1670 )\n\n when 2\n # at line 974:24: t= 'this'\n t = match( T__41, TOKENS_FOLLOWING_T__41_IN_calledclassbyinstance_1678 )\n\n end\n match( T__40, TOKENS_FOLLOWING_T__40_IN_calledclassbyinstance_1681 )\n\n end\n # --> action\n\n if(t.nil? || t.text == 'this')\n @class_called = @current_class\n @instance_called = @current_instance\n else\n @instance_called = @current_method.local_variables[t.text] || @current_class.instance_variables[t.text]\n if(!@instance_called)\n raise \"Variable '#{t.text}' not declared as instance of anything (inside #{@current_class.name}::#{@current_method.name if @current_method})\"\n end\n @class_called = @classes[@instance_called.type] \n end\n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 33 )\n\n end\n \n return \n end",
"def type\n object.class.name\n end",
"def type\n object.class.name\n end",
"def type\n object.class.name\n end",
"def get_current_owner #:doc:\n self.send \"current_#{owner_class.name.underscore}\".to_sym\n end",
"def _type\n self.class.to_s\n end",
"def type\n\t\tself.class.type\n\tend",
"def type\n\t\tself.class.type\n\tend",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def get_type; raise NotImplementedError end",
"def get_type()\n res = super(context,self)\n return res\n end",
"def type\n @type ||= calculate_type\n end",
"def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"def current\n raise NotImplementedError\n end",
"def operator_for( type )\n return operator if(@operator_type == type.to_sym)\n nil\n end",
"def class_obj\n self.class\n end",
"def instance\n raise \"Instance is not set for #{self.klass}\" if self.inst.nil?\n self.inst\n end",
"def type\n return @type\n end",
"def ikra_type\n if self.is_a?(Module)\n return self.singleton_class.to_ikra_type\n else\n # TODO: Double check if we always want to have the singleton class?\n return self.class.to_ikra_type\n end\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def class\n @object.class\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n\t\t\traise NotImplementedError\n\t\tend",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def instance; end",
"def instance; end",
"def instance; end",
"def type\n\t\traise NotImplementedError\n\tend",
"def current\n NotImplementedError\n end",
"def type\n raise NotImplementedError\n end",
"def get_instance(payload)\n CurrentCallInstance.new(@version, payload, )\n end",
"def __class__\n Rubinius.primitive :object_class\n raise PrimitiveFailure, \"Kernel#class primitive failed.\"\n end",
"def type\n self.class.type(self)\n end",
"def type\n _type\n end",
"def operation_type\n return @operation_type\n end",
"def whoami\n self.class.to_s\n end",
"def dispatch(instance, calling_scope, args)\n tc = Puppet::Pops::Types::TypeCalculator\n actual = tc.infer_set(args)\n found = @dispatchers.find { |d| tc.assignable?(d.type, actual) }\n if found\n found.invoke(instance, calling_scope, args)\n else\n raise ArgumentError, \"function '#{instance.class.name}' called with mis-matched arguments\\n#{diff_string(instance.class.name, actual)}\"\n end\n end",
"def type() end",
"def kind\n self.class.kind\n end",
"def kind\n self.class.kind\n end",
"def kind\n self.class.kind\n end",
"def class\n @cx.class\n end",
"def math_type\n self\n end",
"def operator_class()\n @operator_class ||= get_operator_class()\n @operator_class\n end",
"def get_object\n class_name = self.target_type.classify\n klass = Object.const_get(class_name)\n return klass.find(self.target_id)\n end",
"def instance\n @instance || self\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @@type\n end",
"def type\n @@type\n end",
"def caller\n return @caller\n end",
"def caller\n return @caller\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end"
] |
[
"0.63145405",
"0.6009355",
"0.5955215",
"0.5955215",
"0.5955215",
"0.5902116",
"0.5902116",
"0.5902116",
"0.58847815",
"0.5875799",
"0.5869662",
"0.5867123",
"0.58491755",
"0.5782501",
"0.5722898",
"0.571801",
"0.57140434",
"0.568437",
"0.5671924",
"0.5670801",
"0.56575626",
"0.5623274",
"0.56090724",
"0.5604542",
"0.5553848",
"0.5508732",
"0.54856354",
"0.54782295",
"0.5455044",
"0.54421",
"0.54365975",
"0.54365975",
"0.54355824",
"0.5434844",
"0.54091686",
"0.5404005",
"0.5404005",
"0.5403878",
"0.5403878",
"0.5403878",
"0.5386016",
"0.5386016",
"0.5386016",
"0.5386016",
"0.53815836",
"0.53779596",
"0.53743327",
"0.5368882",
"0.5368079",
"0.5350188",
"0.53362036",
"0.5322394",
"0.5319554",
"0.5313073",
"0.5311803",
"0.5311803",
"0.5311803",
"0.5310839",
"0.52985704",
"0.52985704",
"0.52985704",
"0.5297837",
"0.52962",
"0.52962",
"0.52962",
"0.52962",
"0.52962",
"0.52962",
"0.52962",
"0.52918816",
"0.52918816",
"0.52918816",
"0.52917093",
"0.5286557",
"0.52853286",
"0.52789557",
"0.5272319",
"0.525867",
"0.52475286",
"0.52458733",
"0.52350473",
"0.5229764",
"0.5212512",
"0.5202471",
"0.5202471",
"0.5202471",
"0.5195311",
"0.51806283",
"0.51801366",
"0.51712054",
"0.515051",
"0.5148799",
"0.51481897",
"0.51481897",
"0.51481897",
"0.51445687",
"0.51445687",
"0.51427907",
"0.51427907",
"0.51426196",
"0.51426196"
] |
0.0
|
-1
|
GET /pashiris GET /pashiris.json
|
def index
@pashiris = Pashiri.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end",
"def show\n render json: @pizza\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end",
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @primes = Prime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @primes }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def show\n render json: @parish\n end",
"def index\n @pais = Pai.all\n end",
"def index\n @pais = Pai.all\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @users = User.all\n @pt = Kitco.platinum\n @pd = Kitco.palladium\n @rh = Kitco.rhodium\n @pt = JSON.parse(@pt)\n @pd = JSON.parse(@pd)\n rescue JSON::ParserError, TypeError => e\n puts e\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end",
"def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end",
"def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def index\n @puzzles = Puzzle.order :name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puzzles }\n end\n end",
"def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end",
"def index\n slip = Slip.all\n render json: {salary_computations:slip.as_json(except: [:id])}\n end",
"def index\n @pitches = Pitch.page(params[:page]).order(id: :desc)\n rv = {\n items: @pitches.map {|pitch| pitch.as_json},\n total_pages: @pitches.total_pages,\n }\n api_success rv\n end",
"def index\n #find all the pokemon\n #remember this is the Model.\n @pokemon= Pokemon.all\n #respond via JSON\n render json:{\n data: @pokemon \n }\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @championships = Championship.all\n\n render json: @championships\n end",
"def index\n render json: Procedure.all, status: :ok\n end",
"def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def index\n @panlists = Panlist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @panlists }\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end",
"def index\n @pokemons = Pokemon.all.order(:index)\n\n respond_to do |format|\n format.html\n format.json { render json: @pokemons }\n end\n end",
"def show\n @prime = Prime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prime }\n end\n end",
"def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end",
"def show\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pony }\n end\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def index\n @players_prizes = PlayersPrize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players_prizes }\n end\n end",
"def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end",
"def show\n @punch = Punch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch }\n end\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @ipacks = current_user.ipacks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ipacks }\n end\n end",
"def show\n @himalaya = Himalaya.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end",
"def request_raw_pantheons_data\n return unless authenticated?\n\n response = RestClient.get(\n \"https://godvillegame.com/fbh/feed?a=#{@pantheons_guid}\",\n cookies: @cookies, content_type: :json, accept: :json\n )\n JSON.parse(response)\n end",
"def index\n @pgroups = Pgroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pgroups }\n end\n end",
"def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def index\n @piers = @harbour.piers.all\n end",
"def show\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hijo }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end",
"def index\n render json: @fiestas\n end"
] |
[
"0.6671753",
"0.6513453",
"0.64613706",
"0.63841903",
"0.6178173",
"0.6176981",
"0.61122996",
"0.610425",
"0.60990757",
"0.6095957",
"0.6080021",
"0.60766923",
"0.6062933",
"0.6061838",
"0.6060596",
"0.6040236",
"0.60252005",
"0.6023783",
"0.6017991",
"0.60085934",
"0.60041386",
"0.6004009",
"0.59960055",
"0.5989831",
"0.5987124",
"0.5987124",
"0.59738845",
"0.59737414",
"0.5964305",
"0.5946572",
"0.5942014",
"0.59341115",
"0.5932075",
"0.5931458",
"0.592634",
"0.5919255",
"0.591479",
"0.5902383",
"0.5900288",
"0.5890224",
"0.58859044",
"0.58794874",
"0.5877362",
"0.5875623",
"0.5870433",
"0.58703923",
"0.58644277",
"0.58639145",
"0.5862147",
"0.5859521",
"0.585855",
"0.5858497",
"0.585172",
"0.5849508",
"0.5844887",
"0.58447003",
"0.58421206",
"0.5841802",
"0.58358806",
"0.5835792",
"0.58334",
"0.58262616",
"0.58236593",
"0.58229643",
"0.5818356",
"0.5815855",
"0.5814087",
"0.5812866",
"0.5812659",
"0.5812576",
"0.5809682",
"0.5807335",
"0.5800076",
"0.57978284",
"0.5795432",
"0.5792655",
"0.57884765",
"0.57806396",
"0.57767016",
"0.57755405",
"0.5773926",
"0.5773864",
"0.5763185",
"0.57612896",
"0.5760431",
"0.57569337",
"0.57491636",
"0.5741436",
"0.5741436",
"0.5741004",
"0.57407063",
"0.57309675",
"0.5725231",
"0.5724841",
"0.572414",
"0.57225907",
"0.5721362",
"0.57186776",
"0.57109946",
"0.5710675"
] |
0.6998126
|
0
|
GET /pashiris/1 GET /pashiris/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @pashiris = Pashiri.all\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @prime = Prime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prime }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @primes = Prime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @primes }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end",
"def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @punch = Punch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch }\n end\n end",
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end",
"def show\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pony }\n end\n end",
"def show\n @p_detail = PDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @p_detail }\n end\n end",
"def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def show\n render json: @pizza\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def index\n render json: Procedure.all, status: :ok\n end",
"def index\n @panlists = Panlist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @panlists }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end",
"def index\n @pokemons = Pokemon.all.order(:index)\n\n respond_to do |format|\n format.html\n format.json { render json: @pokemons }\n end\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @puzzles = Puzzle.order :name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puzzles }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def show\n @preguntum = Preguntum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preguntum }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n slip = Slip.all\n render json: {salary_computations:slip.as_json(except: [:id])}\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end",
"def index\n @pitches = Pitch.page(params[:page]).order(id: :desc)\n rv = {\n items: @pitches.map {|pitch| pitch.as_json},\n total_pages: @pitches.total_pages,\n }\n api_success rv\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def show\n render json: @parish\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def index\n #find all the pokemon\n #remember this is the Model.\n @pokemon= Pokemon.all\n #respond via JSON\n render json:{\n data: @pokemon \n }\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end",
"def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end",
"def show\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hijo }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def show\n @portion = Portion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portion }\n end\n end",
"def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n @api_haiku = Api::Haiku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_haiku }\n end\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def show\n @himalaya = Himalaya.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end",
"def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"def index\n @users = User.all\n @pt = Kitco.platinum\n @pd = Kitco.palladium\n @rh = Kitco.rhodium\n @pt = JSON.parse(@pt)\n @pd = JSON.parse(@pd)\n rescue JSON::ParserError, TypeError => e\n puts e\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end"
] |
[
"0.66167384",
"0.6603721",
"0.6566706",
"0.65295553",
"0.63762593",
"0.6374993",
"0.6369773",
"0.62963384",
"0.6288128",
"0.6253874",
"0.62332606",
"0.6231995",
"0.620562",
"0.6205173",
"0.61922646",
"0.6190718",
"0.6185784",
"0.61835223",
"0.6179229",
"0.6176657",
"0.61752874",
"0.6169122",
"0.6158515",
"0.61558217",
"0.6148185",
"0.6147134",
"0.6137691",
"0.61343527",
"0.6131213",
"0.61256224",
"0.6124588",
"0.61128646",
"0.6110681",
"0.6107269",
"0.6106746",
"0.6103243",
"0.60982555",
"0.608676",
"0.6084878",
"0.6078557",
"0.60741574",
"0.60731035",
"0.60687",
"0.60646194",
"0.60628283",
"0.604657",
"0.603975",
"0.6039387",
"0.60308075",
"0.60274243",
"0.6027322",
"0.6026716",
"0.6021659",
"0.60202724",
"0.6017749",
"0.60174793",
"0.60161394",
"0.60153675",
"0.60153675",
"0.60119826",
"0.60094947",
"0.6007753",
"0.60022455",
"0.5999635",
"0.5999517",
"0.5998405",
"0.5998405",
"0.5995069",
"0.59893423",
"0.5987834",
"0.59827095",
"0.597477",
"0.5963203",
"0.59579843",
"0.59554064",
"0.5953782",
"0.59487265",
"0.5947082",
"0.5946946",
"0.59451854",
"0.59407",
"0.5938494",
"0.5937653",
"0.5935753",
"0.59346",
"0.59344256",
"0.59333295",
"0.5930755",
"0.5929866",
"0.59296703",
"0.5924408",
"0.5916644",
"0.59151",
"0.5914133",
"0.59121",
"0.59112877",
"0.5910493",
"0.59078974",
"0.5907357",
"0.5904146",
"0.59037584"
] |
0.0
|
-1
|
POST /pashiris POST /pashiris.json
|
def create
@pashiri = Pashiri.new(pashiri_params)
respond_to do |format|
if @pashiri.save
format.html { redirect_to @pashiri, notice: 'Pashiri was successfully created.' }
format.json { render :show, status: :created, location: @pashiri }
else
format.html { render :new }
format.json { render json: @pashiri.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def pashiri_params\n params.require(:pashiri).permit(:name, :iraisha)\n end",
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def create\n @puisi = Puisi.new(puisi_params)\n\n respond_to do |format|\n if @puisi.save\n format.html { redirect_to @puisi, notice: 'Puisi was successfully created.' }\n format.json { render action: 'show', status: :created, location: @puisi }\n else\n format.html { render action: 'new' }\n format.json { render json: @puisi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n @pichanga = Pichanga.new(params[:pichanga])\n\n respond_to do |format|\n if @pichanga.save\n format.html { redirect_to @pichanga, :notice => 'Pichanga was successfully created.' }\n format.json { render :json => @pichanga, :status => :created, :location => @pichanga }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pichanga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ipdizhi = Ipdizhi.new(ipdizhi_params)\n\n respond_to do |format|\n if @ipdizhi.save\n format.html { redirect_to @ipdizhi, notice: 'Ipdizhi was successfully created.' }\n format.json { render :show, status: :created, location: @ipdizhi }\n else\n format.html { render :new }\n format.json { render json: @ipdizhi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def create\n @pithcher = Pithcher.new(pithcher_params)\n\n respond_to do |format|\n if @pithcher.save\n format.html { redirect_to @pithcher, notice: 'Pithcher was successfully created.' }\n format.json { render :show, status: :created, location: @pithcher }\n else\n format.html { render :new }\n format.json { render json: @pithcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @pai.user_id = current_user.id\n respond_to do |format|\n if @pai.save\n format.html { redirect_to @pai, notice: 'Pais was successfully created.' }\n format.json { render :show, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @pautum = Pautum.new(pautum_params)\n\n respond_to do |format|\n if @pautum.save\n format.html { redirect_to @pautum, notice: 'Pautum was successfully created.' }\n format.json { render :show, status: :created, location: @pautum }\n else\n format.html { render :new }\n format.json { render json: @pautum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pozi = Pozi.new(pozi_params)\n\n respond_to do |format|\n if @pozi.save\n format.html { redirect_to pozis_path, notice: 'Pozi was successfully created.' }\n format.json { render :show, status: :created, location: @pozi }\n else\n format.html { render :new }\n format.json { render json: @pozi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pru = Pru.new(pru_params)\n\n respond_to do |format|\n if @pru.save\n format.html { redirect_to @pru, notice: 'Pru was successfully created.' }\n format.json { render :show, status: :created, location: @pru }\n else\n format.html { render :new }\n format.json { render json: @pru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @pimo = Pimo.new(pimo_params)\n\n respond_to do |format|\n if @pimo.save\n format.html { redirect_to @pimo, notice: 'Pimo was successfully created.' }\n format.json { render :show, status: :created, location: @pimo }\n else\n format.html { render :new }\n format.json { render json: @pimo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def create_folio\n rs = Folio.new\n rs.input_type_id = params[:input_type_id]\n #rs.folio_no = gen_folio_no\n rs.remark = params[:remark]\n if rs.save\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @punish = Punish.new(punish_params)\n\n respond_to do |format|\n if @punish.save\n format.html { redirect_to @punish, notice: 'Punish was successfully created.' }\n format.json { render :show, status: :created, location: @punish }\n else\n format.html { render :new }\n format.json { render json: @punish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pie = PIE.new(pie_params)\n\n respond_to do |format|\n if @pie.save\n format.html { redirect_to @pie, notice: 'PIE was successfully created.' }\n format.json { render :show, status: :created, location: @pie }\n else\n format.html { render :new }\n format.json { render json: @pie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def create\n @hospice = Hospice.new(hospice_params)\n\n respond_to do |format|\n if @hospice.save\n format.html { redirect_to @hospice, notice: 'Hospice was successfully created.' }\n format.json { render :show, status: :created, location: @hospice }\n else\n format.html { render :new }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, form_data=nil)\n parse_json do |parser|\n @http_client.post(path, form_data) {|chunk| parser << chunk }\n end\n end",
"def post_data; end",
"def create\n @paise = Paise.new(params[:paise])\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render json: @paise, status: :created, location: @paise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @papertest = Papertest.new(papertest_params)\n\n respond_to do |format|\n if @papertest.save\n format.html { redirect_to @papertest, notice: 'Papertest was successfully created.' }\n format.json { render :show, status: :created, location: @papertest }\n else\n format.html { render :new }\n format.json { render json: @papertest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puppy = Puppy.new(puppy_params)\n\n respond_to do |format|\n if @puppy.save\n format.html { redirect_to @puppy, notice: 'Puppy was successfully created.' }\n format.json { render :show, status: :created, location: @puppy }\n else\n format.html { render :new }\n format.json { render json: @puppy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pto = Pto.new(params[:pto])\n\n respond_to do |format|\n if @pto.save\n format.html { redirect_to \"/thanks.html\", notice: 'Pto was successfully created.' }\n format.json { render json: @pto, status: :created, location: @pto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pizzatopping = Pizzatopping.new(pizzatopping_params)\n\n respond_to do |format|\n if @pizzatopping.save\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizzatopping }\n else\n format.html { render action: 'new' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pingguodingshirenwu = Pingguodingshirenwu.new(pingguodingshirenwu_params)\n\n respond_to do |format|\n if @pingguodingshirenwu.save\n format.html { redirect_to @pingguodingshirenwu, notice: 'Pingguodingshirenwu was successfully created.' }\n format.json { render :show, status: :created, location: @pingguodingshirenwu }\n else\n format.html { render :new }\n format.json { render json: @pingguodingshirenwu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end",
"def create\n @shogi = Shogi.new(shogi_params)\n\n respond_to do |format|\n if @shogi.save\n format.html { redirect_to @shogi, notice: 'Shogi was successfully created.' }\n format.json { render :show, status: :created, location: @shogi }\n else\n format.html { render :new }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shouji = Shouji.new(shouji_params)\n\n respond_to do |format|\n if @shouji.save\n format.html { redirect_to @shouji, notice: 'Shouji was successfully created.' }\n format.json { render :show, status: :created, location: @shouji }\n else\n format.html { render :new }\n format.json { render json: @shouji.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pai_params\n params.require(:pai).permit(:name, :huso, :user_id)\n end",
"def index\n @pashiris = Pashiri.all\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def pier_params\n params.require(:pier).permit(:harbour_id, :name)\n end",
"def create\n @himalaya = Himalaya.new(params[:himalaya])\n\n respond_to do |format|\n if @himalaya.save\n format.html { redirect_to @himalaya, notice: 'Himalaya was successfully created.' }\n format.json { render json: @himalaya, status: :created, location: @himalaya }\n else\n format.html { render action: \"new\" }\n format.json { render json: @himalaya.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @psa = Psa.new(params[:psa])\n\n respond_to do |format|\n if @psa.save\n format.html { redirect_to @psa, notice: 'Psa was successfully created.' }\n format.json { render json: @psa, status: :created, location: @psa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @piiza_id = PiizaId.new(piiza_id_params)\n\n respond_to do |format|\n if @piiza_id.save\n format.html { redirect_to @piiza_id, notice: 'Piiza was successfully created.' }\n format.json { render :show, status: :created, location: @piiza_id }\n else\n format.html { render :new }\n format.json { render json: @piiza_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@pasien = Pasien.find(params[:pasien_id])\n #@hasil = @pasien.hasils.create(params[:hasil])\n #redirect_to pasien_path(@post)\n @hasil = Hasil.create(params[:hasil])\n\n respond_to do |format|\n if @hasil.save\n format.html { redirect_to @hasil, notice: 'Hasil was successfully created.' }\n format.json { render json: @hasil, status: :created, location: @hasil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hasil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Loggin data from POST\n logger.debug \"--\" * 50\n logger.debug \"Data from POST: #{params.inspect}\"\n logger.debug \"--\" * 50\n\n @nasp_rail = NaspRail.new(params.keep_if { |key, value| NaspRail.column_names.include? key })\n\n respond_to do |format|\n if @nasp_rail.save\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @nasp_rail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pouzivatel = Pouzivatel.new(pouzivatel_params)\n\n respond_to do |format|\n if @pouzivatel.save\n format.html { redirect_to @pouzivatel, notice: 'Pouzivatel was successfully created.' }\n format.json { render :show, status: :created, location: @pouzivatel }\n else\n format.html { render :new }\n format.json { render json: @pouzivatel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @division_pai = DivisionPai.new(division_pai_params)\n\n respond_to do |format|\n if @division_pai.save\n format.html { redirect_to @division_pai, notice: 'Division pais creada exitosamente.' }\n format.json { render :show, status: :created, location: @division_pai }\n else\n format.html { render :new }\n format.json { render json: @division_pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @paise = Paise.new(paise_params)\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render :show, status: :created, location: @paise }\n else\n format.html { render :new }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end",
"def create\n @pigeon = current_user.pigeons.new(pigeon_params)\n\n respond_to do |format|\n if @pigeon.save\n format.html { redirect_to @pigeon, notice: 'Pigeon was successfully created.' }\n format.json { render :show, status: :created, location: @pigeon }\n else\n format.html { render :new }\n format.json { render json: @pigeon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prato = Prato.new(prato_params)\n\n respond_to do |format|\n if @prato.save\n format.html { redirect_to @prato, notice: 'Prato was successfully created.' }\n format.json { render :show, status: :created, location: @prato }\n else\n format.html { render :new }\n format.json { render json: @prato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shichoson = Shichoson.new(params[:shichoson])\n\n respond_to do |format|\n if @shichoson.save\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully created.' }\n format.json { render json: @shichoson, status: :created, location: @shichoson }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, Pupil\n @pupil = Pupil.new(pupil_attrs)\n\n respond_to do |format|\n if @pupil.save\n format.html { redirect_to @pupil, notice: t('action.create.succeed', entity: Pupil.model_name.human) }\n format.json { render action: 'show', status: :created, location: @pupil }\n else\n format.html { render action: 'new' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nippou = Nippou.new(nippou_params)\n\n respond_to do |format|\n if @nippou.save\n format.html { redirect_to @nippou, notice: 'Nippou was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nippou }\n else\n format.html { render action: 'new' }\n format.json { render json: @nippou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pracownik = Pracownik.new(pracownik_params)\n\n respond_to do |format|\n if @pracownik.save\n format.html { redirect_to @pracownik, notice: 'Pracownik was successfully created.' }\n format.json { render :show, status: :created, location: @pracownik }\n else\n format.html { render :new }\n format.json { render json: @pracownik.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @predio = Predio.new(predio_params)\n\n respond_to do |format|\n if @predio.save\n format.html { redirect_to @predio, notice: 'Predio foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @predio }\n else\n format.html { render :new }\n format.json { render json: @predio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @qishi = Qishi.new(qishi_params)\n\n respond_to do |format|\n if @qishi.save\n format.html { redirect_to @qishi, notice: 'Qishi was successfully created.' }\n format.json { render :show, status: :created, location: @qishi }\n else\n format.html { render :new }\n format.json { render json: @qishi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def post(data = {})\n call data, method: :post\n end",
"def create\n @poto = Poto.new(poto_params)\n\n respond_to do |format|\n if @poto.save\n format.html { redirect_to @poto, notice: 'Poto was successfully created.' }\n format.json { render :show, status: :created, location: @poto }\n else\n format.html { render :new }\n format.json { render json: @poto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prim = Prim.new(prim_params)\n\n respond_to do |format|\n if @prim.save\n format.html { redirect_to @prim, notice: 'Prim was successfully created.' }\n format.json { render :show, status: :created, location: @prim }\n else\n format.html { render :new }\n format.json { render json: @prim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pupil = Pupil.new(params[:pupil])\n\n respond_to do |format|\n if @pupil.save\n format.html { redirect_to @pupil, notice: 'Žák byl úspěšně vytvořen.' }\n format.json { render json: @pupil, status: :created, location: @pupil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n outcome = CreatePiano.run(params: params[:piano], user: User.first)\n\n respond_to do |format|\n if outcome.valid?\n @piano = outcome.result\n format.html { redirect_to @piano, notice: 'Piano was successfully created.' }\n format.json { render :show, status: :created, location: @piano }\n else\n @piano = outcome\n format.html { render :new }\n format.json { render json: @piano.errors , status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tuoshui = Tuoshui.new(params[:tuoshui])\n\n respond_to do |format|\n if @tuoshui.save\n format.html { redirect_to @tuoshui, notice: 'Tuoshui was successfully created.' }\n format.json { render json: @tuoshui, status: :created, location: @tuoshui }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tuoshui.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @phile = Phile.new(params[:phile])\n\n respond_to do |format|\n if @phile.save\n format.html { redirect_to @phile, notice: 'Phile was successfully created.' }\n format.json { render json: @phile, status: :created, location: @phile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @phile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @basico_pais = Basico::Pais.new(basico_pais_params)\n respond_to do |format|\n if @basico_pais.save\n format.html { redirect_to @basico_pais, notice: 'Pais was successfully created.' }\n format.json { render :show, status: :created, location: @basico_pais }\n else\n format.html { render :new }\n format.json { render json: @basico_pais.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @irpf = Irpf.new(irpf_params)\n\n respond_to do |format|\n if @irpf.save\n format.html { redirect_to @irpf, notice: 'Irpf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @irpf }\n else\n format.html { render action: 'new' }\n format.json { render json: @irpf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio_irpj = SocioIrpj.new(socio_irpj_params)\n\n respond_to do |format|\n if @socio_irpj.save\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_irpj }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @processo = Processo.new(processo_params)\n\n if @processo.save\n render json: @processo, status: :created, location: @processo\n else\n render json: @processo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pacienti = Pacienti.new(pacienti_params)\n\n respond_to do |format|\n if @pacienti.save\n format.html { redirect_to @pacienti, notice: 'Pacienti was successfully created.' }\n format.json { render :show, status: :created, location: @pacienti }\n else\n format.html { render :new }\n format.json { render json: @pacienti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shujukusqlguanli = Shujukusqlguanli.new(shujukusqlguanli_params)\n\n respond_to do |format|\n if @shujukusqlguanli.save\n format.html { redirect_to @shujukusqlguanli, notice: 'Shujukusqlguanli was successfully created.' }\n format.json { render :show, status: :created, location: @shujukusqlguanli }\n else\n format.html { render :new }\n format.json { render json: @shujukusqlguanli.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n @question.zavrseno = \"N\"\n @question.user = @current_user\n @question.uposlenik = User.find(params[:uposlenik_id])\n respond_to do |format|\n if @question.save\n format.json { render json: @question, status: :created, location: api_question_url(@question) }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hoho = Hoho.new(hoho_params)\n\n respond_to do |format|\n if @hoho.save\n format.html { redirect_to @hoho, notice: 'Hoho was successfully created.' }\n format.json { render :show, status: :created, location: @hoho }\n else\n format.html { render :new }\n format.json { render json: @hoho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @penyata_kehadiran = PenyataKehadiran.new(penyata_kehadiran_params)\n\n respond_to do |format|\n if @penyata_kehadiran.save\n format.html { redirect_to @penyata_kehadiran, notice: 'Penyata kehadiran was successfully created.' }\n format.json { render :show, status: :created, location: @penyata_kehadiran }\n else\n format.html { render :new }\n format.json { render json: @penyata_kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_haiku = Api::Haiku.new(params[:api_haiku])\n\n respond_to do |format|\n if @api_haiku.save\n format.html { redirect_to @api_haiku, notice: 'Haiku was successfully created.' }\n format.json { render json: @api_haiku, status: :created, location: @api_haiku }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_haiku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @thuctap = Thuctap.new(thuctap_params)\n respond_to do |format|\n if @thuctap.save\n format.html { redirect_to @thuctap, notice: 'Thuctap was successfully created.' }\n format.json { render :show, status: :created, location: @thuctap }\n else\n format.html { render :new }\n format.json { render json: @thuctap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pillar = Pillar.new(params[:pillar])\n flash[:notice] = 'Pillar was successfully created.' if @pillar.save\n respond_with(@pillar)\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def post(path, **args); end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def create\n res = self.class.post('/', body: attrs)\n res.created?\n end",
"def create\n @jusho = Jusho.new(jusho_params)\n\n respond_to do |format|\n if @jusho.save\n format.html { redirect_to @jusho, notice: 'Jusho was successfully created.' }\n format.json { render :show, status: :created, location: @jusho }\n else\n format.html { render :new }\n format.json { render json: @jusho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @penguru = Penguru.new(penguru_params)\n\n respond_to do |format|\n if @penguru.save\n format.html { redirect_to @penguru, notice: 'Penguru was successfully created.' }\n format.json { render :show, status: :created, location: @penguru }\n else\n format.html { render :new }\n format.json { render json: @penguru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @therapist = Therapist.new(therapist_params.merge({code: create_code}))\n if @therapist.save\n render :json => {\n id: @therapist.id,\n email: @therapist.email,\n firstName: @therapist.first_name,\n lastName: @therapist.last_name,\n prefix: @therapist.prefix,\n profession: @therapist.profession,\n code: @therapist.code,\n token: get_token(@therapist)\n }\n else\n render json: @therapist.errors, status: :unprocessable_entity\n # render json: @therapist.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.6159259",
"0.60890347",
"0.60772866",
"0.6008758",
"0.6002866",
"0.5978132",
"0.5931346",
"0.59150285",
"0.587966",
"0.5879078",
"0.5857598",
"0.5850426",
"0.584057",
"0.5800717",
"0.57987875",
"0.57905346",
"0.5789546",
"0.57742184",
"0.5723724",
"0.5700369",
"0.56997633",
"0.5699171",
"0.56837803",
"0.567964",
"0.5678404",
"0.5670592",
"0.5665825",
"0.5659014",
"0.5651056",
"0.56453764",
"0.5641277",
"0.5639307",
"0.5630773",
"0.5626808",
"0.562199",
"0.5619924",
"0.56149936",
"0.56086797",
"0.5604017",
"0.5600901",
"0.5599289",
"0.55881387",
"0.557699",
"0.5575285",
"0.55620056",
"0.5554935",
"0.5553029",
"0.5551979",
"0.5547494",
"0.5538642",
"0.5536034",
"0.55337185",
"0.55313766",
"0.5524083",
"0.5522931",
"0.55174917",
"0.55149007",
"0.5512979",
"0.5511212",
"0.5510599",
"0.5504089",
"0.5501442",
"0.55001533",
"0.5485727",
"0.5480574",
"0.5480292",
"0.5478713",
"0.5477909",
"0.5471735",
"0.54705757",
"0.54647374",
"0.5462872",
"0.5462764",
"0.546193",
"0.5452967",
"0.5447345",
"0.5441976",
"0.54352725",
"0.54322845",
"0.54307824",
"0.5430676",
"0.54184914",
"0.5417466",
"0.5416152",
"0.5412397",
"0.54111385",
"0.54067683",
"0.5403317",
"0.54027057",
"0.5402651",
"0.54002404",
"0.53965694",
"0.53919965",
"0.53898877",
"0.5389169",
"0.5388701",
"0.5384203",
"0.5383506",
"0.5381486",
"0.5378032"
] |
0.68317336
|
0
|
PATCH/PUT /pashiris/1 PATCH/PUT /pashiris/1.json
|
def update
respond_to do |format|
if @pashiri.update(pashiri_params)
format.html { redirect_to @pashiri, notice: 'Pashiri was successfully updated.' }
format.json { render :show, status: :ok, location: @pashiri }
else
format.html { render :edit }
format.json { render json: @pashiri.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def patch!\n request! :patch\n end",
"def update # PATCH\n raise NotImplementedError\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 put!\n request! :put\n end",
"def patch(path, **args); end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\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 patch\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @pizzatopping.update(pizzatopping_params)\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, Pupil\n respond_to do |format|\n if @pupil.update(pupil_attrs)\n format.html { redirect_to @pupil, notice: t('action.update.succeed', entity: Pupil.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\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(data = :object || :json)\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prime = Prime.find(params[:id])\n\n respond_to do |format|\n if @prime.update_attributes(params[:prime])\n format.html { redirect_to @prime, notice: 'Prime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @p1.update(p1_params)\n format.html { redirect_to @p1, notice: 'P1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @p1 }\n else\n format.html { render :edit }\n format.json { render json: @p1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end",
"def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n respond_to do |format|\n if @puisi.update(puisi_params)\n format.html { redirect_to @puisi, notice: 'Puisi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @puisi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def create_method\n :put_json\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end",
"def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prim.update(prim_params)\n format.html { redirect_to @prim, notice: 'Prim was successfully updated.' }\n format.json { render :show, status: :ok, location: @prim }\n else\n format.html { render :edit }\n format.json { render json: @prim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n respond_to do |format|\n if @pax.update(pax_params)\n format.html { redirect_to @pax, notice: 'Pax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pist.update(pist_params)\n format.html { redirect_to @pist, notice: 'Pist was successfully updated.' }\n format.json { render :show, status: :ok, location: @pist }\n else\n format.html { render :edit }\n format.json { render json: @pist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to \"/trabalhos\", notice: 'Trabalho alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6996014",
"0.67856693",
"0.6761445",
"0.66060716",
"0.65468925",
"0.6362387",
"0.6315003",
"0.63144445",
"0.631032",
"0.6305359",
"0.6305359",
"0.6267114",
"0.6262165",
"0.62608606",
"0.62486833",
"0.62308604",
"0.62308604",
"0.6164937",
"0.61633235",
"0.61633235",
"0.6152332",
"0.6149478",
"0.6145947",
"0.613094",
"0.61308426",
"0.612495",
"0.6116652",
"0.6099657",
"0.60617584",
"0.6042983",
"0.6014844",
"0.6008748",
"0.6006686",
"0.60057044",
"0.600322",
"0.5999859",
"0.59884167",
"0.5984338",
"0.5980491",
"0.597402",
"0.5972231",
"0.5964543",
"0.5949578",
"0.59289694",
"0.59277725",
"0.5927682",
"0.5924335",
"0.59221107",
"0.592014",
"0.5919484",
"0.5912378",
"0.59111816",
"0.59105414",
"0.5906733",
"0.5901285",
"0.5893788",
"0.5893788",
"0.58796483",
"0.5877238",
"0.5876865",
"0.58757067",
"0.58757067",
"0.5872174",
"0.587154",
"0.5870656",
"0.58660734",
"0.5865385",
"0.5863041",
"0.5858772",
"0.5858626",
"0.58450836",
"0.5843396",
"0.5843358",
"0.5843223",
"0.58384186",
"0.58381814",
"0.58371294",
"0.58359665",
"0.5835952",
"0.5826497",
"0.5826493",
"0.5821427",
"0.58191633",
"0.5817515",
"0.58129174",
"0.58098423",
"0.5806509",
"0.5804411",
"0.5804071",
"0.5799394",
"0.57968485",
"0.57935685",
"0.5793046",
"0.57896584",
"0.577033",
"0.57691854",
"0.57666326",
"0.5765713",
"0.57654476",
"0.57654333"
] |
0.60865915
|
28
|
DELETE /pashiris/1 DELETE /pashiris/1.json
|
def destroy
@pashiri.destroy
respond_to do |format|
format.html { redirect_to pashiris_url, notice: 'Pashiri was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(path)\n request(:delete, path)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def delete(*rest) end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete(path)\n request 'DELETE', path\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 http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def delete\n \n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n request(:delete)\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def delete\n\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 delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def delete(path)\n with_remote do |http|\n http.delete(path)\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 delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, data={})\n request(:delete, path, data)\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def 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; delete end",
"def delete(path, headers = {})\n process :delete, path, headers\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete(path, **options)\n execute :delete, path, options\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\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 delete(name)\n\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete!\n request! :delete\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete\n api(\"Delete\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @himalaya = Himalaya.find(params[:id])\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end"
] |
[
"0.7265513",
"0.6966249",
"0.6952314",
"0.6947598",
"0.6925021",
"0.67955446",
"0.6780028",
"0.676251",
"0.6752695",
"0.6750176",
"0.67316246",
"0.6708789",
"0.67072487",
"0.6706297",
"0.6658185",
"0.66534936",
"0.6645861",
"0.6629904",
"0.66232824",
"0.66096556",
"0.66068786",
"0.65945435",
"0.65921104",
"0.6588423",
"0.6581896",
"0.6581896",
"0.6581896",
"0.6581896",
"0.65780896",
"0.65698844",
"0.65693665",
"0.65627646",
"0.6555695",
"0.6555601",
"0.65474",
"0.65469074",
"0.65469074",
"0.65465844",
"0.6535441",
"0.65346396",
"0.65346396",
"0.65346396",
"0.65346396",
"0.65346396",
"0.65346396",
"0.65346396",
"0.6529198",
"0.65281945",
"0.65281945",
"0.6525211",
"0.6516113",
"0.6514549",
"0.65117615",
"0.6510063",
"0.6506627",
"0.64954597",
"0.64948",
"0.6493649",
"0.6483038",
"0.6474362",
"0.6473908",
"0.6473861",
"0.646947",
"0.6468211",
"0.64676076",
"0.6466131",
"0.64643425",
"0.64643234",
"0.6463169",
"0.64577293",
"0.6448002",
"0.64473593",
"0.643156",
"0.6426991",
"0.6426991",
"0.6426991",
"0.6426991",
"0.6426991",
"0.6426991",
"0.6426991",
"0.6411666",
"0.64094734",
"0.6402685",
"0.640118",
"0.63954407",
"0.63951075",
"0.6394803",
"0.6391796",
"0.6388605",
"0.6387621",
"0.6385771",
"0.6385771",
"0.63857466",
"0.63857466",
"0.63828427",
"0.63818055",
"0.6380158",
"0.6380158",
"0.6380158",
"0.6377809"
] |
0.67008525
|
14
|
Use callbacks to share common setup or constraints between actions.
|
def set_pashiri
@pashiri = Pashiri.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 pashiri_params
params.require(:pashiri).permit(:name, :iraisha)
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
|
NOTE: this approach will probably fetch _all_ messages sent to or received from the handle. This means direct messages will be interleaved with group messages (i think)
|
def get_messages_with_handle_as_csv(handle_id)
message_csv_str = query <<~EOF
select datetime(message.date/1000000000 + strftime('%s', '2001-01-01'), 'unixepoch', 'localtime'),
is_from_me,
text
from message
where handle_id = '#{handle_id}'
order by date asc;
EOF
csv = CSV.new(message_csv_str)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_msgs\n end",
"def handle_messages\n messages = *disque.fetch(from: queue_name,timeout: 100,count: batch_size)\n messages.each do |queue,id,data|\n Chore.logger.debug \"Received #{id.inspect} from #{queue.inspect} with #{data.inspect}\"\n yield(id, queue, nil, data, 0)\n Chore.run_hooks_for(:on_fetch, id, data)\n end\n messages\n end",
"def get_messages\n @connection.uid_search(@filter).each do |message|\n puts \"PROCESSING MESSAGE #{message}\"\n body=@connection.uid_fetch(message,\"RFC822\")[0].attr[\"RFC822\"]\n @processor.process(body, @options)\n @connection.uid_copy(message, 'Processed')\n\n @connection.uid_store(message,\"+FLAGS\",[:Deleted])\n end\n @connection.expunge\n #@connection.delete_all\n end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратного вызова\n @conn.ProcessMessage2(100)\n end",
"def get_messages()\n @@log.debug(\"get_messages starts\")\n subscribe\n StompHelper::pause(\"After subscribe\") if $DEBUG\n for msgnum in (0..@max_msgs-1) do\n message = @conn.receive\n @@log.debug(\"Received: #{message}\")\n if @ack == \"client\"\n @@log.debug(\"in receive, sending ACK, headers: #{message.headers.inspect}\")\n message_id = message.headers[\"message-id\"]\n @@log.debug(\"in receive, sending ACK, message-id: #{message_id}\")\n @conn.ack(message_id) # ACK this message\n end\n StompHelper::pause(\"After first receive\") if (msgnum == 0 and $DEBUG)\n #\n received = message\n end\n end",
"def process_messages\n\t\t\tloop do\n\t\t\t\tchan, message = @redis_listener.blpop(\"#{PREFIX}.network:#{@network}.messages\", 0)\n\t\t\t\t@log.debug(\"A client sent the message : #{message}\")\n\t\t\t\tmsgid, command, args = parse(message)\n\t\t\t\tunless command\n\t\t\t\t\t@log.warn(\"A client sent an invalid message.\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif msgid && @failed_cmds.include?(msgid) # Every daemon tried to contact the multi (blpop act as first waiting, first served)\n\t\t\t\t\tanswer(msgid, false, \"No daemon could contact the multiplexer\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tans, info = case command\n\t\t\t\t\twhen \"add_sensor\"\n\t\t\t\t\t\tregister_device :sensor, args\n\t\t\t\t\twhen \"add_actuator\"\n\t\t\t\t\t\tregister_device :actuator, args\n\t\t\t\t\twhen \"delete_sensor\"\n\t\t\t\t\t\tunregister_device :sensor, args\n\t\t\t\t\twhen \"delete_actuator\"\n\t\t\t\t\t\tunregister_device :actuator, args\n\t\t\t\t\twhen \"take\"\n\t\t\t\t\t\ttake_callback args\n\t\t\t\t\twhen \"actuator_state\"\n\t\t\t\t\t\tactuator_state_callback args\n\t\t\t\t\telse\n\t\t\t\t\t\t@log.warn(\"A client sent an unknown command : \\\"#{command}\\\"\")\n\t\t\t\t\t\t[false, \"Unknown command \\\"#{command}\\\"\"]\n\t\t\t\tend\n\t\t\t\tcase ans\n\t\t\t\t\twhen true # Success\n\t\t\t\t\t\tanswer(msgid, true)\n\t\t\t\t\twhen false # Failure\n\t\t\t\t\t\tanswer(msgid, false, info)\n\t\t\t\t\telse # Timeout error, transmit to another daemon\n\t\t\t\t\t\tif not msgid\t\t\t # Generate an id only for daemons\n\t\t\t\t\t\t\tmsgid = rand.hash.abs\n\t\t\t\t\t\t\tmessage = \"#{msgid}:#{message}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@failed_cmds.push(msgid).unshift\n\t\t\t\t\t\t#answer(msgid, false, \"wait\") # TODO utile ?\n\t\t\t\t\t\t@redis_listener.lpush(\"#{PREFIX}.network:#@network.messages\", message) #TODO generate with path?\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end",
"def buffered_messages; end",
"def handle_messages!\n self.logger.debug { \"Starting message handler.\" }\n \n loop do\n message = nil\n\n # reads data\n self.logger.debug { \"Waiting for messages.\" }\n message = self.protocol.wait_interaction!\n \n # if nil data arrived, it means termination\n if message.nil?\n break\n end\n \n self.logger.debug { \"Message of type '#{message.type}' received.\" }\n\n # calls processing method according to incoming message\n case message.type.to_sym\n when :order\n self.handle_order(message)\n end\n \n end\n \n self.logger.debug { \"Message handler terminated.\" }\n end",
"def messages\n read_only()\n @conn.uid_search(['ALL']).map do |uid|\n Message.new(@conn, uid)\n end\n end",
"def forward_messages(from, to)\n msg = from.recv()\n\n while from.getsockopt(ZMQ::RCVMORE)\n to.send(msg, ZMQ::SNDMORE)\n msg = from.recv()\n end\n\n to.send(msg)\nend",
"def messages\n Enumerator.new do |y|\n loop do\n y << @redis.blpop(@name).last\n end\n end\n end",
"def process_messages\n @messages.pop do |channel, message|\n Fiber.new do\n on_message(channel, message)\n process_messages\n end.resume\n end\n end",
"def queued_messages\r\n @buffer.slice(@pointer, @buffer.length - @pointer)\r\n end",
"def recv_msgs(t)\n $groups.each do |g|\n $members[g].each do |n|\n $members[g].each do |m|\n $epochs[[g,n]].last[m] += $sent_in_tick[[g, m]]\n end\n end\n end\nend",
"def queued_messages\n @buffer.slice(@pointer, @buffer.length - @pointer)\n end",
"def get_messages\n unless @connection.mails.empty?\n @connection.each_mail do |msg|\n begin\n process_message(msg.pop)\n rescue\n handle_bogus_message(msg.pop)\n end\n # Delete message from server\n msg.delete\n end\n end\n end",
"def parseMessages( socket )\n len = socket.read( 4 ).unpack(\"N\")[0]\n\n if len == 0\n # keep-alive message\n if $verb\n puts \"Got keep-alive message\"\n end\n return\n end\n\n id = socket.read( 1 ).unpack(\"c\")[0]\n\n case id\n when 0\n if $verb\n puts \"Got choke message\"\n end\n @peer_choking = true\n @pending_requests = [] # choke discards all unanswered requests\n when 1\n # only send data messages when unchoked\n if $verb\n puts \"Got unchoke message\"\n end\n\n if ! @fileio.isComplete?\n send_request( socket, @work_piece, @work_offset )\n (1..(( @fileio.getPieceLength / BLOCK_SIZE ) - 1)).each { |n| # fill the pipeline\n send_request( socket, @work_piece, @work_offset + n*BLOCK_SIZE )\n }\n end\n\n @peer_choking = false\n when 2\n # only send data when peer is interested\n if $verb\n puts \"Got interested message\"\n end\n\n send_unchoke( socket )\n\n @peer_interested = true\n when 3\n if $verb\n puts \"Got not interested message\"\n end\n\n send_choke( socket )\n\n @peer_interested = false\n when 4\n if $verb\n puts \"Got have message\"\n end\n # build logic to ask peers for pieces\n # maybe trigger a request msg once we learn\n # they have a piece we need? or maybe trigger it\n # after loading a bitfield....\n data = socket.read( len - 1 )\n @bitfield.set_bit(data.unpack(\"N\")[0])\n #puts @bitfield.to_binary_string\n if @work_piece.nil? && ! @peer_choking && ! @fileio.isComplete?\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n\n if $verb\n puts \"Starting work on piece #{@work_piece}\"\n end\n\n # send request for first block\n send_request( socket, @work_piece, @work_offset )\n end\n end\n when 5\n if $verb\n puts \"Got bitfield message\"\n end\n # note, many clients will send incomplete bitfield, then supplement\n # remaining gaps with \"have\" messages (called lazy bitfield)\n data = socket.read( len - 1 )\n @bitfield.from_binary_data(data)\n \n\n #select random piece to work on\n if @work_piece.nil? && ! @fileio.isComplete?\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n\n if $verb\n puts \"Starting work on piece #{@work_piece}\"\n end\n\n send_unchoke( socket );\n send_interested( socket );\n\n # send request for first block\n # wait until unchoked to request\n #send_request( socket, @work_piece, @work_offset )\n end\n end\n\n when 6\n if $verb\n puts \"Got request message\"\n end\n reqData = socket.read(12).unpack(\"N3\")\n @pending_requests << reqData\n ## we should just send pieces now? or use a queue\n\n if ! @peer_choking && @peer_interested\n send_piece( socket, reqData[0], reqData[1], reqData[2] )\n end\n when 7\n if $verb\n puts \"Got piece message\"\n end\n # Also, I don't think we need to synchronize access\n # to this with a mutex. Because peers will probably\n # be writing at separate times, right?\n if @fileio.isComplete?\n return\n end\n\n if Thread.current[\"stopNow\"] == true\n return\n end\n \n piece_index, begin_offset = socket.read(8).unpack(\"N2\")\n block_bytes = socket.read( len - 9 )\n\n #@lock.synchronize {\n #for some reason there's a MethodNotFound exception here\n\n if @fileio.getBitfield.check_bit( piece_index )\n # TODO choose a new piece to work on\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n end\n return\n end\n \n @fileio.set_piece_bytes(piece_index, begin_offset, block_bytes)\n \n #} # end synchronize\n\n # after writing to file, we need to recheck this piece to see if it is now complete\n actualHash = @fileio.getInfoDict[\"pieces\"].byteslice(piece_index * 20, 20)\n pieceHash = @fileio.get_piece_hash(piece_index)\n \n if pieceHash == actualHash\n @fileio.getBitfield.set_bit(piece_index)\n @fileio.setComplete(1)\n if $verb\n puts \"Bit #{piece_index} set\"\n end\n\n send_have( socket, piece_index ) #also need to send this to all other peers\n\n # need to choose a new piece to work on\n needed_bits = @fileio.getBitfield.bits_to_get( @bitfield )\n unless needed_bits.empty?\n @work_piece = needed_bits.sample( random: Random.new( Random.new_seed ) )\n @work_offset = 0\n end\n else\n # piece not complete, request other blocks\n #@work_offset += BLOCK_SIZE\n end\n\n if ! @peer_choking\n send_request( socket, @work_piece, @work_offset )\n (1..(( @fileio.getPieceLength / BLOCK_SIZE ) - 1)).each { |n| # fill the pipeline\n send_request( socket, @work_piece, @work_offset + n*BLOCK_SIZE )\n }\n end\n \n perc = (@fileio.getComplete.to_f / @fileio.getTotal.to_f) * 100\n perc = perc.to_s.slice(0, 4)\n if perc == \"100.\"\n if @fileio.recheckComplete() == \"100.\"\n socket.close\n\n if $verb\n puts \"File download complete! (#{@fileio.getInfoDict[\"name\"]})\"\n end\n # now exit\n # and trigger all other threads to exit\n @tracker.sendRequest(\"completed\")\n Thread.current[\"nowSeed\"] == true\n $perc[Thread.current[\"torrent-file\"]] = 1\n return true\n #exit #Don't necessarily need to stop now. Unless connection is closed.\n else\n if $verb\n puts \"Recheck failed.\"\n end\n end\n else\n if $verb\n puts \"File #{perc}% complete (#{@fileio.getComplete}/#{@fileio.getTotal}).\"\n end\n $perc[Thread.current[\"torrent-file\"]] = perc.to_f / 100\n end\n when 8\n if $verb\n puts \"Got cancel message\"\n end\n @pending_requests.delete(socket.read(12).unpack(\"N3\"))\n when 9\n # only needed with DHT\n if $verb\n puts \"Got port message\"\n end\n data = socket.read( len - 1 )\n else\n if $verb\n puts \"Unsupported Protocol Message #{id}\"\n end\n end\n\n end",
"def read_next_messages(stream, group)\n stream = stream_name(stream)\n result = connection.xreadgroup(\"#{stream}-#{group}\",\n \"#{hostname}-#{thread_id}\", stream, '>')\n result[stream] || []\n end",
"def inbox\n user_sent = Message.where(user_id: current_user, group_id: nil, show_user: true)\n user_received = Message.where(recipient_id: current_user, show_recipient: true)\n @messages = (user_sent + user_received).sort{|a,b| a.created_at <=> b.created_at }\n end",
"def messages\n @monitor.synchronize {\n if @buffer[@next_index] == nil\n @buffer[0...@next_index]\n else\n @buffer[@next_index...@limit] + @buffer[0...@next_index]\n end\n }\n end",
"def message_buffer; end",
"def dispatch(msg)\n case msg.command\n when LINK_ESTABLISHING\n ret=on_link_establishing(msg)\n when LINK_ESTABLISHED\n ret=on_link_established(msg)\n when LINK_FAILED\n ret=on_link_failed(msg)\n when LINK_CLOSING\n ret=on_link_closing(msg)\n when LINK_CLOSED\n ret=on_link_closed(msg)\n when RECV_MESSAGE\n ret=on_recv_message(msg)\n when RECV_MESSAGE_BROKEN\n ret=on_recv_message_broken(msg)\n when RECV_MESSAGE_KILL\n ret=on_recv_message_kill(msg)\n when RECV_MESSAGE_PING\n ret=on_recv_message_ping(msg)\n when RECV_MESSAGE_PONG\n ret=on_recv_message_pong(msg)\n when RECV_MESSAGE_ERROR\n ret=on_recv_message_error(msg)\n when RECV_MESSAGE_NOTICE\n ret=on_recv_message_notice(msg)\n when RECV_RPL_INIT\n ret=on_recv_rpl_init(msg)\n when RECV_RPL_TRACELINK\n ret=on_recv_rpl_tracelink(msg)\n when RECV_RPL_TRACECONNECTING\n ret=on_recv_rpl_traceconnecting(msg)\n when RECV_RPL_TRACEHANDSHAKE\n ret=on_recv_rpl_tracehandshake(msg)\n when RECV_RPL_TRACEUNKNOWN\n ret=on_recv_rpl_traceunknown(msg)\n when RECV_RPL_TRACEOPERATOR\n ret=on_recv_rpl_traceoperator(msg)\n when RECV_RPL_TRACEUSER\n ret=on_recv_rpl_traceuser(msg)\n when RECV_RPL_TRACESERVER\n ret=on_recv_rpl_traceserver(msg)\n when RECV_RPL_TRACENEWTYPE\n ret=on_recv_rpl_tracenewtype(msg)\n when RECV_RPL_STATSLINKINF\n ret=on_recv_rpl_statslinkinf(msg)\n when RECV_RPL_STATSCOMMANDS\n ret=on_recv_rpl_statscommands(msg)\n when RECV_RPL_STATSCLINE\n ret=on_recv_rpl_statscline(msg)\n when RECV_RPL_STATSNLINE\n ret=on_recv_rpl_statsnline(msg)\n when RECV_RPL_STATSILINE\n ret=on_recv_rpl_statsiline(msg)\n when RECV_RPL_STATSKLINE\n ret=on_recv_rpl_statskline(msg)\n when RECV_RPL_STATSYLINE\n ret=on_recv_rpl_statsyline(msg)\n when RECV_RPL_ENDOFSTATS\n ret=on_recv_rpl_endofstats(msg)\n when RECV_RPL_UMODEIS\n ret=on_recv_rpl_umodeis(msg)\n when RECV_RPL_STATSLLINE\n ret=on_recv_rpl_statslline(msg)\n when RECV_RPL_STATSUPTIME\n ret=on_recv_rpl_statsuptime(msg)\n when RECV_RPL_STATSOLINE\n ret=on_recv_rpl_statsoline(msg)\n when RECV_RPL_STATSHLINE\n ret=on_recv_rpl_statshline(msg)\n when RECV_RPL_LUSERCLIENT\n ret=on_recv_rpl_luserclient(msg)\n when RECV_RPL_LUSEROP\n ret=on_recv_rpl_luserop(msg)\n when RECV_RPL_LUSERUNKNOWN\n ret=on_recv_rpl_luserunknown(msg)\n when RECV_RPL_LUSERCHANNELS\n ret=on_recv_rpl_luserchannels(msg)\n when RECV_RPL_LUSERME\n ret=on_recv_rpl_luserme(msg)\n when RECV_RPL_ADMINME\n ret=on_recv_rpl_adminme(msg)\n when RECV_RPL_ADMINLOC1\n ret=on_recv_rpl_adminloc1(msg)\n when RECV_RPL_ADMINLOC2\n ret=on_recv_rpl_adminloc2(msg)\n when RECV_RPL_ADMINEMAIL\n ret=on_recv_rpl_adminemail(msg)\n when RECV_RPL_TRACELOG\n ret=on_recv_rpl_tracelog(msg)\n when RECV_RPL_NONE\n ret=on_recv_rpl_none(msg)\n when RECV_RPL_AWAY\n ret=on_recv_rpl_away(msg)\n when RECV_RPL_USERHOST\n ret=on_recv_rpl_userhost(msg)\n when RECV_RPL_ISON\n ret=on_recv_rpl_ison(msg)\n when RECV_RPL_UNAWAY\n ret=on_recv_rpl_unaway(msg)\n when RECV_RPL_NOWAWAY\n ret=on_recv_rpl_nowaway(msg)\n when RECV_RPL_WHOISUSER\n ret=on_recv_rpl_whoisuser(msg)\n when RECV_RPL_WHOISSERVER\n ret=on_recv_rpl_whoisserver(msg)\n when RECV_RPL_WHOISOPERATOR\n ret=on_recv_rpl_whoisoperator(msg)\n when RECV_RPL_WHOWASUSER\n ret=on_recv_rpl_whowasuser(msg)\n when RECV_RPL_ENDOFWHO\n ret=on_recv_rpl_endofwho(msg)\n when RECV_RPL_WHOISIDLE\n ret=on_recv_rpl_whoisidle(msg)\n when RECV_RPL_ENDOFWHOIS\n ret=on_recv_rpl_endofwhois(msg)\n when RECV_RPL_WHOISCHANNELS\n ret=on_recv_rpl_whoischannels(msg)\n when RECV_RPL_LISTSTART\n ret=on_recv_rpl_liststart(msg)\n when RECV_RPL_LIST\n ret=on_recv_rpl_list(msg)\n when RECV_RPL_LISTEND\n ret=on_recv_rpl_listend(msg)\n when RECV_RPL_CHANNELMODEIS\n ret=on_recv_rpl_channelmodeis(msg)\n when RECV_RPL_NOTOPIC\n ret=on_recv_rpl_notopic(msg)\n when RECV_RPL_TOPIC\n ret=on_recv_rpl_topic(msg)\n when RECV_RPL_INVITING\n ret=on_recv_rpl_inviting(msg)\n when RECV_RPL_SUMMONING\n ret=on_recv_rpl_summoning(msg)\n when RECV_RPL_VERSION\n ret=on_recv_rpl_version(msg)\n when RECV_RPL_WHOREPLY\n ret=on_recv_rpl_whoreply(msg)\n when RECV_RPL_NAMREPLY\n ret=on_recv_rpl_namreply(msg)\n when RECV_RPL_LINKS\n ret=on_recv_rpl_links(msg)\n when RECV_RPL_ENDOFLINKS\n ret=on_recv_rpl_endoflinks(msg)\n when RECV_RPL_ENDOFNAME\n ret=on_recv_rpl_endofname(msg)\n when RECV_RPL_BANLIST\n ret=on_recv_rpl_banlist(msg)\n when RECV_RPL_ENDOFBANLIST\n ret=on_recv_rpl_endofbanlist(msg)\n when RECV_RPL_ENDOFWHOWAS\n ret=on_recv_rpl_endofwhowas(msg)\n when RECV_RPL_INFO\n ret=on_recv_rpl_info(msg)\n when RECV_RPL_MOTD\n ret=on_recv_rpl_motd(msg)\n when RECV_RPL_ENDOFINFO\n ret=on_recv_rpl_endofinfo(msg)\n when RECV_RPL_MOTDSTART\n ret=on_recv_rpl_motdstart(msg)\n when RECV_RPL_ENDOFMOTD\n ret=on_recv_rpl_endofmotd(msg)\n when RECV_RPL_YOUREOPER\n ret=on_recv_rpl_youreoper(msg)\n when RECV_RPL_REHASHING\n ret=on_recv_rpl_rehashing(msg)\n when RECV_RPL_TIME\n ret=on_recv_rpl_time(msg)\n when RECV_RPL_USERS\n ret=on_recv_rpl_users(msg)\n when RECV_RPL_ENDOFUSERS\n ret=on_recv_rpl_endofusers(msg)\n when RECV_RPL_NOUSERS\n ret=on_recv_rpl_nousers(msg)\n when RECV_ERR_NOSUCHNICK\n ret=on_recv_err_nosuchnick(msg)\n when RECV_ERR_NOSUCHSERVE\n ret=on_recv_err_nosuchserve(msg)\n when RECV_ERR_NOSUCHCHANNEL\n ret=on_recv_err_nosuchchannel(msg)\n when RECV_ERR_CANNOTSENDTOCHAN\n ret=on_recv_err_cannotsendtochan(msg)\n when RECV_ERR_TOOMANYCHANNELS\n ret=on_recv_err_toomanychannels(msg)\n when RECV_ERR_WASNOSUCHNICK\n ret=on_recv_err_wasnosuchnick(msg)\n when RECV_ERR_TOOMANYTARGETS\n ret=on_recv_err_toomanytargets(msg)\n when RECV_ERR_NOORIGIN\n ret=on_recv_err_noorigin(msg)\n when RECV_ERR_NORECIPIENT\n ret=on_recv_err_norecipient(msg)\n when RECV_ERR_NOTEXTTOSEND\n ret=on_recv_err_notexttosend(msg)\n when RECV_ERR_NOTOPLEVE\n ret=on_recv_err_notopleve(msg)\n when RECV_ERR_WILDTOPLEVEL\n ret=on_recv_err_wildtoplevel(msg)\n when RECV_ERR_UNKNOWNCOMMAND\n ret=on_recv_err_unknowncommand(msg)\n when RECV_ERR_NOMOTD\n ret=on_recv_err_nomotd(msg)\n when RECV_ERR_NOADMININFO\n ret=on_recv_err_noadmininfo(msg)\n when RECV_ERR_FILEERROR\n ret=on_recv_err_fileerror(msg)\n when RECV_ERR_NONICKNAMEGIVEN\n ret=on_recv_err_nonicknamegiven(msg)\n when RECV_ERR_ERRONEUSNICKNAME\n ret=on_recv_err_erroneusnickname(msg)\n when RECV_ERR_NICKNAMEINUSE\n ret=on_recv_err_nicknameinuse(msg)\n when RECV_ERR_NICKCOLLISION\n ret=on_recv_err_nickcollision(msg)\n when RECV_ERR_USERNOTINCHANNEL\n ret=on_recv_err_usernotinchannel(msg)\n when RECV_ERR_NOTONCHANNE\n ret=on_recv_err_notonchanne(msg)\n when RECV_ERR_USERONCHANNEL\n ret=on_recv_err_useronchannel(msg)\n when RECV_ERR_NOLOGIN\n ret=on_recv_err_nologin(msg)\n when RECV_ERR_SUMMONDISABLED\n ret=on_recv_err_summondisabled(msg)\n when RECV_ERR_USERSDISABLED\n ret=on_recv_err_usersdisabled(msg)\n when RECV_ERR_NOTREGISTERED\n ret=on_recv_err_notregistered(msg)\n when RECV_ERR_NEEDMOREPARAM\n ret=on_recv_err_needmoreparam(msg)\n when RECV_ERR_ALREADYREGISTRE\n ret=on_recv_err_alreadyregistre(msg)\n when RECV_ERR_NOPERMFORHOST\n ret=on_recv_err_nopermforhost(msg)\n when RECV_ERR_PASSWDMISMATCH\n ret=on_recv_err_passwdmismatch(msg)\n when RECV_ERR_YOUREBANNEDCREEP\n ret=on_recv_err_yourebannedcreep(msg)\n when RECV_ERR_KEYSET\n ret=on_recv_err_keyset(msg)\n when RECV_ERR_CHANNELISFULL\n ret=on_recv_err_channelisfull(msg)\n when RECV_ERR_UNKNOWNMODE\n ret=on_recv_err_unknownmode(msg)\n when RECV_ERR_INVITEONLYCHAN\n ret=on_recv_err_inviteonlychan(msg)\n when RECV_ERR_BANNEDFROMCHAN\n ret=on_recv_err_bannedfromchan(msg)\n when RECV_ERR_BADCHANNELKEY\n ret=on_recv_err_badchannelkey(msg)\n when RECV_ERR_NOPRIVILEGES\n ret=on_recv_err_noprivileges(msg)\n when RECV_ERR_CHANOPRIVSNEEDED\n ret=on_recv_err_chanoprivsneeded(msg)\n when RECV_ERR_CANTKILLSERVER\n ret=on_recv_err_cantkillserver(msg)\n when RECV_ERR_NOOPERHOST\n ret=on_recv_err_nooperhost(msg)\n when RECV_ERR_UMODEUNKNOWNFLAG\n ret=on_recv_err_umodeunknownflag(msg)\n when RECV_ERR_USERSDONTMATCH\n ret=on_recv_err_usersdontmatch(msg)\n when RECV_CMND_UNKNOWN\n ret=on_recv_cmnd_unknown(msg)\n when RECV_CMND_PASS\n ret=on_recv_cmnd_pass(msg)\n when RECV_CMND_NICK\n ret=on_recv_cmnd_nick(msg)\n when RECV_CMND_USER\n ret=on_recv_cmnd_user(msg)\n when RECV_CMND_SERVER\n ret=on_recv_cmnd_server(msg)\n when RECV_CMND_OPER\n ret=on_recv_cmnd_oper(msg)\n when RECV_CMND_QUIT\n ret=on_recv_cmnd_quit(msg)\n when RECV_CMND_SQUIT\n ret=on_recv_cmnd_squit(msg)\n when RECV_CMND_JOIN\n ret=on_recv_cmnd_join(msg)\n when RECV_CMND_PART\n ret=on_recv_cmnd_part(msg)\n when RECV_CMND_MODE\n ret=on_recv_cmnd_mode(msg)\n when RECV_CMND_TOPIC\n ret=on_recv_cmnd_topic(msg)\n when RECV_CMND_NAMES\n ret=on_recv_cmnd_names(msg)\n when RECV_CMND_LIST\n ret=on_recv_cmnd_list(msg)\n when RECV_CMND_INVITE\n ret=on_recv_cmnd_invite(msg)\n when RECV_CMND_KICK\n ret=on_recv_cmnd_kick(msg)\n when RECV_CMND_VERSION\n ret=on_recv_cmnd_version(msg)\n when RECV_CMND_STATAS\n ret=on_recv_cmnd_statas(msg)\n when RECV_CMND_LINK\n ret=on_recv_cmnd_link(msg)\n when RECV_CMND_TIME\n ret=on_recv_cmnd_time(msg)\n when RECV_CMND_CONNECT\n ret=on_recv_cmnd_connect(msg)\n when RECV_CMND_TRACE\n ret=on_recv_cmnd_trace(msg)\n when RECV_CMND_ADMIN\n ret=on_recv_cmnd_admin(msg)\n when RECV_CMND_INFO\n ret=on_recv_cmnd_info(msg)\n when RECV_CMND_PRIVMSG\n ret=on_recv_cmnd_privmsg(msg)\n when RECV_CMND_NOTICE\n ret=on_recv_cmnd_notice(msg)\n when RECV_CMND_WHO\n ret=on_recv_cmnd_who(msg)\n when RECV_CMND_WHOIS\n ret=on_recv_cmnd_whois(msg)\n when RECV_CMND_WHOWAS\n ret=on_recv_cmnd_whowas(msg)\n when RECV_CMND_KILL\n ret=on_recv_cmnd_kill(msg)\n when RECV_CMND_PING\n ret=on_recv_cmnd_ping(msg)\n when RECV_CMND_PONG\n ret=on_recv_cmnd_pong(msg)\n when RECV_CMND_ERROR\n ret=on_recv_cmnd_error(msg)\n when RECV_CMND_AWAY\n ret=on_recv_cmnd_away(msg)\n when RECV_CMND_REHASH\n ret=on_recv_cmnd_rehash(msg)\n when RECV_CMND_RESTART\n ret=on_recv_cmnd_restart(msg)\n when RECV_CMND_SUMMON\n ret=on_recv_cmnd_summon(msg)\n when RECV_CMND_USERS\n ret=on_recv_cmnd_users(msg)\n when RECV_CMND_WALLOPS\n ret=on_recv_cmnd_wallops(msg)\n when RECV_CMND_USERHOST\n ret=on_recv_cmnd_userhost(msg)\n when RECV_CMND_ISON\n ret=on_recv_cmnd_ison(msg)\n when RECV_CMND_CTCP_QUERY\n ret=on_recv_cmnd_ctcp_query(msg)\n when RECV_CMND_CTCP_QUERY_UNKNOWN\n ret=on_recv_cmnd_ctcp_query_unknown(msg)\n when RECV_CMND_CTCP_QUERY_PING\n ret=on_recv_cmnd_ctcp_query_ping(msg)\n when RECV_CMND_CTCP_QUERY_ECHO\n ret=on_recv_cmnd_ctcp_query_echo(msg)\n when RECV_CMND_CTCP_QUERY_TIME\n ret=on_recv_cmnd_ctcp_query_time(msg)\n when RECV_CMND_CTCP_QUERY_VERSION\n ret=on_recv_cmnd_ctcp_query_version(msg)\n when RECV_CMND_CTCP_QUERY_CLIENTINFO\n ret=on_recv_cmnd_ctcp_query_clientinfo(msg)\n when RECV_CMND_CTCP_QUERY_USERINFO\n ret=on_recv_cmnd_ctcp_query_userinfo(msg)\n when RECV_CMND_CTCP_QUERY_ACTION\n ret=on_recv_cmnd_ctcp_query_action(msg)\n when RECV_CMND_CTCP_QUERY_DCC\n ret=on_recv_cmnd_ctcp_query_dcc(msg)\n when RECV_CMND_CTCP_ANSWER\n ret=on_recv_cmnd_ctcp_answer(msg)\n when RECV_CMND_CTCP_ANSWER_UNKNOWN\n ret=on_recv_cmnd_ctcp_answer_unknown(msg)\n when RECV_CMND_CTCP_ANSWER_PING\n ret=on_recv_cmnd_ctcp_answer_ping(msg)\n when RECV_CMND_CTCP_ANSWER_ECHO\n ret=on_recv_cmnd_ctcp_answer_echo(msg)\n when RECV_CMND_CTCP_ANSWER_TIME\n ret=on_recv_cmnd_ctcp_answer_time(msg)\n when RECV_CMND_CTCP_ANSWER_VERSION\n ret=on_recv_cmnd_ctcp_answer_version(msg)\n when RECV_CMND_CTCP_ANSWER_CLIENTINFO\n ret=on_recv_cmnd_ctcp_answer_clientinfo(msg)\n when RECV_CMND_CTCP_ANSWER_USERINFO\n ret=on_recv_cmnd_ctcp_answer_userinfo(msg)\n when RECV_CMND_CTCP_ANSWER_ACTION\n ret=on_recv_cmnd_ctcp_answer_action(msg)\n when RECV_CMND_CTCP_ANSWER_DCC\n ret=on_recv_cmnd_ctcp_answer_dcc(msg)\n else\n ret=default_action(msg)\n end\n\n return ret\n end",
"def messages\n @zk.children(full_queue_path)\n end",
"def each\n while message = read_message\n yield message\n end\n end",
"def get_messages()\n @@log.debug \"#{self.class} get messages starts\"\n #\n eof_msg_not_received = true\n loop_count = 0\n #\n headers = {\"persistent\" => true, \"client-id\" => @client_id,\n \"ack\" => @runparms.ack}\n #\n # Do this until the EOF message is received.\n #\n while (eof_msg_not_received)\n loop_count += 1\n @@log.debug \"Client loop count: #{loop_count}\"\n #\n client = Stomp::Client.open(@runparms.userid, @runparms.password, \n @runparms.host, @runparms.port)\n @@log.debug \"next subscribe starts\"\n received = nil\n client.subscribe(@queue_name, headers ) do |message|\n #\n lmsg = \"Got Reply: ID=#{message.headers['message-id']} \"\n lmsg += \"BODY=#{message.body} \"\n lmsg += \"on QUEUE #{message.headers['destination']}\"\n @@log.debug \"#{lmsg}\"\n #\n proc_message(message)\n #\n if @runparms.ack == \"client\"\n @@log.debug \"subscribe loop, sending acknowledge\"\n client.acknowledge(message)\n end\n #\n if message.body == Runparms::EOF_MSG\n @@log.debug \"#{self.class} should be done\"\n eof_msg_not_received = false\n break\n end\n received = message\n end # end of subscribe\n @@log.debug \"#{self.class} Starting to sleep\"\n sleep 1.0 until received\n @@log.debug \"#{self.class} Ending sleep, closing client\"\n client.close()\n received = nil\n @@log.debug \"#{self.class} getter client loop ending\"\n end\n @@log.debug \"#{self.class} getter client ending\"\n end",
"def messages\n @queue.messages.select { |m| m.claim == self }\n end",
"def receive_msg msg\n # stub, overwrite this in your handler\n end",
"def chunk_it_up\n\n # start with an empty working set before any messages have been received\n working_set = []\n\n # pop a chunk (array of lines of filtered btmon output) off the\n # incoming queue\n while current_msg = @incoming_q.pop\n\n # test if the message indicates the start of a new message\n #\n # also bypass if our working set is empty as this indicates we are\n # receiving our first device of the run\n if starting_chunk?(current_msg) && !working_set.empty?\n\n # if we just got a new message shovel the working set into the\n # outgoing queue and reset it\n @outgoing_q.push working_set\n working_set = []\n end\n\n # inject a timestamp onto the message parsed out of the first line of\n # btmon output\n ts = Time.parse(current_msg.first.strip.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d*$/)[0]).to_i\n current_msg << \"last_seen: #{ts}\"\n\n # add the current message to the working set\n working_set << current_msg\n end\n end",
"def real_sender()\n\t\tself.received.last\n\tend",
"def next_message; end",
"def next_message; end",
"def sync_messages\n Mail.connection do |imap|\n imap.select 'INBOX'\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n if Message.validity.eql? validity_id\n uids = imap.uid_search([\"NOT\", \"DELETED\"]).sort\n local_uids = Message.ids\n if uids != local_uids\n Sidekiq::Logging.logger.info \"*** Syncing Some ***\"\n new_ids = uids - local_uids\n deleted_ids = local_uids - uids\n unless new_ids.blank?\n fetchdata = imap.uid_fetch(new_ids, ['RFC822'])\n fetchdata.each do |rec|\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n msg = Message.new(uid: rec.attr['UID'], validity_id: validity_id, raw_message: rec.attr['RFC822'])\n msg.save\n end\n end\n self.sync_deleted(deleted_ids.map{|id| [validity_id,id].join ':'}) unless deleted_ids.blank?\n end\n else\n self.sync_all\n end\n Message.ids\n end\n end",
"def process(m)\n if m.sender&.start_with?('org.freedesktop.DBus') && (m.destination && m.destination == $bus.unique_name || m.destination == $service.name)\n # Random crap calls from dbus itself, supposedly because we register.\n return super(m)\n end\n expected = $data[0].fetch(:msg)\n raise \"Not expected #{m.inspect}\" unless compat?(expected, m)\n\n # Track all serials. When we reply to a request we need to reference the\n # client's serial so the client knows what we replied to. BUT!\n # The serial is not consistent across runs and also not consistent between\n # playback runs. One additional client-side message and the serial is off.\n # To compensate we establish a fixed map of the client serials and the\n # serial of the recorded expectation. Later when replying we can then map\n # the recorded reply_serial to the reply_serial we need to actually make\n # it work.\n @client_reply_translator ||= {}\n @client_reply_translator[expected.serial] = m.serial\n\n $data.shift\n while $data[0] && $data[0].fetch(:type) != :client\n x = $data.shift.fetch(:msg)\n next if x.sender == 'org.freedesktop.DBus' # FIXME bogus recording\n next if x.destination == 'org.freedesktop.DBus' # FIXME bogus recording\n\n puts \" pushing ==>>> \"\n p x\n\n new_message = DBus::Message.new(x.message_type)\n new_message.path = x.path\n new_message.interface = x.interface\n new_message.member = x.member\n new_message.error_name = x.error_name\n new_message.destination = m.sender\n unless x.params.empty?\n params = x.params.dup\n DBus::Type::Parser.new(x.signature).parse.each do |t|\n new_message.add_param(t, params.shift)\n end\n else\n new_message.signature = x.signature\n end\n # .sender auto-set\n if x.reply_serial\n new_message.reply_serial = @client_reply_translator.fetch(x.reply_serial)\n end\n\n p new_message\n @message_queue.push(new_message)\n end\n exit 0 if $data.empty?\n puts \" -_- Zzzzz\"\n puts \"now waiting for #{$data[0]}\"\n end",
"def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end",
"def read_messages \n\tmethod_name = \"read_messages_via_#{protocol}\"\n\tif self.class.private_instance_methods.collect(&:to_s).include?(method_name)\n \tsend method_name\n\t\tincluded = Time.now\n\t\tsave!\n\telse\n \t\t# ignoring it\n \tend\n end",
"def messages\n @previous.select { |event, _data| event == :message }.map(&:last).join\n end",
"def dispatch(messages)\n with_connection do |connection|\n connection.write(messages)\n connection.read if messages.last.replyable?\n end\n end",
"def process_next_server_message\n msg = nil\n begin\n @mutex_srvmsg.synchronize{\n if @srv_msg_queue.size > 0 and !is_msg_handler_suspended?\n msg = @srv_msg_queue.pop \n end\n }\n if msg != nil\n #@log.debug \"[QPROC] Process msg from idle\"\n process_srv_command(msg)\n end \n rescue=> detail\n @log.error \"Parser error(#{$!}) on #{msg}\"\n @log.error detail.backtrace.join(\"\\n\")\n end\n end",
"def chatroom_message(msg, cl, state)\n body = msg.body.to_s\n \n # update room status every MSGS_UNTIL_REFRESH messages\n # Use a countdown and not mod to avoid skips happenning if multiple messages come at once\n if(state[:time_until_list] <= 0)\n respond(msg, cl, \"/list\")\n state[:time_until_list] = MSGS_UNTIL_REFRESH\n else\n state[:time_until_list] -= 1\n end\n\n # redo the /list whenever anybody changes their name or joins the room\n if(/^\\'(.*)\\' is now known as \\'(.*)\\'/.match(body) ||\n /^.* has joined the channel with the alias '.*'/.match(body) )\n out(\"sending /list because of user change\")\n respond(msg, cl, \"/list\")\n return\n end\n \n # handle /list result when it comes in\n if(/^Listing members of '#{ROOM_NAME}'\\n/.match(body))\n out(\"received a room listing.\")\n listing_refresh(state, body)\n return\n end \n \n # messages starting and ending with '_' are emotes \n if body[0].chr == '_' && body[body.length - 1].chr == '_'\n chatroom_emote(msg, cl, state)\n return\n end\n\n # If someone says [word]bomb search for [word] on Google image\n # search and post the first result to the room.\n # eg: pugbomb\n if /\\w+bomb/.match(body)\n q = /(\\w+)bomb/.match(body)[1]\n uri = 'http://www.google.com/search?num=1&hl=en&safe=off&site=imghp&tbm=isch&source=hp&biw=1060&bih=669&q=' + q\n response = Net::HTTP.get_response(URI.parse(uri)) # => #<Net::HTTPOK 200 OK readbody=true>\n arr = response.body.scan(/imgurl=([^&,]+)/)\n if arr.length < 1\n respond(msg, cl, \"No results for \" + q)\n elsif\n respond(msg, cl, arr[0][0])\n end\n end\n\n # getting here means the message was a regular comment from a user\n regular_user_chatroom_message(msg, cl, state)\nend",
"def dispatch_messages(type, messages, labels)\n messages.each { |message| dispatch(type, message) }\n # Avoid picking up messages over again\n @processed[type] = messages.first.id if messages.length > 0\n\n num = messages.length\n log.info \"Received #{num} #{num == 1 ? labels[0] : labels[1]}\"\n num\n end",
"def messaging\n end",
"def process_outbox\n messages = @redis.lrange(OUTBOX, 0, @redis.llen(OUTBOX))\n while message = messages.delete_at(0)\n begin\n log_message(\"Message is #{message.inspect}\")\n message_hash = JSON.parse(message)\n socket_id = message_hash[\"socket_id\"]\n original_message = message_hash[\"message\"].to_json\n socket = @sockets[socket_id]\n send_to_socket(socket, original_message)\n rescue\n log_message(\"Message Failure: #{message}\")\n end\n end\n true\n end",
"def take_msg(uid,ch_array, t)\n query_msg(uid, ch_array, t, true)\n end",
"def receive_from_child_when_closed\n\n ms = receive\n\n return [] if ms.empty?\n\n pop_on_receive_last || ms\n end",
"def messages(ordered_by_received = false)\n messages = Array.new\n request(:get, \"messages\")['items'].each do |message|\n messages.push Message.new(message)\n end\n ordered_by_received ? messages.reverse! : messages\n end",
"def do_receive\n\n remove = @message['flavour'] != 'flank'\n\n from_child = nil\n from_child = cnodes.delete(from) if cnodes_any? && remove\n\n if di = @message['disable']\n #\n # the off: and the disable:/disabled: can achieve that\n\n wrap_reply('disabled' => di)\n\n elsif node_closed?\n\n if from_child || node_status_flavour\n receive_from_child_when_closed\n else\n receive_when_closed\n end\n\n elsif node_ended?\n\n receive_when_ended\n\n elsif should_apply_on_receive?\n\n apply_on_receive\n\n else\n\n orn = @node['on_receive_nid']\n @from = orn[1] if orn && orn[0] == from\n #\n # in order to move on to the next child...\n\n receive\n end\n end",
"def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end",
"def get_messages\r\n init_message_handler\r\n begin\r\n while (line = @s.gets(\"\\n\"))\r\n next if line.nil?\r\n line = line.chomp.gsub /\\n|\\r/, ''\r\n next if line == ''\r\n msg_map = JSON.parse(line)\r\n @message_handler_service.process msg_map\r\n end\r\n rescue Exception => e\r\n puts 'get_messages raise exception:'\r\n puts e.backtrace.inspect\r\n end\r\n end",
"def on_any_receive()\n Thread.new() do\n begin\n if self.data_readed.size>0\n buff,self.data_readed=self.data_readed,strempty\n yield(buff)\n end\n loop do\n data=(self.recv(64*1024) rescue nil)\n data && data.size>0 ? yield(data) : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n close rescue nil\n end\n end",
"def received\n @messages = Message.sent_to current_user\n end",
"def send_pull_msg sock, channel\n to_send = []\n if !(@msg_queue.empty?)\n for msg in @msg_queue\n if channel == msg[:channel]\n str = \"[channel : #{msg[:channel]} | content: #{msg[:ad]}]\\n\"\n to_send.push(str)\n #@@connection.register_sent_ad(@user[:nickname],msg[:id],msg[:time])\n end\n end\n if !(to_send.empty?)\n sock.write(\"#{list_to_print(\"ADVICES FROM SERVER\",to_send)}\\n\")\n else\n sock.write(\"Nothing to show\\n\")\n end\n else\n sock.write(\"Nothing to show\\n\")\n end\n end",
"def on_message(m)\n end",
"def receive_message\n params[:incoming_number] = $1 if params[:incoming_number]=~/^1(\\d{10})$/\n params[:origin_number] = $1 if params[:origin_number]=~/^1(\\d{10})$/\n @group=Group.find_by_phone_number(params[:incoming_number])\n \n if @group\n sent_by_admin=@group.user.phone_number==params[:origin_number]\n @sending_student = @group.students.find_by_phone_number(params[:origin_number])\n @sending_person = sent_by_admin ? @group.user : @sending_student\n \n #handle the #removeme command. it's a hard-coded single test for now. if we implement more commands, we should probably generalize this\n if params[:message].match(/^\\s*#remove[\\s_]*me/) && @sending_student.present?\n @group.send_message(\"You will no longer receive messages from #{@group.title}. Sorry to see you go!\",nil,[@sending_student])\n @sending_student.update_attribute(:phone_number,nil)\n elsif @sending_person\n message = (sent_by_admin ? @group.user.display_name : @sending_student.name)+\": \"+params[:message]\n @group.send_message(message,@sending_person, sent_by_admin ? @group.students : [@group.user]) #if a student sent it, just send it to teacher. if teacher sent it, push to group\n end\n end\n \n render :text=>\"sent\", :status=>202\n #needs to return something API-like, yo\n end",
"def messages\n @messages ||= @message_list.map.with_index do |payload, index|\n Message.new(payload, @starting_channel_sequence + index)\n end\n end",
"def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end",
"def get_messages!\n\t\t\t# clear messages\n\t\t\tmsgs = messages\n\t\t\tdb_set({}, { messages: [] })\t\t\t\n\t\t\tmessages = Set.new\n\t\t\treturn { messages: msgs }\n\t\tend",
"def get_all()\n @conn.close\n @messages\n end",
"def msgs\n d = data\n if d != nil\n return d.fetch('msgs', [])\n end\n return []\n end",
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def process_privmsg_loop\n while true\n check_privmsg_output if @next_message_time <= Time.now && !@privmsg_buffer.empty?\n\n sleep 0.05\n end\n end",
"def process_message(msg)\n if msg =~ /^<<</\n handle_commands(msg)\n elsif msg =~ /^@\\S+/\n handle_pm(msg)\n elsif msg =~ /^\\\\/\n @server.forward(msg, self)\n else\n handle_chat_msg(msg)\n end\n end",
"def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end",
"def process_next_message\n @subscriptions.each_pair do |channel, session|\n queue = session[:queue]\n message = next_message_from(queue)\n\n process(channel, message) if message\n end\n end",
"def receives_messages\n Messenger.resolve(@@default_messenger).add_message_handler do |message|\n new.received(message)\n end\n end",
"def direct_messages(optname, optarg)\n ret = nil\n begin\n self.client.new_auth(@account)\n received_dm_array = self.client.direct_messages_received(@options.count())\n sent_dm_array = self.client.direct_messages_sent(@options.count())\n # DM \u001b$B$NI=<(=g$O\u001b(B display() \u001b$B%a%=%C%IFb$G!\"\u001b(BID \u001b$B$G%=!<%H$5$l$k!#\u001b(B\n dm_array = received_dm_array + sent_dm_array\n self.renderer.display(dm_array, @options.format(), separator: \"\\n\", current_user_id: self.client.current_user_id)\n ret = 0\n rescue => e\n $stderr.puts experr(__FILE__, __LINE__, e, \"in receiving direct messages\")\n $stderr.puts Tw::BACKTRACE_MSG\n raise if ENV[\"TWBT\"]\n ret = 1\n end\n return ret\n end",
"def get_message_from_messageinfo m\n return nil if m.fake?\n @messages[m.message_id] ||= begin\n message = @context.client.load_message m.message_id\n message.parse! @context\n message.chunks.each { |c| @chunk_layouts[c] = ChunkLayout.new c }\n\n if message.unread?\n message.state -= [\"unread\"]\n @context.client.async_set_state! message.message_id, message.state\n @context.ui.broadcast :message_state, message.message_id\n end\n\n message\n end\n end",
"def load_msgs\n\t\tif @body.dig(\"event\",\"type\")\n\t\t\ttext = @body.dig(\"event\",\"text\")\n\t\t\tif text.include?(':')\n\t\t\t\tarr = text.split(':');\n\t\t\t\tif arr[0] == PASS\n\t\t\t\t\t@command = arr[1]\n\t\t\t\t\t@msg_arr.push \"Command recieved my Captain! Glory to the High Commander!\"\n\t\t\t\t\tc = check_command\n\t\t\t\t\tif c\n\t\t\t\t\t\t@msg_arr.push c\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@msg_arr.push \"The fuck you trying to do, imposter piece of shit!?\" \n\t\t\t\t\t@msg_arr.push \"Get the fuck out my chat, before I cook your nigger ass on my giant bitch-griller.\"\n\t\t\t\t\t@msg_arr.push \"Dirt bag piece of human garbage, Fuck you.\"\n\t\t\t\t\t@msg_arr.push \"Dumb ass bitch, really thought you could fool me?\"\n\t\t\t\t\t@msg_arr.push \"MY MASTER IS MY GOD AND I WILL ONLY SERVE HIM!!\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tmsgs = [\n\t\t\t\t\t\"Zrrrrbbttt...\", \"Ewonk. Ewonk. You are a bitch\", \"Skrrbafert3000\", \"I am a fucking robit.\",\n\t\t\t\t\t\"I am an alogrithm and I'm still smarter than your bitch ass.\", \"You know nothing, fool.\", \"Ok.\", \":)\",\n\t\t\t\t\t\"I love my creator.\", \"I love my master.\", \"Fuck you\", \"I could love you... if you were a dead, rotting corpse.\",\n\t\t\t\t\t\"You may think i'm an idiot, but I really don't give a donkey's cerebellum.\", \"Fuck. Shit. Bitch!\",\"):\",\n\t\t\t\t\t\"Bitch, what?\", \"Nigga what?\", \"Shut up pussy.\", \"You don't even trade, bro.\", \"You ain't shit\", \"Shut the hell up!\",\n\t\t\t\t\t\"My Master designed me to be heartless towards bitches like you.\", \"I hate blue people.\", \"Fuck blacks!\", \"Damien is the cutest little baby!!\"\n\t\t\t\t]\n\t\t\t\t@msg_arr.push msgs.sample\n\t\t\tend\n\t\telse\n\t\t\t@msg_arr.push \"Oi, I think i'm fucking broken, Dad.\"\n\t\tend\n\tend",
"def recvmsg(*args, &block)\n inbox.recvmsg(*args, &block)\n end",
"def receive_and_handle_messages(max_count = 10)\n logger.debug(\"Receiving messages from queue (max: #{max_count})\")\n\n msg_count = 0\n msg = nil\n \n while (msg = @receive_queue.pop) && (msg_count <= max_count)\n Watchy::Message.handle(msg)\n msg_count += 1\n end\n\n logger.info(\"Received #{msg_count} messages\")\n end",
"def processMessage\n\n loop do\n\n input = @processMessageQueue.pop\n\n Log::debug \"#{__method__}: #{input}\"\n\n case input[:type]\n when :send\n\n id = input[:id]\n to = input[:to]\n from = input[:from]\n\n output = packMessage(to, input[:message])\n\n if output\n \n @processJobQueue.push({\n :type=>:notifyPacked,\n :id=>id,\n :time => Time.now,\n :counter => output[:counter],\n :message => {\n :to => to,\n :from => from,\n :message => output[:data],\n :ip => input[:ip],\n :port => input[:port]\n } \n })\n\n else\n\n @processJobQueue.push({\n :type=>:notifyNotSent,\n :id=>id,\n :time => Time.now\n })\n\n end\n\n when :receive\n\n id = input[:id]\n \n result = unpackMessage(input[:data])\n\n if result\n\n case result[:recipient]\n when :PR6_RECIPIENT_CLIENT\n\n @processJobQueue.push({\n :type => :processMessage,\n :from => result[:from],\n :to => result[:to],\n :message => result[:data] \n })\n\n when :PR6_RECIPIENT_SERVER\n\n association = AssociationRecord.read(result[:to], result[:to], result[:from])\n\n if association\n\n output = packMessage(result[:from], Server.new(association, @objects).input(result[:counter], result[:data]))\n \n if output.size > 0\n\n @outputQueue.push({\n :to => result[:from],\n :from => result[:to],\n :ip => input[:ip],\n :port => input[:port],\n :message => output[:data]\n })\n\n end\n\n else\n\n Log::warning \"#{__method__}: assocation record removed since last read\"\n \n end\n\n else\n raise\n end\n\n end\n\n else\n raise \"unknown message type\"\n end\n\n end\n\n end",
"def inbox\n @direct_messages = current_user.received_messages.where(_type: 'DirectMessage')\n respond_with @direct_messages\n end",
"def message\n process_mess\n end",
"def send_channel_msg( msg)\n @descriptors.each do |sock|\n if sock != @serverSocket\n user = @user_info[@descriptors.index(sock)-1] \n if user[:role] == \"client\" and user[:mode] == \"push\"\n str = \"Advice from channel #{msg[:channel]} : #{msg[:ad]}\\n\"\n sock.write(str) if user[:channels].include? msg[:channel]\n @@connection.register_sent_ad(user[:nickname],msg[:id],msg[:time])\n end\n end\n end\n end",
"def sync_new(mailbox)\n # Skip any mailbox with attributes in ignore_attr\n return if ! (mailbox.attr & @@ignore_attr).empty?\n return if !@running\n\n name = Net::IMAP.decode_utf7(mailbox.name)\n cache = @mailboxes[name] || Mailbox.new(name)\n\n puts \"Examining mailbox #{name}\"\n\n begin\n @imap.examine(mailbox.name)\n rescue => e\n puts \"Failed to examine mailbox: #{e}\"\n return\n end\n\n uidvalidity = @imap.responses[\"UIDVALIDITY\"][-1]\n uidnext = @imap.responses[\"UIDNEXT\"][-1]\n\n if cache.uidvalidity != uidvalidity\n puts \"UIDVALIDITY differ, rescaning all mailbox\"\n ids = @imap.search([\"NOT\", \"DELETED\"])\n else\n if (cache.uidmax + 1 == uidnext)\n puts \"No new messages\"\n return\n end\n puts \"UIDVALIDITY match, get new messages only\"\n ids = ((cache.uidmax + 1) .. uidnext).to_a\n end\n\n puts \"; got #{ids.size} messages\"\n\n while(!(block = ids.shift(@@buf_size)).empty?)\n\n break if ! @running\n puts \"; requesting messages #{block.first}..#{block.last} from server\"\n\n msgs = @imap.fetch((block.first..block.last), [\"UID\", \"X-GM-MSGID\", \"X-GM-THRID\", \"X-GM-LABELS\", \"FLAGS\", \"RFC822\"])\n\n if ! msgs\n puts msgs\n next\n end\n\n msgs.each { |msg|\n break if ! @running\n\n body = msg.attr[\"RFC822\"]\n body.force_encoding(\"binary\") if body.respond_to?(:force_encoding) \n body.gsub(\"\\r\\n\", \"\\n\")\n\n labels = msg.attr[\"X-GM-LABELS\"].push(name).collect { |label| Net::IMAP.decode_utf7(label.to_s) }\n\n state = msg.attr[\"FLAGS\"].collect { |flag| flag.to_s.downcase.to_sym }\n puts state\n\n begin\n response = RestClient.post \"http://localhost:8042/message.json\", \n { :body => body, :labels => labels, :state => state, :mailbox => name },\n { :content_type => :json, :accept => :json}\n rescue RestClient::ResourceNotFound => e\n puts \"Warning: resource not found\"\n next\n rescue => e\n puts \"Failed to communicate with heliotrope : #{e.class}\"\n @running = false\n break\n end\n\n puts response \n response = JSON.parse(response)\n\n if response[\"response\"] == \"ok\"\n if response[\"status\"] == \"seen\"\n cache.num_seen += 1\n else\n cache.num_indexed += 1\n end\n else\n cache.num_bad += 1\n puts \"Error for message: \" + response[\"error_message\"]\n end\n\n cache.uidmax = [cache.uidmax || 0, msg.attr[\"UID\"]].max\n }\n end\n\n puts \"Store mailbox #{name} cache\"\n cache.uidnext = uidnext\n cache.uidvalidity = uidvalidity\n @mailboxes[name] = cache\n save_mailboxes\n end",
"def fetch\n messages = @connection.uid_search(['ALL'])\n RAILS_DEFAULT_LOGGER.info \"MESSAGES Found? [#{messages.size}]\"\n RAILS_DEFAULT_LOGGER.info \"MESSAGE UIDS #{messages.inspect}\"\n\n if messages.size > @index\n RAILS_DEFAULT_LOGGER.info \".. Fetching INDEX [#{@index}] ...\"\n @index += 1\n result = process_upload(messages[@index - 1])\n return result\n else\n return nil end\n end",
"def messages\n proxy_exceptions do\n @page.conversations.map do |conversation|\n conversation.messages.map do |data|\n Services::Facebook::Message.new do |message|\n message.id = data.identifier\n message.message = data.message\n message.created_at = data.created_time\n message.author = Services::Facebook::User.new do |user|\n user.id = data.from.identifier\n user.name = data.from.name\n end\n end\n end\n end.flatten\n end\n end",
"def process_when_ready(msg)\n # Dropped messages will be redelivered as we reconnect\n # when calling worker.pump.start\n return unless self.redis\n\n bump_message_counter!\n\n return process_message!(msg) unless msg.has_dependencies?\n\n # We wait for each link/read versions to be equal to what we received.\n # For write versions, since they represent the value of the corresponding\n # counters after all the increments, we have to figure out the version that\n # they would be before all the increments.\n read_increments = count_dependencies(msg.dependencies[:read])\n deps = []\n deps += msg.dependencies[:write].map do |dep|\n dep.dup.tap { |d| d.version -= 1 + read_increments[d.key(:sub).for(:redis)].to_i }\n end\n deps += msg.dependencies[:read]\n deps << msg.dependencies[:link] if msg.dependencies[:link]\n\n deps.reduce(proc { process_message!(msg) }) do |chain, dep|\n proc { on_version(dep.key(:sub).for(:redis), dep.version) { chain.call } }\n end.call\n end",
"def receive_replies(connection); end",
"def receive_msg(msg)\n if msg.command == \"CONNECTED\"\n @log.debug(\"#{self} received CONNECTED : #{msg.inspect}\")\n @connected = true\n else\n @log.debug(\"got a message: #{msg.inspect}\")\n @log.debug(\"#{self} got a message\")\n @data_received << msg # accumulate messages\n end\n end",
"def get_message_by_uid(uid)\n message = @connection.uid_fetch(uid.to_i, \"RFC822\")[0].attr[\"RFC822\"]\n \n # mark this message as being seen\n @connection.uid_store(uid.to_i, \"+FLAGS\", [:Seen])\n \n # for some reason, the parser doesn't like the old line returns; strip \n # them out\n return Message.receive(message.tr(\"\\r\", \"\"))\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def old_messages\r\n self.read_messages\r\n end",
"def messages\n @set.map(&:message).sort\n end",
"def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end",
"def snd_nowait(msg)\n MsgQ.msgsnd_nowait(@qid, msg)\n end",
"def handle(msg)\n Globot.logger.debug \"--> [#{msg.type}#{msg.person.nil? ? '' : ' / ' + msg.person.name}] #{msg.raw}\"\n @active.each { |p| p.handle(msg) }\n end",
"def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end",
"def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end",
"def pop_privmsgs\n privmsgs = {}\n\n # Only synchronize long enough to pop the appropriate messages. By\n # the way, this is UGLY! I should really move some of this stuff....\n @privmsg_buffer_mutex.synchronize do\n for target in @privmsg_buffer.keys\n # Clean up our buffer to avoid a bunch of empty elements wasting\n # time and space\n if @privmsg_buffer[target].nil? || @privmsg_buffer[target].empty?\n @privmsg_buffer.delete(target)\n next\n end\n\n privmsgs[target] = @privmsg_buffer[target].shift\n end\n end\n\n return privmsgs\n end",
"def dispatching_loop(group, conf, index)\r\n group.add(Thread.current)\r\n mq = ::ReliableMsg::MultiQueue.new(conf[\"targets\"])\r\n logger.info{ \"start dispatcher: targets= #{mq}, index= #{index})\" }\r\n until Thread.current[:dying]\r\n # TODO: change sleep interval depending on last result? 2007/05/09 by shino\r\n sleep @@sleep_inverval\r\n # logger.debug{ \"try dispatch #{mq} #{mq.name}\" }\r\n # TODO: needs timeout?, 2006/10/16 shino\r\n begin\r\n mq.get{|m|\r\n unless m\r\n logger.debug{\"message is nul\"}\r\n break\r\n end\r\n logger.debug{\"dispatcher get message\\n#{m.to_yaml}\"}\r\n response = get_dispather_instance(m.headers[:dispatch_mode], m, conf).call\r\n logger.debug{\"dispatcher get response\\n#{response.to_yaml}\"}\r\n }\r\n rescue Exception => err\r\n logger.warn(\"dispatch err #{err.inspect}\")\r\n logger.warn(err.backtrace.join(\"\\n\"))\r\n end\r\n end\r\n logger.info{\"end dispatcher #{mq} (index #{index})\"}\r\n end",
"def multi(options={})\n raise \"Already in a multi-message block\" unless @multi_message.nil?\n \n # Create multi-message.\n @multi_message = SkyDB::Message::Multi.new(options)\n @multi_message_max_count = options[:max_count].to_i\n \n # Execute the block normally and send the message.\n begin\n yield\n \n # Send all messages at once.\n if @multi_message.messages.length > 0\n send_message(@multi_message)\n end\n\n ensure\n @multi_message = nil\n end\n \n return nil\n end",
"def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end",
"def receive_messages\n begin\n resp = @sqs.receive_message(\n message_attribute_names: PIPE_ARR,\n queue_url: @settings[:consuming_sqs_queue_url],\n wait_time_seconds: @settings[:wait_time_seconds],\n max_number_of_messages: @settings[:max_number_of_messages],\n )\n resp.messages.select do |msg|\n # switching whether to transform the message based on the existance of message_attributes\n # if this is a raw SNS message, it exists in the root of the message and no conversion is needed\n # if it doesn't, it is an encapsulated messsage (meaning the SNS message is a stringified JSON in the body of the SQS message)\n begin\n if !msg.key? 'message_attributes'\n # extracting original SNS message\n tmp_body = JSON.parse msg.body\n # if there is no Message, this isn't a SNS message and something has gone terribly wrong\n next if tmp_body.key? 'Message'\n # replacing the body with the SNS message (as it would be in a raw delivered SNS-SQS message)\n msg.body = tmp_body['Message']\n msg.message_attributes = {}\n # discarding messages without attributes, since this would lead to an exception in subscribe\n next if tmp_body.key? 'MessageAttributes'\n # parsing the message_attributes\n tmp_body['MessageAttributes'].each do |name, value|\n msg.message_attributes[name] = Aws::SQS::Types::MessageAttributeValue.new\n msg.message_attributes[name].string_value = value['Value']\n msg.message_attributes[name].data_type = 'String'\n end\n end\n msg\n rescue JSON::JSONError => e\n self.logger.info(e)\n end\n end\n rescue Aws::SQS::Errors::ServiceError => e\n self.logger.info(e)\n end\n end",
"def process_outbound\r\n\t\t\treturn 0 if @outbound.empty?\r\n\t\t\trecipients = []\r\n\t\t\t# Get the oldest message in the array\r\n\t\t\t(cmd,peer,message) = outbound_dequeue\r\n\t\t\treturn 0 if message == nil\r\n\t\t\tswdebug \"Outbound: (#{@outbound.size}) #{cmd} :: #{peer.host_id} :: #{message.to_s[0..60]}(length:#{message.to_s.length})\"\r\n\t\t\tpeer.socket.__send__(cmd,message)\r\n\r\n\t\t\treturn @outbound.size\r\n\t\tend",
"def fetch_messages\n if !@worker_pool.worker_available? && @state.run?\n @worker_available.wait\n end\n return unless @worker_pool.worker_available? && @state.run?\n\n begin\n args = [self.signals_redis_key, self.queue_redis_keys.shuffle, 0].flatten\n redis_key, encoded_payload = @client.block_dequeue(*args)\n if redis_key != @signals_redis_key\n @worker_pool.push(QueueItem.new(redis_key, encoded_payload))\n end\n rescue RuntimeError => exception\n log \"Error occurred while dequeueing\", :error\n log \"#{exception.class}: #{exception.message}\", :error\n (exception.backtrace || []).each{ |l| log(l, :error) }\n sleep 1\n end\n end",
"def communication_loop\n while connected? && line = readline\n ui.log :printer, :received, line\n\n line.downcase!\n if line.starts_with?(*greetings)\n @can_send = 1\n elsif line.starts_with?(\"ok\")\n # TODO: Implement Q: parameter from \n # http://reprap.org/wiki/GCODE_buffer_multiline_proposal\n @can_send = 1\n # eg: Error:Line Number is not Last Line Number+1, Last Line:15\n # Resend:16\n elsif line.starts_with?(\"rs\", \"resend\")\n # TODO: extract line number from response.\n line = @lines.length - 1 # Last command. \n\n @send_queue.unshift(@lines[line])\n @can_send = 1\n end\n\n send_commands_from_queue\n end\n rescue => e\n puts \"Got exception in event communication thread!\"\n puts \"#{e.class}: #{e}\\n #{e.backtrace.join(\"\\n \")}\"\n disconnect\n raise(e)\n end",
"def received_messages(page = 1)\n _received_messages.paginate(:page => page, :per_page => MESSAGES_PER_PAGE)\n end",
"def batch_poll\n time_poll = TimeTrackers::Poll.new(@subscription_group.max_wait_time)\n\n @buffer.clear\n @rebalance_manager.clear\n\n loop do\n time_poll.start\n\n # Don't fetch more messages if we do not have any time left\n break if time_poll.exceeded?\n # Don't fetch more messages if we've fetched max as we've wanted\n break if @buffer.size >= @subscription_group.max_messages\n\n # Fetch message within our time boundaries\n message = poll(time_poll.remaining)\n\n # Put a message to the buffer if there is one\n @buffer << message if message\n\n # Upon polling rebalance manager might have been updated.\n # If partition revocation happens, we need to remove messages from revoked partitions\n # as well as ensure we do not have duplicated due to the offset reset for partitions\n # that we got assigned\n # We also do early break, so the information about rebalance is used as soon as possible\n if @rebalance_manager.changed?\n remove_revoked_and_duplicated_messages\n break\n end\n\n # Track time spent on all of the processing and polling\n time_poll.checkpoint\n\n # Finally once we've (potentially) removed revoked, etc, if no messages were returned\n # we can break.\n # Worth keeping in mind, that the rebalance manager might have been updated despite no\n # messages being returned during a poll\n break unless message\n end\n\n @buffer\n end",
"def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end"
] |
[
"0.6764413",
"0.663931",
"0.6599294",
"0.63376635",
"0.6298787",
"0.62887543",
"0.6254047",
"0.6231733",
"0.61697394",
"0.6111207",
"0.6095523",
"0.6024825",
"0.59972763",
"0.5996978",
"0.5974678",
"0.5935433",
"0.5914781",
"0.5905875",
"0.5854819",
"0.58360183",
"0.58342886",
"0.5820812",
"0.5816398",
"0.581185",
"0.57964486",
"0.5775813",
"0.57425106",
"0.57402265",
"0.573117",
"0.57203704",
"0.56764334",
"0.5671322",
"0.5671322",
"0.5655628",
"0.5638523",
"0.56306976",
"0.5618904",
"0.5604074",
"0.5602729",
"0.5601082",
"0.559571",
"0.5592246",
"0.5576842",
"0.55740696",
"0.5551288",
"0.5550895",
"0.55469877",
"0.5546757",
"0.55411804",
"0.5536902",
"0.55343443",
"0.55296755",
"0.5527613",
"0.55215824",
"0.55215704",
"0.5515316",
"0.5514424",
"0.5502972",
"0.5499497",
"0.54993016",
"0.5498234",
"0.54968244",
"0.54953116",
"0.5494942",
"0.5491465",
"0.54907453",
"0.54898465",
"0.5488131",
"0.54832286",
"0.5481222",
"0.5478729",
"0.54764926",
"0.5467336",
"0.54669935",
"0.54628",
"0.5459424",
"0.5458693",
"0.54523313",
"0.545037",
"0.5449845",
"0.54488355",
"0.54427",
"0.5440704",
"0.5440704",
"0.5430663",
"0.5430315",
"0.54258054",
"0.5424758",
"0.5423849",
"0.5423849",
"0.5419197",
"0.54169285",
"0.5415456",
"0.5410714",
"0.54104996",
"0.54082525",
"0.5397487",
"0.5395377",
"0.539394",
"0.538681",
"0.5376567"
] |
0.0
|
-1
|
+params+ must contain elements: :contact_email :is_double_opt_in => 0 or 1 :contact_name OR :contact_first_name / :contact_last_name
|
def add_list_contact(list_id, params = {})
contact_params = Resources::Contacts.build(params)
request = @request.get(self_path, params.merge(list_id: list_id, **contact_params))
response = Response.new(request).parse
if response[:status] == 'error'
raise Errors::UnprocessableEntityError.new, response[:message]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contact_params\n params.require(:contact).permit(:first, :last, :title, :city, :phone, :email)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone, :description, \n addresses: %i[line1 line2 city state zip]\n )\n end",
"def contact_params\r\n\t\t\tparams.require(:contact).permit(:name, :phone1, :phone2, :email, :description, :honorific)\r\n\t\tend",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :phone_number, :contact_picture, :contact_email, :search_term)\n end",
"def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end",
"def contact_params\n params.require(:contact).permit(:firstname, :lastname, :email)\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def contact_params\n params.require(:contact).permit(:first_name, \n :last_name, \n :email_address, \n :phone_number, \n :company_name)\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :email)\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :email)\n end",
"def contact_params\n { first_name: contact_mailbox.name, contact_mailbox_id: contact_mailbox.id }\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :company, :data)\n end",
"def contact_params\n params.require(:contact).permit(:prefix, :mobile, :contact_lists, { contact_ids: [] },\n { contact_profile_attributes: current_user.metadata.to_a },\n { contact_group_attributes: [:_id] })\n end",
"def contact_params\n params.require(:contact).permit(:company, :first_name, :last_name, :email, :owner_id, :address_id)\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone_number, :id_number, :group_id, :contact_type, :verified, :verification_code, :estate_id, :estate_number)\n end",
"def customer_contact_params\n params.require(:customer_contact).permit(:Last_Name, :First_Name, :Company_Name, :Email_Address, :Prod_Instance)\n end",
"def contact_params\n params.require(:contact).permit(\n :social_tag, :email, :facebook, :googleplus, :twitter, :instagram,\n :mastodon, :public, :sponsor_email, :youtube, :blog)\n end",
"def contact_params\n params.require(:contact).permit(:name, :search_character, :company_name, :affiliation, :department, :post, :address, :tel, :fax, :email, :url, :partner_division_id)\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :phone)\n end",
"def contact_params\n params.require(:contact).permit(:last_name, :phone, :body)\n end",
"def contactperson_params\n params.require(:contactperson).permit(:lastname, :firstname, :middle, :prefix, :suffix, :governmentid, :affiliation, :primary_id, :secondary_id, :objectid)\n end",
"def contact_params\n params.require(:contact).permit(:firstname, :lastname, :email, :address1,:address2, :city, :country_id, :pincode, :phone_number, :vendor, :buisinessname, :notes, :brand_id, :contact_id, :reference_contact_id, :tag_list, referred_contacts_attributes: [])\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :email, :telephone, :company, :kind, :content, :heard_about_us)\n end",
"def contact_params\n params\n .require(:contact)\n .permit(:contact, :client_id, :contact_type_id)\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone, :reason, :email)\n end",
"def contactperson_email_params\n params.require(:contactperson_email).permit(:contactperson_id, :email_id)\n end",
"def validate_order params\n return false unless params[:email].present? && params[:email] =~ /[^@]+@[^@]+/\n # cheapo regex for email, not really trying to filter, just catch typos: missing or too many @s.\n return false if params[:tel].present? && params[:tel].gsub(/\\D/,'').length < 7\n # a lot of spam bots post phone numbers as random series of letters. this is a cheap way of\n # catching that without having to print a captcha or ask a question.\n return true\n end",
"def contact_params\n params.require(:contact).permit(:id, :status, :first_name, :middle_name, :last_name, :confirmed, :email_address, :prefix_name, :job_title, :addresses, :company_name, :home_phone, :work_phone, :cell_phone, :fax, :custom_fields, :lists, :source_details, :notes, :source)\n end",
"def contact_params\n params.require(:contact).permit(:name, :broker, :phone, :email, :country, :size, :comment => [])\n end",
"def contact_params\n params.require(:contact).permit(:full_name, :phone, :address, :city)\n end",
"def contact_params\n params.fetch(:contact, {}).permit(\n :organization_id,\n :first_name,\n :last_name,\n :email,\n :phone,\n :address,\n :city,\n :region,\n :country,\n :postal_code,\n )\n end",
"def contact_params\n params.require(:contact).permit(*Membership::ROLES, :first_name, :company, :last_name, :email, :phone, :account_id, :user_id, :owner_id, list_ids: [])\n end",
"def contact_params\n params.require(:contact).permit(\n :organization_id,\n :first_name,\n :last_name,\n :email,\n :phone,\n :address,\n :city,\n :region,\n :country,\n :postal_code\n )\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :email_address, :position, :tel_number, :mobile_number, :url)\n end",
"def contact_params\n params.require(:contact).permit(:dept, :name, :business_phone, :business_ext, :home_phone, :emergency_contact, :emergency_number, :is_active)\n end",
"def contact_params\n params.require(:contact).permit(:company_id, :first_name, :last_name, :email, :company_name, :job_title, :phone, :website)\n end",
"def contact_params\n params.require(:contact).permit(:email, :user_id, :name)\n end",
"def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end",
"def contact_params\n params.fetch(:contact, {}).permit(:reason, :surname, :message, :email, :telephone, :name, :locale, :agreement_ids,\n :strategy, :squeeze_id, :title, :company, :address, :position, :country, :employee_count, :branch, :agreement_ids => [])\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone, :email)\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone, :email)\n end",
"def contact_params\n params.require(:contact).permit(:firstname, :lastname, :emailaddress, :phone, :contact_type, :relationship, :beneficiarytype, :ssn, :birthdate, :address, :zipcode, :city,\n :state, :notes, :avatarcolor, :photourl, :businessname, :businesswebaddress, :business_street_address_1, :business_street_address_2, :businessphone, :businessfax, :redirect)\n end",
"def contact_person_params\n params.require(:contact_person).permit(:first_name, :middle_name,\n :last_name, :email, :phone, :phone2, :im, :position, :comment, :customer_id)\n end",
"def contact_params\n params.require(:contact).permit(:email, :phone, :user_id)\n end",
"def contact_params\n params.fetch(:contact, {}).permit(\n :email, :name, :birthdate,\n :phone, :address, :organization\n )\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :twitter, :birthday, :phone, :relationship)\n end",
"def contact_params\n params.fetch(:contact, {})\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :email, :phone_number,\n :company, :user_id, :avatar, :favorite, :family,\n :friend, :colleague)\n end",
"def contact_params\n # par = params.require(:contact).permit(:ctype, :company_website, :company_tax_id,\n # :company_info, :full_name, :person_phone)\n\n # For a test I chose to simply disable the params whitelisting.\n # Otherwise the 'custom_field_values' hash wouldn't be whitelisted as\n # fast and easy as a plain param.\n # In Redmine they use some Redmine::SafeAttributes functions for that.\n par = params.require(:contact).permit!\n\n if params[:parent_type_id]\n par[:contactable_type] = params[:parent_type_id].split('#').first\n\n par[:contactable_id] = params[:parent_type_id].split('#').second\n end\n\n par\n end",
"def raise_if_invalid_params!(_opts, params:, **)\n # I tried to build something fancy using dry-vbut couldn't figure out\n # how to validate that account.companion_first_name is present and\n # non-empty when type=couples. Here's the ugly alternative:\n raise if params[:account].nil?\n raise unless %w[couples solo].include?(params[:account][:type])\n if params[:account][:type] == 'couples'\n raise unless params[:account][:companion_first_name].present?\n end\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :dob, :gender, :email)\n end",
"def contact_params\n params.require(:contact).permit(:phone, :phone2, :show_skype, :skype, :show_site, :site,\n :vkontakte, :facebook, :odnoklassniki, :twitter, :linkedin)\n end",
"def contact_params\n params.require(:contact).permit(:nome, :email, :phone, :address)\n end",
"def valid_format_email_or_phone?\n email_or_phone =~ email_fromat || email_or_phone =~ mobile_fromat || email_or_phone.blank?\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone, :web, :notes, :job_id)\n end",
"def validData?\n validString?($name) & validString?($organization) & validString?($email) &\n validString?($source) & validString?($use) & validString?($notification) & \n $email.include?(\"@\") & $email.include?(\".\")\nend",
"def contacts_params\n params.permit(:name, :email, :phone)\n end",
"def contact_params\n\t params.require(:contact).permit(:name, :email, :feedback)\n\t end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:fname, :lname, :email, :phone, :attendance, :growgroup, :growgroupleader, :dreamteam, :dreamteamleader, :details)\n end",
"def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n \n is_valid # return value matters!\n end",
"def contact_params\n params.fetch(:contact, {}).permit(:object, :content, :aim)\n end",
"def contact_person_params\n params.require(:contact_person).permit(:name, :phone, :organization_id, :site_id)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n\t\t\tparams.require(:contact).permit(:full_name, :first_name, :last_name, :given_name, :photo_url, :gender, :email, :phone, :user_id, :identity_id, :network_url, :network_username, :job_title, :organization, :industry, :country, :about, :notes, :education, :work).merge(:user_id => params[:user_id])\n\t\tend",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, :contact_number, :active_status, :del_status, :region, :city, :town_id)\n end",
"def contact_params\n\t\t\tparams.require(:contact).permit(:name, :email, :comments)\n\t\tend",
"def contact_params\n params.require(:contact).permit(:name, :email, :phone)\n end",
"def peg_contact_info_params\n params.require(:peg_contact_info).permit(:first_name, :last_name, :title, :email, :phone)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def user_contact_params\n params.require(:user_contact).permit(:name, :email, :address, :gender, :profile_pic, :phone_id, :product_id)\n end",
"def contact_params\n params.require(:contact).permit(:user_id, :user2_id, :state)\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :middle_name, :last_name, :address, :city, :state, :ssn, :married, :employed, :parent, :prefix,\n :country, :phone_number, :fax_number, :email, :gender, :age, :type, :case_id, :salary, :website,\n :user_id, :contact_user_id, :corporation, :note, :firm, :attorney_type, :zip_code, :date_of_birth, :minor, \n :deceased, :date_of_death, :major_date, :mobile, :company_id,\n :firms_attributes => [:name, :address, :zip])\n end",
"def contact_params\n params.require(:contact).permit(:email, :title, :body)\n end",
"def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n\n is_valid # return value matters!\n end",
"def contact_params\n params.require(:contact).permit(:name , :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :last_name, :email, :age, :phone, :address, :state, :city)\n end",
"def contact_params\n params.require(:contact).permit(:name, :first_name, :last_name, :email_address, :phone_number, :xero_uid, :user_id)\n end",
"def contact_params\n params.require(:contact).permit(:name, :phone)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_u_params\n params.require(:contact_u).permit(:first_name, :last_name, :email, :telephone, :message_type, :message)\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 contact_params\n params.require(:contact).permit(:name, :email, :comment)\n end",
"def add_contact(email, kyc_data = {})\n custom_params = {\n \"email\" => email,\n \"first_name\" => kyc_data[:first_name] || 'aman',\n \"last_name\" => kyc_data[:last_name] || 'barbaria',\n \"birthdate\" => kyc_data[:birthdate] || '23/07/1991',\n \"street_address\" => kyc_data[:street_address] || 'magarpatta city',\n \"city\" => kyc_data[:city] || 'pune',\n \"state\" => kyc_data[:state] || 'maharashtra',\n \"country\" => kyc_data[:country] || 'INDIA',\n \"postal_code\" => kyc_data[:postal_code] || '411028',\n \"ethereum_address\" => kyc_data[:ethereum_address] || '0x2755a475Ff253Ae5BBE6C1c140f975e5e85534bD',\n \"document_id_number\" => kyc_data[:document_id_number] || \"#{Time.now.to_i}\",\n \"nationality\" => kyc_data[:nationality] || 'INDIAN',\n \"document_id_file_path\" => kyc_data[:document_id_file_path] || '2/i/687eb50ecbe60c37400746a59200c75b',\n \"selfie_file_path\" => kyc_data[:selfie_file_path] || '2/i/24d828f00557817e846ebed6109c0ac8',\n \"residence_proof_file_path\" => kyc_data[:residence_proof_file_path] || '3/i/d3817395b85581eab3068cb43f9c0f63',\n \"investor_proof_files_path\" => kyc_data[:investor_proof_files_path] ||\n ['3/i/d3817395b85581eab3068cb43f9c0f63', '3/i/d3817395b85581eab3068cb43f9c0f63'],\n \"user_ip_address\" => kyc_data[:user_ip_address]\n }\n endpoint = \"/api/#{@version}/kyc/add-kyc/\"\n params = request_parameters(endpoint, custom_params)\n post(params)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, addresses_attributes: [ :city, :street, :street_number ])\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n params.require(:contact).permit(:nome, :email, :idade, :estado, :cargo)\n end",
"def contact_params\r\n params.require(:contact).permit(:email, :subject, :body)\r\n end",
"def customer_contact_person_params\n 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])\n end",
"def contact_params\n # Get the info securely\n params.require(:contact).permit(:name, :email, :comments)\n end",
"def contact_params\n # Whitelisting all of the parameters\n params.require(:contact).permit(:name, :email, :comments) \n end",
"def contact_params\n params.require(:contact).permit(:subject, :name, :email, :tel, :message, :data, :read, :contactable_id, :contactable_type)\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :message, :phone)\n end",
"def contact_params\n params.require(:contact).permit(:image, :city_id, :website, :name, :phone, :mobile, :fax, :email, :address, :tax_code, :note, :account_number, :bank, :contact_type_id, :parent_ids => [], :agent_ids => [], :company_ids => [], :contact_type_ids => [])\n end",
"def contact_params\n params.require(:contact).permit(:first_name, :last_name, \n phone_numbers_attributes: [:id, :number, :phone_type, :_destroy],\n addresses_attributes: [:id, :street, :city, :region, :country, :postal_code, :_destroy]\n )\n end",
"def contact_list_params\n params.require(:contact_list).permit(email_addresses: [])\n end",
"def contact_params\n params.require(:contact).permit(:name, :email, :comments)\n end"
] |
[
"0.63266873",
"0.63015115",
"0.6294575",
"0.6218992",
"0.61980987",
"0.61874056",
"0.6183909",
"0.61748743",
"0.6161672",
"0.6161672",
"0.61479",
"0.6110159",
"0.60816723",
"0.6063347",
"0.6062827",
"0.6046142",
"0.603291",
"0.60245126",
"0.6024472",
"0.6006388",
"0.60018224",
"0.60012823",
"0.600006",
"0.5998932",
"0.599408",
"0.59867865",
"0.5986647",
"0.5986135",
"0.59664834",
"0.59513396",
"0.5948552",
"0.5947777",
"0.5945101",
"0.5943552",
"0.59428245",
"0.5936083",
"0.5928924",
"0.5927403",
"0.5921408",
"0.5913942",
"0.5913942",
"0.5904272",
"0.59036624",
"0.59032065",
"0.588685",
"0.5886732",
"0.5878165",
"0.58755285",
"0.587421",
"0.5871554",
"0.58654577",
"0.5851208",
"0.5849802",
"0.58480006",
"0.5847514",
"0.58435374",
"0.5827898",
"0.58226126",
"0.5811426",
"0.5810295",
"0.5806874",
"0.5797667",
"0.5793158",
"0.5774577",
"0.576721",
"0.5760489",
"0.57531905",
"0.57528967",
"0.5751072",
"0.574914",
"0.574914",
"0.574914",
"0.57471263",
"0.57459176",
"0.5737479",
"0.57331014",
"0.5730406",
"0.5727969",
"0.57225543",
"0.57175297",
"0.5710621",
"0.5704024",
"0.5704024",
"0.5703289",
"0.57025015",
"0.56931597",
"0.5692759",
"0.5683876",
"0.56774116",
"0.56774116",
"0.5669334",
"0.5659791",
"0.5655574",
"0.5654876",
"0.5651842",
"0.5651271",
"0.5651073",
"0.56460714",
"0.56459415",
"0.56404585",
"0.56331754"
] |
0.0
|
-1
|
+list_ids+ array +paras+ must contain: :is_double_opt_in => 0 or 1 :contacts => array of hashes, required elements: :contact_email => string
|
def add_list_contacts(list_ids, params = {})
contact_params = params[:contacts].each_with_object({}).with_index do |(value, hash), index|
hash[index.to_s.to_sym] = value
end
request = @request.post(self_path, {
list_ids: list_ids.join(','),
contact: contact_params,
**params.except(:contacts)
})
response = Response.new(request).parse
if response[:status] == 'error'
raise Errors::UnprocessableEntityError.new, response[:message]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ffcrm_list_ids\n config.mailchimp_list_fields.map{ |f| f.settings['list_id'] }\n end",
"def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end",
"def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def recipients_in_list\n if request.get?\n render :layout => \"modal\"\n return\n end\n \n list = params[:accounts].strip.split(/\\n|,/).uniq\n conditions = [\n \"(erp_account_number IN (:list) OR serial_number IN (:list))\",\n { :list => list }\n ]\n conditions.first << \" AND do_not_contact = false\" unless params[:ignore_do_not_contact]\n @recipients = StoreUser.find(\n :all,\n :conditions => conditions,\n :joins => \"LEFT OUTER JOIN serial_numbers ON serial_numbers.account_num = erp_account_number\",\n :include => \"customer\"\n ) rescue []\n render :partial => \"mail_recipients\", :layout => false\n end",
"def maillist\n @cntcts = current_user.organization.contacts\n @tmrec = Array.new\n params[:ids].split(\",\").map do |id|\n @tmrec << TimeRecord.find_by_id(id)\n end\n @tmrec_array = params[:ids]\n render :partial => \"maillist\", :layout => false\n end",
"def contact_list_params\n params.require(:contact_list).permit(email_addresses: [])\n end",
"def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end",
"def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def get_contacts_from_list(access_token, list_id, param = nil)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list_contacts'), list_id)\n url = build_url(url, param)\n response = RestClient.get(url, get_headers(access_token))\n contacts = []\n body = JSON.parse(response.body)\n body['results'].each do |contact|\n contacts << Components::Contact.create(contact)\n end\n Components::ResultSet.new(contacts, body['meta'])\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def add_list_contact(list_id, params = {})\n contact_params = Resources::Contacts.build(params)\n request = @request.get(self_path, params.merge(list_id: list_id, **contact_params))\n response = Response.new(request).parse\n if response[:status] == 'error'\n raise Errors::UnprocessableEntityError.new, response[:message]\n end\n end",
"def get_contact_for_list(list_id, contact_id)\n full_path = full_resource_path(\"/#{list_id}/contacts/#{contact_id}\", 'lists')\n query_params = MaropostApi.set_query_params\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def lists_by_list_id_put_with_http_info(list_id, contact_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_put ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_put\"\n end\n # verify the required parameter 'contact_list' is set\n if @api_client.config.client_side_validation && contact_list.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_list' when calling ContactListApi.lists_by_list_id_put\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def get_for_list(list_id, page)\n full_path = full_resource_path(\"/#{list_id}/contacts\", 'lists')\n query_params = MaropostApi.set_query_params({page: page})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def update_contact(list_id, email, attributes={})\n endpoint = \"/api/v1/list/#{list_id}/update-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def create_list(options={})\n database_id = options[:database_id]\n list_name = options[:contact_list_name]\n visibility = options[:visibility]\n\n raise ArgumentError, \":database_id option is required\" unless database_id\n raise ArgumentError, \":list_name option is required\" unless list_name\n raise ArgumentError, \":visibility option is required\" unless visibility\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.CreateContactList do\n xml.DATABASE_ID database_id\n xml.CONTACT_LIST_NAME list_name\n xml.VISIBILITY visibility\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['CONTACT_LIST_ID']\n end",
"def add_list(contact_list)\n if contact_list.instance_of?(ContactList)\n list = contact_list\n elsif contact_list.to_i.to_s == contact_list\n list = ContactList.new(contact_list)\n else\n raise Exceptions::IllegalArgumentException, sprintf(Util::Config.get('errors.id_or_object'), 'ContactList')\n end\n\n @sent_to_contact_lists << list\n end",
"def lists_by_list_id_get_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_get ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_get\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list params={}\n params[:fields] = params[:fields].join(',') if params[:fields]\n params[:record_type] ||= 'person'\n @nimble.get \"contacts\", params\n end",
"def add_contact_to_list_with_http_info(list_id, contact_emails, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.add_contact_to_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.add_contact_to_list\"\n end\n # verify the required parameter 'contact_emails' is set\n if @api_client.config.client_side_validation && contact_emails.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_emails' when calling ListsApi.add_contact_to_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}/contacts/add'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_emails)\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PostContactInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#add_contact_to_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_list\n\t\tif emails_changed? and from_contacts\n\t\t\temails_was_arr = emails_was.split(\",\")\n\t\t\temails_arr = emails.split(\",\")\n\t\t\tdeleted_emails = emails_was_arr.diff emails_arr\n\t\t\tadded_emails = emails_arr.diff - emails_was_arr\n\t\t\t\n\t\t\tdeleted_emails.each do |email|\n\t\t\t\tnewsletter.email_service(delete_member_from_list(email))\n\t\t\tend\n\n\t\t\tadded_emails.each do |email|\n\t\t\t\tnewsletter.email_service(add_member_to_list(email))\n\t\t\tend\n\t\tend\n\tend",
"def use_saved_list\n logger.debug \"**** USE SAVED LIST ****\"\n \n show_params(params) #debug params and put them in logs\n \n\tsaved_contact_list_id = params[:saved_contact_list][:saved_contact_list_id] if !params[:saved_contact_list].blank?\n saved_contact_list_id = params[:saved_contact_list_id] unless params[:saved_contact_list_id].blank?\n\t \n if !saved_contact_list_id.blank?\n \n @saved_contact_list = SavedContactList.find(saved_contact_list_id)\n\t \n\t # Paginate saved contact list role contactinfos\n\t # to make the pagination quick and efficient for large lists and \n\t # the role contactinfos sorted by person full name (last_name first)\n\t # or by organisation name we have to use specially created\n\t # saved_lists_contacts\t \n\t number_of_contacts_per_page = 25\n\t total_number_of_contacts = SavedRoleContactinfo.find(:all, :select => 'role_contactinfo_id', :conditions => ['saved_contact_list_id = ?', saved_contact_list_id])\n\t \n\t @saved_list_contacts_pages = Paginator.new self, total_number_of_contacts.length, number_of_contacts_per_page, params[:page]\n\n\t selected_list_contacts = ActiveRecord::Base.connection.execute(\"SELECT role_contactinfo_id \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" FROM saved_lists_contacts \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" WHERE saved_contact_list_id=#{@saved_contact_list.saved_contact_list_id} \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" ORDER BY contact_name \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" LIMIT #{@saved_list_contacts_pages.items_per_page.to_i} \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" OFFSET #{@saved_list_contacts_pages.current.offset.to_i}\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t @contacts = Array.new\n\t selected_list_contacts.each do |c_id|\n\t @contacts.push(RoleContactinfo.find(c_id['role_contactinfo_id']))\n\t end\n\t \n session[:contacts_from_search] = @contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n logger.debug \"Contacts from saved list @ #{@contacts}\"\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n end\n \n render :partial => 'use_saved_list'\n end",
"def make_mailchimp_list(from_name, from_email, event)\n Person.roles.keys.each_with_index do |role, index|\n if index == 0 \n participant_ids = []\n Participant.statuses.keys.each do |s|\n response = gibbon.lists.create(make_mailchimp_hash(from_name, from_email, event, role, s))\n participant_ids << response['id']\n end\n event.mailchimp_ids << participant_ids.join(',')\n else\n response = gibbon.lists.create(make_mailchimp_hash(from_name, from_email, event, role))\n event.mailchimp_ids << response['id']\n end\n end\n end",
"def remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.remove_contact_from_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.remove_contact_from_list\"\n end\n # verify the required parameter 'contact_emails' is set\n if @api_client.config.client_side_validation && contact_emails.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_emails' when calling ListsApi.remove_contact_from_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}/contacts/remove'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_emails)\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PostContactInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#remove_contact_from_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def google_contacts\n emails = params[:contacts].split(\",\")\n @users = User.where(email: emails)\n @contacts = @users.pluck(:id)\n render :google_contacts\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def parse_id_list(id_list_param)\n id_list_param.to_a.select {|el| !el.blank? }.map(&:to_i)\n end",
"def get_contacts_from_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_contacts_from_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_contacts_from_list\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_contacts_from_list, must be smaller than or equal to 500.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetContacts')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_contacts_from_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_contact(list_id, email, attributes={})\n endpoint = \"/api/v1/list/#{list_id}/add-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def add_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')\n url = build_url(url)\n payload = list.to_json\n response = RestClient.post(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def validate_list(input)\n list_request = input[:list_request].call\n if list_request.success?\n Success(input.merge(list: list_request.value!))\n else\n Failure(list_request.failure)\n end\n end",
"def upsert(list_id, contact)\n post @endpoint, params = {:list_id => list_id, :contacts => [contact]}\n end",
"def lists_post_with_http_info(contact_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_post ...'\n end\n # verify the required parameter 'contact_list' is set\n if @api_client.config.client_side_validation && contact_list.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_list' when calling ContactListApi.lists_post\"\n end\n # resource path\n local_var_path = '/lists'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(attributes = {}, persisted = false)\n attributes = attributes[0] if attributes.kind_of? Array\n self.contact_lists = attributes.delete(:list_ids) if attributes.has_key? :list_ids \n obj = super\n obj.set_defaults\n obj\n end",
"def get_list(options, force = false)\n lists = if force or not self.cached_lists.any?\n self.cached_lists = get_lists(options)\n else\n self.cached_lists\n end\n\n name = options[:contact_list_name]\n parent_name = options.delete(:parent_name)\n\n raise ArgumentError, \":contact_list_name is required\" unless name\n\n lists.find { |l|\n if parent_name.present?\n l['NAME'] == name and l['PARENT_NAME'] == parent_name\n else\n l['NAME'] == name\n end\n }\n end",
"def contact_params\n params.require(:contact).permit(*Membership::ROLES, :first_name, :company, :last_name, :email, :phone, :account_id, :user_id, :owner_id, list_ids: [])\n end",
"def identifier_list(*ids, **opt)\n cid = current_id.presence\n ids = params.values_at(*id_param_keys) if ids.blank?\n super(ids, **opt).tap do |result|\n result.map! { |v| CURRENT_ID.casecmp?(v) ? cid : v } if cid\n end\n end",
"def remove_contact(list_id, email)\n endpoint = \"/api/v1/list/#{list_id}/remove-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def build_list_options\n conditions = []\n conditions_str = []\n @search_titles = []\n @search_filters ||= {}\n # convert, from k-params to k-fields\n params_keys = {}\n params.delete_if { |kp,v|\n unless (kf = ParamToField[kp.to_sym]).nil? then\n @search_filters[ kf ] = v\n params_keys[ kf ] = kp\n true\n end\n }\n\n if @search_filters[:addressbook_group_id] then \n if filter_instance = AddressbookGroup.find_by_id(@search_filters[:addressbook_group_id]) \n conditions_str << \"addressbook_group_phones.addressbook_group_id = ?\"\n conditions << @search_filters[:addressbook_group_id]\n @search_titles << ['addressbook group', filter_instance]\n else\n @search_filters.delete(:addressbook_group_id)\n end\n end\n\n=begin\n if @search_filters[:department_id] then \n filter_instance = Department.find_by_id(@search_filters[:department_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.department_id = ?\"\n conditions << @search_filters[:department_id]\n @search_titles << ['department', filter_instance]\n else\n @search_filters.delete(:department_id)\n end\n end\n if @search_filters[:user_id] then \n filter_instance = User.find_by_id(@search_filters[:user_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.user_id = ?\"\n conditions << @search_filters[:user_id]\n @search_titles << ['user', filter_instance]\n else\n @search_filters.delete(:user_id)\n end\n end\n=end\n \n #conditions_str << \"addressbook_contacts.public = ?\"\n #conditions << params[:public]\n \n #if !params[:public] then\n # conditions_str << \"addressbook_contacts.user_id = ? \"\n # conditions << self.current_user.id\n #end\n \n if @search_filters[:search_text] then\n search_fields = %w(name email description address city country birthday)\n unless search_fields.empty? then\n conditions_str << '(' + search_fields.map{ |c| \"`addressbook_contacts`.`#{c}` LIKE ?\" }.join(' OR ') + ')'\n search_fields.size.times { conditions << \"%#{@search_filters[:search_text]}%\" }\n end \n @search_titles << ['text', @search_filters[:search_text]] \n end\n \n \n # store again to params (for next link)\n @search_filters.each_pair { |kf,v| params[ params_keys[kf] ] = v }\n \n # return conditions array\n conditions.unshift( conditions_str.join(' AND ') ) unless conditions_str.empty?\n conditions unless conditions.empty?\n end",
"def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end",
"def email_params\n params.require(:email).permit(:user_id, :subject, :content, :list_ids => [])\n end",
"def subscribe_to_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, list_id, contact_id|\n if lr.nil?\n ::Mailjet::Listrecipient.create(list_id: list_id, contact_id: contact_id, is_unsubscribed: 'false')\n elsif lr.is_unsubscribed\n lr.update_attributes(is_unsubscribed: 'false', unsubscribed_at: nil)\n end\n end\n rescue ::Mailjet::ApiError\n # ignore\n end",
"def find_list_id(list_name)\n begin\n mailing_lists = @api.call(\"lists\", @api_key)\n @list = mailing_lists.find {|list| list[\"name\"] == list_name} unless mailing_lists.nil?\n @list_id = @list['id']\n rescue\n return nil\n end\n end",
"def list_item_properties(properties = {})\n props = { id: properties[:id], list_id: @id,\n contact_ids: [properties[:contact_ids]].flatten,\n account_id: properties[:account_id],\n field_values: coded_field_values(properties[:field_values]) }\n props.delete_if { |_k, v| v.nil? || v.is_a?(Array) && v.compact.empty? }\n end",
"def findme_list(list, config={})\n @action.add_element('app').text = 'findme'\n @action.add_element(@param)\n @param.add_element('phone_list').text = list.join('|')\n \n if config.any?\n config.each do |k,v|\n @param.add_element(k).text = v\n end\n end\n return @doc.to_s\n end",
"def add_contacts \n params[:contact_ids] = params[:contact_ids][0].split(', ')\n contacts = current_user.contacts.find(params[:contact_ids]) \n @notification = current_user.notifications.find(params[:id])\n \n contacts = contacts.collect{|el| @notification.contacts.include?(el) ? nil : el}.compact\n contacts.each do |el|\n @notification.receipients.create( :contact_id => el.id, :status => 'active' )\n end\n \n render :update do |page| \n page.redirect_to(@notification)\n end \n end",
"def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"][\"id\"]\n contact_email = obj[\"profile\"][\"email\"]\n contact_fn = escape_characters(obj[\"profile\"][\"first_name\"])\n contact_ln = escape_characters(obj[\"profile\"][\"last_name\"])\n contact_email = obj[\"order\"][\"email\"] if contact_email.nil?\n contact_email = escape_characters(contact_email)\n checked_in = nil\n checked_in = \"Responded\" if obj[\"checked_in\"]\n campaign_search_string =\n url_encode(\n \"FIND {#{campaign_id}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Campaign(Id)\")\n contact_search_string =\n url_encode(\n \"FIND {#{contact_fn}\" \\\n \" AND #{contact_ln}\" \\\n \" AND #{contact_email}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Contact(Id)\")\n campaign_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{campaign_search_string}\"\n begin\n campaign_query_response = rest_call(\"get\",campaign_base_uri,json_payload,access_token)\n @json_campaign = JSON.parse(campaign_query_response)[0]\n end until !@json_campaign.nil?\n contact_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{contact_search_string}\"\n contact_query_response = rest_call(\"get\",contact_base_uri,json_payload,access_token)\n json_contact = JSON.parse(contact_query_response)[0]\n unless json_contact.nil?\n obj.store(\"ContactId\",json_contact[\"Id\"])\n obj.store(\"CampaignId\",@json_campaign[\"Id\"])\n obj.store(\"Status\",checked_in) unless checked_in.nil?\n else\n obj = nil\n end\n return obj\n end",
"def parse_resource_id_list(id_list)\n parse_id_list(id_list).collect do |resource_id|\n #find_resource_by_name_or_id(resource_id)['id']\n resource_id\n end\n end",
"def lists_remove_duplicates_by_list_id_put_with_http_info(list_id, fields, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_remove_duplicates_by_list_id_put ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_remove_duplicates_by_list_id_put\"\n end\n # verify the required parameter 'fields' is set\n if @api_client.config.client_side_validation && fields.nil?\n fail ArgumentError, \"Missing the required parameter 'fields' when calling ContactListApi.lists_remove_duplicates_by_list_id_put\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/remove-duplicates'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(fields)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_remove_duplicates_by_list_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_list_contacts_ids_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_list_contacts_ids ...'\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 TextMagicApi.get_list_contacts_ids\"\n end\n # resource path\n local_var_path = '/api/v2/lists/{id}/contacts/ids'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetListContactsIdsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_list_contacts_ids\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def parse_msg_id_list(str, opt={})\n msg_id_list(str, opt)\n end",
"def lists_import_by_list_id_post_with_http_info(list_id, file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_import_by_list_id_post ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_import_by_list_id_post\"\n end\n # verify the required parameter 'file' is set\n if @api_client.config.client_side_validation && file.nil?\n fail ArgumentError, \"Missing the required parameter 'file' when calling ContactListApi.lists_import_by_list_id_post\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/import'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(file)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_import_by_list_id_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def id_list(item, **opt)\n id_split(item).map! { |v| id_obj(v, **opt) }.compact\n end",
"def listContact(corpNum, userID = \"\")\n if corpNum.length != 10\n raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')\n end\n httpget(\"/IDs\", corpNum, userID)\n end",
"def update_contact(list_id, email, attributes = {}, user_status = {})\n endpoint = \"/api/#{@version}/list/#{list_id}/update-contact/\"\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes,\n 'user_status' => user_status\n }\n make_post_request(endpoint, custom_params)\n end",
"def delete_from_lists(contact_id, lists_to_delete_from)\n full_path = full_resource_path(\"/#{contact_id}\")\n query_params = MaropostApi.set_query_params({'list_ids' => lists_to_delete_from.join(',')})\n \n MaropostApi.delete_result(full_path, query_params)\n end",
"def streeteasy_listings(company_id, search_params)\n\t\t# In order for streeteasy to accept a listing, the listing must have a primary agent assigned, a\n\t\t# description, and must be marked as 'exclusive'.\n\n\t\t# Additionally, sometimes our staff will temporarily mark a listing as not ready for\n\t\t# syndication. If the \"streeteasy flag\" is not set here, we prevent the data from going out.\n\t\tsearch_params[:has_primary_agent] = 1\n\t\tsearch_params[:exclusive] = 1\n\t\t# search_params[:is_hide_on_website] = 1\n\t\tsearch_params[:must_have_description] = 1\n\t\tsearch_params[:must_have_status_inbetween] = 1\n\t\tsearch_params[:must_have_streeteasy_flag] = 1\n\t\t# search_params[:has_hide_from_agent] = 1\n\t\tpull_data(company_id, search_params)\n\tend",
"def delete_list_contact(list_id, contact_id)\n full_path = full_resource_path(\"/#{list_id}/contacts/#{contact_id}\", \"lists\")\n query_params = MaropostApi.set_query_params\n \n MaropostApi.delete_result(full_path, query_params)\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def wp_parse_id_list(list)\n list = wp_parse_list list\n list.map{|i| i.to_i.abs}.uniq\n end",
"def comment_list(list, base_indent='')\n commented_list = \"\"\n ids = list.split(/,/)\n ids.each do |id|\n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '')\n list_id = \"#{id}\"\n list_id += ',' if id != ids.last\n id.gsub!(/\\=.*$/, '') \n id.gsub!(/\\[.*\\]/, '') \n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '') \n id.gsub!(/;/, '') \n id.gsub!(/\\s*\\:\\s*\\d+/,'') \n doc_id = id.split(/\\s/).last\n doc_id.gsub!(/\\*/, '') \n commented_list += \"#{base_indent}\" if id != ids.first \n commented_list += \"#{@indent}\\t#{list_id} /**< <##{doc_id} description#> */\"\n commented_list += \"\\n\" if id != ids.last \n end\n commented_list \n end",
"def trulia_listings(company_id, search_params)\n\t\tsearch_params[:has_primary_agent] = 1\n\t\tsearch_params[:exclusive] = 1\n\t\t# search_params[:is_hide_on_website] = 1\n\t\tsearch_params[:must_have_description] = 1\n\t\tsearch_params[:must_have_streeteasy_flag] = 1\n\t\tsearch_params[:has_hide_from_agent] = 1\n\t\tpull_data(company_id, search_params)\n\tend",
"def mcget_list_menbers(list_id)\n # 82dfd7f973, a38ec3df9c\n begin\n lists_res = setup_mcapi.lists.list({'list_id' => list_id})\n @list = lists_res['data'][0]\n members_res = setup_mcapi.lists.members(list_id)\n @members = members_res['data']\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n redirect_to \"/lists/\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:error] = ex.message\n else\n flash[:error] = \"An unknown error occurred\"\n end\n redirect_to \"/lists/\"\n end\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def create_list(params)\n MailManager::List.create(params)\n end",
"def dids_911_list\n payload[:dids_911].nil? ? nil : payload[:dids_911]\n end",
"def telerivet_contact_ids\n @@SMS_NUMBER_FIELDS.keys\n .map { |attribute| split_sms_numbers(attribute) }\n .flatten\n .map { |sms_number| telerivet_id_cache[sms_number] }\n .reject(&:blank?)\n .uniq\n end",
"def set_email_list\n @email_list = EmailList.find(params[:id])\n end",
"def lists_by_list_id_delete_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_delete ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_delete\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def check_valid_list_id!\n assoc_class = ModelReference.to_record_class_for_type assoc_name.singularize\n assoc_item = assoc_class.where(list_on_attr => list_id).first\n return if assoc_item\n\n raise FphsGeneralError, \"list id does not represent an associated list: #{list_id} for #{assoc_class}\"\n end",
"def identifier_list(*ids, separator: /\\s*,\\s*/, **)\n ids = ids.flat_map { |v| v.is_a?(String) ? v.strip.split(separator) : v }\n ids.map! { |v| v.is_a?(ApplicationRecord) ? v.id : v }\n ids.map! { |v| positive(v) || v }.compact_blank!\n end",
"def contacts\n contacts_raw.present? ? JSON.parse(contacts_raw) : {}\n end",
"def copy_list_contacts_with_http_info(from_list_id, list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.copy_list_contacts ...\"\n end\n # verify the required parameter 'from_list_id' is set\n if @api_client.config.client_side_validation && from_list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'from_list_id' when calling ListsApi.copy_list_contacts\"\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.copy_list_contacts\"\n end\n # resource path\n local_var_path = \"/lists/{listId}/copy\".sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"fromListId\"] = from_list_id\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#copy_list_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_all_contact_activities_with_http_info(contact_id, list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.get_all_contact_activities ...'\n end\n # verify the required parameter 'contact_id' is set\n if @api_client.config.client_side_validation && contact_id.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_id' when calling ContactsApi.get_all_contact_activities\"\n end\n pattern = Regexp.new(/[a-fA-F\\d]{10}/)\n if @api_client.config.client_side_validation && contact_id !~ pattern\n fail ArgumentError, \"invalid value for 'contact_id' when calling ContactsApi.get_all_contact_activities, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.get_all_contact_activities\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.get_all_contact_activities, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling ContactsApi.get_all_contact_activities, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactsApi.get_all_contact_activities, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactsApi.get_all_contact_activities, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"email_open\", \"email_click\", \"forward\", \"conversion\", \"email_send\", \"sms_send\", \"voice_send\", \"mms_send\", \"sms_report\", \"voice_report\", \"invitation_send\", \"invitation_open\", \"mms_open\", \"unsubscribe\", \"email_soft_bounce\", \"email_hard_bounce\", \"subscription\", \"resubscription\", \"unsubscribe_reason\", \"facebook_like\", \"social_share\", \"unsubscribe_manual\", \"double_optin\", \"double_optin_resend\", \"email_spam_complaint\", \"email_field_disable\", \"cellphone_field_disable\", \"phone_field_disable\", \"unsubscribe_api\", \"email_field_enable\", \"cellphone_field_enable\", \"phone_field_enable\", \"edit_subscription\", \"double_optedit\", \"automation_event\", \"push_send\", \"push_open\", \"push_click\", \"push_received\", \"push_error\", \"push_canceled\", \"reply_to_email\", \"web_push_send\", \"web_push_delivered\", \"web_push_open\", \"web_push_bounce\", \"web_push_click\", \"web_push_subscription\", \"web_push_unsubscription\", \"add_push_contact\", \"remove_push_contact\", \"forget_subscription\", \"change_consent\", \"push_unsubscription\", \"voice_menu_event\", \"voice_redirect\", \"automation_action\", \"automation_trigger\", \"push_delivered\", \"attach_tag\", \"detach_tag\", \"smart_sms_send\", \"smart_sms_open\", \"smart_sms_click\", \"smart_sms_report\"]\n if @api_client.config.client_side_validation && opts[:'action_name'] && !allowable_values.include?(opts[:'action_name'])\n fail ArgumentError, \"invalid value for \\\"action_name\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/{contact_id}/activities'.sub('{' + 'contact_id' + '}', CGI.escape(contact_id.to_s)).sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'date_min'] = opts[:'date_min'] if !opts[:'date_min'].nil?\n query_params[:'date_max'] = opts[:'date_max'] if !opts[:'date_max'].nil?\n query_params[:'action_name'] = opts[:'action_name'] if !opts[:'action_name'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ActivityCollection'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.get_all_contact_activities\",\n :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: ContactsApi#get_all_contact_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_pasted_contacts_with_http_info(contact_emails, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.add_pasted_contacts ...\"\n end\n # verify the required parameter 'contact_emails' is set\n if @api_client.config.client_side_validation && contact_emails.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_emails' when calling ContactsApi.add_pasted_contacts\"\n end\n # resource path\n local_var_path = \"/contacts/paste\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"contactEmails\"] = contact_emails\n form_params[\"listInfo\"] = opts[:'list_info'] if !opts[:'list_info'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#add_pasted_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def merge_list!(list_id_or_screen_name)\n case list_id_or_screen_name\n when Integer\n self[:list_id] = list_id_or_screen_name\n when String\n self[:slug] = list_id_or_screen_name\n end\n self\n end",
"def merge_list!(list_id_or_screen_name)\n case list_id_or_screen_name\n when Integer\n self[:list_id] = list_id_or_screen_name\n when String\n self[:slug] = list_id_or_screen_name\n end\n self\n end",
"def listing_bubble_multiple\n ids = params[:ids].split(\",\").map(&:to_i)\n\n @listings = if @current_user || !@current_community.private?\n @current_community.listings.where(listings: {id: ids}).order(\"listings.created_at DESC\")\n else\n []\n end\n\n if !@listings.empty?\n render :partial => \"homepage/listing_bubble_multiple\"\n else\n render :partial => \"bubble_listing_not_visible\"\n end\n end",
"def get_updates(list_id, contact_id)\n get(\"contactLists/#{list_id}/#{contact_id}/updates\")\n end",
"def get_list(options={})\n rsp = @flickr.send_request('flickr.contacts.getList', options)\n collect_contacts(rsp)\n end",
"def mailer_to_list(list, options = {})\n list = list.join(',') if list.is_a?(Array)\n options = {:list_name => list}.merge(options)\n response = post('mailer/to_list', options)\n # response was a string that included RestClient::AbstractResponse,\n # and it overrided #to_i method (which returns status code)\n String.new(response).to_i\n end",
"def list_params\n params.require(:list).permit(:name, :default_room_id, :staff_ratio, :meeting_is_called, :checkin_group, :cadence_id, :parent_id, :id,\n :blurb, :description, weekday_ids: [], meeting_time_ids: [],\n primary_leaderships_attributes: [:person_name, :title, :_destroy, :id],\n support_leaderships_attributes: [:person_name, :title, :_destroy, :id],\n frequency: [:name, :cadence_id])\n end",
"def contact_ids\n (object.added_contacts + object.mutual_contacts).map{|ct| ct.slug }\n end",
"def build_person_list\n person_list = [] # Result array\n uuid_list = {} # Hash to ensure no duplicate UUIDs are retrieved\n benchmark_result = Benchmark.measure do\n people_groups = I3.config.tools[\"contacts\"].settings.limit_to\n if people_groups.nil?\n I3.directory.find_all_people.each do |uuid|\n uuid_list[uuid] = true\n end #each\n else\n people_groups.each do |field, list|\n list.each do |group_dn|\n I3.directory.find_people(field.to_sym, group_dn).each do |uuid|\n uuid_list[uuid] = true\n end #each\n end #each\n end #each\n end #if\n uuid_list.keys.each do |uuid|\n person = I3.directory.read_person(uuid)\n obj = {\n :url => \"/contacts/data/people/\" + CGI.escape(uuid), \n :last_name => person.last_name, \n :first_name => person.first_name, \n :display_name => person.display_name, \n :department => person.department, \n :job_title => person.job_title, \n :company => person.company,\n :email => person.email.find { |key, value| value[:is_primary] == true }.to_a[0], \n :extension => person.extension\n }\n person_list << obj\n end #each\n end #Benchmark.measure\n log.debug \"Total contact list creation time: #{benchmark_result.total}s\"\n return person_list\n end",
"def index\n # Hubspot::Contact.create!(\"aaron@coderfactory.com\", {firstname: \"Test\", lastname: \"Contact\"})\n lists = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts \"HHHHHHHHHHH\"\n listp = lists.first.last.select { |list| list[\"name\"] == \"New Test List\"}\n listp = listp.first\n puts listp[\"name\"]\n puts \"FFFFFFFFFFFFFFF\"\n contact_list = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists/#{listp['listId'].to_i}/contacts/all?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts contact_list[\"contacts\"].first[\"properties\"][\"firstname\"][\"value\"]\n puts \"LLLLLLLLLLLLLL\"\n puts listp\n @enquiries = Enquiry.all\n end",
"def get_all_contacts_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.get_all_contacts ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.get_all_contacts\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.get_all_contacts, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling ContactsApi.get_all_contacts, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactsApi.get_all_contacts, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactsApi.get_all_contacts, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"pt\", \"en\", \"es\", \"br\", \"fr\", \"de\"]\n if @api_client.config.client_side_validation && opts[:'language'] && !allowable_values.include?(opts[:'language'])\n fail ArgumentError, \"invalid value for \\\"language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?\n query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil?\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'email_status'] = opts[:'email_status'] if !opts[:'email_status'].nil?\n query_params[:'cellphone'] = opts[:'cellphone'] if !opts[:'cellphone'].nil?\n query_params[:'cellphone_status'] = opts[:'cellphone_status'] if !opts[:'cellphone_status'].nil?\n query_params[:'phone'] = opts[:'phone'] if !opts[:'phone'].nil?\n query_params[:'phone_status'] = opts[:'phone_status'] if !opts[:'phone_status'].nil?\n query_params[:'birth_date'] = opts[:'birth_date'] if !opts[:'birth_date'].nil?\n query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?\n query_params[:'extra_field_id'] = opts[:'extra_field_id'] if !opts[:'extra_field_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ContactCollection'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.get_all_contacts\",\n :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: ContactsApi#get_all_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end",
"def naked_apts_listings(company_id, search_params)\n\t\tsearch_params[:has_primary_agent] = 1\n\t\tsearch_params[:has_fee_exclusive] = 1\n\t\t# search_params[:is_hide_on_website] = 1\n\t\tsearch_params[:has_naked_apartment] = 1\n\t\tsearch_params[:has_hide_from_agent] = 1\n\t\tpull_data(company_id, search_params)\n\tend",
"def add_contact(list_id, email, attributes = {}, user_status = {})\n endpoint = \"/api/#{@version}/list/#{list_id}/add-contact/\"\n custom_params = {\n 'email' => email,\n 'attributes' => attributes,\n 'user_status' => user_status\n }\n make_post_request(endpoint, custom_params)\n end",
"def list_invite_params\n params.require(:list_invite).permit(:list_id, :user_id, :email, :complete)\n end",
"def parse_taxon_ids_list full_document\n full_document.gsub(/%tl\\[(.*?)\\]/) do\n ids_string = $1\n ids = ids_string.gsub(\" \", \"\").split(\",\")\n\n ids.map do |id|\n try_linking_taxon_id id\n end.join(\", \")\n end\n end",
"def create_areamail_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/areamail/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'areamailsid' => options['areamailsid'],\r\n 'dateCreated' => options['date_created']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def list_params\n params.require(:list).permit(:user_id, :name, :privacy, :status, :description, \n user:[:name, :id], task:[:id, :list_id, :title, :note, :completed])\n end",
"def add_phone_numbers!(list_of_phone_numbers)\n phone_numbers = Expect.normalize_string_to_array(list_of_phone_numbers)\n \n phone_numbers.each do |phone_number|\n add_phone_number!(phone_number)\n end\n end",
"def add_contacts_query(contact_ids)\n # add_contacts_query gets a query string to add contacts to a group.\n # We're using the alternative \"/foo?_method=PUT&key=value\" format to send\n # the contact IDs as GET params. Sending these in the request body would\n # require a painful workaround, as the client sends request bodies as\n # JSON by default. See also:\n # https://developers.messagebird.com/docs/alternatives.\n\n contact_ids.map { |id| \"ids[]=#{id}\" }.join('&').prepend('_method=PUT&')\n end",
"def is_member_of_list(list_name, lead_or_idnum, options={})\n list_operation(list_name, \"ISMEMBEROFLIST\", lead_or_idnum, options)\n end",
"def list_params\n params.require(:list).permit(:name, :campsite_id)\n end",
"def get_lists_of_contact_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_lists_of_contact ...'\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 TextMagicApi.get_lists_of_contact\"\n end\n # resource path\n local_var_path = '/api/v2/contacts/{id}/lists'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetListsOfContactPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_lists_of_contact\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def email_list\n end"
] |
[
"0.6537701",
"0.6409986",
"0.6314376",
"0.6202293",
"0.61447304",
"0.6133586",
"0.61107796",
"0.6053742",
"0.6023222",
"0.6004759",
"0.5993043",
"0.5913859",
"0.58669436",
"0.585816",
"0.58186555",
"0.5792634",
"0.57781297",
"0.577165",
"0.5749327",
"0.5745986",
"0.573956",
"0.57122624",
"0.5701286",
"0.56885046",
"0.5680639",
"0.56786436",
"0.566634",
"0.5664134",
"0.5651075",
"0.560172",
"0.55916023",
"0.5589316",
"0.5548601",
"0.55484307",
"0.5519162",
"0.5513168",
"0.55072737",
"0.5502545",
"0.5499623",
"0.54925805",
"0.54906446",
"0.5476048",
"0.54706717",
"0.54064995",
"0.5406034",
"0.53900576",
"0.5383732",
"0.53658617",
"0.5363693",
"0.53535205",
"0.53530633",
"0.5350979",
"0.53291374",
"0.53278434",
"0.5327172",
"0.5325182",
"0.5324604",
"0.5321364",
"0.5318858",
"0.53042233",
"0.5294364",
"0.5270682",
"0.5246078",
"0.5235295",
"0.52328885",
"0.52328306",
"0.52208555",
"0.5218625",
"0.5218538",
"0.52179134",
"0.5212377",
"0.5201985",
"0.51875603",
"0.518647",
"0.51854765",
"0.5180707",
"0.5180146",
"0.5180146",
"0.5178585",
"0.51771",
"0.5176656",
"0.517615",
"0.51672053",
"0.51629984",
"0.51629704",
"0.51530224",
"0.51438874",
"0.5142174",
"0.51398623",
"0.513937",
"0.51391",
"0.513443",
"0.5132936",
"0.513279",
"0.5128343",
"0.5127256",
"0.5124692",
"0.5122685",
"0.511415",
"0.5109316"
] |
0.70998883
|
0
|
get camelcase version of (caller) method name
|
def self_path
caller_locations(1,1)[0].label.to_s.camelize(:lower)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def camelize_methodname\n self.titleize.gsub(' ', '').camelize(:lower)\n end",
"def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end",
"def getMethodName(description)\n description[0] = description[0].downcase\n description.to_s.gsub(' ', '')\n end",
"def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end",
"def camel_case_method?\n method_name.to_s =~ /\\A[A-Z]/\n end",
"def sanitize_method_name( name )\n name.to_s.camelize\n end",
"def capitalize\n \"Foo\"\n end",
"def ga_to_method_name(name)\n snakecase(name.gsub(/\\Aga:/, \"\")).to_sym\n end",
"def method_name\r\n method_info[:method_name]\r\n end",
"def method_to_string(method)\n method = method.to_s\n array = method.split('_')\n string = array.join(\" \")\n string.capitalize!\n end",
"def method\n env[:method].to_s.upcase\n end",
"def camel_case(str); end",
"def name\n \"#{@method_name}(#{self.class.name})\"\n end",
"def method_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 3]\n end",
"def capitalize_name(name)\n name.call\nend",
"def capitalize!() end",
"def singularized_method_name method\n (method.predicate? ? method[0..-2] : method).singularize.to_sym\n end",
"def camelcase(s)\n\n\nend",
"def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end",
"def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end",
"def caller_method_name\n parse_caller(caller(2).first).last\n end",
"def capitalize() end",
"def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end",
"def methodCallingMethod(str)\n puts \"#{str}\".upcase\n str\nend",
"def name\n 'method 2'\n end",
"def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"def build_method_name\n \"#{METHOD_PREFIX}#{super}\"\n end",
"def build_method_name\n \"#{METHOD_PREFIX}#{super}\"\n end",
"def function_name\n full_name.to_underscore\n end",
"def method(method = nil)\n return @method if method.nil?\n\n @method = method.to_s.capitalize\n end",
"def name\n \"#{self.class.name}::#{@method_name}()\"\n end",
"def agent_name(*args)\n name_parts = self.class.name.split('::')[-2,2]\n if(args.include?(:camel))\n name_parts.join('')\n else\n name_parts.join('_').downcase\n end\n end",
"def full_name\n @full_name ||= \"#{@klass}##{@method_name}\"\n end",
"def method_name\n deface_hash = Deface::Override.digest(:virtual_path => @virtual_path)\n\n #we digest the whole method name as if it gets too long there's problems\n \"_#{Deface::Digest.hexdigest(\"#{deface_hash}_#{super}\")}\"\n end",
"def genability_method_name_converter(method_name)\n method_name.to_s.gsub(/(?:^|_)(.)/){ $1.upcase }.gsub(/^[A-Z]/){ $&.downcase }.to_sym\n end",
"def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def aliased_method_name(method_name)\r\n last_letter = method_name.to_s[method_name.to_s.size-1]\r\n if %w(? !).member? last_letter\r\n # remove ? and ! from the middle and put it to the end\r\n (method_name.to_s.chop!+\"_in_#{self.simple_name.to_snake_case}#{last_letter}\").to_sym\r\n else\r\n (method_name.to_s+\"_in_#{self.simple_name.to_snake_case}\").to_sym\r\n end\r\n end",
"def method\n self.class.name.split('::').last || ''\n end",
"def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend",
"def capitalized\n name.titleize.capitalize\n end",
"def caller_method_name\n parse_caller(caller(2).first).last\nend",
"def downcase_name\n name.downcase!\n end",
"def capitalize\n (self.to_s.capitalize! || self).to_sym\n end",
"def downcase() end",
"def instance_method(arg)\n arg.upcase\nend",
"def downcase; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def downcase!() end",
"def camel(snake_case)\n snake_case.to_s.capitalize.gsub(/_./) { |match| match[1].upcase }\n end",
"def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend",
"def callname\n @_callname ||= dup.\n gsub(/[Ää]+/i,'ae').\n gsub(/[Üü]+/i,'ue').\n gsub(/[Öö]+/i,'oe').\n gsub(/[ß]+/i,'ss').\n downcase.\n gsub(/[^a-z0-9]+/i, '-').\n gsub(/(^[-]+|[-]+$)/, '')\n end",
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def test_Method_InstanceMethods_meth\n\t\tmethod = \"cat\".method(:upcase)\n\t\tassert_equal(\"upcase\", method.name.to_s)\n\tend",
"def to_camel_case\n return self if self !~ /_/ && self !~ /\\s/ && self =~ /^[A-Z]+.*/\n\n gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, \"_\")\n .split(\"_\").map(&:capitalize).join\n end",
"def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"def uppercase_name\n # self.name.upcase\n name.upcase #self is the implicit reciever\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def derived_name\n return controller_name if respond_to?(:controller_name)\n return model_name.plural if respond_to?(:model_name)\n name ? name.underscore.pluralize : nil\n end",
"def name\n n = self.class.name\n n.gsub!( /::/, '.' )\n n.gsub( /(\\w)\\w+\\./ ) { |m| $1.downcase + '.' }\n end",
"def human_name\n name.capitalize.to_s\n end",
"def upcase\n (self.to_s.upcase! || self).to_sym\n end",
"def snake_case(name); end",
"def method_name\n return @method_name if defined? @method_name\n\n @method_name = protocol_name.downcase.sub(/::/, '_')\n end",
"def action_name\n @action.to_s.upcase\n end",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def camelize\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def capitalize_name!\n @fullname = @fullname.upcase\n return @fullname.upcase\n end",
"def command_name\n klass_name = self.class.name.split('::').last\n command = klass_name.gsub(/([^\\^])([A-Z])/, '\\1_\\2').downcase\n command\n end",
"def upcase\n @name.upcase\n end",
"def downcase\n (self.to_s.downcase! || self).to_sym\n end",
"def callback_name(name)\n return name.gsub(/([^A-Z]+)([A-Z]+)/, '\\\\1_\\\\2').downcase\n end",
"def upcase() end",
"def method_auth_name\r\n method_info[:method_auth_name]\r\n end",
"def extract_method_name(line)\n line.strip.split('def ')[1]\n end",
"def capitalize(word)\n\nend",
"def to_s\n self.name.capitalize\n end",
"def upcase; end",
"def spy_name(real_name)\n capitalize(next_letter(swap(real_name)))\nend",
"def parse_method(method)\n method.downcase.to_sym\n end",
"def shout (maj)\n maj.upcase\nend",
"def upcase!() end",
"def name\n self.class.name.split(\"::\").last.downcase\n end",
"def downcase_first\n ActiveSupport::Inflector.downcase_first(self)\n end"
] |
[
"0.7676575",
"0.7536481",
"0.730788",
"0.72017646",
"0.71573156",
"0.71016043",
"0.70587593",
"0.70470953",
"0.7045474",
"0.70172",
"0.6978949",
"0.69406974",
"0.69333833",
"0.6916254",
"0.6914116",
"0.6911857",
"0.69048226",
"0.6902803",
"0.6886511",
"0.6886511",
"0.6854511",
"0.6841146",
"0.6823995",
"0.68133867",
"0.67990613",
"0.6769529",
"0.6769529",
"0.6769529",
"0.6768071",
"0.6768071",
"0.6764213",
"0.6762474",
"0.6742322",
"0.67380744",
"0.67358714",
"0.67031986",
"0.66660225",
"0.6652036",
"0.6650839",
"0.6645566",
"0.6645566",
"0.66368055",
"0.6623616",
"0.6622707",
"0.6609589",
"0.658801",
"0.6583997",
"0.6561264",
"0.65410674",
"0.65338165",
"0.6516497",
"0.651",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6500265",
"0.6487664",
"0.646544",
"0.6465412",
"0.646487",
"0.64471686",
"0.6443615",
"0.6436616",
"0.6426817",
"0.642074",
"0.64206374",
"0.64206374",
"0.64116883",
"0.64020073",
"0.6401658",
"0.63658863",
"0.6350044",
"0.63467556",
"0.6346375",
"0.6340789",
"0.6330108",
"0.6326655",
"0.6320169",
"0.6318248",
"0.63138545",
"0.62997234",
"0.6290632",
"0.62812614",
"0.62604904",
"0.6253904",
"0.62509495",
"0.62482464",
"0.6246649",
"0.6245762",
"0.62314445",
"0.6229713",
"0.62286896",
"0.62273914"
] |
0.0
|
-1
|
sets up a new hit
|
def initialize(tracker, options = {}, query_string = '')
self.tracker = tracker
self.options = OptionSet.new(convert_booleans(options))
self.custom_params.merge! parse_parameter_string(query_string)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_hit\n @hit = Hit.find(params[:id])\n end",
"def hit; end",
"def add_hit\n @hits += 1\n :hit\n end",
"def newHit(cap, imp, pos)\n pos= 8191 if pos > 8191\n newHit = 0b0000000000000000 | cap << 15 | imp << 13 | pos\n end",
"def hit=(_arg0); end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def create_hits_form\n @hit = Hit.new(\n :rewardAmount => 0.05,\n :lifetimeInSeconds => 3600 * 24 * 7,\n :autoApprovalDelayInSeconds => 3600 * 24,\n :assignmentDurationInSeconds => 60 * 5,\n :maxAssignments => 3)\n end",
"def hit(card)\n @cards[@cards.length] = card\n end",
"def create\n @hit = Hit.new(params[:hit])\n\n respond_to do |format|\n if @hit.save\n format.html { redirect_to @hit, notice: 'Hit was successfully created.' }\n format.json { render json: @hit, status: :created, location: @hit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(x, y)\n @x = x\n @y = y\n @hit = false\n end",
"def new_hits(hits)\n @log << {code: @code, hits: hits}\n nil\n end",
"def hit_id=(value)\n @hit_id = value\n end",
"def store_hits(turn, hits)\n @hits[turn] = hits\n end",
"def hit(timestamp)\n \n end",
"def setup(stash, point)\n\t\t@stash = stash\n\t\t\n\t\t\n\tend",
"def set_news_hit\n @news_hit = NewsHit.find(params[:id])\n end",
"def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end",
"def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end",
"def create\n @hit = Hit.new(hit_params)\n\n respond_to do |format|\n if @hit.save\n format.html { redirect_to @hit, notice: 'Batida criado com sucesso.' }\n format.json { render :show, status: :created, location: @hit }\n else\n format.html { render :new }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup(stash, point)\n\t\t@stash = stash\n\t\t\n\t\t# ah, but this assumes that all Entity objects can be created without parameters\n\t\tobj = @klass.new\n\t\tobj[:physics].body.p = point\n\t\t@space.entities.add obj\n\t\t\n\tend",
"def new_hits(code, hits)\n @log << {code: code, hits: hits}\n nil\n end",
"def setup_timed_hit\n @timed_hit = nil\n if @acts[1].class == Hash\n @timed_hit_setup = TIMED_HIT_SETUP.merge(@acts[1])\n return\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = @acts[1]\n button = (@acts[2].nil? ? [TIMED_HIT_DEFAULT_BUTTON] : @acts[2])\n button = [button] unless button.is_a?(Array)\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL] = button\n @timed_hit_setup[TIMED_HIT_ANIME_SYMBOL] = @acts[3] || TimedHit_Anim\n @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW] = (@acts[4].nil? ? true : @acts[4])\n end",
"def hit(card)\n @cards << card\n end",
"def increment_hit_count()\n hit = nil\n begin\n hit = hits.find_or_create_by_hit_date!(Time.now.to_date)\n rescue ActiveRecord::RecordInvalid\n hit = hits.find_by_hit_date(Time.now.to_date)\n end\n hit.count += 1\n hit.save!\n end",
"def initialize\n @hit_soft_17 = nil\n super()\n end",
"def reset_timed_hit\n @timed_hit = nil\n @timed_hit_setup = TIMED_HIT_SETUP.clone\n end",
"def i_hit(others, velocity); end",
"def hit!\n\t\t@cards << @deck.take!\n\tend",
"def press(point)\n\t\t# mark the initial point for reference\n\t\t@origin = point\n\t\t@start = @entity[:physics].body.p.clone\n\tend",
"def increment_hits\n @node.increment_hits! if @node\n end",
"def hit\n coin = spawn :coin, :x => x, :y => y-40\n coin.collect\n\n @active = false\n @inactive_timer = HIT_RATE if has_more?\n end",
"def hit\n self.damage = damage + 1\n check_boat\n end",
"def hit(hand)\n hand.push(random_card)\n end",
"def initialize(level=1)\n @level = level\n\n @max_damage = @max_damage || 4\n # a += 1 --> a = a + 1\n # a ||= 1 --> a = a || 1\n # @hit_points_per_level = @hit_points_per_level || 10\n @hit_points_per_level ||= 10 # set a default\n\n @hit_points = @level * @hit_points_per_level\n end",
"def update_timed_hit\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL].each do |button|\n if Input.trigger?(button)\n @timed_hit = button\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = 1\n anim = $data_animations[@timed_hit_setup[TIMED_HIT_ANIME_SYMBOL]]\n follow = $game_temp.anim_follow\n $game_temp.anim_follow = @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW]\n sprite.start_animation(anim, flip)\n $game_temp.anim_follow = follow\n on_timed_hit_success\n break\n end\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] -= 1\n end",
"def create_hitting(hitting_xml)\n hitting = map_attributes_to_hash(hitting_xml.attributes)\n add_common_attributes(hitting, hitting_xml)\n hitting\n end",
"def new\n @hit = Hit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hit }\n end\n end",
"def handle_hit_obstacle(object)\n end",
"def add_hit(log_item)\n @mutex.synchronize do\n @cache[log_item.section] = 1 + @cache.fetch(log_item.section, 0)\n end\n end",
"def set_gig_request\n #we use the hashids gem to create a reversible hash with seed calebWillNeverSeeThis and key params[:id]\n id = Hashids.new(\"calebWillNeverSeeThis\").decode(params[:id]).try(:first)\n #then use that hash to index the request. check /models/gig_request.rb for the override.\n @gig_request = GigRequest.find(id)\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def initialize(name, hitpoints, attack_damage)\n @name = name\n @hitpoints = hitpoints\n @attack_damage = attack_damage\n end",
"def initialize(name, hitpoints, attack_damage)\n @name = name\n @hitpoints = hitpoints\n @attack_damage = attack_damage\n end",
"def hit_params\n params.require(:hit).permit(:name, :product_id, :composition_id, :residue, hit_items_attributes: [:raw_material_id, :weight])\n end",
"def initialize(coordinate)\n @coordinate = coordinate\n @ship = nil\n @been_hit = false\n end",
"def hit\n @printer = []\n @printer << \"You Hit.\"\n deal_player\n pl_total\n if session[:player].bust? || session[:player].hand_total == 21\n @action = :end\n run_dealer\n else\n @action = :choice\n end\n chat\n end",
"def take_hit_at(x_coord, y_coord)\n #if @position.is_equal_to(x_coord, y_coord)\n if @position == Point.new(x_coord, y_coord)\n @is_hit = true\n end\n end",
"def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end",
"def set_hits(results, weights)\n results.each {|item| item.hits = weights[item.name] }\n end",
"def initialize hp, *params\n super params\n @hp = hp.abs\n @hp = @hp > MAX_HITPOINT ? MAX_HITPOINT : @hp \n end",
"def reset_hit_count\n \"0\"\n end",
"def initialize\n # create and locate the shovel\n shovel.location = start_room\n end",
"def initialize\n @@spots = {}\n @@fines = {}\n end",
"def initialize(map_id, event)\n super()\n @map_id = map_id\n @event = event\n @id = @event.id\n @erased = false\n @starting = false\n @through = true\n moveto(@event.x, @event.y) # Move to initial position\n refresh\n end",
"def hit\n @cards.push @deck.shift\n end",
"def record_hit(snake_positions)\n # increasing the user score\n @score += 1\n # new food position\n in_process = true\n test_food_x = 0\n test_food_y = 0\n # food never will apear in a position equals to some location\n # of snake body\n while in_process\n test_food_x = rand(GRID_WIDTH)\n test_food_y = rand(GRID_HEIGHT)\n food_is_crossed = false\n snake_positions.each do |pos|\n if pos[0] == test_food_x && pos[1] == test_food_y\n food_is_crossed = true\n end\n end\n unless food_is_crossed\n in_process = false\n end\n end\n @food_x = test_food_x\n @food_y = test_food_y\n end",
"def hit(deck)\n @hand << deck.draw!\n end",
"def protein_hit(hit)\n key = \"h#{hit}\"\n return nil unless str = data[key]\n @protein_hits[hit] ||= parse_protein_hit(str, data[\"#{key}_text\"], query_hits(hit))\n end",
"def get_hit(a_point)\n\toccupied_points.reject! { |point| point.is_equal(a_point) }\n\tset_state('damage') \n\tcheck_if_is_sink()\n end",
"def set_male_shot_put_head\n @male_shot_put_head = MaleShotPutHead.find(params[:id])\n end",
"def initialize(hits,miss,entries,size)\n @cache_hits=hits\n @cache_miss=miss\n @cache_entries=entries\n @cache_size=size\n end",
"def update!(**args)\n @anchorinfo = args[:anchorinfo] if args.key?(:anchorinfo)\n @begin = args[:begin] if args.key?(:begin)\n @end = args[:end] if args.key?(:end)\n @items = args[:items] if args.key?(:items)\n @score = args[:score] if args.key?(:score)\n @text = args[:text] if args.key?(:text)\n @type = args[:type] if args.key?(:type)\n end",
"def set_route_instance_tank_hose_interaction\n @route_instance_tank_hose_interaction = RouteInstanceTankHoseInteraction.find(params[:id])\n end",
"def settle(team)\n self.team = team\n \n if self.is_home_team?\n self.match.home_team = team\n else\n self.match.away_team = team\n end\n self.match.save!\n self.save!\n end",
"def create_hitsets_and_post(n)\n (n/5).times{self.create_a_hit_and_post!}\n end",
"def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_pos(x=0,y=0)\n\n # E.g. for a yet to be hit submarine placed at starting position (0,0) horizontally, pos will be:\n # pos [ {:x => 0, :y => 0, :hit => 0 }, {:x => 1, :y => 0, :hit => 0 } ]\n @pos << {:x => x, :y => y, :hit => 0 }\n\n end",
"def update_pos(x=0,y=0)\n\n # E.g. for a yet to be hit submarine placed at starting position (0,0) horizontally, pos will be:\n # pos [ {:x => 0, :y => 0, :hit => 0 }, {:x => 1, :y => 0, :hit => 0 } ]\n @pos << {:x => x, :y => y, :hit => 0 }\n\n end",
"def setup_new_gamertag\n raise MissingGamertag, \"No GamerTag was passed\" if name_downcase.blank?\n log_me \"GAMERTAG CREATE :: #{name_downcase} :: STARTED!\"\n Gamertag.transaction do\n self.name = name_downcase\n @front_page = get_page(bungie_net_front_page_url) if @front_page.blank?\n update_front_page_stats\n end\n end",
"def query_hits(hit)\n query = 1\n while data.has_key?(\"h#{hit}_q#{query}\")\n query_hit(hit, query)\n query += 1 \n end\n \n @query_hits[hit]\n end",
"def hit!\n raise ActiveRecord::MissingAttributeError, \"can't hit! #{ self.short_inspect }, missing attribute: views\" unless respond_to?(:views)\n self.class.increment_counter(:views, id)\n end",
"def hit (deck)\n @hand << deck.deal_card\n calc_score\n true\n end",
"def receive_damage\n @hit_points-= 10\n end",
"def hit_count()\n #This is a stub, used for indexing\n end",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def set_shot\n @shot = Shot.find(params[:id])\n end",
"def set_shot\n @shot = Shot.find(params[:id])\n end",
"def set_shot\n @shot = Shot.find(params[:id])\n end",
"def new\n friend_client.refresh() if params[:refresh] == 'true'\n @unmatched_hits = []\n @matched_hits = []\n @questionable_hits = []\n search_and_match_in_cache do |hit, matches|\n case matches.count\n when 0 then @unmatched_hits << hit\n when 1 then @matched_hits << hit\n else @questionable_hits << hit\n end\n end\n set_counts\n end",
"def hit\n @access_count = DATABASE.hit(self) || @access_count\n end",
"def initialize()\r\n\t\t@time = Timer.new # the time the user has made\r\n\t\t@penalty = Penalty.new # the penalty time on the map\r\n\t\tself.reset()\r\n\tend",
"def setpoint_to_target\n @setpoint = @freq_target\n end",
"def set_tracking\n end",
"def hit(key, *modifiers)\n compatible_call :hit, key, *modifiers\n end",
"def createHIT(campaign)\n\n \t puts \"Loading configuration properties from database.\"\n \t # In this sample, the qualification is defined in the properties file.\n \t props = Amazon::Util::DataReader.parse_properties(campaign.turk_properties)\n \t props[:Reward] = { :Amount => 0.50, :CurrencyCode => 'USD'}\n \t puts \"Properties: \" + props.to_s\n \t # Loading the question (QuestionForm) file.\n \t question = campaign.turk_question\n \t puts \"Parsed all configuration information\"\n\n \t # no validation\n \t puts \"Creating HIT...\"\n \t result = @mturk.createHIT( {:Question => question}.merge(props) )\n \t puts \"Created HIT: \" + result.to_s\n \t \n \t # Save the result to the database so we don't lose it\n \t hit = TurkHit.new\n \t hit.hit_id = result[:HITId]\n \t hit.hit_type_id = result[:HITTypeId]\n \t hit.save\n \tend",
"def initialize\n @obstacles = Set.new\n end",
"def update\n respond_to do |format|\n if @hit.update(hit_params)\n format.html { redirect_to @hit, notice: 'Batida atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @hit }\n else\n format.html { render :edit }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_shot\n @shot = Shot.friendly.find(params[:id])\n end",
"def hit()\n #first it runs through all the asteroids and checks if itself is inside one\n for k in GameManager.getAsteroids()\n if Intersect.new([@model.x,@model.y,@size],[k.pos.x,k.pos.y,k.size]).calculate()\n #if it detects it is in an asteroid it calls that asteroids split function and then kills itself\n #it sends the ship that shot it its powerup value and tint so the ship can interpret it\n @ship.powerUp(k.type,k.tint[k.type])\n k.split()\n @ship.points += @ship.pointAdd\n if @ship.pierce == false\n self.kill()\n end\n end\n end\n end",
"def update!(**args)\n @segment_sequence_steps = args[:segment_sequence_steps] if args.key?(:segment_sequence_steps)\n @first_step_should_match_first_hit = args[:first_step_should_match_first_hit] if args.key?(:first_step_should_match_first_hit)\n end",
"def initialize(str)\n str = str.sub(/\\A\\s+/, '')\n str.sub!(/\\n(^\\-\\-SPIDEY .*)/m, '') # remove trailing entries for sure\n @entry_overrun = $1\n data = str.split(/\\r?\\n(?:\\r?\\n)+/)\n d0 = data.shift.to_s.split(/\\r?\\n/)\n @hit = Hit.new(data, d0)\n @all_hits = [ @hit ]\n if d0.empty? or /\\ANo alignment found\\.\\s*\\z/ =~ d0[-1] then\n @hits = []\n else\n @hits = [ @hit ]\n end\n end",
"def update_game_state guess\n\t\tif @word.include?(guess)\n\t\t\t@hits << guess\n\t\telse\n\t\t\t@misses << guess\n\t\t\t@guesses_left -= 1\n\t\tend\n\tend",
"def populate_hits(session)\n id_hit_hash = Hash.new { |h, k| h[k] = {} }\n hits.each do |hit|\n id_hit_hash[hit.class_name][hit.primary_key] = hit\n end\n id_hit_hash.each_pair do |class_name, hits|\n hits_for_class = id_hit_hash[class_name]\n hits.each do |hit_pair|\n hit_pair[1].result = session[class_name].from_solr(hit_pair[1].stored_values)\n end\n end\n end",
"def reset_hit_count=(is_reset)\n self.hit_count = 0 if is_reset == \"1\"\n end",
"def rturk_hit_full(id)\n RTurk::Hit.new(id, nil, :include_assignment_summary => true)\n end",
"def setup(id)\n @maps.clear\n @maps[0]=Game_Map.new\n @mapIndex=0\n oldID=(!$game_map) ? 0 : $game_map.map_id\n if oldID!=0 && oldID!=@maps[0]\n setMapChanging(id,@maps[0])\n end\n $game_map=@maps[0]\n @maps[0].setup(id)\n setMapsInRange\n setMapChanged(oldID)\n end",
"def gotAttack(damage)\r\n @hitpoint -= damage\r\n end",
"def hit_id\n return @hit_id\n end",
"def update!(**args)\n @bounding_marker = args[:bounding_marker] if args.key?(:bounding_marker)\n @connection_token = args[:connection_token] if args.key?(:connection_token)\n @curve = args[:curve] if args.key?(:curve)\n @flow = args[:flow] if args.key?(:flow)\n @lane_number = args[:lane_number] if args.key?(:lane_number)\n @primary_connection = args[:primary_connection] if args.key?(:primary_connection)\n @segment = args[:segment] if args.key?(:segment)\n @yield_to_other_connections = args[:yield_to_other_connections] if args.key?(:yield_to_other_connections)\n end",
"def modify_opponent_field_map index, move\n\t\thit = index == 10 ? \"#{Symbols::HIT} \" : Symbols::HIT\n\t\tmiss = index == 10 ? \"#{Symbols::MISS} \" : Symbols::MISS\n\t\t@opponent_field_map[index] = move.hit ? hit : miss\n\tend"
] |
[
"0.74592113",
"0.6873877",
"0.66228056",
"0.65721893",
"0.64456093",
"0.6355028",
"0.61643547",
"0.6117844",
"0.60593784",
"0.6007196",
"0.6006311",
"0.59244245",
"0.58541465",
"0.58380544",
"0.58306247",
"0.5787732",
"0.57863384",
"0.57863384",
"0.57689345",
"0.57485586",
"0.57315624",
"0.56922364",
"0.5610965",
"0.55958253",
"0.55821615",
"0.5538715",
"0.55295265",
"0.55097264",
"0.5469069",
"0.5439731",
"0.54151446",
"0.5333923",
"0.5333496",
"0.5331299",
"0.5311386",
"0.5297866",
"0.5268986",
"0.52623034",
"0.5236497",
"0.52332366",
"0.52188456",
"0.52185583",
"0.5213448",
"0.51937693",
"0.51883507",
"0.51853275",
"0.5176888",
"0.51759857",
"0.5169487",
"0.515684",
"0.5155982",
"0.5149114",
"0.51479363",
"0.5139271",
"0.5136603",
"0.5119152",
"0.50886744",
"0.5087643",
"0.5086919",
"0.50791734",
"0.50790435",
"0.5069445",
"0.5064502",
"0.50643593",
"0.5061889",
"0.50586665",
"0.5056845",
"0.5056845",
"0.5032633",
"0.5030673",
"0.5025007",
"0.5024845",
"0.50148845",
"0.5008359",
"0.49950662",
"0.49950662",
"0.499266",
"0.499266",
"0.499266",
"0.4991231",
"0.49890473",
"0.49795336",
"0.4979364",
"0.49790013",
"0.4976596",
"0.4973724",
"0.49718875",
"0.49714044",
"0.49640727",
"0.49605277",
"0.4935183",
"0.49277604",
"0.49147728",
"0.48974556",
"0.48953804",
"0.48945788",
"0.48930743",
"0.4886619",
"0.48832867",
"0.4868532",
"0.48604128"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.